fixed conflict

This commit is contained in:
Nweni
2017-06-29 13:39:37 +06:30
21 changed files with 550 additions and 140 deletions

View File

@@ -138,7 +138,7 @@
<div class="row bottom">
<div class="col-md-3">
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
<div class="fluid cashier_number" data-value="20" data-type="add">15%</div>
</div>
<div class="col-md-9">
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
@@ -149,7 +149,7 @@
<div class="row bottom">
<div class="col-md-3">
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
<div class="fluid cashier_number" data-value="30" data-type="add">20%</div>
</div>
<div class="col-md-9">
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
@@ -160,7 +160,7 @@
<div class="row">
<div class="col-md-3">
<div class="fluid cashier_number" data-value="50" data-type="add">50%</div>
<div class="fluid cashier_number" data-value="50" data-type="add">30%</div>
</div>
<div class="col-md-9">
<div class="col-md-4 cashier_number"></div>
@@ -172,7 +172,7 @@
<div class="col-md-3">
<div class="form-group">
<button id="net" class="btn btn-warning fluid action-btn">Nett</button>
<button id="net" class="btn btn-info fluid action-btn">Nett</button>
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
</div>
@@ -187,6 +187,8 @@
<!-- Action Panel -->
<div>
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button>
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">Remove Discount</button>
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
</div>
</div>
@@ -358,6 +360,64 @@ $(document).ready(function(){
}
});
});
// Remove selected given discount item
$("#remove-item-discount").on('click', function(e){
e.preventDefault();
var sale_id = $('#sale-id').text();
var discount_items = [];
// Selected Items
var sale_items = get_selected_sale_items();
if(sale_items.length == 0){
alert("You have no selected item!");
return;
}
for(var i=0;i < sale_items.length;i++){
if(sale_items[i].price < 0){
discount_items.push(sale_items[i]);
}
else {
alert("You have selected no discount item!");
return;
}
}
var params = { 'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/remove_discount_items",
data: params,
success: function(result){
alert('Removed Discount');
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
});
});
$("#remove-all").on('click', function(e){
e.preventDefault();
var sale_id = $('#sale-id').text();
$.ajax({
type: "GET",
url: "/origami/" + sale_id + "/remove_all_discount",
success: function(result){
alert('Removed All Discount');
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
});
});
});
/* Remove Selection */

View File

@@ -302,6 +302,7 @@
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
<% else %>
@@ -310,6 +311,7 @@
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
<% end %>
@@ -405,7 +407,18 @@ $(document).ready(function(){
});
// Print for first bill
$("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success:function(result){
location.reload();
}
});
});
$('#pay').on('click',function() {
var sale_id = $('#sale_id').val();
@@ -417,9 +430,9 @@ $('#request_bills').click(function() {
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({
type: "POST",
type: "GET",
url: ajax_url,
data: 'order_id='+ order_id,
// data: 'order_id='+ order_id,
success:function(result){
location.reload();
@@ -483,29 +496,30 @@ function show_customer_details(customer_id){
}
});
//End Ajax
}
}
$('#edit').on('click',function(){
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
})
$('#edit').on('click',function(){
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
});
$('#void').on('click',function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
$('#void').on('click',function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
}
}
});
})
</script>

View File

@@ -136,13 +136,13 @@
<% if @ppamount != 0.0 %>
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
<div class="col-md-5"></div>
<div class="col-md-3">Paypar</div>
<div class="col-md-3">Redeem</div>
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
</div>
<% else %>
<div class="row" style="display:none">
<div class="col-md-5"></div>
<div class="col-md-3">Paypar</div>
<div class="col-md-3">Redeem</div>
<div class="col-md-4" id="ppamount">0.0</div>
</div>
<% end %>

View File

