wip product category variants

This commit is contained in:
2025-06-29 21:52:07 -07:00
parent a01805dc53
commit f61a4161be
12 changed files with 502 additions and 16 deletions

View File

@@ -0,0 +1,33 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\ProductCategoryVariant $productCategoryVariant
* @var \Cake\Collection\CollectionInterface|string[] $productCategories
* @var \Cake\Collection\CollectionInterface|string[] $products
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('List Product Category Variants'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productCategoryVariants form content">
<?= $this->Form->create($productCategoryVariant) ?>
<fieldset>
<legend><?= __('Add Product Category Variant') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('product_category_id', ['options' => $productCategories, 'empty' => true]);
echo $this->Form->control('product_id', ['options' => $products, 'empty' => true]);
echo $this->Form->control('attribute_type_id');
echo $this->Form->control('enabled');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,38 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\ProductCategoryVariant $productCategoryVariant
* @var string[]|\Cake\Collection\CollectionInterface $productCategories
* @var string[]|\Cake\Collection\CollectionInterface $products
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Form->postLink(
__('Delete'),
['action' => 'delete', $productCategoryVariant->id],
['confirm' => __('Are you sure you want to delete # {0}?', $productCategoryVariant->id), 'class' => 'side-nav-item']
) ?>
<?= $this->Html->link(__('List Product Category Variants'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productCategoryVariants form content">
<?= $this->Form->create($productCategoryVariant) ?>
<fieldset>
<legend><?= __('Edit Product Category Variant') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('product_category_id', ['options' => $productCategories, 'empty' => true]);
echo $this->Form->control('product_id', ['options' => $products, 'empty' => true]);
echo $this->Form->control('attribute_type_id');
echo $this->Form->control('enabled');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,52 @@
<?php
/**
* @var \App\View\AppView $this
* @var iterable<\App\Model\Entity\ProductCategoryVariant> $productCategoryVariants
*/
?>
<div class="productCategoryVariants index content">
<?= $this->Html->link(__('New Product Category Variant'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Product Category Variants') ?></h3>
<div class="table-responsive" id="table-container">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('name') ?></th>
<th><?= $this->Paginator->sort('product_category_id') ?></th>
<th><?= $this->Paginator->sort('product_id') ?></th>
<th><?= $this->Paginator->sort('attribute_type_id') ?></th>
<th><?= $this->Paginator->sort('enabled') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($productCategoryVariants as $productCategoryVariant): ?>
<tr>
<td><?= h($productCategoryVariant->id) ?></td>
<td><?= h($productCategoryVariant->name) ?></td>
<td><?= $productCategoryVariant->hasValue('product_category') ? $this->Html->link($productCategoryVariant->product_category->name, ['controller' => 'ProductCategories', 'action' => 'view', $productCategoryVariant->product_category->id]) : '' ?></td>
<td><?= $productCategoryVariant->hasValue('product') ? $this->Html->link($productCategoryVariant->product->name, ['controller' => 'Products', 'action' => 'view', $productCategoryVariant->product->id]) : '' ?></td>
<td><?= $this->Number->format($productCategoryVariant->attribute_type_id) ?></td>
<td><?= h($productCategoryVariant->enabled) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $productCategoryVariant->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $productCategoryVariant->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $productCategoryVariant->id], ['confirm' => __('Are you sure you want to delete # {0}?', $productCategoryVariant->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\ProductCategoryVariant $productCategoryVariant
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('Edit Product Category Variant'), ['action' => 'edit', $productCategoryVariant->id], ['class' => 'side-nav-item']) ?>
<?= $this->Form->postLink(__('Delete Product Category Variant'), ['action' => 'delete', $productCategoryVariant->id], ['confirm' => __('Are you sure you want to delete # {0}?', $productCategoryVariant->id), 'class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('List Product Category Variants'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('New Product Category Variant'), ['action' => 'add'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productCategoryVariants view content">
<h3><?= h($productCategoryVariant->name) ?></h3>
<table>
<tr>
<th><?= __('Id') ?></th>
<td><?= h($productCategoryVariant->id) ?></td>
</tr>
<tr>
<th><?= __('Name') ?></th>
<td><?= h($productCategoryVariant->name) ?></td>
</tr>
<tr>
<th><?= __('Product Category') ?></th>
<td><?= $productCategoryVariant->hasValue('product_category') ? $this->Html->link($productCategoryVariant->product_category->name, ['controller' => 'ProductCategories', 'action' => 'view', $productCategoryVariant->product_category->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Product') ?></th>
<td><?= $productCategoryVariant->hasValue('product') ? $this->Html->link($productCategoryVariant->product->name, ['controller' => 'Products', 'action' => 'view', $productCategoryVariant->product->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Attribute Type Id') ?></th>
<td><?= $this->Number->format($productCategoryVariant->attribute_type_id) ?></td>
</tr>
<tr>
<th><?= __('Enabled') ?></th>
<td><?= $productCategoryVariant->enabled ? __('Yes') : __('No'); ?></td>
</tr>
</table>
</div>
</div>
</div>