diff --git a/app/controllers/foodcourt/paymal_controller.rb b/app/controllers/foodcourt/paymal_controller.rb
index a46b1945..1632ad6e 100644
--- a/app/controllers/foodcourt/paymal_controller.rb
+++ b/app/controllers/foodcourt/paymal_controller.rb
@@ -1,25 +1,14 @@
class Foodcourt::PaymalController < BaseFoodcourtController
-def create
- cash = params[:payment_amount]
- sale_id = params[:sale_id]
- transaction_ref = params[:transaction_ref]
- account_no = params[:account_no]
- if(Sale.exists?(sale_id))
- saleObj = Sale.find(sale_id)
- # shop_details = Shop.first
-
- # rounding adjustment
- # if shop_details.is_rounding_adj
- # new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
- # rounding_adj = new_total-saleObj.grand_total
- # saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
- # end
-
- # saleObj = Sale.find(sale_id)
+ def create
+ cash = params[:payment_amount]
+ sale_id = params[:sale_id]
+ transaction_ref = params[:transaction_ref]
+ account_no = params[:account_no]
+ if(Sale.exists?(sale_id))
+ saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
status, @sale,@membership_data = sale_payment.process_payment(saleObj, current_user, cash, "paymal",account_no)
-
if status == true && @membership_data["status"] == true
@out = true, "Success!"
else
diff --git a/app/views/foodcourt/payments/show.html.erb b/app/views/foodcourt/payments/show.html.erb
index 1353a05a..ec031489 100755
--- a/app/views/foodcourt/payments/show.html.erb
+++ b/app/views/foodcourt/payments/show.html.erb
@@ -119,7 +119,11 @@
No Tax
<% end %>
<%if @sale_payment.nil? && @changable_tax %>
-
+ <% if current_login_employee.role == "cashier" %>
+ Change Tax
+ <% else %>
+
+ <% end %>
<% end %>
<%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%> |
@@ -397,17 +401,30 @@
Refresh
<% if @sale_payment.nil? %>
-
+ <% if current_login_employee.role == "cashier" %>
+ Void
+ <% else %>
+
+ <%end %>
<% if @other_payment <= 0 %>
<%if @sale_data.total_discount == 0 %>
-
-
+ <% if current_login_employee.role == "cashier" %>
+ Waste
+ Spoile
+ <% else %>
+
+
+ <% end %>
<% end %>
<% end %>
<% end %>
<% if @sale_payment.nil? %>
-
+ <% if current_login_employee.role == "cashier" %>
+ Edit
+ <% else %>
+
+ <% end %>
<%end %>
@@ -1326,7 +1343,7 @@ $(document).ready(function(){
// get CardNo from Java
function setCardNo(cardNo){
-
+
if(cardNo.length == 16){
$("#paypar_account_no").val(cardNo);
if ($("#sxModal").attr("data-for") == 'member') {
@@ -1424,6 +1441,52 @@ $(document).ready(function(){
var sale_id = $("#sale_id").text() || 0;
update_sale("", customer_id, customer_name, sale_id);
});
+ $(document).on('click', '.access_modal', function(event){
+ type = $(this).data("type");
+ $(".ok").attr("data-action",type)
+ $('#AccessCodeModal').modal('show');
+ });
+
+ function check_emp_access_code(access_code,type) {
+ var url = "/foodcourt/check_emp_access_code/" + access_code ;
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: {},
+ success: function (result) {
+ // console.log(result)
+ if (result.status == true) {
+ createAccessCode(code);
+ if (type == "edit") {
+ var dining_id = $('#dining').text();
+ var sale_id = $('#sale_id').text();
+ window.location.href = "/foodcourt/table/sale/" + sale_id + "/"+cashier_type+"/edit";
+ }else if(type == "void"){
+ $('#AccessCodeModal').modal('hide');
+ $('#voidModal').modal('show');
+ // overall_void();
+ }else if(type == "waste") {
+ // $('#AccessCodeModal').modal('hide');
+ // $('#focModal').modal('show');
+ waste_and_spoilage("waste")
+ }else if(type == "spoile") {
+ // $('#AccessCodeModal').modal('hide');
+ // $('#voidModal').modal('show');
+ waste_and_spoilage("spoile")
+ }else if(type == "foc"){
+ $('#AccessCodeModal').modal('hide');
+ $('#focModal').modal('show');
+ // overall_foc();
+ }else if(type == "change_tax"){
+ $('#AccessCodeModal').modal('hide');
+ $('#change_taxModal').modal('show');
+ }
+ }else{
+ swal("Oops",result.message,"warning");
+ }
+ }
+ });
+ }
$('#foc').on('click', function () {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val();
@@ -1553,6 +1616,7 @@ $(document).ready(function(){
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
+ $('.confirm').prop("disabled",true);
$.ajax({
type: "POST",
url: "/foodcourt/payment/"+cashier_type+"/change_tax",
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index 44a05fcb..3cd60ed0 100755
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -1253,6 +1253,7 @@ $(document).ready(function(){
title: "Payment Successful!",
text: text,
html: true,
+ type: 'success',
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false