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 */

View File

@@ -12,6 +12,8 @@
@import "BSBMaterial/themes/all-themes";
@import "reset";
@import "induties/assign_in_duties";
@import "select2";
@import "select2-material";
/*@import "bootstrap-select/css/bootstrap-select.min";*/

View File

@@ -0,0 +1,231 @@
.select2-container--material {
width: 100% !important; }
.select2-container--material .select2-selection--single {
background-color: transparent;
border: none;
border-bottom: 1px solid rgba(0,0,0,0.26);
border-radius: 0;
box-shadow: none;
box-sizing: content-box;
height: auto;
margin: 0;
outline: none;
padding: 0.46875rem 0 0.40625rem 0;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.select2-container--material .select2-selection--single .select2-selection__rendered {
color: #444;
font-size: 1rem;
line-height: 18px;
padding-left: 0; }
.select2-container--material .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--material .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--material .select2-selection--single .select2-selection__arrow {
height: 20px;
margin: 0.5rem 0 0.2rem 0;
position: absolute;
line-height: 1rem;
top: 1px;
right: 1px;
width: 20px; }
.select2-container--material .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--material[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; }
.select2-container--material[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto; }
.select2-container--material.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--material.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; }
.select2-container--material.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--material .select2-selection--multiple {
background-color: transparent;
border: none;
border-bottom: 1px solid #ced4da;
border-radius: 0;
box-shadow: none;
box-sizing: content-box;
cursor: text;
height: auto;
margin: 0;
outline: none;
padding: 5px 0 0 0;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; }
.select2-container--material .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--material .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--material .select2-selection--multiple .select2-selection__placeholder {
color: #999;
margin-top: 5px;
float: left; }
.select2-container--material .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice {
background-color: #ffca28;
border-radius: 16px;
color: rgba(0, 0, 0, 0.6);
cursor: default;
float: left;
margin-right: 5px;
margin-top: 6px;
padding: 0 12px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice__remove {
cursor: pointer;
display: inline-block;
font-weight: bold;
float: right;
margin-left: 5px; }
.select2-container--material .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--material[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto; }
.select2-container--material[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto; }
.select2-container--material.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--material.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--material.select2-container--open.select2-container--above .select2-selection--single, .select2-container--material.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--material.select2-container--open.select2-container--below .select2-selection--single, .select2-container--material.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--material.select2-container--focus .select2-selection--single {
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
outline: 0; }
.select2-container--material.select2-container--focus .select2-selection--multiple {
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
outline: 0; }
.select2-container--material .select2-search--dropdown .select2-search__field {
border: none;
border-bottom: 1px solid #ced4da;
border-radius: 0;
outline: none; }
.select2-container--material .select2-search--dropdown .select2-search__field:focus:not([readonly]) {
box-shadow: 0 1px 0 0 #ced4da;
border-bottom: 1px solid #ced4da; }
.select2-container--material .select2-search--inline .select2-search__field {
background: transparent;
border: none !important;
outline: 0;
box-shadow: none !important;
-webkit-appearance: textfield; }
.select2-container--material .select2-results > .select2-results__options {
overflow-y: auto; }
.select2-container--material .select2-results__option[role=group] {
padding: 0; }
.select2-container--material .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--material .select2-results__option[aria-selected=true] {
background-color: #ddd; }
.select2-container--material .select2-results__option .select2-results__option {
padding-left: 1em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em; }
.select2-container--material .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em; }
.select2-container--material .select2-results__option--highlighted[aria-selected] {
background-color: #3f729b;
color: white; }
.select2-container--material .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-dropdown {
background-color: white;
border: 1px solid #ced4da;
border-radius: 4px;
box-sizing: border-box;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051;
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); }
.select2-results {
display: block; }
.select2-results__options {
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0; }
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }