update addorder
This commit is contained in:
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(".nav-completed").on("click", function(){
|
$(".nav-completed").on("click", function(){
|
||||||
$("#completed").removeClass('hide')
|
$("#completed").removeClass('hide')
|
||||||
$(".oqs_append").addClass('hide')
|
$(".oqs_append").addClass('hide')
|
||||||
@@ -38,8 +36,6 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
show_details(url);
|
show_details(url);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}); //End Click
|
}); //End Click
|
||||||
|
|
||||||
function show_details(url){
|
function show_details(url){
|
||||||
|
|||||||
@@ -8,12 +8,6 @@ $(function(){
|
|||||||
});
|
});
|
||||||
//End menu category Click
|
//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
|
//show menu item list when click menu category
|
||||||
function show_menu_item_list(url_item){
|
function show_menu_item_list(url_item){
|
||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
@@ -152,7 +146,8 @@ $(function(){
|
|||||||
$('#set_item_instances').text(instances);
|
$('#set_item_instances').text(instances);
|
||||||
$('#set_name').text(data.attr('data-name'));
|
$('#set_name').text(data.attr('data-name'));
|
||||||
$('#set_item_code').text(data.attr('data-item-code'));
|
$('#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(data.attr('data-price'));
|
||||||
});
|
});
|
||||||
// click instance for add item set
|
// click instance for add item set
|
||||||
@@ -179,7 +174,8 @@ $(function(){
|
|||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
price = $(this).data('price');
|
price = $(this).data('price');
|
||||||
qty = $('#set_change_qty').val();
|
// qty = $('#set_change_qty').val();
|
||||||
|
qty = document.getElementById("count").value;
|
||||||
total = qty*price;
|
total = qty*price;
|
||||||
var total_price = +sub_total - +total;
|
var total_price = +sub_total - +total;
|
||||||
$(this).removeClass('selected-instance');
|
$(this).removeClass('selected-instance');
|
||||||
@@ -187,10 +183,12 @@ $(function(){
|
|||||||
$(this).removeAttr('data-options');
|
$(this).removeAttr('data-options');
|
||||||
$('#instance_option').text('')
|
$('#instance_option').text('')
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
price = $(this).data('price');
|
price = $(this).data('price');
|
||||||
qty = $('#set_change_qty').val();
|
// qty = $('#set_change_qty').val();
|
||||||
|
qty = document.getElementById("count").value;
|
||||||
total = qty*price;
|
total = qty*price;
|
||||||
var total_price = +sub_total + +total;
|
var total_price = +sub_total + +total;
|
||||||
$(this).addClass('selected-instance');
|
$(this).addClass('selected-instance');
|
||||||
@@ -273,21 +271,48 @@ $(function(){
|
|||||||
for(var field in instances) {
|
for(var field in instances) {
|
||||||
value = instances[field].values;
|
value = instances[field].values;
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
options = value[i];
|
// options = value[i];
|
||||||
instance_attributes.push(options);
|
// 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) {
|
for(var field in attributes) {
|
||||||
value = attributes[field]["values"];
|
value = attributes[field]["values"];
|
||||||
type = attributes[field]["type"]
|
type = attributes[field]["type"]
|
||||||
row = "<h4>"+attributes[field]["type"]+"</h4>"
|
row = "<h4>"+attributes[field]["type"]+"</h4>";
|
||||||
|
console.log(selected_arr);
|
||||||
|
console.log(value);
|
||||||
|
|
||||||
|
console.log(instance_attributes);
|
||||||
|
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
disabled = ""
|
disabled = ""
|
||||||
status ="";
|
status ="";
|
||||||
|
if(parseInt(jQuery.inArray(value[i], selected_arr)) !== -1){
|
||||||
|
|
||||||
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
|
|
||||||
status = "selected-attribute";
|
status = "selected-attribute";
|
||||||
}
|
}
|
||||||
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
|
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
|
||||||
@@ -654,13 +679,18 @@ $(function(){
|
|||||||
|
|
||||||
var count = 1;
|
var count = 1;
|
||||||
var countEl = document.getElementById("count");
|
var countEl = document.getElementById("count");
|
||||||
|
|
||||||
$("#plus").on("click", function(){
|
$("#plus").on("click", function(){
|
||||||
count++;
|
count++;
|
||||||
countEl.value = count;
|
countEl.value = count;
|
||||||
|
|
||||||
price = $("#unit_price").text();
|
price = $("#unit_price").text();
|
||||||
$("#total_price").text(count*price);
|
$("#total_price").text(count*price);
|
||||||
|
|
||||||
|
set_price = $("#set_unit_price").text();
|
||||||
|
$("#set_total_price").text(qty*set_price);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#minus").on("click", function(){
|
$("#minus").on("click", function(){
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
count--;
|
count--;
|
||||||
@@ -668,9 +698,18 @@ $(function(){
|
|||||||
|
|
||||||
price = $("#unit_price").text();
|
price = $("#unit_price").text();
|
||||||
$("#total_price").text(count*price);
|
$("#total_price").text(count*price);
|
||||||
|
|
||||||
|
set_price = $("#set_unit_price").text();
|
||||||
|
$("#set_total_price").text(qty*set_price);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// $("#set_change_qty").change(function(){
|
||||||
|
// qty = $(this).val();
|
||||||
|
// price = $("#set_total_price").text();
|
||||||
|
// $("#set_total_price").text(qty*price);
|
||||||
|
// });
|
||||||
|
|
||||||
// $(".change_qty").change(function(){
|
// $(".change_qty").change(function(){
|
||||||
// qty = $(this).val();
|
// qty = $(this).val();
|
||||||
// price = $("#unit_price").text();
|
// price = $("#unit_price").text();
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
class Api::Restaurant::MenuItemAttributesController < Api::ApiController
|
||||||
|
skip_before_action :authenticate
|
||||||
#Description
|
#Description
|
||||||
# Pull the default menu details and also other available (active) menus
|
# Pull the default menu details and also other available (active) menus
|
||||||
# Input Params - order_id
|
# Input Params - order_id
|
||||||
def index
|
def index
|
||||||
@menu_attributes = MenuItemAttribute.all
|
@menu_attributes = MenuItemAttribute.all
|
||||||
end
|
end
|
||||||
|
def show
|
||||||
|
@attribute = MenuItemAttribute.find(params[:id])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
if(@attribute)
|
||||||
|
json.id @attribute.id
|
||||||
|
json.type @attribute.attribute_type
|
||||||
|
json.name @attribute.name
|
||||||
|
json.value @attribute.value
|
||||||
|
else
|
||||||
|
json.success false
|
||||||
|
end
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<span class="glyphicon glyphicon-minus"></span>
|
<span class="glyphicon glyphicon-minus"></span>
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
<input type="text" value="1" id="count" class="form-control col-md-12 ">
|
<input type="text" value="1" id="count" class="change_qty form-control col-md-12 ">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
<button type="button" class="btn btn-success btn-number" value="+" id="plus">
|
<button type="button" class="btn btn-success btn-number" value="+" id="plus">
|
||||||
<span class="glyphicon glyphicon-plus"></span>
|
<span class="glyphicon glyphicon-plus"></span>
|
||||||
@@ -171,10 +171,25 @@
|
|||||||
<div class="row set-item">
|
<div class="row set-item">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||||
<div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<label class="col-md-6" style="margin-top:5px">Quantity</label>
|
<label class="col-md-6" style="margin-top:5px">Quantity</label>
|
||||||
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
|
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
|
||||||
|
</div> -->
|
||||||
|
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="button" class="btn btn-danger btn-number" value="-" id="minus">
|
||||||
|
<span class="glyphicon glyphicon-minus"></span>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
<input type="text" value="1" id="count" class="set_change_qty form-control col-md-12 ">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="button" class="btn btn-success btn-number" value="+" id="plus">
|
||||||
|
<span class="glyphicon glyphicon-plus"></span>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="hidden" id="set_unit_price"></p>
|
<p class="hidden" id="set_unit_price"></p>
|
||||||
<p class="hidden" id="set_instance_code"></p>
|
<p class="hidden" id="set_instance_code"></p>
|
||||||
<p class="hidden" id="set_instance_name"></p>
|
<p class="hidden" id="set_instance_name"></p>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ Rails.application.routes.draw do
|
|||||||
resources :menu, only: [:index, :show]
|
resources :menu, only: [:index, :show]
|
||||||
resources :menu_categories, only: [:index, :show]
|
resources :menu_categories, only: [:index, :show]
|
||||||
resources :menu_items, only: [:index, :show]
|
resources :menu_items, only: [:index, :show]
|
||||||
resources :menu_item_attributes, only: [:index]
|
resources :menu_item_attributes, only: [:index, :show]
|
||||||
resources :menu_item_options, only: [:index]
|
resources :menu_item_options, only: [:index]
|
||||||
resources :menu_sold_out, only: [:index]
|
resources :menu_sold_out, only: [:index]
|
||||||
resources :menu_item_instances, only: [:show]
|
resources :menu_item_instances, only: [:show]
|
||||||
|
|||||||
Reference in New Issue
Block a user