From 2de6b9633d8b9d2cec532920ecd7dfb3a2d76df7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Sun, 9 Jun 2019 15:46:58 +0200 Subject: [PATCH] =?utf8?q?PartPicker:=20auch=20nach=20ung=C3=BCltigen=20od?= =?utf8?q?er=20allen=20Artikeln=20suchen=20k=C3=B6nnen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Dazu kann ein Parameter "status" (active/obsolete/all) übergeben werden. Ohne diesen Parameter ist das Verhalten wie zuvor (nur gültige). --- SL/Presenter/Part.pm | 5 +++++ js/kivi.Part.js | 7 ++++++- templates/webpages/part/test_page.html | 9 +++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/SL/Presenter/Part.pm b/SL/Presenter/Part.pm index 4f2105caa..145d9128f 100644 --- a/SL/Presenter/Part.pm +++ b/SL/Presenter/Part.pm @@ -229,6 +229,11 @@ If C<%params> contains C only parts of this type will be used for autocompletion. You may comma separate multiple types as in C. +If C<%params> contains C only parts of this status will be used +for autocompletion. C can be one of the following strings: +C, C or C. C is the default if C is +not given. + If C<%params> contains C only parts with this unit will be used for autocompletion. You may comma separate multiple units as in C. diff --git a/js/kivi.Part.js b/js/kivi.Part.js index 9fa071839..0b0185bf3 100644 --- a/js/kivi.Part.js +++ b/js/kivi.Part.js @@ -335,13 +335,18 @@ namespace('kivi.Part', function(ns) { ajax_data: function(term) { var data = { 'filter.all:substr:multi::ilike': term, - 'filter.obsolete': 0, current: this.$real.val(), }; if (this.o.part_type) data['filter.part_type'] = this.o.part_type.split(','); + if (this.o.status) { + if (this.o.status == 'active') data['filter.obsolete'] = 0; + if (this.o.status == 'obsolete') data['filter.obsolete'] = 1; + } else + data['filter.obsolete'] = 0; + if (this.o.classification_id) data['filter.classification_id'] = this.o.classification_id.split(','); diff --git a/templates/webpages/part/test_page.html b/templates/webpages/part/test_page.html index fb7853f3f..02d54d900 100644 --- a/templates/webpages/part/test_page.html +++ b/templates/webpages/part/test_page.html @@ -24,6 +24,15 @@ Artikel-Klassifizierung: Produktion
[% P.part.picker('part_id13', undef, classification_id='4') %]
Artikel-Klassifizierung: Eink.,Verk.,Prod.
[% P.part.picker('part_id14', undef, classification_id='1,2,4') %]
+Artikel-Status: Aktiv (default)
+[% P.part.picker('part_id15') %]
+Artikel-Status: Aktiv< (explizit)
+[% P.part.picker('part_id16', undef, status="active") %]
+Artikel-Status: Ungültig
+[% P.part.picker('part_id17', undef, status="obsolete") %]
+Artikel-Status: Alle
+[% P.part.picker('part_id18', undef, status="all") %]
+ Pre-filled:
[% P.part.picker('part_id6', pre_filled_part) %]
Convertible unit 'Std': (only select parts with unit Tag/Std/Min)
-- 2.20.1