route changes

This commit is contained in:
San Wai Lwin
2018-03-13 14:51:07 +06:30
parent 694feb9c06
commit 9228168ebc
49 changed files with 1906 additions and 707 deletions

View File

@@ -34,12 +34,14 @@
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
<button type="submit" class="btn bg-blue waves-effect waves-effect">Search</button>
</div>
<!-- <div class="col-lg-2 col-md-2 col-sm-2 col-xs-12"> -->
<button type="submit" class="btn bg-blue waves-effect waves-effect" style="height: 30%;margin-right: 10px;">Search</button>
<!-- </div> -->
<button type="button" id="member_acc_no" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;">Member Card</button>
<button type="button" id="qr_code" class="btn bg-green btn-sm waves-effect" style="height: 30%;margin-right: 10px;"><%= t("views.btn.qr_code") %></button>
</div>
<% end %>
</div>
@@ -114,6 +116,8 @@
<span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
<input type="hidden" id="page" name="page" value="<%= @page %>" />
<%if !@dining_facility.nil?%>
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
@@ -262,7 +266,8 @@
</div>
</div>
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
var cashier_type = "<%= @cashier_type %>";
var page = "<%= @page %>";
$(function() {
/*$('.datepicker').datepicker({
setDate: '12-12-1999',
@@ -295,22 +300,23 @@
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#search").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "get_customer" ,
url: "/origami/"+sale_id+"/get_customer" ,
data: { filter : customer_mamber_card_no ,type :"card"},
dataType: "json",
success: function(data) {
if (data[0].customer_id == false) {
$.alert({
title: 'Alert!',
content: data[0].message,
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal("Alert!", data[0].message, "error");
// $.alert({
// title: 'Alert!',
// content: data[0].message,
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
}else{
customer_id = data[0].customer_id;
customer_name = data[0].name;
@@ -339,13 +345,33 @@
}
}
// QR Code Reader
$("#qr_code").on('click', function(e){
var code = "";
setTimeout(function(){
code=getQRCode();
setQRCode(code);
},100);
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
}
// get QRCode from Java
function setQRCode(code){
$("#qr_code").text(code);
$("#search").val(code);
}
$(document).on('click',".customer_tr",function(){
// if(this.checked){
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).attr('data-ref');
var customer_name = $(this).children("td:nth-child(3)").text();
console.log(sale_id);
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id, customer_name,sale_id);
@@ -433,7 +459,7 @@
}, function () {
$.ajax({
type: "POST",
url: "update_sale" ,
url: "/origami/"+sale_id+"/"+cashier_type+"/customers/update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
@@ -441,13 +467,25 @@
{
var id = $("#table_id").val();
var type = $("#type").val();
var booking_id = "";
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
<% end %>
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
window.location.href = '/origami/room/'+id
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
}
}else{
if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
}else{
window.location.href = '/origami/room/'+id
}
}
}
}else{
@@ -460,17 +498,25 @@
}
$('#back').on('click',function(){
var id = $("#table_id").val()
var type = $("#type").val()
var sale_id = $("#sale_id").val()
var id = $("#table_id").val();
var type = $("#type").val();
var sale_id = $("#sale_id").val();
if (cashier_type == "quick_service") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
if(page == "pending"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/pending/';
}
else if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id;
}else{
window.location.href = '/origami/room/'+id
}
window.location.href = '/origami/room/'+id;
}
}
}
})