Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 28faaa2a

Von Tamino Steinert vor 6 Monaten hinzugefügt

  • ID 28faaa2a0f73da818bdebda3e95253ee6d48a7d0
  • Vorgänger e945cb1d
  • Nachfolger aa7ea0f0

Varianten: Varianten Ausprägungen bearbeiten

Unterschiede anzeigen:

SL/Controller/Part.pm
}
my $new_select_tag = select_tag(
"variants[].add_variant_property_value", \@options,
"variants_properties[].add_variant_property_value", \@options,
with_empty => 1,
%select_tag_options
);
$self->js->replaceWith('[name^="variants[].add_variant_property_value"]', $new_select_tag);
$self->js->replaceWith('[name^="variants_properties[].add_variant_property_value"]', $new_select_tag);
my $new_select_tag_multible = select_tag(
"add_variant_property_value_for_selected_variants", \@options,
"add_variant_property_value_for_selected_variants_properties", \@options,
%select_tag_options
);
$self->js->replaceWith("#add_variant_property_value_for_selected_variants", $new_select_tag_multible);
$self->js->replaceWith("#add_variant_property_value_for_selected_variants_properties", $new_select_tag_multible);
$self->js->render();
}
sub action_update_variants {
sub action_update_variants_values {
my ($self) = @_;
my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants}};
my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants_values}};
my $variant_property_id = $::form->{add_variant_property};
SL::DB->client->with_transaction(sub {
my $new_variant_property;
foreach my $variant (@{$self->part->variants}) {
my $variant_attributes = $variant_id_to_values{$variant->id};
delete $variant_attributes->{$_} for qw(id position);
$variant->update_attributes(%$variant_attributes);
}
1;
}) or do {
return $self->js->error(t8('Error while updating values of variants: #1', SL::DB->client->error))->render();
};
$self->redirect_to(
controller => 'Part',
action => 'edit',
'part.id' => $self->part->id
);
}
sub action_update_variants_properties {
my ($self) = @_;
my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants_properties}};
my $variant_property_id = delete $::form->{add_variant_property};
if ($variant_property_id) {
foreach my $variant (@{$self->part->variants}) {
die t8("Please select a new variant property value for all variants")
unless $variant_id_to_values{$variant->id}->{"add_variant_property_value"};
my $variant_values = $variant_id_to_values{$variant->id};
$variant_values->{"variant_property_$variant_property_id"} =
delete $variant_values->{"add_variant_property_value"}
or die t8("Please select a new variant property value for all variants");
}
}
SL::DB->client->with_transaction(sub {
my $new_variant_property;
if ($variant_property_id) {
$new_variant_property = SL::DB::VariantPropertyPart->new(
part_id => $self->part->id,
variant_property_id => $variant_property_id,
)->save;
my ($one_variant_id) = keys %variant_id_to_values;
my %variant_property_ids =
map { $_ => 1 }
grep {$_ =~ m/^variant_property_/}
keys %{$variant_id_to_values{$one_variant_id}};
my $variant_property_id_string = join " ", sort keys %variant_property_ids;
my %variant_property_values_to_variant;
foreach my $variant (@{$self->part->variants}) {
my %variant_values = %{$variant_id_to_values{$variant->id}};
my $current_variant_property_id_string =
join " ",
sort
grep {$_ =~ m/^variant_property_/}
keys %variant_values;
die "property ids doesn't match"
. $current_variant_property_id_string . ";" .$variant_property_id_string
if $current_variant_property_id_string ne $variant_property_id_string;
my $variant_property_values =
join " ",
sort
map {$variant_values{$_}}
keys %variant_property_ids;
if (defined $variant_property_values_to_variant{$variant_property_values}) {
my $matching_variant = $variant_property_values_to_variant{$variant_property_values};
die t8("The variants '#1' and '#2' would have the same variant property values.",
$variant->displayable_name, $matching_variant->displayable_name
);
} else {
$variant_property_values_to_variant{$variant_property_values} = $variant;
}
}
SL::DB->client->with_transaction(sub {
my @variant_properties =
map {SL::DB::Manager::VariantProperty->find_by(id => $_)}
map {$_ =~ s/^variant_property_//; $_}
keys %variant_property_ids;
$self->part->variant_properties(\@variant_properties);
$self->part->save;
foreach my $variant (@{$self->part->variants}) {
my $variant_attributes = $variant_id_to_values{$variant->id};
my $variant_property_value_id = delete $variant_attributes->{add_variant_property_value};
delete $variant_attributes->{$_} for qw(id position);
$variant->update_attributes(%$variant_attributes);
if ($new_variant_property) {
SL::DB::VariantPropertyValuePart->new(
part_id => $variant->id,
variant_property_value_id => $variant_property_value_id,
)->save;
}
my %variant_values = %{$variant_id_to_values{$variant->id}};
my @variant_property_values =
map {
SL::DB::Manager::VariantPropertyValue->find_by(
id => $variant_values{"variant_property_" . $_->id}
);
}
@variant_properties;
$variant->variant_property_values(\@variant_property_values);
$variant->save;
}
1;
}) or do {
return $self->js->error(t8('Error while adding variant property: #1', SL::DB->client->error))->render();
return $self->js->error(t8('Error while updating variant properties: #1', SL::DB->client->error))->render();
};
$self->redirect_to(
......
$self->js->run('kivi.Part.redisplay_items', \@to_sort)->render;
}
sub action_reorder_variants {
sub action_reorder_variants_values {
my ($self) = @_;
my $part= $self->part;
......
my %variant_id_to_position =
map {$_->{id} => $_->{position}}
@{$::form->{variants}};
@{$::form->{variants_values}};
my @to_sort = map { { old_pos => $variant_id_to_position{$_->id}, order_by => $method->($_) } } @items;
if ($::form->{order_by} =~ /^(listprice|sellprice|lastcost|onhand|rop)$/ ||
......
}
};
$self->js->run('kivi.Part.redisplay_variants', \@to_sort)->render;
$self->js->run('kivi.Part.redisplay_variants_values', \@to_sort)->render;
}
sub action_reorder_variants_properties {
my ($self) = @_;
my $part= $self->part;
my %sort_keys = (
partnumber => sub { $_[0]->partnumber },
description => sub { $_[0]->description },
ean => sub { $_[0]->ean },
variant_values => sub { $_[0]->variant_values },
);
foreach my $variant_property (@{$part->variant_properties}) {
my $key = 'variant_property_' . $variant_property->id;
$sort_keys{$key} = sub {
$_[0]->get_variant_property_value_by_unique_name($variant_property->unique_name)->sortkey;
}
}
my $method = $sort_keys{$::form->{order_by}};
my @items = $part->variants;
my %variant_id_to_position =
map {$_->{id} => $_->{position}}
@{$::form->{variants_properties}};
my @to_sort = map { { old_pos => $variant_id_to_position{$_->id}, order_by => $method->($_) } } @items;
if ($::form->{order_by} =~ /^variant_property_/) {
if ($::form->{sort_dir}) {
@to_sort = sort { $a->{order_by} <=> $b->{order_by} } @to_sort;
} else {
@to_sort = sort { $b->{order_by} <=> $a->{order_by} } @to_sort;
}
} else {
if ($::form->{sort_dir}) {
@to_sort = sort { $a->{order_by} cmp $b->{order_by} } @to_sort;
} else {
@to_sort = sort { $b->{order_by} cmp $a->{order_by} } @to_sort;
}
};
$self->js->run('kivi.Part.redisplay_variants_properties', \@to_sort)->render;
}
sub action_warehouse_changed {
js/kivi.Part.js
ns.renumber_positions();
};
ns.reorder_variants = function(order_by) {
var dir = $('#variant_' + order_by + '_header_id a img').attr("data-sort-dir");
$('#parent_variant_table thead a img').remove();
ns.reorder_variants_values = function(order_by) {
var dir = $('#variant_value_' + order_by + '_header_id a img').attr("data-sort-dir");
$('#variant_value_table thead a img').remove();
var src;
if (dir == "1") {
......
src = "image/down.png";
}
$('#variant_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
$('#variant_value_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
var data = $('#ic').serializeArray();
data.push({ name: 'action', value: 'Part/reorder_variants' },
data.push({ name: 'action', value: 'Part/reorder_variants_values' },
{ name: 'order_by', value: order_by },
{ name: 'sort_dir', value: dir });
$.post("controller.pl", data, kivi.eval_json_result);
};
ns.redisplay_variants = function(data) {
var old_rows = $('.variant_row_entry').detach();
ns.redisplay_variants_values = function(data) {
console.log("data", data);
var old_rows = $('.variant_value_row_entry').detach();
var new_rows = [];
$(data).each(function(idx, elt) {
let new_row = old_rows[elt.old_pos - 1];
$(new_row).find('[name="variants[].position"]').val( idx+1);
$(new_row).find('[name="variants_values[].position"]').val( idx+1);
new_rows.push(new_row);
});
$(new_rows).appendTo($('#parent_variant_table'));
$(new_rows).appendTo($('#variant_value_table'));
};
ns.get_selected_variants = function() {
ns.get_selected_variants_values = function() {
let selected_rows = [];
$('[name^="variant_multi_id_"]').each( function() {
if (this.checked) {
......
return selected_rows;
}
ns.variant_rows_toggle_selected = function() {
ns.variant_value_rows_toggle_selected = function() {
$('[name^="variant_multi_id_"]').each( function() {
this.checked = !this.checked;
});
}
ns.set_selected_variants_to_value = function(value_name) {
let value = $('[name="' + value_name + '_for_selected_variants"]').val();
let selected_rows = ns.get_selected_variants();
let value = $('[name="' + value_name + '_for_selected_variants_values"]').val();
let selected_rows = ns.get_selected_variants_values();
selected_rows.forEach(function(row) {
$(row).find(
'[name="variants[].' + value_name + '"]'
'[name="variants_values[].' + value_name + '"]'
).val(
value
);
});
};
ns.reorder_variants_properties = function(order_by) {
var dir = $('#variant_property_' + order_by + '_header_id a img').attr("data-sort-dir");
$('#variant_property_table thead a img').remove();
var src;
if (dir == "1") {
dir = "0";
src = "image/up.png";
} else {
dir = "1";
src = "image/down.png";
}
$('#variant_property_' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
var data = $('#ic').serializeArray();
data.push({ name: 'action', value: 'Part/reorder_variants_properties' },
{ name: 'order_by', value: order_by },
{ name: 'sort_dir', value: dir });
$.post("controller.pl", data, kivi.eval_json_result);
};
ns.redisplay_variants_properties = function(data) {
var old_rows = $('.variant_property_row_entry').detach();
var new_rows = [];
$(data).each(function(idx, elt) {
let new_row = old_rows[elt.old_pos - 1];
$(new_row).find('[name="variants_properties[].position"]').val( idx+1);
new_rows.push(new_row);
});
$(new_rows).appendTo($('#variant_property_table'));
};
ns.get_selected_variants_properties = function() {
let selected_rows = [];
$('[name^="variant_property_multi_id_"]').each( function() {
if (this.checked) {
selected_rows.push($(this).parents("tr").first());
}
});
return selected_rows;
}
ns.variant_property_rows_toggle_selected = function() {
$('[name^="variant_property_multi_id_"]').each( function() {
this.checked = !this.checked;
});
}
ns.set_selected_variants_to_property = function(value_name) {
let value = $('[name="' + value_name + '_for_selected_variants_properties"]').val();
let selected_rows = ns.get_selected_variants_properties();
selected_rows.forEach(function(row) {
$(row).find(
'[name="variants_properties[].' + value_name + '"]'
).val(
value
);
});
};
ns.remove_variant_property = function(button) {
if (!confirm(kivi.t8("Do you really want to delete the property?"))) return;
let column_head_th = $(button).parents("th").first()[0];
let index = column_head_th.cellIndex;
let table = $('#variant_property_table')[0];
for(const row of table.rows) {
row.deleteCell(index);
};
};
ns.assortment_recalc = function() {
var data = $('#assortment :input').serializeArray();
data.push(
......
$.post("controller.pl", data, kivi.eval_json_result);
};
ns.update_variants = function() {
ns.update_variants_values = function() {
var data = $('#ic').serializeArray();
data.push({ name: 'action', value: 'Part/update_variants_values' });
$.post("controller.pl", data, kivi.eval_json_result);
};
ns.update_variants_properties = function() {
var data = $('#ic').serializeArray();
data.push({ name: 'action', value: 'Part/update_variants' });
data.push({ name: 'action', value: 'Part/update_variants_properties' });
$.post("controller.pl", data, kivi.eval_json_result);
};
......
$('#part_warehouse_id').change(kivi.Part.reload_bin_selection);
$('#variant_select_all').click( function() {
$('#variant_value_select_all').click( function() {
var checked = this.checked;
$('[name^="variant_value_multi_id_"]').each(function() {
this.checked = checked;
});
});
$('#variant_property_select_all').click( function() {
var checked = this.checked;
$('[name^="variant_multi_id_"]').each(function() {
$('[name^="variant_property_multi_id_"]').each(function() {
this.checked = checked;
});
});
js/locale/de.js
"Details of article number \"#1\"":"Details von Artikel \"#1\"",
"Do you really want to cancel?":"Möchten Sie wirklich abbrechen?",
"Do you really want to continue?":"Möchten Sie wirklich fortfahren?",
"Do you really want to delete the property?":"Möchten Sie wirklich die Eigenschaft entfernen?",
"Do you really want to delete the selected documents?":"Möchten Sie wirklich diese Dateien löschen?",
"Do you really want to delete this draft?":"Möchten Sie diesen Entwurf wirklich löschen?",
"Do you really want to delete this record template?":"Möchten Sie diese Belegvorlage wirklich löschen?",
js/locale/en.js
"Details of article number \"#1\"":"",
"Do you really want to cancel?":"",
"Do you really want to continue?":"",
"Do you really want to delete the property?":"",
"Do you really want to delete the selected documents?":"",
"Do you really want to delete this draft?":"",
"Do you really want to delete this record template?":"",
locale/de/all
'Delete Dataset' => 'Datenbank löschen',
'Delete Documents' => 'Dokumente löschen',
'Delete Images' => 'Bilder löschen',
'Delete Property' => 'Eigenschaft entfernen',
'Delete Shipto' => 'Lieferadresse löschen',
'Delete address' => 'Adresse löschen',
'Delete all' => 'Alle Löschen',
......
'Do you really want to delete AP transaction #1?' => 'Möchten Sie wirklich die Kreditorenbuchung #1 löschen?',
'Do you really want to delete AR transaction #1?' => 'Möchten Sie wirklich die Debitorenbuchung #1 löschen?',
'Do you really want to delete GL transaction #1?' => 'Möchten Sie wirklich die Dialogbuchung #1 löschen?',
'Do you really want to delete the property?' => 'Möchten Sie wirklich die Eigenschaft entfernen?',
'Do you really want to delete the selected documents?' => 'Möchten Sie wirklich diese Dateien löschen?',
'Do you really want to delete the selected links?' => 'Möchten Sie wirklich die ausgewählten Verknüpfungen löschen?',
'Do you really want to delete the selected objects?' => 'Möchten Sie die ausgewählten Objekte wirklich löschen?',
......
'Edit Preferences for #1' => 'Einstellungen von #1 bearbeiten',
'Edit Price Factor' => 'Preisfaktor bearbeiten',
'Edit Printer' => 'Drucker bearbeiten',
'Edit Properties' => 'Eigenschaften bearbeiten',
'Edit Purchase Credit Note' => 'Einkaufsgutschrift bearbeiten',
'Edit Purchase Delivery Order' => 'Lieferschein (Einkauf) bearbeiten',
'Edit Purchase Invoice' => 'Einkaufsrechnung bearbeiten',
......
'Error message from the database: #1' => 'Fehlermeldung der Datenbank: #1',
'Error message from the webshop api:' => 'Fehlermeldung der Webshop Api',
'Error when saving: #1' => 'Fehler beim Speichern: #1',
'Error while adding variant property: #1' => 'Fehler beim Hinzufügen der Varianteneigenschaft: #1',
'Error while applying year-end bookings!' => 'Fehler beim Durchführen der Abschlußbuchungen!',
'Error while converting part to variant: ' => 'Fehler beim Umwandeln des Artikel zur Variante: ',
'Error while creating project with project number of new order number, project number #1 already exists!' => 'Fehler beim Erstellen eines Projekts mit der Projektnummer der neuen Auftragsnummer, Projektnummer #1 existiert bereits!',
'Error while creating variants: ' => 'Fehler beim Erstellen von Varianten: ',
'Error while processing email journal (\'#1\') attachments with \'#2\': ' => 'Fehler beim Verarbeiten der E-Mail-Journals (\'#1\') Anhänge mit \'#2\': ',
'Error while saving shop order #1. DB Error #2. Generic exception #3.' => 'Fehler beim Speichern der Shop-Bestellung #1. DB Fehler #2. Genereller Fehler #3.',
'Error while updating values of variants: #1' => 'Fehler beim Updaten der Werte der Varianten: #1',
'Error while updating variant properties: #1' => 'Fehler beim Updaten der Ausprägungen: #1',
'Error with default taxzone' => 'Ungültige Standardsteuerzone',
'Error!' => 'Fehler!',
'Error: #1' => 'Fehler: #1',
......
'Hide Attachment' => 'Anhang verbergen',
'Hide Convert Part to Variant' => 'Artikel in Variante umwandeln verbergen',
'Hide Create new Variants' => 'Neue Varianten erstellen verbergen',
'Hide Edit Properties' => 'Eigenschaften bearbeiten verbergen',
'Hide Filter' => 'Filter verbergen',
'Hide Records' => 'Belege verbergen',
'Hide all details' => 'Alle Details verbergen',
......
'Show Convert Part to Variant' => 'Artikel in Variante umwandeln zeigen',
'Show Create new Variants' => 'Neue Varianten erstellen zeigen',
'Show E-Mails' => 'E-Mails anzeigen',
'Show Edit Properties' => 'Eigenschaften bearbeiten zeigen',
'Show Filter' => 'Filter zeigen',
'Show Records' => 'Belege anzeigen',
'Show Salesman' => 'Verkäufer anzeigen',
......
'The value \'#1\' is not a valid IBAN.' => 'Der Wert \'#1\' ist keine gültige IBAN.',
'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => 'Der Wert »unsere Leitweg-ID beim Kunden« muss in den Kundenstammdaten gesetzt sein für Profil #1.',
'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken',
'The variants \'#1\' and \'#2\' would have the same variant property values.' => 'Die Varianten \'#1\' und \'#2\' würden die gleichen Ausprägunen bekommen.',
'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => 'Der Lieferant konnte nicht gefunden werden. Bitte registrieren Sie den Lieferanten mit dem exakten Namen aus der QR-Rechnung wie unten angezeigt.',
'The vendor name is missing.' => 'Der Liefeantenname fehlt.',
'The version number is missing.' => 'Die Versionsnummer fehlt.',
locale/en/all
'Delete Dataset' => '',
'Delete Documents' => '',
'Delete Images' => '',
'Delete Property' => '',
'Delete Shipto' => '',
'Delete address' => '',
'Delete all' => '',
......
'Do you really want to delete AP transaction #1?' => '',
'Do you really want to delete AR transaction #1?' => '',
'Do you really want to delete GL transaction #1?' => '',
'Do you really want to delete the property?' => '',
'Do you really want to delete the selected documents?' => '',
'Do you really want to delete the selected links?' => '',
'Do you really want to delete the selected objects?' => '',
......
'Edit Preferences for #1' => '',
'Edit Price Factor' => '',
'Edit Printer' => '',
'Edit Properties' => '',
'Edit Purchase Credit Note' => '',
'Edit Purchase Delivery Order' => '',
'Edit Purchase Invoice' => '',
......
'Error message from the database: #1' => '',
'Error message from the webshop api:' => '',
'Error when saving: #1' => '',
'Error while adding variant property: #1' => '',
'Error while applying year-end bookings!' => '',
'Error while converting part to variant: ' => '',
'Error while creating project with project number of new order number, project number #1 already exists!' => '',
'Error while creating variants: ' => '',
'Error while processing email journal (\'#1\') attachments with \'#2\': ' => '',
'Error while saving shop order #1. DB Error #2. Generic exception #3.' => '',
'Error while updating values of variants: #1' => '',
'Error while updating variant properties: #1' => '',
'Error with default taxzone' => '',
'Error!' => '',
'Error: #1' => '',
......
'Hide Attachment' => '',
'Hide Convert Part to Variant' => '',
'Hide Create new Variants' => '',
'Hide Edit Properties' => '',
'Hide Filter' => '',
'Hide Records' => '',
'Hide all details' => '',
......
'Show Convert Part to Variant' => '',
'Show Create new Variants' => '',
'Show E-Mails' => '',
'Show Edit Properties' => '',
'Show Filter' => '',
'Show Records' => '',
'Show Salesman' => '',
......
'The value \'#1\' is not a valid IBAN.' => '',
'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => '',
'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => '',
'The variants \'#1\' and \'#2\' would have the same variant property values.' => '',
'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => '',
'The vendor name is missing.' => '',
'The version number is missing.' => '',
templates/design40_webpages/part/_parent_variant.html
<div id="parent_variant" class="wrapper">
<div class="input-panel">
<h3> [% LxERP.t8("Variant Properties") %] </h3>
<table id="parent_variant_table" class="tbl-list">
<table id="variant_value_table" class="tbl-list">
<caption>
[% LxERP.t8("Variants") %]
</caption>
<thead>
<tr>
<th>
[% L.checkbox_tag("varaint_select_all_multi_id",
checked=0, id='variant_select_all'
[% L.checkbox_tag("varaint_value_select_all_multi_id",
checked=0, id='variant_value_select_all'
alt=LxERP.t8('Select/Deselect all'), title=LxERP.t8('Select/Deselect all'),
) %]
</th>
<th id="variant_partnumber_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("partnumber")'>
<th id="variant_value_partnumber_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("partnumber")'>
[% 'Partnumber' | $T8 %]
</a>
</th>
<th id="variant_ean_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("ean")'>
<th id="variant_value_ean_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("ean")'>
[% "EAN" | $T8 %]
</a>
</th>
<th id="variant_description_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("description")'>
<th id="variant_value_description_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("description")'>
[% "Description" | $T8 %]
</a>
</th>
<th id="variant_variant_values_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("variant_values")'>
<th id="variant_value_variant_values_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("variant_values")'>
[% "Property Values (Abbreviation)" | $T8 %]
</a>
</th>
[% FOREACH variant_property = SELF.part.variant_properties %]
<th id="variant_variant_property_[% variant_property.id %]_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("variant_property_[% variant_property.id %]")'>
<th id="variant_value_variant_property_[% variant_property.id %]_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("variant_property_[% variant_property.id %]")'>
[% variant_property.displayable_name %]
</a>
</th>
[% END %]
<th id="variant_listprice_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("listprice")'>
<th id="variant_value_listprice_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("listprice")'>
[% "List Price" | $T8 %]
</a>
</th>
<th id="variant_sellprice_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("sellprice")'>
<th id="variant_value_sellprice_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("sellprice")'>
[% "Sell Price" | $T8 %]
</a>
</th>
<th id="variant_lastcost_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("lastcost")'>
<th id="variant_value_lastcost_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("lastcost")'>
[% "Last Cost" | $T8 %]
</a>
</th>
<th id="variant_onhand_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("onhand")'>
<th id="variant_value_onhand_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("onhand")'>
[% "On Hand" | $T8 %]
</a>
</th>
<th id="variant_rop_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants("rop")'>
<th id="variant_value_rop_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_values("rop")'>
[% "ROP" | $T8 %]
</a>
</th>
<th>
[% L.select_tag("add_variant_property", AVAILABLE_VARIANT_PROPERIES
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Add Variant Property"),
onchange='kivi.Part.update_variant_property_value_options();',
)%]
</th>
</tr>
<tr>
<th>
......
<th><!-- partnumber --></th>
<th><!-- ean --></th>
<th>
[% L.input_tag("description_for_selected_variants", SELF.part.description,
[% L.input_tag("description_for_selected_variants_values", SELF.part.description,
class="wi-medium",
) %]
[%- L.button_tag(
......
[% END %]
<th>
[% L.input_tag(
"listprice_as_number_for_selected_variants",
"listprice_as_number_for_selected_variants_values",
SELF.part.listprice_as_number,
class="reformat_number numeric wi-small",
) %]
......
</th>
<th>
[% L.input_tag(
"sellprice_as_number_for_selected_variants",
"sellprice_as_number_for_selected_variants_values",
SELF.part.sellprice_as_number,
class="reformat_number numeric wi-small",
) %]
......
</th>
<th>
[% L.input_tag(
"lastcost_as_number_for_selected_variants",
"lastcost_as_number_for_selected_variants_values",
SELF.part.lastcost_as_number,
class="reformat_number numeric wi-small",
) %]
......
<th><!-- onhand --></th>
<th>
[% L.input_tag(
"rop_as_number_for_selected_variants",
"rop_as_number_for_selected_variants_values",
SELF.part.rop_as_number,
class="reformat_number numeric wi-small",
) %]
......
title=LxERP.t8('Apply to selected rows'),
) %]
</th>
<th>
[% L.select_tag("add_variant_property_value_for_selected_variants", []
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
) %]
[%- L.button_tag(
'kivi.Part.set_selected_variants_to_value("add_variant_property_value")',
"↓",
alt=LxERP.t8('Apply to selected rows'),
title=LxERP.t8('Apply to selected rows'),
) %]
</th>
</tr>
</thead>
<tbody class="listrow">
[% FOREACH variant = SELF.part.variants %]
<tr class="variant_row_entry">
[% L.hidden_tag("variants[+].id", variant.id, id='variant_' _ variant.id) %]
[% L.hidden_tag("variants[].position", loop.count) %]
<tr class="variant_value_row_entry">
[% L.hidden_tag("variants_values[+].id", variant.id, id='variant_' _ variant.id) %]
[% L.hidden_tag("variants_values[].position", loop.count) %]
<td>
[% L.checkbox_tag('variant_multi_id_' _ loop.count, value=variant.id, checked=0) %]
[% L.checkbox_tag('variant_value_multi_id_' _ loop.count, value=variant.id, checked=0) %]
</td>
<td>[% variant.presenter.part %]</td>
<td>
[% L.input_tag("variants[].ean", variant.ean, class="wi-medium") %]
[% L.input_tag("variants_values[].ean", variant.ean, class="wi-medium") %]
</td>
<td>
[% L.input_tag("variants[].description", variant.description, class="wi-medium") %]
[% L.input_tag("variants_values[].description", variant.description, class="wi-medium") %]
</td>
<td>[% variant.variant_values | html %]</td>
[% FOREACH variant_property = SELF.part.variant_properties %]
......
[% END %]
<td>
[% L.input_tag(
"variants[].listprice_as_number",
"variants_values[].listprice_as_number",
variant.listprice_as_number,
class='reformat_number numeric wi-small',
) %]
</td>
<td>
[% L.input_tag(
"variants[].sellprice_as_number",
"variants_values[].sellprice_as_number",
variant.sellprice_as_number,
class='reformat_number numeric wi-small',
) %]
</td>
<td>
[% L.input_tag(
"variants[].lastcost_as_number",
"variants_values[].lastcost_as_number",
variant.lastcost_as_number,
class='reformat_number numeric wi-small',
) %]
......
</td>
<td>
[% L.input_tag(
"variants[].rop_as_number",
"variants_values[].rop_as_number",
variant.rop_as_number,
class='reformat_number numeric wi-small',
) %]
</td>
<td>
[% L.select_tag("variants[].add_variant_property_value", []
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
) %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% L.button_tag('kivi.Part.update_variants();', LxERP.t8("Update Variants")) %]
[% L.button_tag('kivi.Part.update_variants_values();', LxERP.t8("Update Variants")) %]
</div>
[% BLOCK panel_1 %]
......
%]
</div>
<div class="wrapper">
[%
INCLUDE 'common/toggle_panel.html'
block_name='panel_3'
toggle_class='panel_3'
display_status='open'
button_closed=LxERP.t8('Show Edit Properties')
button_open=LxERP.t8('Hide Edit Properties')
%]
</div>
[% BLOCK panel_3 %]
<h3> [% LxERP.t8("Edit Properties") %] </h3>
<table id="variant_property_table" class="tbl-list">
<caption>
[% LxERP.t8("Variants") %]
</caption>
<thead>
<tr>
<th>
[% L.checkbox_tag("varaint_property_select_all_multi_id",
checked=0, id='variant_property_select_all'
alt=LxERP.t8('Select/Deselect all'), title=LxERP.t8('Select/Deselect all'),
) %]
</th>
<th id="variant_property_partnumber_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("partnumber")'>
[% 'Partnumber' | $T8 %]
</a>
</th>
<th id="variant_property_ean_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("ean")'>
[% "EAN" | $T8 %]
</a>
</th>
<th id="variant_property_description_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("description")'>
[% "Description" | $T8 %]
</a>
</th>
<th id="variant_property_variant_values_header_id">
<a href='#' onClick='javascript:kivi.Part.reorder_variants_properties("variant_values")'>
[% "Property Values (Abbreviation)" | $T8 %]
</a>
</th>
[% FOREACH variant_property = SELF.part.variant_properties %]
<th id="variant_property_variant_property_[% variant_property.id %]_header_id">
<span>
<a style="color:#e0e0d6"
href='#' onClick='javascript:kivi.Part.reorder_variants_properties("variant_property_[% variant_property.id %]")'>
[% variant_property.displayable_name | html %]
</a>
[% L.button_tag('kivi.Part.remove_variant_property(this)', 'X'
title=LxERP.t8('Delete Property'),
alt=LxERP.t8('Delete Property'),
)%]
</span>
</th>
[% END %]
<th>
[% L.select_tag("add_variant_property", AVAILABLE_VARIANT_PROPERIES
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Add Variant Property"),
onchange='kivi.Part.update_variant_property_value_options();',
)%]
</th>
</tr>
<tr>
<th>
[%- L.button_tag('kivi.Part.variant_property_rows_toggle_selected();', "🔄",
title=LxERP.t8("Toggle selection"),
alt=LxERP.t8("Toggle selection"),
) %]
</th>
<th><!-- partnumber --></th>
<th><!-- ean --></th>
<th><!-- description --></th>
<th><!-- variant_values --></th>
[% FOREACH variant_property = SELF.part.variant_properties %]
<th>
[% L.select_tag("variant_property_" _ variant_property.id _ "_for_selected_variants_properties",
variant_property.property_values_sorted
title_key='displayable_name', value_key='id'
) %]
[%- L.button_tag(
'kivi.Part.set_selected_variants_to_property("variant_property_' _ variant_property.id _ '")',
"↓",
alt=LxERP.t8('Apply to selected rows'),
title=LxERP.t8('Apply to selected rows'),
) %]
</th>
[% END %]
<th>
[% L.select_tag("add_variant_property_value_for_selected_variants_properties", []
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
) %]
[%- L.button_tag(
'kivi.Part.set_selected_variants_to_property("add_variant_property_value")',
"↓",
alt=LxERP.t8('Apply to selected rows'),
title=LxERP.t8('Apply to selected rows'),
) %]
</th>
</tr>
</thead>
<tbody class="listrow">
[% FOREACH variant = SELF.part.variants %]
<tr class="variant_property_row_entry">
[% L.hidden_tag("variants_properties[+].id", variant.id, id='variant_' _ variant.id) %]
[% L.hidden_tag("variants_properties[].position", loop.count) %]
<td>
[% L.checkbox_tag('variant_property_multi_id_' _ loop.count, value=variant.id, checked=0) %]
</td>
<td>[% variant.presenter.part %]</td>
<td><span class="data wi-medium">
[% variant.ean | html %]
</span></td>
<td><span class="data wi-normal">
[% variant.description | html %]
</span></td>
<td>[% variant.variant_values | html %]</td>
[% FOREACH variant_property = SELF.part.variant_properties %]
<td>
[% L.select_tag("variants_properties[].variant_property_" _ variant_property.id,
variant_property.property_values_sorted
title_key='displayable_name', value_key='id',
default=variant.variant_value(variant_property).id
) %]
</td>
[% END %]
<td>
[% L.select_tag("variants_properties[].add_variant_property_value", []
title_key='displayable_name', value_key='id',
with_empty=1, empty_title=LxERP.t8("Select Variant Property First"),
) %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% L.button_tag('kivi.Part.update_variants_properties();', LxERP.t8("Update Variants")) %]
[% END %]
</div>

Auch abrufbar als: Unified diff