update add order
This commit is contained in:
@@ -181,7 +181,7 @@ $(function(){
|
|||||||
code = instances[i].code;
|
code = instances[i].code;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
row = '<div class="card">'
|
row = '<div class="card">'
|
||||||
+'<div class="card-head" style="line-height:14px;">'
|
+'<div class="card-head" style="line-height:14px;">'
|
||||||
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
+'<small class="col-md-9">'+ menu_items[field].name +'</small>'
|
||||||
@@ -212,29 +212,28 @@ $(function(){
|
|||||||
|
|
||||||
//click item row for add order
|
//click item row for add order
|
||||||
$(document).on('click', '.menu_item_box', function(event){
|
$(document).on('click', '.menu_item_box', function(event){
|
||||||
|
$('.option-list').empty();
|
||||||
data = $(this).parent().children().children('.add_icon');
|
data = $(this).parent().children().children('.add_icon');
|
||||||
attributes = $(this).data('id');
|
attributes = $(this).data('id');
|
||||||
selected_item = $(this).data('item');
|
selected_item = $(this).data('item');
|
||||||
|
console.log(attributes);
|
||||||
for(var field in attributes) {
|
for(var field in attributes) {
|
||||||
value = attributes[field]["value"];
|
value = attributes[field]["value"];
|
||||||
|
type = attributes[field]["type"]
|
||||||
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
||||||
|
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
$(selected_item).each(function(item){
|
status ="";
|
||||||
if (value[i] == selected_item[item]) {
|
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
|
||||||
$('.custom-btn').addClass('selected-option');
|
status = "selected-option";
|
||||||
}else{
|
}
|
||||||
$('.custom-btn').removeClass('selected-option');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
console.log(jQuery.inArray(value[i], selected_item));
|
|
||||||
|
|
||||||
row +='<button id="selected-option" data-type="'+attributes[field]["type"]+'" class="btn btn-default custom-btn">'+value[i]+'</button>';
|
row +='<button id="selected-option" data-type="'+type+'" class="btn btn-default custom-btn '+ status +' '+ type +'">'+value[i]+'</button>';
|
||||||
});
|
|
||||||
|
});
|
||||||
|
$(".option-list").append(row);
|
||||||
|
|
||||||
$(".option-list").append(row);
|
|
||||||
}
|
}
|
||||||
$('#change_qty').val(1);
|
$('#change_qty').val(1);
|
||||||
$('#title_name').text(data.attr('data-name'));
|
$('#title_name').text(data.attr('data-name'));
|
||||||
@@ -242,6 +241,16 @@ $(function(){
|
|||||||
$('#unit_price').text(data.attr('data-price'));
|
$('#unit_price').text(data.attr('data-price'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// click select option icon for add
|
||||||
|
$(document).on('click', '.custom-btn', function(event){
|
||||||
|
type = $(this).data('type');
|
||||||
|
$('+ type +').removeClass('selected-option');
|
||||||
|
$(this).addClass('selected-option');
|
||||||
|
|
||||||
|
|
||||||
|
}); //End selecct Click
|
||||||
|
|
||||||
|
|
||||||
// click plus icon for add
|
// click plus icon for add
|
||||||
$(document).on('click', '.add_icon', function(event){
|
$(document).on('click', '.add_icon', function(event){
|
||||||
var item_data = $(this);
|
var item_data = $(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user