Residu server
This commit is contained in:
parent
54dcf852c2
commit
ef01e6515d
@ -951,7 +951,7 @@ class AdminAntLogistic extends AdminTab {
|
||||
<th>'.$this->l('Produit').'</th>
|
||||
<th></th>
|
||||
<th class="text-center">'.$this->l('Référence').'</th>
|
||||
<th class="text-center">'.$this->l('Quantités').'</th>
|
||||
<th class="text-center" width="100">'.$this->l('Quantités').'</th>
|
||||
<th class="text-center" width="80px">'.$this->l('Quantité à envoyée').'</th>
|
||||
<th class="text-center">'.$this->l('Att').'</th>
|
||||
<th class="text-center" width="110px">'.$this->l('Quantité envoyée').'</th>
|
||||
|
@ -516,7 +516,7 @@ if(($id_order = (int) Tools::getValue('id_order'))
|
||||
if ($products[$key]['id_shipping'] != 2
|
||||
|| ($products[$key]['id_shipping'] == 2 && ($profile == 1 || $profile == 7))
|
||||
) {
|
||||
$html_products.='<input data-item="'.$item['id_product'].'" class="input_quantity" readonly="true" onchange="checkQuantityPack($(this),'.$item['id_product'].','.$p['id_order_detail'].','.$item['pack_quantity'].','.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).');" type="text" value="0" autocomplete="off" /><span class="qtyblock"><a onclick="qtyUp($(this), '.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).'); return false;">+</a><a class="qty_down" onclick="qtyDown($(this)); return false;">-</a></span>';
|
||||
$html_products.='<input data-item="'.$item['id_product'].'" data-id_order_detail="'.$p['id_order_detail'].'" class="input_quantity" readonly="true" onchange="checkQuantityPack('.$p['id_order_detail'].');" type="text" value="0" autocomplete="off" /><span class="qtyblock"><a onclick="qtyUp($(this), '.(in_array($products[$key]['product_id'], $locked_products)? 0: max(($products[$key]['product_quantity']*$item['pack_quantity'] - ($products[$key]['product_quantity_refunded']*$item['pack_quantity'] > 0? $products[$key]['product_quantity_refunded']*$item['pack_quantity']: $products[$key]['product_quantity_return']*$item['pack_quantity']) - $products[$key]['product_quantity_sent']*$item['pack_quantity']), 0)).'); return false;">+</a><a class="qty_down" onclick="qtyDown($(this)); return false;">-</a></span>';
|
||||
}
|
||||
$html_products.='
|
||||
</td>
|
||||
|
@ -126,28 +126,30 @@ function qtyDown(el) {
|
||||
}
|
||||
|
||||
input.val(Math.max(parseInt(input.val()) - 1, 0));
|
||||
if(parseInt(input.val()) > 0) {
|
||||
$(input).trigger("change");
|
||||
if(input.parent().parent().hasClass('pack_item')){
|
||||
packQtyDown(input.attr('data-id_order_detail'));
|
||||
} else {
|
||||
if(parseInt(input.val()) > 0) {
|
||||
$(input).trigger("change");
|
||||
}
|
||||
}
|
||||
|
||||
changeCarrier();
|
||||
}
|
||||
|
||||
function checkQuantityPack(el, id_item, id_order_detail, quantity, max){
|
||||
function checkQuantityPack(id_order_detail){
|
||||
var add_quantity = true;
|
||||
var quantity_ok = {};
|
||||
var pack_quantity = parseInt($('input[name="shipped['+id_order_detail+']"]').val());
|
||||
|
||||
$('.pack_'+id_order_detail+' input.input_quantity').each(function(){
|
||||
id_item = $(this).data('item');
|
||||
quantity = $(this).val();
|
||||
item_pack_quantity = $('input[name="shipped['+id_order_detail+']"]').parent().parent().attr('data-pack_'+id_item);
|
||||
|
||||
result = quantity / (item_pack_quantity*(pack_quantity+1));
|
||||
if(parseFloat(result)!=1){
|
||||
quantity_ok[id_item] = false;
|
||||
if(parseFloat(result)>=1){
|
||||
quantity_ok[id_item] = parseInt(quantity / item_pack_quantity);
|
||||
} else {
|
||||
quantity_ok[id_item] = true;
|
||||
quantity_ok[id_item] = false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -165,6 +167,37 @@ function checkQuantityPack(el, id_item, id_order_detail, quantity, max){
|
||||
}
|
||||
}
|
||||
|
||||
function packQtyDown(id_order_detail){
|
||||
var add_quantity = true;
|
||||
var quantity_ok = {};
|
||||
var pack_quantity = parseInt($('input[name="shipped['+id_order_detail+']"]').val());
|
||||
$('.pack_'+id_order_detail+' input.input_quantity').each(function(){
|
||||
id_item = $(this).data('item');
|
||||
quantity = $(this).val();
|
||||
item_pack_quantity = $('input[name="shipped['+id_order_detail+']"]').parent().parent().attr('data-pack_'+id_item);
|
||||
result = quantity / ((item_pack_quantity-1)*(pack_quantity));
|
||||
if(parseFloat(result)>=1){
|
||||
quantity_ok[id_item] = parseInt(quantity / item_pack_quantity);
|
||||
} else {
|
||||
quantity_ok[id_item] = 0;
|
||||
}
|
||||
});
|
||||
|
||||
var val_to_put = 0;
|
||||
var i = 0;
|
||||
$.each(quantity_ok, function( key, value ) {
|
||||
if(i == 0){
|
||||
val_to_put = value;
|
||||
}
|
||||
if(value != false){
|
||||
val_to_put = Math.min(val_to_put,value);
|
||||
}
|
||||
i++;
|
||||
});
|
||||
$('input[name="shipped['+id_order_detail+']"]').val(val_to_put);
|
||||
$('input[name="shipped['+id_order_detail+']"]').trigger("change");
|
||||
}
|
||||
|
||||
function confirm(message, callback) {
|
||||
$('#confirm .message').html(message);
|
||||
$('#confirm').modal('toggle');
|
||||
|
Loading…
Reference in New Issue
Block a user