print settings ActionCable

This commit is contained in:
Thein Lin Kyaw
2020-08-18 16:11:17 +06:30
parent 583d7ee473
commit 5dfdc7353e
25 changed files with 1050 additions and 802 deletions

View File

@@ -402,17 +402,17 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/print/print/'+assigned_item_id,
data: params,
success: function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
}
});
});
// Print Order Summary
@@ -428,13 +428,15 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/print/print_order_summary/'+assigned_item_id,
data: params,
success: function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
}
});
});

View File

@@ -36,6 +36,7 @@
//= require custom.js
//= require jquery-fileupload/basic
//= require induties/induties.js
//= require select2
$(document).ready(function() {
$('.count-to').countTo();
@@ -65,7 +66,7 @@ $(document).ready(function() {
clearButton: true,
date: false
});
// Image Upload
$("#simple_menu_item_image_path").fileinput({
previewFileType: "image",
@@ -148,7 +149,7 @@ $(document).ready(function() {
'</div>\n',
}
});
$("#commissioner_image_path").fileinput({
previewFileType: "image",
allowedFileExtensions: ["jpg", "gif", "png"],
@@ -167,7 +168,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n',
}
});
});
$("#employee_image_path").fileinput({
previewFileType: "image",
@@ -187,7 +188,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n',
}
});
});
$("#shop_image").fileinput({
previewFileType: "image",
@@ -227,7 +228,7 @@ $(document).ready(function() {
' <img src="{data}" class="file-preview-image" title="{caption}" alt="{caption}" style="width: 200px;height: 200px;">\n' +
'</div>\n',
}
});
});
// first input focus for all form
$('form:first *input[data-behaviour!=datepicker]:input[type!=hidden]:first').focus();
@@ -252,4 +253,4 @@ Chart.scaleService.updateScaleDefaults('linear', {
}
}
});
/* chartkick js YAxis value override */
/* chartkick js YAxis value override */

View File

@@ -1,6 +1,6 @@
//= require custom.js
$(function() {
$(function() {
$("#discount").hide();
$(".expected_time").hide();
$('#accepted').hide();
@@ -11,7 +11,7 @@ $(function() {
$(".accepted_time").hide();
$(".kitchen_time").hide();
$(".ready_time").hide();
$(function() {
$(function() {
$('.first-1').click();
});
@@ -213,8 +213,8 @@ $(function() {
function warnBeforeRedirect(linkURL) {
swal({
title: "Alert!",
text: "Are you sure you want to close cashier?",
title: "Alert!",
text: "Are you sure you want to close cashier?",
type: "warning",
showCancelButton: true
}, function() {
@@ -278,13 +278,13 @@ function refreshDetailData(){
$("#payment_type").text("");
}
//show order list
function show_order_detail(url,sr_no){
//show order list
function show_order_detail(url,sr_no){
// $('.summary-items').html("");
//Start Ajax
$.ajax({
type: "GET",
url: url,
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
@@ -334,12 +334,12 @@ function show_order_detail(url,sr_no){
$("#ready_delivery_time").html(ready_time);
}
}
var newDate = new Date(data.requested_time);
var time = timeFormat(newDate);
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
// var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate);
@@ -367,7 +367,7 @@ function show_order_detail(url,sr_no){
if(items!=undefined && items!=""){
if(items.length > 0){
for(var i in items) {
for(var i in items) {
var item_price = 0;
if(items[i].price > 0){
item_price = items[i].price;
@@ -378,7 +378,7 @@ function show_order_detail(url,sr_no){
var check_mobile =document.getElementsByName("summary_items_mobile")[0].value;
if (check_mobile == "true"){
if(items[i].options!='[]' && items[i].options!="" && items[i].options!=null){
row =
row =
'<tr>'
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
+' <br>'
@@ -417,8 +417,8 @@ function show_order_detail(url,sr_no){
}
}
$('.summary-items').append(row);
}
@@ -452,7 +452,7 @@ function show_order_detail(url,sr_no){
}else if(data.payment_type == "dinga"){
$("#payment_type").text("DINGA");
}
$('#ref_no').text(data.transaction_ref);
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
@@ -494,16 +494,16 @@ function show_order_detail(url,sr_no){
}else{
$("#invoice_no").text(data["order_reservation_id"]);
}
}
}
}
});
//end Ajax
//end Ajax
}
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
var url = 'order_reservation/update';
var post_url = "order_reservation/send_status";
var waiting_time = "";
@@ -527,16 +527,16 @@ function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reas
access_code = approved_code;
}
// $.ajax({
// type: "POST",
// url: post_url,
// $.ajax({
// type: "POST",
// url: post_url,
// data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
// dataType: "json",
// success: function(data) {
// if(data.status){
$.ajax({
type: "POST",
url: url,
$.ajax({
type: "POST",
url: url,
data: {order_id: order_id, ref_no: ref_no, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
dataType: "json",
success: function(data) {
@@ -711,7 +711,7 @@ function getOrderDay(day){
function timeFormat(date){
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM');
return time;
@@ -722,8 +722,8 @@ function timeFormat(date){
function getOnlineOrderCount(){
var count = 0;
//Start Ajax
$.ajax({
async: false,
$.ajax({
async: false,
type: "GET",
url: "/origami/get_order_info",
dataType: "json",
@@ -733,7 +733,7 @@ function getOnlineOrderCount(){
}
}
});
//end Ajax
//end Ajax
// alert(count);
return count;
}
@@ -748,31 +748,33 @@ function print_receipt(){
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
console.log(params);
$.ajax({
type: "POST",
type: "POST",
url: "/origami/sale/"+sale_id+"/doemal_order/payment/print",
data: params,
success:function(result){
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/order_reservation';
}
else{
swal({
title: "Print Success",
text: "Complete Order",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
}
window.location.href = '/origami/order_reservation';
}
else{
swal({
title: "Print Success",
text: "Complete Order",
type: 'success',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/order_reservation';
});
}
}
});
}
/* pdf print out */
/* pdf print out */