Revision a00ec2d1
Von Bernd Bleßmann vor 3 Monaten hinzugefügt
SL/Controller/StockCounting.pm | ||
---|---|---|
47 | 47 |
push @errors, t8 ('Part not found') if scalar(@$parts) == 0; |
48 | 48 |
push @errors, t8 ('Part is ambiguous') if scalar(@$parts) > 1; |
49 | 49 |
|
50 |
$self->stock_counting_item->part($parts->[0]) if !@errors; |
|
50 |
return $self->render('stock_counting/count', errors => \@errors) if @errors; |
|
51 |
|
|
52 |
$self->stock_counting_item->part($parts->[0]); |
|
51 | 53 |
|
52 | 54 |
my @validation_errors = $self->stock_counting_item->validate; |
53 | 55 |
push @errors, @validation_errors if @validation_errors; |
54 | 56 |
|
55 |
$::form->error(join "\n", @errors) if @errors;
|
|
57 |
return $self->render('stock_counting/count', errors => \@errors) if @errors;
|
|
56 | 58 |
|
57 | 59 |
$self->stock_counting_item->qty(1); |
58 | 60 |
$self->stock_counting_item->save; |
59 | 61 |
|
60 |
$self->render('stock_counting/count',); |
|
62 |
$self->render('stock_counting/count', successfully_counted => 1);
|
|
61 | 63 |
} |
62 | 64 |
|
63 | 65 |
sub init_is_developer { |
js/kivi.StockCounting.js | ||
---|---|---|
1 | 1 |
namespace('kivi.StockCounting', function(ns) { |
2 | 2 |
|
3 |
ns.count_window_onload = () => { |
|
4 |
if ($('#successfully_counted').val() === '1') { |
|
5 |
$('#successfully_counted_modal').modal('open'); |
|
6 |
} |
|
7 |
if ($('#errors').val() !== '0') { |
|
8 |
$('#error_modal').modal('open'); |
|
9 |
} |
|
10 |
}; |
|
11 |
|
|
3 | 12 |
}); |
templates/mobile_webpages/stock_counting/count.html | ||
---|---|---|
32 | 32 |
</div> |
33 | 33 |
</div> |
34 | 34 |
</div> |
35 |
|
|
36 |
[% P.hidden_tag("successfully_counted", successfully_counted) %] |
|
37 |
<div id="successfully_counted_modal" class="modal"> |
|
38 |
<div class="modal-content"> |
|
39 |
<h4>[% 'Part successfully counted' | $T8 %]</h4> |
|
40 |
</div> |
|
41 |
<div class="modal-footer"> |
|
42 |
[% P.M.button_tag("", LxERP.t8("Ok"), class="modal-close") %] |
|
43 |
</div> |
|
44 |
</div> |
|
45 |
|
|
46 |
[% P.hidden_tag("errors", errors.size() || '0') %] |
|
47 |
<div id="error_modal" class="modal"> |
|
48 |
<div class="modal-content"> |
|
49 |
<h4>[% 'Error' | $T8 %]</h4> |
|
50 |
[% FOREACH e = errors %] |
|
51 |
<p>[% e %]<p> |
|
52 |
[% END %] |
|
53 |
</div> |
|
54 |
<div class="modal-footer"> |
|
55 |
[% P.M.button_tag("", LxERP.t8("Ok"), class="modal-close") %] |
|
56 |
</div> |
|
57 |
</div> |
|
58 |
|
|
59 |
<script> |
|
60 |
// using $(document).ready didn't work here |
|
61 |
window.onload = () => { |
|
62 |
kivi.StockCounting.count_window_onload(); |
|
63 |
}; |
|
64 |
</script> |
Auch abrufbar als: Unified diff
Zwischeninventur: Modale Dialoge für Feedback