sub display_form {
my ($self, %params) = @_;
my $is_new = !$self->price_rule->id;
- my $title = $is_new ?
- ($self->price_rule->is_sales ? t8('Create a new sales price rule') : t8('Create a new purchase price rule')) :
- ($self->price_rule->is_sales ? t8('Edit sales price rule') : t8('Edit purchase price rule'));
+ my $title = $self->form_title(($is_new ? 'create' : 'edit'), $self->price_rule->type);
$self->render('price_rule/form',
title => $title,
%params
);
}
+sub form_title {
+ my ($self, $action, $type) = @_;
+
+ return {
+ edit => {
+ customer => t8('Edit sales price rule'),
+ vendor => t8('Edit purchase price rule'),
+ '' => t8('Edit price rule'),
+ },
+ create => {
+ customer => t8('Create a new sales price rule'),
+ vendor => t8('Create a new purchase price rule'),
+ '' => t8('Create a new price rule'),
+ },
+ list => {
+ customer => t8('Sales Price Rules'),
+ vendor => t8('Purchase Price Rules'),
+ '' => t8('Price Rules'),
+ },
+ }->{$action}{$type};
+}
+
sub create_or_update {
my $self = shift;
my $is_new = !$self->price_rule->id;
std_column_visibility => 1,
controller_class => 'PriceRule',
output_format => 'HTML',
- title => ($self->vc eq 'customer' ? t8('Sales Price Rules') : t8('Purchase Price Rules')) ,
+ title => $self->form_title('list', $self->vc),
allow_pdf_export => !$::form->{inline},
allow_csv_export => !$::form->{inline},
);
sub get_all_types {
my ($class, $vc) = @_;
- [ map { [ $_, $types{$_}{description} ] } grep { $types{$_}{$vc} } map { $_ } @types ];
+ $vc
+ ? [ map { [ $_, $types{$_}{description} ] } grep { $types{$_}{$vc} } map { $_ } @types ]
+ : [ map { [ $_, $types{$_}{description} ] } map { $_ } @types ]
}
sub get_type {
});
}
+ ns.on_change_filter_type = function() {
+ var val = $('#price_rule_filter_type').val();
+ if (val == 'vendor') {
+ $('#price_rule_filter_customer').data('customer_vendor_picker').set_item({});
+ $('#price_rule_filter_customer_tr').hide();
+ $('#price_rule_filter_vendor_tr').show();
+ }
+ if (val == 'customer') {
+ $('#price_rule_filter_vendor').data('customer_vendor_picker').set_item({});
+ $('#price_rule_filter_vendor_tr').hide();
+ $('#price_rule_filter_customer_tr').show();
+ }
+ if (val == '') {
+ $('#price_rule_filter_customer_tr').show();
+ $('#price_rule_filter_vendor_tr').show();
+ }
+ }
+
$(function() {
$('#price_rule_item_add').click(function() {
ns.add_new_row($('#price_rules_empty_item_select').val());
$(this).closest('div').remove();
})
$('#price_rule_price_type_help').click(ns.open_price_type_help_popup);
+ $('#price_rule_filter_type').change(ns.on_change_filter_type);
});
});
'Create a new group' => 'Neue Benutzergruppe erfassen',
'Create a new payment term' => 'Neue Zahlungsbedingungen anlegen',
'Create a new predefined text' => 'Einen neuen vordefinierten Textblock anlegen',
+ 'Create a new price rule' => 'Neue Preisregel anlegen',
'Create a new printer' => 'Einen neuen Drucker anlegen',
'Create a new project' => 'Neues Projekt anlegen',
'Create a new project and link to it.' => 'Neues Projekt anlegen und damit verknüpfen.',
'Edit payment term' => 'Zahlungsbedingungen bearbeiten',
'Edit picture' => 'Bild bearbeiten',
'Edit predefined text' => 'Vordefinierten Textblock bearbeiten',
+ 'Edit price rule' => 'Preisregel bearbeiten',
'Edit prices and discount (if not used, textfield is ONLY set readonly)' => 'Preise und Rabatt in Formularen frei anpassen (falls deaktiviert, wird allerdings NUR das textfield auf READONLY gesetzt / kann je nach Browserversion und technischen Fähigkeiten des Anwenders noch umgangen werden)',
'Edit project' => 'Projekt bearbeiten',
'Edit project #1' => 'Projekt #1 bearbeiten',
'Net amount (for verification)' => 'Nettobetrag (zur Überprüfung)',
'Netto Terms' => 'Zahlungsziel netto',
'New Password' => 'Neues Passwort',
- 'New Price Rule' => 'Neue Preisregel',
+ 'New Purchase Price Rule' => 'Neue Einkaufspreisregel',
+ 'New Sales Price Rule' => 'Neue Verkaufspreisregel',
'New assembly' => 'Neues Erzeugnis',
'New bank account' => 'Neues Bankkonto',
'New client #1: The database configuration fields "host", "port", "name" and "user" must not be empty.' => 'Neuer Mandant #1: Die Datenbankkonfigurationsfelder "Host", "Port" und "Name" dürfen nicht leer sein.',
module=ic.pl
action=search_update_prices
-[Master Data--Sales Price Rules ]
+[Master Data--Price Rules]
ACCESS=part_service_assembly_edit
module=controller.pl
action=PriceRule/list
-filter.type=customer
-filter.obsolete=0
-
-[Master Data--Purchase Price Rules ]
-ACCESS=part_service_assembly_edit
-module=controller.pl
-action=PriceRule/list
-filter.type=vendor
filter.obsolete=0
[Master Data--Reports]
<th align="right">[% 'Description' | $T8 %]</th>
<td>[% L.input_tag('filter.name:substr::ilike', filter.name_substr__ilike, size = 20, style='width: 300px') %]</td>
</tr>
+ <tr>
+ <th align="right">[% 'Type' | $T8 %]</th>
+ <td>[% L.select_tag('filter.type', [ [ 'customer', LxERP.t8('Sales Price Rules '), ] [ 'vendor', LxERP.t8('Purchase Price Rules ') ] ], with_empty=1, default=filter.type, id='price_rule_filter_type', style='width: 300px') %]</td>
+ </tr>
<tr>
<th align="right">[% 'Part' | $T8 %]</th>
<td>[% L.part_picker('filter.item_type_matches[].part', FORM.filter.item_type_matches.0.part, style='width: 300px') %]</td>
</tr>
-[%- IF SELF.vc == 'customer' %]
- <tr>
+ <tr id='price_rule_filter_customer_tr' [% "style='display:hidden' " UNLESS SELF.vc == 'customer' %]>
<th align="right">[% 'Customer' | $T8 %]</th>
- <td>[% L.customer_vendor_picker('filter.item_type_matches[].customer', FORM.filter.item_type_matches.0.customer, type='customer', style='width: 300px') %]</td>
+ <td>[% L.customer_vendor_picker('filter.item_type_matches[].customer', FORM.filter.item_type_matches.0.customer, type='customer', id='price_rule_filter_customer', style='width: 300px') %]</td>
</tr>
-[%- END %]
-[%- IF SELF.vc == 'vendor' %]
- <tr>
+ <tr id='price_rule_filter_vendor_tr' [% "style='display:hidden' " UNLESS SELF.vc == 'customer' %]>
<th align="right">[% 'Vendor' | $T8 %]</th>
- <td>[% L.customer_vendor_picker('filter.item_type_matches[].vendor', FORM.filter.item_type_matches.0.vendor, type='vendor', style='width: 300px') %]</td>
+ <td>[% L.customer_vendor_picker('filter.item_type_matches[].vendor', FORM.filter.item_type_matches.0.vendor, type='vendor', id='price_rule_filter_vendor', style='width: 300px') %]</td>
</tr>
-[%- END %]
<tr>
<th align="right">[% 'Business' | $T8 %]</th>
<td>[% L.select_tag('filter.item_type_matches[].business', SELF.businesses, title_key='description', default=FORM.filter.item_type_matches.0.business, with_empty=1, style='width: 300px') %]</td>
</table>
[% L.hidden_tag('action', 'PriceRule/dispatch') %]
-[% L.hidden_tag('filter.type', FORM.filter.type) %]
[% L.hidden_tag('sort_by', FORM.sort_by) %]
[% L.hidden_tag('sort_dir', FORM.sort_dir) %]
[% L.hidden_tag('page', FORM.page) %]
-[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit')%]
+[% L.input_tag('action_list', LxERP.t8('Continue'), type = 'submit', class='submit') %]
-<a onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);$("#filter_table select").val("")'>[% 'Reset' | $T8 %]</a>
+<a class='interact cursor-pointer' onClick='javascript:$("#filter_table input").val("");$("#filter_table input[type=checkbox]").prop("checked", 0);$("#filter_table select").val("")'>[% 'Reset' | $T8 %]</a>
</div>
[%- L.paginate_controls(models=SELF.models) %]
[%- UNLESS FORM.inline %]
-<a href="[% SELF.url_for(action='new', 'price_rule.type'=SELF.vc, callback=SELF.models.get_callback) | html %]">[% 'New Price Rule' | $T8 %]</a>
+<a href="[% SELF.url_for(action='new', 'price_rule.type'='customer', callback=SELF.models.get_callback) | html %]">[% 'New Sales Price Rule' | $T8 %]</a>
+<a href="[% SELF.url_for(action='new', 'price_rule.type'='vendor', callback=SELF.models.get_callback) | html %]">[% 'New Purchase Price Rule' | $T8 %]</a>
[%- END %]