UPD version 0.9.12
This commit is contained in:
parent
616bf0ca31
commit
f656fb70fa
@ -25,10 +25,12 @@
|
|||||||
label="JGLOBAL_SORT_BY"
|
label="JGLOBAL_SORT_BY"
|
||||||
statuses="*,0,1,2,-2"
|
statuses="*,0,1,2,-2"
|
||||||
class="js-select-submit-on-change"
|
class="js-select-submit-on-change"
|
||||||
default="p.name ASC"
|
default=""
|
||||||
validate="options"
|
validate="options"
|
||||||
>
|
>
|
||||||
<option value="">JGLOBAL_SORT_BY</option>
|
<option value="">JGLOBAL_SORT_BY</option>
|
||||||
|
<option value="p.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||||
|
<option value="p.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||||
<option value="p.state ASC">JSTATUS_ASC</option>
|
<option value="p.state ASC">JSTATUS_ASC</option>
|
||||||
<option value="p.state DESC">JSTATUS_DESC</option>
|
<option value="p.state DESC">JSTATUS_DESC</option>
|
||||||
<option value="p.name ASC">JGLOBAL_NAME_ASC</option>
|
<option value="p.name ASC">JGLOBAL_NAME_ASC</option>
|
||||||
|
@ -78,5 +78,13 @@
|
|||||||
class="readonly"
|
class="readonly"
|
||||||
readonly="true"
|
readonly="true"
|
||||||
/>
|
/>
|
||||||
|
<field
|
||||||
|
name="ordering"
|
||||||
|
type="text"
|
||||||
|
label="JFIELD_ORDERING_LABEL"
|
||||||
|
class="readonly"
|
||||||
|
default="0"
|
||||||
|
readonly="true"
|
||||||
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
@ -17,8 +17,7 @@ use Joomla\DI\Container;
|
|||||||
use Joomla\DI\ServiceProviderInterface;
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
use KW4NZ\Component\Depot\Administrator\Extension\DepotComponent;
|
use KW4NZ\Component\Depot\Administrator\Extension\DepotComponent;
|
||||||
|
|
||||||
return new class implements ServiceProviderInterface
|
return new class implements ServiceProviderInterface {
|
||||||
{
|
|
||||||
public function register(Container $container)
|
public function register(Container $container)
|
||||||
{
|
{
|
||||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\KW4NZ\\Component\\Depot'));
|
$container->registerServiceProvider(new ComponentDispatcherFactory('\\KW4NZ\\Component\\Depot'));
|
||||||
@ -26,8 +25,7 @@ return new class implements ServiceProviderInterface
|
|||||||
|
|
||||||
$container->set(
|
$container->set(
|
||||||
ComponentInterface::class,
|
ComponentInterface::class,
|
||||||
function (Container $container)
|
function (Container $container) {
|
||||||
{
|
|
||||||
$component = new DepotComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
$component = new DepotComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||||
|
|
||||||
|
@ -135,6 +135,9 @@ CREATE TABLE `#__depot_package` (
|
|||||||
`created_by` INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
`created_by` INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
`checked_out` INT(11) NOT NULL DEFAULT 0,
|
`checked_out` INT(11) NOT NULL DEFAULT 0,
|
||||||
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`modified_by` INT(10) UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
`ordering` INT(11) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
AUTO_INCREMENT=0
|
AUTO_INCREMENT=0
|
||||||
|
8
admin/sql/updates/mysql/0.9.11.sql
Normal file
8
admin/sql/updates/mysql/0.9.11.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-- @package Depot.SQL MariaDB -- UPDATE to 0.9.11
|
||||||
|
-- @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
|
||||||
|
ALTER TABLE `#__depot_package`
|
||||||
|
ADD COLUMN `ordering` INT(11) NOT NULL DEFAULT 0 AFTER `modified_by`;
|
9
admin/sql/updates/mysql/0.9.12.sql
Normal file
9
admin/sql/updates/mysql/0.9.12.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
-- @package Depot.SQL MariaDB -- UPDATE to 0.9.12
|
||||||
|
-- @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
|
||||||
|
ALTER TABLE `#__depot_package`
|
||||||
|
ADD COLUMN `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `checked_out_time`,
|
||||||
|
ADD COLUMN `modified_by` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `modified`;
|
@ -10,11 +10,14 @@
|
|||||||
|
|
||||||
namespace KW4NZ\Component\Depot\Administrator\Model;
|
namespace KW4NZ\Component\Depot\Administrator\Model;
|
||||||
|
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use Joomla\CMS\MVC\Model\ListModel;
|
use Joomla\CMS\MVC\Model\ListModel;
|
||||||
// use Joomla\CMS\Table\Table;
|
use Joomla\CMS\Table\Table;
|
||||||
use Joomla\Database\ParameterType;
|
use Joomla\Database\ParameterType;
|
||||||
|
|
||||||
|
// phpcs:disable PSR1.Files.SideEffects
|
||||||
\defined('_JEXEC') or die;
|
\defined('_JEXEC') or die;
|
||||||
|
// phpcs:enable PSR1.Files.SideEffects
|
||||||
|
|
||||||
class PackagesModel extends ListModel
|
class PackagesModel extends ListModel
|
||||||
{
|
{
|
||||||
@ -36,6 +39,10 @@ class PackagesModel extends ListModel
|
|||||||
'mounting_style',
|
'mounting_style',
|
||||||
'description',
|
'description',
|
||||||
'p.description',
|
'p.description',
|
||||||
|
'ordering',
|
||||||
|
'p.ordering',
|
||||||
|
'checked_out',
|
||||||
|
'p.checked_out',
|
||||||
];
|
];
|
||||||
parent::__construct($config);
|
parent::__construct($config);
|
||||||
}
|
}
|
||||||
@ -73,6 +80,12 @@ class PackagesModel extends ListModel
|
|||||||
$db->quoteName('p.description'),
|
$db->quoteName('p.description'),
|
||||||
$db->quoteName('p.image'),
|
$db->quoteName('p.image'),
|
||||||
$db->quoteName('p.state'),
|
$db->quoteName('p.state'),
|
||||||
|
$db->quoteName('p.ordering'),
|
||||||
|
$db->quoteName('p.checked_out'),
|
||||||
|
$db->quoteName('p.checked_out_time'),
|
||||||
|
$db->quoteName('p.modified'),
|
||||||
|
$db->quoteName('p.modified_by'),
|
||||||
|
$db->quoteName('p.mounting_style_id'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -104,10 +117,27 @@ class PackagesModel extends ListModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add list ordering clause
|
// add list ordering clause
|
||||||
$orderCol = $this->state->get('list.ordering', 'id');
|
$query->order(
|
||||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
$db->quoteName($db->escape($this->getState('list.ordering', 'p.ordering'))) . ' ' .
|
||||||
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
|
$db->escape($this->getState('list.direction', 'ASC'))
|
||||||
|
);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a reference to the a Table object, always creating it.
|
||||||
|
*
|
||||||
|
* @param string $type The table type to instantiate
|
||||||
|
* @param string $prefix A prefix for the table class name. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return Table A Table object
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getTable($type = 'Package', $prefix = 'Administrator', $config = [])
|
||||||
|
{
|
||||||
|
return parent::getTable($type, $prefix, $config);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,6 +23,8 @@ class PartsModel extends ListModel
|
|||||||
$config['filter_fields'] = [
|
$config['filter_fields'] = [
|
||||||
'id',
|
'id',
|
||||||
'd.id',
|
'd.id',
|
||||||
|
'state',
|
||||||
|
'd.state',
|
||||||
'component_name',
|
'component_name',
|
||||||
'd.component_name',
|
'd.component_name',
|
||||||
'alias',
|
'alias',
|
||||||
@ -65,6 +67,7 @@ class PartsModel extends ListModel
|
|||||||
'list.select',
|
'list.select',
|
||||||
[
|
[
|
||||||
$db->quoteName('d.id'),
|
$db->quoteName('d.id'),
|
||||||
|
$db->quoteName('d.state'),
|
||||||
$db->quoteName('d.component_name'),
|
$db->quoteName('d.component_name'),
|
||||||
$db->quoteName('d.alias'),
|
$db->quoteName('d.alias'),
|
||||||
$db->quoteName('d.description'),
|
$db->quoteName('d.description'),
|
||||||
|
@ -97,10 +97,10 @@ class StocksModel extends ListModel
|
|||||||
$query->where($db->quoteName('s.state') . ' IN (0, 1)');
|
$query->where($db->quoteName('s.state') . ' IN (0, 1)');
|
||||||
}
|
}
|
||||||
|
|
||||||
// add list ordering clause
|
// Add the list ordering clause.
|
||||||
$orderCol = $this->state->get('list.ordering', 'id');
|
$query->order(
|
||||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
$db->quoteName($db->escape($this->getState('list.ordering', 'id'))) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))
|
||||||
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
|
);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,41 @@ class PackageTable extends Table
|
|||||||
$this->setColumnAlias('published', 'state');
|
$this->setColumnAlias('published', 'state');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function check()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
parent::check();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->setError($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set created date if not set.
|
||||||
|
if (!(int) $this->created) {
|
||||||
|
$this->created = Factory::getDate()->toSql();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set ordering
|
||||||
|
if ($this->state < 0) {
|
||||||
|
// Set ordering to 0 if state is archived or trashed
|
||||||
|
$this->ordering = 0;
|
||||||
|
} elseif (empty($this->ordering)) {
|
||||||
|
// Set ordering to last if ordering was 0
|
||||||
|
$this->ordering = self::getNextOrder($this->_db->quoteName('state') . ' >= 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set modified to created if not set
|
||||||
|
if ($this->modified) {
|
||||||
|
$this->modified = $this->created;
|
||||||
|
}
|
||||||
|
// Set modified_by to created_by if not set
|
||||||
|
if (empty($this->modified_by)) {
|
||||||
|
$this->modified_by = $this->created_by;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function store($updateNulls = true)
|
public function store($updateNulls = true)
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
@ -56,18 +91,20 @@ class PackageTable extends Table
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
if (!empty($this->alias)) {
|
||||||
// Verify that the alias is unique
|
// Verify that the alias is unique
|
||||||
$table = $app->bootComponent('com_depot')->getMVCFactory()->createTable('Package', 'Administrator');
|
$table = $app->bootComponent('com_depot')->getMVCFactory()->createTable('Package', 'Administrator');
|
||||||
if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0)) {
|
if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0)) {
|
||||||
$this->setError('Alias is not unique.');
|
$this->setError('Alias is not unique.');
|
||||||
|
|
||||||
if ($table->state == -2) {
|
if ($table->state == -2) {
|
||||||
$this->setError('Alias is not unique. The item is in Trash.');
|
$this->setError('Alias is not unique. The item is in Trash.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
return parent::store($updateNulls);
|
return parent::store($updateNulls);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,35 +10,32 @@
|
|||||||
|
|
||||||
namespace KW4NZ\Component\Depot\Administrator\View\Packages;
|
namespace KW4NZ\Component\Depot\Administrator\View\Packages;
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
|
||||||
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||||
// use Joomla\CMS\Toolbar;
|
// use Joomla\CMS\Toolbar;
|
||||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
|
||||||
// use Joomla\CMS\Language\Text;
|
// phpcs:disable PSR1.Files.SideEffects
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
// phpcs:enable PSR1.Files.SideEffects
|
||||||
|
|
||||||
|
|
||||||
class HtmlView extends BaseHtmlView
|
class HtmlView extends BaseHtmlView
|
||||||
{
|
{
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
// Get application
|
/** @var PackagesModel $model */
|
||||||
$app = Factory::getApplication();
|
$model = $this->getModel();
|
||||||
|
$this->items = $model->getItems();
|
||||||
|
$this->pagination = $model->getPagination();
|
||||||
|
$this->state = $model->getState();
|
||||||
|
$this->filterForm = $model->getFilterForm();
|
||||||
|
$this->activeFilters = $model->getActiveFilters();
|
||||||
|
|
||||||
$this->items = $this->get('Items');
|
if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
|
||||||
$this->state = $this->get('State');
|
$this->setLayout('emptystate');
|
||||||
// list order
|
}
|
||||||
$this->listOrder = $this->escape($this->state->get('list.ordering'));
|
|
||||||
$this->listDirn = $this->escape($this->state->get('list.direction'));
|
|
||||||
// add pagination
|
|
||||||
$this->pagination = $this->get('Pagination');
|
|
||||||
|
|
||||||
// adding filters
|
|
||||||
$this->filterForm = $this->get('FilterForm');
|
|
||||||
$this->activeFilters = $this->get('ActiveFilters');
|
|
||||||
|
|
||||||
// set the toolbar
|
// set the toolbar
|
||||||
$this->addToolbar();
|
$this->addToolbar();
|
||||||
|
@ -25,19 +25,13 @@ class HtmlView extends BaseHtmlView
|
|||||||
{
|
{
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
// Get application
|
// Get model
|
||||||
$app = Factory::getApplication();
|
$model = $this->getModel();
|
||||||
|
$this->items = $model->getItems();
|
||||||
$this->items = $this->get('Items');
|
$this->pagination = $model->getPagination();
|
||||||
$this->state = $this->get('State');
|
$this->state = $model->getState();
|
||||||
// list order
|
$this->filterForm = $model->getFilterForm();
|
||||||
$this->listOrder = $this->escape($this->state->get('list.ordering'));
|
$this->activeFilters = $model->getActiveFilters();
|
||||||
$this->listDirn = $this->escape($this->state->get('list.direction'));
|
|
||||||
// add pagination
|
|
||||||
$this->pagination = $this->get('Pagination');
|
|
||||||
// adding filters
|
|
||||||
$this->filterForm = $this->get('FilterForm');
|
|
||||||
$this->activeFilters = $this->get('ActiveFilters');
|
|
||||||
|
|
||||||
// set the toolbar
|
// set the toolbar
|
||||||
$this->addToolbar();
|
$this->addToolbar();
|
||||||
@ -45,7 +39,7 @@ class HtmlView extends BaseHtmlView
|
|||||||
parent::display($tpl);
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addToolbar()
|
protected function addToolbar(): void
|
||||||
{
|
{
|
||||||
ToolbarHelper::title(Text::_('COM_DEPOT_MANAGER_PARTS'));
|
ToolbarHelper::title(Text::_('COM_DEPOT_MANAGER_PARTS'));
|
||||||
ToolbarHelper::addNew('part.add');
|
ToolbarHelper::addNew('part.add');
|
||||||
|
@ -12,7 +12,23 @@ use Joomla\CMS\HTML\HTMLHelper;
|
|||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
use Joomla\CMS\Router\Route;
|
use Joomla\CMS\Router\Route;
|
||||||
use Joomla\CMS\Layout\LayoutHelper;
|
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"
|
<form action="<?= Route::_('index.php?option=com_depot&view=packages'); ?>" method="post" name="adminForm"
|
||||||
id="adminForm">
|
id="adminForm">
|
||||||
@ -26,29 +42,34 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<table class="table table-striped table-hover" id="packageList">
|
||||||
<table class="table table-striped table-hover">
|
<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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<td class="w-1 text-center">
|
||||||
<?= HTMLHelper::_('grid.checkall'); ?>
|
<?= 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>
|
||||||
<th>
|
<th scope="col" class="w-1 text-center">
|
||||||
<?= HTMLHelper::_(
|
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'p.state', $listDirn, $listOrder); ?>
|
||||||
'searchtools.sort',
|
|
||||||
'JGRID_HEADING_ID',
|
|
||||||
'p.id',
|
|
||||||
$this->listDirn,
|
|
||||||
$this->listOrder
|
|
||||||
); ?>
|
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
<?= HTMLHelper::_(
|
<?= HTMLHelper::_(
|
||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_PACKAGE_NAME',
|
'COM_DEPOT_TABLE_HEAD_PACKAGE_NAME',
|
||||||
'p.name',
|
'p.name',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@ -56,8 +77,8 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
|
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
|
||||||
'p.description',
|
'p.description',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@ -65,33 +86,72 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE',
|
'COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE',
|
||||||
'p.mounting_style',
|
'p.mounting_style',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
|
); ?>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<?= HTMLHelper::_(
|
||||||
|
'searchtools.sort',
|
||||||
|
'JGRID_HEADING_ID',
|
||||||
|
'p.id',
|
||||||
|
$listDirn,
|
||||||
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody <?php if ($saveOrder):
|
||||||
<?php foreach ($this->items as $i => $item): ?>
|
?> class="js-draggable" data-url="<?= $saveOrderingUrl; ?>"
|
||||||
<tr>
|
data-direction="<?= strtolower($listDirn); ?>" data-nested="true" <?php
|
||||||
<td>
|
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); ?>
|
<?= 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>
|
||||||
<td>
|
<td class="text-center">
|
||||||
<?= $item->id ?>
|
<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'packages.', $canChange); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<th>
|
||||||
<a href="<?= Route::_('index.php?option=com_depot&task=package.edit&id=' .
|
<a href="<?= Route::_('index.php?option=com_depot&task=package.edit&id=' .
|
||||||
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
||||||
<?= $this->escape($item->name); ?>
|
<?= $this->escape($item->name); ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->escape($item->description); ?>
|
<?= $this->escape($item->description); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->escape($item->mounting_style); ?>
|
<?= $this->escape($item->mounting_style); ?>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $item->id ?>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -10,11 +10,24 @@
|
|||||||
|
|
||||||
use Joomla\CMS\HTML\HTMLHelper;
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
use Joomla\CMS\Router\Route;
|
|
||||||
use Joomla\CMS\Layout\LayoutHelper;
|
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">
|
<form action="<?= Route::_('index.php?option=com_depot&view=parts'); ?>" method="post" name="adminForm" id="adminForm">
|
||||||
|
|
||||||
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
|
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
|
||||||
@ -26,28 +39,31 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<td class="w-1 text-center">
|
||||||
<?= HTMLHelper::_('grid.checkall'); ?>
|
<?= HTMLHelper::_('grid.checkall'); ?>
|
||||||
|
</td>
|
||||||
|
<th scope="col" class="w-1 text-center">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'd.state', $listDirn, $listOrder); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th scope="col">
|
||||||
<?= HTMLHelper::_(
|
|
||||||
'searchtools.sort',
|
|
||||||
'JGRID_HEADING_ID',
|
|
||||||
'd.id',
|
|
||||||
$this->listDirn,
|
|
||||||
$this->listOrder
|
|
||||||
); ?>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<?= HTMLHelper::_(
|
<?= HTMLHelper::_(
|
||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_NAME',
|
'COM_DEPOT_TABLE_HEAD_NAME',
|
||||||
'd.component_name',
|
'd.component_name',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@ -55,8 +71,8 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_QUANTITY',
|
'COM_DEPOT_TABLE_HEAD_QUANTITY',
|
||||||
'd.quantity',
|
'd.quantity',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@ -67,8 +83,8 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_MANUFACTURER',
|
'COM_DEPOT_TABLE_HEAD_MANUFACTURER',
|
||||||
'manufacturer',
|
'manufacturer',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@ -76,8 +92,17 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
'searchtools.sort',
|
'searchtools.sort',
|
||||||
'COM_DEPOT_TABLE_HEAD_STOCK',
|
'COM_DEPOT_TABLE_HEAD_STOCK',
|
||||||
'stock_name',
|
'stock_name',
|
||||||
$this->listDirn,
|
$listDirn,
|
||||||
$this->listOrder
|
$listOrder
|
||||||
|
); ?>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="w-1 text-center">
|
||||||
|
<?= HTMLHelper::_(
|
||||||
|
'searchtools.sort',
|
||||||
|
'JGRID_HEADING_ID',
|
||||||
|
'd.id',
|
||||||
|
$listDirn,
|
||||||
|
$listOrder
|
||||||
); ?>
|
); ?>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -85,13 +110,13 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach ($this->items as $i => $item): ?>
|
<?php foreach ($this->items as $i => $item): ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td class="text-center">
|
||||||
<?= HTMLHelper::_('grid.id', $i, $item->id); ?>
|
<?= HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->component_name); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="text-center">
|
||||||
<?= $item->id ?>
|
<?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'parts.', $canChange); ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<th>
|
||||||
<div class="break-word">
|
<div class="break-word">
|
||||||
<a href="<?= Route::_('index.php?option=com_depot&task=part.edit&id=' .
|
<a href="<?= Route::_('index.php?option=com_depot&task=part.edit&id=' .
|
||||||
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
||||||
@ -110,7 +135,7 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->escape($item->quantity); ?>
|
<?= $this->escape($item->quantity); ?>
|
||||||
</td>
|
</td>
|
||||||
@ -124,7 +149,6 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
<a class="break-word" href="<?= Route::_('index.php?option=com_depot&task=stock.edit&id=' .
|
<a class="break-word" href="<?= Route::_('index.php?option=com_depot&task=stock.edit&id=' .
|
||||||
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
|
||||||
<?= $this->escape($item->stock_name); ?>
|
<?= $this->escape($item->stock_name); ?>
|
||||||
@ -132,7 +156,9 @@ use Joomla\CMS\Layout\LayoutHelper;
|
|||||||
<div class="small">
|
<div class="small">
|
||||||
<?= $this->escape($item->owner); ?>
|
<?= $this->escape($item->owner); ?>
|
||||||
</div>
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?= $item->id ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
<extension type="component" method="upgrade">
|
<extension type="component" method="upgrade">
|
||||||
<name>Depot</name>
|
<name>Depot</name>
|
||||||
<author>KW4NZ</author>
|
<author>KW4NZ</author>
|
||||||
<creationDate>2023-11-01</creationDate>
|
<creationDate>2023-11-02</creationDate>
|
||||||
<copyright>(C) KW4NZ Thomas Kuschel</copyright>
|
<copyright>(C) KW4NZ Thomas Kuschel</copyright>
|
||||||
<license>GPL v2 +; see LICENSE.md</license>
|
<license>GPL v2 +; see LICENSE.md</license>
|
||||||
<authorEmail>thomas@kuschel.at</authorEmail>
|
<authorEmail>thomas@kuschel.at</authorEmail>
|
||||||
<authorUrl>https://kuschel.at</authorUrl>
|
<authorUrl>https://kuschel.at</authorUrl>
|
||||||
<version>0.9.10</version>
|
<version>0.9.12</version>
|
||||||
<description>COM_DEPOT_XML_DESCRIPTION</description>
|
<description>COM_DEPOT_XML_DESCRIPTION</description>
|
||||||
<namespace path="src/">KW4NZ\Component\Depot</namespace>
|
<namespace path="src/">KW4NZ\Component\Depot</namespace>
|
||||||
<install> <!-- Runs on install -->
|
<install> <!-- Runs on install -->
|
||||||
|
Loading…
Reference in New Issue
Block a user