Revision 9eb765a5
Von Bernd Bleßmann vor fast 8 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
594 | 594 |
$_[0]->render(\ $longdescription, { type => 'text' }); |
595 | 595 |
} |
596 | 596 |
|
597 |
# load the second row for an item (cvars only for now)
|
|
597 |
# load the second row for one or more items (cvars only for now)
|
|
598 | 598 |
# |
599 |
# This action gets the html code for the items second row by rendering a template for
|
|
600 |
# the second row and calls a javascript function with this html code via client js.
|
|
601 |
sub action_load_second_row { |
|
599 |
# This action gets the html code for all items second rows by rendering a template for
|
|
600 |
# the second row and sets the html code via client js.
|
|
601 |
sub action_load_second_rows {
|
|
602 | 602 |
my ($self) = @_; |
603 | 603 |
|
604 |
my $idx = first_index { $_ eq $::form->{item_id} } @{ $::form->{orderitem_ids} }; |
|
605 |
my $item = $self->order->items_sorted->[$idx]; |
|
604 |
foreach my $item_id (@{ $::form->{item_ids} }) { |
|
605 |
my $idx = first_index { $_ eq $item_id } @{ $::form->{orderitem_ids} }; |
|
606 |
my $item = $self->order->items_sorted->[$idx]; |
|
607 |
|
|
608 |
$self->_js_load_second_row($item, $item_id, 0); |
|
609 |
} |
|
610 |
|
|
611 |
$self->js->render(); |
|
612 |
} |
|
606 | 613 |
|
607 |
# Parse values from form (they are formated while rendering (template)). |
|
608 |
# Workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values). |
|
609 |
# This parsing is not necessary at all, if we assure that the second row/cvars are only loaded once. |
|
610 |
#foreach my $var (@{ $item->cvars_by_config }) { |
|
611 |
# $var->unparsed_value($::form->parse_amount(\%::myconfig, $var->{__unparsed_value})) if ($var->config->type eq 'number' && exists($var->{__unparsed_value})); |
|
612 |
#} |
|
613 |
#$item->parse_custom_variable_values; |
|
614 |
sub _js_load_second_row { |
|
615 |
my ($self, $item, $item_id, $do_parse) = @_; |
|
616 |
|
|
617 |
if ($do_parse) { |
|
618 |
# Parse values from form (they are formated while rendering (template)). |
|
619 |
# Workaround to pre-parse number-cvars (parse_custom_variable_values does not parse number values). |
|
620 |
# This parsing is not necessary at all, if we assure that the second row/cvars are only loaded once. |
|
621 |
foreach my $var (@{ $item->cvars_by_config }) { |
|
622 |
$var->unparsed_value($::form->parse_amount(\%::myconfig, $var->{__unparsed_value})) if ($var->config->type eq 'number' && exists($var->{__unparsed_value})); |
|
623 |
} |
|
624 |
$item->parse_custom_variable_values; |
|
625 |
} |
|
614 | 626 |
|
615 | 627 |
my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item); |
616 | 628 |
|
617 | 629 |
$self->js |
618 |
->html('.row_entry:has(#item_' . $::form->{item_id} . ') [name = "second_row"]', $row_as_html) |
|
619 |
->data('.row_entry:has(#item_' . $::form->{item_id} . ') [name = "second_row"]', 'loaded', 1) |
|
620 |
->render(); |
|
630 |
->html('.row_entry:has(#item_' . $item_id . ') [name = "second_row"]', $row_as_html) |
|
631 |
->data('.row_entry:has(#item_' . $item_id . ') [name = "second_row"]', 'loaded', 1); |
|
621 | 632 |
} |
622 | 633 |
|
623 | 634 |
sub _js_redisplay_linetotals { |
js/kivi.Order.js | ||
---|---|---|
190 | 190 |
return; |
191 | 191 |
} |
192 | 192 |
var data = $('#order_form').serializeArray(); |
193 |
data.push({ name: 'action', value: 'Order/load_second_row' }); |
|
194 |
data.push({ name: 'item_id', value: item_id_dom.val() }); |
|
193 |
data.push({ name: 'action', value: 'Order/load_second_rows' });
|
|
194 |
data.push({ name: 'item_ids[]', value: item_id_dom.val() });
|
|
195 | 195 |
|
196 | 196 |
$.post("controller.pl", data, kivi.eval_json_result); |
197 | 197 |
}; |
198 | 198 |
|
199 |
ns.load_all_second_rows = function() { |
|
200 |
var rows = $('.row_entry').filter(function(idx, elt) { |
|
201 |
return $(elt).find('[name="second_row"]').data('loaded') != 1; |
|
202 |
}); |
|
203 |
|
|
204 |
var item_ids = $.map(rows, function(elt) { |
|
205 |
var item_id = $(elt).find('[name="orderitem_ids[+]"]').val(); |
|
206 |
return { name: 'item_ids[]', value: item_id }; |
|
207 |
}); |
|
208 |
|
|
209 |
if (item_ids.length == 0) { |
|
210 |
return; |
|
211 |
} |
|
212 |
|
|
213 |
var data = $('#order_form').serializeArray(); |
|
214 |
data.push({ name: 'action', value: 'Order/load_second_rows' }); |
|
215 |
data = data.concat(item_ids); |
|
216 |
|
|
217 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
218 |
}; |
|
219 |
|
|
220 |
ns.hide_second_row = function(row) { |
|
221 |
$(row).children().not(':first').hide(); |
|
222 |
$(row).data('expanded', false); |
|
223 |
var elt = $(row).find('.expand'); |
|
224 |
elt.attr('src', "image/expand3.gif"); |
|
225 |
elt.attr('alt', kivi.t8('Show details')); |
|
226 |
elt.attr('title', kivi.t8('Show details')); |
|
227 |
}; |
|
228 |
|
|
229 |
ns.show_second_row = function(row) { |
|
230 |
$(row).children().not(':first').show(); |
|
231 |
$(row).data('expanded', true); |
|
232 |
var elt = $(row).find('.expand'); |
|
233 |
elt.attr('src', "image/collapse3.gif"); |
|
234 |
elt.attr('alt', kivi.t8('Hide details')); |
|
235 |
elt.attr('title', kivi.t8('Hide details')); |
|
236 |
}; |
|
237 |
|
|
238 |
ns.toggle_second_row = function(row) { |
|
239 |
if ($(row).data('expanded') === true) { |
|
240 |
ns.hide_second_row(row); |
|
241 |
} else { |
|
242 |
ns.show_second_row(row); |
|
243 |
} |
|
244 |
}; |
|
199 | 245 |
|
200 | 246 |
ns.init_row_handlers = function() { |
201 | 247 |
kivi.run_once_for('.recalc', 'on_change_recalc', function(elt) { |
... | ... | |
218 | 264 |
event.preventDefault(); |
219 | 265 |
var row = $(event.target).parents(".row_entry").first(); |
220 | 266 |
ns.load_second_row(row); |
221 |
$(row).children().not(':first').show();
|
|
267 |
ns.show_second_row(row);
|
|
222 | 268 |
return false; |
223 | 269 |
} |
224 | 270 |
if(event.keyCode == 38 && event.shiftKey === true) { |
225 | 271 |
// shift arrow up |
226 | 272 |
event.preventDefault(); |
227 | 273 |
var row = $(event.target).parents(".row_entry").first(); |
228 |
$(row).children().not(':first').hide();
|
|
274 |
ns.hide_second_row(row);
|
|
229 | 275 |
return false; |
230 | 276 |
} |
231 | 277 |
}); |
... | ... | |
233 | 279 |
event.preventDefault(); |
234 | 280 |
var row = $(event.target).parents(".row_entry").first(); |
235 | 281 |
ns.load_second_row(row); |
236 |
$(row).children().not(':first').toggle();
|
|
282 |
ns.toggle_second_row(row);
|
|
237 | 283 |
return false; |
238 | 284 |
}); |
239 | 285 |
}); |
286 |
|
|
287 |
kivi.run_once_for('.expand', 'expand_second_row', function(elt) { |
|
288 |
$(elt).click(function(event) { |
|
289 |
event.preventDefault(); |
|
290 |
var row = $(event.target).parents(".row_entry").first(); |
|
291 |
ns.load_second_row(row); |
|
292 |
ns.toggle_second_row(row); |
|
293 |
return false; |
|
294 |
}) |
|
295 |
}); |
|
296 |
|
|
240 | 297 |
}; |
241 | 298 |
|
242 | 299 |
ns.redisplay_linetotals = function(data) { |
... | ... | |
486 | 543 |
$('#row_table_id thead a img').remove(); |
487 | 544 |
kivi.Order.renumber_positions(); |
488 | 545 |
}); |
546 |
|
|
547 |
$('#expand_all').on('click', function(event) { |
|
548 |
event.preventDefault(); |
|
549 |
if ($('#expand_all').data('expanded') === true) { |
|
550 |
$('#expand_all').data('expanded', false); |
|
551 |
$('#expand_all').attr('src', 'image/expand3.gif'); |
|
552 |
$('#expand_all').attr('alt', kivi.t8('Show all details')); |
|
553 |
$('#expand_all').attr('title', kivi.t8('Show all details')); |
|
554 |
$('.row_entry').each(function(idx, elt) { |
|
555 |
kivi.Order.hide_second_row(elt); |
|
556 |
}); |
|
557 |
} else { |
|
558 |
$('#expand_all').data('expanded', true); |
|
559 |
$('#expand_all').attr('src', "image/collapse3.gif"); |
|
560 |
$('#expand_all').attr('alt', kivi.t8('Hide all details')); |
|
561 |
$('#expand_all').attr('title', kivi.t8('Hide all details')); |
|
562 |
kivi.Order.load_all_second_rows(); |
|
563 |
$('.row_entry').each(function(idx, elt) { |
|
564 |
kivi.Order.show_second_row(elt); |
|
565 |
}); |
|
566 |
} |
|
567 |
return false; |
|
568 |
}); |
|
489 | 569 |
}); |
js/locale/de.js | ||
---|---|---|
47 | 47 |
"Edit text block":"Textblock bearbeiten", |
48 | 48 |
"Enter longdescription":"Langtext eingeben", |
49 | 49 |
"Function block actions":"Funktionsblockaktionen", |
50 |
"Hide all details":"", |
|
51 |
"Hide details":"Details verbergen", |
|
50 | 52 |
"History":"Historie", |
51 | 53 |
"If you switch to a different tab without saving you will lose the data you've entered in the current tab.":"Wenn Sie auf einen anderen Tab wechseln, ohne vorher zu speichern, so gehen die im aktuellen Tab eingegebenen Daten verloren.", |
52 | 54 |
"Map":"Karte", |
... | ... | |
72 | 74 |
"Save and keep open":"Speichern und geöffnet lassen", |
73 | 75 |
"Section/Function block actions":"Abschnitts-/Funktionsblockaktionen", |
74 | 76 |
"Select template to paste":"Einzufügende Vorlage auswählen", |
77 |
"Show all details":"", |
|
78 |
"Show details":"Details anzeigen", |
|
75 | 79 |
"Subject":"Betreff", |
76 | 80 |
"Text block actions":"Textblockaktionen", |
77 | 81 |
"Text block picture actions":"Aktionen für Textblockbilder", |
locale/de/all | ||
---|---|---|
1416 | 1416 |
'Here you only provide the credentials for logging into the database.' => 'Hier geben Sie nur die Logindaten für die Anmeldung an der Datenbank ein.', |
1417 | 1417 |
'Here\'s an example command line:' => 'Hier ist eine Kommandozeile, die als Beispiel dient:', |
1418 | 1418 |
'Hide Filter' => 'Filter verbergen', |
1419 |
'Hide all details' => 'Alle Details verbergen', |
|
1419 | 1420 |
'Hide by default' => 'Standardmäßig verstecken', |
1420 | 1421 |
'Hide chart details' => 'Konteninformation verstecken', |
1421 | 1422 |
'Hide details' => 'Details verbergen', |
... | ... | |
2593 | 2594 |
'Show TODO list' => 'Aufgabenliste anzeigen', |
2594 | 2595 |
'Show Transfer via default' => 'Ein- / Auslagern über Standardlagerplatz anzeigen (zusätzlicher Knopf in Beleg Lieferschein)', |
2595 | 2596 |
'Show administration link' => 'Link zur Administration anzeigen', |
2597 |
'Show all details' => 'Alle Details anzeigen', |
|
2596 | 2598 |
'Show all parts' => 'Alle Artikel anzeigen', |
2597 | 2599 |
'Show by default' => 'Standardmäßig anzeigen', |
2598 | 2600 |
'Show custom variable search inputs' => 'Suchoptionen für Benutzerdefinierte Variablen verstecken', |
locale/en/all | ||
---|---|---|
1415 | 1415 |
'Here you only provide the credentials for logging into the database.' => '', |
1416 | 1416 |
'Here\'s an example command line:' => '', |
1417 | 1417 |
'Hide Filter' => '', |
1418 |
'Hide all details' => '', |
|
1418 | 1419 |
'Hide by default' => '', |
1419 | 1420 |
'Hide chart details' => '', |
1420 | 1421 |
'Hide details' => '', |
... | ... | |
2584 | 2585 |
'Show TODO list' => '', |
2585 | 2586 |
'Show Transfer via default' => '', |
2586 | 2587 |
'Show administration link' => '', |
2588 |
'Show all details' => '', |
|
2587 | 2589 |
'Show all parts' => '', |
2588 | 2590 |
'Show by default' => '', |
2589 | 2591 |
'Show custom variable search inputs' => '', |
templates/webpages/order/tabs/_row.html | ||
---|---|---|
6 | 6 |
<tbody class="row_entry"> |
7 | 7 |
|
8 | 8 |
<tr class="listrow0"> |
9 |
<td style='display:none'> |
|
9 |
<td align="center"> |
|
10 |
[%- IF MYCONFIG.show_form_details %] |
|
11 |
[% L.img_tag(src="image/collapse3.gif", |
|
12 |
alt=LxERP.t8('Hide details'), title=LxERP.t8('Hide details'), class="expand") %] |
|
13 |
[%- ELSE %] |
|
14 |
[% L.img_tag(src="image/expand3.gif", |
|
15 |
alt=LxERP.t8('Show details'), title=LxERP.t8('Show details'), class="expand") %] |
|
16 |
[%- END %] |
|
10 | 17 |
[% L.hidden_tag("orderitem_ids[+]", ID) %] |
11 | 18 |
[% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %] |
12 | 19 |
[% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %] |
... | ... | |
100 | 107 |
|
101 | 108 |
</tr> |
102 | 109 |
|
103 |
<tr class="listrow1" style="display:none">
|
|
110 |
<tr class="listrow1" [%- IF !MYCONFIG.show_form_details -%]style="display:none"[%- END -%]>
|
|
104 | 111 |
<td colspan="100%"> |
105 |
<div name="second_row"> |
|
106 |
[%- LxERP.t8("Loading...") %] |
|
107 |
</div> |
|
112 |
[%- IF MYCONFIG.show_form_details %] |
|
113 |
<div name="second_row" data-loaded="1"> |
|
114 |
[%- PROCESS order/tabs/_second_row.html ITEM=ITEM %] |
|
115 |
</div> |
|
116 |
[%- ELSE %] |
|
117 |
<div name="second_row"> |
|
118 |
[%- LxERP.t8("Loading...") %] |
|
119 |
</div> |
|
120 |
[%- END %] |
|
108 | 121 |
</td> |
109 | 122 |
</tr> |
110 | 123 |
|
templates/webpages/order/tabs/basic_data.html | ||
---|---|---|
155 | 155 |
<table id="row_table_id" width="100%"> |
156 | 156 |
<thead> |
157 | 157 |
<tr class="listheading"> |
158 |
<th class="listheading" style='display:none'></th> |
|
158 |
<th class="listheading" style='text-align:center' nowrap width="1"> |
|
159 |
[%- IF MYCONFIG.show_form_details %] |
|
160 |
[%- L.img_tag(src="image/collapse3.gif", alt=LxERP.t8('Hide all details'), title=LxERP.t8('Hide all details'), id='expand_all') %] |
|
161 |
[%- ELSE %] |
|
162 |
[%- L.img_tag(src="image/expand3.gif", alt=LxERP.t8('Show all details'), title=LxERP.t8('Show all details'), id='expand_all') %] |
|
163 |
[%- END %] |
|
164 |
</th> |
|
159 | 165 |
<th class="listheading" nowrap width="3" >[%- 'position' | $T8 %] </th> |
160 | 166 |
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th> |
161 | 167 |
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th> |
Auch abrufbar als: Unified diff
Auftrags-Controller: zweite Zeile laden mit Icons und alle zweiten Zeilen laden.