fixed conflict

This commit is contained in:
Aung Myo
2017-06-09 12:04:36 +06:30
82 changed files with 2071 additions and 337 deletions

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -1,115 +0,0 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require cable
$(document).ready(function(){
$(".orders").on('click', function(){
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();
//for customer button
if(unique_id.charAt(0) == 'S'){
$("#customer").removeAttr('disabled');
}else{
$("#customer").attr('disabled','disabled');
}
var cashier="";
var receipt_date="";
var sub_total=0;
var discount_amount=0;
var tax_amount=0;
var grand_total_amount=0;
$("#order-title").text("ORDER DETAILS - " + zone_name);
// clear order items
$("#order-items-table").children("tbody").empty();
// AJAX call for order
$.ajax({
type: "GET",
url: "origami/" + unique_id,
data: { '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);
// Receipt Header
receipt_no = result[i].receipt_no;
cashier = result[i].cashier_name;
receipt_date = result[i].receipt_date;
$("#receipt_no").text(receipt_no);
$("#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;
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-discount").text(discount_amount);
$("#order-Tax").text(tax_amount);
$("#order-grand-total").text(grand_total_amount);
// Ordered Items
var order_items_rows = "<tr>" +
"<td class='item-name'>" + parse_data.item_name + "</td>" +
"<td class='item-attr'>" + parse_data.qty + "</td>" +
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
"</tr>";
$("#order-items-table").children("tbody").append(order_items_rows);
}
}
});
// End AJAX Call
$('.orders').removeClass('selected-item');
$(this).addClass('selected-item');
});
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/request_bills/'+ order_id
return false;
});
// Payment for Bill
$('#pay').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/origami/sale/'+ sale_id + "/payment"
return false;
});
$('#customer').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
return false;
});
});

View File

@@ -0,0 +1,244 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require bootstrap
//= require jquery_ujs
//= require turbolinks
//= require cable
$(document).ready(function(){
$(".orders").on('click', function(){
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();
// Enable/Disable Button
control_button(order_status);
//for customer button
if(unique_id.charAt(0) == 'S'){
$("#customer").removeAttr('disabled');
}else{
$("#customer").attr('disabled','disabled');
}
var cashier="";
var receipt_date="";
var sub_total=0;
var discount_amount=0;
var tax_amount=0;
var grand_total_amount=0;
$("#order-title").text("ORDER DETAILS - " + zone_name);
// clear order items
$("#order-items-table").children("tbody").empty();
// AJAX call for order
$.ajax({
type: "GET",
url: "origami/" + unique_id,
data: { '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);
// Receipt Header
receipt_no = result[i].receipt_no;
cashier = result[i].cashier_name;
receipt_date = result[i].receipt_date;
$("#receipt_no").text(receipt_no);
$("#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;
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-discount").text(discount_amount);
$("#order-Tax").text(tax_amount);
$("#order-grand-total").text(grand_total_amount);
// Ordered Items
var order_items_rows = "<tr>" +
"<td class='item-name'>" + parse_data.item_name + "</td>" +
"<td class='item-attr'>" + parse_data.qty + "</td>" +
"<td class='item-attr'>" + parse_data.qty*parse_data.price + "</td>" +
"</tr>";
$("#order-items-table").children("tbody").append(order_items_rows);
}
}
});
// End AJAX Call
$('.orders').removeClass('selected-item');
$(this).addClass('selected-item');
});
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/request_bills/'+ order_id
}
else {
alert("Please select an order!");
}
return false;
});
// Discount for Payment
$('#discount').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
if(order_id!=""){
window.location.href = '/origami/discount/'+ order_id
}
else {
alert("Please select an order!");
}
return false;
});
// Pay Discount for Payment
$("#pay-discount").on('click', function(){
var sale_id = $('#sale-id').text();
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;
// 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};
$.ajax({
type: "POST",
url: "/origami/discount",
data: params,
success:function(result){ }
});
});
// Payment for Bill
$('#pay-bill').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
if(sale_id!=""){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
}
else {
alert("Please select an order!");
}
return false;
});
$('#customer').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
window.location.href = '/crm/customers/'+ sale_id + "/assign_sale_id"
return false;
});
/* For Receipt - Calculate discount or tax */
$('.cashier_number').on('click', function(event){
if(event.handled !== true) {
var original_value=0;
original_value = $('#discount-amount').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0.0"){
$('#discount-amount').val(input_value);
update_balance();
}
else{
$('#discount-amount').val(original_value + '' + input_value);
update_balance();
}
break;
case 'add':
var input_value = $(this).attr("data-value");
amount = parseInt(input_value) + parseInt(original_value);
$('#discount-amount').val(amount);
update_balance();
break;
case 'del' :
var discount_text=$('#discount-amount').val();
$('#discount-amount').val(discount_text.substr(0,discount_text.length-1));
update_balance();
break;
case 'clr':
$('#discount-amount').val("0.0");
update_balance();
break;
}
event.handled = true;
} else {
return false;
}
});
});
/* Button Control by Status */
function control_button(order_status){
if(order_status=="billed"){
$("#request_bills").prop('disabled', true);
$("#discount").prop('disabled', false);
$("#pay").prop('disabled', false);
}
else if(order_status=="new") {
$("#request_bills").prop('disabled', false);
$("#discount").prop('disabled', true);
$("#pay").prop('disabled', true);
}
}
/* For Receipt - Update Balance */
function update_balance(){
var discount_type = $('#discount-type').val();
var discount_amount = $('#discount-amount').val();
var sub_total = $('#order-sub-total').text();
var tax = $('#order-Tax').text();
// For Percentage Discount
if(discount_type == 1){
discount_amount=(sub_total*discount_amount)/100;
}
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
$('#order-discount').text(discount_amount);
$('#order-grand-total').text(total);
}

