template updates - htmx on categories form

This commit is contained in:
2025-03-28 00:13:42 -07:00
parent a9a79ffb1d
commit 9e5df45f59
6 changed files with 45 additions and 16 deletions

View File

@@ -0,0 +1,30 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $productCategory
* @var \Cake\Collection\CollectionInterface|string[] $productCatalogs
* @var string|null $prefix
*/
echo $this->Form->control('product_catalog_id', [
'options' => $productCatalogs,
'hx-trigger' => 'change, load delay:1s',
'hx-get' => $this->Url->build([
'plugin' => 'CakeProducts',
'controller' => 'ProductCategories',
'action' => 'select',
'?' => [
'category_id' => $productCategory->parent_id ?? '',
],
]),
'hx-target' => '#product_category_parent_id',
]);
echo $this->Form->control('name');
echo $this->Form->control('category_description');
echo $this->Form->control('parent_id', [
'options' => $parentProductCategories,
'empty' => true,
'id' => 'product_category_parent_id',
]);
echo $this->Form->control('enabled');
?>