credit payment for quick service

This commit is contained in:
phyusin
2018-07-11 18:32:09 +06:30
parent c67655d1f3
commit c4ab456176
23 changed files with 666 additions and 119 deletions

View File

@@ -10,6 +10,9 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
@@ -44,6 +47,40 @@
<% end %>
</div>
</div>
<!-- Credit Sales Panel -->
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
</div>
<!-- Credit Sales Panel -->
</div>
</div>
</div>
@@ -61,47 +98,64 @@
</div>
</div>
</div>
<script>
cashier_type = "quick_service"
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
})
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
})
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
<!-- script data for credit lists -->
<script type="text/html" id="html_credit_items">
<tr class="row_{key} credit_detail" data-id="{sale_id}" data-type="{cashier_type}">
<td>{receipt_date}</td>
<td>{receipt_no}</td>
<td>{cashier_name}</td>
<td>{customer_name}</td>
<td>{credit_amount}</td>
</tr>
</script>
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
});
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
});
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
warnBeforeRedirect(linkURL);
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
});
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
});
});
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
// Redirect the user
window.location.href = linkURL;
});
}
</script>