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