Merge branch 'master' of ssh://bitbucket.org/code2lab/sxrestaurant
# Conflicts: # Gemfile.lock
This commit is contained in:
13
Gemfile
13
Gemfile
@@ -9,11 +9,10 @@ end
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '~> 5.1.0'
|
||||
# Use mysql as the database for Active Record
|
||||
|
||||
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||
|
||||
#Use PosgreSQL
|
||||
#gem 'pg'
|
||||
gem 'pg'
|
||||
|
||||
# redis server for cable
|
||||
# gem 'redis', '~> 3.0'
|
||||
@@ -44,9 +43,6 @@ gem 'to_xls-rails'
|
||||
#Reporting gem
|
||||
#gem 'compendium'
|
||||
|
||||
# Pagination
|
||||
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'
|
||||
|
||||
# Use jquery as the JavaScript library
|
||||
gem 'jquery-rails'
|
||||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
||||
@@ -61,7 +57,8 @@ gem 'bcrypt', '~> 3.1.7'
|
||||
gem 'sidekiq'
|
||||
|
||||
# Pagination
|
||||
gem 'kaminari', :git => "git://github.com/amatsuda/kaminari.git", :branch => 'master'
|
||||
gem 'kaminari', '~> 0.16.3'
|
||||
|
||||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano-rails', group: :development
|
||||
@@ -94,4 +91,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
gem 'httparty', '~> 0.15.5'
|
||||
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
gem 'bootstrap-datepicker-rails'
|
||||
|
||||
29
Gemfile.lock
29
Gemfile.lock
@@ -1,21 +1,3 @@
|
||||
GIT
|
||||
remote: git://github.com/amatsuda/kaminari.git
|
||||
revision: bc52ae73d41386d344b5d1b18e689e5a988f1a03
|
||||
branch: master
|
||||
specs:
|
||||
kaminari (1.0.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.0.1)
|
||||
kaminari-activerecord (= 1.0.1)
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-actionview (1.0.1)
|
||||
actionview
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-activerecord (1.0.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.0.1)
|
||||
kaminari-core (1.0.1)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
@@ -104,6 +86,9 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
kaminari (0.16.3)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
listen (3.0.8)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
@@ -119,10 +104,12 @@ GEM
|
||||
minitest (5.10.2)
|
||||
multi_json (1.12.1)
|
||||
multi_xml (0.6.0)
|
||||
mysql2 (0.4.6)
|
||||
nio4r (2.1.0)
|
||||
nokogiri (1.7.2)
|
||||
mini_portile2 (~> 2.1.0)
|
||||
pdf-core (0.7.0)
|
||||
pg (0.20.0)
|
||||
prawn (2.2.2)
|
||||
pdf-core (~> 0.7.0)
|
||||
ttfunk (~> 1.5)
|
||||
@@ -255,8 +242,10 @@ DEPENDENCIES
|
||||
httparty (~> 0.15.5)
|
||||
jbuilder (~> 2.5)
|
||||
jquery-rails
|
||||
kaminari!
|
||||
kaminari (~> 0.16.3)
|
||||
listen (~> 3.0.5)
|
||||
mysql2 (>= 0.3.18, < 0.5)
|
||||
pg
|
||||
prawn
|
||||
prawn-table
|
||||
puma (~> 3.0)
|
||||
@@ -279,4 +268,4 @@ DEPENDENCIES
|
||||
web-console (>= 3.3.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.15.0
|
||||
1.15.1
|
||||
|
||||
@@ -18,3 +18,4 @@
|
||||
//= require cable
|
||||
//= require settings/processing_items
|
||||
//= require bootstrap-datepicker
|
||||
|
||||
|
||||
3
app/assets/javascripts/membership_actions.coffee
Normal file
3
app/assets/javascripts/membership_actions.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -1,102 +0,0 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".orders").on('click', function(){
|
||||
var zone_name=$(this).find(".orders-table").text();
|
||||
var receipt_no=$(this).find(".orders-receipt-no").text();
|
||||
var unique_id=$(this).find(".orders-id").text();
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
|
||||
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||
// clear order items
|
||||
$("#order-items-table").children("tbody").empty();
|
||||
|
||||
// AJAX call for order
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "origami/" + unique_id,
|
||||
data: { 'id' : unique_id },
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier = result[i].cashier_name;
|
||||
receipt_date = result[i].receipt_date;
|
||||
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier==null?"":cashier);
|
||||
$("#receipt_date").text(receipt_date);
|
||||
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += (parse_data.qty*parse_data.price);
|
||||
discount_amount = parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
$("#order-food").text('');
|
||||
$("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
|
||||
$('.orders').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/origami/request_bills/'+ order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
241
app/assets/javascripts/origami.js
Normal file
241
app/assets/javascripts/origami.js
Normal file
@@ -0,0 +1,241 @@
|
||||
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||
// listed below.
|
||||
//
|
||||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
||||
//
|
||||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
||||
//
|
||||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
||||
// about supported directives.
|
||||
//
|
||||
//= require jquery
|
||||
//= require bootstrap
|
||||
//= require jquery_ujs
|
||||
//= require turbolinks
|
||||
//= require cable
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".orders").on('click', function(){
|
||||
var zone_name=$(this).find(".orders-table").text();
|
||||
var receipt_no=$(this).find(".orders-receipt-no").text();
|
||||
var unique_id = $(this).find(".orders-id").text();
|
||||
var order_status=$(this).find(".orders-order-status").text().trim();
|
||||
|
||||
// Enable/Disable Button
|
||||
control_button(order_status);
|
||||
|
||||
//for customer button
|
||||
if(unique_id.charAt(0) == 'S'){
|
||||
$("#customer").removeAttr('disabled');
|
||||
}else{
|
||||
$("#customer").attr('disabled','disabled');
|
||||
}
|
||||
|
||||
var cashier="";
|
||||
var receipt_date="";
|
||||
var sub_total=0;
|
||||
var discount_amount=0;
|
||||
var tax_amount=0;
|
||||
var grand_total_amount=0;
|
||||
|
||||
$("#order-title").text("ORDER DETAILS - " + zone_name);
|
||||
// clear order items
|
||||
$("#order-items-table").children("tbody").empty();
|
||||
|
||||
// AJAX call for order
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "origami/" + unique_id,
|
||||
data: { 'id' : unique_id },
|
||||
success:function(result){
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
|
||||
// Receipt Header
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier = result[i].cashier_name;
|
||||
receipt_date = result[i].receipt_date;
|
||||
|
||||
$("#receipt_no").text(receipt_no);
|
||||
$("#cashier").text(cashier==null?"":cashier);
|
||||
$("#receipt_date").text(receipt_date);
|
||||
|
||||
|
||||
//Receipt Charges
|
||||
sub_total += (parse_data.qty*parse_data.price);
|
||||
discount_amount = parse_data.discount_amount;
|
||||
tax_amount = parse_data.tax_amount;
|
||||
grand_total_amount = parse_data.grand_total_amount;
|
||||
|
||||
$("#order-sub-total").text(sub_total);
|
||||
$("#order-food").text('');
|
||||
$("#order-beverage").text('');
|
||||
$("#order-discount").text(discount_amount);
|
||||
$("#order-Tax").text(tax_amount);
|
||||
$("#order-grand-total").text(grand_total_amount);
|
||||
|
||||
// Ordered Items
|
||||
var order_items_rows = "<tr>" +
|
||||
"<td class='item-name'>" + parse_data.item_name + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty + "</td>" +
|
||||
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
|
||||
"</tr>";
|
||||
|
||||
$("#order-items-table").children("tbody").append(order_items_rows);
|
||||
}
|
||||
}
|
||||
});
|
||||
// End AJAX Call
|
||||
|
||||
$('.orders').removeClass('selected-item');
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
// Bill Request
|
||||
$('#request_bills').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text();
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/request_bills/'+ order_id
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// Discount for Payment
|
||||
$('#discount').click(function() {
|
||||
var order_id=$(".selected-item").find(".orders-id").text();
|
||||
if(order_id!=""){
|
||||
window.location.href = '/origami/discount/'+ order_id
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Pay Discount for Payment
|
||||
$("#pay-discount").on('click', function(){
|
||||
var sale_id = $('#sale-id').text();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var grand_total = $('#order-grand-total').text();
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_value = $('#discount-amount').val();
|
||||
var discount_amount = discount_value;
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_value)/100;
|
||||
}
|
||||
|
||||
var params = {'sale_id': sale_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/origami/discount",
|
||||
data: params,
|
||||
success:function(result){ }
|
||||
});
|
||||
});
|
||||
|
||||
// Payment for Bill
|
||||
$('#pay-bill').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
||||
if(sale_id!=""){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}
|
||||
else {
|
||||
alert("Please select an order!");
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#customer').click(function() {
|
||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
||||
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
|
||||
return false;
|
||||
});
|
||||
|
||||
/* For Receipt - Calculate discount or tax */
|
||||
$('.cashier_number').on('click', function(event){
|
||||
if(event.handled !== true) {
|
||||
var original_value=0;
|
||||
original_value = $('#discount-amount').val();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#discount-amount').val(input_value);
|
||||
update_balance();
|
||||
}
|
||||
else{
|
||||
$('#discount-amount').val(original_value + '' + input_value);
|
||||
update_balance();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#discount-amount').val(amount);
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'del' :
|
||||
var discount_text=$('#discount-amount').val();
|
||||
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#discount-amount').val("0.0");
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* Button Control by Status */
|
||||
function control_button(order_status){
|
||||
if(order_status=="billed"){
|
||||
$("#request_bills").prop('disabled', true);
|
||||
$("#discount").prop('disabled', false);
|
||||
$("#pay-bill").prop('disabled', false);
|
||||
}
|
||||
else if(order_status=="new") {
|
||||
$("#request_bills").prop('disabled', false);
|
||||
$("#discount").prop('disabled', true);
|
||||
$("#pay-bill").prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
/* For Receipt - Update Balance */
|
||||
function update_balance(){
|
||||
var discount_type = $('#discount-type').val();
|
||||
var discount_amount = $('#discount-amount').val();
|
||||
var sub_total = $('#order-sub-total').text();
|
||||
var tax = $('#order-Tax').text();
|
||||
|
||||
// For Percentage Discount
|
||||
if(discount_type == 1){
|
||||
discount_amount=(sub_total*discount_amount)/100;
|
||||
}
|
||||
|
||||
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
|
||||
$('#order-discount').text(discount_amount);
|
||||
$('#order-grand-total').text(total);
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
// $(document).on('touchstart click', '.keypad', function(event){
|
||||
// event.stopPropagation();
|
||||
// event.preventDefault();
|
||||
// if(event.handled !== true) {
|
||||
//
|
||||
// // Do your magic here.
|
||||
// var input_value = $(this).attr("data-value");
|
||||
// switch (input_value) {
|
||||
//
|
||||
// case 'delete':
|
||||
// process_delete_payment();
|
||||
// break;
|
||||
//
|
||||
// case 'foc':
|
||||
// remove_input_action();
|
||||
// $(".foc").attr("data-action","true");
|
||||
// if(customerName.toString() != " "){ //if already chosen customer
|
||||
// if($("#foc_reason_lists").attr("foc_reason") == ' '){
|
||||
// alert("Please! Choose or Add FOC reason");
|
||||
// foc_additional_form();
|
||||
// }
|
||||
// else{
|
||||
// process_foc_payment();
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// alert("Please! Choose or Save Customer");
|
||||
// foc_additional_form();
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case 'nett':
|
||||
// remove_input_action();
|
||||
// $(".nett").attr("data-action","true");
|
||||
// if($(".credit_note_payment").hasClass("payment_selected")){
|
||||
// if(customerName == " "){
|
||||
// alert("Please! Choose or Save Customer");
|
||||
// showCustomer();
|
||||
// }
|
||||
// else{
|
||||
// $("#accept_payment_btn").attr("data-payment","credit");
|
||||
// process_nett_payment();
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// process_nett_payment();
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case 'edit':
|
||||
// process_edit_invoice();
|
||||
// break;
|
||||
//
|
||||
// case 'cancel':
|
||||
// remove_input_action();
|
||||
// var status = $("#label_amountdue").attr("data-status");
|
||||
// if (status != 'completed' && status != 'void'){
|
||||
// $(".cancel").attr("data-action","true");
|
||||
// var message = confirm("Are you sure to void? Please, add reason!");
|
||||
// if (message == true) {
|
||||
// $(".additional_form").hide();
|
||||
// $("#void_sale_additional_form").show();
|
||||
// process_cancel_payment();
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// $(".cancel").addClass("dim");
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case 'ent':
|
||||
// amount_due = parseFloat($("#label_amountdue").attr("data-original"));
|
||||
// other_amt = parseFloat($("#label_cash_amount").attr("data-value"));
|
||||
// credit_amount = parseFloat($("#label_credit_note").text());
|
||||
// if ($(".credit_note_payment").hasClass("payment_selected") && credit_amount > 0){
|
||||
// if(customerName.toString() != " "){
|
||||
// if(credit_amount > (amount_due - other_amt)){
|
||||
// alert("You shouldn't exceed the amount due.");
|
||||
// }
|
||||
// else{
|
||||
// $("#accept_payment_btn").attr("data-payment","credit");
|
||||
// update_balance_due();
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// alert("Please! Choose or Save Customer");
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// update_balance_due();
|
||||
// }
|
||||
//
|
||||
// break;
|
||||
// case 'clear':
|
||||
// process_clear_payment();
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
//
|
||||
// var existing_value = $(".payment_selected span").text();
|
||||
//
|
||||
// if (existing_value == "0" || existing_value == "0.00") { existing_value = ""; }
|
||||
// existing_value = existing_value + input_value;
|
||||
// $(".payment_selected span").text(existing_value);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// event.handled = true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
3
app/assets/javascripts/origami/redeem_payments.coffee
Normal file
3
app/assets/javascripts/origami/redeem_payments.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -0,0 +1,3 @@
|
||||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
@@ -1,3 +1,3 @@
|
||||
// Place all the styles related to the origami/RequestBills controller here.
|
||||
// Place all the styles related to the api/origami/paypar controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/membership_actions.scss
Normal file
3
app/assets/stylesheets/membership_actions.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the membership_actions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -7,17 +7,36 @@
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
.others-payment{
|
||||
line-height:100px;
|
||||
text-align:center;
|
||||
color:white;
|
||||
width:300px;
|
||||
height:100px;
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
.cashier_number{
|
||||
height:76px;
|
||||
line-height:80px;
|
||||
width: 30%;
|
||||
height:71px;
|
||||
line-height:71px;
|
||||
|
||||
text-align:center;
|
||||
background:#54A5AF;
|
||||
float:left;
|
||||
margin:2px;
|
||||
// float:left;
|
||||
// margin:2px;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
// cursor:pointer;
|
||||
}
|
||||
|
||||
.pay{
|
||||
width: 98%;
|
||||
height:210px;
|
||||
line-height:210px;
|
||||
text-align:center;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.cashier_number:hover{
|
||||
@@ -25,7 +44,7 @@
|
||||
}
|
||||
|
||||
.long{
|
||||
width:100%
|
||||
width:49%
|
||||
}
|
||||
|
||||
.sold {
|
||||
@@ -42,17 +61,17 @@
|
||||
}
|
||||
|
||||
.charges-name {
|
||||
width: 80%;
|
||||
width: 80%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
width: 60%;
|
||||
width: 60%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.item-attr {
|
||||
width: 20%;
|
||||
width: 20%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@@ -69,3 +88,16 @@
|
||||
.green{
|
||||
background-color: #009900
|
||||
}
|
||||
|
||||
.left{
|
||||
margin-left:1px;
|
||||
}
|
||||
|
||||
.bottom{
|
||||
margin-bottom: 1px;
|
||||
}
|
||||
/*----- Reset -----*/
|
||||
|
||||
select.form-control {
|
||||
height: inherit !important;
|
||||
}
|
||||
3
app/assets/stylesheets/origami/redeem_payments.scss
Normal file
3
app/assets/stylesheets/origami/redeem_payments.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the origami/redeem_payments controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/settings/membership_actions.scss
Normal file
3
app/assets/stylesheets/settings/membership_actions.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the settings/membership_actions controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -9,11 +9,11 @@ class Api::BillController < Api::ApiController
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@status = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Api::MembershipsController < ActionController::API
|
||||
before :authenticate_token
|
||||
|
||||
|
||||
|
||||
#Add Membership to invoice
|
||||
def create
|
||||
|
||||
|
||||
@@ -4,10 +4,13 @@ class Crm::CustomersController < ApplicationController
|
||||
# GET /crm/customers
|
||||
# GET /crm/customers.json
|
||||
def index
|
||||
@crm_customers = Customer.all
|
||||
@customers = Customer.new
|
||||
@sale_id = 0
|
||||
@crm_customers = Customer.all
|
||||
@crm_customer = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
|
||||
if @membership["status"] == true
|
||||
@member_group = @membership["data"]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @crm_customers }
|
||||
@@ -33,15 +36,67 @@ class Crm::CustomersController < ApplicationController
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
@crm_customer = Customer.new(customer_params)
|
||||
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customer.save
|
||||
format.html { redirect_to @crm_customer, notice: 'Customer was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @crm_customer }
|
||||
if @crm_customers.save
|
||||
|
||||
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
date_of_birth = customer_params[:date_of_birth]
|
||||
membership_id = params[:membership_id]
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||
app_token = membership.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
date_of_birth: date_of_birth,
|
||||
membership_id: membership_id}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
if response["status"] == true
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' }
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: 'Customer was successfully created.' }
|
||||
end
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
else
|
||||
|
||||
@crm_customers.destroy
|
||||
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# format.json { render :index, status: :created, location: @crm_customers }
|
||||
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
|
||||
if params[:sale_id] != 0
|
||||
format.html { redirect_to crm_customers_path}
|
||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||
|
||||
else
|
||||
format.html { redirect_to '/crm/customers/'+params[:sale_id]+'/assign_sale_id', notice: response["message"] }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -49,14 +104,39 @@ class Crm::CustomersController < ApplicationController
|
||||
# PATCH/PUT /crm/customers/1
|
||||
# PATCH/PUT /crm/customers/1.json
|
||||
def update
|
||||
|
||||
respond_to do |format|
|
||||
if @crm_customer.update(customer_params)
|
||||
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
|
||||
|
||||
name = customer_params[:name]
|
||||
phone = customer_params[:contact_no]
|
||||
email = customer_params[:email]
|
||||
date_of_birth = customer_params[:date_of_birth]
|
||||
id = customer_params[:membership_id]
|
||||
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
|
||||
app_token = membership.auth_token.to_s
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
|
||||
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
|
||||
date_of_birth: date_of_birth,
|
||||
id: id}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
|
||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @crm_customer }
|
||||
|
||||
else
|
||||
|
||||
format.html { render :edit }
|
||||
format.json { render json: @crm_customer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,6 +150,23 @@ class Crm::CustomersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /crm/customers/1
|
||||
# DELETE /crm/customers/1.json
|
||||
def get_sale_id
|
||||
|
||||
@sale_id = params[:sale_id]
|
||||
@crm_customers = Customer.all
|
||||
@crm_customer = Customer.new
|
||||
@membership = Customer.get_member_group
|
||||
if @membership["status"] == true
|
||||
@member_group = @membership["data"]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { render action: "index"}
|
||||
format.json { render json: @crm_customers }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_crm_customer
|
||||
@@ -78,6 +175,7 @@ class Crm::CustomersController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def customer_params
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||
|
||||
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_type, :membership_authentication_code)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,22 +3,53 @@ class Crm::HomeController < BaseCrmController
|
||||
|
||||
@booking = Booking.all
|
||||
@customer = Customer.all
|
||||
|
||||
#@booking = Booking.select("bookings.id as booking_id,
|
||||
# bookings.checkin_at,
|
||||
# bookings.checkin_by,
|
||||
# bookings.dining_facility_id,
|
||||
# od.customer_id as customer,
|
||||
# od.id as order_id,
|
||||
# od.item_count as count,
|
||||
# odt.id as order_item_id,
|
||||
# odt.item_name as item_name")
|
||||
# .joins("join booking_orders as bko ON bko.booking_id = bookings.id")
|
||||
# .joins("right join orders as od ON od.id = bko.order_id")
|
||||
# .joins("right join order_items as odt ON odt.order_id=od.id")
|
||||
# .order("bookings.id DESC")
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
#print for crm
|
||||
def print_order
|
||||
|
||||
@booking = Booking.find(params[:id])
|
||||
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
order = Order.find(bo.order_id)
|
||||
#if (order.status == "new")
|
||||
order_items = order_items + order.order_items
|
||||
#end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
unique_code="CrmOrderPdf"
|
||||
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
printer.print_crm_order(@booking,order_items,print_settings)
|
||||
|
||||
end
|
||||
|
||||
def update_sale_by_customer
|
||||
|
||||
sale = Sale.find(params[:sale_id])
|
||||
status = sale.update_attributes(customer_id: params[:customer_id])
|
||||
|
||||
if status == true
|
||||
render json: JSON.generate({:status => true})
|
||||
else
|
||||
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
29
app/controllers/origami/card_payments_controller.rb
Normal file
29
app/controllers/origami/card_payments_controller.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
class Origami::CardPaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
@membership_rebate_balance = 0
|
||||
@membership_id = 0
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.get_paypar_account(membership_setting.gateway_url,membership_setting.auth_token,@membership_id)
|
||||
if membership_data["status"]==true
|
||||
membership_account_data = membership_data["data"];
|
||||
membership_account_data.each do |acc_data|
|
||||
if acc_data["accountable_type"] == "REBATEACCOUNT"
|
||||
@membership_rebate_balance=acc_data["balance"]
|
||||
else
|
||||
@membership_rebate_balance = 0
|
||||
end
|
||||
end
|
||||
else
|
||||
@membership_rebate_balance = 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,6 +1,51 @@
|
||||
class Origami::DiscountsController < BaseOrigamiController
|
||||
|
||||
#discount page show from origami index with selected order
|
||||
def index
|
||||
sale_id = params[:id]
|
||||
if Sale.exists?(sale_id)
|
||||
@sale_data = Sale.find(sale_id)
|
||||
end
|
||||
end
|
||||
|
||||
#discount for selected order
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
discount_type = params[:discount_type]
|
||||
discount_value = params[:discount_value]
|
||||
discount_amount = params[:discount_amount]
|
||||
grand_total = params[:grand_total]
|
||||
|
||||
if discount_type == 0
|
||||
remark="Discount " + discount_amount + " as net"
|
||||
else
|
||||
remark="Discount " + discount_amount + " as percentage"
|
||||
end
|
||||
|
||||
#update discount for sale
|
||||
sale = Sale.find(sale_id)
|
||||
sale.total_discount = discount_amount
|
||||
sale.grand_total = grand_total
|
||||
sale.save
|
||||
|
||||
#save sale item for discount
|
||||
sale_item = SaleItem.new
|
||||
|
||||
#pull
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = 0
|
||||
sale_item.product_name = "Discount"
|
||||
sale_item.remark = remark
|
||||
|
||||
sale_item.qty = 1
|
||||
sale_item.unit_price = (0-discount_amount.to_f)
|
||||
sale_item.taxable_price = discount_amount
|
||||
sale_item.is_taxable = 0
|
||||
|
||||
sale_item.price = sale_item.qty * sale_item.unit_price
|
||||
sale_item.save
|
||||
|
||||
redirect_to origami_root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
17
app/controllers/origami/mpu_controller.rb
Normal file
17
app/controllers/origami/mpu_controller.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Origami::MpuController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
end
|
||||
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,35 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
||||
|
||||
|
||||
def index
|
||||
@membership_rebate_balance = 0
|
||||
@sale_id = params[:sale_id]
|
||||
@payment_method_setting = PaymentMethodSetting.all
|
||||
|
||||
# @sale_id = params[:sale_id]
|
||||
# sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
|
||||
# if sale_data.customer_id
|
||||
# customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
# @membership_id = customer_data.membership_id
|
||||
# if !@membership_id.nil?
|
||||
# membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
# membership_data = SalePayment.get_paypar_account(membership_setting.gateway_url,membership_setting.auth_token,@membership_id)
|
||||
# if membership_data["status"]==true
|
||||
# membership_account_data = membership_data["data"];
|
||||
# membership_account_data.each do |acc_data|
|
||||
# if acc_data["accountable_type"] == "REBATEACCOUNT"
|
||||
# @membership_rebate_balance=acc_data["balance"]
|
||||
# else
|
||||
# @membership_rebate_balance = 0
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
# @membership_rebate_balance = 0
|
||||
# end
|
||||
# end
|
||||
# else
|
||||
|
||||
# end
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -10,14 +10,24 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash)
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
@cash = 0.0
|
||||
@other = 0.0
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
@sale_data.sale_payments.each do |spay|
|
||||
if spay.payment_method == "cash"
|
||||
@cash = spay.payment_amount
|
||||
end
|
||||
if spay.payment_method == "mpu"
|
||||
@other = spay.payment_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
21
app/controllers/origami/paypar_payments_controller.rb
Normal file
21
app/controllers/origami/paypar_payments_controller.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class Origami::PayparPaymentsController < BaseOrigamiController
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
redeem_amount = params[:redeem_amount]
|
||||
membership_id = params[:membership_id]
|
||||
payment_method = "paypar"
|
||||
if(Sale.exists?(sale_id))
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_payment = SalePayment.new
|
||||
status,msg =sale_payment.process_payment(saleObj, @user, redeem_amount,payment_method)
|
||||
if status == true
|
||||
@out = true, "Success!"
|
||||
else
|
||||
@out =false, "Please try again payment!"
|
||||
end
|
||||
else
|
||||
@out = false, "There has no sale record!"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
46
app/controllers/origami/redeem_payments_controller.rb
Normal file
46
app/controllers/origami/redeem_payments_controller.rb
Normal file
@@ -0,0 +1,46 @@
|
||||
class Origami::RedeemPaymentsController < BaseOrigamiController
|
||||
def index
|
||||
@sale_id = params[:sale_id]
|
||||
payment_method = params[:payment_method]
|
||||
@membership_rebate_balance=0
|
||||
sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
if sale_data
|
||||
if sale_data.customer_id
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if customer_data
|
||||
@membership_id = customer_data.membership_id
|
||||
if !@membership_id.nil?
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
if member_actions.gateway_url
|
||||
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id)
|
||||
if membership_data["status"]==true
|
||||
@membership_rebate_balance=membership_data["balance"]
|
||||
@out = true, @membership_rebate_balance,@membership_id
|
||||
end
|
||||
else
|
||||
@out =false,0
|
||||
end
|
||||
else
|
||||
@out = false,0
|
||||
end
|
||||
|
||||
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
else
|
||||
@out = false, 0
|
||||
end
|
||||
@out = false, 0
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,6 @@
|
||||
class Origami::RequestBillsController < BaseOrigamiController
|
||||
|
||||
|
||||
def print
|
||||
@sale = Sale.new
|
||||
sale_order=SaleOrder.new
|
||||
@@ -26,3 +27,5 @@ class Origami::RequestBillsController < BaseOrigamiController
|
||||
redirect_to origami_root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
74
app/controllers/settings/membership_actions_controller.rb
Normal file
74
app/controllers/settings/membership_actions_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Settings::MembershipActionsController < ApplicationController
|
||||
before_action :set_settings_membership_action, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /settings/membership_actions
|
||||
# GET /settings/membership_actions.json
|
||||
def index
|
||||
@settings_membership_actions = MembershipAction.all
|
||||
end
|
||||
|
||||
# GET /settings/membership_actions/1
|
||||
# GET /settings/membership_actions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/membership_actions/new
|
||||
def new
|
||||
@settings_membership_action = MembershipAction.new
|
||||
end
|
||||
|
||||
# GET /settings/membership_actions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/membership_actions
|
||||
# POST /settings/membership_actions.json
|
||||
def create
|
||||
@settings_membership_action = MembershipAction.new(settings_membership_action_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_membership_action.save
|
||||
format.html { redirect_to settings_membership_actions_path, notice: 'Membership action was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_membership_action }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @settings_membership_action.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/membership_actions/1
|
||||
# PATCH/PUT /settings/membership_actions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_membership_action.update(settings_membership_action_params)
|
||||
format.html { redirect_to settings_membership_action_path, notice: 'Membership action was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_membership_action }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_membership_action.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/membership_actions/1
|
||||
# DELETE /settings/membership_actions/1.json
|
||||
def destroy
|
||||
@settings_membership_action.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to settings_membership_actions_url, notice: 'Membership action was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_membership_action
|
||||
@settings_membership_action = MembershipAction.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_membership_action_params
|
||||
params.require(:membership_action).permit(:membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by, :additional_parameter)
|
||||
end
|
||||
end
|
||||
@@ -69,6 +69,6 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_payment_method_setting_params
|
||||
params.require(:payment_method_setting).permit(:payment_method, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id)
|
||||
params.require(:payment_method_setting).permit(:payment_method, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :additional_parameters)
|
||||
end
|
||||
end
|
||||
|
||||
2
app/helpers/api/origami/paypar_helper.rb
Normal file
2
app/helpers/api/origami/paypar_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Api::Origami::PayparHelper
|
||||
end
|
||||
2
app/helpers/origami/paypar_helper.rb
Normal file
2
app/helpers/origami/paypar_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Origami::PayparHelper
|
||||
end
|
||||
2
app/helpers/origami/redeem_payments_helper.rb
Normal file
2
app/helpers/origami/redeem_payments_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Origami::RedeemPaymentsHelper
|
||||
end
|
||||
2
app/helpers/settings/membership_actions_helper.rb
Normal file
2
app/helpers/settings/membership_actions_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Settings::MembershipActionsHelper
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
class OrderQueueProcessorJob < ApplicationJob
|
||||
queue_as :oqs
|
||||
queue_as :default
|
||||
|
||||
def perform(order_id)
|
||||
# Do something later
|
||||
|
||||
@@ -2,7 +2,7 @@ class Account < ApplicationRecord
|
||||
validates_presence_of :title, :account_type
|
||||
|
||||
has_many :menu_items
|
||||
# belongs_to :lookup , :class_name => "Lookup"
|
||||
|
||||
def self.collection
|
||||
Account.select("id, title").map { |e| [e.title, e.id] }
|
||||
end
|
||||
|
||||
@@ -10,21 +10,27 @@ class Customer < ApplicationRecord
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
|
||||
def self.get_member_group
|
||||
|
||||
gateway_url = MembershipSetting.find_by_membership_type("smartpay_url")
|
||||
url = gateway_url.gateway_url.to_s + "/api/get_all_member_group".to_s
|
||||
response = HTTParty.get(url)
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
|
||||
app_token = membership.auth_token.to_s
|
||||
|
||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||
response = HTTParty.get(url,
|
||||
:body => { app_token: app_token}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
puts response.body, response.code, response.message, response.headers.inspect
|
||||
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
# http://192.168.1.47:3006/api/create_membership_customer
|
||||
#get_all_member_group
|
||||
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
2
app/models/membership_action.rb
Normal file
2
app/models/membership_action.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class MembershipAction < ApplicationRecord
|
||||
end
|
||||
@@ -48,7 +48,7 @@ class Order < ApplicationRecord
|
||||
process_order_queue
|
||||
|
||||
#send order to broadcast job
|
||||
send_order_broadcast
|
||||
#send_order_broadcast
|
||||
|
||||
return true, booking
|
||||
|
||||
@@ -208,8 +208,7 @@ class Order < ApplicationRecord
|
||||
OrderBroadcastJob.perform_later(self.id)
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view order type Table
|
||||
|
||||
#Origami: Cashier : to view order Table
|
||||
def self.get_order_table
|
||||
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||
@@ -220,6 +219,8 @@ class Order < ApplicationRecord
|
||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||
end
|
||||
|
||||
#Origami: Cashier : to view booking order Table
|
||||
def self.get_booking_order_table
|
||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||
|
||||
@@ -72,4 +72,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
end
|
||||
|
||||
#Bill Receipt Print
|
||||
def print_crm_order(booking,order_items,setting)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = CrmOrderPdf.new(booking,order_items,setting)
|
||||
pdf.render_file "tmp/print_crm_order.pdf"
|
||||
self.print("tmp/print_crm_order.pdf")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,6 @@ class Sale < ApplicationRecord
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
before_create :generate_custom_id
|
||||
|
||||
#before_create :generate_receipt_no
|
||||
belongs_to :cashier, :optional => true
|
||||
belongs_to :customer, :optional => true
|
||||
@@ -17,7 +16,6 @@ class Sale < ApplicationRecord
|
||||
scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") }
|
||||
|
||||
def generate_invoice_from_booking(booking_id, requested_by)
|
||||
puts "get invoice from booking"
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -33,7 +31,6 @@ class Sale < ApplicationRecord
|
||||
booking.sale_id = sale_id
|
||||
end
|
||||
order = booking.booking_orders.take.order
|
||||
puts "add sale order"
|
||||
link_order_sale(order.id)
|
||||
return status, sale_id
|
||||
end
|
||||
@@ -55,8 +52,8 @@ class Sale < ApplicationRecord
|
||||
generate_receipt_no
|
||||
order = Order.find(order_id)
|
||||
|
||||
#Default - Values
|
||||
self.tax_type = "execlusive"
|
||||
#Default Tax - Values
|
||||
self.tax_type = "exclusive"
|
||||
|
||||
self.requested_by = requested_by
|
||||
self.requested_at = DateTime.now.utc
|
||||
@@ -231,9 +228,10 @@ class Sale < ApplicationRecord
|
||||
def link_order_sale(order_id)
|
||||
#create if it doesn't exist
|
||||
saleOrder = SaleOrder.where("sale_id=? and order_id=?", self.id, order_id).take
|
||||
|
||||
|
||||
if saleOrder.nil?
|
||||
SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||
sale_order = SaleOrder.new
|
||||
sale_order.create_sale_order(self.id, order_id)
|
||||
end
|
||||
# if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
|
||||
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||
@@ -261,6 +259,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_custom_id
|
||||
self.sale_id = SeedGenerator.generate_id(self.class.name, "SAL")
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ class SaleItem < ApplicationRecord
|
||||
|
||||
|
||||
def self.get_order_items_details(sale_id)
|
||||
order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,
|
||||
order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,
|
||||
sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
|
||||
.joins("left join sales on sales.sale_id = sale_items.sale_id")
|
||||
.where("sale_items.sale_id=?",sale_id)
|
||||
|
||||
@@ -2,13 +2,22 @@ class SaleOrder < ApplicationRecord
|
||||
self.primary_key = "sale_order_id"
|
||||
|
||||
#primary key - need to be unique generated for multiple shops
|
||||
before_create :generate_custom_id
|
||||
before_create :generate_sale_order_id
|
||||
|
||||
belongs_to :sale
|
||||
belongs_to :order
|
||||
|
||||
def create_sale_order(sale, order)
|
||||
self.sale_id = sale
|
||||
self.order_id = order
|
||||
self.save
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_order_id = SeedGenerator.generate_id(self.class.name, "SOI")
|
||||
def generate_sale_order_id
|
||||
self.class.name
|
||||
saleOrderId = SeedGenerator.generate_id(self.class.name, "SOI")
|
||||
self.sale_order_id = saleOrderId
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,12 +8,10 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
||||
|
||||
def process_payment(invoice, action_by, cash_amount)
|
||||
def process_payment(invoice, action_by, cash_amount, payment_method)
|
||||
|
||||
self.sale = invoice
|
||||
self.received_amount = cash_amount
|
||||
|
||||
payment_method = "cash"
|
||||
amount_due = invoice.grand_total
|
||||
|
||||
#get all payment for this invoices
|
||||
@@ -54,7 +52,7 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
#record an payment in sale-audit
|
||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{amount} | Payment Status ->#{payment_status}"
|
||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||
|
||||
return true, self.sale
|
||||
@@ -66,6 +64,38 @@ class SalePayment < ApplicationRecord
|
||||
return false, "No outstanding Amount"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def self.get_paypar_account(url,token,membership_id,campaign_type_id)
|
||||
response = HTTParty.get(url,
|
||||
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id)
|
||||
membership_actions_data = MembershipAction.find_by_membership_type("redeem");
|
||||
if !membership_actions_data.nil?
|
||||
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
|
||||
response = HTTParty.post(url,
|
||||
:body => { generic_customer_id:membership_id,total_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:""}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json'
|
||||
}
|
||||
)
|
||||
else
|
||||
response =false;
|
||||
end
|
||||
puts response.to_json
|
||||
return response;
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
@@ -73,10 +103,9 @@ class SalePayment < ApplicationRecord
|
||||
payment_status = false
|
||||
self.payment_method = "cash"
|
||||
self.payment_amount = self.received_amount
|
||||
self.outstanding_amount = self.sale.grand_total - self.received_amount
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
|
||||
sale_update_payment_status(self.received_amount)
|
||||
|
||||
return payment_status
|
||||
@@ -104,7 +133,7 @@ class SalePayment < ApplicationRecord
|
||||
self.payment_method = method
|
||||
self.payment_amount = self.received_amount
|
||||
self.payment_reference = self.card_payment_reference
|
||||
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.payment_status = "paid"
|
||||
payment_method = self.save!
|
||||
|
||||
@@ -148,23 +177,54 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
def paypar_payment
|
||||
##TODO - Integration with Paypar (SmartPay)
|
||||
payment_status = false
|
||||
|
||||
#Next time - validate if the vochure number is valid - within
|
||||
self.payment_method = "paypar"
|
||||
self.payment_amount = self.received_amount
|
||||
self.payment_reference = self.voucher_no
|
||||
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||
self.payment_status = "pending"
|
||||
payment_method = self.save!
|
||||
|
||||
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id)
|
||||
if membership_data["status"]==true
|
||||
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
||||
sale_update_payment_status(self.received_amount.to_f)
|
||||
|
||||
else
|
||||
sale_update_payment_status(0)
|
||||
end
|
||||
|
||||
return payment_status
|
||||
|
||||
end
|
||||
|
||||
def sale_update_payment_status(paid_amount)
|
||||
puts "paid_amount"
|
||||
puts paid_amount
|
||||
#update amount_outstanding
|
||||
self.sale.amount_received = self.sale.amount_received + paid_amount
|
||||
self.sale.amount_changed = amount - self.sale.amount_received
|
||||
if (self.sale.grand_total <= self.sale.amount_received && self.sale.amount_changed > 0)
|
||||
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
||||
self.sale.amount_changed = paid_amount.to_f - self.sale.amount_received.to_f
|
||||
all_received_amount = 0.0
|
||||
sObj = Sale.find(self.sale_id)
|
||||
sObj.sale_payments.each do |spay|
|
||||
all_received_amount += spay.payment_amount.to_f
|
||||
end
|
||||
|
||||
if (self.sale.grand_total <= all_received_amount)
|
||||
self.sale.payment_status = "paid"
|
||||
self.sale.sale_status = "completed"
|
||||
self.sale.save!
|
||||
rebat()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def rebat
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class SeedGenerator < ApplicationRecord
|
||||
|
||||
def self.generate_id(model, prefix)
|
||||
seed = SeedGenerator.find_by_model(model)
|
||||
new_receipt_no = 0
|
||||
|
||||
if (seed.nil?)
|
||||
seed = SeedGenerator.new()
|
||||
seed.model = model
|
||||
@@ -16,8 +18,8 @@ class SeedGenerator < ApplicationRecord
|
||||
end
|
||||
|
||||
padding_len = 15 - prefix.length
|
||||
|
||||
return prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
saleOrderId = prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
return saleOrderId
|
||||
|
||||
end
|
||||
|
||||
|
||||
106
app/pdf/crm_order_pdf.rb
Normal file
106
app/pdf/crm_order_pdf.rb
Normal file
@@ -0,0 +1,106 @@
|
||||
class CrmOrderPdf < Prawn::Document
|
||||
attr_accessor :receipt_width,:price_column_width,:p_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_column_width,:item_description_width
|
||||
def initialize(booking,order_items,print_settings)
|
||||
self.p_width = 200
|
||||
self.page_height = 1450
|
||||
self.margin = 10
|
||||
# self.price_width = self.p_width / 2
|
||||
self.price_width=80
|
||||
self.item_width = self.p_width - self.price_width
|
||||
self.item_height = self.item_height
|
||||
self.qty_column_width = self.p_width / 2
|
||||
self.item_description_width=self.p_width - self.price_width
|
||||
self.receipt_width=130
|
||||
|
||||
@item_width = self.p_width.to_i / 2
|
||||
@qty_width = @item_width.to_i / 3
|
||||
@double = @qty_width * 1.3
|
||||
@half_qty = @qty_width / 2
|
||||
#setting page margin and width
|
||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||
self.header_font_size = 7
|
||||
self.item_font_size = 9
|
||||
|
||||
header( booking.type, booking.dining_facility.name)
|
||||
stroke_horizontal_rule
|
||||
order_detail(booking.checkin_by,booking.checkin_at,booking.dining_facility.name)
|
||||
line_items(order_items)
|
||||
#all_total(order_items)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def header (type, name)
|
||||
text "#{type}", :size => self.header_font_size,:align => :center
|
||||
move_down 5
|
||||
text "#{name}", :size => self.header_font_size,:align => :center
|
||||
# move_down self.item_height
|
||||
move_down 5
|
||||
|
||||
stroke_horizontal_rule
|
||||
|
||||
end
|
||||
|
||||
def order_detail(order_by,order_at,customer)
|
||||
move_down 5
|
||||
move_down 2
|
||||
y_position = cursor
|
||||
qty_column_width = self.p_width * 0.2
|
||||
item_description_width = self.p_width * 0.5
|
||||
price_column_width = self.p_width * 0.3
|
||||
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
pad_top(15) {
|
||||
# @item_width.to_i + @half_qty.to_i
|
||||
text_box "Order By", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
||||
text_box "Order At", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
text_box "Customer", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
|
||||
}
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
y_position = cursor
|
||||
pad_top(15) {
|
||||
|
||||
text_box "#{order_by}", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
text_box "#{order_at.to_i}", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
text_box "#{customer}", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
def line_items(order_items)
|
||||
y_position = cursor
|
||||
qty_column_width = self.p_width * 0.2
|
||||
item_description_width = self.p_width * 0.5
|
||||
price_column_width = self.p_width * 0.3
|
||||
|
||||
|
||||
|
||||
stroke_horizontal_rule
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
pad_top(15) {
|
||||
# @item_width.to_i + @half_qty.to_i
|
||||
text_box "Items", :at =>[0,y_position], :width => @item_width.to_i - @half_qty.to_i , :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size
|
||||
text_box "Price", :at =>[@item_width.to_i - @half_qty.to_i,y_position], :width => @qty_width, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
text_box "Qty", :at =>[@item_width.to_i-@qty_width,y_position], :width => @half_qty, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
text_box "Total", :at =>[@item_width.to_i + @half_qty.to_i,y_position], :width => @double, :height =>15, :overflow => :shrink_to_fix, :size => self.item_font_size, :align => :right
|
||||
|
||||
}
|
||||
|
||||
move_down 5
|
||||
stroke_horizontal_rule
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -8,7 +8,6 @@
|
||||
<%= f.input :contact_no %>
|
||||
<%= f.input :email %>
|
||||
<%= f.input :date_of_birth %>
|
||||
<%= f.input :membership_id, :collection => @membership %>
|
||||
<%= f.input :membership_type %>
|
||||
<%= f.input :membership_authentication_code %>
|
||||
</div>
|
||||
@@ -17,3 +16,5 @@
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- -->
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
||||
<li><a href="<%= crm_root_path %>">Home</a></li>
|
||||
<li class="active">
|
||||
<a href="<%= crm_customers_path %>">Customer</a>
|
||||
</li>
|
||||
<a href="<%= new_crm_customer_path%>" class="btn btn-primary pull-right">
|
||||
<!-- <a href="<%= new_crm_customer_path%>" class="btn btn-primary pull-right">
|
||||
<i class="fa fa-plus-circle fa-lg"></i> Add Customer
|
||||
</a>
|
||||
</a> -->
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-7">
|
||||
<div class="col-lg-8">
|
||||
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive">
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Select</th>
|
||||
<th>Name</th>
|
||||
<th>Company</th>
|
||||
<th>Contact no</th>
|
||||
@@ -32,10 +33,16 @@
|
||||
<tbody>
|
||||
<% @crm_customers.each do |crm_customer| %>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></td>
|
||||
<td><%= crm_customer.name %></td>
|
||||
<td><%= crm_customer.company %></td>
|
||||
<td><%= crm_customer.contact_no %></td>
|
||||
<td><%= crm_customer.email %></td>
|
||||
<td>
|
||||
<%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
@@ -46,55 +53,61 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5">
|
||||
<%= simple_form_for crm_customers_path, :html => { :class => 'form-horizontal' } do |f| %>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
|
||||
<span class="patch_method"></span>
|
||||
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
|
||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :name, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :company, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :email, :class => "form-control col-md-6" %>
|
||||
</div>
|
||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="date_of_birth" class="col-md-6 control-label">Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:class=>"form-control datepicker",:readonly =>true, :value => @date_of_birth%>
|
||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Date Of Birth</label>
|
||||
<%= f.text_field :date_of_birth,:class=>"form-control datepicker date_of_birth",:readonly =>true, :value => @date_of_birth%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.select :membership_id, options_for_select(@membership.collect { |member|
|
||||
[member["id"].name.titleize, member["id"].id] }, 1), {}, { id: 'countries_select' } %>
|
||||
<select class="selectpicker form-control col-md-6" name="membership_id">
|
||||
<select class="selectpicker form-control col-md-12" name="membership_id">
|
||||
<option>Select Member Group</option>
|
||||
<% @membership.each do |member| %>
|
||||
<% @member_group.each do |member| %>
|
||||
<option value="<%= member["id"] %>">
|
||||
<%= member["name"] %></option>
|
||||
<%end %>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.input :membership_type, :class => "form-control col-md-6" %>
|
||||
<%= f.input :membership_type, :class => "form-control col-md-6 membership_type" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.input :membership_authentication_code, :class => "form-control col-md-6" %>
|
||||
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<%= f.button :submit, "Submit", :class => 'btn btn-primary' , :id => 'submit_account' %>
|
||||
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
|
||||
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
|
||||
</div>
|
||||
<%end%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
if (jQuery().datepicker) {
|
||||
@@ -107,4 +120,112 @@
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click',".checkbox_check",function(){
|
||||
if(this.checked){
|
||||
|
||||
var sale_id = $("#sale_id").val() || 0;
|
||||
var customer_id = $(this).val();
|
||||
|
||||
if(sale_id != 0){
|
||||
var url = "../"+customer_id;
|
||||
update_sale(customer_id,sale_id);
|
||||
}else{
|
||||
|
||||
var url = "customers/"+customer_id;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
$('#customer_email').val(data.email);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
|
||||
$('.membership_authentication_code').val(data.membership_authentication_code);
|
||||
|
||||
$('#update_customer').removeAttr('disabled').val('');
|
||||
$('#update_customer').attr('value', 'Update');
|
||||
$('#submit_customer').attr('disabled','disabled');
|
||||
|
||||
$("#new_customer").attr('class', 'simple_form edit_customer');
|
||||
var id = "edit_customer_"+$('#customer_id').val();
|
||||
$("#new_customer").attr('id', id);
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
|
||||
$(".patch_method").append('<input type="hidden" name="_method" value="patch">');
|
||||
//$(".edit_customer").attr('method', 'PATCH');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
function update_sale(customer_id,sale_id) {
|
||||
$.confirm({
|
||||
title: 'Confirm!',
|
||||
content: 'Are You Sure to assign this customer!',
|
||||
buttons: {
|
||||
|
||||
cancel: function () {
|
||||
|
||||
},
|
||||
confirm: {
|
||||
text: 'Confirm',
|
||||
btnClass: 'btn-green',
|
||||
keys: ['enter', 'shift'],
|
||||
action: function(){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "../../update_sale/" ,
|
||||
data: {customer_id:customer_id,sale_id:sale_id},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status == true)
|
||||
{
|
||||
alert('Customer has assigned');
|
||||
window.location.href = '/origami'
|
||||
}else{
|
||||
alert('Record not found!');
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*function changeMethod() {
|
||||
$("#update_customer").attr('method', 'put');
|
||||
}*/
|
||||
|
||||
|
||||
/* $("#update_customer").click(function() {
|
||||
$("#new_customer").attr('class', 'edit_customer');
|
||||
var id = "edit_customer_"+$('#customer_id').val();alert(id);
|
||||
$("#new_customer").attr('id', id);
|
||||
alert(";;")
|
||||
//$('#new_customer').removeClass('new_customer');
|
||||
//$('#new_customer').addClass('edit_customer')
|
||||
}); */
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
<%= @crm_customer.date_of_birth %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Membership:</strong>
|
||||
<%= @crm_customer.membership %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Membership type:</strong>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
json.partial! "crm_customers/crm_customer", crm_customer: @crm_customer
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
<% @i = 0 %>
|
||||
<% @booking.each do |booking| %>
|
||||
<% if booking.booking_status == "assign" %>
|
||||
<% if booking.booking_status == "new" %>
|
||||
<div class="card">
|
||||
<div class="card-block booking_click" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" style="width:100%;">
|
||||
<div class="card-block booking_click" data-id="sfddf" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" >
|
||||
<p class="hidden booking-id"><%= booking.id %></p>
|
||||
<h4 class="card-title">
|
||||
<%= @i += 1 %> . <%= booking.dining_facility.name %>
|
||||
- <%= booking.id %>
|
||||
@@ -36,29 +37,50 @@
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
||||
$(".booking_click").on("click", function(){
|
||||
$(".booking_click").on("click", function(){
|
||||
$(".summary-items tbody tr").remove();
|
||||
$("#cancel").removeAttr("disabled");
|
||||
$("#assign").removeAttr("disabled");
|
||||
|
||||
var booking_id = $(this).find(".booking-id").text();
|
||||
$("#crm_print").val(booking_id);
|
||||
$("#crm_print").removeAttr("disabled");
|
||||
|
||||
var url = $(this).attr('data-ref');
|
||||
show_details(url);
|
||||
});
|
||||
|
||||
$('.assign').click(function(e){
|
||||
});
|
||||
|
||||
$('.crm_print').click(function() {
|
||||
var booking_id = $('#crm_print').val();
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "crm/print/"+booking_id,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.assign').click(function(e){
|
||||
var booking_id = $(this).val()
|
||||
var type = $(this).attr("data-type")
|
||||
|
||||
update_booking(booking_id,type)
|
||||
});
|
||||
});
|
||||
|
||||
$('.cancel').click(function(e){
|
||||
$('.cancel').click(function(e){
|
||||
var booking_id = $(this).val()
|
||||
var type = $(this).attr("data-type")
|
||||
|
||||
update_booking(booking_id,type)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function show_details(url_item){
|
||||
$.ajax({
|
||||
@@ -97,7 +119,7 @@ function show_details(url_item){
|
||||
function update_booking(booking_id,type) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "crm/update_booking/" ,
|
||||
url: "update_booking/" ,
|
||||
data: {booking_id:booking_id,type:type},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<% if booking.booking_status == "assign" %>
|
||||
<div class="card booking_click" data-ref="<%= api_booking_path booking.id%>" id="booking_block">
|
||||
<div class="card-block" id="card-block" style="width:100%;">
|
||||
<p class="hidden booking-id"><%= booking.id %></p>
|
||||
<h4 class="card-title">
|
||||
<%= @i += 1 %> . <%= booking.dining_facility.name %>
|
||||
- <%= booking.id %>
|
||||
|
||||
@@ -92,10 +92,15 @@
|
||||
<!-- Column Three--->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- OQS Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print <br/>Order<br/>Summary</button>
|
||||
<button id="crm_print" value="" disabled="disabled" data-type="assign" class="btn crm_print btn-primary btn-lg btn-block" >
|
||||
Print
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print <br/>Order<br/>Summary</button>
|
||||
<button id="assign" value="" disabled="disabled" data-type="assign" class="btn assign btn-primary btn-lg btn-block">ASSIGN</button>
|
||||
<button id="cancel" value="" disabled="disabled" data-type="cancel" class="btn btn-danger cancel btn-lg btn-block">CANCLE</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<%= render 'layouts/header_crm' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
<div class="alert-danger fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%= message %>
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<li><%= link_to "Membership Setting",settings_membership_settings_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -30,9 +31,14 @@
|
||||
<li><%= link_to "Sales ", crm_root_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<!-- <li class="navbar-nav mr-auto">
|
||||
Reports
|
||||
</li> -->
|
||||
<li class="navbar-nav mr-auto dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to "Daily Sale Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Sales Item Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Receipt Report", origami_root_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<strong>CRM</strong>
|
||||
</div>
|
||||
<div style="float:left;margin-top:3px;text-align:left; width:600px">
|
||||
Queue | Bookings | Online Orders | Customers
|
||||
Queue | Bookings | Online Orders | <%= link_to 'Customer', crm_customers_path, :html=>":color:white" %>
|
||||
</div>
|
||||
|
||||
<div style="float:right; margin-top:3px; text-align:right;width:200px;color:#ffffff">
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'orgiami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'orgiami', 'data-turbolinks-track': 'reload' %>
|
||||
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
178
app/views/origami/discounts/index.html.erb
Normal file
178
app/views/origami/discounts/index.html.erb
Normal file
@@ -0,0 +1,178 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Order Details -->
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||
<p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</td>
|
||||
<th class="item-attr">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% sub_total = 0 %>
|
||||
<% @sale_data.sale_items.each do |sale_item| %>
|
||||
<% sub_total += sale_item.qty*sale_item.unit_price%>
|
||||
<tr>
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-qty"><%=sale_item.qty%></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||
</td>
|
||||
</tr>
|
||||
<%end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Food:</strong></td>
|
||||
<td class="item-attr"><strong id="order-food"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Beverage:</strong></td>
|
||||
<td class="item-attr"><strong id="order-beverage"></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<td class="item-attr"><strong id="order-discount">(<%=@sale_data.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<!-- Discount Amount -->
|
||||
<div class="card row">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">Pay Discount</strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<div class="col-md-3">
|
||||
<select name="discount_type" id="discount-type" class="form-control">
|
||||
<option value=0 >Net</option>
|
||||
<option value=1 >Percentage</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<input type="text" id="discount-amount" name="discount-amount" value="<%= @sale_data.total_discount rescue 0 %>" class="form-control" />
|
||||
</div>
|
||||
</div>
|
||||
<button id="pay-discount" class="btn btn-primary long">Discount</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="500" data-type="add">500</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
@@ -21,23 +21,23 @@
|
||||
<!--- Panel 0 - Table Orders -->
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_orders.each do |bko|
|
||||
<%
|
||||
@booking_orders.each do |bko|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if bko.order_status == 'new'
|
||||
if bko.order_status == 'new'
|
||||
unique_id=bko.booking_id
|
||||
else
|
||||
else
|
||||
unique_id=bko.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= bko.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
@@ -48,12 +48,12 @@
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= bko.order_status %>
|
||||
</span>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
@@ -62,23 +62,23 @@
|
||||
<!--- Panel 1 - Room Orders -->
|
||||
<div class="tab-pane active" id="rooms" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@booking_rooms.each do |rmo|
|
||||
<%
|
||||
@booking_rooms.each do |rmo|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if rmo.order_status == 'new'
|
||||
unique_id=rmo.booking_id
|
||||
else
|
||||
if rmo.order_status == 'new'
|
||||
unique_id=rmo.booking_id
|
||||
else
|
||||
unique_id=rmo.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= rmo.room_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
@@ -89,12 +89,12 @@
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= rmo.order_status %>
|
||||
</span>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
@@ -103,23 +103,23 @@
|
||||
<!--- Panel 2 - Orders -->
|
||||
<div class="tab-pane active" id="orders" role="tabpanel">
|
||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
<%
|
||||
@orders.each do |odr|
|
||||
# Assigned Id for new Order? Sale?
|
||||
unique_id=""
|
||||
# For CSS- Class for Order? Sale?
|
||||
sale_status=""
|
||||
if odr.order_status == 'new'
|
||||
if odr.order_status == 'new'
|
||||
unique_id=odr.booking_id
|
||||
else
|
||||
else
|
||||
unique_id=odr.sale_id
|
||||
sale_status="sold"
|
||||
end
|
||||
end
|
||||
%>
|
||||
<div class="card orders <%= sale_status %>">
|
||||
<div class="card-block">
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
|
||||
<p class="hidden orders-id"><%= unique_id %></p>
|
||||
<h4 class="card-title orders-table"><%= odr.table_name %></h4>
|
||||
<p class="card-text">
|
||||
Receipt No :
|
||||
<span class="orders-receipt-no">
|
||||
@@ -130,16 +130,16 @@
|
||||
Order Status :
|
||||
<span class="orders-order-status">
|
||||
<%= odr.order_status %>
|
||||
</span>
|
||||
</span>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tabs - End -->
|
||||
@@ -157,10 +157,10 @@
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Receipt No: <span id="receipt_no"></span></p>
|
||||
<p>Cashier: <span id="cashier"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<table class="table table-striped" id="order-items-table">
|
||||
@@ -205,7 +205,7 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
@@ -214,12 +214,14 @@
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
||||
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled id="customer" disabled>Customer</button>
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block">Discount</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block">Tax</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
||||
|
||||
<button type="button" id="pay-bill" class="btn btn-primary btn-lg btn-block" disabled>Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,328 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-8">
|
||||
<!-- Column One -->
|
||||
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#orders" role="tab">Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
|
||||
<div class="tab-content" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!-- Panel 1 - Tables -->
|
||||
|
||||
<div class="tab-pane active" id="tables" role="tabpanel">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% if @booking_orders %>
|
||||
<% @booking_orders.each do |booking_order| %>
|
||||
<% if booking_order.order_status != "new" %>
|
||||
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_order.sale_id%>" onclick="callOrderDetails('sale_<%=booking_order.sale_id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span id="table-name-<%=booking_order.sale_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||
<span>Receipt No : <%=booking_order.receipt_no%></span><br/>
|
||||
<span>Order Status : <%=booking_order.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card" id="table-order-<%=booking_order.id%>" onclick="callOrderDetails('order_<%=booking_order.id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span id="table-name-<%=booking_order.id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||
<span>Order Status : <%=booking_order.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 1 - Tables - End -->
|
||||
<!-- Panel 2 - Rooms -->
|
||||
<div class="tab-pane" id="rooms" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% if @booking_rooms %>
|
||||
<% @booking_rooms.each do |booking_room| %>
|
||||
<% if !booking_room.order_status = 'new'%>
|
||||
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('sale_<%=booking_room.id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
||||
<span>Receipt No : <%=booking_room.receipt_no%></span><br/>
|
||||
<span>Order Status : <%=booking_room.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('order_<%=booking_room.id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%>ddd</span></h4> \
|
||||
<span>Order Status : <%=booking_room.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 2 - Rooms - End -->
|
||||
<!-- Panel 3 - Orders -->
|
||||
<div class="tab-pane" id="orders" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:scroll">
|
||||
|
||||
<!--- Booking Items -->
|
||||
<div class="card-columns" style="padding-top:10px">
|
||||
|
||||
<% if @orders %>
|
||||
<% @orders.each do |order| %>
|
||||
<% if !order.order_status = 'new'%>
|
||||
<div style="background-color: green;color: white;" class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('sale_<%=order.order_id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title">
|
||||
<span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
||||
<span>Receipt No : <%=order.receipt_no%></span><br/>
|
||||
<span>Order Status : <%=order.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="card" id="table-order-<%=order.order_id%>" onclick="callOrderDetails('order_<%=order.order_id%>')">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span id="table-name-<%=order.order_id%>" class="table-name">Order No:<%=order.order_id%></span></h4>
|
||||
<span>Order Status : <%=order.order_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%end %>
|
||||
<%end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 3 - Orders - End -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div id="order-title"><strong><span id="receipt-no">ORDER DETAILS</span></strong>
|
||||
<strong><span id ="receipt-date" style="margin-left: 30%"></span></strong></div><br/>
|
||||
<div ><strong><span id="cashier-name"></span></strong><strong><span style="margin-left: 36%" id="order-detail-header"></span></strong></div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:60%; text-align:left">Items</th>
|
||||
<th style="width:20%; text-align:right">QTY</td>
|
||||
<th style="width:20%; text-align:right">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||
<table class="table" id="append-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width:60%; text-align:left">
|
||||
<span id="item-name-price"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-qty"></span>
|
||||
</td>
|
||||
<td style="width:20%; text-align:right">
|
||||
<span id="item-total-price"></span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" style="margin-bottom:0px">
|
||||
<tfooter>
|
||||
<tr>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong>Sub Total</strong></td>
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="sub-total"></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="discount-header"></strong></td>
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="discount_amount"></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="tax-header"></strong></td>
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="tax_amount"></span></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width:80%; text-align:left; border-top:none"><strong><span id="grand-total-header"></strong></td>
|
||||
<td style="width:20%; text-align:right; border-top:none"><strong><span id="grand_total_amount"></span></strong></td>
|
||||
</tr>
|
||||
</tfooter>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three--->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
|
||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button> -->
|
||||
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block">
|
||||
Req.Bill
|
||||
</button>
|
||||
<!-- Cashier Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button>
|
||||
<button type="button" id="pay" class="btn btn-primary btn-lg btn-block" >Pay</button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var old_order_id = 0
|
||||
var old_table_name = ""
|
||||
var table_or_order_id = 0
|
||||
var pay_sale_id = 0
|
||||
|
||||
function callOrderDetails(sale_order_id){
|
||||
var order_id = 0
|
||||
var sale_id = 0
|
||||
var data_val = ""
|
||||
sale_order = sale_order_id.split("_")[0]
|
||||
|
||||
if (sale_order == 'sale') {
|
||||
sale_id = sale_order_id.split("_")[1]
|
||||
url = "origami/"+sale_id
|
||||
data_val = { sale_id: sale_id }
|
||||
sale_or_order_id=sale_id
|
||||
}else{
|
||||
order_id = sale_order_id.split("_")[1]
|
||||
url = "origami/"+order_id
|
||||
data_val = { order_id: sale_order_id.split("_")[1]}
|
||||
sale_or_order_id=order_id
|
||||
}
|
||||
|
||||
table_or_order_id = order_id
|
||||
pay_sale_id = sale_id
|
||||
var tbody = ""
|
||||
|
||||
// clear data in table
|
||||
$("#append-table").html("")
|
||||
|
||||
if (old_order_id != order_id){
|
||||
$("#table-order-"+old_order_id).removeClass("selected_color")
|
||||
$("#table-order-"+order_id).addClass("selected_color")
|
||||
old_order_id = order_id
|
||||
}
|
||||
|
||||
$("#order-detail-header").html("")
|
||||
$("#order-detail-header").append("Table Name : "+document.getElementById("table-name-" + sale_or_order_id).innerHTML)
|
||||
$("#sub-total").html("")
|
||||
$.ajax({type: "GET",
|
||||
url: url,
|
||||
data: data_val,
|
||||
success:function(result){
|
||||
var sub_total = 0
|
||||
var discount_amount = 0
|
||||
var receipt_no = ""
|
||||
var cashier_name = ""
|
||||
var receipt_date = ""
|
||||
var tax_amount = 0
|
||||
var grand_total_amount = 0
|
||||
row = "<tbody>"
|
||||
for (i = 0; i < result.length; i++) {
|
||||
var data = JSON.stringify(result[i]);
|
||||
var parse_data = JSON.parse(data)
|
||||
|
||||
sub_total += (parse_data.qty*parse_data.price)
|
||||
row = '<tr><td style="width:60%; text-align:left"><span id="item-name-price">'+parse_data.item_name+"@"+(parse_data.price*1)+'</span></td>'
|
||||
+'<td style="width:20%; text-align:right"><span id="item-qty">'+(parse_data.qty*1)+'</span></td>s'
|
||||
+'<td style="width:20%; text-align:right"><span id="item-total-price">'+(parse_data.qty*parse_data.price)+'</span></td>'
|
||||
+'</tr>>'
|
||||
tbody += row
|
||||
|
||||
discount_amount = result[i].discount_amount;
|
||||
|
||||
tax_amount = result[i].tax_amount;
|
||||
grand_total_amount = result[i].grand_total_amount;
|
||||
|
||||
receipt_no = result[i].receipt_no;
|
||||
cashier_name = result[i].cashier_name;
|
||||
receipt_date = result[i].receipt_date;
|
||||
}
|
||||
row = "</tbody>";
|
||||
$("#append-table").append(tbody);
|
||||
|
||||
$("#sub-total").append((sub_total)+"<br/>");
|
||||
|
||||
if (discount_amount > 0 ) {
|
||||
$("#discount-header").html("(Discount)");
|
||||
$("#discount_amount").html("("+discount_amount+")");
|
||||
}
|
||||
|
||||
if (tax_amount > 0 ) {
|
||||
$("#tax-header").html("Tax");
|
||||
$("#tax_amount").html(tax_amount);
|
||||
}
|
||||
|
||||
if (grand_total_amount > 0 ) {
|
||||
$("#grand-total-header").html("Grand Total")
|
||||
$("#grand_total_amount").html(grand_total_amount);
|
||||
}
|
||||
|
||||
if (cashier_name == null){
|
||||
cashier_name = "";
|
||||
}
|
||||
|
||||
if(receipt_no != null){
|
||||
$("#receipt-no").html("Receipt No : " + receipt_no);
|
||||
}
|
||||
if (receipt_date != null) {
|
||||
$("#receipt-date").html("Receipt Date : "+receipt_date);
|
||||
}
|
||||
if (cashier_name != null) {
|
||||
$("#cashier-name").html("Cashier Name : "+cashier_name);
|
||||
}
|
||||
},
|
||||
error:function(result){
|
||||
// alert('error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
$('#request_bills').click(function() {
|
||||
console.log(table_or_order_id);
|
||||
window.location.href = '/origami/request_bills/'+ table_or_order_id
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#pay').click(function() {
|
||||
window.location.href = '/origami/sale/'+ pay_sale_id + "/payment"
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.selected_color{
|
||||
color:white;
|
||||
background-color: blue;
|
||||
}
|
||||
</style>
|
||||
5
app/views/origami/mpu/create.json.jbuilder
Normal file
5
app/views/origami/mpu/create.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
if(@status)
|
||||
json.status @status
|
||||
else
|
||||
json.status false
|
||||
end
|
||||
26
app/views/origami/mpu/index.html.erb
Normal file
26
app/views/origami/mpu/index.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<h2> MPU </h2>
|
||||
|
||||
|
||||
Amount :
|
||||
|
||||
<input type="text" name="amount" id="amount" value=""/>
|
||||
|
||||
<button type="submit" id="mpu_pay" > PAY </button>
|
||||
|
||||
<script>
|
||||
$('#mpu_pay').on('click',function(){
|
||||
var amount = $('#amount').val();
|
||||
var sale_id = "<%= @sale_id %>";
|
||||
|
||||
$.ajax({type: "POST",
|
||||
url: "<%= origami_create_mpu_payment_path %>",
|
||||
data: "amount="+ amount + "&sale_id="+ sale_id,
|
||||
success:function(result){
|
||||
if(result){
|
||||
alert("Payment success")
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment";
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@@ -1 +1,19 @@
|
||||
Hello Card Payment
|
||||
<div class="row">
|
||||
|
||||
<div >
|
||||
<div >
|
||||
<% @payment_method_setting.each do |payment_method|%>
|
||||
<div class="purple others-payment bottom left" data-type="<%= payment_method.payment_method %>" id="<%= payment_method.payment_method %>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$('.others-payment').on('click',function(){
|
||||
var input_type = $(this).attr("data-type");
|
||||
var sale_id = $(this).attr("data-sale-id");
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment/" + input_type;
|
||||
})
|
||||
</script>
|
||||
|
||||
1
app/views/origami/payments/create.json.jbuilder
Normal file
1
app/views/origami/payments/create.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.status true
|
||||
@@ -1,25 +1,35 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="col-lg-6 col-md-6 col-sm-3">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div id="order-title">
|
||||
<span><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></span>
|
||||
<span style="margin-left: 24%"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></span>
|
||||
<span><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></span>
|
||||
<span style="margin-left: 27%"><strong>Sale Id</strong> </span><span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="width:60%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
|
||||
<td style="width:40%;"><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>Sale Id</strong> </span><span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Customer :</strong> Default Customer</td>
|
||||
<td><strong>Points :</strong> 1234 </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="card-title">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<table >
|
||||
<!-- <thead> -->
|
||||
<tr>
|
||||
<th style="width:60%; text-align:left">Items</th>
|
||||
<th style="width:20%; text-align:right">QTY</td>
|
||||
<th style="width:20%; text-align:right">Price</td>
|
||||
<th style="width:80%;">Items</th>
|
||||
<th style="width:20%;">QTY</td>
|
||||
<th style="width:20%;">Price</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- </thead> -->
|
||||
</table>
|
||||
</div>
|
||||
<div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll">
|
||||
@@ -71,136 +81,125 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><strong>AMOUNT DUE</strong></div>
|
||||
<div class="col-md-4"><strong><span id="amount_due"><%= @sale_data.grand_total %></span></strong></div>
|
||||
<div class="row" style="margin-top:10px;">
|
||||
<div class="col-md-8"><strong style="font-size:18px;">Amount Due</strong></div>
|
||||
<div class="col-md-4"><strong><span id="amount_due" style="font-size:18px;"><%= @sale_data.grand_total %></span></strong></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8">CASH</div>
|
||||
<div class="col-md-4" id="cash" >0.0</div>
|
||||
<div class="col-md-8">Cash</div>
|
||||
<div class="col-md-4" id="cash" ><%= @cash %></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" id="credit_payment">
|
||||
<div class="col-md-8">CREDIT</div>
|
||||
<div class="col-md-4">0.0</div>
|
||||
<div class="col-md-8">Credit</div>
|
||||
<div class="col-md-4" id="credit">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row" id="card_payment">
|
||||
<div class="col-md-8">OTHERS PAYMENT</div>
|
||||
<div class="col-md-4">0.0</div>
|
||||
<div class="col-md-8">Others Payment</div>
|
||||
<div class="col-md-4" id="others"><%= @other %></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8">BALANCE</div>
|
||||
<div class="col-md-8">Balance</div>
|
||||
<div class="col-md-4"><span id='balance'><%= @sale_data.grand_total %></span></div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
|
||||
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="4" data-type="num">4</div>
|
||||
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
|
||||
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="7" data-type="num">7</div>
|
||||
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
|
||||
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number " data-value="0" data-type="num">0</div>
|
||||
<div class=" cashier_number left" data-value="." data-type="num">.</div>
|
||||
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class=" cashier_number"></div>
|
||||
<div class=" cashier_number red left" data-type="del">Del</div>
|
||||
<div class=" cashier_number green left" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||
<div class="row bottom">
|
||||
<div class="cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
<div class="cashier_number long left" data-value="3000" data-type="add">3000</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
<div class="row bottom">
|
||||
<div class="cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
<div class="cashier_number long left" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
<div class="row bottom">
|
||||
<div class="pay purple" id="pay">Pay</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long purple " id="pay">PAY</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
|
||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
update_balance();
|
||||
})
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#cash').text();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#cash').text();
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#cash').text(input_value);
|
||||
update_balance();
|
||||
}else{
|
||||
$('#cash').append(input_value);
|
||||
update_balance();
|
||||
}
|
||||
break;
|
||||
var input_type = $(this).attr("data-type");
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#cash').text(amount);
|
||||
update_balance();
|
||||
break;
|
||||
|
||||
case 'clr':
|
||||
$('#cash').text("0.0");
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
var input_value = $(this).attr("data-value");
|
||||
if (original_value == "0.0"){
|
||||
$('#cash').text(input_value);
|
||||
update_balance();
|
||||
}else{
|
||||
$('#cash').append(input_value);
|
||||
update_balance();
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#cash').text(amount);
|
||||
update_balance();
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#cash').text();
|
||||
$('#cash').text(cash.substr(0,cash.length-1));
|
||||
update_balance();
|
||||
break;
|
||||
case 'clr':
|
||||
$('#cash').text("0.0");
|
||||
update_balance();
|
||||
break;
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
@@ -218,22 +217,22 @@ $( document ).ready(function() {
|
||||
|
||||
$('#pay').click(function() {
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
alert(" Insufficient Amount!")
|
||||
}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_process_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
alert("THANK YOU")
|
||||
}
|
||||
});
|
||||
|
||||
if($('#balance').text() > 0){
|
||||
alert(" Insufficient Amount!")
|
||||
}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_process_path %>",
|
||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||
success:function(result){
|
||||
alert("Thank you")
|
||||
window.location.href = '/origami';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -242,9 +241,9 @@ $( document ).ready(function() {
|
||||
function update_balance(){
|
||||
var cash = $('#cash').text();
|
||||
var credit = $('#credit').text();
|
||||
var card = $('#card').text();
|
||||
var card = $('#others').text();
|
||||
var amount_due = $('#amount_due').text();
|
||||
var total = cash + credit + card
|
||||
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card)
|
||||
var result = amount_due - total
|
||||
$('#balance').text(result);
|
||||
}
|
||||
|
||||
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.set! :status, @out[0]
|
||||
json.set! :message, @out[1]
|
||||
137
app/views/origami/paypar_payments/index.html.erb
Normal file
137
app/views/origami/paypar_payments/index.html.erb
Normal file
@@ -0,0 +1,137 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card">
|
||||
<% if @membership_id!=0 %>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 long purple " id="redim">Redim Amount</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
<div class="rebate-form" hidden="true">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Valid Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @membership_rebate_balance %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Used Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 cashier_number">DEL</div>
|
||||
<div class="col-md-3 cashier_number">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long purple " id="pay">PAY</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redim").click(function(){
|
||||
$('.rebate-form').removeAttr("hidden");
|
||||
})
|
||||
</script>
|
||||
161
app/views/origami/redeem_payments/index.html.erb
Normal file
161
app/views/origami/redeem_payments/index.html.erb
Normal file
@@ -0,0 +1,161 @@
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||
<div class="card">
|
||||
<div class="rebate-form">
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Valid Amount</label>
|
||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%=@membership_rebate_balance%>" data-value="<%=@sale_id %>" data-member-value="<%= @membership_id %>">
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||
<label class="col-lg-4 col-md-4 col-sm-4">Used Amount</label>
|
||||
<div id="used_amount" class="form-control col-lg-7 col-md-7 col-sm-7">0.0</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-7 col-md-7 col-sm-7">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
|
||||
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div>
|
||||
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="1000" data-type="add">1000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
|
||||
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div>
|
||||
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="5000" data-type="add">5000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
|
||||
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div>
|
||||
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="10000" data-type="add">10000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div>
|
||||
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long" data-value="50000" data-type="add">50000</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-7">
|
||||
<div class="row">
|
||||
<div class="col-md-3 cashier_number"></div>
|
||||
<div class="col-md-3 cashier_number red" data-type="del">DEL</div>
|
||||
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-12 cashier_number long purple" id="redeem" >PAY</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', '.cashier_number', function(event){
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
if(event.handled !== true) {
|
||||
var original_value;
|
||||
original_value = $('#used_amount').text();
|
||||
|
||||
var input_value = $(this).attr("data-value");
|
||||
|
||||
var input_type = $(this).attr("data-type");
|
||||
switch (input_type) {
|
||||
case 'num':
|
||||
if (original_value == "0.0"){
|
||||
$('#used_amount').text(input_value);
|
||||
}else{
|
||||
$('#used_amount').append(input_value);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'add':
|
||||
var input_value = $(this).attr("data-value");
|
||||
amount = parseInt(input_value) + parseInt(original_value);
|
||||
$('#used_amount').html(amount);
|
||||
|
||||
break;
|
||||
case 'clr':
|
||||
$('#used_amount').html("0.0");
|
||||
break;
|
||||
case 'del' :
|
||||
var cash=$('#used_amount').text();
|
||||
$('#used_amount').text(cash.substr(0,cash.length-1));
|
||||
break;
|
||||
|
||||
}
|
||||
event.handled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$("#redeem").click(function(){
|
||||
valid_amount = $("#valid_amount").val();
|
||||
sale_id = $("#valid_amount").attr('data-value');
|
||||
membership_id = $("#valid_amount").attr('data-member-value');
|
||||
redeem_amount = parseInt($("#used_amount").text());
|
||||
if(redeem_amount<=0 ){
|
||||
alert(" Insufficient Amount!")
|
||||
}else if(valid_amount< redeem_amount || redeem_amount == ""){
|
||||
alert("Please type valid amount");
|
||||
}else{
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<%=origami_paypar_payment_process_path%>",
|
||||
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||
success: function(result){
|
||||
if(result.status == true){
|
||||
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||
}else{
|
||||
alert(result.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
</script>
|
||||
18
app/views/settings/membership_actions/_form.html.erb
Normal file
18
app/views/settings/membership_actions/_form.html.erb
Normal file
@@ -0,0 +1,18 @@
|
||||
<%= simple_form_for([:settings,@settings_membership_action]) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :membership_type %>
|
||||
<%= f.input :is_active %>
|
||||
<%= f.input :gateway_communication_type %>
|
||||
<%= f.input :gateway_url %>
|
||||
<%= f.input :auth_token %>
|
||||
<%= f.input :merchant_account_id %>
|
||||
<%= f.input :created_by %>
|
||||
<%= f.input :additional_parameter %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! settings_membership_action, :id, :membership_type, :is_active, :gateway_communication_type, :gateway_url, :auth_token, :merchant_account_id, :created_by, :additional_parameter, :created_at, :updated_at
|
||||
json.url settings_membership_action_url(settings_membership_action, format: :json)
|
||||
6
app/views/settings/membership_actions/edit.html.erb
Normal file
6
app/views/settings/membership_actions/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Settings Membership Action</h1>
|
||||
|
||||
<%= render 'form', settings_membership_action: @settings_membership_action %>
|
||||
|
||||
<%= link_to 'Show', settings_membership_action_path(@settings_membership_action) %> |
|
||||
<%= link_to 'Back', settings_membership_actions_path %>
|
||||
41
app/views/settings/membership_actions/index.html.erb
Normal file
41
app/views/settings/membership_actions/index.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Settings Membership Actions</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Membership type</th>
|
||||
<th>Is active</th>
|
||||
<th>Gateway communication type</th>
|
||||
<th>Gateway url</th>
|
||||
<th>Auth token</th>
|
||||
<th>Merchant account</th>
|
||||
<th>Created by</th>
|
||||
<th>Additional parameter</th>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @settings_membership_actions.each do |settings_membership_action| %>
|
||||
<tr>
|
||||
<td><%= settings_membership_action.membership_type %></td>
|
||||
<td><%= settings_membership_action.is_active %></td>
|
||||
<td><%= settings_membership_action.gateway_communication_type %></td>
|
||||
<td><%= settings_membership_action.gateway_url %></td>
|
||||
<td><%= settings_membership_action.auth_token %></td>
|
||||
<td><%= settings_membership_action.merchant_account_id %></td>
|
||||
<td><%= settings_membership_action.created_by %></td>
|
||||
<td><%= settings_membership_action.additional_parameter %></td>
|
||||
<td><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %></td>
|
||||
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
|
||||
<td><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %>
|
||||
@@ -0,0 +1 @@
|
||||
json.array! @settings_membership_actions, partial: 'settings_membership_actions/settings_membership_action', as: :settings_membership_action
|
||||
5
app/views/settings/membership_actions/new.html.erb
Normal file
5
app/views/settings/membership_actions/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New Settings Membership Action</h1>
|
||||
|
||||
<%= render 'form', settings_membership_action: @settings_membership_action %>
|
||||
|
||||
<%= link_to 'Back', settings_membership_actions_path %>
|
||||
44
app/views/settings/membership_actions/show.html.erb
Normal file
44
app/views/settings/membership_actions/show.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>Membership type:</strong>
|
||||
<%= @settings_membership_action.membership_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Is active:</strong>
|
||||
<%= @settings_membership_action.is_active %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Gateway communication type:</strong>
|
||||
<%= @settings_membership_action.gateway_communication_type %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Gateway url:</strong>
|
||||
<%= @settings_membership_action.gateway_url %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Auth token:</strong>
|
||||
<%= @settings_membership_action.auth_token %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Merchant account:</strong>
|
||||
<%= @settings_membership_action.merchant_account_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Created by:</strong>
|
||||
<%= @settings_membership_action.created_by %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Additional parameter:</strong>
|
||||
<%= @settings_membership_action.additional_parameter %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_settings_membership_action_path(@settings_membership_action) %> |
|
||||
<%= link_to 'Back', settings_membership_actions_path %>
|
||||
1
app/views/settings/membership_actions/show.json.jbuilder
Normal file
1
app/views/settings/membership_actions/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "settings_membership_actions/settings_membership_action", settings_membership_action: @settings_membership_action
|
||||
@@ -8,6 +8,7 @@
|
||||
<%= f.input :gateway_url %>
|
||||
<%= f.input :auth_token %>
|
||||
<%= f.input :merchant_account_id %>
|
||||
<%= f.input :additional_parameters %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -11,10 +11,10 @@ Rails.application.config.assets.version = '1.0'
|
||||
# Rails.application.config.assets.precompile += %w( search.js )
|
||||
|
||||
# --- Waiter/ Cashier - Orgiami ----
|
||||
Rails.application.config.assets.precompile += %w( orgiami.css )
|
||||
Rails.application.config.assets.precompile += %w( orgiami.js )
|
||||
Rails.application.config.assets.precompile += %w( origami.css )
|
||||
Rails.application.config.assets.precompile += %w( origami.js )
|
||||
# -- Order Queue Station -----
|
||||
Rails.application.config.assets.precompile += %w( OQS.css )
|
||||
Rails.application.config.assets.precompile += %w( OQS.js )
|
||||
Rails.application.config.assets.precompile += %w( OQS.js )
|
||||
|
||||
Rails.application.config.assets.precompile += %w( settings.css )
|
||||
|
||||
@@ -2,6 +2,9 @@ require 'sidekiq/web'
|
||||
|
||||
Rails.application.routes.draw do
|
||||
|
||||
namespace :settings do
|
||||
resources :membership_actions
|
||||
end
|
||||
root 'home#index'
|
||||
mount Sidekiq::Web => '/kiq'
|
||||
|
||||
@@ -72,15 +75,20 @@ Rails.application.routes.draw do
|
||||
resources :customers, only: [:index,:new, :create ] #add customer type
|
||||
end
|
||||
|
||||
|
||||
get "/request_bills/:id" => "request_bills#print"
|
||||
get "/discount/:id" => "discounts#index"
|
||||
post "/discount" => "discounts#create"
|
||||
|
||||
#--------- Payment ------------#
|
||||
get 'sale/:sale_id/payment' => 'payments#show'
|
||||
post 'payment_process' => 'payments#create'
|
||||
|
||||
post 'paypar_payment_process' => 'paypar_payments#create'
|
||||
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||
|
||||
# get 'sale/:sale_id/payment/others_payment/:payment_method' => "redeem_payments#index"
|
||||
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
|
||||
post 'create_mpu_payment' => "mpu#create"
|
||||
get 'sale/:sale_id/payment/others_payment/REDEEMREBATE' => "redeem_payments#index"
|
||||
end
|
||||
|
||||
#--------- Waiter/Ordering Station ------------#
|
||||
@@ -93,12 +101,12 @@ Rails.application.routes.draw do
|
||||
#--------- Customer Relationship Management ------------#
|
||||
namespace :crm do
|
||||
root "home#index" #queue number
|
||||
#customers
|
||||
get 'customers/:sale_id/assign_sale_id', to: "customers#get_sale_id", :as => "assign_sale"#get sale id with customer for crm
|
||||
resources :customers
|
||||
#membership
|
||||
#bookings
|
||||
post "update_booking" , to: "bookings#update_booking", as: "update_booking"
|
||||
#queue
|
||||
post "update_booking" , to: "bookings#update_booking", as: "update_booking"#assign and cancel
|
||||
post "update_sale" , to: "home#update_sale_by_customer"#update customer id in sale table
|
||||
get '/print/:id', to: "home#print_order"#print order for crm
|
||||
|
||||
end
|
||||
|
||||
#--------- Order Queue Station ------------#
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
class CreateMenuItems < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :menu_items do |t|
|
||||
|
||||
@@ -13,6 +13,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1]
|
||||
t.string :options
|
||||
t.json :set_menu_items #this parameter is require to route the items correctly
|
||||
t.boolean :taxable, :null => false, :default => true
|
||||
t.string :completed_by
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,7 @@ class CreatePaymentMethodSettings < ActiveRecord::Migration[5.1]
|
||||
t.string :gateway_url
|
||||
t.string :auth_token
|
||||
t.string :merchant_account_id
|
||||
|
||||
t.string :additional_parameters
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class CreateSaleOrders < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :sale_orders, :id => false do |t|
|
||||
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
||||
|
||||
|
||||
t.string :sale_order_id, :limit => 16, :primary_key => true
|
||||
t.string :sale_id, foreign_key: true,:limit => 16
|
||||
t.string :order_id, foreign_key: true, :limit => 16
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
end
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
class OrderItemsCompletedBy < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
add_column :order_items, :completed_by, :string
|
||||
add_column :order_items, :completed_at, :datetime
|
||||
end
|
||||
end
|
||||
@@ -3,10 +3,10 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
||||
create_table :print_settings do |t|
|
||||
t.string :name, :null => false
|
||||
t.string :unique_code, :null => false
|
||||
t.string :template, :null => false
|
||||
t.string :db_name, :null => false
|
||||
t.string :db_type, :null => false
|
||||
t.string :db_username, :null => false
|
||||
t.string :template
|
||||
t.string :db_name
|
||||
t.string :db_type
|
||||
t.string :db_username
|
||||
t.string :db_password
|
||||
t.string :printer_name, :null => false
|
||||
t.string :api_settings
|
||||
|
||||
16
db/migrate/20170611084537_create_membership_actions.rb
Normal file
16
db/migrate/20170611084537_create_membership_actions.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class CreateMembershipActions < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :membership_actions do |t|
|
||||
t.string :membership_type
|
||||
t.boolean :is_active
|
||||
t.string :gateway_communication_type
|
||||
t.string :gateway_url
|
||||
t.string :auth_token
|
||||
t.string :merchant_account_id
|
||||
t.string :created_by
|
||||
t.jsonb :additional_parameter
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
27
db/seeds.rb
27
db/seeds.rb
@@ -107,7 +107,7 @@ menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Sample Men
|
||||
|
||||
#Default Menu items
|
||||
menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"01001-1", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"II0101", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"full portion",item_instance_code:"01001-2", menu_item: menu_category1_menu_item0, price:18.00, is_on_promotion:false}])
|
||||
|
||||
menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
|
||||
@@ -140,9 +140,24 @@ admin_employee = Employee.create({name: "Administrator", role: "Administrator",
|
||||
food = Account.create({title: "Food", account_type: "0"})
|
||||
beverage = Account.create({title: "Beverage", account_type: "1"})
|
||||
|
||||
shop = Shop.create(
|
||||
{name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
||||
country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
|
||||
activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
|
||||
)
|
||||
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||
|
||||
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "192.168.1."})
|
||||
|
||||
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1}},
|
||||
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1}},
|
||||
{membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer"},
|
||||
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer"},
|
||||
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group"},
|
||||
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1}},
|
||||
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data"}
|
||||
])
|
||||
|
||||
# shop = Shop.create(
|
||||
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
||||
# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
|
||||
# activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
|
||||
# )
|
||||
|
||||
|
||||
16
lib/tasks/clear_data.rake
Normal file
16
lib/tasks/clear_data.rake
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace :clear do
|
||||
desc "Clear Data"
|
||||
task :data => :environment do
|
||||
BookingOrder.delete_all
|
||||
Booking.delete_all
|
||||
OrderItem.delete_all
|
||||
AssignedOrderItem.delete_all
|
||||
Order.delete_all
|
||||
SaleOrder.delete_all
|
||||
SaleItem.delete_all
|
||||
Sale.delete_all
|
||||
SaleAudit.delete_all
|
||||
SalePayment.delete_all
|
||||
puts "Clear Data Done."
|
||||
end
|
||||
end
|
||||
5
spec/controllers/api/origami/paypar_controller_spec.rb
Normal file
5
spec/controllers/api/origami/paypar_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::Origami::PayparController, type: :controller do
|
||||
|
||||
end
|
||||
141
spec/controllers/membership_actions_controller_spec.rb
Normal file
141
spec/controllers/membership_actions_controller_spec.rb
Normal file
@@ -0,0 +1,141 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||
# It demonstrates how one might use RSpec to specify the controller code that
|
||||
# was generated by Rails when you ran the scaffold generator.
|
||||
#
|
||||
# It assumes that the implementation code is generated by the rails scaffold
|
||||
# generator. If you are using any extension libraries to generate different
|
||||
# controller code, this generated spec may or may not pass.
|
||||
#
|
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||
# of tools you can use to make these specs even more expressive, but we're
|
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||
#
|
||||
# Compared to earlier versions of this generator, there is very limited use of
|
||||
# stubs and message expectations in this spec. Stubs are only used when there
|
||||
# is no simpler way to get a handle on the object needed for the example.
|
||||
# Message expectations are only used when there is no simpler way to specify
|
||||
# that an instance is receiving a specific message.
|
||||
#
|
||||
# Also compared to earlier versions of this generator, there are no longer any
|
||||
# expectations of assigns and templates rendered. These features have been
|
||||
# removed from Rails core in Rails 5, but can be added back in via the
|
||||
# `rails-controller-testing` gem.
|
||||
|
||||
RSpec.describe MembershipActionsController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# MembershipAction. As you add validations to MembershipAction, be sure to
|
||||
# adjust the attributes here as well.
|
||||
let(:valid_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
let(:invalid_attributes) {
|
||||
skip("Add a hash of attributes invalid for your model")
|
||||
}
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# MembershipActionsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
get :index, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns a success response" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
get :show, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #new" do
|
||||
it "returns a success response" do
|
||||
get :new, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #edit" do
|
||||
it "returns a success response" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
get :edit, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST #create" do
|
||||
context "with valid params" do
|
||||
it "creates a new MembershipAction" do
|
||||
expect {
|
||||
post :create, params: {membership_action: valid_attributes}, session: valid_session
|
||||
}.to change(MembershipAction, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created membership_action" do
|
||||
post :create, params: {membership_action: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(MembershipAction.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, params: {membership_action: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT #update" do
|
||||
context "with valid params" do
|
||||
let(:new_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
it "updates the requested membership_action" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, membership_action: new_attributes}, session: valid_session
|
||||
membership_action.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the membership_action" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, membership_action: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(membership_action)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, membership_action: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested membership_action" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, params: {id: membership_action.to_param}, session: valid_session
|
||||
}.to change(MembershipAction, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the membership_actions list" do
|
||||
membership_action = MembershipAction.create! valid_attributes
|
||||
delete :destroy, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to redirect_to(membership_actions_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
5
spec/controllers/origami/paypar_controller_spec.rb
Normal file
5
spec/controllers/origami/paypar_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Origami::PayparController, type: :controller do
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Origami::RedeemPaymentsController, type: :controller do
|
||||
|
||||
end
|
||||
141
spec/controllers/settings/membership_actions_controller_spec.rb
Normal file
141
spec/controllers/settings/membership_actions_controller_spec.rb
Normal file
@@ -0,0 +1,141 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# This spec was generated by rspec-rails when you ran the scaffold generator.
|
||||
# It demonstrates how one might use RSpec to specify the controller code that
|
||||
# was generated by Rails when you ran the scaffold generator.
|
||||
#
|
||||
# It assumes that the implementation code is generated by the rails scaffold
|
||||
# generator. If you are using any extension libraries to generate different
|
||||
# controller code, this generated spec may or may not pass.
|
||||
#
|
||||
# It only uses APIs available in rails and/or rspec-rails. There are a number
|
||||
# of tools you can use to make these specs even more expressive, but we're
|
||||
# sticking to rails and rspec-rails APIs to keep things simple and stable.
|
||||
#
|
||||
# Compared to earlier versions of this generator, there is very limited use of
|
||||
# stubs and message expectations in this spec. Stubs are only used when there
|
||||
# is no simpler way to get a handle on the object needed for the example.
|
||||
# Message expectations are only used when there is no simpler way to specify
|
||||
# that an instance is receiving a specific message.
|
||||
#
|
||||
# Also compared to earlier versions of this generator, there are no longer any
|
||||
# expectations of assigns and templates rendered. These features have been
|
||||
# removed from Rails core in Rails 5, but can be added back in via the
|
||||
# `rails-controller-testing` gem.
|
||||
|
||||
RSpec.describe Settings::MembershipActionsController, type: :controller do
|
||||
|
||||
# This should return the minimal set of attributes required to create a valid
|
||||
# Settings::MembershipAction. As you add validations to Settings::MembershipAction, be sure to
|
||||
# adjust the attributes here as well.
|
||||
let(:valid_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
let(:invalid_attributes) {
|
||||
skip("Add a hash of attributes invalid for your model")
|
||||
}
|
||||
|
||||
# This should return the minimal set of values that should be in the session
|
||||
# in order to pass any filters (e.g. authentication) defined in
|
||||
# Settings::MembershipActionsController. Be sure to keep this updated too.
|
||||
let(:valid_session) { {} }
|
||||
|
||||
describe "GET #index" do
|
||||
it "returns a success response" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
get :index, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #show" do
|
||||
it "returns a success response" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
get :show, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #new" do
|
||||
it "returns a success response" do
|
||||
get :new, params: {}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET #edit" do
|
||||
it "returns a success response" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
get :edit, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST #create" do
|
||||
context "with valid params" do
|
||||
it "creates a new Settings::MembershipAction" do
|
||||
expect {
|
||||
post :create, params: {settings_membership_action: valid_attributes}, session: valid_session
|
||||
}.to change(Settings::MembershipAction, :count).by(1)
|
||||
end
|
||||
|
||||
it "redirects to the created settings_membership_action" do
|
||||
post :create, params: {settings_membership_action: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(Settings::MembershipAction.last)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'new' template)" do
|
||||
post :create, params: {settings_membership_action: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT #update" do
|
||||
context "with valid params" do
|
||||
let(:new_attributes) {
|
||||
skip("Add a hash of attributes valid for your model")
|
||||
}
|
||||
|
||||
it "updates the requested settings_membership_action" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, settings_membership_action: new_attributes}, session: valid_session
|
||||
membership_action.reload
|
||||
skip("Add assertions for updated state")
|
||||
end
|
||||
|
||||
it "redirects to the settings_membership_action" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, settings_membership_action: valid_attributes}, session: valid_session
|
||||
expect(response).to redirect_to(membership_action)
|
||||
end
|
||||
end
|
||||
|
||||
context "with invalid params" do
|
||||
it "returns a success response (i.e. to display the 'edit' template)" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
put :update, params: {id: membership_action.to_param, settings_membership_action: invalid_attributes}, session: valid_session
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "DELETE #destroy" do
|
||||
it "destroys the requested settings_membership_action" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
expect {
|
||||
delete :destroy, params: {id: membership_action.to_param}, session: valid_session
|
||||
}.to change(Settings::MembershipAction, :count).by(-1)
|
||||
end
|
||||
|
||||
it "redirects to the settings_membership_actions list" do
|
||||
membership_action = Settings::MembershipAction.create! valid_attributes
|
||||
delete :destroy, params: {id: membership_action.to_param}, session: valid_session
|
||||
expect(response).to redirect_to(settings_membership_actions_url)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
15
spec/helpers/api/origami/paypar_helper_spec.rb
Normal file
15
spec/helpers/api/origami/paypar_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Api::Origami::PayparHelper. For example:
|
||||
#
|
||||
# describe Api::Origami::PayparHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Api::Origami::PayparHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/membership_actions_helper_spec.rb
Normal file
15
spec/helpers/membership_actions_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the MembershipActionsHelper. For example:
|
||||
#
|
||||
# describe MembershipActionsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe MembershipActionsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/origami/paypar_helper_spec.rb
Normal file
15
spec/helpers/origami/paypar_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Origami::PayparHelper. For example:
|
||||
#
|
||||
# describe Origami::PayparHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Origami::PayparHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/origami/redeem_payments_helper_spec.rb
Normal file
15
spec/helpers/origami/redeem_payments_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Origami::RedeemPaymentsHelper. For example:
|
||||
#
|
||||
# describe Origami::RedeemPaymentsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Origami::RedeemPaymentsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/settings/membership_actions_helper_spec.rb
Normal file
15
spec/helpers/settings/membership_actions_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Settings::MembershipActionsHelper. For example:
|
||||
#
|
||||
# describe Settings::MembershipActionsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Settings::MembershipActionsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
5
spec/models/membership_action_spec.rb
Normal file
5
spec/models/membership_action_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe MembershipAction, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user