fixed conflictfile

This commit is contained in:
Aung Myo
2017-06-12 15:01:19 +06:30
30 changed files with 699 additions and 353 deletions

View File

@@ -40,31 +40,36 @@ $(document).ready(function(){
// complete for queue item
$('.order-complete').on('click',function(){
var _self= $(this);
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(15);
var params = { 'id':assigned_item_id };
var station=$(this).parent().parent(".queue_station").parent().parent().attr('id');
$.ajax({
type: 'POST',
url: '/oqs/update_delivery',
data: params,
dataType: 'json',
success: function(data){
var queue_station=_self.parent().parent(".queue_station");
success: function(data){
for (i = 0; i < data.length; i++) {
var queue_station = $('#assigned_queue_' + data[i]).parent().parent(".queue_station");
var station = queue_station.parent().parent().attr('id');
// Remove a queue card from current station
queue_station.remove();
// Remove a queue card from current station
queue_station.remove();
// Remove a queue card from current station
queue_station.children('.card-footer').remove();
// Add removed queue card from station to completed
$("#completed").children('.card-columns').append(queue_station);
// Remove a queue card from current station
queue_station.children('.card-footer').remove();
// Add removed queue card from station to completed
$("#completed").children('.card-columns').append(queue_station);
// update queue item count in station
$("#"+station+"_count").text(parseInt($("#"+station+"_count").text())-1);
$("#completed_count").text(parseInt($("#completed_count").text())+1);
// update queue item count in each station
var station_count=parseInt($("#"+station+"_count").text()) - 1;
$("#"+station+"_count").text(station_count);
}
// update queue item count in completed station
$("#completed_count").text(parseInt($("#completed_count").text()) + data.length);
alert("updated!");
}

View File

@@ -17,8 +17,18 @@
//= require cable
$(document).ready(function(){
// Enable/Disable Button
control_button("disabled");
$(".orders").on('click', function(){
var zone_name=$(this).find(".orders-table").text();
$("#order-sub-total").text('');
// $("#order-food").text('');
// $("#order-beverage").text('');
$("#order-discount").text('');
$("#order-Tax").text('');
$("#order-grand-total").text('');
var zone_name=$(this).find(".orders-table").text();
var receipt_no=$(this).find(".orders-receipt-no").text();
var unique_id = $(this).find(".orders-id").text();
var order_status=$(this).find(".orders-order-status").text().trim();
@@ -47,10 +57,10 @@ $(document).ready(function(){
// AJAX call for order
$.ajax({
type: "GET",
url: "origami/" + unique_id,
data: { 'id' : unique_id },
success:function(result){
type: "POST",
url: "/origami/" + unique_id,
data: { 'booking_id' : unique_id },
success:function(result){
for (i = 0; i < result.length; i++) {
var data = JSON.stringify(result[i]);
var parse_data = JSON.parse(data);
@@ -61,19 +71,20 @@ $(document).ready(function(){
receipt_date = result[i].receipt_date;
$("#receipt_no").text(receipt_no);
$("#cashier").text(cashier==null?"":cashier);
$("#cashier").text(cashier == null ? "" : cashier);
$("#receipt_date").text(receipt_date);
//Receipt Charges
sub_total += (parse_data.qty*parse_data.price);
discount_amount = parse_data.discount_amount;
discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount;
tax_amount = parse_data.tax_amount;
grand_total_amount = parse_data.grand_total_amount;
$("#order-sub-total").text(sub_total);
$("#order-food").text('');
$("#order-beverage").text('');
// $("#order-food").text('');
// $("#order-beverage").text('');
$("#order-discount").text(discount_amount);
$("#order-Tax").text(tax_amount);
$("#order-grand-total").text(grand_total_amount);
@@ -99,7 +110,7 @@ $(document).ready(function(){
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/request_bills/'+ order_id
window.location.href = '/origami/' + order_id + '/request_bills'
}
else {
alert("Please select an order!");
@@ -111,7 +122,7 @@ $(document).ready(function(){
$('#discount').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/discount/'+ order_id
window.location.href = '/origami/' + order_id + '/discount'
}
else {
alert("Please select an order!");
@@ -123,21 +134,27 @@ $(document).ready(function(){
// Pay Discount for Payment
$("#pay-discount").on('click', function(){
var sale_id = $('#sale-id').text();
var sale_item_id = $('.selected-item').attr('id');
var sub_total = $('#order-sub-total').text();
var grand_total = $('#order-grand-total').text();
var discount_type = $('#discount-type').val();
var discount_value = $('#discount-amount').val();
var discount_amount = discount_value;
if(sale_item_id == null){
alert('Please select item row to discount!');
return;
}
// For Percentage Discount
if(discount_type == 1){
discount_amount=(sub_total*discount_value)/100;
}
var params = {'sale_id': sale_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount};
$.ajax({
type: "POST",
url: "/origami/discount",
url: "/origami/" + sale_item_id + "/discount",
data: params,
success:function(result){ }
});
@@ -171,33 +188,33 @@ $(document).ready(function(){
});
function show_customer_details(customer_id){
$('.customer_detail').removeClass('hide');
//Start Ajax
$.ajax({
type: "GET",
url: "origami/"+customer_id+"/get_customer/",
data: {},
dataType: "json",
success: function(data) {
$("#customer_name").text(data["customer"].name);
$.each(data["response_data"]["data"], function (i) {
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
var balance = data["response_data"]["data"][i]["balance"];
console.log(balance);
if (balance) {
$("#customer_amount").text(balance);
}else{
$("#customer_amount").text('00');
}
}
});
}
});
//End Ajax
}
$('.customer_detail').removeClass('hide');
//Start Ajax
$.ajax({
type: "GET",
url: "origami/"+customer_id+"/get_customer/",
data: {},
dataType: "json",
success: function(data) {
$("#customer_name").text(data["customer"].name);
$.each(data["response_data"]["data"], function (i) {
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
var balance = data["response_data"]["data"][i]["balance"];
console.log(balance);
if (balance) {
$("#customer_amount").text(balance);
}else{
$("#customer_amount").text('00');
}
}
});
}
});
//End Ajax
}
/* For Receipt - Calculate discount or tax */
$('.cashier_number').on('click', function(event){
@@ -222,8 +239,9 @@ $(document).ready(function(){
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
amount = parseInt(input_value);
$('#discount-amount').val(amount);
$('#discount-type').val(1);
update_balance();
break;
@@ -245,6 +263,11 @@ $(document).ready(function(){
}
});
$('.discount-item-row').on('click',function(){
$('.discount-item-row').removeClass('selected-item');
$(this).addClass('selected-item');
});
});
/* Button Control by Status */
@@ -259,6 +282,11 @@ function control_button(order_status){
$("#discount").prop('disabled', true);
$("#pay-bill").prop('disabled', true);
}
else {
$("#request_bills").prop('disabled', true);
$("#discount").prop('disabled', true);
$("#pay-bill").prop('disabled', true);
}
}
/* For Receipt - Update Balance */

View File

@@ -16,11 +16,14 @@
font-size:18px;
}
.cashier_number{
width: 30%;
height:71px;
line-height:71px;
.orders-table {
cursor: pointer;
}
.cashier_number{
width: 33%;
height:70px;
line-height:70px;
text-align:center;
background:#54A5AF;
// float:left;
@@ -32,8 +35,8 @@
.pay{
width: 98%;
height:210px;
line-height:210px;
height:211px;
line-height:211px;
text-align:center;
font-size:20px;
color:white;
@@ -44,15 +47,20 @@
}
.long{
width:49%
width:49%;
}
.sold {
background-color: red;
}
.paid {
background-color: green;
}
.selected-item {
background-color: blue;
color: #fff !important;
background-color: blue !important;
}
/* Reciept Style */
@@ -101,3 +109,17 @@
select.form-control {
height: inherit !important;
}
.form-horizontal .form-group {
margin-right: 0px !important;
}
/* Discount */
.discount-item-row {
cursor: pointer;
}
tr.discount-item-row:hover {
background-color: #e3e3e3 !important;
}