first standalone plugin commit

This commit is contained in:
2025-11-18 00:43:34 -08:00
commit 5dc7aa87cd
86 changed files with 86844 additions and 0 deletions

39
templates/States/add.php Normal file
View File

@@ -0,0 +1,39 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $state
* @var \Cake\Collection\CollectionInterface|string[] $countries
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('List States'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="states form content">
<?= $this->Form->create($state) ?>
<fieldset>
<legend><?= __('Add State') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('country_id', ['options' => $countries]);
echo $this->Form->control('country_code');
echo $this->Form->control('fips_code');
echo $this->Form->control('iso2');
echo $this->Form->control('type');
echo $this->Form->control('latitude');
echo $this->Form->control('longitude');
echo $this->Form->control('created_at');
echo $this->Form->control('updated_at');
echo $this->Form->control('flag');
echo $this->Form->control('wikiDataId');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

44
templates/States/edit.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $state
* @var string[]|\Cake\Collection\CollectionInterface $countries
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Form->postLink(
__('Delete'),
['action' => 'delete', $state->id],
['confirm' => __('Are you sure you want to delete # {0}?', $state->id), 'class' => 'side-nav-item']
) ?>
<?= $this->Html->link(__('List States'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="states form content">
<?= $this->Form->create($state) ?>
<fieldset>
<legend><?= __('Edit State') ?></legend>
<?php
echo $this->Form->control('name');
echo $this->Form->control('country_id', ['options' => $countries]);
echo $this->Form->control('country_code');
echo $this->Form->control('fips_code');
echo $this->Form->control('iso2');
echo $this->Form->control('type');
echo $this->Form->control('latitude');
echo $this->Form->control('longitude');
echo $this->Form->control('created_at');
echo $this->Form->control('updated_at');
echo $this->Form->control('flag');
echo $this->Form->control('wikiDataId');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,63 @@
<?php
/**
* @var \App\View\AppView $this
* @var iterable<\Cake\Datasource\EntityInterface> $states
*/
?>
<div class="states index content">
<h3><?= __('States') ?></h3>
<div class="table-responsive">
<table>
<thead>
<tr>
<th><?= $this->Paginator->sort('id') ?></th>
<th><?= $this->Paginator->sort('name') ?></th>
<th><?= $this->Paginator->sort('country_id') ?></th>
<th><?= $this->Paginator->sort('country_code') ?></th>
<th><?= $this->Paginator->sort('fips_code') ?></th>
<th><?= $this->Paginator->sort('iso2') ?></th>
<th><?= $this->Paginator->sort('type') ?></th>
<th><?= $this->Paginator->sort('latitude') ?></th>
<th><?= $this->Paginator->sort('longitude') ?></th>
<th><?= $this->Paginator->sort('created_at') ?></th>
<th><?= $this->Paginator->sort('updated_at') ?></th>
<th><?= $this->Paginator->sort('flag') ?></th>
<th><?= $this->Paginator->sort('wikiDataId') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($states as $state): ?>
<tr>
<td><?= $this->Number->format($state->id) ?></td>
<td><?= h($state->name) ?></td>
<td><?= $state->hasValue('country') ? $this->Html->link($state->country->name, ['controller' => 'Countries', 'action' => 'view', $state->country->id]) : '' ?></td>
<td><?= h($state->country_code) ?></td>
<td><?= h($state->fips_code) ?></td>
<td><?= h($state->iso2) ?></td>
<td><?= h($state->type) ?></td>
<td><?= $state->latitude === null ? '' : $this->Number->format($state->latitude) ?></td>
<td><?= $state->longitude === null ? '' : $this->Number->format($state->longitude) ?></td>
<td><?= h($state->created_at) ?></td>
<td><?= h($state->updated_at) ?></td>
<td><?= h($state->flag) ?></td>
<td><?= h($state->wikiDataId) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $state->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,13 @@
<?php
/**
* @var \App\View\AppView $this
* @var iterable<\Cake\Datasource\EntityInterface> $states
*/
$this->setLayout('ajax');
?>
<option value="">Select a state</option>
<?php foreach ($states as $stateId => $stateName): ?>
<option value="<?= $stateId; ?>" <?= $this->request->getQuery('state_id') == $stateId ? 'selected="selected"' : ''; ?>><?= $stateName; ?></option>
<?php endforeach; ?>

167
templates/States/view.php Normal file
View File

@@ -0,0 +1,167 @@
<?php
/**
* @var \App\View\AppView $this
* @var \Cake\Datasource\EntityInterface $state
*/
?>
<div class="row">
<aside class="column">
<div class="side-nav">
<h4 class="heading"><?= __('Actions') ?></h4>
<?= $this->Html->link(__('List States'), ['action' => 'index'], ['class' => 'side-nav-item']) ?>
</div>
</aside>
<div class="column column-80">
<div class="states view content">
<h3><?= h($state->name) ?></h3>
<table>
<tr>
<th><?= __('Name') ?></th>
<td><?= h($state->name) ?></td>
</tr>
<tr>
<th><?= __('Country') ?></th>
<td><?= $state->hasValue('country') ? $this->Html->link($state->country->name, ['controller' => 'Countries', 'action' => 'view', $state->country->id]) : '' ?></td>
</tr>
<tr>
<th><?= __('Country Code') ?></th>
<td><?= h($state->country_code) ?></td>
</tr>
<tr>
<th><?= __('Fips Code') ?></th>
<td><?= h($state->fips_code) ?></td>
</tr>
<tr>
<th><?= __('Iso2') ?></th>
<td><?= h($state->iso2) ?></td>
</tr>
<tr>
<th><?= __('Type') ?></th>
<td><?= h($state->type) ?></td>
</tr>
<tr>
<th><?= __('WikiDataId') ?></th>
<td><?= h($state->wikiDataId) ?></td>
</tr>
<tr>
<th><?= __('Id') ?></th>
<td><?= $this->Number->format($state->id) ?></td>
</tr>
<tr>
<th><?= __('Latitude') ?></th>
<td><?= $state->latitude === null ? '' : $this->Number->format($state->latitude) ?></td>
</tr>
<tr>
<th><?= __('Longitude') ?></th>
<td><?= $state->longitude === null ? '' : $this->Number->format($state->longitude) ?></td>
</tr>
<tr>
<th><?= __('Created At') ?></th>
<td><?= h($state->created_at) ?></td>
</tr>
<tr>
<th><?= __('Updated At') ?></th>
<td><?= h($state->updated_at) ?></td>
</tr>
<tr>
<th><?= __('Flag') ?></th>
<td><?= $state->flag ? __('Yes') : __('No'); ?></td>
</tr>
</table>
<div class="related">
<h4><?= __('Related Addresses') ?></h4>
<?php if (!empty($state->addresses)) : ?>
<div class="table-responsive">
<table>
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Address Name') ?></th>
<th><?= __('Contact Name') ?></th>
<th><?= __('Address Line1') ?></th>
<th><?= __('Address Line2') ?></th>
<th><?= __('City') ?></th>
<th><?= __('City Id') ?></th>
<th><?= __('State') ?></th>
<th><?= __('State Id') ?></th>
<th><?= __('Postal Code') ?></th>
<th><?= __('Country') ?></th>
<th><?= __('Country Id') ?></th>
<th><?= __('Phone Number') ?></th>
<th><?= __('Email') ?></th>
<th><?= __('Notes') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($state->addresses as $addresses) : ?>
<tr>
<td><?= h($addresses->id) ?></td>
<td><?= h($addresses->address_name) ?></td>
<td><?= h($addresses->contact_name) ?></td>
<td><?= h($addresses->address_line1) ?></td>
<td><?= h($addresses->address_line2) ?></td>
<td><?= h($addresses->city) ?></td>
<td><?= h($addresses->city_id) ?></td>
<td><?= h($addresses->state) ?></td>
<td><?= h($addresses->state_id) ?></td>
<td><?= h($addresses->postal_code) ?></td>
<td><?= h($addresses->country) ?></td>
<td><?= h($addresses->country_id) ?></td>
<td><?= h($addresses->phone_number) ?></td>
<td><?= h($addresses->email) ?></td>
<td><?= h($addresses->notes) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'Addresses', 'action' => 'view', $addresses->id]) ?>
<?= $this->Html->link(__('Edit'), ['controller' => 'Addresses', 'action' => 'edit', $addresses->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['controller' => 'Addresses', 'action' => 'delete', $addresses->id], ['confirm' => __('Are you sure you want to delete # {0}?', $addresses->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif; ?>
</div>
<div class="related">
<h4><?= __('Related Cities') ?></h4>
<?php if (!empty($state->cities)) : ?>
<div class="table-responsive">
<table>
<tr>
<th><?= __('Id') ?></th>
<th><?= __('Name') ?></th>
<th><?= __('State Id') ?></th>
<th><?= __('State Code') ?></th>
<th><?= __('Country Id') ?></th>
<th><?= __('Country Code') ?></th>
<th><?= __('Latitude') ?></th>
<th><?= __('Longitude') ?></th>
<th><?= __('Created At') ?></th>
<th><?= __('Updated At') ?></th>
<th><?= __('Flag') ?></th>
<th><?= __('WikiDataId') ?></th>
<th class="actions"><?= __('Actions') ?></th>
</tr>
<?php foreach ($state->cities as $cities) : ?>
<tr>
<td><?= h($cities->id) ?></td>
<td><?= h($cities->name) ?></td>
<td><?= h($cities->state_id) ?></td>
<td><?= h($cities->state_code) ?></td>
<td><?= h($cities->country_id) ?></td>
<td><?= h($cities->country_code) ?></td>
<td><?= h($cities->latitude) ?></td>
<td><?= h($cities->longitude) ?></td>
<td><?= h($cities->created_at) ?></td>
<td><?= h($cities->updated_at) ?></td>
<td><?= h($cities->flag) ?></td>
<td><?= h($cities->wikiDataId) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['controller' => 'Cities', 'action' => 'view', $cities->id]) ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>