uncomplete print, need for print_settings

This commit is contained in:
Yan
2017-06-02 18:26:44 +06:30
parent 6d705e2860
commit 63be238e09
6 changed files with 29 additions and 6 deletions

View File

@@ -33,6 +33,9 @@ $(document).ready(function(){
$('#order-items').text(orderItem);
$('#order-qty').text(orderQty);
$('.queue_station').removeClass('selected-item');
$(this).addClass('selected-item');
});
// complete for queue item
@@ -67,4 +70,14 @@ $(document).ready(function(){
}
});
});
$('#print_order_item').on('click',function(){
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var params = { 'id':assigned_item_id };
$.ajax({
type: 'GET',
url: '/oqs/print/print/'+assigned_item_id,
success: function(data){ }
});
});
});

View File

@@ -14,3 +14,7 @@
.order-void {
background-color: #FFCCDD;
}
.selected-item {
background-color: blue;
}

View File

@@ -1,5 +1,8 @@
class Oqs::PrintController < ApplicationController
def print
assigned_item_id=params[:id]
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where('id='+assigned_item_id)
order_queue_printer= OrderQueuePrinter.new
order_queue_printer.print_order_item(assigned_order_item[0].order_id, assigned_order_item[0].item_code )
end
end

View File

@@ -1,11 +1,11 @@
class Printer::OrderQueuePrinter < Printer::PrinterWorker
def print_order_item(order_queue_id)
def print_order_item(order_id, item_code)
#Use CUPS service
#Generate PDF
#Print
pdf = OrderItemPdf.new
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
pdf.render_file "tmp/order_item_queue_#{order_id}_#{item_code}" + ".pdf"
self.print("tmp/receipt.pdf")
end

View File

@@ -69,6 +69,7 @@
</small>
</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.id %></p>
</div>
<!-- <div class="card-footer">
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
@@ -117,7 +118,9 @@
</span>
</small>
</p>
<!-- Hidden Fields for Items -->
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.id %></p>
</div>
<div class="card-footer">
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
@@ -197,8 +200,8 @@
<!-- Column Three--->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<a href=<%= oqs_print_path %> title="Print Order Item" class="btn btn-primary btn-lg btn-block">Print</a>
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Print <br/>Order<br/>Summary</button>
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_item" disabled>Print <br/>Order<br/>Summary</button>
</div>
</div>