update cache menu
This commit is contained in:
24
app/views/origami/dashboard/_menu.json.jbuilder
Normal file
24
app/views/origami/dashboard/_menu.json.jbuilder
Normal file
@@ -0,0 +1,24 @@
|
||||
json.id menu.id
|
||||
json.name menu.name
|
||||
json.is_active menu.is_active
|
||||
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
|
||||
if (menu.menu_categories)
|
||||
json.categories menu.menu_categories do |category|
|
||||
json.id category.id
|
||||
json.code category.code
|
||||
json.order_by category.order_by
|
||||
json.name category.name
|
||||
json.alt_name category.alt_name
|
||||
json.order_by category.order_by
|
||||
json.parent_id category.menu_category_id
|
||||
json.is_available category.is_available
|
||||
|
||||
if category.menu_items
|
||||
json.items category.menu_items do |item|
|
||||
json.partial! 'origami/addorders/menu_item', item: item
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
15
app/views/origami/dashboard/get_all_menu.json.jbuilder
Normal file
15
app/views/origami/dashboard/get_all_menu.json.jbuilder
Normal file
@@ -0,0 +1,15 @@
|
||||
menu_json = json.array! @menus do |menu|
|
||||
json.id menu.id
|
||||
json.name menu.name
|
||||
json.valid_days menu.valid_days
|
||||
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
|
||||
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
|
||||
|
||||
json.partial! 'origami/dashboard/menu', menu: menu
|
||||
# if (@current_menu)
|
||||
# json.current_menu do
|
||||
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
@@ -207,6 +207,16 @@
|
||||
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
<script>
|
||||
$(function() {
|
||||
localStorage.removeItem("menus");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: 'get_all_menu',
|
||||
data: {},
|
||||
success:function(result){
|
||||
localStorage.setItem("menus", JSON.stringify(result));
|
||||
}
|
||||
});
|
||||
|
||||
$(".cashier_view").on('click', function() {
|
||||
window.location.href = '/origami';
|
||||
@@ -223,9 +233,9 @@
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
|
||||
$("#second_view").on('click', function () {
|
||||
$("#second_view").on('click', function () {
|
||||
var url = $(this).attr("data-href");
|
||||
window.open(url,'_blank');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user