update conflict oragimi.scss
This commit is contained in:
@@ -12,19 +12,20 @@
|
||||
|
||||
<div class="main-box-body clearfix" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<table id="origami-crm-table" class="table table-striped">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<% path ="/origami/#{@sale_id}/customers" %>
|
||||
<%= form_tag path, :method => :get do %>
|
||||
<div class="input-append col-md-12 form-group pull-left">
|
||||
<input type="text" name="filter" style="margin-right:10px" placeholder="Search" class="form-control input-sm col-md-4">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
<%= form_tag path, :id => "filter_form", :method => :get do %>
|
||||
<div class="input-append col-md-7 form-group pull-left">
|
||||
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-9">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Search</button>
|
||||
</div>
|
||||
<% end %>
|
||||
<button id="member_acc_no" class="btn btn-success btn-sm"><span class="fa fa-credit-card"></span> Member Card</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -34,6 +35,7 @@
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
<th>Email</th>
|
||||
<!-- <th>Paypar No</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -54,7 +56,7 @@
|
||||
<td><%= crm_customer.company rescue '-' %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
<td><%= crm_customer.email %></td>
|
||||
|
||||
<!-- <td><%= crm_customer.paypar_account_no %></td> -->
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -89,6 +91,13 @@
|
||||
<span class="help-block" style="margin-top:-10px"><%= str %></span>
|
||||
<% end -%>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Paypar Account No:</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="paypar_account_no" name="customer[paypar_account_no]" readonly />
|
||||
<div class="input-group-addon"><span class="fa fa-credit-card"></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Salutation :</label><br>
|
||||
<label>Mr</label>
|
||||
@@ -121,10 +130,10 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :nrc_no, :class => "form-control nrc_no" %>
|
||||
<%= f.input :nrc_no, :label => "NRC No",:class => "form-control nrc_no" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6 company",:required => true%>
|
||||
<%= f.input :company, :class => "form-control col-md-6 company"%>
|
||||
|
||||
<% flash.each do |name, msg| %>
|
||||
<% str="[\"#{msg['company']}\"]"
|
||||
@@ -192,6 +201,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sxModal">
|
||||
<div id="sxModal-Content"><h3>Card Tap</h3></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('.datepicker').datepicker({
|
||||
@@ -201,8 +214,48 @@
|
||||
});
|
||||
$('.datepicker').attr('ReadOnly','true');
|
||||
$('.datepicker').css('cursor','pointer');
|
||||
|
||||
// Read Card Reader
|
||||
$("#paypar_account_no").on('focus', function(e){
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
},100);
|
||||
});
|
||||
|
||||
// Read Card Reader
|
||||
$("#member_acc_no").on('click', function(e){
|
||||
var cardNo = "";
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_mamber_card_no = 0;
|
||||
$("#sxModal").show();
|
||||
setTimeout(function(){
|
||||
getCardNo();
|
||||
$("#sxModal").hide();
|
||||
customer_mamber_card_no = $("#search").val();
|
||||
|
||||
if(sale_id != 0 && customer_mamber_card_no != 0){
|
||||
update_sale(customer_mamber_card_no,sale_id);
|
||||
}
|
||||
},100);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Read NFC card no from java
|
||||
function getCardNo(){
|
||||
code2lab.readNFC();
|
||||
}
|
||||
|
||||
// get CardNo from Java
|
||||
function setCardNo(cardNo){
|
||||
if(cardNo.length == 16){
|
||||
$("#paypar_account_no").val(cardNo);
|
||||
$("#search").val(cardNo);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click',".customer_tr",function(){
|
||||
// if(this.checked){
|
||||
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||
@@ -217,6 +270,7 @@
|
||||
var url = "customers/"+customer_id;
|
||||
}
|
||||
|
||||
// Need To Clean?
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
@@ -235,6 +289,7 @@
|
||||
|
||||
$('#customer_salutation').val(data.salutation);
|
||||
$('#customer_nrc_no').val(data.nrc_no);
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
|
||||
if (data.gender == 'Male') {
|
||||
$('.male').prop( "checked", true )
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<%
|
||||
sub_total += sale_item.qty*sale_item.unit_price
|
||||
unless sale_item.price == 0
|
||||
if sale_item.price != 0 && sale_item.remark != "void"
|
||||
%>
|
||||
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||
<td style="width:60%; text-align:left">
|
||||
@@ -67,7 +67,12 @@
|
||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
@@ -138,7 +143,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">15%</div>
|
||||
<div class="fluid cashier_number" data-value="15" data-type="add">15%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||
@@ -149,7 +154,7 @@
|
||||
|
||||
<div class="row bottom">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">20%</div>
|
||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||
@@ -160,7 +165,7 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="fluid cashier_number" data-value="50" data-type="add">30%</div>
|
||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div class="col-md-4 cashier_number"></div>
|
||||
@@ -190,6 +195,11 @@
|
||||
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">RemoveItem Discount</button>
|
||||
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
|
||||
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
|
||||
<% if @member_discount%>
|
||||
<hr />
|
||||
<button id="member-discount" class="btn btn-success btn-block action-btn
|
||||
<%= @sale_data.customer.membership_id ? " " : "disabled"%>">Member Discount</button>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -281,7 +291,7 @@ $(document).ready(function(){
|
||||
$("#net").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_value = parseFloat($('#discount-amount').val());
|
||||
var ajax_url = "/origami/" + sale_id + "/discount";
|
||||
|
||||
// Selected Items
|
||||
@@ -328,10 +338,15 @@ $(document).ready(function(){
|
||||
// Remove selected discount items
|
||||
$("#remove-item").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var origin_sub_total = parseFloat($("#order-sub-total").text());
|
||||
var total = 0;
|
||||
|
||||
$('.discount-item-row.selected-item').each(function(i){
|
||||
var amount = parseFloat($(this).find('#item-total-price').text());
|
||||
total = total + Math.abs(amount);
|
||||
$(this).remove();
|
||||
});
|
||||
$("#order-sub-total").text(origin_sub_total + total);
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
@@ -350,13 +365,24 @@ $(document).ready(function(){
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
alert("Successfully Discount!");
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -370,8 +396,19 @@ $(document).ready(function(){
|
||||
// Selected Items
|
||||
var sale_items = get_selected_sale_items();
|
||||
if(sale_items.length == 0){
|
||||
alert("You have no selected item!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "You have no selected item!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
@@ -379,8 +416,19 @@ $(document).ready(function(){
|
||||
discount_items.push(sale_items[i]);
|
||||
}
|
||||
else {
|
||||
alert("You have selected no discount item!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "You have selected no discount item!!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,13 +438,24 @@ $(document).ready(function(){
|
||||
url: "/origami/" + sale_id + "/remove_discount_items",
|
||||
data: params,
|
||||
success: function(result){
|
||||
alert('Removed Discount');
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -408,16 +467,95 @@ $(document).ready(function(){
|
||||
type: "GET",
|
||||
url: "/origami/" + sale_id + "/remove_all_discount",
|
||||
success: function(result){
|
||||
alert('Removed All Discount');
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.status,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Pay Discount for membership
|
||||
$("#member-discount").on('click', function(e){
|
||||
e.preventDefault();
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var ajax_url = "/origami/" + sale_id + "/member_discount";
|
||||
|
||||
// Selected Account
|
||||
//var account_types = JSON.stringify(get_selected_account_types());
|
||||
|
||||
// if($('.accounts-type').hasClass('selected-account') == true){
|
||||
|
||||
// var params = {'sale_id':sale_id, 'sub_total':sub_total, 'account_types':account_types };
|
||||
|
||||
var params = {'sale_id':sale_id, 'sub_total':sub_total };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
success:function(result){
|
||||
|
||||
if (result.status == "Success") {
|
||||
type = 'green'
|
||||
btn_color = 'btn-green'
|
||||
}else{
|
||||
type = 'red'
|
||||
btn_color = 'btn-red'
|
||||
|
||||
}
|
||||
|
||||
$.confirm({
|
||||
title: result.title,
|
||||
content: result.status,
|
||||
columnClass: 'small',
|
||||
type: type,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: btn_color,
|
||||
action: function(){
|
||||
if(result.table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + result.table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + result.table_id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
// }
|
||||
// else{
|
||||
// $.alert({
|
||||
// title: 'Alert!',
|
||||
// content: 'Please Select Account',
|
||||
// type: 'red',
|
||||
// typeAnimated: true,
|
||||
// btnClass: 'btn-danger',
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
});//end member discount
|
||||
});
|
||||
|
||||
/* Remove Selection */
|
||||
@@ -511,10 +649,23 @@ function calculate_overall_discount(type, amount){
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "Percentage Value over 100!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
total_discount = (origin_sub_total * amount)/100;
|
||||
}
|
||||
|
||||
$("#order-discount").text(total_discount);
|
||||
@@ -531,42 +682,43 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
dis_amount = (0 - amount);
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
// No Needs For Auto Selected
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
|
||||
sub_total = origin_sub_total - total_discount;
|
||||
}
|
||||
@@ -574,57 +726,67 @@ function calculate_item_discount(type, amount, sale_items, account_types){
|
||||
// For Percentage Pay
|
||||
if(type == 1){
|
||||
if(amount > 100 ){
|
||||
aler("Percentage Value over 100!");
|
||||
return;
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: "Percentage Value over 100!",
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
if(account_types.length > 0){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(sale_items[i].account_id != account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
|
||||
else{
|
||||
// Check sale items exists
|
||||
if(sale_items.length > 0){
|
||||
for(var i=0;i < sale_items.length;i++){
|
||||
// if(account_types.length > 0){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(sale_items[i].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
dis_amount = 0 - ((sale_items[i].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
}
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
}
|
||||
}
|
||||
|
||||
// No Needs For Auto Selected
|
||||
// Check account types exists
|
||||
if(account_types.length > 0){
|
||||
var item_rows=get_item_rows();
|
||||
console.log(account_types);
|
||||
if(item_rows.length > 0){
|
||||
for(var k=0; k < item_rows.length; k++){
|
||||
for(var j=0; j < account_types.length; j++){
|
||||
if(item_rows[k].account_id == account_types[j].id){
|
||||
// Discount Items
|
||||
dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
$("#order-items-table tbody").append(discount_item_row);
|
||||
total_discount = total_discount + dis_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert("No Items!");
|
||||
}
|
||||
}
|
||||
|
||||
sub_total = origin_sub_total + total_discount;
|
||||
// if(account_types.length > 0){
|
||||
// var item_rows=get_item_rows();
|
||||
// console.log(account_types);
|
||||
// if(item_rows.length > 0){
|
||||
// for(var k=0; k < item_rows.length; k++){
|
||||
// for(var j=0; j < account_types.length; j++){
|
||||
// if(item_rows[k].account_id == account_types[j].id){
|
||||
// // Discount Items
|
||||
// dis_amount = 0 - ((item_rows[k].price * amount)/100);
|
||||
// var discount_item_row = item_row_template(type, item_rows[k], dis_amount, amount);
|
||||
// $("#order-items-table tbody").append(discount_item_row);
|
||||
// total_discount = total_discount + dis_amount;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// alert("No Items!");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
|
||||
@@ -105,10 +105,11 @@
|
||||
</div>
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
||||
<!-- TEMP Disable for BITP -->
|
||||
<!-- <button id="cash_in" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash In </button> -->
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash Out </button>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Close Cashier </button>
|
||||
<button id="cash_in" type="button" class="btn btn-block btn-primary"> Cash In </button>
|
||||
<button id="cash_out" type="button" class="btn btn-block btn-primary"> Cash Out </button>
|
||||
<!-- Temporary Disabled -->
|
||||
<!-- <button id="sale_summary" type="button" class="btn btn-block btn-primary">Sale Sammary</button> -->
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-primary"> Close Cashier </button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
@@ -117,20 +118,28 @@ $(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/table/' + dining_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".sales").on('click',function(){
|
||||
var sale_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/sale/' + sale_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".rooms").on('click', function(){
|
||||
var dining_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/room/' + dining_id;
|
||||
})
|
||||
});
|
||||
|
||||
$(".orders").on('click',function(){
|
||||
var order_id = $(this).attr("data-id");
|
||||
window.location.href = '/origami/order/' + order_id;
|
||||
});
|
||||
|
||||
$('#sale_summary').on('click',function(){
|
||||
window.location.href = '/origami/shift/sale_summary';
|
||||
})
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var timer;
|
||||
|
||||
|
||||
@@ -220,7 +220,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
@@ -470,8 +474,24 @@ $('#request_bills').click(function() {
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
if(!result.status){
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.error_message,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content" style="max-height:570px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane " id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow:auto" >
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||
<div class="tab-content" style="max-height:570px; overflow:auto">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
|
||||
|
||||
<!--- Panel 1 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<div class="card-columns" style="padding-top:10px;" >
|
||||
<% @tables.each do |table| %>
|
||||
<% if table.status == 'occupied' %>
|
||||
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
<!--- Panel 2 - Room Orders -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
|
||||
<% @rooms.each do |room| %>
|
||||
<% if room.status == 'occupied' %>
|
||||
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll" >
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow:auto" >
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@@ -175,7 +175,9 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@selected_item.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
|
||||
@@ -59,7 +59,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||
</tr>
|
||||
<tr class="hidden">
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
json.status true
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-3">
|
||||
<div class="card" >
|
||||
@@ -10,11 +12,12 @@
|
||||
<td style="width:50%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
||||
<td><strong>Table No</strong> - <%=@table_no%></td>
|
||||
<td><strong>Sale Id</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||
<td style="width:50%;"><strong>Customer ID :</strong> <%= @sale_data.customer.customer_id%></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -67,7 +70,12 @@
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"><%=sub_total%></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
||||
<%if @sale_data.discount_type == 'member_discount'%>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong>(Discount)</strong></td>
|
||||
<%end%>
|
||||
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span>(<%=@sale_data.total_discount rescue 0%>)</span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -98,6 +106,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row" style="margin-top:10px;">
|
||||
<div class="col-md-8"><strong style="font-size:18px;">Amount Due</strong></div>
|
||||
@@ -119,7 +128,7 @@
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="row payment other-payment-color" id="card_payment" style="line-height:30px;height: 30px;margin-bottom: 0px;" >
|
||||
<div class="row payment other-payment-color" id="card_payment" >
|
||||
<div class="col-md-12">Other Payments</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -252,6 +261,8 @@
|
||||
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
||||
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -338,29 +349,34 @@ $( document ).ready(function() {
|
||||
|
||||
$('#pay').click(function() {
|
||||
$('#pay').text("Processing, Please wait!")
|
||||
|
||||
$( "#loading_wrapper" ).show();
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
alert(" Insufficient Amount!")
|
||||
$( "#loading_wrapper" ).hide();
|
||||
}else{
|
||||
// payment
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_payment_cash_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
localStorage.removeItem("cash");
|
||||
localStorage.removeItem("cash");
|
||||
if (result.status) {
|
||||
var msg = result.message;
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
var msg = '';
|
||||
}
|
||||
|
||||
$( "#loading_wrapper" ).hide();
|
||||
if($('#balance').text() < 0){
|
||||
$.confirm({
|
||||
title: 'Hi!',
|
||||
title: 'Infomation!',
|
||||
content: 'Changed amount ' + $('#balance').text() * (-1),
|
||||
buttons: {
|
||||
confirm: {
|
||||
@@ -372,12 +388,11 @@ $( document ).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
}
|
||||
else{
|
||||
$('#pay').text("Pay")
|
||||
|
||||
$.confirm({
|
||||
title: 'Hi!',
|
||||
title: 'Infomation!',
|
||||
content: 'Thank you !',
|
||||
buttons: {
|
||||
confirm: {
|
||||
@@ -428,4 +443,4 @@ function update_balance(){
|
||||
$('#balance').text(result.toFixed(2));
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
@@ -1 +1,7 @@
|
||||
json.status true
|
||||
if @status == true
|
||||
#show invoice number and stuff
|
||||
json.status @status
|
||||
else
|
||||
json.status @status
|
||||
json.error_message @error_message
|
||||
end
|
||||
|
||||
@@ -40,7 +40,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -106,7 +106,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -203,7 +203,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @obj != nil && @status_sale == 'sale' && @obj.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@obj.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<% if @status == "sale" %>
|
||||
@@ -457,8 +461,24 @@ $('#request_bills').click(function() {
|
||||
url: ajax_url,
|
||||
// data: 'order_id='+ order_id,
|
||||
success:function(result){
|
||||
|
||||
location.reload();
|
||||
if(!result.status){
|
||||
$.confirm({
|
||||
title: 'Infomation!',
|
||||
content: result.error_message,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green',
|
||||
action: function(){
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -164,7 +164,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -222,6 +226,22 @@ $('#pay').on('click',function() {
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami/';
|
||||
})
|
||||
|
||||
$('#void').on('click',function () {
|
||||
var sure = confirm("Are you sure want to Void");
|
||||
if (sure == true) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
@@ -110,7 +110,7 @@ $(document).on('focusout', '.float-value', function(event){
|
||||
|
||||
$('#open_cashier').on('click',function(){
|
||||
var cashier_terminal = $('#cashier_terminal').val();
|
||||
var amount = $('#total').text();
|
||||
var amount = $('#total').text()||0;
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_shifts_path %>",
|
||||
data: "opening_balance=" + amount + "&cashier_terminal="+ cashier_terminal,
|
||||
|
||||
@@ -40,7 +40,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -106,7 +106,11 @@
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%if @sale.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user