diff --git a/README.md b/README.md
index 4c43517..decca0a 100644
--- a/README.md
+++ b/README.md
@@ -574,7 +574,9 @@ incrementing it.
/* if it is 0 -> get the max + 1 value */
if (!$data['ordering']) {
$db = Factory::getDbo();
- $query = $db->getQuery(true)
+ // $query = $db->getQuery(true) // is deprecated,
+ // using createQuery() instead:
+ $query = $db->createQuery()
->select('MAX(ordering)')
->from('#__depot');
diff --git a/admin/forms/filter_packages.xml b/admin/forms/filter_packages.xml
index b961585..97845f8 100644
--- a/admin/forms/filter_packages.xml
+++ b/admin/forms/filter_packages.xml
@@ -35,6 +35,8 @@
+
+
diff --git a/admin/forms/filter_parts.xml b/admin/forms/filter_parts.xml
index eee1aef..c61215f 100644
--- a/admin/forms/filter_parts.xml
+++ b/admin/forms/filter_parts.xml
@@ -35,6 +35,8 @@
+
+
diff --git a/admin/forms/filter_stocks.xml b/admin/forms/filter_stocks.xml
index 5b343db..b8d14bd 100644
--- a/admin/forms/filter_stocks.xml
+++ b/admin/forms/filter_stocks.xml
@@ -25,10 +25,12 @@
label="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
class="js-select-submit-on-change"
- default="s.name ASC"
+ default=""
validate="options"
>
+
+
diff --git a/admin/forms/part.xml b/admin/forms/part.xml
index 5496fd8..f78b7b7 100644
--- a/admin/forms/part.xml
+++ b/admin/forms/part.xml
@@ -36,6 +36,12 @@
hint="COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER"
size="40"
/>
+
+
diff --git a/admin/language/en-GB/com_depot.ini b/admin/language/en-GB/com_depot.ini
index b15e615..d82925b 100644
--- a/admin/language/en-GB/com_depot.ini
+++ b/admin/language/en-GB/com_depot.ini
@@ -11,6 +11,8 @@ COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER="Auto-generate from component name"
COM_DEPOT_FIELD_ALIAS_STOCK_PLACEHOLDER="Auto-generate from stock name"
COM_DEPOT_FIELD_COMPONENT_NAME_DESC="The name of the component is unique. Please do not enter special characters or umlauts."
COM_DEPOT_FIELD_COMPONENT_NAME_LABEL="Component Name"
+COM_DEPOT_FIELD_DESCRIPTION_DESC="Enter here the description of the component"
+COM_DEPOT_FIELD_DESCRIPTION_LABEL="Description"
COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_DESC="Enter here the acronym of the manufacturer or short name"
COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_LABEL="Manufacturer Acronym"
COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_DESC="Enter here the long name of the manufacturer"
diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql
index b4be42b..0ea5c38 100644
--- a/admin/sql/install.mysql.utf8.sql
+++ b/admin/sql/install.mysql.utf8.sql
@@ -8,6 +8,7 @@
DROP TABLE IF EXISTS `#__depot`;
CREATE TABLE `#__depot` (
`id` SERIAL,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
`component_name` VARCHAR(1024) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL
COMMENT 'unique component name (ASCII characters only)',
`alias` VARCHAR(1024) NOT NULL DEFAULT '',
@@ -28,7 +29,6 @@ CREATE TABLE `#__depot` (
`access` TINYINT(4) NOT NULL DEFAULT 0,
`params` VARCHAR(1024) NOT NULL DEFAULT '',
`image` VARCHAR(1024) NOT NULL DEFAULT '',
- `ordering` INT(11) NOT NULL DEFAULT 0,
`version` int unsigned NOT NULL DEFAULT 1,
-- references to other tables:
`category_id` INT(11) NOT NULL DEFAULT 0,
@@ -49,11 +49,13 @@ CREATE TABLE `#__depot` (
INSERT INTO `#__depot` (`component_name`,`alias`,`description`,`quantity`,`created`,
`ordering`,`state`,`manufacturer_id`,`stock_id`,`package_id`) VALUES
('1N5404','1n5404','diode, rectifier 3A',9,'2023-09-25 15:00:00',1,1,1,1,9),
- ('1N4148','1n4148','diode, general purpose',1234,'2023-09-25 15:15:15',2,1,2,1,8);
+ ('1N4148','1n4148','diode, general purpose',1234,'2023-09-25 15:15:15',2,1,2,1,8)
+ ('R_120R','r_120r','resistor, metalic',46,'2023-11-15 23:40:00',3,1,1,2,11);
DROP TABLE IF EXISTS `#__depot_manufacturer`;
CREATE TABLE `#__depot_manufacturer` (
`id` SERIAL,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
`name_short` CHAR(25) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL
COMMENT 'unique manufacturer name or abbriviation',
`alias` VARCHAR(127) NOT NULL DEFAULT '',
@@ -85,6 +87,7 @@ INSERT INTO `#__depot_manufacturer` (`name_short`, `name_long`, `url`,
DROP TABLE IF EXISTS `#__depot_stock`;
CREATE TABLE `#__depot_stock` (
`id` SERIAL,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
`name` VARCHAR(1024) NOT NULL DEFAULT '',
`alias` VARCHAR(1024) NOT NULL DEFAULT '',
`owner_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
@@ -123,6 +126,7 @@ INSERT INTO `#__depot_stock`(`name`, `location`, `description`, `state`, `access
DROP TABLE IF EXISTS `#__depot_package`;
CREATE TABLE `#__depot_package` (
`id` SERIAL,
+ `ordering` INT(11) NOT NULL DEFAULT 0,
`name` VARCHAR(400) NOT NULL DEFAULT '',
`description` VARCHAR(4000) NOT NULL DEFAULT '',
`alias` VARCHAR(400) NOT NULL DEFAULT '',
@@ -137,7 +141,6 @@ CREATE TABLE `#__depot_package` (
`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`)
) ENGINE = InnoDB
AUTO_INCREMENT=0
@@ -163,8 +166,8 @@ INSERT INTO `#__depot_package` (`name`,`description`,`state`,`mounting_style_id`
DROP TABLE IF EXISTS `#__depot_mounting_style`;
CREATE TABLE `#__depot_mounting_style` (
`id` SERIAL,
- `title` VARCHAR(100) NOT NULL DEFAULT '',
`ordering` INT(11) NOT NULL DEFAULT 0,
+ `title` VARCHAR(100) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT=0
diff --git a/admin/src/Model/PackageModel.php b/admin/src/Model/PackageModel.php
index f97f00d..cd446c7 100644
--- a/admin/src/Model/PackageModel.php
+++ b/admin/src/Model/PackageModel.php
@@ -41,6 +41,37 @@ class PackageModel extends AdminModel
return $data;
}
+
+ protected function prepareTable($table)
+ {
+ $date = Factory::getDate();
+ $user = $this->getCurrentUser();
+
+ if (empty($table->id)) {
+ // Set the values
+ $table->created = $date->toSql();
+ $table->created_by = $user->id;
+
+ // Set ordering to the last item if not set
+ if (empty($table->ordering)) {
+
+ $db = $this->getDatabase();
+ $query = $db->createQuery()
+ ->select('MAX(' . $db->quoteName('ordering') . ')')
+ ->from($db->quoteName('#__depot_package'));
+
+ $db->setQuery($query);
+ $max = $db->loadResult();
+
+ $table->ordering = ++$max;
+ }
+ } else {
+ // Set the values
+ $table->modified = $date->toSql();
+ $table->modified_by = $user->id;
+ }
+ }
+
public function save($data)
{
/* Add code to modify data before saving */
diff --git a/admin/src/Model/PackagesModel.php b/admin/src/Model/PackagesModel.php
index a212087..02eccab 100644
--- a/admin/src/Model/PackagesModel.php
+++ b/admin/src/Model/PackagesModel.php
@@ -10,7 +10,6 @@
namespace KW4NZ\Component\Depot\Administrator\Model;
-use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
@@ -124,8 +123,9 @@ class PackagesModel extends ListModel
return $query;
}
+
/**
- * Returns a reference to the a Table object, always creating it.
+ * Returns a reference to the Table object, always creating it.
*
* @param string $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
@@ -139,5 +139,4 @@ class PackagesModel extends ListModel
{
return parent::getTable($type, $prefix, $config);
}
-
}
\ No newline at end of file
diff --git a/admin/src/Model/PartsModel.php b/admin/src/Model/PartsModel.php
index 0795d10..ac03abf 100644
--- a/admin/src/Model/PartsModel.php
+++ b/admin/src/Model/PartsModel.php
@@ -11,10 +11,11 @@
namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel;
-// use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
+// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
class PartsModel extends ListModel
{
@@ -31,6 +32,10 @@ class PartsModel extends ListModel
'd.alias',
'quantity',
'd.quantity',
+ 'ordering',
+ 'd.ordering',
+ 'description',
+ 'd.description',
'published',
'd.published',
'package',
@@ -75,6 +80,8 @@ class PartsModel extends ListModel
$db->quoteName('d.quantity_exp'),
$db->quoteName('d.ordering'),
$db->quoteName('d.package_id'),
+ $db->quoteName('d.checked_out'),
+ $db->quoteName('d.checked_out_time'),
]
)
)
@@ -103,6 +110,7 @@ class PartsModel extends ListModel
$like = $db->quote('%' . $search . '%');
$query->where($db->quoteName('d.component_name') . ' LIKE ' . $like);
}
+
// Filter by published state
$published = (string) $this->getState('filter.published');
if (is_numeric($published)) {
@@ -114,9 +122,10 @@ class PartsModel extends ListModel
}
// add list ordering clause
- $orderCol = $this->state->get('list.ordering', 'id');
- $orderDirn = $this->state->get('list.direction', 'desc');
- $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
+ $query->order(
+ $db->quoteName($db->escape($this->getState('list.ordering', 'd.ordering'))) . ' ' .
+ $db->escape($this->getState('list.direction', 'ASC'))
+ );
return $query;
}
diff --git a/admin/src/Model/StocksModel.php b/admin/src/Model/StocksModel.php
index e92ea44..0103825 100644
--- a/admin/src/Model/StocksModel.php
+++ b/admin/src/Model/StocksModel.php
@@ -11,10 +11,12 @@
namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel;
-// use Joomla\CMS\Table\Table;
+use Joomla\CMS\Table\Table;
use Joomla\Database\ParameterType;
+// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
class StocksModel extends ListModel
{
@@ -23,18 +25,25 @@ class StocksModel extends ListModel
$config['filter_fields'] = [
'id',
's.id',
- 's.name',
'name',
+ 's.name',
'alias',
's.alias',
- 's.description',
- 'description',
+ 'state',
+ 's.state',
'published',
- 'd.published',
+ 's.published',
+ 'description',
+ 's.description',
+ 'ordering',
+ 's.ordering',
+ 'checked_out',
+ 's.checked_out',
'owner',
];
parent::__construct($config);
}
+
/**
* Build an SQL query to load the list data.
*
@@ -66,6 +75,10 @@ class StocksModel extends ListModel
$db->quoteName('s.name'),
$db->quoteName('s.alias'),
$db->quoteName('s.description'),
+ $db->quoteName('s.state'),
+ $db->quoteName('s.ordering'),
+ $db->quoteName('s.checked_out'),
+ $db->quoteName('s.checked_out_time'),
]
)
)
@@ -99,9 +112,27 @@ class StocksModel extends ListModel
// Add the list ordering clause.
$query->order(
- $db->quoteName($db->escape($this->getState('list.ordering', 'id'))) . ' ' . $db->escape($this->getState('list.direction', 'ASC'))
+ $db->quoteName($db->escape($this->getState('list.ordering', 's.ordering'))) . ' ' .
+ $db->escape($this->getState('list.direction', 'ASC'))
);
return $query;
}
+
+ /**
+ * Returns a reference to the 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 = 'Stock', $prefix = 'Administrator', $config = [])
+ {
+ return parent::getTable($type, $prefix, $config);
+ }
+
}
\ No newline at end of file
diff --git a/admin/src/Table/PackageTable.php b/admin/src/Table/PackageTable.php
index 6cc1f9d..c25f053 100644
--- a/admin/src/Table/PackageTable.php
+++ b/admin/src/Table/PackageTable.php
@@ -32,6 +32,7 @@ class PackageTable extends Table
parent::check();
} catch (\Exception $e) {
$this->setError($e->getMessage());
+
return false;
}
@@ -50,7 +51,7 @@ class PackageTable extends Table
}
// Set modified to created if not set
- if ($this->modified) {
+ if (!$this->modified) {
$this->modified = $this->created;
}
// Set modified_by to created_by if not set
@@ -92,19 +93,19 @@ class PackageTable extends Table
}
/***
- if (!empty($this->alias)) {
- // Verify that the alias is unique
- $table = $app->bootComponent('com_depot')->getMVCFactory()->createTable('Package', 'Administrator');
- if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0)) {
- $this->setError('Alias is not unique.');
- if ($table->state == -2) {
- $this->setError('Alias is not unique. The item is in Trash.');
- }
+ if (!empty($this->alias)) {
+ // Verify that the alias is unique
+ $table = $app->bootComponent('com_depot')->getMVCFactory()->createTable('Package', 'Administrator');
+ if ($table->load(['alias' => $this->alias]) && ($table->id != $this->id || $this->id == 0)) {
+ $this->setError('Alias is not unique.');
+ if ($table->state == -2) {
+ $this->setError('Alias is not unique. The item is in Trash.');
+ }
- return false;
- }
- }
- */
+ return false;
+ }
+ }
+ */
return parent::store($updateNulls);
}
}
\ No newline at end of file
diff --git a/admin/src/Table/PartTable.php b/admin/src/Table/PartTable.php
index b8e3cdf..873e5cb 100644
--- a/admin/src/Table/PartTable.php
+++ b/admin/src/Table/PartTable.php
@@ -26,6 +26,42 @@ class PartTable extends Table
$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)
{
$app = Factory::getApplication();
diff --git a/admin/src/Table/StockTable.php b/admin/src/Table/StockTable.php
index 6dca676..b5b456e 100644
--- a/admin/src/Table/StockTable.php
+++ b/admin/src/Table/StockTable.php
@@ -26,6 +26,40 @@ class StockTable extends Table
$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;
+ }
+ }
public function store($updateNulls = true)
{
$app = Factory::getApplication();
diff --git a/admin/src/View/Packages/HtmlView.php b/admin/src/View/Packages/HtmlView.php
index e097079..915b2b3 100644
--- a/admin/src/View/Packages/HtmlView.php
+++ b/admin/src/View/Packages/HtmlView.php
@@ -10,10 +10,8 @@
namespace KW4NZ\Component\Depot\Administrator\View\Packages;
-use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
-// use Joomla\CMS\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
@@ -37,7 +35,7 @@ class HtmlView extends BaseHtmlView
$this->setLayout('emptystate');
}
- // set the toolbar
+ // Set the toolbar
$this->addToolbar();
parent::display($tpl);
diff --git a/admin/src/View/Parts/HtmlView.php b/admin/src/View/Parts/HtmlView.php
index 068d360..830abd5 100644
--- a/admin/src/View/Parts/HtmlView.php
+++ b/admin/src/View/Parts/HtmlView.php
@@ -10,15 +10,13 @@
namespace KW4NZ\Component\Depot\Administrator\View\Parts;
-defined('_JEXEC') or die;
-
-use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
-// use Joomla\CMS\Toolbar;
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
@@ -33,7 +31,11 @@ class HtmlView extends BaseHtmlView
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
- // set the toolbar
+ if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
+ $this->setLayout('emptystate');
+ }
+
+ // Set the toolbar
$this->addToolbar();
parent::display($tpl);
diff --git a/admin/src/View/Stocks/HtmlView.php b/admin/src/View/Stocks/HtmlView.php
index d8ffe21..6490a66 100644
--- a/admin/src/View/Stocks/HtmlView.php
+++ b/admin/src/View/Stocks/HtmlView.php
@@ -10,36 +10,33 @@
namespace KW4NZ\Component\Depot\Administrator\View\Stocks;
-defined('_JEXEC') or die;
-
-use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
-// use Joomla\CMS\Toolbar;
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
{
public function display($tpl = null)
{
- // Get application
- $app = Factory::getApplication();
+ /**@var StocksModel $model */
+ $model = $this->getModel();
- $this->items = $this->get('Items');
- $this->state = $this->get('State');
- // 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');
+ $this->items = $model->getItems();
+ $this->pagination = $model->getPagination();
+ $this->state = $model->getState();
+ $this->filterForm = $model->getFilterForm();
+ $this->activeFilters = $model->getActiveFilters();
- // set the toolbar
+ if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
+ $this->setLayout('emptystate');
+ }
+
+ // Set the toolbar
$this->addToolbar();
parent::display($tpl);
diff --git a/admin/tmpl/manufacturers/default.php b/admin/tmpl/manufacturers/default.php
index 90e1748..81c9c20 100644
--- a/admin/tmpl/manufacturers/default.php
+++ b/admin/tmpl/manufacturers/default.php
@@ -84,7 +84,7 @@ use Joomla\CMS\Layout\LayoutHelper;
- pagination->getListFooter(); ?>
+ = $this->pagination->getListFooter(); ?>
diff --git a/admin/tmpl/packages/default.php b/admin/tmpl/packages/default.php
index 95a721a..1816300 100644
--- a/admin/tmpl/packages/default.php
+++ b/admin/tmpl/packages/default.php
@@ -10,9 +10,8 @@
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;
+use Joomla\CMS\Router\Route;
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
@@ -44,12 +43,12 @@ if ($saveOrder && !empty($this->items)) {
- ,
+ = Text::_('COM_DEPOT_PACKAGES_TABLE_CAPTION'); ?>,
-
+ = Text::_('JGLOBAL_SORTED_BY'); ?>
,
-
+ = Text::_('JGLOBAL_FILTERED_BY'); ?>
@@ -58,10 +57,10 @@ if ($saveOrder && !empty($this->items)) {
= HTMLHelper::_('grid.checkall'); ?>
-
+ = HTMLHelper::_('searchtools.sort', '', 'p.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
|
-
+ = HTMLHelper::_('searchtools.sort', 'JSTATUS', 'p.state', $listDirn, $listOrder); ?>
|
= HTMLHelper::_(
@@ -109,7 +108,7 @@ if ($saveOrder && !empty($this->items)) {
$ordering = ($listOrder == 'ordering');
$canChange = true;
?>
- |
+
= HTMLHelper::_('grid.id', $i, $item->id); ?>
|
@@ -123,11 +122,11 @@ if ($saveOrder && !empty($this->items)) {
$iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
}
?>
-
+
-
@@ -135,7 +134,7 @@ if ($saveOrder && !empty($this->items)) {
- state, $i, 'packages.', $canChange); ?>
+ = HTMLHelper::_('jgrid.published', $item->state, $i, 'packages.', $canChange); ?>
|
diff --git a/admin/tmpl/part/edit.php b/admin/tmpl/part/edit.php
index bb95a91..008a1ae 100644
--- a/admin/tmpl/part/edit.php
+++ b/admin/tmpl/part/edit.php
@@ -32,12 +32,9 @@ $wa->useScript('form.validate')
= Text::_('COM_DEPOT_LEGEND_PART_DETAILS') ?>
-
+
= $this->form->renderFieldset('details'); ?>
-
- = $this->form->getInput('description'); ?>
-
= HtmlHelper::_('uitab.endTab'); ?>
diff --git a/admin/tmpl/parts/default.php b/admin/tmpl/parts/default.php
index 77ccb7c..18912b0 100644
--- a/admin/tmpl/parts/default.php
+++ b/admin/tmpl/parts/default.php
@@ -39,14 +39,14 @@ if ($saveOrder && !empty($this->items)) {
= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
-
+
- ,
+ = Text::_('COM_DEPOT_PARTS_TABLE_CAPTION'); ?>,
-
+ = Text::_('JGLOBAL_SORTED_BY'); ?>
,
-
+ = Text::_('JGLOBAL_FILTERED_BY'); ?>
@@ -55,7 +55,10 @@ if ($saveOrder && !empty($this->items)) {
= HTMLHelper::_('grid.checkall'); ?>
-
+ = HTMLHelper::_('searchtools.sort', '', 'd.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
+ |
+
+ = HTMLHelper::_('searchtools.sort', 'JSTATUS', 'd.state', $listDirn, $listOrder); ?>
|
= HTMLHelper::_(
@@ -78,6 +81,15 @@ if ($saveOrder && !empty($this->items)) {
|
= Text::_('COM_DEPOT_TABLE_HEAD_QUANTITY_EXP') ?>
|
+
+ = HTMLHelper::_(
+ 'searchtools.sort',
+ 'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
+ 'd.description',
+ $listDirn,
+ $listOrder
+ ); ?>
+ |
= HTMLHelper::_(
'searchtools.sort',
@@ -107,14 +119,39 @@ if ($saveOrder && !empty($this->items)) {
|
-
- items as $i => $item): ?>
-
-
+ | class="js-draggable" data-url="= $saveOrderingUrl; ?>"
+ data-direction="= strtolower($listDirn); ?>" data-nested="true" >
+ items as $i => $item):
+ $ordering = ($listOrder == 'ordering');
+ $canChange = true;
+ ?>
+
+
= HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->component_name); ?>
+ |
+
+
+
+
+
+
+
+
+
+ = $item->ordering; ?>
+
|
- state, $i, 'parts.', $canChange); ?>
+ = HTMLHelper::_('jgrid.published', $item->state, $i, 'parts.', $canChange); ?>
|
|
- pagination->getListFooter(); ?>
+ = $this->pagination->getListFooter(); ?>
diff --git a/admin/tmpl/stocks/default.php b/admin/tmpl/stocks/default.php
index 3869a4b..dd2d2e4 100644
--- a/admin/tmpl/stocks/default.php
+++ b/admin/tmpl/stocks/default.php
@@ -13,6 +13,20 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
+$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 == 's.ordering';
+
+if ($saveOrder && !empty($this->items)) {
+ $saveOrderingUrl = 'index.php?option=com_depot&task=stocks.saveOrderAjax&tmpl=component';
+ HTMLHelper::_('draggablelist.draggable');
+}
?>
|