bring into standalone plugin for distribution
This commit is contained in:
30
templates/Products/add.php
Normal file
30
templates/Products/add.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \Cake\Datasource\EntityInterface $product
|
||||
* @var \Cake\Collection\CollectionInterface|string[] $productCategories
|
||||
*/
|
||||
?>
|
||||
<div class="row">
|
||||
<aside class="column">
|
||||
<div class="side-nav">
|
||||
<h4 class="heading"><?= __('Actions') ?></h4>
|
||||
<?= $this->Html->link(__('List Products'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="column column-80">
|
||||
<div class="products form content">
|
||||
<?= $this->Form->create($product) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Add Product') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('name');
|
||||
echo $this->Form->control('product_category_id', ['options' => $productCategories]);
|
||||
echo $this->Form->control('product_type_id');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
35
templates/Products/edit.php
Normal file
35
templates/Products/edit.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \Cake\Datasource\EntityInterface $product
|
||||
* @var string[]|\Cake\Collection\CollectionInterface $productCategories
|
||||
*/
|
||||
?>
|
||||
<div class="row">
|
||||
<aside class="column">
|
||||
<div class="side-nav">
|
||||
<h4 class="heading"><?= __('Actions') ?></h4>
|
||||
<?= $this->Form->postLink(
|
||||
__('Delete'),
|
||||
['action' => 'delete', $product->id],
|
||||
['confirm' => __('Are you sure you want to delete # {0}?', $product->id), 'class' => 'side-nav-item']
|
||||
) ?>
|
||||
<?= $this->Html->link(__('List Products'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="column column-80">
|
||||
<div class="products form content">
|
||||
<?= $this->Form->create($product) ?>
|
||||
<fieldset>
|
||||
<legend><?= __('Edit Product') ?></legend>
|
||||
<?php
|
||||
echo $this->Form->control('name');
|
||||
echo $this->Form->control('product_category_id', ['options' => $productCategories]);
|
||||
echo $this->Form->control('product_type_id');
|
||||
?>
|
||||
</fieldset>
|
||||
<?= $this->Form->button(__('Submit')) ?>
|
||||
<?= $this->Form->end() ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
48
templates/Products/index.php
Normal file
48
templates/Products/index.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var iterable<\Cake\Datasource\EntityInterface> $products
|
||||
*/
|
||||
?>
|
||||
<div class="products index content">
|
||||
<?= $this->Html->link(__('New Product'), ['action' => 'add'], ['class' => 'button float-right']) ?>
|
||||
<h3><?= __('Products') ?></h3>
|
||||
<div class="table-responsive">
|
||||
<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_type_id') ?></th>
|
||||
<th class="actions"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($products as $product): ?>
|
||||
<tr>
|
||||
<td><?= $this->Number->format($product->id) ?></td>
|
||||
<td><?= h($product->name) ?></td>
|
||||
<td><?= $product->hasValue('product_category') ? $this->Html->link($product->product_category->name, ['controller' => 'ProductCategories', 'action' => 'view', $product->product_category->id]) : '' ?></td>
|
||||
<td><?= $product->product_type_id->name ?></td>
|
||||
<td class="actions">
|
||||
<?= $this->Html->link(__('View'), ['action' => 'view', $product->id]) ?>
|
||||
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $product->id]) ?>
|
||||
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $product->id], ['confirm' => __('Are you sure you want to delete # {0}?', $product->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>
|
||||
40
templates/Products/view.php
Normal file
40
templates/Products/view.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @var \App\View\AppView $this
|
||||
* @var \Cake\Datasource\EntityInterface $product
|
||||
*/
|
||||
?>
|
||||
<div class="row">
|
||||
<aside class="column">
|
||||
<div class="side-nav">
|
||||
<h4 class="heading"><?= __('Actions') ?></h4>
|
||||
<?= $this->Html->link(__('Edit Product'), ['action' => 'edit', $product->id], ['class' => 'side-nav-item']) ?>
|
||||
<?= $this->Form->postLink(__('Delete Product'), ['action' => 'delete', $product->id], ['confirm' => __('Are you sure you want to delete # {0}?', $product->id), 'class' => 'side-nav-item']) ?>
|
||||
<?= $this->Html->link(__('List Products'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
|
||||
<?= $this->Html->link(__('New Product'), ['action' => 'add'], ['class' => 'side-nav-item']) ?>
|
||||
</div>
|
||||
</aside>
|
||||
<div class="column column-80">
|
||||
<div class="products view content">
|
||||
<h3><?= h($product->name) ?></h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th><?= __('Name') ?></th>
|
||||
<td><?= h($product->name) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= __('Product Category') ?></th>
|
||||
<td><?= $product->hasValue('product_category') ? $this->Html->link($product->product_category->name, ['controller' => 'ProductCategories', 'action' => 'view', $product->product_category->id]) : '' ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= __('Id') ?></th>
|
||||
<td><?= $this->Number->format($product->id) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?= __('Product Type Id') ?></th>
|
||||
<td><?= $product->product_type_id->name ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user