option select addorder
This commit is contained in:
@@ -329,13 +329,12 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var j in item_options) {
|
for(var j in item_options) {
|
||||||
value = item_options[j]["values"];
|
value = item_options[j]["values"];
|
||||||
type = item_options[j]["type"];
|
type = item_options[j]["type"];
|
||||||
row = "<h4>"+type+"</h4>"
|
row = "<h4>"+type+"</h4>"
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
|
row +="<button class='btn btn- waves-effect check_option_btn "+ type +"' data-type='"
|
||||||
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
|
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
|
||||||
});
|
});
|
||||||
$(".options-list").append(row);
|
$(".options-list").append(row);
|
||||||
@@ -375,7 +374,7 @@ $(function() {
|
|||||||
type = item_options[field]["type"];
|
type = item_options[field]["type"];
|
||||||
row = "<p style='font-size:16px;margin-bottom:3px'>"+type+"</p>"
|
row = "<p style='font-size:16px;margin-bottom:3px'>"+type+"</p>"
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
row +="<button class='btn btn-default btn-sm option_btn "+ type +"' data-type='"
|
row +="<button class='btn btn-default btn-sm check_option_btn"+ type +"' data-type='"
|
||||||
+type+"' data-value='"+value[i]+"' data-code='"+code+"' data-group='set_menu'>"
|
+type+"' data-value='"+value[i]+"' data-code='"+code+"' data-group='set_menu'>"
|
||||||
+value[i]+"</button>";
|
+value[i]+"</button>";
|
||||||
});
|
});
|
||||||
@@ -646,7 +645,7 @@ $(function() {
|
|||||||
type = item_options[field]["type"];
|
type = item_options[field]["type"];
|
||||||
row = "<h4>"+type+"</h4>"
|
row = "<h4>"+type+"</h4>"
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
|
row +="<button class='btn btn- waves-effect check_option_btn "+ type +"' data-type='"
|
||||||
+type+"' data-value='"+value[i]+"' data-group='simple_menu'>"+value[i]+"</button>";
|
+type+"' data-value='"+value[i]+"' data-group='simple_menu'>"+value[i]+"</button>";
|
||||||
});
|
});
|
||||||
$(".options-list").append(row);
|
$(".options-list").append(row);
|
||||||
@@ -710,6 +709,7 @@ $(function() {
|
|||||||
value = $(this).data('value');
|
value = $(this).data('value');
|
||||||
type = $(this).data('type');
|
type = $(this).data('type');
|
||||||
group = $(this).data('group');
|
group = $(this).data('group');
|
||||||
|
console.log(group);
|
||||||
options = $(".option_btn");
|
options = $(".option_btn");
|
||||||
$(options).each(function(i){
|
$(options).each(function(i){
|
||||||
if ($(options[i]).attr('data-type')==type){
|
if ($(options[i]).attr('data-type')==type){
|
||||||
@@ -744,7 +744,38 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}); //End selecct attribute buttom
|
}); //End selecct attribute buttom
|
||||||
|
// click select option icon for add
|
||||||
|
$(document).on('click', '.check_option_btn', function(event){
|
||||||
|
active =$(this).hasClass('selected-option');
|
||||||
|
value = $(this).data('value');
|
||||||
|
type = $(this).data('type');
|
||||||
|
group = $(this).data('group');
|
||||||
|
if (active) {
|
||||||
|
$(this).removeClass('selected-option');
|
||||||
|
}else{
|
||||||
|
$(this).addClass('selected-option');
|
||||||
|
}
|
||||||
|
if(group == "set_menu"){
|
||||||
|
option_arr = get_selected_attributes('selected-option');
|
||||||
|
$(".selected-set:last").attr('data-options',JSON.stringify(option_arr));
|
||||||
|
$(".selected-set:last").children().children('#instance_option').text(option_arr);
|
||||||
|
// instance = $(".selected-instance");
|
||||||
|
// $(instance).each(function(i){
|
||||||
|
// if ($(instance[i]).attr('data-code')==code){
|
||||||
|
// option_arr = get_selected_attributes('selected-option');
|
||||||
|
// $(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||||
|
// $(instance[i]).children().children('#instance_option').text(option_arr);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
// click add order
|
// click add order
|
||||||
$(document).on('click', '.add_to_order', function(event){
|
$(document).on('click', '.add_to_order', function(event){
|
||||||
total_price = $('#total_price').text();
|
total_price = $('#total_price').text();
|
||||||
|
|||||||
@@ -334,3 +334,9 @@ i.logout_icon{
|
|||||||
.custom-flex-footer{
|
.custom-flex-footer{
|
||||||
display:flex;
|
display:flex;
|
||||||
}
|
}
|
||||||
|
.check_option_btn {
|
||||||
|
white-space: normal !important;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
margin-right: 5px;
|
||||||
|
color: #111 !important;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user