shop code
This commit is contained in:
@@ -19,17 +19,17 @@
|
||||
<div class="active" id="tables" role="tabpanel">
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 2.2rem;">
|
||||
<% @i =0 %>
|
||||
<% DiningFacility.all.each do |table| %>
|
||||
<% @i =0 %>
|
||||
<% @tables.each do |table| %>
|
||||
<div class="card assign_table <%= table.status=="available" ? "green" : "red"%>" data-id="<%= table.id %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden queue-id"><%= @queue.id %></p>
|
||||
<p class="hidden queue-id"><%= @queue.id %></p>
|
||||
<p class="hidden queue-status"><%= table.status %></p>
|
||||
<p style="text-align: center"><%= table.name %></p>
|
||||
<p style="text-align: center">Seat : <%= table.seater %></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,12 +50,12 @@ $(document).on('click',".assign_table",function(){
|
||||
var table_id = $(this).attr('data-id');
|
||||
url = '<%= crm_assign_table_path %>';
|
||||
var status = $(this).find(".queue-status").text()
|
||||
|
||||
|
||||
if (status == "available") {
|
||||
assign_table(queue_id,table_id,url);
|
||||
} else {
|
||||
swal ( "Alert!" , "You cannot assign this table!" , "warning" );
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function assign_table(id,table_id,url) {
|
||||
@@ -63,24 +63,23 @@ function assign_table(id,table_id,url) {
|
||||
title: "Confirm!",
|
||||
text: "Are You Sure to assign this customer!",
|
||||
}, function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url ,
|
||||
data: {id:id,table_id:table_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
{
|
||||
window.location.href = '<%=crm_dining_queues_path%>'
|
||||
}else{
|
||||
swal ( "Alert!" , "Record not found!" , "warning" );
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user