Merge branch 'master' into qr_code
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
//= require cable
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
|
||||
$(".nav-completed").on("click", function(){
|
||||
$("#completed").removeClass('hide')
|
||||
@@ -36,9 +34,7 @@ $(document).ready(function(){
|
||||
var oqs_id = $(this).find(".oqs-id").text();
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
show_details(url);
|
||||
|
||||
|
||||
show_details(url);
|
||||
|
||||
}); //End Click
|
||||
|
||||
|
||||
@@ -8,12 +8,6 @@ $(function(){
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
$("#set_change_qty").change(function(){
|
||||
qty = $(this).val();
|
||||
price = $("#set_total_price").text();
|
||||
$("#set_total_price").text(qty*price);
|
||||
});
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_item_list(url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
@@ -104,10 +98,10 @@ $(function(){
|
||||
}
|
||||
//end show list function
|
||||
//click item row for item set
|
||||
$(document).on('click', '.set_item_box', function(event){
|
||||
$(".instance-list").empty();
|
||||
$(".options-list").empty();
|
||||
|
||||
$(document).on('click', '.set_item_box', function(event){
|
||||
$(".instance-list").empty();
|
||||
$(".options-list").empty();
|
||||
change_qty_plus_minus("set_count","set_plus","set_minus");
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
instances = $(this).data('instance');
|
||||
@@ -152,8 +146,10 @@ $(function(){
|
||||
$('#set_item_instances').text(instances);
|
||||
$('#set_name').text(data.attr('data-name'));
|
||||
$('#set_item_code').text(data.attr('data-item-code'));
|
||||
$('#set_total_price').text(data.attr('data-price'));
|
||||
// $('#set_total_price').text(data.attr('data-price'));
|
||||
$('#set_total_price').text(0);
|
||||
$('#set_unit_price').text(data.attr('data-price'));
|
||||
// $('#set_unit_price').text(0);
|
||||
});
|
||||
// click instance for add item set
|
||||
$(document).on('click', '.instance_box', function(event){
|
||||
@@ -179,7 +175,8 @@ $(function(){
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
qty = $('#set_change_qty').val();
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
var total_price = +sub_total - +total;
|
||||
$(this).removeClass('selected-instance');
|
||||
@@ -187,21 +184,24 @@ $(function(){
|
||||
$(this).removeAttr('data-options');
|
||||
$('#instance_option').text('')
|
||||
}else {
|
||||
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
qty = $('#set_change_qty').val();
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
var total_price = +sub_total + +total;
|
||||
$(this).addClass('selected-instance');
|
||||
}
|
||||
$('#set_unit_price').text(price);
|
||||
$('#set_total_price').text(total_price);
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
// click add order
|
||||
$(document).on('click', '.set_order', function(event){
|
||||
total_price = $('#set_total_price').text();
|
||||
qty = parseInt($('#set_change_qty').val());
|
||||
qty = parseInt($('#set_count').val());
|
||||
item_code = $('#set_item_code').text();
|
||||
item_name = $('#set_name').text();
|
||||
|
||||
@@ -253,6 +253,8 @@ $(function(){
|
||||
$('.add_to_order').removeAttr('data-attributes');
|
||||
$('.add_to_order').removeAttr('data-options');
|
||||
|
||||
change_qty_plus_minus("count","plus","minus");
|
||||
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
$('#total_price').text(data.attr('data-price'));
|
||||
@@ -273,21 +275,44 @@ $(function(){
|
||||
for(var field in instances) {
|
||||
value = instances[field].values;
|
||||
$(value).each(function(i){
|
||||
options = value[i];
|
||||
instance_attributes.push(options);
|
||||
options = value[i];
|
||||
instance_attributes.push(options);
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '../../api/restaurant/menu_item_attributes/'+value[i],
|
||||
// data: {id:value[i]},
|
||||
// success:function(result){
|
||||
|
||||
// options = result["name"];
|
||||
// instance_attributes.push(options);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
// selected_arr = []
|
||||
// $(selected_item).each(function(i){
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '../../api/restaurant/menu_item_attributes/'+selected_item[i],
|
||||
// data: {id:selected_item[i]},
|
||||
// success:function(result){
|
||||
// name = result["name"];
|
||||
// selected_arr.push(name);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
for(var field in attributes) {
|
||||
value = attributes[field]["values"];
|
||||
type = attributes[field]["type"]
|
||||
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
||||
row = "<h4>"+attributes[field]["type"]+"</h4>";
|
||||
|
||||
$(value).each(function(i){
|
||||
disabled = ""
|
||||
status ="";
|
||||
|
||||
|
||||
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
|
||||
if(parseInt(jQuery.inArray(value[i], selected_item)) !== -1){
|
||||
status = "selected-attribute";
|
||||
}
|
||||
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
|
||||
@@ -326,6 +351,8 @@ $(function(){
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.attribute_btn', function(event){
|
||||
|
||||
$('.change_qty').val(1);
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
instances = $(this).data('instances');
|
||||
@@ -345,7 +372,7 @@ $(function(){
|
||||
|
||||
var selected_attr = get_selected_attributes('selected-attribute');
|
||||
|
||||
qty = $('#change_qty').val();
|
||||
qty = $('.change_qty').val();
|
||||
|
||||
for(var field in instances) {
|
||||
item_attr = instances[field].values;
|
||||
@@ -652,24 +679,72 @@ $(function(){
|
||||
}
|
||||
});
|
||||
|
||||
var count = 1;
|
||||
var countEl = document.getElementById("count");
|
||||
$("#plus").on("click", function(){
|
||||
count++;
|
||||
countEl.value = count;
|
||||
// Get Selected Class
|
||||
function change_qty_plus_minus(id,plus,minus) {
|
||||
|
||||
price = $("#unit_price").text();
|
||||
$("#total_price").text(count*price);
|
||||
});
|
||||
$("#minus").on("click", function(){
|
||||
if (count > 1) {
|
||||
count--;
|
||||
var count = 1;
|
||||
var countEl = document.getElementById(id);
|
||||
|
||||
$('#'+plus).on("click", function(){
|
||||
|
||||
count++;
|
||||
countEl.value = count;
|
||||
|
||||
price = $("#unit_price").text();
|
||||
$("#total_price").text(count*price);
|
||||
}
|
||||
})
|
||||
|
||||
if (id == "count") {
|
||||
price = $("#unit_price").text();
|
||||
$("#total_price").text(count*price);
|
||||
}else{
|
||||
var item_row = $('.selected-instance');
|
||||
price = $("#set_unit_price").text();
|
||||
set_total_price = $("#set_total_price").text();
|
||||
|
||||
if (item_row.length > 1) {
|
||||
total = 0 ;
|
||||
$(item_row).each(function(i){
|
||||
total += count * $(item_row[i]).attr('data-price');
|
||||
total_price = total;
|
||||
});
|
||||
}else{
|
||||
total_price = count*price;
|
||||
}
|
||||
|
||||
$("#set_total_price").text(total_price);
|
||||
}
|
||||
});
|
||||
|
||||
$('#'+minus).on("click", function(){
|
||||
if (count > 1) {
|
||||
count--;
|
||||
countEl.value = count;
|
||||
|
||||
if (id=="count") {
|
||||
price = $("#unit_price").text();
|
||||
$("#total_price").text(count*price);
|
||||
}else{
|
||||
var item_row = $('.selected-instance');
|
||||
price = $("#set_unit_price").text();
|
||||
set_total_price = $("#set_total_price").text();
|
||||
|
||||
if (item_row.length > 1) {
|
||||
total = 0 ;
|
||||
$(item_row).each(function(i){
|
||||
total += count * $(item_row[i]).attr('data-price');
|
||||
total_price = total;
|
||||
});
|
||||
}else{
|
||||
total_price = count*price;
|
||||
}
|
||||
$("#set_total_price").text(total_price);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// $("#set_change_qty").change(function(){
|
||||
// qty = $(this).val();
|
||||
// price = $("#set_total_price").text();
|
||||
// $("#set_total_price").text(qty*price);
|
||||
// });
|
||||
|
||||
// $(".change_qty").change(function(){
|
||||
// qty = $(this).val();
|
||||
|
||||
Reference in New Issue
Block a user