This commit is contained in:
Aung Myo
2017-09-01 16:55:51 +06:30
parent 2be93e413d
commit fc5192157b
11 changed files with 55 additions and 38 deletions

View File

@@ -276,6 +276,7 @@ $(function(){
disabled = "" disabled = ""
status =""; status ="";
if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){ if(parseInt(jQuery.inArray(value[i], selected_item))!== -1){
status = "selected-attribute"; status = "selected-attribute";
} }
@@ -417,7 +418,7 @@ $(function(){
}); //End Add Icon Click }); //End Add Icon Click
function show_item_detail(data){ function show_item_detail(data){
console.log(data)
qty = parseInt(data.attr('data-qty')); qty = parseInt(data.attr('data-qty'));
append = 0; append = 0;
price = parseFloat(data.attr('data-price')).toFixed(2); price = parseFloat(data.attr('data-price')).toFixed(2);
@@ -599,7 +600,7 @@ $(function(){
var item_row = $('.summary-items tbody tr'); var item_row = $('.summary-items tbody tr');
$(item_row).each(function(i){ $(item_row).each(function(i){
var order_item = {}; var order_item = {};
console.log($(item_row[i]).attr('data-options'));
order_item.order_item_id = $(item_row[i]).attr('data-row'); order_item.order_item_id = $(item_row[i]).attr('data-row');
order_item.item_instance_code = $(item_row[i]).attr('data-instance-code'); order_item.item_instance_code = $(item_row[i]).attr('data-instance-code');
order_item.quantity = $(item_row[i]).children('#item_qty').text(); order_item.quantity = $(item_row[i]).children('#item_qty').text();

View File

@@ -1,14 +1,14 @@
// Action Cable provides the framework to deal with WebSockets in Rails. // Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command. // You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable //= require action_cable
//= require_self //= require_self
//= require_tree ./channels //= require_tree ./channels
// Temp Disable // Temp Disable
// (function() { (function() {
// this.App || (this.App = {}); this.App || (this.App = {});
// App.cable = ActionCable.createConsumer(); App.cable = ActionCable.createConsumer();
// }).call(this); }).call(this);

View File

@@ -1,24 +1,29 @@
// App.order_queue_station = App.cable.subscriptions.create("OrderQueueStationChannel", { App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChannel', {
// connected: function() {}, // App.messages = App.cable.subscriptions.create('MessagesChannel', {
// disconnected: function() {}, connected: function() {},
// received: function(message) { disconnected: function() {},
// alert(message);
// },
// order: function(message) { received: function(data) {
// return this.perform('order', { console.log(data);
// message: message alert(data);
// }); console.log("hiiiiiiiiiiii");
// } $('#test').append(data);
// }); },
// $(function(){ order: function(message) {
// $("#submit_order").on('click', function(event) { return this.perform('order', {
// var orderData=$("#new_order").serializeObject(); message: message
// App.order_station.order(orderData); });
// //orderData=''; }
// return event.preventDefault(); });
// });
// }); $(function(){
$("#submit_order").on('click', function(event) {
var orderData=$("#new_order").serializeObject();
App.order_station.order(orderData);
//orderData='';
return event.preventDefault();
});
});

View File

@@ -7,7 +7,7 @@ module ApplicationCable
end end
# Order Queue Station Channel # Order Queue Station Channel
class OQSChannel < ActionCable::Channel::Base class OrderQueueStationChannel < ActionCable::Channel::Base
end end

View File

@@ -1,4 +1,7 @@
module ApplicationCable module ApplicationCable
class Connection < ActionCable::Connection::Base class Connection < ActionCable::Connection::Base
def connect
logger.add_tags "ActionCable"
end
end end
end end

View File

@@ -4,6 +4,7 @@ class OrderQueueStationChannel < ApplicationCable::Channel
end end
def unsubscribed def unsubscribed
stop_all_streams
# Any cleanup needed when channel is unsubscribed # Any cleanup needed when channel is unsubscribed
end end

View File

@@ -4,8 +4,9 @@ class OrderQueueProcessorJob < ApplicationJob
def perform(order_id, table_id) def perform(order_id, table_id)
# Do something later # Do something later
#Order ID #Order ID
order = Order.find(order_id)
order = Order.find(order_id)
ActionCable.server.broadcast "order_queue_station_channel",message: order
#Loop through the order stations and process the items #Loop through the order stations and process the items
#Execute orders and send to order stations #Execute orders and send to order stations
if order if order
@@ -13,5 +14,8 @@ class OrderQueueProcessorJob < ApplicationJob
oqs.process_order(order, table_id) oqs.process_order(order, table_id)
end end
end end
end end

View File

@@ -12,6 +12,9 @@
<% end %> <% end %>
</div> </div>
<div class="col-md-6">
<p data-be="message" id="test"></p>
</div>
</div> </div>
<hr> <hr>
<!-- Column One --> <!-- Column One -->

View File

@@ -1,9 +1,7 @@
development: redis: &redis
adapter: async
test:
adapter: async
production:
adapter: redis adapter: redis
url: redis://localhost:6379/1 url: redis://localhost:6379/1
production: *redis
development: *redis
test: *redis

View File

@@ -45,6 +45,8 @@ Rails.application.configure do
# Suppress logger output for asset requests. # Suppress logger output for asset requests.
config.assets.quiet = true config.assets.quiet = true
config.web_console.whiny_requests = false
# Raises error for missing translations # Raises error for missing translations
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
@@ -53,5 +55,5 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set Cable URL # Set Cable URL
# config.action_cable.url = "ws://192.168.1.140:3002/cable" config.action_cable.url = "ws://192.168.1.39:3002/cable"
end end

View File

@@ -7,7 +7,7 @@ Rails.application.routes.draw do
mount Sidekiq::Web => '/kiq' mount Sidekiq::Web => '/kiq'
# Action Cable Creation # Action Cable Creation
# mount ActionCable.server => "/cable" mount ActionCable.server => "/cable"
#--------- SmartSales Installation ------------# #--------- SmartSales Installation ------------#
get 'install' => 'install#index' get 'install' => 'install#index'