Compare commits

..

17 Commits

Author SHA1 Message Date
42870bdca1 FIX deprecated function setQuery(true), using createQuery() instead. 2024-09-04 23:46:01 +02:00
0532b525b5 ADD script file for installation process (template) 2024-09-01 01:03:07 +02:00
d395377760 UPD depot version 0.9.20 2024-05-29 07:55:55 +02:00
45831a97aa FIX extension name should be "com_depot" instead of Depot 2024-05-26 15:20:20 +02:00
0c66b24962 UPD test and fix zipdepot script 2024-05-26 01:50:52 +02:00
62b749fe61 UPD depot.xml 2024-05-26 01:34:25 +02:00
b31d6faa46 UPD zipdepot script to increment version 2024-05-26 01:26:13 +02:00
82cec820d3 ADD zip file, commit with lfs 2024-05-25 22:39:15 +02:00
464f7bd1ac C3 Front End Model for Item, Test: localhost/index.php?option=com_depot&view=part&id=1 2023-11-19 12:16:54 +01:00
bedb36c136 Version 0.9.13 2023-11-18 21:05:43 +01:00
f656fb70fa UPD version 0.9.12 2023-11-12 22:56:20 +01:00
616bf0ca31 ADD pagination for all table lists 2023-11-01 08:06:41 +01:00
3f72ee89ca Ordering and search, no pagination yet 2023-10-31 23:25:42 +01:00
6d03c99a34 ADD filtering and searching 0.9.7 2023-10-29 21:48:49 +01:00
372fdada98 ADD table package 2023-10-26 20:30:19 +02:00
add4b362ac ADD filter/search to manufacturers and stocks 2023-10-26 16:42:11 +02:00
e69f2af6b0 ADD search and filtering to the component 2023-10-26 12:58:58 +02:00
55 changed files with 2276 additions and 156 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@ -574,7 +574,9 @@ incrementing it.
/* if it is 0 -> get the max + 1 value */ /* if it is 0 -> get the max + 1 value */
if (!$data['ordering']) { if (!$data['ordering']) {
$db = Factory::getDbo(); $db = Factory::getDbo();
$query = $db->getQuery(true) // $query = $db->getQuery(true) // is deprecated,
// using createQuery() instead:
$query = $db->createQuery()
->select('MAX(ordering)') ->select('MAX(ordering)')
->from('#__depot'); ->from('#__depot');

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<form addfieldprefix="Joomla\Component\Depot\Administrator\Field">
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_DEPOT_FILTER_SEARCH_MANUFACTURERS_LABEL"
description="COM_DEPOT_FILTER_SEARCH_MANUFACTURERS_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JSTATUS"
class="js-select-submit-on-change"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
class="js-select-submit-on-change"
default="m.name_long ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="m.state ASC">JSTATUS_ASC</option>
<option value="m.state DESC">JSTATUS_DESC</option>
<option value="m.name_long ASC">COM_DEPOT_SORT_BY_MANUFACTURER_ASC</option>
<option value="m.name_long DESC">COM_DEPOT_SORT_BY_MANUFACTURER_DESC</option>
<option value="m.name_short ASC">COM_DEPOT_SORT_BY_ACRONYM_ASC</option>
<option value="m.name_short DESC">COM_DEPOT_SORT_BY_ACRONYM_DESC</option>
<option value="m.description ASC">COM_DEPOT_SORT_BY_DESCRIPTION_ASC</option>
<option value="m.description DESC">COM_DEPOT_SORT_BY_DESCRIPTION_DESC</option>
<option value="m.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="m.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIST_LIMIT"
default="25"
class="js-select-submit-on-change"
/>
</fields>
</form>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<form addfieldprefix="Joomla\Component\Depot\Administrator\Field">
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_DEPOT_FILTER_SEARCH_PACKAGES_LABEL"
description="COM_DEPOT_FILTER_SEARCH_PACKAGES_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JSTATUS"
class="js-select-submit-on-change"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
class="js-select-submit-on-change"
default=""
validate="options"
>
<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 DESC">JSTATUS_DESC</option>
<option value="p.name ASC">JGLOBAL_NAME_ASC</option>
<option value="p.name DESC">JGLOBAL_NAME_DESC</option>
<option value="p.description ASC">COM_DEPOT_SORT_BY_DESCRIPTION_ASC</option>
<option value="p.description DESC">COM_DEPOT_SORT_BY_DESCRIPTION_DESC</option>
<option value="p.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="p.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIST_LIMIT"
default="25"
class="js-select-submit-on-change"
/>
</fields>
</form>

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<form addfieldprefix="Joomla\Component\Depot\Administrator\Field">
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_DEPOT_FILTER_SEARCH_PARTS_LABEL"
description="COM_DEPOT_FILTER_SEARCH_PARTS_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JSTATUS"
class="js-select-submit-on-change"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
class="js-select-submit-on-change"
default="d.component_name ASC"
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="d.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="d.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="d.state ASC">JSTATUS_ASC</option>
<option value="d.state DESC">JSTATUS_DESC</option>
<option value="d.component_name ASC">JGLOBAL_NAME_ASC</option>
<option value="d.component_name DESC">JGLOBAL_NAME_DESC</option>
<option value="d.description ASC">COM_DEPOT_SORT_BY_DESCRIPTION_ASC</option>
<option value="d.description DESC">COM_DEPOT_SORT_BY_DESCRIPTION_DESC</option>
<option value="d.quantity ASC">COM_DEPOT_SORT_BY_QUANTITY_ASC</option>
<option value="d.quantity DESC">COM_DEPOT_SORT_BY_QUANTITY_DESC</option>
<option value="manufacturer ASC">COM_DEPOT_SORT_BY_MANUFACTURER_ASC</option>
<option value="manufacturer DESC">COM_DEPOT_SORT_BY_MANUFACTURER_DESC</option>
<option value="d.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="d.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIST_LIMIT"
default="25"
class="js-select-submit-on-change"
/>
</fields>
</form>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<form addfieldprefix="Joomla\Component\Depot\Administrator\Field">
<fields name="filter">
<field
name="search"
type="text"
inputmode="search"
label="COM_DEPOT_FILTER_SEARCH_STOCKS_LABEL"
description="COM_DEPOT_FILTER_SEARCH_STOCKS_DESC"
hint="JSEARCH_FILTER"
/>
<field
name="published"
type="status"
label="JSTATUS"
class="js-select-submit-on-change"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
</fields>
<fields name="list">
<field
name="fullordering"
type="list"
label="JGLOBAL_SORT_BY"
statuses="*,0,1,2,-2"
class="js-select-submit-on-change"
default=""
validate="options"
>
<option value="">JGLOBAL_SORT_BY</option>
<option value="s.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
<option value="s.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
<option value="s.state ASC">JSTATUS_ASC</option>
<option value="s.state DESC">JSTATUS_DESC</option>
<option value="s.name ASC">JGLOBAL_NAME_ASC</option>
<option value="s.name DESC">JGLOBAL_NAME_DESC</option>
<option value="owner ASC">COM_DEPOT_SORT_BY_OWNER_ASC</option>
<option value="owner DESC">COM_DEPOT_SORT_BY_OWNER_DESC</option>
<option value="s.description ASC">COM_DEPOT_SORT_BY_DESCRIPTION_ASC</option>
<option value="s.description DESC">COM_DEPOT_SORT_BY_DESCRIPTION_DESC</option>
<option value="s.id ASC">JGRID_HEADING_ID_ASC</option>
<option value="s.id DESC">JGRID_HEADING_ID_DESC</option>
</field>
<field
name="limit"
type="limitbox"
label="JGLOBAL_LIST_LIMIT"
default="25"
class="js-select-submit-on-change"
/>
</fields>
</form>

View File

@ -58,7 +58,7 @@
<field <field
name="created" name="created"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_CREATED_LABEL" label="JGLOBAL_FIELD_CREATED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -68,14 +68,14 @@
<field <field
name="created_by" name="created_by"
type="user" type="user"
label="COM_DEPOT_FIELD_CREATED_BY_LABEL" label="JGLOBAL_FIELD_CREATED_BY_LABEL"
class="readonly" class="readonly"
readonly="true" readonly="true"
/> />
<field <field
name="modified" name="modified"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_MODIFIED_LABEL" label="JGLOBAL_FIELD_MODIFIED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -85,7 +85,7 @@
<field <field
name="modified_by" name="modified_by"
type="user" type="user"
label="COM_DEPOT_FIELD_MODIFIED_BY_LABEL" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
class="readonly" class="readonly"
readonly="true" readonly="true"
/> />

90
admin/forms/package.xml Normal file
View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fieldset
name="details"
label="COM_DEPOT_DETAILS"
addruleprefix="KW4NZ\Component\Depot\Administrator\Rule"
addfieldprefix="KW4NZ\Component\Depot\Administrator\Field"
>
<field
name="name"
type="text"
label="COM_DEPOT_FIELD_PACKAGE_NAME_LABEL"
description="COM_DEPOT_FIELD_PACKAGE_NAME_DESC"
required="true"
autofocus="1"
/>
<field
name="alias"
type="text"
label="JFIELD_ALIAS_LABEL"
description="JFIELD_ALIAS_DESC"
hint="COM_DEPOT_FIELD_ALIAS_PACKAGE_PLACEHOLDER"
size="40"
/>
<field
name="mounting_style_id"
type="list"
label="COM_DEPOT_FIELD_PACKAGE_MOUNTING_STYLE_LABEL"
default="0"
>
<option value="0">JOPTION_DO_NOT_USE</option>
<option value="1">COM_DEPOT_LIST_MOUNTING_STYLE_SMD</option>
<option value="2">COM_DEPOT_LIST_MOUNTING_STYLE_THD</option>
<option value="3">COM_DEPOT_LIST_MOUNTING_STYLE_CHASSIS_MOUNT</option>
<option value="4">COM_DEPOT_LIST_MOUNTING_STYLE_PRESS_FIT</option>
<option value="5">COM_DEPOT_LIST_MOUNTING_STYLE_SCREW_MOUNT</option>
</field>
<field
name="state"
type="list"
label="JSTATUS"
class="form-select-color-state"
default="1"
validate="options"
>
<option value="1">JPUBLISHED</option>
<option value="0">JUNPUBLISHED</option>
<option value="2">JARCHIVED</option>
<option value="-2">JTRASHED</option>
</field>
</fieldset>
<fieldset
name="statistics"
label="COM_DEPOT_FIELD_STATISTICS"
>
<field
name="id"
type="text"
label="JGLOBAL_FIELD_ID_LABEL"
class="readonly"
default="0"
readonly="true"
/>
<field
name="created"
type="calendar"
label="JGLOBAL_FIELD_CREATED_LABEL"
class="readonly"
translateformat="true"
showtime="true"
readonly="true"
filter="user_utc"
/>
<field
name="created_by"
type="user"
label="JGLOBAL_FIELD_CREATED_BY_LABEL"
class="readonly"
readonly="true"
/>
<field
name="ordering"
type="text"
label="JFIELD_ORDERING_LABEL"
class="readonly"
default="0"
readonly="true"
/>
</fieldset>
</form>

View File

@ -36,11 +36,27 @@
hint="COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER" hint="COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER"
size="40" size="40"
/> />
<field
name="description"
type="text"
label="COM_DEPOT_FIELD_DESCRIPTION_LABEL"
description="COM_DEPOT_FIELD_DESCRIPTION_DESC"
/>
<field
name="package_id"
type="sql"
label="COM_DEPOT_FIELD_SELECT_PACKAGE"
query="SELECT id, CONCAT(name,' (',description,')') AS package FROM #__depot_package ORDER BY package"
key_field="id"
value_field="package"
>
<option value="">COM_DEPOT_SELECT_YOUR_OPTION</option>
</field>
<field <field
name="manufacturer_id" name="manufacturer_id"
type="sql" type="sql"
label="COM_DEPOT_FIELD_SELECT_MANUFACTURER" label="COM_DEPOT_FIELD_SELECT_MANUFACTURER"
query="SELECT id, CONCAT( name_short, ' (', name_long, ')') AS title FROM #__depot_manufacturer ORDER BY title" query="SELECT id, CONCAT(name_short,' (',name_long,')') AS title FROM #__depot_manufacturer ORDER BY title"
key_field="id" key_field="id"
value_field="title" value_field="title"
required="true" required="true"
@ -87,7 +103,7 @@
<field <field
name="created" name="created"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_CREATED_LABEL" label="JGLOBAL_FIELD_CREATED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -97,14 +113,14 @@
<field <field
name="created_by" name="created_by"
type="user" type="user"
label="COM_DEPOT_FIELD_CREATED_BY_LABEL" label="JGLOBAL_FIELD_CREATED_BY_LABEL"
class="readonly" class="readonly"
readonly="true" readonly="true"
/> />
<field <field
name="modified" name="modified"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_MODIFIED_LABEL" label="JGLOBAL_FIELD_MODIFIED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -114,7 +130,7 @@
<field <field
name="modified_by" name="modified_by"
type="user" type="user"
label="COM_DEPOT_FIELD_MODIFIED_BY_LABEL" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
class="readonly" class="readonly"
readonly="true" readonly="true"
/> />

View File

@ -21,6 +21,12 @@
description="COM_DEPOT_FIELD_STOCK_DESCRIPTION_DESC" description="COM_DEPOT_FIELD_STOCK_DESCRIPTION_DESC"
required="true" required="true"
/> />
<field
name="owner_id"
type="user"
label="COM_DEPOT_FIELD_STOCK_OWNER_LABEL"
description="COM_DEPOT_FIELD_STOCK_OWNER_DESC"
/>
<field <field
name="alias" name="alias"
type="text" type="text"
@ -58,7 +64,7 @@
<field <field
name="created" name="created"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_CREATED_LABEL" label="JGLOBAL_FIELD_CREATED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -68,14 +74,14 @@
<field <field
name="created_by" name="created_by"
type="user" type="user"
label="COM_DEPOT_FIELD_CREATED_BY_LABEL" label="JGLOBAL_FIELD_CREATED_BY_LABEL"
class="readonly" class="readonly"
readonly="true" readonly="true"
/> />
<field <field
name="modified" name="modified"
type="calendar" type="calendar"
label="COM_DEPOT_FIELD_MODIFIED_LABEL" label="JGLOBAL_FIELD_MODIFIED_LABEL"
class="readonly" class="readonly"
translateformat="true" translateformat="true"
showtime="true" showtime="true"
@ -85,9 +91,17 @@
<field <field
name="modified_by" name="modified_by"
type="user" type="user"
label="COM_DEPOT_FIELD_MODIFIED_BY_LABEL" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL"
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>

View File

@ -0,0 +1,109 @@
; @package Depot.Language German de-DE
; @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.0.1
;
COM_DEPOT_FIELD_ALIAS_MANUFACTURER_PLACEHOLDER="Automatisch aus dem Herstellerkürzel generieren"
COM_DEPOT_FIELD_ALIAS_PACKAGE_PLACEHOLDER="Automatisch aus dem Gehäusenamen erzeugen"
COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER="Automatisch aus dem Bauteilnamen erzeugen"
COM_DEPOT_FIELD_ALIAS_STOCK_PLACEHOLDER="Automatisch aus dem Lagernamen erzeugen"
COM_DEPOT_FIELD_COMPONENT_NAME_DESC="Der Bauteilname ist eindeutig. Bitte geben Sie keine Sonderzeichen oder Umlaute ein."
COM_DEPOT_FIELD_COMPONENT_NAME_LABEL="Bauteilname"
COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_DESC="Geben Sie hier das Herstellerkürzel oder einen kurzen Namen ein"
COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_LABEL="Herstellerkürzel"
COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_DESC="Geben Sie hier die vollständige Herstellerbezeichnung ein"
COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_LABEL="Hersteller (vollständige Bezeichnung)"
COM_DEPOT_FIELD_PACKAGE_LABEL="Gehäuse"
COM_DEPOT_FIELD_PACKAGE_MOUNTING_STYLE_LABEL="Montageart"
COM_DEPOT_FIELD_PACKAGE_NAME_DESC="Geben Sie hier das Gehäuse des Bauteils ein"
COM_DEPOT_FIELD_PACKAGE_NAME_LABEL="Gehäusebezeichnung"
COM_DEPOT_FIELD_QUANTITY_LABEL="Menge"
COM_DEPOT_FIELD_QUANTITY_DESC="Geben Sie hier die tatsächliche Anzahl an Bauteilen ein"
COM_DEPOT_FIELD_QUANTITY_EXP_LABEL="Mengenquotient"
COM_DEPOT_FIELD_QUANTITY_EXP_DESC="Exponent (10^x der Anzahl, normalerweise 0, d.h. 10⁰)"
COM_DEPOT_FIELD_SELECT_MANUFACTURER="Hersteller"
COM_DEPOT_FIELD_SELECT_PACKAGE="Gehäuse"
COM_DEPOT_FIELD_SELECT_STOCK="Lagerort"
COM_DEPOT_FIELD_STOCK_DESCRIPTION_DESC="Geben Sie hier die exakte Position/Beschreibung ein"
COM_DEPOT_FIELD_STOCK_DESCRIPTION_LABEL="Beschreibung"
COM_DEPOT_FIELD_STOCK_NAME_DESC="Geben Sie hier den Lagerort (Kurzbezeichnung) ein"
COM_DEPOT_FIELD_STOCK_NAME_LABEL="Lagerort"
COM_DEPOT_FIELD_STOCK_OWNER_DESC="Geben Sie hier den Besitzer des Lagers ein"
COM_DEPOT_FIELD_STOCK_OWNER_LABEL="Besitzer"
COM_DEPOT_FILTER_SEARCH_PARTS_DESC="Bauteilsuche"
COM_DEPOT_FILTER_SEARCH_PARTS_LABEL="Bauteilsuche"
COM_DEPOT_FILTER_SEARCH_STOCKS_DESC="Suche des Lagerortes"
COM_DEPOT_FILTER_SEARCH_STOCKS_LABEL="Lagerortsuche"
COM_DEPOT_LEGEND_MANUFACTURER_DETAILS="Herstellerdetails"
COM_DEPOT_LEGEND_PACKAGE_DETAILS="Gehäusedetails"
COM_DEPOT_LEGEND_PART_DETAILS="Bauteildetails"
COM_DEPOT_LEGEND_STATISTICS="Statistik"
COM_DEPOT_LEGEND_STOCK_DETAILS="Lagerort-Details"
COM_DEPOT_LIST_MOUNTING_STYLE_CHASSIS_MOUNT="Gehäuse-Montage"
COM_DEPOT_LIST_MOUNTING_STYLE_PRESS_FIT="Presspassung"
COM_DEPOT_LIST_MOUNTING_STYLE_SCREW_MOUNT="Schraubbefestigung"
COM_DEPOT_LIST_MOUNTING_STYLE_SMD="SMD (oberflächenmontiertes Bauteil)"
COM_DEPOT_LIST_MOUNTING_STYLE_THD="THD (bedrahtetes Bauteil)"
COM_DEPOT_LIST_MOUNTING_STYLE_UNKNOWN="Unbekannte Montageart"
COM_DEPOT_MANAGER_MANUFACTURERS="Verwaltung Hersteller"
COM_DEPOT_MANAGER_PACKAGES="Verwaltung Gehäuse"
COM_DEPOT_MANAGER_PARTS="Verwaltung Bauteile"
COM_DEPOT_MANAGER_STOCKS="Verwaltung Lagerorte"
COM_DEPOT_MANUFACTURERS_N_ITEMS_DELETED_1="Ein Hersteller entfernt"
COM_DEPOT_MANUFACTURERS_N_ITEMS_DELETED_MORE="%d Hersteller entfernt"
COM_DEPOT_MANUFACTURERS_N_ITEMS_PUBLISHED_1="Ein Hersteller veröffentlicht"
COM_DEPOT_MANUFACTURERS_N_ITEMS_PUBLISHED_MORE="%d Hersteller veröffentlicht"
COM_DEPOT_MANUFACTURERS_N_ITEMS_UNPUBLISHED_1="Ein Hersteller versteckt"
COM_DEPOT_MANUFACTURERS_N_ITEMS_UNPUBLISHED_MORE="%d Hersteller versteckt"
COM_DEPOT_N_ITEMS_DELETED_1="Ein Bauteil entfernt"
COM_DEPOT_N_ITEMS_DELETED_MORE="%d Bauteile entfernt"
COM_DEPOT_N_ITEMS_PUBLISHED_1="Ein Bauteil veröffentlicht"
COM_DEPOT_N_ITEMS_PUBLISHED_MORE="%d Bauteile veröffentlicht"
COM_DEPOT_N_ITEMS_UNPUBLISHED_1="Ein Bauteil versteckt"
COM_DEPOT_N_ITEMS_UNPUBLISHED_MORE="%d Bauteile versteckt"
COM_DEPOT_PACKAGES_N_ITEMS_DELETED_1="Ein Gehäuse entfernt"
COM_DEPOT_PACKAGES_N_ITEMS_DELETED_MORE="%d Gehäuse entfernt"
COM_DEPOT_PACKAGES_N_ITEMS_PUBLISHED_1="Ein Gehäuse veröffentlicht"
COM_DEPOT_PACKAGES_N_ITEMS_PUBLISHED_MORE="%d Gehäuse veröffentlicht"
COM_DEPOT_PACKAGES_N_ITEMS_UNPUBLISHED_1="Ein Gehäuse versteckt"
COM_DEPOT_PACKAGES_N_ITEMS_UNPUBLISHED_MORE="%d Gehäuse versteckt"
COM_DEPOT_SELECT_YOUR_OPTION="Wählen Sie Ihre Option"
COM_DEPOT_SORT_BY_ACRONYM_ASC="Herstellerkürzel aufsteigend"
COM_DEPOT_SORT_BY_ACRONYM_DESC="Herstellerkürzel absteigend"
COM_DEPOT_SORT_BY_DESCRIPTION_ASC="Beschreibung aufsteigend"
COM_DEPOT_SORT_BY_DESCRIPTION_DESC="Beschreibung absteigend"
COM_DEPOT_SORT_BY_MANUFACTURER_ASC="Hersteller aufsteigend"
COM_DEPOT_SORT_BY_MANUFACTURER_DESC="Hersteller absteigend"
COM_DEPOT_SORT_BY_OWNER_ASC="Besitzer aufsteigend"
COM_DEPOT_SORT_BY_OWNER_DESC="Besitzer absteigend"
COM_DEPOT_SORT_BY_QUANTITY_ASC="Menge aufsteigend"
COM_DEPOT_SORT_BY_QUANTITY_DESC="Menge absteigend"
COM_DEPOT_SORT_BY_STOCK_NAME_ASC="Lagerort aufsteigend"
COM_DEPOT_SORT_BY_STOCK_NAME_DESC="Lagerort absteigend"
COM_DEPOT_STOCKS_N_ITEMS_DELETED_1="Ein Lagerort entfernt"
COM_DEPOT_STOCKS_N_ITEMS_DELETED_MORE="%d Lagerorte entfernt"
COM_DEPOT_STOCKS_N_ITEMS_PUBLISHED_1="Ein Lagerort veröffentlicht"
COM_DEPOT_STOCKS_N_ITEMS_PUBLISHED_MORE="%d Lagerorte veröffentlicht"
COM_DEPOT_STOCKS_N_ITEMS_UNPUBLISHED_1="Ein Lagerort versteckt"
COM_DEPOT_STOCKS_N_ITEMS_UNPUBLISHED_MORE="%d Lagerorte versteckt"
COM_DEPOT_TAB_EDIT_MANUFACTURER="Herstellerdetails"
COM_DEPOT_TAB_EDIT_PACKAGE="Gehäusedetails"
COM_DEPOT_TAB_EDIT_PART="Bauteildetails"
COM_DEPOT_TAB_EDIT_STOCK="Lagerdetails"
COM_DEPOT_TAB_NEW_MANUFACTURER="Neuer Hersteller"
COM_DEPOT_TAB_NEW_PART="Neues Bauteil"
COM_DEPOT_TAB_STATISTICS="Statistik"
COM_DEPOT_TABLE_HEAD_DESCRIPTION="Beschreibung"
COM_DEPOT_TABLE_HEAD_ID="ID"
COM_DEPOT_TABLE_HEAD_MANUFACTURER="Hersteller"
COM_DEPOT_TABLE_HEAD_MANUFACTURER_ACRONYM="Kürzel"
COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE="Montageart"
COM_DEPOT_TABLE_HEAD_NAME="Bauteilname"
COM_DEPOT_TABLE_HEAD_OWNER="Besitzer"
COM_DEPOT_TABLE_HEAD_PACKAGE_NAME="Gehausename"
COM_DEPOT_TABLE_HEAD_QUANTITY="Menge"
COM_DEPOT_TABLE_HEAD_QUANTITY_EXP="Exponent"
COM_DEPOT_TABLE_HEAD_STOCK="Lagerort"
COM_DEPOT_XML_DESCRIPTION="Depot, das Bauteil-Warenhaus"

View File

@ -0,0 +1,12 @@
; @package Depot.Language German de-DE
; @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.0.1
;
COM_DEPOT_MENU="Depot"
COM_DEPOT_MENU_MANUFACTURERS="Hersteller"
COM_DEPOT_MENU_PACKAGES="Gehäuse"
COM_DEPOT_MENU_STOCKS="Lagerorte"
COM_DEPOT_XML_DESCRIPTION="Depot, das Bauteil-Warenhaus"

View File

@ -1,59 +1,111 @@
; @package Depot.Language ; @package Depot.Language English en-GB (default)
; @subpackage com_depot ; @subpackage com_depot
; @author Thomas Kuschel <thomas@kuschel.at> ; @author Thomas Kuschel <thomas@kuschel.at>
; @copyright (C) 2023 KW4NZ, <https://www.kuschel.at> ; @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
; @license GNU General Public License version 2 or later; see LICENSE.md ; @license GNU General Public License version 2 or later; see LICENSE.md
; @since 0.0.1 ; @since 0.0.1
; ;
COM_DEPOT_FIELD_ALIAS_MANUFACTURER_PLACEHOLDER="Auto-generate from manufacturer acronym"
COM_DEPOT_FIELD_ALIAS_PACKAGE_PLACEHOLDER="Auto-generate from package name"
COM_DEPOT_FIELD_ALIAS_PART_PLACEHOLDER="Auto-generate from component name" 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_ALIAS_STOCK_PLACEHOLDER="Auto-generate from stock name"
COM_DEPOT_FIELD_ALIAS_MANUFACTURER_PLACEHOLDER="Auto-generate from manufacturer acronym"
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_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_COMPONENT_NAME_LABEL="Component Name"
COM_DEPOT_FIELD_CREATED_LABEL="Created" COM_DEPOT_FIELD_DESCRIPTION_DESC="Enter here the description of the component"
COM_DEPOT_FIELD_CREATED_BY_LABEL="Created by" 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_DESC="Enter here the acronym of the manufacturer or short name"
COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_LABEL="Manufacturer Acronym" COM_DEPOT_FIELD_MANUFACTURER_ACRONYM_LABEL="Manufacturer Acronym"
COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_DESC="Enter here the long name of the manufacturer" COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_DESC="Enter here the long name of the manufacturer"
COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_LABEL="Manufacturer (long name)" COM_DEPOT_FIELD_MANUFACTURER_LONG_NAME_LABEL="Manufacturer (long name)"
COM_DEPOT_FIELD_MODIFIED_LABEL="Modified" COM_DEPOT_FIELD_PACKAGE_LABEL="Package"
COM_DEPOT_FIELD_MODIFIED_BY_LABEL="Modified by" COM_DEPOT_FIELD_PACKAGE_MOUNTING_STYLE_LABEL="Mounting Style"
COM_DEPOT_FIELD_QUANTITY_LABEL="Quantity" COM_DEPOT_FIELD_PACKAGE_NAME_DESC="Enter here the package name of the component"
COM_DEPOT_FIELD_PACKAGE_NAME_LABEL="Package Name"
COM_DEPOT_FIELD_QUANTITY_DESC="Enter here the current number of components" COM_DEPOT_FIELD_QUANTITY_DESC="Enter here the current number of components"
COM_DEPOT_FIELD_QUANTITY_EXP_LABEL="Quantity Exponent" COM_DEPOT_FIELD_QUANTITY_LABEL="Quantity"
COM_DEPOT_FIELD_QUANTITY_EXP_DESC="Exponent (10^x of the number, usually 0, i.e. 10⁰)" COM_DEPOT_FIELD_QUANTITY_EXP_DESC="Exponent (10^x of the number, usually 0, i.e. 10⁰)"
COM_DEPOT_FIELD_QUANTITY_EXP_LABEL="Quantity Exponent"
COM_DEPOT_FIELD_SELECT_MANUFACTURER="Manufacturer" COM_DEPOT_FIELD_SELECT_MANUFACTURER="Manufacturer"
COM_DEPOT_FIELD_SELECT_PACKAGE="Package"
COM_DEPOT_FIELD_SELECT_STOCK="Stock Location" COM_DEPOT_FIELD_SELECT_STOCK="Stock Location"
COM_DEPOT_FIELD_STOCK_NAME_DESC="Enter here the short stock location"
COM_DEPOT_FIELD_STOCK_NAME_LABEL="Stock Location"
COM_DEPOT_FIELD_STOCK_DESCRIPTION_DESC="Enter here the exact location/description" COM_DEPOT_FIELD_STOCK_DESCRIPTION_DESC="Enter here the exact location/description"
COM_DEPOT_FIELD_STOCK_DESCRIPTION_LABEL="Description" COM_DEPOT_FIELD_STOCK_DESCRIPTION_LABEL="Description"
COM_DEPOT_FIELD_STOCK_NAME_DESC="Enter here the short stock location"
COM_DEPOT_FIELD_STOCK_NAME_LABEL="Stock Location"
COM_DEPOT_FIELD_STOCK_OWNER_DESC="Enter here the owner of the stock"
COM_DEPOT_FIELD_STOCK_OWNER_LABEL="Owner"
COM_DEPOT_FILTER_SEARCH_PARTS_DESC="Search a Component"
COM_DEPOT_FILTER_SEARCH_PARTS_LABEL="Search a component"
COM_DEPOT_FILTER_SEARCH_STOCKS_DESC="Search in Stock Location"
COM_DEPOT_FILTER_SEARCH_STOCKS_LABEL="Search Stock Location"
COM_DEPOT_LEGEND_MANUFACTURER_DETAILS="Manufacturer Details" COM_DEPOT_LEGEND_MANUFACTURER_DETAILS="Manufacturer Details"
COM_DEPOT_LEGEND_PACKAGE_DETAILS="Package Details"
COM_DEPOT_LEGEND_PART_DETAILS="Component Details" COM_DEPOT_LEGEND_PART_DETAILS="Component Details"
COM_DEPOT_LEGEND_STOCK_DETAILS="Stock Location Details"
COM_DEPOT_LEGEND_STATISTICS="Statistics" COM_DEPOT_LEGEND_STATISTICS="Statistics"
COM_DEPOT_LEGEND_STOCK_DETAILS="Stock Location Details"
COM_DEPOT_LIST_MOUNTING_STYLE_CHASSIS_MOUNT="Chassis Mount"
COM_DEPOT_LIST_MOUNTING_STYLE_PRESS_FIT="Press Fit"
COM_DEPOT_LIST_MOUNTING_STYLE_SCREW_MOUNT="Screw Mount"
COM_DEPOT_LIST_MOUNTING_STYLE_SMD="SMD/SMT (surface-mounted device)"
COM_DEPOT_LIST_MOUNTING_STYLE_THD="THD (through hole device)"
COM_DEPOT_LIST_MOUNTING_STYLE_UNKNOWN="Unknown mounting style"
COM_DEPOT_MANAGER_MANUFACTURERS="Manager Manufacturers" COM_DEPOT_MANAGER_MANUFACTURERS="Manager Manufacturers"
COM_DEPOT_MANAGER_PACKAGES="Manager Packages"
COM_DEPOT_MANAGER_PARTS="Manager Components" COM_DEPOT_MANAGER_PARTS="Manager Components"
COM_DEPOT_MANAGER_STOCKS="Manager Stock Locations" COM_DEPOT_MANAGER_STOCKS="Manager Stock Locations"
COM_DEPOT_MANUFACTURERS_N_ITEMS_DELETED_1="One manufacturer deleted"
COM_DEPOT_MANUFACTURERS_N_ITEMS_DELETED_MORE="%d manufacturers deleted"
COM_DEPOT_MANUFACTURERS_N_ITEMS_PUBLISHED_1="One manufacturer published"
COM_DEPOT_MANUFACTURERS_N_ITEMS_PUBLISHED_MORE="%d manufacturers published"
COM_DEPOT_MANUFACTURERS_N_ITEMS_UNPUBLISHED_1="One manufacturer unpublished"
COM_DEPOT_MANUFACTURERS_N_ITEMS_UNPUBLISHED_MORE="%d manufacturers unpublished"
COM_DEPOT_N_ITEMS_DELETED_1="One component deleted" COM_DEPOT_N_ITEMS_DELETED_1="One component deleted"
COM_DEPOT_N_ITEMS_DELETED_MORE="%d components deleted" COM_DEPOT_N_ITEMS_DELETED_MORE="%d components deleted"
COM_DEPOT_N_ITEMS_PUBLISHED_1="One component published" COM_DEPOT_N_ITEMS_PUBLISHED_1="One component published"
COM_DEPOT_N_ITEMS_PUBLISHED_MORE="%d components published" COM_DEPOT_N_ITEMS_PUBLISHED_MORE="%d components published"
COM_DEPOT_N_ITEMS_UNPUBLISHED_1="One component unpublished" COM_DEPOT_N_ITEMS_UNPUBLISHED_1="One component unpublished"
COM_DEPOT_N_ITEMS_UNPUBLISHED_MORE="%d components unpublished" COM_DEPOT_N_ITEMS_UNPUBLISHED_MORE="%d components unpublished"
COM_DEPOT_PACKAGES_N_ITEMS_DELETED_1="One package deleted"
COM_DEPOT_PACKAGES_N_ITEMS_DELETED_MORE="%d packages deleted"
COM_DEPOT_PACKAGES_N_ITEMS_PUBLISHED_1="One package published"
COM_DEPOT_PACKAGES_N_ITEMS_PUBLISHED_MORE="%d packages published"
COM_DEPOT_PACKAGES_N_ITEMS_UNPUBLISHED_1="One package unpublished"
COM_DEPOT_PACKAGES_N_ITEMS_UNPUBLISHED_MORE="%d packages unpublished"
COM_DEPOT_SELECT_YOUR_OPTION="Select your option" COM_DEPOT_SELECT_YOUR_OPTION="Select your option"
COM_DEPOT_TAB_NEW_PART="New Component" COM_DEPOT_SORT_BY_ACRONYM_ASC="Acronym ascending"
COM_DEPOT_TAB_NEW_MANUFACTURER="New Manufacturer" COM_DEPOT_SORT_BY_ACRONYM_DESC="Acronym descending"
COM_DEPOT_TAB_EDIT_PART="Component Details" COM_DEPOT_SORT_BY_DESCRIPTION_ASC="Description ascending"
COM_DEPOT_SORT_BY_DESCRIPTION_DESC="Description descending"
COM_DEPOT_SORT_BY_MANUFACTURER_ASC="Manufacturer ascending"
COM_DEPOT_SORT_BY_MANUFACTURER_DESC="Manufacturer descending"
COM_DEPOT_SORT_BY_OWNER_ASC="Owner ascending"
COM_DEPOT_SORT_BY_OWNER_DESC="Owner descending"
COM_DEPOT_SORT_BY_QUANTITY_ASC="Quantity ascending"
COM_DEPOT_SORT_BY_QUANTITY_DESC="Quantity descending"
COM_DEPOT_SORT_BY_STOCK_NAME_ASC="Stock Location ascending"
COM_DEPOT_SORT_BY_STOCK_NAME_DESC="Stock Location descending"
COM_DEPOT_STOCKS_N_ITEMS_DELETED_1="One stock location deleted"
COM_DEPOT_STOCKS_N_ITEMS_DELETED_MORE="%d stock locations deleted"
COM_DEPOT_STOCKS_N_ITEMS_PUBLISHED_1="One stock location published"
COM_DEPOT_STOCKS_N_ITEMS_PUBLISHED_MORE="%d stock locations published"
COM_DEPOT_STOCKS_N_ITEMS_UNPUBLISHED_1="One stock location unpublished"
COM_DEPOT_STOCKS_N_ITEMS_UNPUBLISHED_MORE="%d stock locations unpublished"
COM_DEPOT_TAB_EDIT_MANUFACTURER="Manufacturer Details" COM_DEPOT_TAB_EDIT_MANUFACTURER="Manufacturer Details"
COM_DEPOT_TAB_EDIT_PACKAGE="Package Details"
COM_DEPOT_TAB_EDIT_PART="Component Details"
COM_DEPOT_TAB_EDIT_STOCK="Stock Details" COM_DEPOT_TAB_EDIT_STOCK="Stock Details"
COM_DEPOT_TAB_NEW_MANUFACTURER="New Manufacturer"
COM_DEPOT_TAB_NEW_PART="New Component"
COM_DEPOT_TAB_STATISTICS="Statistics" COM_DEPOT_TAB_STATISTICS="Statistics"
COM_DEPOT_TABLE_HEAD_DESCRIPTION="Description"
COM_DEPOT_TABLE_HEAD_ID="ID" COM_DEPOT_TABLE_HEAD_ID="ID"
COM_DEPOT_TABLE_HEAD_NAME="Component Name"
COM_DEPOT_TABLE_HEAD_MANUFACTURER="Manufacturer" COM_DEPOT_TABLE_HEAD_MANUFACTURER="Manufacturer"
COM_DEPOT_TABLE_HEAD_MANUFACTURER_ACRONYM="Acronym" COM_DEPOT_TABLE_HEAD_MANUFACTURER_ACRONYM="Acronym"
COM_DEPOT_TABLE_HEAD_STOCK="Stock Location" COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE="Mounting Style"
COM_DEPOT_TABLE_HEAD_NAME="Component Name"
COM_DEPOT_TABLE_HEAD_OWNER="Owner"
COM_DEPOT_TABLE_HEAD_PACKAGE_NAME="Package Name"
COM_DEPOT_TABLE_HEAD_QUANTITY="Quantity" COM_DEPOT_TABLE_HEAD_QUANTITY="Quantity"
COM_DEPOT_TABLE_HEAD_QUANTITY_EXP="Exponent" COM_DEPOT_TABLE_HEAD_QUANTITY_EXP="Exponent"
COM_DEPOT_TABLE_HEAD_DESCRIPTION="Description" COM_DEPOT_TABLE_HEAD_STOCK="Stock Location"
COM_DEPOT_XML_DESCRIPTION="Depot, the component warehouse" COM_DEPOT_XML_DESCRIPTION="Depot, the component warehouse"

View File

@ -1,4 +1,4 @@
; @package Depot.Language ; @package Depot.Language English en-GB (default)
; @subpackage com_depot ; @subpackage com_depot
; @author Thomas Kuschel <thomas@kuschel.at> ; @author Thomas Kuschel <thomas@kuschel.at>
; @copyright (C) 2023 KW4NZ, <https://www.kuschel.at> ; @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
@ -7,5 +7,6 @@
; ;
COM_DEPOT_MENU="Depot" COM_DEPOT_MENU="Depot"
COM_DEPOT_MENU_MANUFACTURERS="Manufacturers" COM_DEPOT_MENU_MANUFACTURERS="Manufacturers"
COM_DEPOT_MENU_PACKAGES="Packages"
COM_DEPOT_MENU_STOCKS="Stock locations" COM_DEPOT_MENU_STOCKS="Stock locations"
COM_DEPOT_XML_DESCRIPTION="Depot, the component warehouse" COM_DEPOT_XML_DESCRIPTION="Depot, the component warehouse"

View File

@ -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));

