option select addorder
This commit is contained in:
@@ -329,16 +329,15 @@ $(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='"
|
||||
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>";
|
||||
});
|
||||
$(".options-list").append(row);
|
||||
$(".options-list").append(row);
|
||||
}
|
||||
$('.set-item').attr('data-code',instances[0]['code']);
|
||||
$('.set-item').attr('data-name',instances[0]['name']);
|
||||
@@ -375,7 +374,7 @@ $(function() {
|
||||
type = item_options[field]["type"];
|
||||
row = "<p style='font-size:16px;margin-bottom:3px'>"+type+"</p>"
|
||||
$(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'>"
|
||||
+value[i]+"</button>";
|
||||
});
|
||||
@@ -646,7 +645,7 @@ $(function() {
|
||||
type = item_options[field]["type"];
|
||||
row = "<h4>"+type+"</h4>"
|
||||
$(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>";
|
||||
});
|
||||
$(".options-list").append(row);
|
||||
@@ -710,6 +709,7 @@ $(function() {
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
console.log(group);
|
||||
options = $(".option_btn");
|
||||
$(options).each(function(i){
|
||||
if ($(options[i]).attr('data-type')==type){
|
||||
@@ -744,7 +744,38 @@ $(function() {
|
||||
}
|
||||
|
||||
}); //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
|
||||
$(document).on('click', '.add_to_order', function(event){
|
||||
total_price = $('#total_price').text();
|
||||
|
||||
@@ -334,3 +334,9 @@ i.logout_icon{
|
||||
.custom-flex-footer{
|
||||
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