Revision 7f9c007f
Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt
SL/Controller/ShopPart.pm | ||
---|---|---|
28 | 28 |
|
29 | 29 |
|
30 | 30 |
# old: |
31 |
sub action_edit { |
|
32 |
my ($self) = @_; |
|
33 |
|
|
34 |
$self->render('shop_part/edit'); #, { output => 0 }); #, price_source => $price_source) |
|
35 |
} |
|
36 |
|
|
31 |
# sub action_edit {
|
|
32 |
# my ($self) = @_;
|
|
33 |
# |
|
34 |
# $self->render('shop_part/edit'); #, { output => 0 }); #, price_source => $price_source)
|
|
35 |
# }
|
|
36 |
# |
|
37 | 37 |
# used when saving existing ShopPart |
38 |
|
|
38 | 39 |
sub action_update { |
39 | 40 |
my ($self) = @_; |
40 |
|
|
41 |
|
|
41 | 42 |
$self->create_or_update; |
42 | 43 |
} |
43 | 44 |
|
... | ... | |
83 | 84 |
# internal stuff |
84 | 85 |
# |
85 | 86 |
sub add_javascripts { |
87 |
# is this needed? |
|
86 | 88 |
$::request->{layout}->add_javascripts(qw(kivi.shop_part.js)); |
87 | 89 |
} |
88 | 90 |
|
... | ... | |
92 | 94 |
} |
93 | 95 |
|
94 | 96 |
sub init_shop_part { |
95 |
if ($::form->{shop_part_id}) {
|
|
96 |
SL::DB::ShopPart->new(id => $::form->{shop_part_id})->load;
|
|
97 |
if ($::form->{shop_part_id}) { |
|
98 |
SL::DB::Manager::ShopPart->find_by(id => $::form->{shop_part_id});
|
|
97 | 99 |
} else { |
98 | 100 |
SL::DB::ShopPart->new(shop_id => $::form->{shop_id}, part_id => $::form->{part_id}); |
99 | 101 |
}; |
js/kivi.shop_part.js | ||
---|---|---|
32 | 32 |
// save existing shop_part_id with new params from form, calls create_or_update and saves to db |
33 | 33 |
ns.save_shop_part = function(shop_part_id) { |
34 | 34 |
var form = $('form').serializeArray(); |
35 |
// alert(form); |
|
36 | 35 |
form.push( { name: 'action', value: 'ShopPart/update' } |
37 | 36 |
, { name: 'shop_part_id', value: shop_part_id } |
38 | 37 |
); |
... | ... | |
55 | 54 |
|
56 | 55 |
// this is called from tabs/_shop.html, opens edit_window (render) |
57 | 56 |
ns.edit_shop_part = function(shop_part_id) { |
58 |
// alert(shop_part_id); |
|
59 |
var form = $('form').serializeArray(); |
|
60 |
form.push( { name: 'action', value: 'ShopPart/create_or_edit_popup' } |
|
61 |
, { name: 'shop_part_id', value: shop_part_id } |
|
62 |
); |
|
63 |
|
|
64 |
$.post('controller.pl', form, function(data) { |
|
57 |
$.post('controller.pl', { action: 'ShopPart/create_or_edit_popup', shop_part_id: shop_part_id }, function(data) { |
|
65 | 58 |
kivi.eval_json_result(data); |
66 | 59 |
}); |
67 | 60 |
} |
68 | 61 |
|
69 | 62 |
// does the same as edit_shop_part (existing), but with part_id and shop_id, opens edit window (render) |
70 | 63 |
ns.create_shop_part = function(part_id, shop_id) { |
71 |
var form = $('form').serializeArray(); |
|
72 |
form.push( { name: 'action', value: 'ShopPart/create_or_edit_popup' } |
|
73 |
, { name: 'part_id', value: part_id } |
|
74 |
, { name: 'shop_id', value: shop_id } |
|
75 |
); |
|
76 |
|
|
77 |
$.post('controller.pl', form, function(data) { |
|
64 |
$.post('controller.pl', { action: 'ShopPart/create_or_edit_popup', part_id: part_id, shop_id: shop_id }, function(data) { |
|
78 | 65 |
kivi.eval_json_result(data); |
79 | 66 |
}); |
80 | 67 |
} |
81 | 68 |
|
82 |
// ns.update_partnumber = function() { |
|
83 |
// $('#partnumber').val('barfoo'); |
|
84 |
// $('#update_button').click(); |
|
85 |
// // $dialog.dialog("close"); |
|
86 |
// } |
|
87 |
|
|
88 | 69 |
ns.update_discount_source = function(row, source, discount_str) { |
89 | 70 |
$('#active_discount_source_' + row).val(source); |
90 | 71 |
if (discount_str) $('#discount_' + row).val(discount_str); |
Auch abrufbar als: Unified diff
ShopPart - Leichte Überarbeitung von js