product photos first commit - only upload base photo

This commit is contained in:
2025-08-10 02:35:25 -07:00
parent 82b3ca59ed
commit a1012b4054
15 changed files with 1021 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $productPhoto
* @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 Photos'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productPhotos form content">
<?= $this->Form->create($productPhoto, ['type' => 'file']) ?>
<fieldset>
<legend><?= __('Add Product Photo') ?></legend>
<?= $this->element('ProductPhotos/form', ['includeFile' => true]); ?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $productPhoto
* @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', $productPhoto->id],
['confirm' => __('Are you sure you want to delete # {0}?', $productPhoto->id), 'class' => 'side-nav-item']
) ?>
<?= $this->Html->link(__('List Product Photos'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productPhotos form content">
<?= $this->Form->create($productPhoto) ?>
<fieldset>
<legend><?= __('Edit Product Photo') ?></legend>
<?= $this->element('ProductPhotos/form', ['includeFile' => false]); ?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,60 @@
<?php
/**
* @var \App\View\AppView $this
* @var iterable<\Cake\Datasource\EntityInterface> $productPhotos
*/
?>
<div class="productPhotos index content">
<?= $this->Html->link(__('New Product Photo'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Product Photos') ?></h3>
<div class="table-responsive" id="table-container">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('product_id') ?></th>
<th><?= $this->Paginator->sort('product_sku_id') ?></th>
<th><?= $this->Paginator->sort('photo_filename') ?></th>
<th><?= $this->Paginator->sort('primary_photo') ?></th>
<th><?= $this->Paginator->sort('photo_position') ?></th>
<th><?= $this->Paginator->sort('enabled') ?></th>
<th><?= $this->Paginator->sort('created') ?></th>
<th><?= $this->Paginator->sort('modified') ?></th>
<th><?= $this->Paginator->sort('deleted') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($productPhotos as $productPhoto): ?>
<tr>
<td><?= h($productPhoto->id) ?></td>
<td><?= $productPhoto->hasValue('product') ? $this->Html->link($productPhoto->product->name, ['controller' => 'Products', 'action' => 'view', $productPhoto->product->id]) : '' ?></td>
<td><?= h($productPhoto->product_sku_id) ?></td>
<td><?= h($productPhoto->photo_filename) ?></td>
<td><?= h($productPhoto->primary_photo) ?></td>
<td><?= $this->Number->format($productPhoto->photo_position) ?></td>
<td><?= h($productPhoto->enabled) ?></td>
<td><?= h($productPhoto->created) ?></td>
<td><?= h($productPhoto->modified) ?></td>
<td><?= h($productPhoto->deleted) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $productPhoto->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $productPhoto->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $productPhoto->id], ['confirm' => __('Are you sure you want to delete # {0}?', $productPhoto->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,70 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $productPhoto
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('Edit Product Photo'), ['action' => 'edit', $productPhoto->id], ['class' => 'side-nav-item']) ?>
<?= $this->Form->postLink(__('Delete Product Photo'), ['action' => 'delete', $productPhoto->id], ['confirm' => __('Are you sure you want to delete # {0}?', $productPhoto->id), 'class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('List Product Photos'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
<?= $this->Html->link(__('New Product Photo'), ['action' => 'add'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="productPhotos view content">
<h3><?= h($productPhoto->photo_filename) ?></h3>
<table>
<tr>
<th><?= __('Id') ?></th>
<td><?= h($productPhoto->id) ?></td>
</tr>
<tr>
<th><?= __('Product') ?></th>
<td><?= $productPhoto->hasValue('product') ? $this->Html->link($productPhoto->product->name, ['controller' => 'Products', 'action' => 'view', $productPhoto->product->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Product Sku Id') ?></th>
<td><?= h($productPhoto->product_sku_id) ?></td>
</tr>
<tr>
<th><?= __('Photo Filename') ?></th>
<td><?= h($productPhoto->photo_filename) ?></td>
</tr>
<tr>
<th><?= __('Photo Position') ?></th>
<td><?= $this->Number->format($productPhoto->photo_position) ?></td>
</tr>
<tr>
<th><?= __('Created') ?></th>
<td><?= h($productPhoto->created) ?></td>
</tr>
<tr>
<th><?= __('Modified') ?></th>
<td><?= h($productPhoto->modified) ?></td>
</tr>
<tr>
<th><?= __('Deleted') ?></th>
<td><?= h($productPhoto->deleted) ?></td>
</tr>
<tr>
<th><?= __('Primary Photo') ?></th>
<td><?= $productPhoto->primary_photo ? __('Yes') : __('No'); ?></td>
</tr>
<tr>
<th><?= __('Enabled') ?></th>
<td><?= $productPhoto->enabled ? __('Yes') : __('No'); ?></td>
</tr>
</table>
<div class="text">
<strong><?= __('Photo Dir') ?></strong>
<blockquote>
<?= $this->Text->autoParagraph(h($productPhoto->photo_dir)); ?>
</blockquote>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,24 @@
<?php
/**
* @var \App\View\AppView $this
* @var \CakeProducts\Model\Entity\Product[]|\Cake\Datasource\EntityInterface[] $products
* @var \CakeProducts\Model\Entity\Product[]|\Cake\Datasource\EntityInterface[] $productSkus
* @var bool $includeFile
*/
$includeFile = $includeFile ?? false;
echo $this->Form->control('product_id', [
'options' => $products ?? [],
]);
echo $this->Form->control('product_sku_id', [
'options' => $productSkus ?? []
]);
echo $includeFile ? $this->Form->control('photo', [
'type' => 'file',
]) : '';
echo $this->Form->control('primary_photo');
echo $this->Form->control('photo_position');
echo $this->Form->control('enabled');
?>