View File

@@ -1,113 +0,0 @@
// $(document).on('touchstart click', '.keypad', function(event){
// event.stopPropagation();
// event.preventDefault();
// if(event.handled !== true) {
//
// // Do your magic here.
// var input_value = $(this).attr("data-value");
// switch (input_value) {
//
// case 'delete':
// process_delete_payment();
// break;
//
// case 'foc':
// remove_input_action();
// $(".foc").attr("data-action","true");
// if(customerName.toString() != " "){ //if already chosen customer
// if($("#foc_reason_lists").attr("foc_reason") == ' '){
// alert("Please! Choose or Add FOC reason");
// foc_additional_form();
// }
// else{
// process_foc_payment();
// }
// }
// else{
// alert("Please! Choose or Save Customer");
// foc_additional_form();
// }
// break;
//
// case 'nett':
// remove_input_action();
// $(".nett").attr("data-action","true");
// if($(".credit_note_payment").hasClass("payment_selected")){
// if(customerName == " "){
// alert("Please! Choose or Save Customer");
// showCustomer();
// }
// else{
// $("#accept_payment_btn").attr("data-payment","credit");
// process_nett_payment();
// }
// }
// else{
// process_nett_payment();
// }
// break;
//
// case 'edit':
// process_edit_invoice();
// break;
//
// case 'cancel':
// remove_input_action();
// var status = $("#label_amountdue").attr("data-status");
// if (status != 'completed' && status != 'void'){
// $(".cancel").attr("data-action","true");
// var message = confirm("Are you sure to void? Please, add reason!");
// if (message == true) {
// $(".additional_form").hide();
// $("#void_sale_additional_form").show();
// process_cancel_payment();
// }
// }
// else{
// $(".cancel").addClass("dim");
// }
// break;
//
// case 'ent':
// amount_due = parseFloat($("#label_amountdue").attr("data-original"));
// other_amt = parseFloat($("#label_cash_amount").attr("data-value"));
// credit_amount = parseFloat($("#label_credit_note").text());
// if ($(".credit_note_payment").hasClass("payment_selected") && credit_amount > 0){
// if(customerName.toString() != " "){
// if(credit_amount > (amount_due - other_amt)){
// alert("You shouldn't exceed the amount due.");
// }
// else{
// $("#accept_payment_btn").attr("data-payment","credit");
// update_balance_due();
// }
// }
// else{
// alert("Please! Choose or Save Customer");
// }
// }
// else{
// update_balance_due();
// }
//
// break;
// case 'clear':
// process_clear_payment();
// break;
//
// default:
//
// var existing_value = $(".payment_selected span").text();
//
// if (existing_value == "0" || existing_value == "0.00") { existing_value = ""; }
// existing_value = existing_value + input_value;
// $(".payment_selected span").text(existing_value);
//
// }
//
//
// event.handled = true;
// } else {
// return false;
// }
// });

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -1,3 +1,3 @@
// Place all the styles related to the origami/RequestBills controller here.
// Place all the styles related to the api/origami/paypar controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the membership_actions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -69,3 +69,10 @@
.green{
background-color: #009900
}
/*----- Reset -----*/
select.form-control {
height: inherit !important;
}

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the settings/membership_actions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/