Revision a4420618
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
| SL/Controller/VariantProperty.pm | ||
|---|---|---|
| use SL::DB::Manager::VariantProperty;
 | ||
|  | ||
| use Rose::Object::MakeMethods::Generic (
 | ||
|   'scalar --get_set_init' => [ qw(variant_property variant_property_value) ]
 | ||
|   'scalar --get_set_init' => [ qw(variant_property) ]
 | ||
| );
 | ||
|  | ||
| #__PACKAGE__->run_before('check_auth');
 | ||
| __PACKAGE__->run_before('add_javascripts', only => [ qw(edit_property) ]);
 | ||
| __PACKAGE__->run_before('add_javascripts', only => [ qw(edit_variant_property) ]);
 | ||
|  | ||
| #
 | ||
| # actions
 | ||
| #
 | ||
|  | ||
| sub action_list_properties {
 | ||
| sub action_list_variant_properties {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   $self->_setup_list_action_bar;
 | ||
| ... | ... | |
|                );
 | ||
| }
 | ||
|  | ||
| sub action_edit_property {
 | ||
| sub action_edit_variant_property {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   my $is_new = !$self->variant_property->id;
 | ||
|   $self->_setup_form_action_bar;
 | ||
|   $self->render('variant_property/variant_property_form', title => ($is_new ? t8('Add Variant Property') : t8('Edit Variant Property')));
 | ||
|   $self->render(
 | ||
|     'variant_property/variant_property_form',
 | ||
|     title => ($is_new ? t8('Add Variant Property') : t8('Edit Variant Property')),
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| sub action_save_property {
 | ||
| sub action_save_variant_property {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   $self->create_or_update_property;
 | ||
|   $self->create_or_update_variant_property;
 | ||
| }
 | ||
|  | ||
| sub action_delete_property {
 | ||
| sub action_delete_variant_property {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   if ( eval { $self->shop->delete; 1; } ) {
 | ||
|     flash_later('info',  $::locale->text('The shop has been deleted.'));
 | ||
|   if ( eval {
 | ||
|       SL::DB->client->with_transaction(sub {
 | ||
|         $_->delete for $self->variant_property->property_values;
 | ||
|         $self->variant_property->delete;
 | ||
|       });
 | ||
|       1;
 | ||
|     } ) {
 | ||
|     flash_later('info',  t8('The Variant Property has been deleted.'));
 | ||
|   } else {
 | ||
|     flash_later('error', $::locale->text('The shop is in use and cannot be deleted.'));
 | ||
|     flash_later('error', t8('The Variant Property is in use and cannot be deleted.'));
 | ||
|   };
 | ||
|   $self->redirect_to(action => 'list_properties');
 | ||
|   $self->redirect_to(action => 'list_variant_properties');
 | ||
| }
 | ||
|  | ||
| sub action_reorder_properties {
 | ||
| sub action_reorder_variant_properties {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   SL::DB::VariantProperty->reorder_list(@{ $::form->{variant_property_id} || [] });
 | ||
|   $self->render(\'', { type => 'json' }); # ' emacs happy again
 | ||
| }
 | ||
|  | ||
| sub action_edit_property_value {
 | ||
| sub action_reorder_variant_property_values {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   $self->render_variant_edit_dialog();
 | ||
|   SL::DB::VariantPropertyValue->reorder_list(@{ $::form->{variant_property_value_id} || [] });
 | ||
|   $self->render(\'', { type => 'json' }); # ' emacs happy again
 | ||
| }
 | ||
|  | ||
| sub action_save_property_value {
 | ||
| sub action_edit_variant_property_value {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   $self->create_or_update_property_value;
 | ||
| }
 | ||
|  | ||
|  | ||
| sub render_variant_edit_dialog {
 | ||
|   my ($self) = @_;
 | ||
|   $self->js
 | ||
|     ->run(
 | ||
|       'kivi.VariantProperty.variant_dialog',
 | ||
|       t8('Variant Value'),
 | ||
|       $self->render('variant_property/variant_property_value_form', { output => 0 })
 | ||
|       'kivi.VariantProperty.variant_property_value_dialog',
 | ||
|       t8('Variant Property Value'),
 | ||
|       $self->render(
 | ||
|         'variant_property/variant_property_value_form',
 | ||
|         { output => 0 },
 | ||
|         variant_property_value => SL::DB::Manager::VariantPropertyValue->find_by(
 | ||
|             id => $::form->{variant_property_value_id}
 | ||
|           ),
 | ||
|       )
 | ||
|     )
 | ||
|     ->reinit_widgets;
 | ||
|  | ||
|   $self->js->render;
 | ||
| }
 | ||
|  | ||
| #sub action_list_property_values_list {
 | ||
| #  my ($self) = @_;
 | ||
| #
 | ||
| #  $self->_setup_list_action_bar;
 | ||
| #  $self->render('variant_property/variant_property_list',
 | ||
| #                title             => t8('Variant Property'),
 | ||
| #                VARIANTPROPERTIES => SL::DB::Manager::VariantProperty->get_all_sorted,
 | ||
| #               );
 | ||
| #}
 | ||
|  | ||
| #sub action_reorder {
 | ||
| #  my ($self) = @_;
 | ||
| #
 | ||
| #  SL::DB::DeliveryTerm->reorder_list(@{ $::form->{delivery_term_id} || [] });
 | ||
| #
 | ||
| #  $self->render(\'', { type => 'json' });     # ' make Emacs happy
 | ||
| #}
 | ||
| #
 | ||
| sub action_save_variant_property_value {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   die "'variant_property_value.id' is needed" unless $::form->{variant_property_value}->{id};
 | ||
|  | ||
|   my $variant_property_value = SL::DB::Manager::VariantPropertyValue->find_by(
 | ||
|     id => $::form->{variant_property_value}->{id}
 | ||
|   ) or die t8("Could not find Variant Property Value");
 | ||
|  | ||
|   $variant_property_value->update_attributes(
 | ||
|     %{$::form->{variant_property_value}}
 | ||
|   );
 | ||
|  | ||
|   flash_later('info', t8('The Variant Property Value has been saved.'));
 | ||
|   $self->redirect_to(
 | ||
|     action => 'edit_variant_property',
 | ||
|     id     => $variant_property_value->variant_property_id,
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| sub action_add_variant_property_value {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   my $new_variant_property_value = SL::DB::VariantPropertyValue->new(
 | ||
|     %{ $::form->{new_variant_property_value} },
 | ||
|     variant_property => $self->variant_property,
 | ||
|   )->save;
 | ||
|  | ||
|   $self->redirect_to(
 | ||
|     action => 'edit_variant_property',
 | ||
|     id     => $self->variant_property->id,
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| #
 | ||
| #inits
 | ||
| #
 | ||
| ... | ... | |
|   SL::DB::Manager::VariantProperty->find_by_or_create(id => $::form->{id} || 0)->assign_attributes(%{ $::form->{variant_property} });
 | ||
| }
 | ||
|  | ||
| sub init_variant_property_value {
 | ||
|   SL::DB::Manager::VariantPropertyValue->find_by_or_create(id => $::form->{variant_property_value_id} || 0)->assign_attributes(%{ $::form->{variant_property_value} });
 | ||
| }
 | ||
|  | ||
| sub add_javascripts  {
 | ||
|   $::request->{layout}->add_javascripts(qw(kivi.VariantProperty.js));
 | ||
| }
 | ||
| ... | ... | |
| # helpers
 | ||
| #
 | ||
|  | ||
| sub create_or_update_property {
 | ||
| sub create_or_update_variant_property {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   my $is_new = !$self->variant_property->id;
 | ||
| ... | ... | |
|   my @errors = $self->variant_property->validate;
 | ||
|   if (@errors) {
 | ||
|     flash('error', @errors);
 | ||
|     $self->action_edit_property();
 | ||
|     $self->action_edit_variant_property();
 | ||
|     return;
 | ||
|   }
 | ||
|  | ||
|   $self->variant_property->save;
 | ||
|  | ||
|   flash_later('info', $is_new ? t8('The Variant Property has been created.') : t8('The Variant Property has been saved.'));
 | ||
|   $self->redirect_to(action => 'list_properties');
 | ||
| }
 | ||
|  | ||
| sub create_or_update_property_value {
 | ||
|   my ($self) = @_;
 | ||
|  | ||
|   $main::lxdebug->dump(0, "TST:FORM ", $::form);
 | ||
|   my $is_new = !$self->variant_property_value->id;
 | ||
|  | ||
| #  my @errors = $self->variant_property_value->validate;
 | ||
| #  if (@errors) {
 | ||
| #    flash('error', @errors);
 | ||
| #    $self->action_edit_property();
 | ||
| #    return;
 | ||
| #  }
 | ||
|   $main::lxdebug->dump(0, "TST:PV ", $self->variant_property_value);
 | ||
|   $self->variant_property_value->assign_attributes( variant_property_id => $::form->{property_value_id});
 | ||
|   $self->variant_property_value->save;
 | ||
|  | ||
|   flash_later('info', $is_new ? t8('The Variant Property Value has been created.') : t8('The Variant Property Value has been saved.'));
 | ||
|   $self->action_edit_property();
 | ||
|   return;
 | ||
|   $self->redirect_to(
 | ||
|     action => 'edit_variant_property',
 | ||
|     id     => $self->variant_property->id,
 | ||
|   );
 | ||
| }
 | ||
|  | ||
| sub _setup_form_action_bar {
 | ||
| ... | ... | |
|       combobox => [
 | ||
|         action => [
 | ||
|           t8('Save'),
 | ||
|           submit    => [ '#form', { action => "VariantProperty/save_property" } ],
 | ||
|           submit    => [ '#form', { action => "VariantProperty/save_variant_property" } ],
 | ||
|           accesskey => 'enter',
 | ||
|         ],
 | ||
|          action => [
 | ||
|           t8('Delete'),
 | ||
|           submit => [ '#form', { action => "VariantProperty/delete_property" } ],
 | ||
|           submit => [ '#form', { action => "VariantProperty/delete_variant_property" } ],
 | ||
|         ],
 | ||
|       ],
 | ||
|       action => [
 | ||
|         t8('Cancel'),
 | ||
|         submit => [ '#form', { action => "VariantProperty/list_properties" } ],
 | ||
|         submit => [ '#form', { action => "VariantProperty/list_variant_properties" } ],
 | ||
|       ],
 | ||
|     );
 | ||
|   }
 | ||
| ... | ... | |
|     $bar->add(
 | ||
|       link => [
 | ||
|         t8('Add'),
 | ||
|         link => $self->url_for(action => 'edit_property'),
 | ||
|         link => $self->url_for(action => 'edit_variant_property'),
 | ||
|       ],
 | ||
|     )
 | ||
|   };
 | ||
| SL/DB/VariantProperty.pm | ||
|---|---|---|
| use SL::DB::Manager::VariantProperty;
 | ||
| use SL::DB::Helper::ActsAsList;
 | ||
| use SL::DB::Helper::TranslatedAttributes;
 | ||
| use SL::DB::Helper::AttrSorted;
 | ||
|  | ||
| __PACKAGE__->meta->add_relationships(
 | ||
|   parent_variants => {
 | ||
| ... | ... | |
|   }
 | ||
| );
 | ||
|  | ||
| __PACKAGE__->attr_sorted({ unsorted => 'property_values', position => 'sortkey'});
 | ||
|  | ||
| __PACKAGE__->meta->initialize;
 | ||
|  | ||
| sub validate {
 | ||
| SL/DB/VariantPropertyValue.pm | ||
|---|---|---|
|  | ||
| use SL::DB::MetaSetup::VariantPropertyValue;
 | ||
| use SL::DB::Manager::VariantPropertyValue;
 | ||
| use SL::DB::Helper::ActsAsList;
 | ||
|  | ||
| __PACKAGE__->meta->add_relationships(
 | ||
|   parent_variants => {
 | ||
| js/kivi.VariantProperty.js | ||
|---|---|---|
| namespace('kivi.VariantProperty', function(ns) {
 | ||
|   var $dialog;
 | ||
|  | ||
|   ns.variant_dialog = function(title, html) {
 | ||
|     var id            = 'jqueryui_popup_dialog';
 | ||
|   ns.variant_property_value_dialog = function(title, html) {
 | ||
|     var id = 'jqueryui_popup_dialog';
 | ||
|     var dialog_params = {
 | ||
|       id:     id,
 | ||
|       width:  800,
 | ||
|       height: 500,
 | ||
|       modal:  true,
 | ||
|       close: function(event, ui) { $dialog.remove(); },
 | ||
|       close: function(_event, _ui) { $dialog.remove(); },
 | ||
|     };
 | ||
|  | ||
|     $('#' + id).remove();
 | ||
| ... | ... | |
|     return true;
 | ||
|   };
 | ||
|  | ||
|  | ||
|   ns.save_variant_value = function() {
 | ||
|     var form = $('#variant_property_value_form').serializeArray();
 | ||
|     console.log("my", form)
 | ||
|     form.push( { name: 'action', value: 'VariantProperty/save_property_value' }
 | ||
|     );
 | ||
|  | ||
|     $.post('controller.pl', form, function(data) {
 | ||
|       kivi.eval_json_result(data);
 | ||
|     });
 | ||
|   ns.save_variant_property_value = function() {
 | ||
|     var data = $('#variant_property_value_form').serializeArray();
 | ||
|     data.push({ name: 'action', value: 'VariantProperty/save_variant_property_value' });
 | ||
|     $.post('controller.pl', data, kivi.eval_json_result);
 | ||
|   };
 | ||
|  | ||
|   ns.add_or_edit_variant_value = function(id) {
 | ||
|     $.post('controller.pl', { action: 'VariantProperty/edit_property_value', id: id }, function(data) {
 | ||
|       kivi.eval_json_result(data);
 | ||
|     });
 | ||
|   ns.add_variant_property_value = function() {
 | ||
|     var data = $('#variant_property_value_list_form').serializeArray();
 | ||
|     data.push({ name: 'action', value: 'VariantProperty/add_variant_property_value' });
 | ||
|     $.post("controller.pl", data, kivi.eval_json_result);
 | ||
|   }
 | ||
|  | ||
|   ns.edit_variant_property_value = function(variant_property_value_id) {
 | ||
|     $.post('controller.pl', {
 | ||
|       action: 'VariantProperty/edit_variant_property_value',
 | ||
|       variant_property_value_id: variant_property_value_id
 | ||
|     }, kivi.eval_json_result);
 | ||
|   };
 | ||
|  | ||
| });
 | ||
| menus/user/10-variant_properties.yaml | ||
|---|---|---|
|   name: Variant Properties
 | ||
|   order: 1110
 | ||
|   params:
 | ||
|     action: VariantProperty/list_properties
 | ||
|     action: VariantProperty/list_variant_properties
 | ||
| templates/design40_webpages/variant_property/variant_property_form.html | ||
|---|---|---|
| [% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]
 | ||
| [% USE Dumper %]
 | ||
|  | ||
| <h1>[% FORM.title %]</h1>
 | ||
| [%- INCLUDE 'common/flash.html' %]
 | ||
|  | ||
| [% #Dumper.dump_html(SELF.variant_property.property_values) %] 
 | ||
| <div class="wrapper">
 | ||
| <form method="post" action="controller.pl" id="form">
 | ||
|   [%- INCLUDE 'common/flash.html' %] 
 | ||
| [% P.hidden_tag("id", SELF.variant_property.id) %]
 | ||
|  | ||
| <table class="tbl-horizontal">
 | ||
|   <caption> [% LxERP.t8("Variant Property") %] </caption>
 | ||
| ... | ... | |
|       <td> [%- 'Abbreviation' | $T8 %] </td>
 | ||
|       <td> [% P.input_tag("variant_property.abbreviation", SELF.variant_property.abbreviation, "data-validate"="required", "data-title"=LxERP.t8("Abbreviation")) %] </td>
 | ||
|     </tr>
 | ||
|     [% IF SELF.variant_property.id %] 
 | ||
|     [% END %] 
 | ||
|   </tbody>
 | ||
| </table>
 | ||
|  | ||
|  | ||
| <table class="tbl-horizontal">
 | ||
|   <caption> [%- 'Translation' | $T8 %] </caption>
 | ||
|   <tbody>
 | ||
|     [%- FOREACH language = SELF.languages %] 
 | ||
|     [%- FOREACH language = SELF.languages %]
 | ||
|     <tr><th class="caption" colspan="2">[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %])</th></tr>
 | ||
|     <tr>
 | ||
|       <td> [%- 'Name' | $T8 %] </td>
 | ||
| ... | ... | |
|     </tr>
 | ||
|     <tr>
 | ||
|       <th> [% LxERP.t8("Texts for quotations & orders") %] </th>
 | ||
|       <td> 
 | ||
|       <td>
 | ||
|       <input type="text" name="translation_[% language.id %]" value="[%- HTML.escape(SELF.variant_property.translated_attribute('description_long', language, 1)) %]" size="60">
 | ||
|       </td>
 | ||
|       </tr>
 | ||
|       <tr>
 | ||
|       <th> [% LxERP.t8("Texts for invoices") %] </th>
 | ||
|       <td> 
 | ||
|       <td>
 | ||
|       <input type="text" name="translation_invoice_[% language.id %]" value="[%- HTML.escape(SELF.variant_property.translated_attribute('description_long_invoice', language, 1)) %]" size="60">
 | ||
|       </td>
 | ||
|     </tr>
 | ||
|     [%- END %] 
 | ||
|     [%- END %]
 | ||
|   </tbody>
 | ||
| </table>
 | ||
| [% P.hidden_tag("id", SELF.variant_property.id) %] 
 | ||
|  | ||
|  | ||
| </form>
 | ||
|  | ||
|   [% IF !SELF.variant_property.property_values.size %] 
 | ||
|   <p>
 | ||
|     [%- 'No Variantpropertyvalues has been created yet.' | $T8 %] 
 | ||
|   </p>
 | ||
|   [%- ELSE %] 
 | ||
|     [% PROCESS "variant_property/variant_property_value_list.html" %]
 | ||
|   [% END %]
 | ||
| [% IF SELF.variant_property.id %]
 | ||
|   [% PROCESS "variant_property/variant_property_value_list.html" %]
 | ||
| [% END %]
 | ||
|  | ||
|   [% L.button_tag('kivi.VariantProperty.add_or_edit_variant_value(' _ SELF.variant_property.id _ ')', LxERP.t8("Add"))  %]
 | ||
| </div>
 | ||
| templates/design40_webpages/variant_property/variant_property_list.html | ||
|---|---|---|
| <h1>[% title %]</h1>
 | ||
|  | ||
| <div class="wrapper">
 | ||
|   [% IF !VARIANTPROPERTIES.size %] 
 | ||
|   [% IF !VARIANTPROPERTIES.size %]
 | ||
|   <p>
 | ||
|     [%- 'No Variantproperty has been created yet.' | $T8 %] 
 | ||
|     [%- 'No Variantproperty has been created yet.' | $T8 %]
 | ||
|   </p>
 | ||
|   [%- ELSE %] 
 | ||
|   [%- ELSE %]
 | ||
|   <table id="variant_properties" class="tbl-list width-moderate">
 | ||
|     <caption>[% 'Variant Properties' | $T8 %]</caption>
 | ||
|     <thead>
 | ||
|       <tr>
 | ||
|         <th><img src="image/updown.png" alt="[% LxERP.t8('reorder item') %]"></th>
 | ||
|         <th>[% 'Name'         | $T8 %]</th>
 | ||
|         <th>[% 'Unique Name'  | $T8 %]</th>
 | ||
| ... | ... | |
|       [% FOREACH variant_property = VARIANTPROPERTIES %]
 | ||
|       <tr id="variant_property_id_[% variant_property.id %]">
 | ||
|         <td class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
 | ||
|         <td>[% L.link(SELF.url_for(action="edit_property",
 | ||
|         <td>[% L.link(SELF.url_for(action="edit_variant_property",
 | ||
|           id=variant_property.id), variant_property.name) %]</td>
 | ||
|         <td>[% variant_property.unique_name  | html %]</td>
 | ||
|         <td>[% variant_property.abbreviation | html %]</td>
 | ||
|         </tr>
 | ||
|       </tr>
 | ||
|       [% END %]
 | ||
|     </tbody>
 | ||
|   </table>
 | ||
|   [%- END %] 
 | ||
|   [%- END %]
 | ||
| </div>
 | ||
|  | ||
| [% L.sortable_element('#variant_properties tbody', url =>
 | ||
| SELF.url_for(action='reorder_properties'), with => 'variant_property_id') %]
 | ||
|  | ||
| SELF.url_for(action='reorder_variant_properties'), with => 'variant_property_id') %]
 | ||
| templates/design40_webpages/variant_property/variant_property_value_form.html | ||
|---|---|---|
| [% USE HTML %][% USE T8 %][% USE L %][% USE LxERP %][%- USE P -%]
 | ||
| [% USE Dumper %]
 | ||
| <h1>[% FORM.title %]</h1>
 | ||
| [%- INCLUDE 'common/flash.html' %] 
 | ||
| [%- INCLUDE 'common/flash.html' %]
 | ||
|  | ||
| <form id="variant_property_value_form">
 | ||
|     [% P.hidden_tag("variant_property_id", SELF.variant_property.id) %] 
 | ||
|     [% P.input_tag("h_variant_property_id", SELF.variant_property.id) %] 
 | ||
|     Name:[% SELF.variant_property.name %]
 | ||
|   [% P.hidden_tag("variant_property_value.id", variant_property_value.id) %]
 | ||
|   <div class="wrapper">
 | ||
|     <table class="tbl-horizontal">
 | ||
|       <caption> [% LxERP.t8("Value") %] </caption>
 | ||
| ... | ... | |
|       <tbody>
 | ||
|         <tr>
 | ||
|           <td> [%- 'Value' | $T8 %] </td>
 | ||
|           <td> [% P.input_tag("variant_property_value.value", SELF.variant_property_value.value, "data-validate"="required", "data-title"=LxERP.t8("Value")) %] </td>
 | ||
|           <td>
 | ||
|             [% P.input_tag(
 | ||
|                 "variant_property_value.value",
 | ||
|                 variant_property_value.value,
 | ||
|                 "data-validate"="required",
 | ||
|                 "data-title"=LxERP.t8("Value")
 | ||
|             ) %]
 | ||
|           </td>
 | ||
|         </tr>
 | ||
|           <tr>
 | ||
|         <tr>
 | ||
|           <td> [%- 'Abbreviation' | $T8 %] </td>
 | ||
|           <td> [% P.input_tag("variant_property_value.abbreviation", SELF.variant_property_value.abbreviation, "data-validate"="required", "data-title"=LxERP.t8("Abbreviation")) %] </td>
 | ||
|           <td>
 | ||
|             [% P.input_tag(
 | ||
|                 "variant_property_value.abbreviation",
 | ||
|                 variant_property_value.abbreviation,
 | ||
|                 "data-validate"="required",
 | ||
|                 "data-title"=LxERP.t8("Abbreviation"),
 | ||
|             ) %]
 | ||
|           </td>
 | ||
|         </tr>
 | ||
|       </tbody>
 | ||
|     </table>
 | ||
| ... | ... | |
|     <table class="tbl-horizontal">
 | ||
|       <caption> [%- 'Translation' | $T8 %] </caption>
 | ||
|       <tbody>
 | ||
|         [%- FOREACH language = SELF.languages %] 
 | ||
|         [%- FOREACH language = SELF.languages %]
 | ||
|         <tr><th class="caption" colspan="2">[%- HTML.escape(language.description) %] ([%- LxERP.t8('Translation') %])</th></tr>
 | ||
|         <tr>
 | ||
|           <td> [%- 'Value' | $T8 %] </td>
 | ||
|           <input type="text" name="translation_[% language.id %]" value="[%- HTML.escape(SELF.variant_property_value.translated_attribute('description_long', language, 1)) %]" size="60">
 | ||
|           <td> [% P.input_tag("variant_property_value.value", SELF.variant_property_value.value, "data-validate"="required", "data-title"=LxERP.t8("value")) %] </td>
 | ||
|           <input type="text" name="translation_[% language.id %]" value="[%- HTML.escape(variant_property_value.translated_attribute('description_long', language, 1)) %]" size="60">
 | ||
|           <td> [% P.input_tag("variant_property_value.value", variant_property_value.value, "data-validate"="required", "data-title"=LxERP.t8("value")) %] </td>
 | ||
|         </tr>
 | ||
|           <tr>
 | ||
|           <td> [%- 'Abbreviation' | $T8 %] </td>
 | ||
|           <input type="text" name="translation_invoice_[% language.id %]" value="[%- HTML.escape(SELF.variant_property_value.translated_attribute('description_long_invoice', language, 1)) %]" size="60">
 | ||
|           <td> [% P.input_tag("variant_property_value.description", SELF.variant_property_value.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %] </td>
 | ||
|           <input type="text" name="translation_invoice_[% language.id %]" value="[%- HTML.escape(variant_property_value.translated_attribute('description_long_invoice', language, 1)) %]" size="60">
 | ||
|           <td> [% P.input_tag("variant_property_value.description", variant_property_value.description, "data-validate"="required", "data-title"=LxERP.t8("Description")) %] </td>
 | ||
|         </tr>
 | ||
|         [%- END %] 
 | ||
|         [%- END %]
 | ||
|       </tbody>
 | ||
|     </table>
 | ||
|     [% P.hidden_tag("variant_property_value_id", SELF.variant_property_value.id) %] 
 | ||
|   </div>
 | ||
| </form>
 | ||
|  | ||
| <div class="buttons">
 | ||
|     [% L.button_tag("kivi.VariantProperty.save_variant_value()", LxERP.t8("Save"))  %]
 | ||
|     [% L.button_tag("kivi.VariantProperty.save_variant_property_value()", LxERP.t8("Save"))  %]
 | ||
| </div>
 | ||
|  | ||
| templates/design40_webpages/variant_property/variant_property_value_list.html | ||
|---|---|---|
| [% USE L %]
 | ||
| [% USE LxERP %]
 | ||
|  | ||
|  | ||
| <div class="wrapper">
 | ||
|  | ||
| <form id="variant_property_value_list_form">
 | ||
|   [% L.hidden_tag("id", SELF.variant_property.id) %]
 | ||
|   <table class="tbl-list width-moderate" id="variant_property_values">
 | ||
|     <caption>[% 'Value' | $T8 %]</caption>
 | ||
|     <caption>[% 'Values' | $T8 %]</caption>
 | ||
|     <thead>
 | ||
|       <tr>
 | ||
|         <th><img src="image/updown.png" alt="[% LxERP.t8('reorder item') %]"></th>
 | ||
| ... | ... | |
|       </tr>
 | ||
|     </thead>
 | ||
|     <tbody>
 | ||
|        [% FOREACH value = SELF.variant_property.property_values %]
 | ||
|         <tr id="variant_property_value_id_[% variant_property_value.id %]">
 | ||
|           <td class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
 | ||
|           <td><a href="#" onclick="kivi.VariantProperty.add_or_edit_variant_value('[% value.id %]');">[% value.value        | html %]</a></td>
 | ||
|           <td>[% value.abbreviation | html %]</td>
 | ||
|         </tr>
 | ||
|       [% FOREACH value = SELF.variant_property.property_values_sorted %]
 | ||
|       <tr id="variant_property_value_id_[% value.id %]">
 | ||
|         <td class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
 | ||
|         <td><a href="#" onclick="kivi.VariantProperty.edit_variant_property_value('[% value.id %]');">[% value.value | html %]</a></td>
 | ||
|         <td>[% value.abbreviation | html %]</td>
 | ||
|        </tr>
 | ||
|       [% END %]
 | ||
|     </tbody>
 | ||
|     <tfoot>
 | ||
|       <tr>
 | ||
|         <td>
 | ||
|           [% L.button_tag(
 | ||
|                 'kivi.VariantProperty.add_variant_property_value()',
 | ||
|                 LxERP.t8("Add counted")
 | ||
|           ) %]
 | ||
|         </td>
 | ||
|         <td>
 | ||
|           [% L.input_tag(
 | ||
|               "new_variant_property_value.value",
 | ||
|               '',
 | ||
|               class="wi-small",
 | ||
|           ) %]
 | ||
|         </td>
 | ||
|         <td>
 | ||
|           [% L.input_tag(
 | ||
|               "new_variant_property_value.abbreviation",
 | ||
|               '',
 | ||
|               class="wi-small",
 | ||
|           ) %]
 | ||
|         </td>
 | ||
|       </tr>
 | ||
|     </tfoot>
 | ||
|   </table>
 | ||
| </form>
 | ||
| </div>
 | ||
|  | ||
| [% L.sortable_element('#variant_property_values tbody', url =>
 | ||
| SELF.url_for(action='reorder_variant_property_values'), with => 'variant_property_value_id') %]
 | ||
|  | ||
Auch abrufbar als: Unified diff
Varianten: Bearbeiten von Varianten Eigenschaften und Ausprägungen