diff --git a/app/assets/images/second.jpg b/app/assets/images/second.jpg new file mode 100644 index 00000000..b7063459 Binary files /dev/null and b/app/assets/images/second.jpg differ diff --git a/app/assets/images/slider/s1.jpg b/app/assets/images/slider/s1.jpg new file mode 100644 index 00000000..cf5cfb0b Binary files /dev/null and b/app/assets/images/slider/s1.jpg differ diff --git a/app/assets/images/slider/s2.jpg b/app/assets/images/slider/s2.jpg new file mode 100644 index 00000000..2e3e9332 Binary files /dev/null and b/app/assets/images/slider/s2.jpg differ diff --git a/app/assets/images/slider/s3.jpg b/app/assets/images/slider/s3.jpg new file mode 100644 index 00000000..e3b4de10 Binary files /dev/null and b/app/assets/images/slider/s3.jpg differ diff --git a/app/assets/images/slider/s4.jpg b/app/assets/images/slider/s4.jpg new file mode 100644 index 00000000..73decfb9 Binary files /dev/null and b/app/assets/images/slider/s4.jpg differ diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 9cc2f774..4378e517 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -684,6 +684,8 @@ $(function() { $('.add_to_order').attr('data-attributes',JSON.stringify(attribute_arr)); $('.add_to_order').attr('data-options',JSON.stringify(option_arr)); var item_data = $(this); + item = get_item(item_data); + customer_display_view(item,"add"); show_item_detail(item_data); calculate_sub_total(); @@ -692,6 +694,8 @@ $(function() { // click plus icon for add $(document).on('click', '.add_icon', function(event){ var item_data = $(this); + item = get_item(item_data); + customer_display_view(item,"add"); show_item_detail(item_data); calculate_sub_total(); }); //End Add Icon Click @@ -795,7 +799,8 @@ $(function() { url: ajax_url, data: params, dataType: "json", - success:function(result){ + success:function(result){ + customer_display_view(null,"reload"); if (type == "quick_service") { window.location.href = "/origami/quick_service" }else{ @@ -824,9 +829,7 @@ $(function() { type = "quick_service" modify_order = window.location.href.indexOf("modify_order"); $("#oqs_loading_wrapper").show(); - console.log(modify_order) if (modify_order !=-1) { - console.log($('#sale_id').text()) var ajax_url = '../../../quick_service/update_modify_order'; var table_type = $('#table_type').text(); var table_id = $('#table_id').text(); @@ -861,7 +864,6 @@ $(function() { data: params, dataType: "json", success:function(result){ - console.log(result) if (result.status) { if (result.data == null){ window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text(); @@ -1152,6 +1154,35 @@ $(function() { }); //end Ajax } + + /* Get Item rows */ + function get_item(data){ + var sale_items = []; + + var sale_item = {}; + sale_item.qty = parseInt(data.attr('data-qty')) + sale_item.name = data.attr('data-name'); + sale_item.price = data.attr('data-price'); + sale_item.item_code = data.attr('data-item-code') + sale_item.instance_code = data.attr('data-instance-code') + sale_item.attributes = data.attr('data-attributes') + sale_item.options = data.attr('data-options') + sale_item.instance = data.attr('data-instance') + sale_items.push(sale_item); + + return sale_items; + } + + function customer_display_view(data,status) { + $.ajax({ + type: "POST", + url: '../../origami/customer_view', + data: {"data":data,"status":status}, + dataType: "json", + success:function(result){ + } + }); + } /* $("input").keypress(function(){ $("span").text(i += 1); });*/ diff --git a/app/assets/javascripts/channels/second_display.js b/app/assets/javascripts/channels/second_display.js new file mode 100644 index 00000000..79b59cac --- /dev/null +++ b/app/assets/javascripts/channels/second_display.js @@ -0,0 +1,38 @@ +App.checkin = App.cable.subscriptions.create('SecondDisplayChannel', { +// App.messages = App.cable.subscriptions.create('MessagesChannel', { + + connected: function() {}, + + disconnected: function() {}, + + received: function(data) { + var data_obj = data.data; + var status = data.status; + var count = 0 + var sub_total = 0 + if (data.status == "order") { + for(var i in data_obj) { + + sub_total = sub_total + (data_obj[i].price * data_obj[i].qty) + count += 1 + row ='' + +''+count+'' + +''+data_obj[i].item_name+'' + +''+data_obj[i].qty +'' + + ''+data_obj[i].qty*data_obj[i].price +'' + +'' + $(".second_display_items").append(row); + }//end looping + }else{ + $('#s_sub_total').empty(); + $('#s_sub_total').append(data_obj.total_amount); + $('#s_total_discount').empty(); + $('#s_total_discount').append(data_obj.total_discount); + $('#s_tatal_tax').empty(); + $('#s_tatal_tax').append(data_obj.total_tax); + $('#s_grand_total').empty(); + $('#s_grand_total').append(data_obj.grand_total); + } + } +}); + diff --git a/app/assets/javascripts/channels/second_display_view.js b/app/assets/javascripts/channels/second_display_view.js new file mode 100644 index 00000000..1666c3c8 --- /dev/null +++ b/app/assets/javascripts/channels/second_display_view.js @@ -0,0 +1,112 @@ +App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', { +// App.messages = App.cable.subscriptions.create('MessagesChannel', { + + connected: function() {}, + + disconnected: function() {}, + + received: function(data) { + var items = data.data; + var tax = data.tax_profiles; + var status= data.status + if (status == "reload") { + window.location.reload(); + } + $('#second_display_slider').addClass("hidden") + $('#second_display_items').removeClass("hidden") + // append items + for(var i in items) { + qty = parseInt(items[i].qty); + append = 0; + price = items[i].price; + + instance_name = items[i].instance; + if (instance_name == "undefined"){ + instance = ''; + }else{ + instance = "("+items[i].instance+")"; + } + + var rowCount = $('.second_display_items tbody tr').length+1; + var item_row = $('.second_display_items tbody tr'); + + $(item_row).each(function(j){ + var item_code = $(item_row[j]).attr('data-code'); + var instance_code = $(item_row[j]).attr('data-instance-code'); + + if (item_code == items[i].item_code && instance_code == items[i].instance_code) { + if (qty > 1) { + qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty; + }else{ + qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1; + } + + $(item_row[j]).children('#item_qty').text(qty); + parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2))); + append =1; + }else{ + if (qty > 1) { + qty = qty; + }else{ + qty = 1; + } + } + }); + if (append===0) { + row ="" + +''+rowCount+'' + +'' + items[i].name+ ' ' + instance +'' + +'' + qty + '' + +'' + + parseFloat(price).toFixed(2) + +'' + +''; + $(".second_display_items tbody").append(row); + + } + } + //end apend items + var total_price = 0; + var taxable_amount = 0; + var total_discount = 0 + var total_tax_amount = 0 + var item_row = $('.second_display_items tbody tr'); + //calculate Sub Total + $(item_row).each(function(i){ + var unit_price = parseFloat($(item_row[i]).attr('data-price')); + var qty = parseFloat($(item_row[i]).children('#item_qty').text()); + total_price += qty*unit_price; + }); + //calculate Tax Amount + for(var i in tax) { + // substract , to give after discount + var total_tax = total_price - total_discount + // include or execulive + if (tax[i].inclusive){ + rate = tax[i].rate + divided_value = (100 + rate)/rate + total_tax_amount = total_tax_amount + (total_tax / divided_value) + }else{ + total_tax_amount = total_tax_amount + (total_tax * tax[i].rate / 100) + } + } + //end calculate Tax amount + var fixed_total_price = parseFloat(total_price).toFixed(2); + var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2); + var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2); + + $('#s_sub_total').empty(); + $('#s_sub_total').append(fixed_total_price); + $('#s_tatal_tax').empty(); + $('#s_tatal_tax').append(fixed_taxable_amount); + $('#s_grand_total').empty(); + $('#s_grand_total').append(fixed_grand_total); + } + +}); + diff --git a/app/assets/javascripts/wow_script.js b/app/assets/javascripts/wow_script.js new file mode 100644 index 00000000..d15d5798 --- /dev/null +++ b/app/assets/javascripts/wow_script.js @@ -0,0 +1 @@ +jQuery("#wowslider-container").wowSlider({effect:"rotate",prev:"",next:"",duration:20*100,delay:20*100,width:580,height:212,autoPlay:true,stopOnHover:false,loop:false,bullets:true,caption:true,captionEffect:"slide",controls:true,logo:"",images:0}); \ No newline at end of file diff --git a/app/assets/javascripts/wowslider.js b/app/assets/javascripts/wowslider.js new file mode 100644 index 00000000..5179927a --- /dev/null +++ b/app/assets/javascripts/wowslider.js @@ -0,0 +1,337 @@ +// ----------------------------------------------------------------------------------- +// http://wowslider.com/ +// JavaScript Wow Slider is a free software that helps you easily generate delicious +// slideshows with gorgeous transition effects, in a few clicks without writing a single line of code. +// Generated by WOW Slider 2.7 +jQuery.fn.wowSlider = function (d) { + var e = jQuery; + var h = this; + var t = h.get(0); + d = e.extend({ + prev: "", + next: "", + duration: 1000, + delay: 20 * 100, + width: 960, + height: 360, + controls: true, + autoPlay: true, + bullets: true, + }, d); + var a = e(".ws_images", h); + var l = a.find("ul"); + + function u(D) { + l.css({ + left: -D + "00%" + }) + } + e("
") + .css({ + width: "100%", + visibility: "hidden", + "font-size": 0, + "line-height": 0 + }) + .append(a.find("li:first img:first") + .clone() + .css({ + width: "100%" + })) + .prependTo(a); + l.css({ + position: "absolute", + top: 0, + animation: "none", + "-moz-animation": "none", + "-webkit-animation": "none" + }); + var m = a.find("li"); + var v = m.length; + + function i(D) { + return ((D || 0) + v) % v + } + var C = navigator.userAgent; + if ((e.browser.msie && parseInt(e.browser.version, 10) < 8) || (/Safari/.test(C))) { + var b = Math.pow(10, Math.ceil(Math.LOG10E * Math.log(v))); + l.css({ + width: b + "00%" + }); + m.css({ + width: 100 / b + "%" + }) + } else { + l.css({ + width: v + "00%", + display: "table" + }); + m.css({ + display: "table-cell", + "float": "none", + width: "auto" + }) + } + u(0); + var k = []; + m.each(function (D) { + var F = e(">img:first,>a:first,>div:first", this) + .get(0); + var G = e("
"); + for (var E = 0; E < this.childNodes.length;) { + if (this.childNodes[E] != F) { + G.append(this.childNodes[E]) + } else { + E++ + } + } + if (!e(this) + .data("descr")) { + e(this) + .data("descr", G.html() + .replace(/^\s+|\s+$/g, "")) + } + e(this) + .css({ + "font-size": 0 + }); + k[k.length] = e(">a>img", this) + .get(0) || e(">*", this) + .get(0) + }); + k = e(k); + k.css("visibility", "visible"); + + function f(F, D, E) { + this.go = function (G) { + E.find("ul") + .stop(true) + .animate({ + left: (G ? -G + "00%" : (/Safari/.test(navigator.userAgent) ? "0%" : 0)) + }, F.duration, "easeInOutExpo"); + return G + } + } + var o = new f(d, k, a); + var c = 0; + + function r(F, E, D) { + if (isNaN(F)) { + F = c + 1 + } + F = i(F); + if (c == F) { + return + } + s(F, E, D) + } + function s(F, E, D) { + var F = o.go(F, c, E, D); + if (F < 0) { + return + } + q(F); + j(m[F]); + c = F; + z() + } + var B = h.find(".ws_bullets"); + + function q(D) { + if (B.length) { + n(D) + } + } + var p; + + function z(D) { + w(); + if (d.autoPlay) { + p = setTimeout(function () { + r() + }, d.delay + (D ? 0 : d.duration)) + } + } + function w() { + if (p) { + clearTimeout(p) + } + p = null + } + function y(G, F, E, D) { + w(); + G.preventDefault(); + r(F, E, D); + z() + } + if (d.controls) { + var x = e('' + d.next + ""); + var g = e('' + d.prev + ""); + h.append(x); + h.append(g); + x.bind("click", function (D) { + y(D, c + 1) + }); + g.bind("click", function (D) { + y(D, c - 1) + }) + } + function A() { + h.find(".ws_bullets a") + .click(function (L) { + y(L, e(this) + .index()) + }); + if (B.length) { + var F = B.find(">div"); + var K = e("a", B); + var I = K.find("IMG"); + if (I.length) { + var H = e('
') + .appendTo(F); + var E = e("
") + .css({ + width: I.length + 1 + "00%" + }) + .appendTo(e("
") + .appendTo(H)); + I.appendTo(E); + e("") + .appendTo(H); + var G = -1; + + function J(N) { + if (N < 0) { + N = 0 + } + e(K.get(G)) + .removeClass("ws_overbull"); + e(K.get(N)) + .addClass("ws_overbull"); + H.show(); + var O = { + left: K.get(N) + .offsetLeft - H.width() / 2, + "margin-top": K.get(N) + .offsetTop - K.get(0) + .offsetTop + "px", + "margin-bottom": -K.get(N) + .offsetTop + K.get(K.length - 1) + .offsetTop + "px" + }; + var M = I.get(N); + var L = { + left: -M.offsetLeft + (e(M) + .outerWidth(true) - e(M) + .outerWidth()) / 2 + }; + if (G < 0) { + H.css(O); + E.css(L) + } else { + if (!document.all) { + O.opacity = 1 + } + H.stop() + .animate(O, "fast"); + E.stop() + .animate(L, "fast") + } + G = N + } + K.hover(function () { + J(e(this) + .index()) + }); + var D; + F.hover(function () { + if (D) { + clearTimeout(D); + D = 0 + } + J(G) + }, function () { + K.removeClass("ws_overbull"); + if (document.all) { + if (!D) { + D = setTimeout(function () { + H.hide(); + D = 0 + }, 400) + } + } else { + H.stop() + .animate({ + opacity: 0 + }, { + duration: "fast", + complete: function () { + H.hide() + } + }) + } + }); + F.click(function (L) { + y(L, e(L.target) + .index()) + }) + } + } + } + function n(D) { + e("A", B) + .each(function (E) { + if (E == D) { + e(this) + .addClass("ws_selbull") + } else { + e(this) + .removeClass("ws_selbull") + } + }) + } + h.append(""); + + function j(E) { + var G = e("img", E) + .attr("title"); + var F = e(E) + .data("descr"); + var D = e(".ws-title", h); + D.stop(1, 1) + .stop(1, 1) + .fadeOut(1000 / 3, function () { + if (G || F) { + D.html((G ? "" + G + "" : "") + (F ? "
" + F + "
" : "")); + D.fadeIn(400, function () { + if (e.browser.msie) { + e(this) + .get(0) + .style.removeAttribute("filter") + } + }) + } + }) + } + if (B.length) { + A() + } + q(c); + j(m[c]); + z(1); + return this +}; +jQuery.extend(jQuery.easing, { + easeInOutExpo: function (e, f, a, h, g) { + if (f == 0) { + return a + } + if (f == g) { + return a + h + } + if ((f /= g / 2) < 1) { + return h / 2 * Math.pow(2, 10 * (f - 1)) + a + } + return h / 2 * (-Math.pow(2, - 10 * --f) + 2) + a + } +}); diff --git a/app/assets/stylesheets/wow_style.css b/app/assets/stylesheets/wow_style.css new file mode 100644 index 00000000..4080a69d --- /dev/null +++ b/app/assets/stylesheets/wow_style.css @@ -0,0 +1,220 @@ +/* + * generated by WOW Slider 2.5 + * template Quiet + */ +@import url("http://fonts.googleapis.com/css?family=Oswald"); +#wowslider-container { + zoom: 1; + position: relative; + max-width:580px; + margin:0 auto; + z-index:100; + border:none; + text-align:left; /* reset align=center */ +} +* html #wowslider-container{ width:580px } +#wowslider-container ul{ + position:relative; + width: 10000%; + height:auto; + left:0; + list-style:none; + margin:0; + padding:0; + border-spacing:0; + overflow: visible; + /*table-layout:fixed;*/ +} +#wowslider-container .ws_images ul li{ + width:1%; + line-height:0; /*opera*/ + float:left; + font-size:0; + padding:0 0 0 0; + margin:0 0 0 0; +} + +#wowslider-container .ws_images{ + position: relative; + left:0; + top:0; + width:100%; + height:100%; + overflow:hidden; +} +#wowslider-container .ws_images a{ + width:100%; + display:block; + color:transparent; +} + +#wowslider-container .ws_images img{ + width:100%; + border:none 0; + max-width: none; +} +#wowslider-container a{ + text-decoration: none; + outline: none; + border: none; +} + +#wowslider-container .ws_bullets { + font-size: 0px; + float: left; + position:absolute; + z-index:70; +} +#wowslider-container .ws_bullets div{ + position:relative; + float:left; +} +#wowslider-container a.wsl{ + display:none; +} +#wowslider-container .ws_bullets { + padding: 10px; +} +#wowslider-container .ws_bullets a { + width:15px; + height:15px; + background: url(./bullet.png) left top; + float: left; + text-indent: -4000px; + position:relative; + margin-left:3px; + color:transparent; +} +#wowslider-container .ws_bullets a:hover{ + background-position: 0 50%; +} +#wowslider-container .ws_bullets a.ws_selbull{ + background-position: 0 100%; +} +#wowslider-container a.ws_next, #wowslider-container a.ws_prev { + position:absolute; + display:none; + top:50%; + margin-top:-50px; + z-index:60; + height: 100px; + width: 60px; + background-image: url(./arrows.png); +} +#wowslider-container a.ws_next{ + background-position: 100% 0; + right:0; +} +#wowslider-container a.ws_prev { + left:0; + background-position: 0 0; +} +* html #wowslider-container a.ws_next,* html #wowslider-container a.ws_prev{display:block} +#wowslider-container:hover a.ws_next, #wowslider-container:hover a.ws_prev {display:block} +/* bottom center */ +#wowslider-container .ws_bullets { + top: 5px; + right: 10px; +} +#wowslider-container .ws_bullets .ws_bulframe { + top: 20px; +} +#wowslider-container .ws_bullets .ws_bulframe { + top: 20px; +} +#wowslider-container .ws-title{ + position: absolute; + bottom: 10%; + left: 7%; + z-index: 50; + padding:12px; + color: #000000; + background:#fff; + font-family:Oswald,Impact,Charcoal,sans-serif; + font-size: 30px; + text-shadow: 1px 1px 1px #BBBBBB; + line-height: 30px; + border-radius:5px; + -moz-border-radius:5px; + -webkit-border-radius:5px; + opacity:0.5; + filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50); +} +#wowslider-container .ws-title div{ + font-size: 25px; + text-shadow: 1px 1px 1px #000000; +}#wowslider-container ul{ + animation: wsBasic 12s infinite; + -moz-animation: wsBasic 12s infinite; + -webkit-animation: wsBasic 12s infinite; +} +@keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} } +@-moz-keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} } +@-webkit-keyframes wsBasic{0%{left:-0%} 16.67%{left:-0%} 33.33%{left:-100%} 50%{left:-100%} 66.67%{left:-200%} 83.33%{left:-200%} } + +#wowslider-container .ws_shadow{ + background: url(./shadow.png) left 100%; + background-repeat: no-repeat; + background-size:100%; + width:100%; + height:20%; + position: absolute; + left:0; + bottom:-20%; + z-index:-1; +} +* html #wowslider-container .ws_shadow{/*ie6*/ + background:none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src='wowslider/install/shadow.png', sizingMethod='scale'); +} +*+html #wowslider-container .ws_shadow{/*ie7*/ + background:none; + filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src='wowslider/install/shadow.png', sizingMethod='scale'); +} +#wowslider-container .ws_bullets a img{ + text-indent:0; + display:block; + top:15px; + left:-123px; + visibility:hidden; + position:absolute; + -moz-box-shadow: 0 0 5px #999999; + box-shadow: 0 0 5px #999999; + border: 5px solid #FFFFFF; + max-width:none; +} +#wowslider-container .ws_bullets a:hover img{ + visibility:visible; +} + +#wowslider-container .ws_bulframe div div{ + height:90px; + overflow:visible; + position:relative; +} +#wowslider-container .ws_bulframe div { + left:0; + overflow:hidden; + position:relative; + width:246px; + background-color:#FFFFFF; +} +#wowslider-container .ws_bullets .ws_bulframe{ + display:none; + overflow:visible; + position:absolute; + cursor:pointer; + -moz-box-shadow: 0 0 5px #999999; + box-shadow: 0 0 5px #999999; + border: 5px solid #FFFFFF; +} +#wowslider-container .ws_bulframe span{ + display:block; + position:absolute; + top:-11px; + margin-left:-5px; + left:123px; + background:url(./triangle.png); + width:15px; + height:6px; +} \ No newline at end of file diff --git a/app/channels/second_display_channel.rb b/app/channels/second_display_channel.rb new file mode 100644 index 00000000..90f53508 --- /dev/null +++ b/app/channels/second_display_channel.rb @@ -0,0 +1,11 @@ +class SecondDisplayChannel < ApplicationCable::Channel + def subscribed + stream_from "second_display_channel" + end + + def unsubscribed + stop_all_streams + # Any cleanup needed when channel is unsubscribed + end + +end \ No newline at end of file diff --git a/app/channels/second_display_view_channel.rb b/app/channels/second_display_view_channel.rb new file mode 100644 index 00000000..e0b6322e --- /dev/null +++ b/app/channels/second_display_view_channel.rb @@ -0,0 +1,11 @@ +class SecondDisplayViewChannel < ApplicationCable::Channel + def subscribed + stream_from "second_display_view_channel" + end + + def unsubscribed + stop_all_streams + # Any cleanup needed when channel is unsubscribed + end + +end \ No newline at end of file diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index c9b1bc44..a247aa04 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -1,4 +1,4 @@ -class Origami::AddordersController < ApplicationController#BaseOrigamiController +class Origami::AddordersController < BaseOrigamiController # before_action :set_dining, only: [:detail] def index @@ -156,10 +156,15 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController end @status, @booking = @order.generate + + # Order.send_customer_view(@booking) + if current_user.role != "waiter" && params[:create_type] == "create_pay" if @status && @booking && @order.source == 'quick_service' @status, @sale = Sale.request_bill(@order,current_user,current_login_employee) + # for second display + ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale" result = {:status=> @status, :data => @sale } render :json => result.to_json end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 1a73ef8c..07288ca1 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -93,9 +93,6 @@ class Origami::HomeController < BaseOrigamiController @account_arr = Array.new if @customer.tax_profiles accounts = @customer.tax_profiles - puts accounts.to_json - puts "sssssssssss" - puts @customer.tax_profiles @account_arr =[] accounts.each do |acc| account = TaxProfile.find(acc) diff --git a/app/controllers/origami/second_display_controller.rb b/app/controllers/origami/second_display_controller.rb new file mode 100644 index 00000000..8d2efd6f --- /dev/null +++ b/app/controllers/origami/second_display_controller.rb @@ -0,0 +1,23 @@ +class Origami::SecondDisplayController < BaseOrigamiController + + def index + + end + + def customer_view + if params[:status]!= "billed" + tax_profiles = TaxProfile.all.order("order_by asc") + else + tax_profiles = nil + end + + ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status] + end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + + +end diff --git a/app/models/order.rb b/app/models/order.rb index 739de71a..3f8ce21a 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -487,6 +487,42 @@ class Order < ApplicationRecord end end + def self.send_customer_view(booking) + @status = "" + @data_array = Array.new + if(!booking.sale_id.nil?) + sale = Sale.find(booking.sale_id) + if sale.sale_status != "completed" && sale.sale_status != 'void' + @data_array.push(sale) + @status = "sale" + @data_obj = sale + end + else + + @status = "order" + booking.booking_orders.each do |booking_order| + @data_obj = Order.find(booking_order.order_id) + if (@data_obj.status == "new") + @data_obj.order_items.each do |item| + if !item.set_menu_items.nil? + instance_item_sets = JSON.parse(item.set_menu_items) + arr_instance_item_sets = Array.new + instance_item_sets.each do |instance_item| + item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name + arr_instance_item_sets.push(item_instance_name) + item.price = item.price.to_f + instance_item["price"].to_f + end + item.set_menu_items = arr_instance_item_sets + end + @data_array.push(item) + + end + end + end + end + ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status + end + private def generate_custom_id diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index bd682b96..7e4d714b 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -332,10 +332,10 @@ Tax: (<% @i = 0 @account_arr.each do |ct| %> - <%=ct.name%> - <% if @account_arr.count != @i+1%> - + <% @i =+1 %> - <%end%> + <%=ct.name%> + <% if @account_arr.count != @i+1%> + + <% @i =+1 %> + <%end%> <%end %>) <%= @obj_sale.total_tax rescue 0 %> @@ -424,6 +424,7 @@ reply <%= t("views.btn.back") %> + Customer View <% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %> diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cb213a38..af414f4c 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -422,6 +422,7 @@ console.log("fffffffffffff") $("#back").on('click', function() { localStorage.removeItem('cash'); + customer_display_view(null,"reload"); if (cashier_type=="cashier") { window.location.href = '/origami/table/'+ dining_id; }else{ @@ -680,6 +681,7 @@ console.log("fffffffffffff") closeOnCancel: false, allowOutsideClick: false }, function () { + customer_display_view(null,"reload"); if (cashier_type=="cashier") { window.location.href = '/origami'; }else{ @@ -730,6 +732,7 @@ console.log("fffffffffffff") url: ajax_url, data: "remark="+ remark + "&sale_id=" + sale_id, success: function () { + customer_display_view(null,"reload"); if (cashier_type=="cashier") { window.location.href = '/origami'; }else{ @@ -788,7 +791,8 @@ console.log("fffffffffffff") type: "POST", url: "<%= origami_payment_foc_path %>", data: params, - success:function(result){ + success:function(result){ + customer_display_view(null,"reload"); if (cash >= 0) { swal({ title: "Information!", @@ -811,6 +815,16 @@ console.log("fffffffffffff") } }); + function customer_display_view(data,status) { + $.ajax({ + type: "POST", + url: '../../../customer_view', + data: {"data":data,"status":status}, + dataType: "json", + success:function(result){ + } + }); + } function calculate_member_discount(sale_id) { var sub_total = $('#sub-total').text(); var member_id = $('#membership_id').text(); diff --git a/app/views/origami/second_display/_second_display.html.erb b/app/views/origami/second_display/_second_display.html.erb new file mode 100644 index 00000000..a5ac8872 --- /dev/null +++ b/app/views/origami/second_display/_second_display.html.erb @@ -0,0 +1,60 @@ +
+
+ +
+
+
+
+ + + + + + + + + + + + + +
#ItemsQTYPrice
+
+
+
+ +
+ +
+
+ <%= image_tag("slider/s2.jpg", :alt => "rss feed") %> +
+
+ diff --git a/app/views/origami/second_display/_slider.html.erb b/app/views/origami/second_display/_slider.html.erb new file mode 100644 index 00000000..9d01a463 --- /dev/null +++ b/app/views/origami/second_display/_slider.html.erb @@ -0,0 +1,18 @@ +<%= stylesheet_link_tag 'wow_style', media: 'all', 'data-turbolinks-track': 'reload' %> +<%= javascript_include_tag 'wowslider', 'data-turbolinks-track': 'reload' %> +<%= javascript_include_tag 'wow_script', 'data-turbolinks-track': 'reload' %> +
+
+
+
+
    +
  • <%= image_tag("slider/s1.jpg", :alt => "rss feed") %>
  • +
  • <%= image_tag("slider/s2.jpg", :alt => "rss feed") %>
  • +
  • <%= image_tag("slider/s4.jpg", :alt => "rss feed") %>
  • +
+
+
+
+
+
+ diff --git a/app/views/origami/second_display/index.html.erb b/app/views/origami/second_display/index.html.erb new file mode 100644 index 00000000..ea97b891 --- /dev/null +++ b/app/views/origami/second_display/index.html.erb @@ -0,0 +1,11 @@ +
+
+ <%= render 'slider' %> +
+ + +
+ + diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 13b3db4d..7aa7b6ba 100755 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -41,6 +41,11 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js ) Rails.application.config.assets.precompile += %w( addorder.css ) Rails.application.config.assets.precompile += %w( addorder.js ) +# --- Customer/ Customer - Crm ---- +Rails.application.config.assets.precompile += %w( wow_style.css ) +Rails.application.config.assets.precompile += %w( wowslider.js ) +Rails.application.config.assets.precompile += %w( wow_script.js ) + # --- Custom SX Themem ---- Rails.application.config.assets.precompile += %w( sx-sidebar.css ) diff --git a/config/routes.rb b/config/routes.rb index 340dc914..a96281b4 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -95,6 +95,9 @@ scope "(:locale)", locale: /en|mm/ do get "quick_service/modify_order/:sale_id" => "quick_service#modify_order" post 'quick_service/update_modify_order' => "quick_service#update_modify_order", :defaults => { :format => 'json' } + resources :second_display + + post '/customer_view' => "second_display#customer_view",:as => "customer_view", :defaults => { :format => 'json' } resources :cash_ins, only: [:new, :create] resources :cash_outs, only: [:new, :create]