report ui format

This commit is contained in:
Yan
2017-06-13 14:59:00 +06:30
137 changed files with 3958 additions and 1281 deletions

View File

@@ -0,0 +1,17 @@
// 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

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,5 +17,142 @@
//= require turbolinks
//= require cable
//= require settings/processing_items
//= require bootstrap-datepicker
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.es
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
$('.dropdown-toggle').dropdown();
});
/*
* ToDo Move to here from pages
*
*
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
//Reset the form to pervious values
$("#branch").val(<%=params[:branch]%>);
$("#waiter").val("<%=params[:waiter]%>");
$("#cashier").val(<%=params[:cashier]%>);
$("#product").val(<%=params[:product]%>);
$("#singer").val(<%=params[:singer]%>);
$("#item").val('<%=params[:item]%>');
$("#guest_role").val('<%=params[:guest_role]%>');
$("#from").val("<%=params[:from]%>");
$("#to").val("<%=params[:to]%>");
$("#sel_period").val(<%=params[:period]%>);
$("#sel_sale_type").val(<%=params[:sale_type]%>);
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
if(parseInt(search) == 0){
search_by_period();
}
else{
search_by_date();
}
}else{
search_by_period();
}
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
var period = $('#sel_period').val();
var period_type = 0;
var from = "";
var to = "";
}
$('#from').change(function(){
search_by_date();
});
$('#to').change(function(){
search_by_date();
});
function search_by_date(){
var from = $('#from').val();
var to = $('#to').val();
var period = 0;
var period_type = 1;
if(to != '' && from != ''){
shift_name = from + ',' + to;
check_arr.push(to);
// console.log(check_arr.length)
if(check_arr.length == 1){
}
if(check_arr.length == 3){
check_arr = [];
}
}
}
});
*/

View File

