2023-10-29 21:48:49 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Depot.Administrator
|
|
|
|
* @subpackage com_depot
|
|
|
|
* @author Thomas Kuschel <thomas@kuschel.at>
|
|
|
|
* @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.md
|
|
|
|
* @since 0.9.7
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\Layout\LayoutHelper;
|
2023-11-18 21:05:43 +01:00
|
|
|
use Joomla\CMS\Router\Route;
|
2023-10-29 21:48:49 +01:00
|
|
|
|
2023-11-12 22:56:20 +01:00
|
|
|
/** @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');
|
|
|
|
}
|
2023-10-29 21:48:49 +01:00
|
|
|
?>
|
|
|
|
<form action="<?= Route::_('index.php?option=com_depot&view=packages'); ?>" method="post" name="adminForm"
|
|
|
|
id="adminForm">
|
|
|
|
|
|
|
|
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
|
|
|
|
|
|
|
|
<?php if (empty($this->items)): ?>
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<span class="icon-info-circle" aria-hidden="true">
|
|
|
|
</span>
|
|
|
|
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
|
|
|
</div>
|
|
|
|
<?php else: ?>
|
2023-11-12 22:56:20 +01:00
|
|
|
<table class="table table-striped table-hover" id="packageList">
|
|
|
|
<caption class="visually-hidden">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= Text::_('COM_DEPOT_PACKAGES_TABLE_CAPTION'); ?>,
|
2023-11-12 22:56:20 +01:00
|
|
|
<span id="orderedBy">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= Text::_('JGLOBAL_SORTED_BY'); ?>
|
2023-11-12 22:56:20 +01:00
|
|
|
</span>,
|
|
|
|
<span id="filteredBy">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= Text::_('JGLOBAL_FILTERED_BY'); ?>
|
2023-11-12 22:56:20 +01:00
|
|
|
</span>
|
|
|
|
</caption>
|
2023-10-29 21:48:49 +01:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2023-11-12 22:56:20 +01:00
|
|
|
<td class="w-1 text-center">
|
2023-10-29 21:48:49 +01:00
|
|
|
<?= HTMLHelper::_('grid.checkall'); ?>
|
2023-11-12 22:56:20 +01:00
|
|
|
</td>
|
|
|
|
<th scope="col" class="w-1 text-center">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= HTMLHelper::_('searchtools.sort', '', 'p.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</th>
|
2023-11-12 22:56:20 +01:00
|
|
|
<th scope="col" class="w-1 text-center">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= HTMLHelper::_('searchtools.sort', 'JSTATUS', 'p.state', $listDirn, $listOrder); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</th>
|
|
|
|
<th>
|
2023-10-31 23:25:42 +01:00
|
|
|
<?= HTMLHelper::_(
|
|
|
|
'searchtools.sort',
|
|
|
|
'COM_DEPOT_TABLE_HEAD_PACKAGE_NAME',
|
|
|
|
'p.name',
|
2023-11-12 22:56:20 +01:00
|
|
|
$listDirn,
|
|
|
|
$listOrder
|
2023-10-31 23:25:42 +01:00
|
|
|
); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</th>
|
|
|
|
<th>
|
2023-10-31 23:25:42 +01:00
|
|
|
<?= HTMLHelper::_(
|
|
|
|
'searchtools.sort',
|
|
|
|
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
|
|
|
|
'p.description',
|
2023-11-12 22:56:20 +01:00
|
|
|
$listDirn,
|
|
|
|
$listOrder
|
2023-10-31 23:25:42 +01:00
|
|
|
); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</th>
|
|
|
|
<th>
|
2023-10-31 23:25:42 +01:00
|
|
|
<?= HTMLHelper::_(
|
|
|
|
'searchtools.sort',
|
|
|
|
'COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE',
|
|
|
|
'p.mounting_style',
|
2023-11-12 22:56:20 +01:00
|
|
|
$listDirn,
|
|
|
|
$listOrder
|
|
|
|
); ?>
|
|
|
|
</th>
|
|
|
|
<th>
|
|
|
|
<?= HTMLHelper::_(
|
|
|
|
'searchtools.sort',
|
|
|
|
'JGRID_HEADING_ID',
|
|
|
|
'p.id',
|
|
|
|
$listDirn,
|
|
|
|
$listOrder
|
2023-10-31 23:25:42 +01:00
|
|
|
); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2023-11-12 22:56:20 +01:00
|
|
|
<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;
|
|
|
|
?>
|
2023-11-18 21:05:43 +01:00
|
|
|
<tr class="row<?= $i % 2; ?>" data-draggable-group="0" item-id="<?= $item->id; ?>">
|
2023-11-12 22:56:20 +01:00
|
|
|
<th>
|
2023-10-29 21:48:49 +01:00
|
|
|
<?= HTMLHelper::_('grid.id', $i, $item->id); ?>
|
2023-11-12 22:56:20 +01:00
|
|
|
</th>
|
|
|
|
<td class="text-center d-none d-md-table-cell">
|
|
|
|
<?php
|
|
|
|
$iconClass = '';
|
|
|
|
|
|
|
|
if (!$canChange) {
|
|
|
|
$iconClass = ' inactive';
|
|
|
|
} elseif (!$saveOrder) {
|
|
|
|
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
|
|
|
|
}
|
|
|
|
?>
|
2023-11-18 21:05:43 +01:00
|
|
|
<span class="sortable-handler <?= $iconClass ?>">
|
2023-11-12 22:56:20 +01:00
|
|
|
<span class="icon-ellipsis-v" aria-hidden="true"></span>
|
|
|
|
</span>
|
|
|
|
<?php if ($saveOrder): ?>
|
2023-11-18 21:05:43 +01:00
|
|
|
<input type="text" name="order[]" size="5" value="<?= $item->ordering; ?>"
|
2023-11-12 22:56:20 +01:00
|
|
|
class="width-20 text-area-order hidden">
|
|
|
|
<?php endif; ?>
|
|
|
|
<div class="small">
|
|
|
|
<?= $item->ordering; ?>
|
|
|
|
</div>
|
2023-10-29 21:48:49 +01:00
|
|
|
</td>
|
2023-11-12 22:56:20 +01:00
|
|
|
<td class="text-center">
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= HTMLHelper::_('jgrid.published', $item->state, $i, 'packages.', $canChange); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
</td>
|
2023-11-12 22:56:20 +01:00
|
|
|
<th>
|
2023-10-29 21:48:49 +01:00
|
|
|
<a href="<?= Route::_('index.php?option=com_depot&task=package.edit&id=' .
|
|
|
|
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
|
|
|
<?= $this->escape($item->name); ?>
|
|
|
|
</a>
|
2023-11-12 22:56:20 +01:00
|
|
|
</th>
|
2023-10-29 21:48:49 +01:00
|
|
|
<td>
|
|
|
|
<?= $this->escape($item->description); ?>
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<?= $this->escape($item->mounting_style); ?>
|
|
|
|
</td>
|
2023-11-12 22:56:20 +01:00
|
|
|
<td>
|
|
|
|
<?= $item->id ?>
|
|
|
|
</td>
|
2023-10-29 21:48:49 +01:00
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2023-11-18 21:05:43 +01:00
|
|
|
<?= $this->pagination->getListFooter(); ?>
|
2023-10-29 21:48:49 +01:00
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<input type="hidden" name="task" value="">
|
|
|
|
<input type="hidden" name="boxchecked" value="0">
|
|
|
|
<?= HTMLHelper::_('form.token'); ?>
|
|
|
|
</form>
|