select options for products + skus, photos form

This commit is contained in:
2025-10-12 02:20:02 -07:00
parent 30aad1dea4
commit 9f1959a0ee
7 changed files with 102 additions and 8 deletions

View File

@@ -8,17 +8,53 @@
*/
$includeFile = $includeFile ?? false;
echo $this->Form->control('product_catalog_id', [
'empty' => 'Select a Catalog',
'options' => $productCatalogs ?? [],
'hx-trigger' => 'change, load delay:500ms',
'hx-get' => $this->Url->build([
'controller' => 'ProductCategories',
'action' => 'select',
'?' => ['form' => 'product_photo'],
]),
'hx-target' => '#product_category_id',
]);
echo $this->Form->control('product_category_id', [
'options' => [],
'empty' => true,
'id' => 'product_category_id',
'hx-trigger' => 'change, load delay:1s',
'hx-get' => $this->Url->build([
'controller' => 'Products',
'action' => 'select',
'?' => ['form' => 'product_photo'],
]),
'hx-target' => '#product_id',
]);
echo $this->Form->control('product_id', [
'options' => $products ?? [],
'empty' => true,
'hx-trigger' => 'change, load delay:1s',
'id' => 'product_id',
'hx-get' => $this->Url->build([
'controller' => 'ProductSkus',
'action' => 'select',
'?' => ['form' => 'product'],
]),
'hx-target' => '#product_sku_id',
]);
echo $this->Form->control('product_sku_id', [
'options' => $productSkus ?? []
'options' => $productSkus ?? [],
'empty' => true,
'id' => 'product_sku_id',
]);
echo $includeFile ? $this->Form->control('photo', [
'type' => 'file',
]) : '';
echo $this->Form->control('primary_photo');
echo $this->Form->control('primary_category_photo');
echo $this->Form->control('photo_position');
echo $this->Form->control('enabled');
?>