calculate induties in bill
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
<div class="col-md-6 col-sm-6 col-lg-3 mt-3 touch_commissioner" commissionerId='<%= com["id"] %>' commissionerName='<%= com["name"] %>'>
|
||||
<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(<%=com["image_path"] %>);background-repeat: no-repeat; background-size: cover;">
|
||||
<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">
|
||||
<div class="col-6" style="padding:0px !important;"><%=com["name"] %></div>
|
||||
<div class="col-8" style="padding:0px !important;"><%=com["name"] %></div>
|
||||
<% if com["check_in_count"] >0%>
|
||||
<div class="col-6" style="margin:auto;"><span class="badge badge-primary" style="font-size: 1rem;">Active <%=com["check_in_count"] %></span></div>
|
||||
<div class="col-4 row" style="margin:auto;"><span class="badge badge-primary" style="margin:auto;font-size: 0.8rem;">A :<%=com["check_in_count"] %></span></div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
@@ -61,9 +61,14 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="row form-inputs form-group" style="margin: auto;">
|
||||
<hr style="width :100%">
|
||||
<div class="col-12 " style="margin-top: 1rem;">
|
||||
<div class="row" >
|
||||
<div class="col-8 add_to_order" style="margin: auto;">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-inputs form-group" style="margin: auto;">
|
||||
<hr style="width :100%;margin-bottom: 1rem;">
|
||||
<div class="col-12 " style="">
|
||||
<div class="row form-inputs form-group" style="margin: auto;">
|
||||
<div class="col-12" >
|
||||
<label class="radio-room"><input type="radio" name="radio" id="radio-room" value="room" checked="checked" /> Room</label>
|
||||
@@ -87,14 +92,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-inputs form-group" style="margin: auto;">
|
||||
<div class=" col-12 ">
|
||||
<div class="col-12 ">
|
||||
<%= simple_form_for 'save_induties', :url => induties_induties_create_path, :method => :post do |f| %>
|
||||
<%= f.check_box :by_name,:class=>'form-control'%>
|
||||
<label class="checkboxLabel" for="save_induties_by_name">By Name</label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<a href="" id="btn_create_induty" class=" btn bg-blue form-actions btn_create_induty">Create In Duty</a>
|
||||
<button type="button" class=" btn bg-blue form-actions btn_create_induty" id="btn_create_induty" disabled="">Create In Duty</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -108,9 +113,13 @@
|
||||
window.location.href = '/origami/'+dinning_type+'/'+dinning_id;
|
||||
});
|
||||
$( document ).ready(function() {
|
||||
document.getElementById("btn_create_induty").disabled = true;
|
||||
// document.getElementById("btn_create_induty").disabled = true;
|
||||
$('#btn_create_induty').attr("disabled", 'disabled');
|
||||
var booking_id=document.getElementById("booking_id").value
|
||||
getCurrentBooking(booking_id);
|
||||
});
|
||||
$(document).on('click', '.btn_create_induty', function(event){
|
||||
$('.add_to_order').html("");
|
||||
event.preventDefault();
|
||||
var str=document.getElementById("zone_dinning_id").value;
|
||||
var str_t=document.getElementById("zone_t_dinning_id").value;
|
||||
@@ -154,7 +163,9 @@
|
||||
}
|
||||
});
|
||||
$(document).on('click', '.touch_commissioner', function(event){
|
||||
$('#btn_create_induty').attr("disabled", '');
|
||||
$(".success-msg").css('display','none');
|
||||
$('.add_to_order').html("");
|
||||
document.getElementById("btn_create_induty").disabled = false;
|
||||
var commissionerId = this.getAttribute("commissionerId");
|
||||
var commissionerName = this.getAttribute("commissionerName");
|
||||
@@ -167,26 +178,15 @@
|
||||
url: "/induties/assign_in_duties/get_all_occupied_dining/"+commissionerId,
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
$('.commissionerName').append('<label>'+commissionerName+' ('+booking_id+' )</label');
|
||||
$('.commissionerName').append('<label>'+commissionerName+' (<a href="" onclick = "getCurrent(this)">'+booking_id+'</a> )</label');
|
||||
data.forEach(function(items) {
|
||||
in_time = changDateFormat(items.in_time);
|
||||
d_type = items.dinning_type.charAt(0);
|
||||
// console.log(d_type);
|
||||
// if(items.out_time == null){
|
||||
row ='<tr>'
|
||||
+'<td>'+d_type+'-'+items.dinning_id+'</td>'
|
||||
+'<td>'+in_time+'</td>'
|
||||
+'<td><a href="" onclick = "checkout_induty(this)" class="btn checkout_induty" style= "background-color: #3F51B5;"indutyId="'+ items.id +'" >Check Out</a> <a href="" onclick = "remove_induty(this)" class="btn remove_induty" style= "background-color: red;"indutyId="'+ items.id +'" >Remove</a></td>'
|
||||
+'</tr>';
|
||||
// }
|
||||
// else{
|
||||
// out_time = changDateFormat(items.out_time);
|
||||
// row ='<tr>'
|
||||
// +'<td>'+items.dinning_id+'</td>'
|
||||
// +'<td>'+in_time+'</td>'
|
||||
// +'<td>'+out_time+'</td>'
|
||||
// +'</tr>';
|
||||
// }
|
||||
$('.occupide_dining').append(row);
|
||||
|
||||
});
|
||||
@@ -213,15 +213,11 @@
|
||||
}
|
||||
$('input[type=radio]').change(function() {
|
||||
if(this.value == "room"){
|
||||
// $(".table_collection").hide();
|
||||
$(".table_collection").css('display','none');
|
||||
// $(".room_collection").show();
|
||||
$(".room_collection").css('display','block');
|
||||
}
|
||||
else{
|
||||
// $(".room_collection").hide();
|
||||
$(".room_collection").css('display','none');
|
||||
// $(".table_collection").show();
|
||||
$(".table_collection").css('display','block');
|
||||
}
|
||||
});
|
||||
@@ -249,14 +245,6 @@
|
||||
success: function (data) {
|
||||
var d = row.parentNode.parentNode.rowIndex;
|
||||
document.getElementById('show_in_duty_table').deleteRow(d);
|
||||
// in_time = changDateFormat(data.in_time);
|
||||
// out_time = changDateFormat(data.out_time);
|
||||
// row ='<tr>'
|
||||
// +'<td>'+data.dinning_id+'</td>'
|
||||
// +'<td>'+in_time+'</td>'
|
||||
// +'<td>'+out_time+'</td>'
|
||||
// +'</tr>';
|
||||
// $('.occupide_dining').append(row);
|
||||
var scrollTo = document.getElementById('show_list_induty_card');
|
||||
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
|
||||
$(".success-msg").css('display','block');
|
||||
@@ -305,5 +293,53 @@
|
||||
});
|
||||
localStorage.setItem('from_induty', false);
|
||||
|
||||
function getCurrentBooking(booking_id){
|
||||
document.getElementById("btn_create_induty").disabled = true;
|
||||
$('.commissionerName').html("");
|
||||
$('.add_to_order').html("");
|
||||
$('.occupide_dining').html("");
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "get_current_booking",
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
dinning_id = localStorage.getItem('dinning_id');
|
||||
dinning_type = localStorage.getItem('dinning_type');
|
||||
booking_id=document.getElementById("booking_id").value
|
||||
$('.commissionerName').append('<label><a href="" onclick = "getCurrent(this)">'+booking_id+'</a></label');
|
||||
$('.add_to_order').append('<input type="hidden" name="current_checkin_count" value='+data.length+'><input type="submit" class="btn bg-blue form-actions add_to_charges" value="Charges to Invoice" onclick = "addToOrder(this)" current_checkin_induties_count ='+data.length+'>');
|
||||
data.forEach(function(items) {
|
||||
in_time = changDateFormat(items.in_time);
|
||||
d_type = items.dinning_type.charAt(0);
|
||||
row ='<tr>'
|
||||
+'<td>'+d_type+'-'+items.dinning_id+'</td>'
|
||||
+'<td>'+in_time+'</td>'
|
||||
+'<td><a href="" onclick = "checkout_induty(this)" class="btn checkout_induty" style= "background-color: #3F51B5;"indutyId="'+ items.id +'" >Check Out</a> <a href="" onclick = "remove_induty(this)" class="btn remove_induty" style= "background-color: red;"indutyId="'+ items.id +'" >Remove</a></td>'
|
||||
+'</tr>';
|
||||
|
||||
$('.occupide_dining').append(row);
|
||||
});
|
||||
|
||||
var scrollTo = document.getElementById('show_list_induty_card');
|
||||
$("HTML, body").animate({scrollTop: scrollTo.offsetTop - 60 }, 500 );
|
||||
}
|
||||
});
|
||||
}
|
||||
function getCurrent(row){
|
||||
$(".success-msg").css('display','none');
|
||||
booking_id=document.getElementById("booking_id").value
|
||||
event.preventDefault();
|
||||
getCurrentBooking(booking_id);
|
||||
}
|
||||
function addToOrder(row){
|
||||
event.preventDefault();
|
||||
$(".success-msg").css('display','none');
|
||||
booking_id=document.getElementById("booking_id").value
|
||||
var current_checkin_induties_count = row.getAttribute("current_checkin_induties_count");
|
||||
localStorage.setItem("current_checkin_induties_count",current_checkin_induties_count);
|
||||
var dinning_id = localStorage.getItem('dinning_id');
|
||||
var dinning_type = localStorage.getItem('dinning_type');
|
||||
window.location.href = '/origami/'+dinning_type+'/'+dinning_id;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -796,6 +796,7 @@
|
||||
<script>
|
||||
var cashier_type = "cashier";
|
||||
$(document).ready(function () {
|
||||
// alert(localStorage.getItem("current_checkin_count"));
|
||||
localStorage.removeItem("trans_flag");
|
||||
/* check webview loaded*/
|
||||
var webview = <%= @webview %>;
|
||||
@@ -827,6 +828,7 @@
|
||||
$(".tables").on('click', function () {
|
||||
localStorage.setItem('dinning_type','table');
|
||||
var customer_id = $(".customer-id").text();
|
||||
localStorage.setItem('customer_id',customer_id);
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
@@ -845,6 +847,7 @@
|
||||
$(".rooms").on('click', function () {
|
||||
localStorage.setItem('dinning_type','room');
|
||||
var customer_id = $(".customer-id").text();
|
||||
localStorage.setItem('customer_id',customer_id);
|
||||
show_customer_details(customer_id);
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
@@ -1074,6 +1077,8 @@
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
localStorage.setItem("tax_type", "all");
|
||||
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
|
||||
localStorage.removeItem("current_checkin_induties_count");
|
||||
if(order_id!=undefined && order_id!=null && order_id!=""){
|
||||
if($('#request_bills').is(":visible")) {
|
||||
$('#request_bills').prop("disabled",true);
|
||||
@@ -1081,7 +1086,7 @@
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
data: {current_checkin_induties_count: current_checkin_induties_count},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal({
|
||||
|
||||
@@ -915,6 +915,7 @@ $(document).ready(function(){
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
localStorage.setItem('dinning_type','table');
|
||||
localStorage.setItem('customer_id',customer_id);
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
});
|
||||
|
||||
@@ -934,6 +935,7 @@ $(document).ready(function(){
|
||||
|
||||
var dining_id = $(this).attr("data-id");
|
||||
localStorage.setItem('dinning_type','room');
|
||||
localStorage.setItem('customer_id',customer_id);
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
});
|
||||
|
||||
@@ -1148,6 +1150,8 @@ $('#pay').on('click',function() {
|
||||
});
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
|
||||
localStorage.removeItem("current_checkin_induties_count");
|
||||
var order_id = $('#save_order_id').attr('data-order');
|
||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||
if(order_id!=undefined && order_id!=null && order_id!=""){
|
||||
@@ -1158,7 +1162,7 @@ $('#request_bills').click(function() {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
data: {current_checkin_induties_count: current_checkin_induties_count},
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
swal({
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!--<%= f.label :product_code, 'Product' %>
|
||||
<%= f.collection_select :product_code, MenuItem.all.order('name asc'), :id, :name, {prompt: 'Select a Product'}, {class: 'form-control'} %><br/>-->
|
||||
<%= f.input :name %>
|
||||
<%= f.input :commission_type, :collection => ['Percentage','Net Amount'], prompt: 'Select Commission Type', class: 'form-control' %>
|
||||
<%= f.input :commission_type, :collection => ['Percentage','Net Amount','Basic Pay'], prompt: 'Select Commission Type', class: 'form-control' %>
|
||||
<%= f.input :amount %>
|
||||
<%= f.input :is_active,:class => "filled-in" ,:id => "" %>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.product") %> <%= t("views.right_panel.detail.name_txt2") %></th>
|
||||
<th><%= t("views.right_panel.detail.group") %> <%= t("views.right_panel.detail.name_txt2") %></th>
|
||||
<th><%= t("views.right_panel.detail.commission_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.amount") %></th>
|
||||
<th><%= t("views.right_panel.detail.active") %></th>
|
||||
|
||||
Reference in New Issue
Block a user