@@ -5,6 +5,7 @@
//= require_self
//= require_tree ./channels
// Temp Disable
(function() {
this.App || (this.App = {});

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

@@ -17,21 +17,32 @@
//= 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();
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');
}
$("#customer").removeAttr('disabled');
var customer_id=$(this).find(".customer-id").text();
show_customer_details(customer_id);
var cashier="";
var receipt_date="";
@@ -46,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);
@@ -57,28 +68,30 @@ $(document).ready(function(){
// Receipt Header
receipt_no = result[i].receipt_no;
cashier = result[i].cashier_name;
receipt_date = result[i].receipt_date;
receipt_date = new Date(result[i].receipt_date);
show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes()
$("#receipt_no").text(receipt_no);
$("#cashier").text(cashier==null?"":cashier);
$("#receipt_date").text(receipt_date);
$("#cashier").text(cashier == null ? "" : cashier);
$("#receipt_date").text(show_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);
// Ordered Items
var order_items_rows = "<tr>" +
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>" +
@@ -94,11 +107,11 @@ $(document).ready(function(){
$(this).addClass('selected-item');
});
// Bill Request
// Bill Request
$('#request_bills').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
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!");
@@ -106,42 +119,50 @@ $(document).ready(function(){
return false;
});
// Discount for Payment
// Discount for Payment
$('#discount').click(function() {
var order_id=$(".selected-item").find(".orders-id").text();
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!");
}
}
return false;
});
// Pay Discount for Payment
$("#pay-discount").on('click', function(){
$("#pay-discount").on('click', function(e){
e.preventDefault();
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_value = $('#discount-amount').val();
var discount_amount = discount_value;
var ajax_url = "/origami/" + sale_id + "/discount";
if(sale_item_id != null){
ajax_url = "/origami/" + sale_item_id + "/discount";
}
// For Percentage Discount
if(discount_type == 1){
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: ajax_url,
data: params,
success:function(result){ }
});
});
// Payment for Bill
$('#pay-bill').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text();
@@ -150,17 +171,58 @@ $(document).ready(function(){
}
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"
var sale = $(".selected-item").find(".orders-id").text();
if (sale.substring(0, 3)=="SAL") {
var sale_id = sale
}else{
var sale_id = $(".selected-item").find(".order-cid").text();
}
window.location.href = '/origami/'+ sale_id + "/add_customer"
return false;
});
function show_customer_details(customer_id){
if(window.location.pathname.substring(0, 12) == "/origami/SAL"){
var url = customer_id+"/get_customer/"
}else{
var url = "origami/"+customer_id+"/get_customer/"
}
$('.customer_detail').removeClass('hide');
//Start Ajax
$.ajax({
type: "GET",
url: url,
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 == "0.0") {
$("#customer_amount").text('0.0');
}else{
$("#customer_amount").text(balance);
}
}
});
}
});
//End Ajax
}
/* For Receipt - Calculate discount or tax */
$('.cashier_number').on('click', function(event){
if(event.handled !== true) {
@@ -168,7 +230,7 @@ $(document).ready(function(){
original_value = $('#discount-amount').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
@@ -179,13 +241,14 @@ $(document).ready(function(){
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);
amount = parseInt(input_value);
$('#discount-amount').val(amount);
$('#discount-type').val(1);
update_balance();
break;
@@ -207,19 +270,29 @@ $(document).ready(function(){
}
});
$('.discount-item-row').on('click',function(){
$('.discount-item-row').removeClass('selected-item');
$(this).addClass('selected-item');
});
});
/* Button Control by Status */
function control_button(order_status){
function control_button(order_status){
if(order_status=="billed"){
$("#request_bills").prop('disabled', true);
$("#discount").prop('disabled', false);
$("#pay").prop('disabled', false);
$("#pay-bill").prop('disabled', false);
}
else if(order_status=="new") {
$("#request_bills").prop('disabled', false);
$("#discount").prop('disabled', true);
$("#pay").prop('disabled', true);
$("#pay-bill").prop('disabled', true);
}
else {
$("#request_bills").prop('disabled', true);
$("#discount").prop('disabled', true);
$("#pay-bill").prop('disabled', true);
}
}
@@ -236,9 +309,6 @@ function update_balance(){
}
var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount;
$('#order-discount').text(discount_amount);
$('#order-discount').text(discount_amount);
$('#order-grand-total').text(total);
}

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

@@ -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

@@ -7,3 +7,5 @@
// min-height: 75rem;
// padding-top: 4.5rem;
// }

View File

@@ -2,7 +2,7 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "bootstrap-datepicker3";
@import 'bootstrap-datepicker';
/* Show it is fixed to the top */
// body {
@@ -58,3 +58,19 @@ ul.dropdown-menu li a{
/*----- Header Bar -----*/
/*----- Header Bar -----*/
/*----- Layout ------ */
.margin-top-20 {
margin: 20px 0 0 0;
}
/*----- Layout ------ */
/*--- Reset --- */
select.form-control {
height: inherit !important;
}
/*--- Reset --- */

View File

@@ -7,17 +7,39 @@
// min-height: 75rem;
// padding-top: 4.5rem;
// }
.others-payment{
line-height:100px;
text-align:center;
color:white;
width:300px;
height:100px;
font-size:18px;
}
.orders-table {
cursor: pointer;
}
.cashier_number{
height:76px;
line-height:80px;
width: 33%;
height:70px;
line-height:70px;
text-align:center;
background:#54A5AF;
float:left;
margin:2px;
// float:left;
// margin:2px;
font-size:20px;
color:white;
// cursor:pointer;
}
.pay{
width: 98%;
height:211px;
line-height:211px;
text-align:center;
font-size:20px;
color:white;
cursor:pointer;
}
.cashier_number:hover{
@@ -25,15 +47,20 @@
}
.long{
width:100%
width:49%;
}
.sold {
background-color: red;
}
.paid {
background-color: green;
}
.selected-item {
background-color: blue;
color: #fff !important;
background-color: blue !important;
}
/* Reciept Style */
@@ -42,17 +69,17 @@
}
.charges-name {
width: 80%;
width: 80%;
text-align: left;
}
.item-name {
width: 60%;
width: 60%;
text-align: left;
}
.item-attr {
width: 20%;
width: 20%;
text-align: right;
}
@@ -70,9 +97,29 @@
background-color: #009900
}
.left{
margin-left:1px;
}
.bottom{
margin-bottom: 1px;
}
/*----- Reset -----*/
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;
}

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the origami/redeem_payments 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 settings/orders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/