Revision 69c941f8
Von Tamino Steinert vor 6 Tagen hinzugefügt
SL/Controller/ShopPart.pm | ||
---|---|---|
122 | 122 |
}elsif( $price_src_str eq 'lastcost'){ |
123 | 123 |
$price_src_str = t8('Lastcost'); |
124 | 124 |
} |
125 |
$self->js->html('#price_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$price,2)) |
|
126 |
->html('#active_price_source_' . $self->shop_part->id, $price_src_str) |
|
127 |
->render; |
|
125 |
|
|
126 |
my $data = { |
|
127 |
active_price_source => $price_src_str, |
|
128 |
price => $::form->format_amount(\%::myconfig,$price,2), |
|
129 |
}; |
|
130 |
|
|
131 |
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 }); |
|
128 | 132 |
} |
129 | 133 |
|
130 | 134 |
sub action_show_stock { |
... | ... | |
137 | 141 |
if($self->shop_part->last_update) { |
138 | 142 |
my $shop_article = $shop->connector->get_article($self->shop_part->part->partnumber); |
139 | 143 |
$stock_onlineshop = $shop_article->{data}->{mainDetail}->{inStock}; |
140 |
$active_online = $shop_article->{data}->{active};
|
|
144 |
$active_online = lc($shop_article->{data}->{active}) eq 'true';
|
|
141 | 145 |
} |
142 | 146 |
|
143 | 147 |
$stock_local = $self->shop_part->part->onhand; |
144 | 148 |
|
145 |
$self->js->html('#stock_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$stock_local,0)."/".$::form->format_amount(\%::myconfig,$stock_onlineshop,0)) |
|
146 |
->html('#toogle_' . $self->shop_part->id,$active_online) |
|
147 |
->render; |
|
149 |
my $data = { |
|
150 |
stock_local => $::form->format_amount(\%::myconfig,$stock_local,0), |
|
151 |
stock_shop => $::form->format_amount(\%::myconfig,$stock_onlineshop,0), |
|
152 |
active_online => !!$active_online, |
|
153 |
}; |
|
154 |
|
|
155 |
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 }); |
|
148 | 156 |
} |
149 | 157 |
|
150 | 158 |
sub action_get_n_write_categories { |
js/kivi.ShopPart.js | ||
---|---|---|
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
ns.update_price_n_price_source = function(shop_part_id,price_source) { |
98 |
$.post('controller.pl', { action: 'ShopPart/show_price_n_pricesource', shop_part_id: shop_part_id, pricesource: price_source }, function(data) { |
|
99 |
kivi.eval_json_result(data); |
|
98 |
data = [ |
|
99 |
{name: 'action', value: 'ShopPart/show_price_n_pricesource'}, |
|
100 |
{name: 'shop_part_id', value: shop_part_id}, |
|
101 |
{name: 'pricesource', value: price_source}, |
|
102 |
]; |
|
103 |
|
|
104 |
$.ajax({ |
|
105 |
url: 'controller.pl', |
|
106 |
data: data, |
|
107 |
method: 'POST', |
|
108 |
dataType: 'json', |
|
109 |
success: function(data){ |
|
110 |
$("#active_price_source_" + shop_part_id).html(data.active_price_source); |
|
111 |
$("#price_" + shop_part_id).html(data.price); |
|
112 |
} |
|
100 | 113 |
}); |
101 | 114 |
} |
102 | 115 |
|
103 | 116 |
ns.update_stock = function(shop_part_id) { |
104 |
$.post('controller.pl', { action: 'ShopPart/show_stock', shop_part_id: shop_part_id }, function(data) { |
|
105 |
kivi.eval_json_result(data); |
|
117 |
data = [ |
|
118 |
{name: 'action', value: 'ShopPart/show_stock'}, |
|
119 |
{name: 'shop_part_id', value: shop_part_id}, |
|
120 |
]; |
|
121 |
|
|
122 |
$.ajax({ |
|
123 |
url: 'controller.pl', |
|
124 |
data: data, |
|
125 |
method: 'POST', |
|
126 |
dataType: 'json', |
|
127 |
success: function(data){ |
|
128 |
$("#stock_" + shop_part_id).html(data.stock_local + ' / ' + data.stock_shop); |
|
129 |
// $("#toogle_" + shop_part_id).html(data.active_online + ''); |
|
130 |
} |
|
106 | 131 |
}); |
107 | 132 |
} |
108 | 133 |
|
Auch abrufbar als: Unified diff
FIX: S:C:ShopPart: Kein erneutes render beim Laden von Shopdaten