Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2018-04-06 09:40:49 +06:30
11 changed files with 169 additions and 52 deletions

View File

@@ -315,6 +315,7 @@ $(function() {
$(".options-list").empty();
rowCount = $('.selected-instance');
setCount = $('.selected-set');
item_options = $(this).data('option');
min_qty = $(this).data('min-qty');
@@ -335,19 +336,19 @@ $(function() {
$(".options-list").append(row);
}
}
if($(this).hasClass('selected-instance') == true){
sub_total = $('#set_total_price').text();
name = $(this).data('name');
price = $(this).data('price');
// qty = $('#set_change_qty').val();
qty = document.getElementById("set_count").value;
total = qty*price;
var total_price = +sub_total - +total;
$(this).removeClass('selected-instance');
$(".options-list").empty();
$(this).removeAttr('data-options');
$('#instance_option').text('')
}else {
// if($(this).hasClass('selected-instance') == true){
// sub_total = $('#set_total_price').text();
// name = $(this).data('name');
// price = $(this).data('price');
// // qty = $('#set_change_qty').val();
// qty = document.getElementById("set_count").value;
// total = qty*price;
// var total_price = +sub_total - +total;
// $(this).removeClass('selected-instance');
// $(".options-list").empty();
// $(this).removeAttr('data-options');
// $('#instance_option').text('')
// }else {
if (rowCount.length+1 <= max_qty) {
sub_total = $('#set_total_price').text();
name = $(this).data('name');
@@ -358,12 +359,55 @@ $(function() {
total = qty*price;
var total_price = +sub_total + +total;
$(this).addClass('selected-instance');
set = "<div class='selected-set card custom-card' style='margin-bottom:10px !important'"
+"' data-name='"+$(this).data('name')
+"' data-code='"+code
+"' data-price='"+$(this).data('price')
+"' data-option='"+JSON.stringify($(this).data('option'))
+"' data-min-qty='"+$(this).data('min-qty')
+"' data-max-qty='"+$(this).data('max-qty')
+"' data-parent-code='"+$(this).data('parent-code')
+"' data-parent-id='"+$(this).data('parent-id')
+"' data-sub-item='true"
+"'>"
+'<div class="card-block" style="background-color:#54A5AF;">'
+' <button type="button" class="close" id="remove_set" style="font-size: 20px;">&times;</button>'
+'<span style="color:#fff">'+$(this).data('name')+'</span>'
+'</div>'
+'<div class="card-block custom-card-block">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
// +'<div class="card-footer custom-card-footer">'
// +' <span>'+$(this).data('price')+'</span>'
// // +' <small style="float:right" id="instance_option"></small>'
// +'</div>'
+'</div>'
$(".selected-set-list").append(set);
}else{
swal("Alert !", 'Maximum Qty is ' + max_qty + " items", "warning");
}
}
// }
$('#set_unit_price').text(price);
$('#set_total_price').text(total_price);
}); //End selecct attribute buttom
// click add order
$(document).on('click', '#remove_set', function(event){
code = $(this).parent().parent('.selected-set').attr('data-code');
instance = $(".selected-instance");
console.log(code)
$(instance).each(function(i){
if ($(instance[i]).attr('data-code')==code){
console.log($(instance[i]))
$(instance[i]).removeClass("selected-instance")
}
});
$(this).parent().parent('.selected-set').remove();
});
// click add order
$(document).on('click', '.set_order', function(event){
@@ -637,15 +681,17 @@ $(function() {
if(group == "set_menu"){
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);
}
});
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"){

View File

@@ -32,6 +32,26 @@ $(document).ready(function() {
railBorderRadius: '0',
touchScrollStep : 50
});
$('#modal-slimscroll').slimScroll({
height: height-$('#modal-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
$('#modal-set-slimscroll').slimScroll({
height: height-$('#modal-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 45
});
// $('.delete').click(function(){
// var method = $(this).attr('data-method');