- $self->input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => 'part_autocomplete', type => 'hidden', id => $id) .
- join('', map { $params{$_} ? $self->input_tag("", delete $params{$_}, id => "${id}_${_}", type => 'hidden') : '' } qw(column type unit convertible_unit)) .
- $self->input_tag("", (ref $value && $value->can('description')) ? $value->description : '', id => "${id}_name", %params);
+ input_tag($name, (ref $value && $value->can('id') ? $value->id : ''), class => "@classes", type => 'hidden', id => $id,
+ 'data-part-picker-data' => JSON::to_json(\%params),
+ ) .
+ input_tag("", ref $value ? $value->displayable_name : '', id => "${id}_name", %params);
+
+ $::request->layout->add_javascripts('kivi.Part.js');
+ $::request->presenter->need_reinit_widgets($id);
+
+ html_tag('span', $ret, class => 'part_picker');
+}
+
+sub picker { goto &part_picker }
+
+#
+# shortcut for article type
+#
+sub type_abbreviation {
+ my ($part_type) = @_;
+
+ return '' if !$part_type;
+ return $::locale->text('Assembly (typeabbreviation)') if $part_type eq 'assembly';
+ return $::locale->text('Part (typeabbreviation)') if $part_type eq 'part';
+ return $::locale->text('Assortment (typeabbreviation)') if $part_type eq 'assortment';
+ return $::locale->text('Service (typeabbreviation)');
+}
+
+#
+# Translations for Abbreviations:
+#
+# $::locale->text('None (typeabbreviation)')
+# $::locale->text('Purchase (typeabbreviation)')
+# $::locale->text('Sales (typeabbreviation)')
+# $::locale->text('Merchandise (typeabbreviation)')
+# $::locale->text('Production (typeabbreviation)')
+#
+# and for descriptions
+# $::locale->text('Purchase')
+# $::locale->text('Sales')
+# $::locale->text('Merchandise')
+# $::locale->text('Production')
+
+#
+# shortcut for article type
+#
+sub classification_abbreviation {
+ my ($id) = @_;
+
+ return '' if !$id;
+
+ SL::DB::Manager::PartClassification->cache_all();
+ my $obj = SL::DB::PartClassification->load_cached($id);
+ $obj && $obj->abbreviation ? t8($obj->abbreviation) : '';
+}
+
+sub typeclass_abbreviation {
+ my ($part) = @_;
+ return '' if !$part || !$part->isa('SL::DB::Part');
+ return type_abbreviation($part->part_type) . classification_abbreviation($part->classification_id);
+}
+
+#
+# shortcut for article type
+#
+sub separate_abbreviation {
+ my ($id) = @_;
+
+ return '' if !$id;
+
+ SL::DB::Manager::PartClassification->cache_all();
+ my $obj = SL::DB::PartClassification->load_cached($id);
+ $obj && $obj->abbreviation && $obj->report_separate ? t8($obj->abbreviation) : '';
+}
+
+#
+# generate selection tag
+#
+sub select_classification {
+ my ($name, %attributes) = @_;