merge with august_spring
This commit is contained in:
@@ -1,216 +1,235 @@
|
||||
<div class="row">
|
||||
<!-- Column Two -->
|
||||
<!-- Column Two -->
|
||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||
<div class="card" >
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE 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">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div><strong id="order-title">INVOICE 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">
|
||||
<%= @saleobj.receipt_no rescue '' %>
|
||||
</span></p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
<p>Date:
|
||||
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-title row customer_detail hide">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<p>Customer : <span id="customer_name"></span></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th style="" width="13%">QTY</td>
|
||||
<th class="" width="13%">Price</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
</div>
|
||||
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
|
||||
<table class="table " id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="4%">#</th>
|
||||
<th class="" width="30%">Items</th>
|
||||
<th style="" width="13%">QTY
|
||||
</td>
|
||||
<th class="" width="13%">Price
|
||||
</td>
|
||||
<!-- <th class='' width="17%"> Total </th> -->
|
||||
<th class='' width="17%"> Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%
|
||||
count = 0
|
||||
sub_total = 0
|
||||
@saleobj.sale_items.each do |sale_item|
|
||||
count += 1
|
||||
sub_total = sub_total + sale_item.price
|
||||
%>
|
||||
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
|
||||
<%
|
||||
# Can't check for discount
|
||||
unless sale_item.price == 0
|
||||
%>
|
||||
<tr>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
<tr>
|
||||
<td width="4%"><%= count %></td>
|
||||
<td class='' width="30%">
|
||||
<%= sale_item.product_name %>
|
||||
</td>
|
||||
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update
|
||||
</button>
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
|
||||
</td>
|
||||
<td class='' width="17%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-info btn-md foc'>FOC</button>
|
||||
</td>
|
||||
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<!-- <td class='' width="17%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td> -->
|
||||
<td class='' width="17%">
|
||||
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel Void/Update</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
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 class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<td class='' width="17%">
|
||||
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel
|
||||
Void/Update
|
||||
</button>
|
||||
</td>
|
||||
<% else %>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td class='' width="13%">
|
||||
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
|
||||
</td>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<%
|
||||
end
|
||||
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 class="rebate_amount"></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void' >Cancel All Void</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='apply' >Apply</button>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<!-- Waiter Buttons -->
|
||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='cancel_all_void'>Cancel All Void</button>
|
||||
<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Bill Request
|
||||
$(document).ready(function(){
|
||||
|
||||
$(".update").on('click',function() {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#'+sale_item_id + "_qty").val();
|
||||
var price = $('#'+ sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
|
||||
success:function(result){
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'Qty and Price was successfully Updated',
|
||||
buttons: {
|
||||
// Bill Request
|
||||
$(document).ready(function () {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green btn-lg',
|
||||
action: function(){
|
||||
location.reload();
|
||||
$(".update").on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var qty = $('#' + sale_item_id + "_qty").val();
|
||||
var price = $('#' + sale_item_id + "_price").val();
|
||||
console.log(qty + "|" + price)
|
||||
var ajax_url = "/origami/item_edit";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
|
||||
success: function (result) {
|
||||
$.confirm({
|
||||
title: 'Alert!',
|
||||
content: 'Qty and Price was successfully Updated',
|
||||
buttons: {
|
||||
|
||||
confirm: {
|
||||
text: 'Ok',
|
||||
btnClass: 'btn-green btn-lg',
|
||||
action: function () {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.void').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.foc').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_foc";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.cancel').on('click', function () {
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void_cancel";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id=' + sale_item_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#back').on('click', function () {
|
||||
var table_id = '<%= @table_id %>'
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/cancel_all_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
success: function (result) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.void').on('click',function(){
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.cancel').on('click',function(){
|
||||
var sale_item_id = $(this).attr('data-id');
|
||||
var ajax_url = "/origami/item_void_cancel";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_item_id='+ sale_item_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#back').on('click',function(){
|
||||
var table_id = '<%= @table_id %>'
|
||||
window.location.href = '/origami/table/'+ table_id;
|
||||
})
|
||||
|
||||
$('#cancel_all_void').on('click',function(){
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/cancel_all_void";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id='+ sale_id,
|
||||
success:function(result){
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#apply').on('click',function(){
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/apply_void";
|
||||
var table_id = '<%= @table_id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id='+ sale_id,
|
||||
success:function(result){
|
||||
window.location.href = '/origami/table/'+ table_id ;
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#apply').on('click', function () {
|
||||
var sale_id = "<%= @saleobj.sale_id %>"
|
||||
var ajax_url = "/origami/apply_void";
|
||||
var table_id = '<%= @table_id %>'
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: 'sale_id=' + sale_id,
|
||||
success: function (result) {
|
||||
window.location.href = '/origami/table/' + table_id;
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user