UPD version 0.9.12

This commit is contained in:
2023-11-12 22:56:20 +01:00
parent 616bf0ca31
commit f656fb70fa
15 changed files with 286 additions and 111 deletions

View File

@ -12,7 +12,23 @@ use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Session\Session;
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('table.columns')
->useScript('multiselect');
$user = $this->getCurrentUser();
$userID = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'p.ordering';
if ($saveOrder && !empty($this->items)) {
$saveOrderingUrl = 'index.php?option=com_depot&task=packages.saveOrderAjax&tmpl=component';
HTMLHelper::_('draggablelist.draggable');
}
?>
<form action="<?= Route::_('index.php?option=com_depot&view=packages'); ?>" method="post" name="adminForm"
id="adminForm">
@ -26,29 +42,34 @@ use Joomla\CMS\Layout\LayoutHelper;
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else: ?>
<table class="table table-striped table-hover">
<table class="table table-striped table-hover" id="packageList">
<caption class="visually-hidden">
<?php echo Text::_('COM_DEPOT_PACKAGES_TABLE_CAPTION'); ?>,
<span id="orderedBy">
<?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
</span>,
<span id="filteredBy">
<?php echo Text::_('JGLOBAL_FILTERED_BY'); ?>
</span>
</caption>
<thead>
<tr>
<th>
<td class="w-1 text-center">
<?= HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="w-1 text-center">
<?php echo HTMLHelper::_('searchtools.sort', '', 'p.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'p.id',
$this->listDirn,
$this->listOrder
); ?>
<th scope="col" class="w-1 text-center">
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'p.state', $listDirn, $listOrder); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_PACKAGE_NAME',
'p.name',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
@ -56,8 +77,8 @@ use Joomla\CMS\Layout\LayoutHelper;
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
'p.description',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
@ -65,33 +86,72 @@ use Joomla\CMS\Layout\LayoutHelper;
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE',
'p.mounting_style',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'p.id',
$listDirn,
$listOrder
); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item): ?>
<tr>
<td>
<tbody <?php if ($saveOrder):
?> class="js-draggable" data-url="<?= $saveOrderingUrl; ?>"
data-direction="<?= strtolower($listDirn); ?>" data-nested="true" <?php
endif; ?>>
<?php foreach ($this->items as $i => $item):
$ordering = ($listOrder == 'ordering');
$canChange = true;
?>
<tr class="row<?= $i % 2; ?>" data-draggable-group="0" item-id="<?php echo $item->id; ?>">
<th>
<?= HTMLHelper::_('grid.id', $i, $item->id); ?>
</th>
<td class="text-center d-none d-md-table-cell">
<?php
$iconClass = '';
if (!$canChange) {
$iconClass = ' inactive';
} elseif (!$saveOrder) {
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
}
?>
<span class="sortable-handler <?php echo $iconClass ?>">
<span class="icon-ellipsis-v" aria-hidden="true"></span>
</span>
<?php if ($saveOrder): ?>
<input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>"
class="width-20 text-area-order hidden">
<?php endif; ?>
<div class="small">
<?= $item->ordering; ?>
</div>
</td>
<td>
<?= $item->id ?>
<td class="text-center">
<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'packages.', $canChange); ?>
</td>
<td>
<th>
<a href="<?= Route::_('index.php?option=com_depot&task=package.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
<?= $this->escape($item->name); ?>
</a>
</td>
</th>
<td>
<?= $this->escape($item->description); ?>
</td>
<td>
<?= $this->escape($item->mounting_style); ?>
</td>
<td>
<?= $item->id ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>

View File

@ -10,11 +10,24 @@
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('table.columns')
->useScript('multiselect');
$canChange = true;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'd.ordering';
if ($saveOrder && !empty($this->items)) {
$saveOrderingUrl = 'index.php?option=com_depot&task=parts.saveOrderAjax&tmpl=component';
HTMLHelper::_('draggablelist.draggable');
}
?>
<form action="<?= Route::_('index.php?option=com_depot&view=parts'); ?>" method="post" name="adminForm" id="adminForm">
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
@ -26,28 +39,31 @@ use Joomla\CMS\Layout\LayoutHelper;
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else: ?>
<table class="table table-striped table-hover">
<table class="table table-striped table-hover" id="partsList">
<caption class="visually-hidden">
<?php echo Text::_('COM_BANNERS_CLIENTS_TABLE_CAPTION'); ?>,
<span id="orderedBy">
<?php echo Text::_('JGLOBAL_SORTED_BY'); ?>
</span>,
<span id="filteredBy">
<?php echo Text::_('JGLOBAL_FILTERED_BY'); ?>
</span>
</caption>
<thead>
<tr>
<th>
<td class="w-1 text-center">
<?= HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="w-1 text-center">
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'd.state', $listDirn, $listOrder); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'd.id',
$this->listDirn,
$this->listOrder
); ?>
</th>
<th>
<th scope="col">
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_NAME',
'd.component_name',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
@ -55,8 +71,8 @@ use Joomla\CMS\Layout\LayoutHelper;
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_QUANTITY',
'd.quantity',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
@ -67,8 +83,8 @@ use Joomla\CMS\Layout\LayoutHelper;
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MANUFACTURER',
'manufacturer',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th>
@ -76,8 +92,17 @@ use Joomla\CMS\Layout\LayoutHelper;
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_STOCK',
'stock_name',
$this->listDirn,
$this->listOrder
$listDirn,
$listOrder
); ?>
</th>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'd.id',
$listDirn,
$listOrder
); ?>
</th>
</tr>
@ -85,13 +110,13 @@ use Joomla\CMS\Layout\LayoutHelper;
<tbody>
<?php foreach ($this->items as $i => $item): ?>
<tr>
<td>
<?= HTMLHelper::_('grid.id', $i, $item->id); ?>
<td class="text-center">
<?= HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->component_name); ?>
</td>
<td>
<?= $item->id ?>
<td class="text-center">
<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'parts.', $canChange); ?>
</td>
<td>
<th>
<div class="break-word">
<a href="<?= Route::_('index.php?option=com_depot&task=part.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
@ -110,7 +135,7 @@ use Joomla\CMS\Layout\LayoutHelper;
</div>
<?php endif; ?>
</div>
</td>
</th>
<td>
<?= $this->escape($item->quantity); ?>
</td>
@ -124,7 +149,6 @@ use Joomla\CMS\Layout\LayoutHelper;
</a>
</td>
<td>
<a class="break-word" href="<?= Route::_('index.php?option=com_depot&task=stock.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
<?= $this->escape($item->stock_name); ?>
@ -132,7 +156,9 @@ use Joomla\CMS\Layout\LayoutHelper;
<div class="small">
<?= $this->escape($item->owner); ?>
</div>
</td>
<td>
<?= $item->id ?>
</td>
</tr>
<?php endforeach; ?>