update addorder
This commit is contained in:
@@ -110,6 +110,9 @@ $(function(){
|
||||
item_sets = $(this).data('item-sets');
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
|
||||
value = item_sets[field]["instances"];
|
||||
$(value).each(function(i){
|
||||
console.log(value);
|
||||
@@ -161,12 +164,15 @@ $(function(){
|
||||
|
||||
$(".options-list").empty();
|
||||
|
||||
rowCount = $('.selected-instance');
|
||||
item_options = $(this).data('option');
|
||||
|
||||
min_qty = $(this).data('min-qty');
|
||||
max_qty = $(this).data('max-qty');
|
||||
|
||||
code = $(this).data('code');
|
||||
|
||||
if ($('.selected-instance').length+1 <= max_qty) {
|
||||
if (rowCount.length+1 <= max_qty) {
|
||||
for(var field in item_options) {
|
||||
value = item_options[field]["values"];
|
||||
type = item_options[field]["type"];
|
||||
@@ -192,7 +198,7 @@ $(function(){
|
||||
$(this).removeAttr('data-options');
|
||||
$('#instance_option').text('')
|
||||
}else {
|
||||
if ($('.selected-instance').length+1 <= max_qty) {
|
||||
if (rowCount.length+1 <= max_qty) {
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
@@ -214,36 +220,49 @@ $(function(){
|
||||
qty = parseInt($('#set_count').val());
|
||||
item_code = $('#set_item_code').text();
|
||||
item_name = $('#set_name').text();
|
||||
min_qty = $(this).data('min-qty');
|
||||
|
||||
var items = $('.selected-instance');
|
||||
|
||||
attribute_arr = []
|
||||
option_arr = []
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
$(items).each(function(i){
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
option = $(items[i]).attr('data-options');
|
||||
total = qty * price ;
|
||||
option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option_arr+"' data-row ='"+rowCount+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
rowCount = rowCount + 1;
|
||||
});
|
||||
calculate_sub_total();
|
||||
if (items.length >= min_qty) {
|
||||
attribute_arr = []
|
||||
option_arr = []
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
$(items).each(function(i){
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
option = $(items[i]).attr('data-options');
|
||||
total = qty * price ;
|
||||
option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option_arr+"' data-row ='"+rowCount+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
rowCount = rowCount + 1;
|
||||
});
|
||||
calculate_sub_total();
|
||||
$(".sx_item_set_detailModal").css({ 'display': "none" });
|
||||
}else{
|
||||
$(".sx_item_set_detailModal").css({ 'display': "block" });
|
||||
$.alert({
|
||||
title: 'Alert!',
|
||||
content: 'Please Select Minimum ' + min_qty + " items",
|
||||
type: 'red',
|
||||
typeAnimated: true,
|
||||
btnClass: 'btn-danger',
|
||||
});
|
||||
}
|
||||
|
||||
}); //End add order Click
|
||||
|
||||
|
||||
Reference in New Issue
Block a user