@@ -268,61 +268,128 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
<button type="button" class="btn btn-primary btn-block" id="move">Move</button>
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<% if @dining.bookings.length >= 1 %>
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
<% else %>
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
<% end %>
<!-- Cashier Buttons -->
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</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-block">Pay</button>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
<% end %>
</div>
</div>
<script>
$(document).ready(function(){
// $(".tables").on('click', function(){
// var customer_id=$(".customer-id").text();
// show_customer_details(customer_id);
// var dining_id = $(this).attr("data-id");
// window.location.href = '/origami/table/' + dining_id;
// })
// $(".sales").on('click',function(){
// var customer_id=$(".customer-id").text();
// show_customer_details(customer_id);
// var sale_id = $(this).attr("data-id");
// window.location.href = '/origami/sale/' + sale_id;
// })
// $(".rooms").on('click', function(){
// var customer_id=$(".customer-id").text();
// show_customer_details(customer_id);
// var dining_id = $(this).attr("data-id");
// window.location.href = '/origami/room/' + dining_id;
// })
// $(".orders").on('click',function(){
// var customer_id=$(".customer-id").text();
// show_customer_details(customer_id);
// var order_id = $(this).attr("data-id");
// window.location.href = '/origami/order/' + order_id;
// })
$('.invoicedetails').on('click',function(){
var dining_id = "<%= @dining.id %>";
var sale_id = this.id;
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
})
$(".tables").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;
})
});
$(".sales").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/sale/' + sale_id;
})
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/sale/' + sale_id;
});
$(".rooms").on('click', function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/room/' + dining_id;
})
});
$(".orders").on('click',function(){
var customer_id=$(".customer-id").text();
show_customer_details(customer_id);
var order_id = $(this).attr("data-id");
window.location.href = '/origami/order/' + order_id;
})
var order_id = $(this).attr("data-id");
window.location.href = '/origami/order/' + order_id;
});
// bind customer to order or sale
$("#customer").on('click', function(){
$("#customer").on('click', function(){
var sale = $('#sale_id').val();
if (sale) {
var sale_id = sale
}else{
var sale_id = $('#save_order_id').attr('data-order');
}
var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/'+ sale_id + "/customers"
});
$('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
});
// Discount for Payment
$('#discount').click(function() {
var sale = $('#sale_id').val();
@@ -341,6 +408,20 @@ $("#customer").on('click', function(){
return false;
});
});
// Print for first bill
$("#first_bill").on('click', function(){
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success:function(result){
location.reload();
}
});
});
@@ -354,9 +435,9 @@ $('#request_bills').click(function() {
var order_id = $('#save_order_id').attr('data-order');
var ajax_url = "/origami/" + order_id + "/request_bills";
$.ajax({
type: "POST",
type: "GET",
url: ajax_url,
data: 'order_id='+ order_id,
// data: 'order_id='+ order_id,
success:function(result){
location.reload();
@@ -373,39 +454,109 @@ $('#back').on('click',function(){
window.location.href = '/origami/';
})
//show cusotmer rebate amount
function show_customer_details(customer_id){
$('#add_invoice').on('click',function(){
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
success:function(result){
alert("Invoice updated")
window.location.reload();
}
});
});
// //show cusotmer rebate amount
// function show_customer_details(customer_id){
// var url = '<%= @show_customer_details_path %>'
// //Start Ajax
// $.ajax({
// type: "GET",
// url: url,
// data: {},
// dataType: "json",
// success: function(data) {
// $("#customer_name").text(data["customer"].name);
// if (data["response_data"]["data"].length) {
// $.each(data["response_data"]["data"], function (i) {
// if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
// var balance = data["response_data"]["data"][i]["balance"];
// if (data["response_data"]["status"]==true) {
// $('.rebate_amount').removeClass('hide');
// row =
// '<td class="charges-name">' + "Rebate Balance" +'</td>'
// +'<td class="item-attr">' + balance + '</td>';
// $(".rebate_amount").html(row);
// }
// }
// });
// }else{
// $('.rebate_amount').addClass('hide');
// }
// }
// });
// //End Ajax
// }
//show cusotmer rebate amount
function show_customer_details(customer_id){
var url = '<%= @show_customer_details_path %>'
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
$("#customer_name").text(data["customer"].name);
if (data["response_data"]["data"].length) {
$.each(data["response_data"]["data"], function (i) {
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
var balance = data["response_data"]["data"][i]["balance"];
if (data["response_data"]["status"]==true) {
$('.rebate_amount').removeClass('hide');
row =
'<td class="charges-name">' + "Rebate Balance" +'</td>'
+'<td class="item-attr">' + balance + '</td>';
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
$("#customer_name").text(data["customer"].name);
if (data["response_data"]["data"].length) {
$.each(data["response_data"]["data"], function (i) {
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
var balance = data["response_data"]["data"][i]["balance"];
if (data["response_data"]["status"]==true) {
$('.rebate_amount').removeClass('hide');
row =
'<td class="charges-name">' + "Rebate Balance" +'</td>'
+'<td class="item-attr">' + balance + '</td>';
$(".rebate_amount").html(row);
}
$(".rebate_amount").html(row);
}
});
}else{
$('.rebate_amount').addClass('hide');
}
}
});
//End Ajax
});
}else{
$('.rebate_amount').addClass('hide');
}
}
});
//End Ajax
}
$('#edit').on('click',function(){
var dining_id = "<%= @dining.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
});
$('#void').on('click',function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
}
});
</script>