add print job for qr pay
This commit is contained in:
11
Gemfile.lock
11
Gemfile.lock
@@ -85,7 +85,7 @@ GEM
|
|||||||
mime-types (>= 1.16)
|
mime-types (>= 1.16)
|
||||||
chartkick (3.4.0)
|
chartkick (3.4.0)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
chunky_png (1.3.12)
|
chunky_png (1.4.0)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
@@ -182,7 +182,6 @@ GEM
|
|||||||
json (> 1.8.4)
|
json (> 1.8.4)
|
||||||
rails (> 4.2.0)
|
rails (> 4.2.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
pg (1.2.3)
|
|
||||||
prawn (2.3.0)
|
prawn (2.3.0)
|
||||||
pdf-core (~> 0.8.1)
|
pdf-core (~> 0.8.1)
|
||||||
ttfunk (~> 1.6)
|
ttfunk (~> 1.6)
|
||||||
@@ -239,10 +238,10 @@ GEM
|
|||||||
nokogiri
|
nokogiri
|
||||||
rubyzip
|
rubyzip
|
||||||
spreadsheet (> 0.6.4)
|
spreadsheet (> 0.6.4)
|
||||||
rqrcode (1.1.2)
|
rqrcode (2.1.2)
|
||||||
chunky_png (~> 1.0)
|
chunky_png (~> 1.0)
|
||||||
rqrcode_core (~> 0.1)
|
rqrcode_core (~> 1.0)
|
||||||
rqrcode_core (0.1.2)
|
rqrcode_core (1.2.0)
|
||||||
rspec-core (3.9.2)
|
rspec-core (3.9.2)
|
||||||
rspec-support (~> 3.9.3)
|
rspec-support (~> 3.9.3)
|
||||||
rspec-expectations (3.9.2)
|
rspec-expectations (3.9.2)
|
||||||
@@ -381,7 +380,6 @@ DEPENDENCIES
|
|||||||
mysql2 (~> 0.5.2)
|
mysql2 (~> 0.5.2)
|
||||||
nested_form
|
nested_form
|
||||||
pdfjs_viewer-rails
|
pdfjs_viewer-rails
|
||||||
pg
|
|
||||||
prawn
|
prawn
|
||||||
prawn-qrcode
|
prawn-qrcode
|
||||||
prawn-table
|
prawn-table
|
||||||
@@ -391,6 +389,7 @@ DEPENDENCIES
|
|||||||
rails (~> 5.1.0)
|
rails (~> 5.1.0)
|
||||||
redis (~> 3.0)
|
redis (~> 3.0)
|
||||||
roo
|
roo
|
||||||
|
rqrcode (= 2.1.2)
|
||||||
rspec-rails (~> 3.5)
|
rspec-rails (~> 3.5)
|
||||||
rubyzip (= 1.0.0)
|
rubyzip (= 1.0.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ module MultiTenancy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def find_tenant_by_subdomain_or_name
|
def find_tenant_by_subdomain_or_name
|
||||||
if request.subdomains.first && request.subdomains.first != "www"
|
# if request.subdomains.first && request.subdomains.first != "www"
|
||||||
set_current_tenant(Shop.find_by(subdomain: request.subdomains.first))
|
# set_current_tenant(Shop.find_by(subdomain: request.subdomains.first))
|
||||||
elsif Shop.count == 1
|
# elsif Shop.count == 1
|
||||||
set_current_tenant(Shop.first)
|
set_current_tenant(Shop.first)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def not_found
|
def not_found
|
||||||
|
|||||||
@@ -239,6 +239,8 @@ class Foodcourt::QrpayController < BaseFoodcourtController
|
|||||||
qrpayment_service = QrPaymentService.new(sale_id, current_login_employee)
|
qrpayment_service = QrPaymentService.new(sale_id, current_login_employee)
|
||||||
result = qrpayment_service.process
|
result = qrpayment_service.process
|
||||||
|
|
||||||
|
PrintReceiptJob.perform_later(current_shop.shop_code, sale_id)
|
||||||
|
|
||||||
if result[:status]
|
if result[:status]
|
||||||
render json: result, status: :ok
|
render json: result, status: :ok
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -42,17 +42,17 @@ class Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def print(file_path, printer_destination = nil )
|
def print(file_path, printer_destination = nil )
|
||||||
if printer_destination.nil?
|
# if printer_destination.nil?
|
||||||
printer_destination = self.printer_destination
|
# printer_destination = self.printer_destination
|
||||||
end
|
# end
|
||||||
|
|
||||||
copy = self.print_copies
|
# copy = self.print_copies
|
||||||
#Print only when printer information is not null
|
# #Print only when printer information is not null
|
||||||
if !self.printer_destination.nil?
|
# if !self.printer_destination.nil?
|
||||||
(1..copy).each do
|
# (1..copy).each do
|
||||||
page = Cups::PrintJob.new(file_path, printer_destination)
|
# page = Cups::PrintJob.new(file_path, printer_destination)
|
||||||
page.print
|
# page.print
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -917,7 +917,7 @@ $('#mmqr').click(function() {
|
|||||||
$createPayOrderBtn.prop('disabled', false);
|
$createPayOrderBtn.prop('disabled', false);
|
||||||
|
|
||||||
const errorMsg = xhr.status ? `Status: ${xhr.status} - ${xhr.statusText}` : "Network error";
|
const errorMsg = xhr.status ? `Status: ${xhr.status} - ${xhr.statusText}` : "Network error";
|
||||||
swal("Error", errorMsg, "error");
|
// swal("Error", errorMsg, "error");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<<<<<<< Updated upstream
|
||||||
<div class="modal fade" id="read_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
|
<div class="modal fade" id="read_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
|
||||||
<div class="modal-dialog read-dialog" role="document">
|
<div class="modal-dialog read-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@@ -13,6 +14,172 @@
|
|||||||
<div class="modal-footer" style="justify-content: center;">
|
<div class="modal-footer" style="justify-content: center;">
|
||||||
<button type="button" class="btn btn-danger" id="close" >Cancel</button>
|
<button type="button" class="btn btn-danger" id="close" >Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
=======
|
||||||
|
<style>
|
||||||
|
/* Base Styling */
|
||||||
|
.payment-modal {
|
||||||
|
border-radius: 18px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#read_modal{
|
||||||
|
pointer-events: auto;
|
||||||
|
zindex: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-header {
|
||||||
|
background: #f8fbfc;
|
||||||
|
padding: 1.5rem;
|
||||||
|
border-bottom: 2px solid #e0f0f3;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.merchant-logo {
|
||||||
|
height: 65px;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
filter: drop-shadow(0 2px 4px rgba(84,165,175,0.1));
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
color: #2a626b;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Amount Display */
|
||||||
|
.amount-section {
|
||||||
|
background: #54A5AF15;
|
||||||
|
padding: 1.2rem;
|
||||||
|
margin: 0 1.5rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 2px dashed #54A5AF40;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-amount {
|
||||||
|
color: #2a626b;
|
||||||
|
font-size: 1.8rem;
|
||||||
|
font-weight: 800;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount-label {
|
||||||
|
color: #678c93;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Payment Options Grid */
|
||||||
|
.payment-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
/* grid-template-columns: repeat(1, 1fr); */
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-card {
|
||||||
|
background: white;
|
||||||
|
border: 2px solid #e0f0f3;
|
||||||
|
border-radius: 14px;
|
||||||
|
padding: 1.5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-card:hover {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
border-color: #54A5AF;
|
||||||
|
box-shadow: 0 6px 20px rgba(84,165,175,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-card.active {
|
||||||
|
border-color: #54A5AF;
|
||||||
|
background: #f8fbfc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-icon {
|
||||||
|
font-size: 2.2rem;
|
||||||
|
color: #54A5AF;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-label {
|
||||||
|
color: #2a626b;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-description {
|
||||||
|
color: #678c93;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer Actions */
|
||||||
|
.modal-footer {
|
||||||
|
background: #f8fbfc;
|
||||||
|
padding: 1.2rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-top: 2px solid #e0f0f3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel {
|
||||||
|
background: transparent;
|
||||||
|
border: 2px solid #e0f0f3;
|
||||||
|
color: #678c93;
|
||||||
|
padding: 0.8rem 1.5rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-cancel:hover {
|
||||||
|
border-color: #ff4757;
|
||||||
|
color: #ff4757;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-proceed {
|
||||||
|
background: transparent;
|
||||||
|
border: 2px solid #e0f0f3;
|
||||||
|
color: #678c93;
|
||||||
|
padding: 0.8rem 1.5rem;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-proceed:hover {
|
||||||
|
border-color: #ff4757;
|
||||||
|
color: #ff4757;
|
||||||
|
}
|
||||||
|
.payment-card#read_nfc {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="modal fade payment-modal" id="read_modal" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="payment-header">
|
||||||
|
<h2 class="modal-title">Payment Options</h2>
|
||||||
|
</div>
|
||||||
|
<div class="payment-grid">
|
||||||
|
<div class="payment-card" id="dynamic_qr">
|
||||||
|
<div class="payment-icon text-center">
|
||||||
|
<img src="/image/mmqr.webp" width="100" height="100" />
|
||||||
|
</div>
|
||||||
|
<div class="payment-label text-center">Click here to pay with MMQR</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center text-bold text-muted">
|
||||||
|
(Or)
|
||||||
|
>>>>>>> Stashed changes
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user