update addorder option for set

This commit is contained in:
Aung Myo
2018-03-15 14:35:25 +06:30
parent e2ad592007
commit f0e81caad0
5 changed files with 56 additions and 57 deletions

View File

@@ -180,7 +180,7 @@ $(function() {
image_path = "image/logo.png";
}
}
console.log(menu_items[field].options)
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
@@ -202,7 +202,7 @@ $(function() {
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
+ JSON.stringify(item_attributes) +"' data-options = '"
+ options +"' data-image='"+image_path+"' data-toggle='"
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
+JSON.stringify(menu_items[field].instances)+"'>"
@@ -237,10 +237,10 @@ $(function() {
//instances = $(this).data('instance');
item_sets = $(this).data('item-sets');
instances = $(this).data('instances');
// item_sets = $(data).attr('data-item-sets');
item_options = $(this).data('options');
for(var field in item_sets) {
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
value = item_sets[field]["instances"];
@@ -283,10 +283,20 @@ $(function() {
});
}
for(var j in item_options) {
value = item_options[j]["values"];
type = item_options[j]["type"];
row = "<h4>"+type+"</h4>"
$(value).each(function(i){
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
});
$(".options-list").append(row);
}
$('.set-item').attr('data-code',instances[0]['code']);
$('.set-item').attr('data-name',instances[0]['name']);
$('.set-item').attr('data-price',instances[0]['price']);
$('.set-item').attr('data-options','[]');
// $('.set-item').attr('data-options','[]');
$('.set-item').attr('data-parent',true);
$('#set_change_qty').val(1);
@@ -371,32 +381,28 @@ $(function() {
customer_display_view(item,"set_add");
attribute_arr = []
option_arr = []
var rowCount = $('.summary-items tbody tr').length+1;
option_arr = []
code = $('.set-item').attr('data-code');
name = $('.set-item').attr('data-name');
price = $('.set-item').attr('data-price');
option = $('.set-item').attr('data-options');
parent = $('.set-item').attr('data-parent');
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+ "' data-parent ='"+parent+ "'>"
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'-' + option +'</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);
var rowCount = $('.summary-items tbody tr').length+1;
$(items).each(function(i){
code = $(items[i]).attr('data-code');
@@ -406,15 +412,14 @@ $(function() {
sub_item = $(items[i]).attr('data-sub-item');
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+ "' data-sub-item ='"+sub_item+ "'>"
+option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'-' + option +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)
@@ -626,8 +631,6 @@ $(function() {
if(group == "set_menu"){
code = $(this).data('code');
value = $(this).data('value');
instance = $(".selected-instance");
$(instance).each(function(i){
@@ -638,6 +641,12 @@ $(function() {
}
});
}
if(group == "set_menu_default"){
option_arr = get_selected_attributes('selected-option');
$('.set-item').attr('data-options',JSON.stringify(option_arr));
$('.set_default_option').text(option_arr);
}
}); //End selecct attribute buttom