fixed conflict
This commit is contained in:
7
Gemfile
7
Gemfile
@@ -9,13 +9,10 @@ end
|
|||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
|
|
||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
|
gem 'pg'
|
||||||
#gem 'pg'
|
|
||||||
|
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
@@ -61,8 +58,10 @@ gem 'sidekiq'
|
|||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
gem 'kaminari', '~> 0.16.3'
|
gem 'kaminari', '~> 0.16.3'
|
||||||
|
|
||||||
# Datatable
|
# Datatable
|
||||||
gem 'filterrific'
|
gem 'filterrific'
|
||||||
|
|
||||||
# Use Capistrano for deployment
|
# Use Capistrano for deployment
|
||||||
# gem 'capistrano-rails', group: :development
|
# gem 'capistrano-rails', group: :development
|
||||||
|
|
||||||
|
|||||||
@@ -268,4 +268,4 @@ DEPENDENCIES
|
|||||||
web-console (>= 3.3.0)
|
web-console (>= 3.3.0)
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.15.0
|
1.15.1
|
||||||
|
|||||||
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,115 +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();
|
|
||||||
|
|
||||||
//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();
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#customer').click(function() {
|
|
||||||
var sale_id=$(".selected-item").find(".orders-id").text();
|
|
||||||
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
244
app/assets/javascripts/origami.js
Normal file
244
app/assets/javascripts/origami.js
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
// 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").prop('disabled', false);
|
||||||
|
}
|
||||||
|
else if(order_status=="new") {
|
||||||
|
$("#request_bills").prop('disabled', false);
|
||||||
|
$("#discount").prop('disabled', true);
|
||||||
|
$("#pay").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;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
@@ -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.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// 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/
|
||||||
@@ -69,3 +69,10 @@
|
|||||||
.green{
|
.green{
|
||||||
background-color: #009900
|
background-color: #009900
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----- Reset -----*/
|
||||||
|
|
||||||
|
select.form-control {
|
||||||
|
height: inherit !important;
|
||||||
|
}
|
||||||
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/
|
||||||
@@ -57,7 +57,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
date_of_birth = customer_params[:date_of_birth]
|
date_of_birth = customer_params[:date_of_birth]
|
||||||
membership_id = params[:membership_id]
|
membership_id = params[:membership_id]
|
||||||
|
|
||||||
membership = MembershipSetting.find_by_membership_type("smartpay_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
app_token = membership.auth_token.to_s
|
app_token = membership.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + "/api/create_membership_customer".to_s
|
url = membership.gateway_url.to_s + "/api/create_membership_customer".to_s
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
date_of_birth = customer_params[:date_of_birth]
|
date_of_birth = customer_params[:date_of_birth]
|
||||||
id = customer_params[:membership_id]
|
id = customer_params[:membership_id]
|
||||||
|
|
||||||
membership = MembershipSetting.find_by_membership_type("smartpay_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
app_token = membership.auth_token.to_s
|
app_token = membership.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + "/api/update_membership_customer".to_s
|
url = membership.gateway_url.to_s + "/api/update_membership_customer".to_s
|
||||||
|
|
||||||
|
|||||||
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
|
class Origami::DiscountsController < BaseOrigamiController
|
||||||
|
|
||||||
|
#discount page show from origami index with selected order
|
||||||
def index
|
def index
|
||||||
|
sale_id = params[:id]
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
@sale_data = Sale.find(sale_id)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#discount for selected order
|
||||||
def create
|
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
|
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
|
end
|
||||||
|
|||||||
@@ -2,6 +2,34 @@ class Origami::OthersPaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
|
|
||||||
def index
|
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
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash)
|
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
22
app/controllers/origami/paypar_payments_controller.rb
Normal file
22
app/controllers/origami/paypar_payments_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
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
|
||||||
@@ -26,6 +26,6 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
|
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer_name)
|
||||||
redirect_to origami_root_path
|
redirect_to origami_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
111
app/controllers/settings/membership_actions_controller.rb
Normal file
111
app/controllers/settings/membership_actions_controller.rb
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
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
|
||||||
|
type = params[:type]
|
||||||
|
@sale_id = params[:sale_id]
|
||||||
|
if type.nil?
|
||||||
|
@settings_membership_actions = Settings::MembershipAction.all
|
||||||
|
else
|
||||||
|
membership_actions_data=Settings::MembershipAction.find_by_membership_type(type)
|
||||||
|
|
||||||
|
if !membership_actions_data.nil?
|
||||||
|
url = params[:gateway_url].to_s + membership_actions_data.gateway_url.to_s
|
||||||
|
puts url.to_json
|
||||||
|
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
|
||||||
|
@campaign_type_id =1
|
||||||
|
if !@membership_id.nil?
|
||||||
|
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
|
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
|
||||||
|
else
|
||||||
|
@out = false, 0
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@out = false, 0
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@out =false, 0
|
||||||
|
end
|
||||||
|
# campaign_type_id=1
|
||||||
|
# get_account_data = MembershipAction.get_account_data(url)
|
||||||
|
else
|
||||||
|
@out = false, 0
|
||||||
|
end
|
||||||
|
render :json => @out.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
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 = Settings::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 = Settings::MembershipAction.new(settings_membership_action_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @settings_membership_action.save
|
||||||
|
format.html { redirect_to @settings_membership_action, 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, 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 = Settings::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(:settings_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.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def settings_payment_method_setting_params
|
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
|
||||||
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/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
|
class OrderQueueProcessorJob < ApplicationJob
|
||||||
queue_as :oqs
|
queue_as :default
|
||||||
|
|
||||||
def perform(order_id)
|
def perform(order_id)
|
||||||
# Do something later
|
# Do something later
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class Customer < ApplicationRecord
|
|||||||
|
|
||||||
def self.get_member_group
|
def self.get_member_group
|
||||||
|
|
||||||
membership = MembershipSetting.find_by_membership_type("smartpay_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
app_token = membership.auth_token.to_s
|
app_token = membership.auth_token.to_s
|
||||||
|
|
||||||
url = membership.gateway_url.to_s + "/api/get_all_member_group".to_s
|
url = membership.gateway_url.to_s + "/api/get_all_member_group".to_s
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class Order < ApplicationRecord
|
|||||||
process_order_queue
|
process_order_queue
|
||||||
|
|
||||||
#send order to broadcast job
|
#send order to broadcast job
|
||||||
send_order_broadcast
|
#send_order_broadcast
|
||||||
|
|
||||||
return true, booking
|
return true, booking
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class Sale < ApplicationRecord
|
|||||||
generate_receipt_no
|
generate_receipt_no
|
||||||
order = Order.find(order_id)
|
order = Order.find(order_id)
|
||||||
|
|
||||||
#Default - Values
|
#Default Tax - Values
|
||||||
self.tax_type = "execlusive"
|
self.tax_type = "exclusive"
|
||||||
|
|
||||||
self.requested_by = requested_by
|
self.requested_by = requested_by
|
||||||
self.requested_at = DateTime.now.utc
|
self.requested_at = DateTime.now.utc
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SaleItem < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
def self.get_order_items_details(sale_id)
|
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")
|
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")
|
.joins("left join sales on sales.sale_id = sale_items.sale_id")
|
||||||
.where("sale_items.sale_id=?",sale_id)
|
.where("sale_items.sale_id=?",sale_id)
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
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.sale = invoice
|
||||||
self.received_amount = cash_amount
|
self.received_amount = cash_amount
|
||||||
|
|
||||||
payment_method = "cash"
|
|
||||||
amount_due = invoice.grand_total
|
amount_due = invoice.grand_total
|
||||||
|
|
||||||
#get all payment for this invoices
|
#get all payment for this invoices
|
||||||
@@ -54,7 +52,7 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#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)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||||
|
|
||||||
return true, self.sale
|
return true, self.sale
|
||||||
@@ -66,6 +64,38 @@ class SalePayment < ApplicationRecord
|
|||||||
return false, "No outstanding Amount"
|
return false, "No outstanding Amount"
|
||||||
end
|
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,campaign_type_id)
|
||||||
|
membership_actions_data = Settings::MembershipAction.find_by_membership_type("redeem_url");
|
||||||
|
if !membership_actions_data.nil?
|
||||||
|
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
|
||||||
|
campaign_type_id = 1
|
||||||
|
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
|
||||||
|
|
||||||
|
return response;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -73,7 +103,7 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status = false
|
payment_status = false
|
||||||
self.payment_method = "cash"
|
self.payment_method = "cash"
|
||||||
self.payment_amount = self.received_amount
|
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"
|
self.payment_status = "paid"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
@@ -148,16 +178,37 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def paypar_payment
|
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!
|
||||||
|
|
||||||
|
campaign_type_id =1;
|
||||||
|
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,campaign_type_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
|
end
|
||||||
|
|
||||||
def sale_update_payment_status(paid_amount)
|
def sale_update_payment_status(paid_amount)
|
||||||
puts "paid_amount"
|
|
||||||
puts paid_amount
|
|
||||||
#update amount_outstanding
|
#update amount_outstanding
|
||||||
self.sale.amount_received = self.sale.amount_received + paid_amount
|
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
||||||
self.sale.amount_changed = amount - self.sale.amount_received
|
self.sale.amount_changed = paid_amount.to_f - self.sale.amount_received
|
||||||
if (self.sale.grand_total <= self.sale.amount_received && self.sale.amount_changed > 0)
|
if (self.sale.grand_total <= self.sale.amount_received.to_f && self.sale.amount_changed.to_f > 0)
|
||||||
self.sale.payment_status = "paid"
|
self.sale.payment_status = "paid"
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
self.sale.save!
|
self.sale.save!
|
||||||
|
|||||||
2
app/models/settings/membership_action.rb
Normal file
2
app/models/settings/membership_action.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
class Settings::MembershipAction < ApplicationRecord
|
||||||
|
end
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<li><%= link_to "Membership Setting",settings_membership_settings_path, :tabindex =>"-1" %></li>
|
<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 "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 "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||||
|
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -30,9 +31,14 @@
|
|||||||
<li><%= link_to "Sales ", crm_root_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales ", crm_root_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<!-- <li class="navbar-nav mr-auto">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
Reports
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||||
</li> -->
|
<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>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<title>SmartSales : Restaurant</title>
|
<title>SmartSales : Restaurant</title>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
<%= stylesheet_link_tag 'orgiami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<%= javascript_include_tag 'orgiami', 'data-turbolinks-track': 'reload' %>
|
<%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<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>
|
||||||
@@ -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>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>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>Move</button>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-lg btn-block" disabled="disabled">Customer</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" id="request_bills" class="btn btn-primary btn-lg btn-block">Req.Bill</button>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block">Discount</button>
|
<button type="button" id="discount" 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" 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" id="pay-bill" 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>
|
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1 +1,177 @@
|
|||||||
Hello Card Payment
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-3">
|
||||||
|
<div class="card">
|
||||||
|
<% @payment_method_setting.each do |payment_method|%>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="col-md-12 long purple " id="<%= payment_method.payment_method%>" data-url="<%=payment_method.gateway_url%>" data-sale-id="<%= @sale_id%>"><%= payment_method.payment_method %></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="">
|
||||||
|
</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="redeem" data-value="<%=@sale_id %>" data-member-value = "<%= @membership_id %>">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;
|
||||||
|
|
||||||
|
}
|
||||||
|
// event.handled = true;
|
||||||
|
// } else {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#REDIMREBATE").click(function(){
|
||||||
|
$('.rebate-form').removeAttr("hidden");
|
||||||
|
gateway_url = $(this).attr("data-url");
|
||||||
|
sale_id = $(this).attr("data-sale-id");
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "../../../../settings/membership_actions",
|
||||||
|
data: {type:"get_account_balance_url",gateway_url:gateway_url,sale_id:sale_id},
|
||||||
|
success: function(result){
|
||||||
|
$("#valid_amount").val(result[1]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#redeem").click(function(){
|
||||||
|
valid_amount = $("#valid_amount").val();
|
||||||
|
sale_id = $("#REDIMREBATE").attr("data-sale-id");
|
||||||
|
membership_id = $(this).attr("data-member-value");
|
||||||
|
redeem_amount = parseInt($("#used_amount").text());
|
||||||
|
if(redeem_amount<=0){
|
||||||
|
alert(" Insufficient Amount!")
|
||||||
|
}else if(valid_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>
|
||||||
@@ -165,8 +165,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
event.stopPropagation();
|
|
||||||
event.preventDefault();
|
|
||||||
if(event.handled !== true) {
|
if(event.handled !== true) {
|
||||||
var original_value;
|
var original_value;
|
||||||
original_value = $('#cash').text();
|
original_value = $('#cash').text();
|
||||||
@@ -184,14 +182,17 @@ $(document).on('click', '.cashier_number', function(event){
|
|||||||
update_balance();
|
update_balance();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'add':
|
case 'add':
|
||||||
var input_value = $(this).attr("data-value");
|
var input_value = $(this).attr("data-value");
|
||||||
amount = parseInt(input_value) + parseInt(original_value);
|
amount = parseInt(input_value) + parseInt(original_value);
|
||||||
$('#cash').text(amount);
|
$('#cash').text(amount);
|
||||||
update_balance();
|
update_balance();
|
||||||
break;
|
break;
|
||||||
|
case 'del' :
|
||||||
|
var cash=$('#cash').text();
|
||||||
|
$('#cash').text(cash.substr(0,cash.length-1));
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
case 'clr':
|
case 'clr':
|
||||||
$('#cash').text("0.0");
|
$('#cash').text("0.0");
|
||||||
update_balance();
|
update_balance();
|
||||||
@@ -233,7 +234,6 @@ $( document ).ready(function() {
|
|||||||
alert("THANK YOU")
|
alert("THANK YOU")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
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>
|
||||||
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_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 %> |
|
||||||
|
<%= 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 %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %></td>
|
||||||
|
<td><%= link_to 'Destroy', 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 :gateway_url %>
|
||||||
<%= f.input :auth_token %>
|
<%= f.input :auth_token %>
|
||||||
<%= f.input :merchant_account_id %>
|
<%= f.input :merchant_account_id %>
|
||||||
|
<%= f.input :additional_parameters %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ Rails.application.config.assets.version = '1.0'
|
|||||||
# Rails.application.config.assets.precompile += %w( search.js )
|
# Rails.application.config.assets.precompile += %w( search.js )
|
||||||
|
|
||||||
# --- Waiter/ Cashier - Orgiami ----
|
# --- Waiter/ Cashier - Orgiami ----
|
||||||
Rails.application.config.assets.precompile += %w( orgiami.css )
|
Rails.application.config.assets.precompile += %w( origami.css )
|
||||||
Rails.application.config.assets.precompile += %w( orgiami.js )
|
Rails.application.config.assets.precompile += %w( origami.js )
|
||||||
# -- Order Queue Station -----
|
# -- Order Queue Station -----
|
||||||
Rails.application.config.assets.precompile += %w( OQS.css )
|
Rails.application.config.assets.precompile += %w( OQS.css )
|
||||||
Rails.application.config.assets.precompile += %w( OQS.js )
|
Rails.application.config.assets.precompile += %w( OQS.js )
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ require 'sidekiq/web'
|
|||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
|
||||||
|
namespace :settings do
|
||||||
|
resources :membership_actions
|
||||||
|
end
|
||||||
root 'home#index'
|
root 'home#index'
|
||||||
mount Sidekiq::Web => '/kiq'
|
mount Sidekiq::Web => '/kiq'
|
||||||
|
|
||||||
@@ -74,12 +77,14 @@ Rails.application.routes.draw do
|
|||||||
resources :customers, only: [:index,:new, :create ] #add customer type
|
resources :customers, only: [:index,:new, :create ] #add customer type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
get "/request_bills/:id" => "request_bills#print"
|
get "/request_bills/:id" => "request_bills#print"
|
||||||
|
get "/discount/:id" => "discounts#index"
|
||||||
|
post "/discount" => "discounts#create"
|
||||||
|
|
||||||
|
#--------- Payment ------------#
|
||||||
get 'sale/:sale_id/payment' => 'payments#show'
|
get 'sale/:sale_id/payment' => 'payments#show'
|
||||||
post 'payment_process' => 'payments#create'
|
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/credit_payment' => "credit_payments#index"
|
||||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
|
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
|
add_column :order_items, :completed_by, :string
|
||||||
end
|
end
|
||||||
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|
|
create_table :print_settings do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :unique_code, :null => false
|
t.string :unique_code, :null => false
|
||||||
t.string :template, :null => false
|
t.string :template
|
||||||
t.string :db_name, :null => false
|
t.string :db_name
|
||||||
t.string :db_type, :null => false
|
t.string :db_type
|
||||||
t.string :db_username, :null => false
|
t.string :db_username
|
||||||
t.string :db_password
|
t.string :db_password
|
||||||
t.string :printer_name, :null => false
|
t.string :printer_name, :null => false
|
||||||
t.string :api_settings
|
t.string :api_settings
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
class CreateSettingsMembershipActions < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
create_table :settings_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.string :additional_parameter
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class Additionparametertopaymentsettings < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
add_column :payment_method_settings, :additional_parameters, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
14
db/seeds.rb
14
db/seeds.rb
@@ -140,9 +140,13 @@ admin_employee = Employee.create({name: "Administrator", role: "Administrator",
|
|||||||
food = Account.create({title: "Food", account_type: "0"})
|
food = Account.create({title: "Food", account_type: "0"})
|
||||||
beverage = Account.create({title: "Beverage", account_type: "1"})
|
beverage = Account.create({title: "Beverage", account_type: "1"})
|
||||||
|
|
||||||
shop = Shop.create(
|
order_station1=PrintSetting.create({name: "OrderItemPdf", unique_code: "OrderItemPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
{name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
|
order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSummaryPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
|
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
|
||||||
activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
|
|
||||||
)
|
# 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"}
|
||||||
|
# )
|
||||||
|
|
||||||
|
|||||||
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
|
||||||
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/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
|
||||||
5
spec/models/settings/membership_action_spec.rb
Normal file
5
spec/models/settings/membership_action_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Settings::MembershipAction, type: :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
10
spec/requests/membership_actions_spec.rb
Normal file
10
spec/requests/membership_actions_spec.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "MembershipActions", type: :request do
|
||||||
|
describe "GET /membership_actions" do
|
||||||
|
it "works! (now write some real specs)" do
|
||||||
|
get membership_actions_path
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
10
spec/requests/settings/settings_membership_actions_spec.rb
Normal file
10
spec/requests/settings/settings_membership_actions_spec.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "Settings::MembershipActions", type: :request do
|
||||||
|
describe "GET /settings_membership_actions" do
|
||||||
|
it "works! (now write some real specs)" do
|
||||||
|
get settings_membership_actions_path
|
||||||
|
expect(response).to have_http_status(200)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
39
spec/routing/membership_actions_routing_spec.rb
Normal file
39
spec/routing/membership_actions_routing_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe MembershipActionsController, type: :routing do
|
||||||
|
describe "routing" do
|
||||||
|
|
||||||
|
it "routes to #index" do
|
||||||
|
expect(:get => "/membership_actions").to route_to("membership_actions#index")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #new" do
|
||||||
|
expect(:get => "/membership_actions/new").to route_to("membership_actions#new")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #show" do
|
||||||
|
expect(:get => "/membership_actions/1").to route_to("membership_actions#show", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #edit" do
|
||||||
|
expect(:get => "/membership_actions/1/edit").to route_to("membership_actions#edit", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #create" do
|
||||||
|
expect(:post => "/membership_actions").to route_to("membership_actions#create")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PUT" do
|
||||||
|
expect(:put => "/membership_actions/1").to route_to("membership_actions#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PATCH" do
|
||||||
|
expect(:patch => "/membership_actions/1").to route_to("membership_actions#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #destroy" do
|
||||||
|
expect(:delete => "/membership_actions/1").to route_to("membership_actions#destroy", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
39
spec/routing/settings/membership_actions_routing_spec.rb
Normal file
39
spec/routing/settings/membership_actions_routing_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
RSpec.describe Settings::MembershipActionsController, type: :routing do
|
||||||
|
describe "routing" do
|
||||||
|
|
||||||
|
it "routes to #index" do
|
||||||
|
expect(:get => "/settings/membership_actions").to route_to("settings/membership_actions#index")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #new" do
|
||||||
|
expect(:get => "/settings/membership_actions/new").to route_to("settings/membership_actions#new")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #show" do
|
||||||
|
expect(:get => "/settings/membership_actions/1").to route_to("settings/membership_actions#show", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #edit" do
|
||||||
|
expect(:get => "/settings/membership_actions/1/edit").to route_to("settings/membership_actions#edit", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #create" do
|
||||||
|
expect(:post => "/settings/membership_actions").to route_to("settings/membership_actions#create")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PUT" do
|
||||||
|
expect(:put => "/settings/membership_actions/1").to route_to("settings/membership_actions#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #update via PATCH" do
|
||||||
|
expect(:patch => "/settings/membership_actions/1").to route_to("settings/membership_actions#update", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "routes to #destroy" do
|
||||||
|
expect(:delete => "/settings/membership_actions/1").to route_to("settings/membership_actions#destroy", :id => "1")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
39
spec/views/membership_actions/edit.html.erb_spec.rb
Normal file
39
spec/views/membership_actions/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "membership_actions/edit", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@membership_action = assign(:membership_action, MembershipAction.create!(
|
||||||
|
:membership_type => "MyString",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "MyString",
|
||||||
|
:gateway_url => "MyString",
|
||||||
|
:auth_token => "MyString",
|
||||||
|
:merchant_account_id => "MyString",
|
||||||
|
:created_by => "MyString",
|
||||||
|
:additional_parameter => ""
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the edit membership_action form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", membership_action_path(@membership_action), "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[membership_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[is_active]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[gateway_communication_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[gateway_url]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[auth_token]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[merchant_account_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[created_by]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[additional_parameter]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
40
spec/views/membership_actions/index.html.erb_spec.rb
Normal file
40
spec/views/membership_actions/index.html.erb_spec.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "membership_actions/index", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:membership_actions, [
|
||||||
|
MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => ""
|
||||||
|
),
|
||||||
|
MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => ""
|
||||||
|
)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders a list of membership_actions" do
|
||||||
|
render
|
||||||
|
assert_select "tr>td", :text => "Membership Type".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Gateway Communication Type".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Gateway Url".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Auth Token".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Merchant Account".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Created By".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "".to_s, :count => 2
|
||||||
|
end
|
||||||
|
end
|
||||||
0
spec/views/membership_actions/index.json.jbuilder
Normal file
0
spec/views/membership_actions/index.json.jbuilder
Normal file
39
spec/views/membership_actions/new.html.erb_spec.rb
Normal file
39
spec/views/membership_actions/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "membership_actions/new", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:membership_action, MembershipAction.new(
|
||||||
|
:membership_type => "MyString",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "MyString",
|
||||||
|
:gateway_url => "MyString",
|
||||||
|
:auth_token => "MyString",
|
||||||
|
:merchant_account_id => "MyString",
|
||||||
|
:created_by => "MyString",
|
||||||
|
:additional_parameter => ""
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders new membership_action form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", membership_actions_path, "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[membership_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[is_active]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[gateway_communication_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[gateway_url]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[auth_token]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[merchant_account_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[created_by]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "membership_action[additional_parameter]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
28
spec/views/membership_actions/show.html.erb_spec.rb
Normal file
28
spec/views/membership_actions/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "membership_actions/show", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@membership_action = assign(:membership_action, MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => ""
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders attributes in <p>" do
|
||||||
|
render
|
||||||
|
expect(rendered).to match(/Membership Type/)
|
||||||
|
expect(rendered).to match(/false/)
|
||||||
|
expect(rendered).to match(/Gateway Communication Type/)
|
||||||
|
expect(rendered).to match(/Gateway Url/)
|
||||||
|
expect(rendered).to match(/Auth Token/)
|
||||||
|
expect(rendered).to match(/Merchant Account/)
|
||||||
|
expect(rendered).to match(/Created By/)
|
||||||
|
expect(rendered).to match(//)
|
||||||
|
end
|
||||||
|
end
|
||||||
39
spec/views/settings/membership_actions/edit.html.erb_spec.rb
Normal file
39
spec/views/settings/membership_actions/edit.html.erb_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "settings/membership_actions/edit", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@settings_membership_action = assign(:settings_membership_action, Settings::MembershipAction.create!(
|
||||||
|
:membership_type => "MyString",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "MyString",
|
||||||
|
:gateway_url => "MyString",
|
||||||
|
:auth_token => "MyString",
|
||||||
|
:merchant_account_id => "MyString",
|
||||||
|
:created_by => "MyString",
|
||||||
|
:additional_parameter => "MyString"
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders the edit settings_membership_action form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", settings_membership_action_path(@settings_membership_action), "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[membership_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[is_active]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[gateway_communication_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[gateway_url]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[auth_token]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[merchant_account_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[created_by]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[additional_parameter]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "settings/membership_actions/index", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:settings_membership_actions, [
|
||||||
|
Settings::MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => "Additional Parameter"
|
||||||
|
),
|
||||||
|
Settings::MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => "Additional Parameter"
|
||||||
|
)
|
||||||
|
])
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders a list of settings/membership_actions" do
|
||||||
|
render
|
||||||
|
assert_select "tr>td", :text => "Membership Type".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => false.to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Gateway Communication Type".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Gateway Url".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Auth Token".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Merchant Account".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Created By".to_s, :count => 2
|
||||||
|
assert_select "tr>td", :text => "Additional Parameter".to_s, :count => 2
|
||||||
|
end
|
||||||
|
end
|
||||||
39
spec/views/settings/membership_actions/new.html.erb_spec.rb
Normal file
39
spec/views/settings/membership_actions/new.html.erb_spec.rb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "settings/membership_actions/new", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
assign(:settings_membership_action, Settings::MembershipAction.new(
|
||||||
|
:membership_type => "MyString",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "MyString",
|
||||||
|
:gateway_url => "MyString",
|
||||||
|
:auth_token => "MyString",
|
||||||
|
:merchant_account_id => "MyString",
|
||||||
|
:created_by => "MyString",
|
||||||
|
:additional_parameter => "MyString"
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders new settings_membership_action form" do
|
||||||
|
render
|
||||||
|
|
||||||
|
assert_select "form[action=?][method=?]", settings_membership_actions_path, "post" do
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[membership_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[is_active]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[gateway_communication_type]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[gateway_url]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[auth_token]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[merchant_account_id]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[created_by]"
|
||||||
|
|
||||||
|
assert_select "input[name=?]", "settings_membership_action[additional_parameter]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
28
spec/views/settings/membership_actions/show.html.erb_spec.rb
Normal file
28
spec/views/settings/membership_actions/show.html.erb_spec.rb
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "settings/membership_actions/show", type: :view do
|
||||||
|
before(:each) do
|
||||||
|
@settings_membership_action = assign(:settings_membership_action, Settings::MembershipAction.create!(
|
||||||
|
:membership_type => "Membership Type",
|
||||||
|
:is_active => false,
|
||||||
|
:gateway_communication_type => "Gateway Communication Type",
|
||||||
|
:gateway_url => "Gateway Url",
|
||||||
|
:auth_token => "Auth Token",
|
||||||
|
:merchant_account_id => "Merchant Account",
|
||||||
|
:created_by => "Created By",
|
||||||
|
:additional_parameter => "Additional Parameter"
|
||||||
|
))
|
||||||
|
end
|
||||||
|
|
||||||
|
it "renders attributes in <p>" do
|
||||||
|
render
|
||||||
|
expect(rendered).to match(/Membership Type/)
|
||||||
|
expect(rendered).to match(/false/)
|
||||||
|
expect(rendered).to match(/Gateway Communication Type/)
|
||||||
|
expect(rendered).to match(/Gateway Url/)
|
||||||
|
expect(rendered).to match(/Auth Token/)
|
||||||
|
expect(rendered).to match(/Merchant Account/)
|
||||||
|
expect(rendered).to match(/Created By/)
|
||||||
|
expect(rendered).to match(/Additional Parameter/)
|
||||||
|
end
|
||||||
|
end
|
||||||
9
test/system/membership_actions_test.rb
Normal file
9
test/system/membership_actions_test.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class Settings::MembershipActionsTest < ApplicationSystemTestCase
|
||||||
|
# test "visiting the index" do
|
||||||
|
# visit settings_membership_actions_url
|
||||||
|
#
|
||||||
|
# assert_selector "h1", text: "Settings::MembershipAction"
|
||||||
|
# end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user