update add order
This commit is contained in:
@@ -212,29 +212,28 @@ $(function(){
|
||||
|
||||
//click item row for add order
|
||||
$(document).on('click', '.menu_item_box', function(event){
|
||||
$('.option-list').empty();
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
attributes = $(this).data('id');
|
||||
selected_item = $(this).data('item');
|
||||
|
||||
console.log(attributes);
|
||||
for(var field in attributes) {
|
||||
value = attributes[field]["value"];
|
||||
|
||||
type = attributes[field]["type"]
|
||||
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
||||
|
||||
$(value).each(function(i){
|
||||
$(selected_item).each(function(item){
|
||||
if (value[i] == selected_item[item]) {
|
||||
$('.custom-btn').addClass('selected-option');
|
||||
}else{
|
||||
$('.custom-btn').removeClass('selected-option');
|
||||
status ="";
|
||||
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
|
||||
status = "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);
|
||||
|
||||
|
||||
}
|
||||
$('#change_qty').val(1);
|
||||
$('#title_name').text(data.attr('data-name'));
|
||||
@@ -242,6 +241,16 @@ $(function(){
|
||||
$('#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
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
var item_data = $(this);
|
||||
|
||||
Reference in New Issue
Block a user