View File

@ -8,6 +8,7 @@
DROP TABLE IF EXISTS `#__depot`; DROP TABLE IF EXISTS `#__depot`;
CREATE TABLE `#__depot` ( CREATE TABLE `#__depot` (
`id` SERIAL, `id` SERIAL,
`ordering` INT(11) NOT NULL DEFAULT 0,
`component_name` VARCHAR(1024) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL `component_name` VARCHAR(1024) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL
COMMENT 'unique component name (ASCII characters only)', COMMENT 'unique component name (ASCII characters only)',
`alias` VARCHAR(1024) NOT NULL DEFAULT '', `alias` VARCHAR(1024) NOT NULL DEFAULT '',
@ -28,13 +29,13 @@ CREATE TABLE `#__depot` (
`access` TINYINT(4) NOT NULL DEFAULT 0, `access` TINYINT(4) NOT NULL DEFAULT 0,
`params` VARCHAR(1024) NOT NULL DEFAULT '', `params` VARCHAR(1024) NOT NULL DEFAULT '',
`image` 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, `version` int unsigned NOT NULL DEFAULT 1,
-- references to other tables: -- references to other tables:
`category_id` INT(11) NOT NULL DEFAULT 0, `category_id` INT(11) NOT NULL DEFAULT 0,
`datasheet_id` INT(11) NOT NULL DEFAULT 0, `datasheet_id` INT(11) NOT NULL DEFAULT 0,
`datasheet_alt` VARCHAR(1024) NOT NULL DEFAULT '', `datasheet_alt` VARCHAR(1024) NOT NULL DEFAULT '',
`manufacturer_id` INT(11) NOT NULL DEFAULT 0, `manufacturer_id` INT(11) NOT NULL DEFAULT 0,
`package_id` INT(11) NOT NULL DEFAULT 0,
`stock_id` INT(11) NOT NULL DEFAULT 0, `stock_id` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_state` (`state`), KEY `idx_state` (`state`),
@ -46,13 +47,15 @@ CREATE TABLE `#__depot` (
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `#__depot` (`component_name`,`alias`,`description`,`quantity`,`created`, INSERT INTO `#__depot` (`component_name`,`alias`,`description`,`quantity`,`created`,
`ordering`,`state`,`manufacturer_id`,`stock_id`) VALUES `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), ('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); ('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`; DROP TABLE IF EXISTS `#__depot_manufacturer`;
CREATE TABLE `#__depot_manufacturer` ( CREATE TABLE `#__depot_manufacturer` (
`id` SERIAL, `id` SERIAL,
`ordering` INT(11) NOT NULL DEFAULT 0,
`name_short` CHAR(25) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL `name_short` CHAR(25) CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL
COMMENT 'unique manufacturer name or abbriviation', COMMENT 'unique manufacturer name or abbriviation',
`alias` VARCHAR(127) NOT NULL DEFAULT '', `alias` VARCHAR(127) NOT NULL DEFAULT '',
@ -84,9 +87,10 @@ INSERT INTO `#__depot_manufacturer` (`name_short`, `name_long`, `url`,
DROP TABLE IF EXISTS `#__depot_stock`; DROP TABLE IF EXISTS `#__depot_stock`;
CREATE TABLE `#__depot_stock` ( CREATE TABLE `#__depot_stock` (
`id` SERIAL, `id` SERIAL,
`ordering` INT(11) NOT NULL DEFAULT 0,
`name` VARCHAR(1024) NOT NULL DEFAULT '', `name` VARCHAR(1024) NOT NULL DEFAULT '',
`alias` VARCHAR(1024) NOT NULL DEFAULT '', `alias` VARCHAR(1024) NOT NULL DEFAULT '',
`owner` INT(10) UNSIGNED NOT NULL DEFAULT 0, `owner_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`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,
@ -101,7 +105,7 @@ CREATE TABLE `#__depot_stock` (
`state` TINYINT(4) NOT NULL DEFAULT 0, `state` TINYINT(4) NOT NULL DEFAULT 0,
`access` TINYINT(4) NOT NULL DEFAULT 0, `access` TINYINT(4) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `nameindex` (`name`,`owner`) UNIQUE KEY `nameindex` (`name`,`owner_id`)
) )
ENGINE=InnoDB ENGINE=InnoDB
AUTO_INCREMENT=0 AUTO_INCREMENT=0
@ -118,3 +122,61 @@ INSERT INTO `#__depot_stock`(`name`, `location`, `description`, `state`, `access
'MARS Svratka Workshop Depot 5x12 (60) compartments à 54 x 35 x 140 mm',1,0), 'MARS Svratka Workshop Depot 5x12 (60) compartments à 54 x 35 x 140 mm',1,0),
('SMD cabinet', 'Tom''s office, Martinstr. 58a, 3400 Klosterneuburg', ('SMD cabinet', 'Tom''s office, Martinstr. 58a, 3400 Klosterneuburg',
'SMD cabinet, conductive, 6-times cabinet with inlays, 6 x 7*6 (252) round boxes, each ø 27 x 13 mm',1,0); 'SMD cabinet, conductive, 6-times cabinet with inlays, 6 x 7*6 (252) round boxes, each ø 27 x 13 mm',1,0);
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 '',
`image` VARCHAR(1024) NOT NULL DEFAULT '',
`state` TINYINT(4) NOT NULL DEFAULT 0
COMMENT 'Published=1,Unpublished=0,Archived=2,Trashed=-2',
`mounting_style_id` TINYINT(4) NOT NULL DEFAULT 0
COMMENT 'Unknown=0,Through_Hole=1,SMD/SMT=2',
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`created_by` INT(10) UNSIGNED 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',
`modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`modified_by` INT(10) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT=0
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `#__depot_package` (`name`,`description`,`state`,`mounting_style_id`) VALUES
('R_0603_1608Metric','1.6 x 0.8 mm',1,1),
('R_0805_2012Metric','2.0 x 1.2 mm',1,1),
('DIP8','dual inline package 8 pins',1,2),
('DIP14','dual inline package 14 pins',1,2),
('DIP16','dual inline package 16 pins',1,2),
('DIP20','dual inline package 20 pins',1,2),
('DIP28_SMALL','dual inline package 28 pins, small',1,2),
('DO-35','DO-204-AH, SOD27, 3.05-5.08 x ø1.53-ø2.28 mm diode axial package',1,2),
('DO-201AD','DO-27, 7.2-9.5 x ø4.8-ø5.3 mm diode axial package',1,2),
('QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mm','Ultra thin Fine pitch Quad Flat Package No-leads, 7 x 7 mm, 0.5 mm pitch, 48 pins',1,1),
('R_TH_0207','axial 6xø2.3mm typ. 0.25W',1,2),
('R_TH_0104','axial 3.3xø1.8mm typ 0.125W',1,2),
('R_TH_0309','axial 9xø3.2mm typ. 0.5W',1,2),
('R_TH_0412','axial 11.5xø4.5mm typ. 1W',1,2),
('R_TH_0516','axial 15.5xø5mm typ. 2W',1,2);
DROP TABLE IF EXISTS `#__depot_mounting_style`;
CREATE TABLE `#__depot_mounting_style` (
`id` SERIAL,
`ordering` INT(11) NOT NULL DEFAULT 0,
`title` VARCHAR(100) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT=0
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `#__depot_mounting_style` (`id`,`title`,`ordering`) VALUES
-- (0,'UNKNOWN',0),
(1,'SMD',1),
(2,'THD',2),
(3,'CHASSIS_MOUNT',3),
(4,'PRESS_FIT',4),
(5,'SCREW_MOUNT',5);

View File

@ -6,3 +6,7 @@
-- @since 0.0.2 -- @since 0.0.2
DROP TABLE IF EXISTS `#__depot`; DROP TABLE IF EXISTS `#__depot`;
DROP TABLE IF EXISTS `#__depot_manufacturer`;
DROP TABLE IF EXISTS `#__depot_stock`;
DROP TABLE IF EXISTS `#__depot_package`;
DROP TABLE IF EXISTS `#__depot_mounting_style`;

View File

@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS `#__depot_stock` (
`id` SERIAL, `id` SERIAL,
`name` VARCHAR(1024) NOT NULL DEFAULT '', `name` VARCHAR(1024) NOT NULL DEFAULT '',
`alias` VARCHAR(1024) NOT NULL DEFAULT '', `alias` VARCHAR(1024) NOT NULL DEFAULT '',
`owner` INT(10) UNSIGNED NOT NULL DEFAULT 0, `owner_id` INT(10) UNSIGNED NOT NULL DEFAULT 0,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`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,
@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `#__depot_stock` (
`state` TINYINT(4) NOT NULL DEFAULT 0, `state` TINYINT(4) NOT NULL DEFAULT 0,
`access` TINYINT(4) NOT NULL DEFAULT 0, `access` TINYINT(4) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `nameindex` (`name`,`owner`) UNIQUE KEY `nameindex` (`name`,`owner_id`)
) ENGINE=InnoDB ) ENGINE=InnoDB
AUTO_INCREMENT=0 AUTO_INCREMENT=0
DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View 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`;

View 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`;

View File

@ -0,0 +1,31 @@
<?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.9
*/
namespace KW4NZ\Component\Depot\Administrator\Controller;
use Joomla\CMS\MVC\Controller\AdminController;
defined('_JEXEC') or die;
class ManufacturersController extends AdminController
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 0.9.9
*/
protected $text_prefix = 'COM_DEPOT_MANUFACTURERS';
public function getModel($name = 'Manufacturer', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}
}

View File

@ -0,0 +1,20 @@
<?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
*/
namespace KW4NZ\Component\Depot\Administrator\Controller;
use Joomla\CMS\MVC\Controller\FormController;
defined('_JEXEC') or die;
class PackageController extends FormController
{
protected $text_prefix = 'COM_DEPOT_PACKAGE';
}

View File

@ -0,0 +1,31 @@
<?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.9
*/
namespace KW4NZ\Component\Depot\Administrator\Controller;
use Joomla\CMS\MVC\Controller\AdminController;
defined('_JEXEC') or die;
class PackagesController extends AdminController
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 0.9.9
*/
protected $text_prefix = 'COM_DEPOT_PACKAGES';
public function getModel($name = 'Package', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}
}

View File

@ -16,4 +16,5 @@ defined('_JEXEC') or die;
class StockController extends FormController class StockController extends FormController
{ {
protected $text_prefix = 'COM_DEPOT_STOCK';
} }

View File

@ -0,0 +1,31 @@
<?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.9
*/
namespace KW4NZ\Component\Depot\Administrator\Controller;
use Joomla\CMS\MVC\Controller\AdminController;
defined('_JEXEC') or die;
class StocksController extends AdminController
{
/**
* The prefix to use with controller messages.
*
* @var string
* @since 0.9.9
*/
protected $text_prefix = 'COM_DEPOT_STOCKS';
public function getModel($name = 'Stock', $prefix = 'Administrator', $config = ['ignore_request' => true])
{
return parent::getModel($name, $prefix, $config);
}
}

View File

@ -11,12 +11,37 @@
namespace KW4NZ\Component\Depot\Administrator\Model; namespace KW4NZ\Component\Depot\Administrator\Model;
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;
\defined('_JEXEC') or die; \defined('_JEXEC') or die;
class ManufacturersModel extends ListModel class ManufacturersModel extends ListModel
{ {
public function __construct($config = [])
{
$config['filter_fields'] = [
'id',
'm.id',
'name_short',
'm.name_short',
'name_long',
'm.name_long',
'alias',
'm.alias',
'state',
'm.state',
'published',
'm.published',
'description',
'm.descrition',
'image',
'm.image',
];
parent::__construct($config);
}
/** /**
* Build an SQL query to load the list data. * Build an SQL query to load the list data.
* *
@ -27,7 +52,7 @@ class ManufacturersModel extends ListModel
protected function getListQuery() protected function getListQuery()
{ {
$db = $this->getDatabase(); $db = $this->getDatabase();
$query = $db->getQuery(true); $query = $db->createQuery();
// $query->select('*') // $query->select('*')
@ -60,6 +85,14 @@ class ManufacturersModel extends ListModel
->from($db->quoteName('#__depot_manufacturer', 'm')) ->from($db->quoteName('#__depot_manufacturer', 'm'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('m.checked_out')); ->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('m.checked_out'));
// filter: like / search
$search = $this->getState('filter.search');
if (!empty($search)) {
$like = $db->quote('%' . $search . '%');
$query->where('(' . $db->quoteName('m.name_long') . ' LIKE ' . $like . ' OR ' .
$db->quoteName('m.name_short') . ' LIKE ' . $like . ')');
}
// Filter by published state // Filter by published state
$published = (string) $this->getState('filter.published'); $published = (string) $this->getState('filter.published');
if (is_numeric($published)) { if (is_numeric($published)) {
@ -70,6 +103,11 @@ class ManufacturersModel extends ListModel
$query->where($db->quoteName('m.state') . ' IN (0, 1)'); $query->where($db->quoteName('m.state') . ' IN (0, 1)');
} }
// add list ordering clause
$orderCol = $this->state->get('list.ordering', 'id');
$orderDirn = $this->state->get('list.direction', 'asc');
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
return $query; return $query;
} }
} }

View File

@ -0,0 +1,95 @@
<?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
*/
namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\AdminModel;
\defined('_JEXEC') or die;
class PackageModel extends AdminModel
{
public function getForm($data = [], $loadData = true)
{
$form = $this->loadForm('com_depot.package', 'package', ['control' => 'jform', 'load_data' => $loadData]);
if (empty($form)) {
return false;
}
return $form;
}
protected function loadFormData()
{
$app = Factory::getApplication();
$data = $app->getUserState('com_depot.edit.package.data', []);
if (empty($data)) {
$data = $this->getItem();
}
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 */
// if (Factory::getConfig()->get('unicodeslugs') == 1) {
// $data['alias'] = OutputFilter::stringURLUnicodeSlug($data['component_name']);
// } else {
// $data['alias'] = OutputFilter::stringURLSafe($data['component_name']);
// }
/* replaced by: */
if (empty($data['alias'])) {
$data['alias'] = ApplicationHelper::stringURLSafe($data['name']);
}
$result = parent::save($data);
// if ($result) {
// $this->getTable('', 'Administrator')->rebuild(1);
// }
return $result;
}
}

View File

@ -0,0 +1,142 @@
<?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
*/
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 PackagesModel extends ListModel
{
public function __construct($config = [])
{
$config['filter_fields'] = [
'id',
'p.id',
'name',
'p.name',
'alias',
'p.alias',
'state',
'p.state',
'published',
'p.published',
'mounting_style_id',
'p.mounting_style_id',
'mounting_style',
'description',
'p.description',
'ordering',
'p.ordering',
'checked_out',
'p.checked_out',
];
parent::__construct($config);
}
/**
* Build an SQL query to load the list data.
*
* @return \Joomla\Database\DatabaseQuery
*
* @since 1.6
*/
protected function getListQuery()
{
$db = $this->getDatabase();
$query = $db->createQuery();
// $query->select('*')
// ->from($db->quoteName('#__depot', 'd'));
// order by
// $query->order('d.id ASC');
// if (true) {
// return $query;
// }
// select the required fields from the table
$query->select(
$this->getState(
'list.select',
[
$db->quoteName('p.id'),
$db->quoteName('p.name'),
$db->quoteName('p.alias'),
$db->quoteName('p.description'),
$db->quoteName('p.image'),
$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'),
]
)
)
->select(
[
$db->quoteName('u.name', 'creator'),
$db->quoteName('ms.title', 'mounting_style'),
]
)
->from($db->quoteName('#__depot_package', 'p'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('p.checked_out'))
->join('LEFT', $db->quoteName('#__depot_mounting_style', 'ms'), $db->quoteName('ms.id') . ' = ' . $db->quoteName('p.mounting_style_id'));
// filter: like / search
$search = $this->getState('filter.search');
if (!empty($search)) {
$like = $db->quote('%' . $search . '%');
$query->where($db->quoteName('p.name') . ' LIKE ' . $like);
}
// Filter by published state
$published = (string) $this->getState('filter.published');
if (is_numeric($published)) {
$published = (int) $published;
$query->where($db->quoteName('p.state') . ' = :published')
->bind(':published', $published, ParameterType::INTEGER);
} elseif ($published === '') {
$query->where($db->quoteName('p.state') . ' IN (0, 1)');
}
// add list ordering clause
$query->order(
$db->quoteName($db->escape($this->getState('list.ordering', 'p.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 = 'Package', $prefix = 'Administrator', $config = [])
{
return parent::getTable($type, $prefix, $config);
}
}

View File

@ -11,12 +11,39 @@
namespace KW4NZ\Component\Depot\Administrator\Model; namespace KW4NZ\Component\Depot\Administrator\Model;
use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Table\Table; use Joomla\Database\ParameterType;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die; \defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
class PartsModel extends ListModel class PartsModel extends ListModel
{ {
public function __construct($config = [])
{
$config['filter_fields'] = [
'id',
'd.id',
'state',
'd.state',
'component_name',
'd.component_name',
'alias',
'd.alias',
'quantity',
'd.quantity',
'ordering',
'd.ordering',
'description',
'd.description',
'published',
'd.published',
'package',
'manufacturer',
'stock_name',
];
parent::__construct($config);
}
/** /**
* Build an SQL query to load the list data. * Build an SQL query to load the list data.
* *
@ -27,7 +54,7 @@ class PartsModel extends ListModel
protected function getListQuery() protected function getListQuery()
{ {
$db = $this->getDatabase(); $db = $this->getDatabase();
$query = $db->getQuery(true); $query = $db->createQuery();
// $query->select('*') // $query->select('*')
@ -45,12 +72,16 @@ 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'),
$db->quoteName('d.quantity'), $db->quoteName('d.quantity'),
$db->quoteName('d.quantity_exp'), $db->quoteName('d.quantity_exp'),
$db->quoteName('d.ordering'), $db->quoteName('d.ordering'),
$db->quoteName('d.package_id'),
$db->quoteName('d.checked_out'),
$db->quoteName('d.checked_out_time'),
] ]
) )
) )
@ -60,12 +91,25 @@ class PartsModel extends ListModel
$db->quoteName('m.name_short', 'manufacturer'), $db->quoteName('m.name_short', 'manufacturer'),
$db->quoteName('m.name_long', 'manufacturer_long'), $db->quoteName('m.name_long', 'manufacturer_long'),
$db->quoteName('s.name', 'stock_name'), $db->quoteName('s.name', 'stock_name'),
$db->quoteName('p.name', 'package_name'),
$db->quoteName('p.description', 'package_description'),
$db->quoteName('ms.title', 'mounting_style'),
$db->quoteName('v.name', 'owner'),
] ]
) )
->from($db->quoteName('#__depot', 'd')) ->from($db->quoteName('#__depot', 'd'))
->join('LEFT', $db->quoteName('#__depot_manufacturer', 'm'), $db->quoteName('m.id') . ' = ' . $db->quoteName('d.manufacturer_id')) ->join('LEFT', $db->quoteName('#__depot_manufacturer', 'm'), $db->quoteName('m.id') . ' = ' . $db->quoteName('d.manufacturer_id'))
->join('LEFT', $db->quoteName('#__depot_stock', 's'), $db->quoteName('s.id') . ' = ' . $db->quoteName('d.stock_id')) ->join('LEFT', $db->quoteName('#__depot_stock', 's'), $db->quoteName('s.id') . ' = ' . $db->quoteName('d.stock_id'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('d.checked_out')); ->join('LEFT', $db->quoteName('#__depot_package', 'p'), $db->quoteName('p.id') . ' = ' . $db->quoteName('d.package_id'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('d.checked_out'))
->join('LEFT', $db->quoteName('#__depot_mounting_style', 'ms'), $db->quoteName('ms.id') . ' = ' . $db->quoteName('p.mounting_style_id'))
->join('LEFT', $db->quoteName('#__users', 'v'), $db->quoteName('v.id') . ' = ' . $db->quoteName('s.owner_id'));
// filter: like / search
$search = $this->getState('filter.search');
if (!empty($search)) {
$like = $db->quote('%' . $search . '%');
$query->where($db->quoteName('d.component_name') . ' LIKE ' . $like);
}
// Filter by published state // Filter by published state
$published = (string) $this->getState('filter.published'); $published = (string) $this->getState('filter.published');
@ -74,9 +118,15 @@ class PartsModel extends ListModel
$query->where($db->quoteName('d.state') . ' = :published') $query->where($db->quoteName('d.state') . ' = :published')
->bind(':published', $published, ParameterType::INTEGER); ->bind(':published', $published, ParameterType::INTEGER);
} elseif ($published === '') { } elseif ($published === '') {
$query->where($db->quoteName('d.state') . ' IN (0, 1)'); $query->whereIn($db->quoteName('d.state'), [0, 1]);
} }
// add list ordering clause
$query->order(
$db->quoteName($db->escape($this->getState('list.ordering', 'd.ordering'))) . ' ' .
$db->escape($this->getState('list.direction', 'ASC'))
);
return $query; return $query;
} }
} }

View File

@ -53,7 +53,7 @@ class StockModel extends AdminModel
/* replaced by: */ /* replaced by: */
if (empty($data['alias'])) { if (empty($data['alias'])) {
$data['alias'] = ApplicationHelper::stringURLSafe($data['name_short']); $data['alias'] = ApplicationHelper::stringURLSafe($data['owner_id'] . '-' . $data['name']);
} }
$result = parent::save($data); $result = parent::save($data);
// if ($result) { // if ($result) {

View File

@ -12,11 +12,38 @@ namespace KW4NZ\Component\Depot\Administrator\Model;
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;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die; \defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
class StocksModel extends ListModel class StocksModel extends ListModel
{ {
public function __construct($config = [])
{
$config['filter_fields'] = [
'id',
's.id',
'name',
's.name',
'alias',
's.alias',
'state',
's.state',
'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. * Build an SQL query to load the list data.
* *
@ -27,7 +54,7 @@ class StocksModel extends ListModel
protected function getListQuery() protected function getListQuery()
{ {
$db = $this->getDatabase(); $db = $this->getDatabase();
$query = $db->getQuery(true); $query = $db->createQuery();
// $query->select('*') // $query->select('*')
@ -48,16 +75,30 @@ class StocksModel extends ListModel
$db->quoteName('s.name'), $db->quoteName('s.name'),
$db->quoteName('s.alias'), $db->quoteName('s.alias'),
$db->quoteName('s.description'), $db->quoteName('s.description'),
$db->quoteName('s.state'),
$db->quoteName('s.ordering'),
$db->quoteName('s.checked_out'),
$db->quoteName('s.checked_out_time'),
] ]
) )
) )
->select( ->select(
[ [
$db->quoteName('u.name', 'creator'), $db->quoteName('u.name', 'creator'),
$db->quoteName('o.name', 'owner'),
$db->quoteName('o.username', 'owner_username'),
] ]
) )
->from($db->quoteName('#__depot_stock', 's')) ->from($db->quoteName('#__depot_stock', 's'))
->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('s.checked_out')); ->join('LEFT', $db->quoteName('#__users', 'u'), $db->quoteName('u.id') . ' = ' . $db->quoteName('s.checked_out'))
->join('LEFT', $db->quoteName('#__users', 'o'), $db->quoteName('o.id') . ' = ' . $db->quoteName('s.owner_id'));
// filter: like / search
$search = $this->getState('filter.search');
if (!empty($search)) {
$like = $db->quote('%' . $search . '%');
$query->where('(' . $db->quoteName('s.name') . ' LIKE ' . $like . ' OR ' .
$db->quoteName('s.description') . ' LIKE ' . $like . ')');
}
// Filter by published state // Filter by published state
$published = (string) $this->getState('filter.published'); $published = (string) $this->getState('filter.published');
@ -69,6 +110,29 @@ class StocksModel extends ListModel
$query->where($db->quoteName('s.state') . ' IN (0, 1)'); $query->where($db->quoteName('s.state') . ' IN (0, 1)');
} }
// Add the list ordering clause.
$query->order(
$db->quoteName($db->escape($this->getState('list.ordering', 's.ordering'))) . ' ' .
$db->escape($this->getState('list.direction', 'ASC'))
);
return $query; 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);
}
} }

View File

@ -70,5 +70,4 @@ class ManufacturerTable extends Table
return parent::store($updateNulls); return parent::store($updateNulls);
} }
} }

View File

@ -0,0 +1,111 @@
<?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
*/
namespace KW4NZ\Component\Depot\Administrator\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\Database\DatabaseDriver;
\defined('_JEXEC') or die;
class PackageTable extends Table
{
function __construct(DatabaseDriver $db)
{
parent::__construct('#__depot_package', 'id', $db);
// add an alias for published:
$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();
$date = Factory::getDate()->toSql();
// $user = Factory::getUser();
// $user = $this->getCurrentUser();
$user = $app->getIdentity();
if (!$this->created) {
$this->created = $date;
}
if (!$this->created_by) {
$this->created_by = $user->get('id');
}
if ($this->id) {
// existing item
$this->modified_by = $user->get('id');
$this->modified = $date;
} else {
// set modified to created date if not set
if (!$this->modified) {
$this->modified = $this->created;
}
if (empty($this->modified_by)) {
$this->modified_by = $this->created_by;
}
}
/***
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 parent::store($updateNulls);
}
}

View File

@ -26,6 +26,42 @@ class PartTable 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();

View File

@ -26,6 +26,40 @@ class StockTable 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;
}
}
public function store($updateNulls = true) public function store($updateNulls = true)
{ {
$app = Factory::getApplication(); $app = Factory::getApplication();

View File

@ -29,6 +29,15 @@ class HtmlView extends BaseHtmlView
$app = Factory::getApplication(); $app = Factory::getApplication();
$this->items = $this->get('Items'); $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');
// set the toolbar // set the toolbar
$this->addToolbar(); $this->addToolbar();

View File

@ -0,0 +1,75 @@
<?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
*/
namespace KW4NZ\Component\Depot\Administrator\View\Package;
use Joomla\CMS\Factory;
// use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
\defined('_JEXEC') or die;
/**
* View to edit an article.
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* The \JForm object
*
* @var \JForm
*/
protected $form;
/**
* The active item
*
* @var object
*/
protected $item;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @throws \Exception
* @since 1.6
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
// if (count($errors = $this->get('Errors'))) {
// throw new GenericDataException(implode("\n", $errors), 500);
// }
$this->addToolbar();
return parent::display($tpl);
}
protected function addToolbar()
{
Factory::getApplication()->getInput()->set('hidemainmenu', true);
ToolbarHelper::title('Package: Add');
ToolbarHelper::apply('package.apply');
ToolbarHelper::save('package.save');
ToolbarHelper::cancel('package.cancel', 'JTOOLBAR_CLOSE');
}
}

View File

@ -0,0 +1,52 @@
<?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
*/
namespace KW4NZ\Component\Depot\Administrator\View\Packages;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
class HtmlView extends BaseHtmlView
{
public function display($tpl = null)
{
/** @var PackagesModel $model */
$model = $this->getModel();
$this->items = $model->getItems();
$this->pagination = $model->getPagination();
$this->state = $model->getState();
$this->filterForm = $model->getFilterForm();
$this->activeFilters = $model->getActiveFilters();
if (!\count($this->items) && $this->isEmptyState = $this->get('IsEmptyState')) {
$this->setLayout('emptystate');
}
// Set the toolbar
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar()
{
ToolbarHelper::title(Text::_('COM_DEPOT_MANAGER_PACKAGES'));
ToolbarHelper::addNew('package.add');
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'packages.delete');
ToolbarHelper::publish('packages.publish', 'JTOOLBAR_PUBLISH', true);
ToolbarHelper::unpublish('packages.unpublish', 'JTOOLBAR_UNPUBLISH', true);
}
}

View File

@ -10,33 +10,38 @@
namespace KW4NZ\Component\Depot\Administrator\View\Parts; namespace KW4NZ\Component\Depot\Administrator\View\Parts;
defined('_JEXEC') or die;
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\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 // Get 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->setLayout('emptystate');
}
// set the toolbar // Set the toolbar
$this->addToolbar(); $this->addToolbar();
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');

View File

@ -10,27 +10,33 @@
namespace KW4NZ\Component\Depot\Administrator\View\Stocks; namespace KW4NZ\Component\Depot\Administrator\View\Stocks;
defined('_JEXEC') or die;
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\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 StocksModel $model */
$app = Factory::getApplication(); $model = $this->getModel();
$this->items = $this->get('Items'); $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(); $this->addToolbar();
parent::display($tpl); parent::display($tpl);

View File

@ -11,11 +11,14 @@
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\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
?> ?>
<form action="<?= Route::_('index.php?option=com_depot&view=manufacturers'); ?>" method="post" name="adminForm" <form action="<?= Route::_('index.php?option=com_depot&view=manufacturers'); ?>" method="post" name="adminForm"
id="adminForm"> id="adminForm">
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<div class="alert alert-info"> <div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"> <span class="icon-info-circle" aria-hidden="true">
@ -31,15 +34,32 @@ use Joomla\CMS\Router\Route;
<?= HTMLHelper::_('grid.checkall'); ?> <?= HTMLHelper::_('grid.checkall'); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_ID') ?> <?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'm.id',
$this->listDirn,
$this->listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_MANUFACTURER_ACRONYM') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MANUFACTURER_ACRONYM',
'm.name_short',
$this->listDirn,
$this->listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_MANUFACTURER') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MANUFACTURER',
'm.name_long',
$this->listDirn,
$this->listOrder
); ?>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -64,7 +84,7 @@ use Joomla\CMS\Router\Route;
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?= $this->pagination->getListFooter(); ?>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value=""> <input type="hidden" name="task" value="">

View File

@ -0,0 +1,62 @@
<?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\Router\Route;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('form.validate')
->useScript('keepalive');
?>
<form action="<?= Route::_('index.php?option=com_depot&view=package&layout=edit&id=' . (int) $this->item->id); ?>"
method="post" name="adminForm" id="item-form" class="form-validate">
<?= HtmlHelper::_('uitab.startTabSet', 'myTab', ['active' => 'details']); ?>
<?= HTMLHelper::_(
'uitab.addTab',
'myTab',
'details',
empty($this->item->id) ? Text::_('COM_DEPOT_TAB_NEW_PACKAGE') :
Text::_('COM_DEPOT_TAB_EDIT_PACKAGE')
); ?>
<fieldset id="fieldset-details" class="options-form">
<legend>
<?= Text::_('COM_DEPOT_LEGEND_PACKAGE_DETAILS') ?>
</legend>
<div class="row">
<div class="col-12 col-lg-6">
<?= $this->form->renderFieldset('details'); ?>
</div>
<div class="col-12 col-lg-6">
<?= $this->form->getInput('description'); ?>
</div>
</div>
</fieldset>
<?= HtmlHelper::_('uitab.endTab'); ?>
<?= HTMLHelper::_('uitab.addTab', 'myTab', 'statistics', Text::_('COM_DEPOT_TAB_STATISTICS')); ?>
<fieldset class="options-form">
<legend>
<?= Text::_('COM_DEPOT_LEGEND_STATISTICS') ?>
</legend>
<div class="row">
<div class="col-12 col-lg-9">
<?= $this->form->renderFieldset('statistics'); ?>
</div>
</div>
</fieldset>
<?= HTMLHelper::_('uitab.endTab'); ?>
<?= HtmlHelper::_('uitab.endTabSet'); ?>
<input type="hidden" name="task" value="package.edit" />
<?= HTMLHelper::_('form.token'); ?>
</form>

View File

@ -0,0 +1,164 @@
<?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;
use Joomla\CMS\Router\Route;
/** @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">
<?= 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: ?>
<table class="table table-striped table-hover" id="packageList">
<caption class="visually-hidden">
<?= Text::_('COM_DEPOT_PACKAGES_TABLE_CAPTION'); ?>,
<span id="orderedBy">
<?= Text::_('JGLOBAL_SORTED_BY'); ?>
</span>,
<span id="filteredBy">
<?= Text::_('JGLOBAL_FILTERED_BY'); ?>
</span>
</caption>
<thead>
<tr>
<td class="w-1 text-center">
<?= HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_('searchtools.sort', '', 'p.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
</th>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_('searchtools.sort', 'JSTATUS', 'p.state', $listDirn, $listOrder); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_PACKAGE_NAME',
'p.name',
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
'p.description',
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MOUNTING_STYLE',
'p.mounting_style',
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'p.id',
$listDirn,
$listOrder
); ?>
</th>
</tr>
</thead>
<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="<?= $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 <?= $iconClass ?>">
<span class="icon-ellipsis-v" aria-hidden="true"></span>
</span>
<?php if ($saveOrder): ?>
<input type="text" name="order[]" size="5" value="<?= $item->ordering; ?>"
class="width-20 text-area-order hidden">
<?php endif; ?>
<div class="small">
<?= $item->ordering; ?>
</div>
</td>
<td class="text-center">
<?= HTMLHelper::_('jgrid.published', $item->state, $i, 'packages.', $canChange); ?>
</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>
</th>
<td>
<?= $this->escape($item->description); ?>
</td>
<td>
<?= $this->escape($item->mounting_style); ?>
</td>
<td>
<?= $item->id ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?= $this->pagination->getListFooter(); ?>
<?php endif; ?>
<input type="hidden" name="task" value="">
<input type="hidden" name="boxchecked" value="0">
<?= HTMLHelper::_('form.token'); ?>
</form>

View File

@ -32,12 +32,9 @@ $wa->useScript('form.validate')
<?= Text::_('COM_DEPOT_LEGEND_PART_DETAILS') ?> <?= Text::_('COM_DEPOT_LEGEND_PART_DETAILS') ?>
</legend> </legend>
<div class="row"> <div class="row">
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-9">
<?= $this->form->renderFieldset('details'); ?> <?= $this->form->renderFieldset('details'); ?>
</div> </div>
<div class="col-12 col-lg-6">
<?= $this->form->getInput('description'); ?>
</div>
</div> </div>
</fieldset> </fieldset>
<?= HtmlHelper::_('uitab.endTab'); ?> <?= HtmlHelper::_('uitab.endTab'); ?>

View File

@ -10,12 +10,28 @@
use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text; use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route; 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]); ?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<div class="alert alert-info"> <div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"> <span class="icon-info-circle" aria-hidden="true">
@ -23,54 +39,151 @@ use Joomla\CMS\Router\Route;
<?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?> <?= Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div> </div>
<?php else: ?> <?php else: ?>
<table class="table table-striped table-hover" id="partList">
<table class="table table-striped table-hover"> <caption class="visually-hidden">
<?= Text::_('COM_DEPOT_PARTS_TABLE_CAPTION'); ?>,
<span id="orderedBy">
<?= Text::_('JGLOBAL_SORTED_BY'); ?>
</span>,
<span id="filteredBy">
<?= 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">
<?= HTMLHelper::_('searchtools.sort', '', 'd.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
</th>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_('searchtools.sort', 'JSTATUS', 'd.state', $listDirn, $listOrder); ?>
</th>
<th scope="col">
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_NAME',
'd.component_name',
$listDirn,
$listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_ID') ?> <?= HTMLHelper::_(
</th> 'searchtools.sort',
<th> 'COM_DEPOT_TABLE_HEAD_QUANTITY',
<?= Text::_('COM_DEPOT_TABLE_HEAD_NAME') ?> 'd.quantity',
</th> $listDirn,
<th> $listOrder
<?= Text::_('COM_DEPOT_TABLE_HEAD_QUANTITY') ?> ); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_QUANTITY_EXP') ?> <?= Text::_('COM_DEPOT_TABLE_HEAD_QUANTITY_EXP') ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_MANUFACTURER') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
'd.description',
$listDirn,
$listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_STOCK') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_MANUFACTURER',
'manufacturer',
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_STOCK',
'stock_name',
$listDirn,
$listOrder
); ?>
</th>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
'd.id',
$listDirn,
$listOrder
); ?>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody <?php if ($saveOrder): ?> class="js-draggable" data-url="<?= $saveOrderingUrl; ?>"
<?php foreach ($this->items as $i => $item): ?> data-direction="<?= strtolower($listDirn); ?>" data-nested="true" <?php endif; ?>>
<tr> <?php foreach ($this->items as $i => $item):
<td> $ordering = ($listOrder == 'ordering');
<?= HTMLHelper::_('grid.id', $i, $item->id); ?> $canChange = true;
?>
<tr class="row<?= $i % 2; ?>" data-draggable-group="0" item-id="<?= $item->id; ?>">
<th>
<?= HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->component_name); ?>
</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 <?= $iconClass ?>">
<span class="icon-ellipsis-v" aria-hidden="true"></span>
</span>
<?php if ($saveOrder): ?>
<input type="text" name="order[]" size="5" value="<?= $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 ?> <?= HTMLHelper::_('jgrid.published', $item->state, $i, 'parts.', $canChange); ?>
</td>
<td>
<a href="<?= Route::_('index.php?option=com_depot&task=part.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
<?= $this->escape($item->component_name); ?>
</a>
</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') ?>">
<?= $this->escape($item->component_name); ?>
</a>
</div>
<div class="small break-word" role="button" title="<?= $item->package_description ?>">
<?= $item->package_name; ?>
<?php if (!empty($item->mounting_style)): ?>
<div class="small break-word">
<?= Text::_('COM_DEPOT_FIELD_PACKAGE_MOUNTING_STYLE_LABEL') . ': '; ?>
<?= Text::alt(
'COM_DEPOT_LIST_MOUNTING_STYLE_' . $item->mounting_style,
Text::_('COM_DEPOT_LIST_MOUNTING_STYLE_UNKNOWN')
); ?>
</div>
<?php endif; ?>
</div>
</th>
<td> <td>
<?= $this->escape($item->quantity); ?> <?= $this->escape($item->quantity); ?>
</td> </td>
<td> <td>
<?= "10^" . $item->quantity_exp; ?> <?= "10^" . $item->quantity_exp; ?>
</td> </td>
<td>
<div class="break-word">
<?= $this->escape($item->description); ?>
</div>
</td>
<td> <td>
<a href="<?= Route::_('index.php?option=com_depot&task=manufacturer.edit&id=' . <a href="<?= Route::_('index.php?option=com_depot&task=manufacturer.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>"> (int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
@ -78,16 +191,22 @@ use Joomla\CMS\Router\Route;
</a> </a>
</td> </td>
<td> <td>
<a 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); ?>
</a> </a>
<div class="small">
<?= $this->escape($item->owner); ?>
</div>
</td>
<td>
<?= $item->id ?>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?= $this->pagination->getListFooter(); ?>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value=""> <input type="hidden" name="task" value="">

View File

@ -35,9 +35,11 @@ $wa->useScript('form.validate')
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
<?= $this->form->renderFieldset('details'); ?> <?= $this->form->renderFieldset('details'); ?>
</div> </div>
<!--
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
<?= $this->form->getInput('description'); ?> <?= $this->form->getInput('description'); ?>
</div> </div>
-->
</div> </div>
</fieldset> </fieldset>
<?= HtmlHelper::_('uitab.endTab'); ?> <?= HtmlHelper::_('uitab.endTab'); ?>

View File

@ -11,10 +11,27 @@
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\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');
}
?> ?>
<form action="<?= Route::_('index.php?option=com_depot&view=stocks'); ?>" method="post" name="adminForm" id="adminForm"> <form action="<?= Route::_('index.php?option=com_depot&view=stocks'); ?>" method="post" name="adminForm" id="adminForm">
<?= LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<?php if (empty($this->items)): ?> <?php if (empty($this->items)): ?>
<div class="alert alert-info"> <div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"> <span class="icon-info-circle" aria-hidden="true">
@ -23,46 +40,109 @@ use Joomla\CMS\Router\Route;
</div> </div>
<?php else: ?> <?php else: ?>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover" id="stockList">
<thead> <thead>
<tr> <tr>
<th> <td>
<?= HTMLHelper::_('grid.checkall'); ?> <?= HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="w-1 text-center">
<?= HTMLHelper::_('searchtools.sort', '', 's.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_ID') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_STOCK',
's.name',
$listDirn,
$listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_STOCK') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_DESCRIPTION',
's.description',
$listDirn,
$listOrder
); ?>
</th> </th>
<th> <th>
<?= Text::_('COM_DEPOT_TABLE_HEAD_DESCRIPTION') ?> <?= HTMLHelper::_(
'searchtools.sort',
'COM_DEPOT_TABLE_HEAD_OWNER',
'owner',
$listDirn,
$listOrder
); ?>
</th>
<th>
<?= HTMLHelper::_(
'searchtools.sort',
'JGRID_HEADING_ID',
's.id',
$listDirn,
$listOrder
); ?>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody <?php if ($saveOrder): ?> class="js-draggable" data-url="<?= $saveOrderingUrl; ?>"
<?php foreach ($this->items as $i => $item): ?> data-direction="<?= strtolower($listDirn); ?>" data-nested="true" <?php endif; ?> <?php foreach ($this->items as $i => $item):
<tr> $ordering = ($listOrder == 'ordering');
<td> $canChange = true;
<?= HTMLHelper::_('grid.id', $i, $item->id); ?> ?> <tr
</td> class="row<?= $i % 2; ?>" data-draggable-group="0" item-id="<?= $item->id; ?>">
<td> <th>
<?= $item->id ?> <?= HTMLHelper::_('grid.id', $i, $item->id); ?>
</td> </th>
<td> <td class="text-center d-none d-md-table-cell">
<a href="<?= Route::_('index.php?option=com_depot&task=stock.edit&id=' . <?php
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>"> $iconClass = '';
<?= $this->escape($item->name); ?>
</a> if (!$canChange) {
</td> $iconClass = ' inactive';
<td> } elseif (!$saveOrder) {
<?= $this->escape($item->description); ?> $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
</td> }
?>
<span class="sortable-handler <?= $iconClass ?>">
<span class="icon-ellipsis-v" aria-hidden="true"></span>
</span>
<?php if ($saveOrder): ?>
<input type="text" name="order[]" size="5" value="<?= $item->ordering; ?>"
class="width-20 text-area-order hidden">
<?php endif; ?>
</td>
<th>
<a href="<?= Route::_('index.php?option=com_depot&task=stock.edit&id=' .
(int) $item->id) ?>" title="<?= Text::_('JACTION_EDIT') ?>">
<?= $this->escape($item->name); ?>
</a>
</th>
<td>
<?= $this->escape($item->description); ?>
</td>
<td>
<div class="word-break">
<?php if (!empty($item->owner)): ?>
<?= $item->owner; ?>
<div class="small">
<?= Text::_('JGLOBAL_USERNAME') . ': ' . $item->owner_username; ?>
</div>
<?php else: ?>
<?= Text::_('JGLOBAL_AUTH_USER_NOT_FOUND'); ?>
<?php endif; ?>
</div>
</td>
<td>
<?= $item->id ?>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<?= $this->pagination->getListFooter(); ?>
<?php endif; ?> <?php endif; ?>
<input type="hidden" name="task" value=""> <input type="hidden" name="task" value="">

View File

@ -2,14 +2,16 @@
<extension type="component" method="upgrade"> <extension type="component" method="upgrade">
<name>Depot</name> <name>Depot</name>
<author>KW4NZ</author> <author>KW4NZ</author>
<creationDate>2023-10-15</creationDate> <creationDate>2024-08-31</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.3</version> <version>0.9.23</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>
<!-- Runs on install/uninstall/update since 2.5 -->
<scriptfile>script.php</scriptfile>
<install> <!-- Runs on install --> <install> <!-- Runs on install -->
<sql> <sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file> <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
@ -25,10 +27,17 @@
<schemapath type="mysql">sql/updates/mysql</schemapath> <schemapath type="mysql">sql/updates/mysql</schemapath>
</schemas> </schemas>
</update> </update>
<files folder="site/"> <files folder="site">
<folder>src</folder>
<folder>tmpl</folder>
<!--
<file>CODING_STANDARDS.md</file> <file>CODING_STANDARDS.md</file>
<file>LICENSE.md</file> <file>LICENSE.md</file>
<file>README.md</file> <file>README.md</file>
<folder>forms</folder>
<folder>language</folder>
-->
</files> </files>
<administration> <administration>
<!-- <!--
@ -37,29 +46,17 @@
--> -->
<menu img="class:barcode">COM_DEPOT_MENU</menu> <menu img="class:barcode">COM_DEPOT_MENU</menu>
<submenu> <submenu>
<menu <menu link="option=com_depot" view="parts" img="class:depot" alt="Depot/Parts">
link="option=com_depot"
view="parts"
img="class:depot"
alt="Depot/Parts"
>
COM_DEPOT_MENU COM_DEPOT_MENU
</menu> </menu>
<menu <menu link="option=com_depot&amp;view=stocks" view="stocks" img="class:depot-stock" alt="Depot/Stocks">
link="option=com_depot&amp;view=manufacturers" COM_DEPOT_MENU_STOCKS
view="manufacturers" </menu>
img="class:depot-manufacturer" <menu link="option=com_depot&amp;view=manufacturers" view="manufacturers" img="class:depot-manufacturer" alt="Depot/Manufacturers">
alt="Depot/Manufacturers"
>
COM_DEPOT_MENU_MANUFACTURERS COM_DEPOT_MENU_MANUFACTURERS
</menu> </menu>
<menu <menu link="option=com_depot&amp;view=packages" view="packages" img="class:depot-package" alt="Depot/Packages">
link="option=com_depot&amp;view=stocks" COM_DEPOT_MENU_PACKAGES
view="stocks"
img="class:depot-stock"
alt="Depot/Stocks"
>
COM_DEPOT_MENU_STOCKS
</menu> </menu>
</submenu> </submenu>
<files folder="admin"> <files folder="admin">
@ -72,6 +69,8 @@
<languages folder="admin/language"> <languages folder="admin/language">
<language tag="en-GB">en-GB/com_depot.ini</language> <language tag="en-GB">en-GB/com_depot.ini</language>
<language tag="en-GB">en-GB/com_depot.sys.ini</language> <language tag="en-GB">en-GB/com_depot.sys.ini</language>
<language tag="de-DE">de-DE/com_depot.ini</language>
<language tag="de-DE">de-DE/com_depot.sys.ini</language>
</languages> </languages>
</administration> </administration>
</extension> </extension>

76
script.php Normal file
View File

@ -0,0 +1,76 @@
<?php
/**
* @package Depot.Installation.Script
* @subpackage com_depot
* @author Thomas Kuschel <thomas@kuschel.at>
* @copyright (C) 2024 KW4NZ, <https://www.kuschel.at>
* @license GNU General Public License version 2 or later; see LICENSE.md
* @since 0.9.21
*/
\defined('_JEXEC') or die;
/**
* Script file of Depot component.
*
* The name of this class is dependent on the component being installed.
* The class name should have the component's name, directly followed by
* the text InstallerScript (ex:. com_depotInstallerScript).
*
* This class will be called by Joomla's installer, if specified in your component's
* manifest file, and is used for custom automation actions in its installation process.
*
* In order to use this automation script, you should reference it in your component's
* mainfest file as follows:
* <scriptfile>script.php</scriptfile>
*/
use Joomla\CMS\Factory;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Language\Text;
return new class() implements InstallerScriptInterface {
private string $minimumJoomla = '4.4.8'; // '5.1.4'
private string $minimumPhp = '8.1.29';
public function install(InstallerAdapter $adapter): bool
{
echo "component install<br>";
return true;
}
public function update(InstallerAdapter $adapter): bool
{
echo "component update<br>";
return true;
}
public function uninstall(InstallerAdapter $adapter): bool
{
echo "component uninstall<br>";
return true;
}
public function preflight(string $type, InstallerAdapter $adapter): bool
{
echo "component preflight<br>";
if (version_compare(PHP_VERSION, $this->minimumPhp, '<')) {
Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_PHP'), $this->minimumPhp), 'error');
return false;
}
if (version_compare(JVERSION, $this->minimumJoomla, '<')) {
Factory::getApplication()->enqueueMessage(sprintf(Text::_('JLIB_INSTALLER_MINIMUM_JOOMLA'), $this->minimumJoomla), 'error');
return false;
}
return true;
}
public function postflight(string $type, InstallerAdapter $adapter): bool
{
echo "component postflight<br>";
return true;
}
};

72
script/zipdepot Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
# Joomla installation at:
JOOMLADIR="/srv/http/joomla5"
# this is a script file to generate a zip package from this source:
cd "$(dirname "$0")"
cd ..
# now we are at the depot directory
# if there is a file named depot.xml, we ask to increase the version with
read -p "Do you want to update/increase the patch (last) version number? (y/N)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyJj]$ ]]
then
echo "Updating the version"
# patch=`xmllint -xpath 'string(//*[local-name()="version"])' depot.xml | rev | cut -f1 -d. | rev`
# echo "$patch"
# patch=$((patch+1))
# echo "$patch"
version=`xmllint -xpath 'string(//*[local-name()="version"])' depot.xml`
major=`echo "$version" | cut -f1 -d.`
minor=`echo "$version" | cut -f2 -d.`
patch=`echo "$version" | cut -f3 -d.`
echo "$version"
patch=$((patch+1))
minor=$((minor))
newversion="$major.$minor.$patch"
echo "$newversion"
printf -v date '%(%Y-%m-%d)T\n' -1
xmllint --shell depot.xml << EOF
cd extension/version
set $newversion
cd /extension/creationDate
set $date
save
EOF
else
echo "Keep the version"
fi
mkdir -p zip
# Generate ZIP file without directories zip, script
zip -q -r zip/depot.zip * -x .git/\* -x script/\* -x zip/\*
# Install this extension to the active Joomla installation per CLI
read -p "Do you want to install this to the Joomla installation at \"$JOOMLADIR\"? (Y/n)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Nn]$ ]]
then
echo "Extension was not installed"
else
# Find the CLI php procedure, file joomla.php in cli must exists.
FILE="${JOOMLADIR}/cli/joomla.php"
if [ -f "$FILE" ]
then
echo "$FILE exists."
php $FILE --version
php $FILE --help
php $FILE list
# sudo -g http php $FILE core:update:check
php $FILE core:update:check
pwd
# sudo -u http php $FILE extension:install --path zip/depot.zip -v
php $FILE extension:install --path zip/depot.zip -v
php $FILE extension:list --type component
else
echo "$FILE does not exists."
exit 9
fi
fi

View File

@ -0,0 +1,25 @@
<?php
/**
* @package Depot.Site
* @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.14
*/
namespace KW4NZ\Component\Depot\Site\Controller;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController
{
protected $default_view = 'part';
public function display($cacheable = false, $urlparams = [])
{
return parent::display($cacheable, $urlparams);
}
}

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Depot.Site
* @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.14
*/
namespace KW4NZ\Component\Depot\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ItemModel;
class PartModel extends ItemModel
{
public function getItem($pk = null)
{
if ($pk == null) {
$pk = Factory::getApplication()->input->getInt('id');
}
$db = $this->getDatabase();
$query = $db->createQuery()
->select('*')
->from($db->quoteName('#__depot', 'd'))
->where([
$db->quoteName('d.id') . ' = ' . $db->quote($pk),
$db->quoteName('d.state') . ' = 1',
]);
$db->setQuery($query);
$item = $db->loadObject();
return $item;
}
}

View File

@ -0,0 +1,27 @@
<?php
/**
* @package Depot.Site
* @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.14
*/
namespace KW4NZ\Component\Depot\Site\View\Part;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
protected $item;
public function display($tpl = null)
{
$this->item = $this->get('Item');
parent::display($tpl);
}
}

View File

@ -0,0 +1,15 @@
<?php
/**
* @package Depot.Site
* @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.14
*/
defined('_JEXEC') or die;
?>
<h1>
<?= $this->item->component_name; ?>
</h1>

BIN
zip/depot.zip (Stored with Git LFS) Normal file

Binary file not shown.