Revision 05324151
Von Tamino Steinert vor 5 Monaten hinzugefügt
SL/Controller/ShopPart.pm | ||
---|---|---|
}elsif( $price_src_str eq 'lastcost'){
|
||
$price_src_str = t8('Lastcost');
|
||
}
|
||
$self->js->html('#price_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$price,2))
|
||
->html('#active_price_source_' . $self->shop_part->id, $price_src_str)
|
||
->render;
|
||
|
||
my $data = {
|
||
active_price_source => $price_src_str,
|
||
price => $::form->format_amount(\%::myconfig,$price,2),
|
||
};
|
||
|
||
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 });
|
||
}
|
||
|
||
sub action_show_stock {
|
||
... | ... | |
if($self->shop_part->last_update) {
|
||
my $shop_article = $shop->connector->get_article($self->shop_part->part->partnumber);
|
||
$stock_onlineshop = $shop_article->{data}->{mainDetail}->{inStock};
|
||
$active_online = $shop_article->{data}->{active};
|
||
$active_online = lc($shop_article->{data}->{active}) eq 'true';
|
||
}
|
||
|
||
$stock_local = $self->shop_part->part->onhand;
|
||
|
||
$self->js->html('#stock_' . $self->shop_part->id, $::form->format_amount(\%::myconfig,$stock_local,0)."/".$::form->format_amount(\%::myconfig,$stock_onlineshop,0))
|
||
->html('#toogle_' . $self->shop_part->id,$active_online)
|
||
->render;
|
||
my $data = {
|
||
stock_local => $::form->format_amount(\%::myconfig,$stock_local,0),
|
||
stock_shop => $::form->format_amount(\%::myconfig,$stock_onlineshop,0),
|
||
active_online => !!$active_online,
|
||
};
|
||
|
||
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 });
|
||
}
|
||
|
||
sub action_get_n_write_categories {
|
js/kivi.ShopPart.js | ||
---|---|---|
}
|
||
|
||
ns.update_price_n_price_source = function(shop_part_id,price_source) {
|
||
$.post('controller.pl', { action: 'ShopPart/show_price_n_pricesource', shop_part_id: shop_part_id, pricesource: price_source }, function(data) {
|
||
kivi.eval_json_result(data);
|
||
data = [
|
||
{name: 'action', value: 'ShopPart/show_price_n_pricesource'},
|
||
{name: 'shop_part_id', value: shop_part_id},
|
||
{name: 'pricesource', value: price_source},
|
||
];
|
||
|
||
$.ajax({
|
||
url: 'controller.pl',
|
||
data: data,
|
||
method: 'POST',
|
||
dataType: 'json',
|
||
success: function(data){
|
||
$("#active_price_source_" + shop_part_id).html(data.active_price_source);
|
||
$("#price_" + shop_part_id).html(data.price);
|
||
}
|
||
});
|
||
}
|
||
|
||
ns.update_stock = function(shop_part_id) {
|
||
$.post('controller.pl', { action: 'ShopPart/show_stock', shop_part_id: shop_part_id }, function(data) {
|
||
kivi.eval_json_result(data);
|
||
data = [
|
||
{name: 'action', value: 'ShopPart/show_stock'},
|
||
{name: 'shop_part_id', value: shop_part_id},
|
||
];
|
||
|
||
$.ajax({
|
||
url: 'controller.pl',
|
||
data: data,
|
||
method: 'POST',
|
||
dataType: 'json',
|
||
success: function(data){
|
||
$("#stock_" + shop_part_id).html(data.stock_local + ' / ' + data.stock_shop);
|
||
// $("#toogle_" + shop_part_id).html(data.active_online + '');
|
||
}
|
||
});
|
||
}
|
||
|
Auch abrufbar als: Unified diff
FIX: S:C:ShopPart: Kein erneutes render beim Laden von Shopdaten