update addorder

This commit is contained in:
Aung Myo
2017-09-27 13:07:33 +06:30
parent 12458b71be
commit eaa591a17b

View File

@@ -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,9 +220,11 @@ $(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');
if (items.length >= min_qty) {
attribute_arr = [] attribute_arr = []
option_arr = [] option_arr = []
var rowCount = $('.summary-items tbody tr').length+1; var rowCount = $('.summary-items tbody tr').length+1;
@@ -244,6 +252,17 @@ $(function(){
rowCount = rowCount + 1; 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