update add order

This commit is contained in:
Aung Myo
2018-02-16 14:30:53 +06:30
parent 1d62e3c082
commit 941204afc1
3 changed files with 89 additions and 112 deletions

View File

@@ -78,10 +78,11 @@
<!-- <i class="material-icons">reply</i> -->
Back
</button>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style=" padding: .5rem 0.15rem !important;">Pending Order
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button>
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
<input type="hidden" name="table_id" value="" id="table_id">
<%else%>
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>Back
@@ -110,7 +111,7 @@
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p>
<% else%>
<p class="hidden" id="table_type"></p>
<% end%>
</div>
<% else %>
@@ -361,92 +362,46 @@
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;">&times;</button>
</div>
<div class="modal-body" style="margin-top: -0.75rem;padding-top:5px">
<h5>Table</h5>
<%@zone.each do |zone| %>
<h5>Zone : <%=zone.name%></h5>
<div class="card-columns" style="column-count: 7;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% end %>
<div class="card-block">
<%= table.name %>
<!-- <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div> -->
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% end %>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
<% end %>
<% end %>
</div>
<hr style="margin: 5px 20px">
<h5>Room</h5>
<div class="card-columns" style="column-count: 7;">
<% @rooms.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% end %>
<div class="card-block">
<%= table.name %>
<!-- <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div> -->
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<% end %>
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<%zone.tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<% color="red"%>
<% else %>
<% color="orange"%>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<% color="blue"%>
<% else %>
<% color="orange"%>
<% end %>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>" data-name="<%= table.name %>" style="margin-bottom: .5rem;">
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div>
</div>
<% end %>
<% color="green"%>
<% end %>
<div class="card tables <%=color%> text-white table_<%= table.id %>" data-id="<%= table.id %>" data-type="<%= table.type %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
</div>
</div>
<%end%>
</div>
<%end%>
<div class="modal-footer p-r-30">
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
&nbsp; &nbsp;
<button type="button" class="btn btn-link bg-blue waves-effect confirm_table" data-dismiss="modal">Confirm</button>
</div>
</div>
</div>
</div>
</div>
<% end %>
<script>
$(document).ready(function () {
@@ -455,18 +410,24 @@
$('.tables').removeClass('purple')
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var type = $(this).attr("data-type");
$(this).css('background-color','purple');
$(this).addClass('purple')
$('.confirm_table').attr("data-id",dining_id)
$('.confirm_table').attr("data-name",name)
$('.confirm_table').attr("data-type",type)
});
$(".confirm_table").on('click', function () {
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var type = $(this).attr("data-type");
$('#table_id').val(dining_id)
$('#table_type').text(type)
$('.select_table').text(name)
console.log(type)
});
$('#pending_order').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';