fixed out of stock
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -87,7 +87,7 @@ gem 'whenever', :require => false
|
|||||||
|
|
||||||
# XML parser
|
# XML parser
|
||||||
#gem 'nokogiri', '~> 1.6'
|
#gem 'nokogiri', '~> 1.6'
|
||||||
|
gem "select2-rails"
|
||||||
# Pagination
|
# Pagination
|
||||||
gem 'kaminari', '~> 1.0.1'
|
gem 'kaminari', '~> 1.0.1'
|
||||||
|
|
||||||
|
|||||||
19
Gemfile.lock
19
Gemfile.lock
@@ -65,7 +65,7 @@ GEM
|
|||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
byebug (11.1.1)
|
byebug (11.1.1)
|
||||||
cancancan (1.17.0)
|
cancancan (1.17.0)
|
||||||
capistrano (3.12.0)
|
capistrano (3.12.1)
|
||||||
airbrussh (>= 1.0.0)
|
airbrussh (>= 1.0.0)
|
||||||
i18n
|
i18n
|
||||||
rake (>= 10.0.0)
|
rake (>= 10.0.0)
|
||||||
@@ -171,7 +171,7 @@ GEM
|
|||||||
net-ssh (>= 2.6.5, < 6.0.0)
|
net-ssh (>= 2.6.5, < 6.0.0)
|
||||||
net-ssh (5.2.0)
|
net-ssh (5.2.0)
|
||||||
nio4r (2.5.2)
|
nio4r (2.5.2)
|
||||||
nokogiri (1.10.8)
|
nokogiri (1.10.9)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pdfjs_viewer-rails (0.3.1)
|
pdfjs_viewer-rails (0.3.1)
|
||||||
@@ -187,7 +187,7 @@ GEM
|
|||||||
rqrcode (>= 1.0.0)
|
rqrcode (>= 1.0.0)
|
||||||
prawn-table (0.2.2)
|
prawn-table (0.2.2)
|
||||||
prawn (>= 1.3.0, < 3.0.0)
|
prawn (>= 1.3.0, < 3.0.0)
|
||||||
puma (3.12.2)
|
puma (3.12.4)
|
||||||
rack (2.0.9)
|
rack (2.0.9)
|
||||||
rack-cors (1.1.1)
|
rack-cors (1.1.1)
|
||||||
rack (>= 2.0.0)
|
rack (>= 2.0.0)
|
||||||
@@ -235,13 +235,13 @@ GEM
|
|||||||
rqrcode_core (0.1.1)
|
rqrcode_core (0.1.1)
|
||||||
rspec-core (3.9.1)
|
rspec-core (3.9.1)
|
||||||
rspec-support (~> 3.9.1)
|
rspec-support (~> 3.9.1)
|
||||||
rspec-expectations (3.9.0)
|
rspec-expectations (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.9.1)
|
rspec-mocks (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-rails (3.9.0)
|
rspec-rails (3.9.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
@@ -265,6 +265,8 @@ GEM
|
|||||||
tilt (>= 1.1, < 3)
|
tilt (>= 1.1, < 3)
|
||||||
schema_to_scaffold (0.8.0)
|
schema_to_scaffold (0.8.0)
|
||||||
activesupport (>= 3.2.1)
|
activesupport (>= 3.2.1)
|
||||||
|
select2-rails (4.0.3)
|
||||||
|
thor (~> 0.14)
|
||||||
shoulda-matchers (3.1.3)
|
shoulda-matchers (3.1.3)
|
||||||
activesupport (>= 4.0.0)
|
activesupport (>= 4.0.0)
|
||||||
sidekiq (5.2.8)
|
sidekiq (5.2.8)
|
||||||
@@ -288,12 +290,12 @@ GEM
|
|||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sshkit (1.20.0)
|
sshkit (1.21.0)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh (>= 2.8.0)
|
net-ssh (>= 2.8.0)
|
||||||
tether-rails (1.4.0)
|
tether-rails (1.4.0)
|
||||||
rails (>= 3.1)
|
rails (>= 3.1)
|
||||||
thor (1.0.1)
|
thor (0.20.3)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.10)
|
tilt (2.0.10)
|
||||||
to_xls-rails (1.3.1)
|
to_xls-rails (1.3.1)
|
||||||
@@ -368,6 +370,7 @@ DEPENDENCIES
|
|||||||
rubyzip (= 1.0.0)
|
rubyzip (= 1.0.0)
|
||||||
sass-rails (~> 5.0)
|
sass-rails (~> 5.0)
|
||||||
schema_to_scaffold
|
schema_to_scaffold
|
||||||
|
select2-rails
|
||||||
shoulda-matchers (~> 3.1)
|
shoulda-matchers (~> 3.1)
|
||||||
sidekiq
|
sidekiq
|
||||||
simple_form
|
simple_form
|
||||||
@@ -385,4 +388,4 @@ RUBY VERSION
|
|||||||
ruby 2.6.5p114
|
ruby 2.6.5p114
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.0.2
|
2.1.4
|
||||||
|
|||||||
@@ -619,7 +619,7 @@ $(function() {
|
|||||||
|
|
||||||
for(var field in attributes) {
|
for(var field in attributes) {
|
||||||
value = attributes[field]["values"];
|
value = attributes[field]["values"];
|
||||||
type = attributes[field]["type"]
|
type = attributes[field]["type"];
|
||||||
row = "<h5>"+attributes[field]["type"]+"</h5>";
|
row = "<h5>"+attributes[field]["type"]+"</h5>";
|
||||||
|
|
||||||
$(value).each(function(i){
|
$(value).each(function(i){
|
||||||
@@ -830,6 +830,7 @@ $(function() {
|
|||||||
item = get_item(item_data,"add_to_order");
|
item = get_item(item_data,"add_to_order");
|
||||||
customer_display_view(item,"add");
|
customer_display_view(item,"add");
|
||||||
}
|
}
|
||||||
|
console.log(item_data);
|
||||||
show_item_detail(item_data,"add_to_order");
|
show_item_detail(item_data,"add_to_order");
|
||||||
calculate_sub_total();
|
calculate_sub_total();
|
||||||
code = $('#item_code').text()
|
code = $('#item_code').text()
|
||||||
@@ -839,17 +840,20 @@ $(function() {
|
|||||||
|
|
||||||
// click plus icon for add
|
// click plus icon for add
|
||||||
$(document).on('click', '.add_icon', function(event){
|
$(document).on('click', '.add_icon', function(event){
|
||||||
var item_data = $(this);
|
|
||||||
code = $(this).data('item-code');
|
|
||||||
|
|
||||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
if (window.location.pathname != '/settings/out_of_stock/new') {
|
||||||
item = get_item(item_data,"add_icon");
|
var item_data = $(this);
|
||||||
customer_display_view(item,"add");
|
code = $(this).data('item-code');
|
||||||
|
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||||
|
item = get_item(item_data,"add_icon");
|
||||||
|
customer_display_view(item,"add");
|
||||||
|
}
|
||||||
|
|
||||||
|
show_item_detail(item_data,"add_icon");
|
||||||
|
calculate_sub_total();
|
||||||
|
autoScrollToItem(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
show_item_detail(item_data,"add_icon");
|
|
||||||
calculate_sub_total();
|
|
||||||
autoScrollToItem(code)
|
|
||||||
}); //End Add Icon Click
|
}); //End Add Icon Click
|
||||||
|
|
||||||
// scroll to element
|
// scroll to element
|
||||||
@@ -1270,6 +1274,8 @@ $(function() {
|
|||||||
}else{
|
}else{
|
||||||
window.location.href = "/origami/dashboard";
|
window.location.href = "/origami/dashboard";
|
||||||
}
|
}
|
||||||
|
}else if(window.location.href.incluses("out_of_stock")){
|
||||||
|
window.location.href = '/settings/out_of_stock';
|
||||||
}else{
|
}else{
|
||||||
var table_type = $('#table_type').text();
|
var table_type = $('#table_type').text();
|
||||||
var table_id = $('#table_id').text();
|
var table_id = $('#table_id').text();
|
||||||
@@ -1536,7 +1542,6 @@ $(function() {
|
|||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
menu_list.empty();
|
menu_list.empty();
|
||||||
for(var field in menu_items) {
|
for(var field in menu_items) {
|
||||||
console.log(menu_items[field].instances);
|
|
||||||
if (menu_items[field].is_sub_item == false) {
|
if (menu_items[field].is_sub_item == false) {
|
||||||
instances = menu_items[field].instances ;
|
instances = menu_items[field].instances ;
|
||||||
|
|
||||||
@@ -1577,6 +1582,7 @@ $(function() {
|
|||||||
data_target = 'sx_item_detailModal';
|
data_target = 'sx_item_detailModal';
|
||||||
data_modal = ''
|
data_modal = ''
|
||||||
add_icon = "add_icon"
|
add_icon = "add_icon"
|
||||||
|
menu_instances = [];
|
||||||
|
|
||||||
$(instances).each(function(i){
|
$(instances).each(function(i){
|
||||||
if (instances[i].is_default === true) {
|
if (instances[i].is_default === true) {
|
||||||
@@ -1589,6 +1595,10 @@ $(function() {
|
|||||||
promotion_price = instances[i].promotion_price;
|
promotion_price = instances[i].promotion_price;
|
||||||
code = instances[i].code;
|
code = instances[i].code;
|
||||||
out_of_stock = instances[i].out_of_stock;
|
out_of_stock = instances[i].out_of_stock;
|
||||||
|
menu_insta = [code,name,item_attributes];
|
||||||
|
}
|
||||||
|
if(instances[i].out_of_stock === false){
|
||||||
|
menu_instances.push(menu_insta);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1635,6 +1645,7 @@ $(function() {
|
|||||||
+'<span style="font-weight:900;flex-grow:1;">'+ price +'</span>'
|
+'<span style="font-weight:900;flex-grow:1;">'+ price +'</span>'
|
||||||
+ "<div class='offset-4 col-2 "+menu_item_box
|
+ "<div class='offset-4 col-2 "+menu_item_box
|
||||||
+ "' data-item-code='" + menu_items[field].code
|
+ "' data-item-code='" + menu_items[field].code
|
||||||
|
+ "' data-menu-instances='" + JSON.stringify(menu_instances)
|
||||||
+ "' data-instance='" + JSON.stringify(menu_items[field].instances)
|
+ "' data-instance='" + JSON.stringify(menu_items[field].instances)
|
||||||
+ "' data-id='" + JSON.stringify(menu_items[field].attributes)
|
+ "' data-id='" + JSON.stringify(menu_items[field].attributes)
|
||||||
+ "' data-item='" + JSON.stringify(item_attributes)
|
+ "' data-item='" + JSON.stringify(item_attributes)
|
||||||
@@ -1700,6 +1711,7 @@ $(function() {
|
|||||||
+'<span style="font-weight:900;flex-grow:1;">'+ price + '</span>'
|
+'<span style="font-weight:900;flex-grow:1;">'+ price + '</span>'
|
||||||
+" <div class='offset-4 col-2 menu_item_no_img_box "+menu_item_box+" ' "
|
+" <div class='offset-4 col-2 menu_item_no_img_box "+menu_item_box+" ' "
|
||||||
+" data-item-code='"+ menu_items[field].code +"' "
|
+" data-item-code='"+ menu_items[field].code +"' "
|
||||||
|
+" data-menu-instances = '" +JSON.stringify(menu_instances)+"' "
|
||||||
+" data-instance = '" +JSON.stringify(menu_items[field].instances)+"' "
|
+" data-instance = '" +JSON.stringify(menu_items[field].instances)+"' "
|
||||||
+" data-id = '"+JSON.stringify(menu_items[field].attributes)+"' "
|
+" data-id = '"+JSON.stringify(menu_items[field].attributes)+"' "
|
||||||
+" data-item = '" +JSON.stringify(item_attributes)+"' "
|
+" data-item = '" +JSON.stringify(item_attributes)+"' "
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
//= require custom.js
|
//= require custom.js
|
||||||
//= require jquery-fileupload/basic
|
//= require jquery-fileupload/basic
|
||||||
//= require induties/induties.js
|
//= require induties/induties.js
|
||||||
|
//= require select2
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.count-to').countTo();
|
$('.count-to').countTo();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
@import "BSBMaterial/themes/all-themes";
|
@import "BSBMaterial/themes/all-themes";
|
||||||
@import "reset";
|
@import "reset";
|
||||||
@import "induties/assign_in_duties";
|
@import "induties/assign_in_duties";
|
||||||
|
@import "select2";
|
||||||
|
|
||||||
/*@import "bootstrap-select/css/bootstrap-select.min";*/
|
/*@import "bootstrap-select/css/bootstrap-select.min";*/
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ class Api::Restaurant::OutOfStockController < Api::ApiController
|
|||||||
skip_before_action :authenticate
|
skip_before_action :authenticate
|
||||||
|
|
||||||
def index
|
def index
|
||||||
date = params[:date]
|
@out_of_stock = MenuItem.joins(:menu_item_instances).where(menu_item_instances: {is_out_of_stock: true}).select('menu_item_instances.id, menu_item_instances.item_instance_code, menu_item_instances.item_instance_name, menu_items.name, menu_item_instances.is_out_of_stock')
|
||||||
@out_of_stock = OutOfStock.where("DATE(date) = ?", date)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
id = MenuItemInstance.findParentCategory(@item)
|
id = MenuItemInstance.findParentCategory(@item)
|
||||||
@category = MenuCategory.find(id)
|
@category = MenuCategory.find(id)
|
||||||
@item_sets = ItemSet.all
|
@item_sets = ItemSet.all
|
||||||
|
@menu_item_instance = MenuItemInstance.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /settings/menu_item_instances
|
# POST /settings/menu_item_instances
|
||||||
@@ -65,7 +66,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item_instances.save
|
if @settings_menu_item_instances.save
|
||||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
@settings_menu_item_instances.item_attributes = JSON.parse params[:menu_item_instance][:item_attributes]
|
||||||
@settings_menu_item_instances.save
|
@settings_menu_item_instances.save
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||||
@@ -106,7 +107,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||||
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
@settings_menu_item_instances.item_attributes = JSON.parse params[:menu_item_instance][:item_attributes]
|
||||||
@settings_menu_item_instances.save
|
@settings_menu_item_instances.save
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
||||||
@@ -155,7 +156,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# To Only show in Menu item selected attrs
|
# To Only show in Menu item selected attrs
|
||||||
@item.item_attributes = MenuItemAttribute.where(id: @item.item_attributes).select("id, name").map { |e| [e.name, e.id] }
|
@item.item_attributes = MenuItemAttribute.where(id: @item.item_attributes).select("id, name, attribute_type").group_by(&:attribute_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Settings::OutOfStockController < ApplicationController
|
class Settings::OutOfStockController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@menu_items = MenuItem.joins(:menu_item_instances).where(menu_item_instances: {is_out_of_stock: true}).select('menu_item_instances.id, menu_item_instances.item_instance_code, menu_items.name, menu_item_instances.is_out_of_stock')
|
@menu_items = MenuItem.joins(:menu_item_instances).where(menu_item_instances: {is_out_of_stock: true}).select('menu_item_instances.id, menu_item_instances.item_instance_code, menu_item_instances.item_instance_name, menu_items.name, menu_item_instances.is_out_of_stock, menu_item_instances.item_attributes')
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@@ -26,7 +26,7 @@ class Settings::OutOfStockController < ApplicationController
|
|||||||
if !item_instance.first.is_out_of_stock?
|
if !item_instance.first.is_out_of_stock?
|
||||||
item_instance.update(is_out_of_stock: true)
|
item_instance.update(is_out_of_stock: true)
|
||||||
items_arr.each do |i|
|
items_arr.each do |i|
|
||||||
OutOfStock.create_out_of_stock(date,i)
|
# OutOfStock.create_out_of_stock(date,i)
|
||||||
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: i, status: true
|
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: i, status: true
|
||||||
end
|
end
|
||||||
elsif item_instance.first.is_out_of_stock?
|
elsif item_instance.first.is_out_of_stock?
|
||||||
@@ -43,7 +43,7 @@ class Settings::OutOfStockController < ApplicationController
|
|||||||
unless item_instance.nil?
|
unless item_instance.nil?
|
||||||
item_instance.update(is_out_of_stock: false)
|
item_instance.update(is_out_of_stock: false)
|
||||||
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: item_instance.item_instance_code, status: false
|
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: item_instance.item_instance_code, status: false
|
||||||
OutOfStock.where(item_instance_code: item_instance.item_instance_code, created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).destroy_all
|
# OutOfStock.where(item_instance_code: item_instance.item_instance_code, created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).destroy_all
|
||||||
flash[:message] = 'Out of stock was successfully destroyed.'
|
flash[:message] = 'Out of stock was successfully destroyed.'
|
||||||
render :json => {:status=> "Success", :url => settings_out_of_stock_index_url }.to_json
|
render :json => {:status=> "Success", :url => settings_out_of_stock_index_url }.to_json
|
||||||
end
|
end
|
||||||
@@ -55,7 +55,7 @@ class Settings::OutOfStockController < ApplicationController
|
|||||||
item_instance.update(is_out_of_stock: false)
|
item_instance.update(is_out_of_stock: false)
|
||||||
item_instance.each do |i|
|
item_instance.each do |i|
|
||||||
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: i.item_instance_code, status: false
|
ActionCable.server.broadcast "out_of_stock_channel", item_instance_code: i.item_instance_code, status: false
|
||||||
OutOfStock.where(item_instance_code: i.item_instance_code, created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).destroy_all
|
# OutOfStock.where(item_instance_code: i.item_instance_code, created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).destroy_all
|
||||||
end
|
end
|
||||||
flash[:message] = 'Out of stock was successfully destroyed.'
|
flash[:message] = 'Out of stock was successfully destroyed.'
|
||||||
render :json => {:status=> "Success", :url => settings_out_of_stock_index_url }.to_json
|
render :json => {:status=> "Success", :url => settings_out_of_stock_index_url }.to_json
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
class OutOfStock < ApplicationRecord
|
|
||||||
def self.create_out_of_stock(date,item_instance_code)
|
|
||||||
OutOfStock.create(
|
|
||||||
date: date,
|
|
||||||
item_instance_code: item_instance_code
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
out_of_stock_json = json.array! @out_of_stock do |oos|
|
json.status true
|
||||||
json.date oos.date
|
json.data @out_of_stock do |oos|
|
||||||
json.item_instance_code oos.item_instance_code
|
json.item_instance_code oos.item_instance_code
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -349,7 +349,7 @@
|
|||||||
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
||||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
|
<div class="modal-body" data-height="50">
|
||||||
<div class="row set-item">
|
<div class="row set-item">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||||
|
|||||||
@@ -25,7 +25,10 @@
|
|||||||
<%= f.input :item_instance_name %>
|
<%= f.input :item_instance_name %>
|
||||||
<%= f.input :price %>
|
<%= f.input :price %>
|
||||||
|
|
||||||
<%= f.input :item_attributes, collection: @item.item_attributes, include_blank: false, include_hidden: false%>
|
<% @item.item_attributes.each do |type, value| %>
|
||||||
|
<%= f.input :attributes, :label => type, :collection => value.map {|v| [v['name'], v['id']]}, :include_blank => false, :input_html => {:class => "form-control item_sets #{type}"} %>
|
||||||
|
<% end %>
|
||||||
|
<%= f.input :item_attributes, :as => :hidden, :input_html => { :value => '', :id => "attr_type" } %>
|
||||||
|
|
||||||
<%= f.input :is_on_promotion %>
|
<%= f.input :is_on_promotion %>
|
||||||
<%= f.input :promotion_price %>
|
<%= f.input :promotion_price %>
|
||||||
@@ -72,3 +75,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
attr_type = <%= raw @item.item_attributes.to_json %>;
|
||||||
|
attr_id = [];
|
||||||
|
if (window.location.pathname.includes('edit')){
|
||||||
|
item_attributes = <%= raw @menu_item_instance.item_attributes.to_json %>
|
||||||
|
$.each(item_attributes, function (key, value){
|
||||||
|
$.each(attr_type, function(k, v) {
|
||||||
|
$('.' + k + ' > option').each(function(){
|
||||||
|
if ($(this).val() == value ) {
|
||||||
|
$(this).prop("selected",true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
set_option(attr_type);
|
||||||
|
$('.item_sets').change(function() {
|
||||||
|
attr_id = [];
|
||||||
|
set_option(attr_type);
|
||||||
|
});
|
||||||
|
|
||||||
|
function set_option(attr_type){
|
||||||
|
$.each(attr_type, function(k, v) {
|
||||||
|
option = $('.' + k + ' option:selected').val();
|
||||||
|
console.log(option);
|
||||||
|
attr_id.push(option);
|
||||||
|
});
|
||||||
|
$('#attr_type').val(JSON.stringify(attr_id));
|
||||||
|
};
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1 +1,13 @@
|
|||||||
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
|
<%= render 'form', settings_simple_menu_item_menu_item_instances: @settings_menu_item_instances, item_sets: @item_sets %>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
attr_type = <%= raw @item.item_attributes.to_json %>;
|
||||||
|
attr_id = [];
|
||||||
|
$.each(attr_type, function(k, v) {
|
||||||
|
option = $('.' + k + ' option:selected').val();
|
||||||
|
attr_id.push(option);
|
||||||
|
});
|
||||||
|
$('#attr_type').val(JSON.stringify(attr_id));
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'addorder', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
|
||||||
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
|
||||||
<div id="oqs_loading_wrapper" style="display:none;">
|
<div id="oqs_loading_wrapper" style="display:none;">
|
||||||
<div id="oqs_loading"></div>
|
<div id="oqs_loading"></div>
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
<div class="item-modal modal sx_item_detailModal" id="sx_item_detailModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
|
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
|
||||||
@@ -114,21 +114,26 @@
|
|||||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="form-inputs">
|
<div class="row no-set-item">
|
||||||
|
<div class="col-md-5">
|
||||||
<div class="form-group">
|
<p style="text-align: center;" id="modal_box_img"></p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7 item-detail">
|
||||||
|
<div class="form-inputs">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="attribute">Menu Item</label>
|
<!-- <input type="hidden" name="item_code" id="instance_code">
|
||||||
<input class="form-control col-md-6" type="text" value="" id="item_name" readonly="true">
|
<input type="hidden" name="instance_name" id="instance_name"> -->
|
||||||
|
<div class="form-group">
|
||||||
|
<div class='instance-label' style='margin-bottom: 8px;'>
|
||||||
|
<label class="control-label" for="attribute">Instances</label>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="attributes-list col-md-6"></div> -->
|
||||||
|
<select class="form-control" name="item_instance" id="instance_select" multiple="multiple"></select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="item_code" id="instance_code">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="attribute">Instances</label>
|
|
||||||
<div class="attributes-list col-md-6"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -140,9 +145,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.fadeInRight{
|
.fadeInRight{
|
||||||
-webkit-animation-duration: 350ms !important;
|
-webkit-animation-duration: 350ms !important;
|
||||||
@@ -155,9 +160,8 @@
|
|||||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||||
if (menus != null) {
|
if (menus != null) {
|
||||||
var id = menus[0]["categories"][0]["id"];
|
var id = menus[0]["categories"][0]["id"];
|
||||||
// console.log(id);
|
|
||||||
}else{
|
}else{
|
||||||
var id = 1;
|
var id = 1;
|
||||||
}
|
}
|
||||||
jQuery('.first_'+id).click();
|
jQuery('.first_'+id).click();
|
||||||
});
|
});
|
||||||
@@ -202,10 +206,8 @@
|
|||||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||||
|
|
||||||
if (menus != null) {
|
if (menus != null) {
|
||||||
console.log("hi")
|
|
||||||
menu_click_cache_append(name,menus,menu_id);
|
menu_click_cache_append(name,menus,menu_id);
|
||||||
}else{
|
}else{
|
||||||
console.log("sssdfdf")
|
|
||||||
var url = "/origami/addorders/get_menu/"+menu_id;
|
var url = "/origami/addorders/get_menu/"+menu_id;
|
||||||
show_menu_cat_list(name, url);
|
show_menu_cat_list(name, url);
|
||||||
}
|
}
|
||||||
@@ -332,6 +334,66 @@
|
|||||||
});
|
});
|
||||||
//End menu category Click
|
//End menu category Click
|
||||||
|
|
||||||
|
//show menu item list when click menu category
|
||||||
|
function show_sub_category_list(url,sub_category,menu_id){
|
||||||
|
|
||||||
|
var sub_category_list = $('.sub_category_list');
|
||||||
|
sub_category_list.empty();
|
||||||
|
|
||||||
|
menus = JSON.parse(localStorage.getItem("menus"));
|
||||||
|
if (menus != null) {
|
||||||
|
for(var j in menus) {
|
||||||
|
var categories = menus[j]["categories"];
|
||||||
|
for(var ii in categories) {
|
||||||
|
if (menu_id == categories[ii]["parent_id"]) {
|
||||||
|
$(sub_category).removeClass('hidden');
|
||||||
|
row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
|
||||||
|
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
|
||||||
|
+'</li>' ;
|
||||||
|
$(sub_category).append(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (type != -1 && modify_order != -1) {
|
||||||
|
var url = "../../../addorders/"+url;
|
||||||
|
}if(modify_order== -1 && type != -1){
|
||||||
|
var url = 'addorders/'+url;
|
||||||
|
}
|
||||||
|
if (type ==-1 && modify_order == -1){
|
||||||
|
var url = url;
|
||||||
|
}
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
var sub_category_list = $('.sub_category_list');
|
||||||
|
sub_category_list.empty();
|
||||||
|
data = data.sub_category;
|
||||||
|
if (data.length > 0) {
|
||||||
|
// if ((sub_category.hasClass('hidden'))) {
|
||||||
|
$(sub_category).removeClass('hidden');
|
||||||
|
// }else{
|
||||||
|
// $(sub_category).addClass('hidden');
|
||||||
|
// }
|
||||||
|
for(var i in data) {
|
||||||
|
|
||||||
|
row = '<li class="menu_sub_category fadeInTop" data-id="'+data[i].id+'">'
|
||||||
|
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
|
||||||
|
+'</li>' ;
|
||||||
|
$(sub_category).append(row);
|
||||||
|
//end is_sub_item false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//end Ajax
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//show menu item list when click menu category
|
//show menu item list when click menu category
|
||||||
function show_menu_item_list(url_item,menu_id){
|
function show_menu_item_list(url_item,menu_id){
|
||||||
var menu_list = $('.menu_items_list');
|
var menu_list = $('.menu_items_list');
|
||||||
@@ -386,8 +448,9 @@
|
|||||||
add = 'view_list'
|
add = 'view_list'
|
||||||
menu_item_box = 'menu_item_box';
|
menu_item_box = 'menu_item_box';
|
||||||
data_target = 'sx_item_detailModal';
|
data_target = 'sx_item_detailModal';
|
||||||
data_modal = ''
|
data_modal = 'modal'
|
||||||
add_icon = "add_icon"
|
add_icon = "add_icon"
|
||||||
|
menu_instances = [];
|
||||||
|
|
||||||
$(instances).each(function(i){
|
$(instances).each(function(i){
|
||||||
if (instances[i].is_default === true) {
|
if (instances[i].is_default === true) {
|
||||||
@@ -401,6 +464,7 @@
|
|||||||
code = instances[i].code;
|
code = instances[i].code;
|
||||||
out_of_stock = instances[i].out_of_stock;
|
out_of_stock = instances[i].out_of_stock;
|
||||||
}
|
}
|
||||||
|
menu_instances.push(item_attributes);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (menu_items[field].image) {
|
if (menu_items[field].image) {
|
||||||
@@ -464,54 +528,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//click item row for add order
|
//click item row for add order
|
||||||
$(document).on('click', '.card-box', function(event){
|
$(document).on('click', '.add_icon', function(event){
|
||||||
|
});
|
||||||
|
|
||||||
// item_data = $(this).children().siblings('.add_icon');
|
$(document).on('click', '.menu_item_box', function(event){
|
||||||
var disable_item = $(this);
|
$('#instance_select').empty();
|
||||||
var item_data = $(this).children().last();
|
$('#instance_select').select2({placeholder: "Select Instance"});
|
||||||
item_instance_name = item_data.attr('data-name');
|
$('#instance_select').on('select2:select', function(e){
|
||||||
item_instance_code = item_data.attr('data-instance-code');
|
$(this).select2('open');
|
||||||
|
});
|
||||||
instance_attributes = []
|
var instances = $(this).data('menu-instances');
|
||||||
for(var field in instances) {
|
var item_row = $('.summary-items tbody tr');
|
||||||
value = instances[field].values;
|
if(item_row.length > 0){
|
||||||
$(value).each(function(i){
|
$(instances).each(function(i){
|
||||||
options = value[i];
|
var append = 0;
|
||||||
instance_attributes.push(options);
|
if (instances[i][1] != ""){ instance_name = instances[i][1]; }else{ instance_name = instances[i][2][0]; };
|
||||||
|
$(item_row).each(function(e){
|
||||||
|
instance_code = $(item_row[e]).attr('data-instance-code');
|
||||||
|
if(instances[i][0] == instance_code){
|
||||||
|
append = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(append == 0){
|
||||||
|
$('#instance_select').append('<option class="instance_name"' + 'id=' + instances[i][0] + ' value=' + instances[i][0] + '>' + instance_name + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
$(instances).each(function(i){
|
||||||
|
if (instances[i][1] != ""){ instance_name = instances[i][1]; }else{ instance_name = instances[i][2][0]; };
|
||||||
|
$('#instance_select').append('<option class="instance_name"' + 'id=' + instances[i][0] + ' value=' + instances[i][0] + '>' + instance_name + '</option>');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
|
||||||
var item_row = $('.summary-items tbody tr');
|
|
||||||
|
|
||||||
$(item_row).each(function(i){
|
|
||||||
item_name = $(item_row[i]).attr('data-item-name');
|
|
||||||
instance_code = $(item_row[i]).attr('data-instance-code');
|
|
||||||
|
|
||||||
if (item_name == item_data.attr('data-name') && instance_code == item_data.attr('data-instance-code')) {
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
row ="<tr class='item_box' data-instance-code='"
|
|
||||||
+item_data.attr('data-instance-code')+"' data-item-name='"
|
|
||||||
+item_data.attr('data-name')+"' data-row='"
|
|
||||||
+rowCount+"'>"
|
|
||||||
+'<td class="">'+rowCount+'</td>'
|
|
||||||
+'<td class="hidden" id="item_instance_code">' + item_instance_code +'</td>'
|
|
||||||
+'<td class="">' + item_instance_name +'</td>'
|
|
||||||
+"<td class='delete_item'> <i class='material-icons' style='cursor: pointer;'>delete</i> </td>"
|
|
||||||
+'</tr>';
|
|
||||||
$(".summary-items tbody").append(row);
|
|
||||||
$(disable_item).css({"pointer-events": "none", "opacity": "0.4"});
|
|
||||||
|
|
||||||
if ($('.summary-items tbody tr').length > 0) {
|
|
||||||
$('#add_out_of_stock').removeAttr("disabled", false);
|
|
||||||
}else{
|
|
||||||
$('#add_out_of_stock').attr("disabled", true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.delete_item', function(event){
|
$(document).on('click', '.delete_item', function(event){
|
||||||
@@ -522,6 +569,11 @@
|
|||||||
tmp.appendTo(item.parent());
|
tmp.appendTo(item.parent());
|
||||||
enable_item = $("div:contains("+item_name+")");
|
enable_item = $("div:contains("+item_name+")");
|
||||||
$(enable_item).css({"pointer-events": "", "opacity": ""});
|
$(enable_item).css({"pointer-events": "", "opacity": ""});
|
||||||
|
if ($('.summary-items tbody tr').length == 0) {
|
||||||
|
$('#add_out_of_stock').attr("disabled", true);
|
||||||
|
}else{
|
||||||
|
$('#add_out_of_stock').removeAttr("disabled", false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#clear_all', function(event){
|
$(document).on('click', '#clear_all', function(event){
|
||||||
@@ -637,7 +689,6 @@
|
|||||||
}else{
|
}else{
|
||||||
$('#modal-qty').val(original_qty + input_value);
|
$('#modal-qty').val(original_qty + input_value);
|
||||||
$('#modal-qty').attr('data-value',original_qty + input_value);
|
$('#modal-qty').attr('data-value',original_qty + input_value);
|
||||||
// update_total_amount();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'add':
|
case 'add':
|
||||||
@@ -659,40 +710,66 @@
|
|||||||
|
|
||||||
// click select option icon for add
|
// click select option icon for add
|
||||||
$(document).on('click', '.submit', function(event){
|
$(document).on('click', '.submit', function(event){
|
||||||
|
total_price = $('#total_price').text();
|
||||||
|
qty = parseInt($('#count').val());
|
||||||
|
|
||||||
var item_code = $("#instance_code").val();
|
var item_row = $('.selected-attribute');
|
||||||
var min_qty = $("#min_qty").val();
|
attribute_arr = get_selected_attributes('selected-attribute');
|
||||||
var max_qty = $("#max_qty").val();
|
option_arr = get_selected_attributes('selected-option');
|
||||||
var item_name = $("#item_name").val();
|
|
||||||
|
|
||||||
console.log(item_code);
|
data = $("#instance_select").select2('data');
|
||||||
console.log(min_qty);
|
if (data != null){
|
||||||
console.log(max_qty);
|
instance_code = data[0].id;
|
||||||
var params = {'item_code': item_code};
|
instance_name = data[0].text;
|
||||||
var ajax_url = 'settings_update_menu_items_path';
|
code_name = [instance_code,instance_name];
|
||||||
$.ajax({
|
}
|
||||||
type: "POST",
|
|
||||||
url: ajax_url,
|
$('.submit').attr('data-item-code',$('#item_code').text());
|
||||||
data: params,
|
$('.submit').attr('data-instance-arr',JSON.stringify(data));
|
||||||
dataType: "json",
|
$('.submit').attr('data-name',$('#title_name').text());
|
||||||
success:function(result){
|
$('.submit').attr('data-attributes',JSON.stringify(attribute_arr));
|
||||||
if (result.status) {
|
$('.submit').attr('data-options',JSON.stringify(option_arr));
|
||||||
var rowCount = $('.summary-items tbody tr').length+1;
|
$('.submit').attr('data-opt',JSON.stringify(option_arr));
|
||||||
row ="<tr class=''>"
|
var item_data = $(this);
|
||||||
+'<td class="">'+rowCount+'</td>'
|
show_item_detail(item_data,"add_to_order");
|
||||||
+'<td class="hidden" id="itemCodeee">' + item_code +'</td>'
|
|
||||||
+'<td class="">' + item_name +'</td>'
|
|
||||||
+'</tr>';
|
|
||||||
$(".summary-items tbody").append(row);
|
|
||||||
swal("Success",result.message,"success");
|
|
||||||
}else{
|
|
||||||
swal("Opps",result.message,"warning");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// +'<td class="" onClick="remove()"><i class="material-icons"style="cursor: pointer;">delete_forever</i></td>'
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function show_item_detail(data,click_type){
|
||||||
|
testqty = parseInt($('.item_box').children('data_qty').text());
|
||||||
|
qty = parseInt(data.attr('data-qty'));
|
||||||
|
append = 0;
|
||||||
|
price = data.attr('data-price');
|
||||||
|
instance_name = data.attr('data-instance');
|
||||||
|
instance_arr = JSON.parse(data.attr('data-instance-arr'));
|
||||||
|
|
||||||
|
for(var i in instance_arr){
|
||||||
|
if (instance_name == "undefined"){
|
||||||
|
instance = '';
|
||||||
|
}else{
|
||||||
|
instance = "("+instance_arr[i].text+")";
|
||||||
|
}
|
||||||
|
|
||||||
|
var rowCount = $('.summary-items tbody tr').length+1;
|
||||||
|
var item_row = $('.summary-items tbody tr');
|
||||||
|
|
||||||
|
row ="<tr class='item_box' data-price ='"
|
||||||
|
+price+ " 'data-toggle='modal' data-target='#sx_itemModal' data-instance ='"
|
||||||
|
+instance+ "' data-qty='"+qty +"' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
||||||
|
+instance_arr[i].id+"' data-attributes='"
|
||||||
|
+data.attr('data-attributes')
|
||||||
|
+"' data-row ='"+rowCount+ "'>"
|
||||||
|
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||||
|
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +'</td>'
|
||||||
|
+"<td class='delete_item'> <i class='material-icons' style='cursor: pointer;'>delete</i> </td>"
|
||||||
|
+'</tr>';
|
||||||
|
$(".summary-items tbody").append(row);
|
||||||
|
}
|
||||||
|
if ($('.summary-items tbody tr').length == 0) {
|
||||||
|
$('#add_out_of_stock').attr("disabled", true);
|
||||||
|
}else{
|
||||||
|
$('#add_out_of_stock').removeAttr("disabled", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#back').on('click', function () {
|
$('#back').on('click', function () {
|
||||||
window.location.href = '/settings/out_of_stock';
|
window.location.href = '/settings/out_of_stock';
|
||||||
@@ -700,38 +777,4 @@
|
|||||||
$('#stock_taking').on('click', function () {
|
$('#stock_taking').on('click', function () {
|
||||||
window.location.href = '/inventory/stock_checks';
|
window.location.href = '/inventory/stock_checks';
|
||||||
});
|
});
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// $('.remove_row').on('click', function(){
|
|
||||||
// window.location.href = '/inventory';
|
|
||||||
// console.log('remove row!!!!!');
|
|
||||||
// alert('Are you suer?');
|
|
||||||
// });
|
|
||||||
|
|
||||||
// function remove(){
|
|
||||||
// var itemCode = $("#itemCodeee").text();
|
|
||||||
//
|
|
||||||
// var params = {'item_code': itemCode};
|
|
||||||
// var ajax_url = '<%=inventory_inventory_definitions_path%>';
|
|
||||||
// $.ajax({
|
|
||||||
// type: "POST",
|
|
||||||
// url: ajax_url,
|
|
||||||
// data: params,
|
|
||||||
// dataType: "json",
|
|
||||||
// success:function(result){
|
|
||||||
// if (result.status) {
|
|
||||||
// var rowCount = $('.summary-items tbody tr').length+1;
|
|
||||||
// row =
|
|
||||||
// $(".summary-items tbody").append(row);
|
|
||||||
// swal("Success",result.message,"success");
|
|
||||||
// }else{
|
|
||||||
// swal("Opps",result.message,"warning");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// console.log('remove row!!!!!');
|
|
||||||
// console.log(itemCode);
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t("views.right_panel.detail.product") %></th>
|
<th><%= t("views.right_panel.detail.product") %></th>
|
||||||
|
<th><%= t("views.right_panel.detail.instance_name") %></th>
|
||||||
|
<th><%= t("views.right_panel.detail.atrribute_name") %></th>
|
||||||
<th><%= t("views.right_panel.detail.status") %></th>
|
<th><%= t("views.right_panel.detail.status") %></th>
|
||||||
<th><%= t("views.right_panel.detail.action") %></th>
|
<th><%= t("views.right_panel.detail.action") %></th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -14,6 +16,12 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= item.name rescue '-' %></td>
|
<td><%= item.name rescue '-' %></td>
|
||||||
|
<% if !item.item_instance_name.blank? %>
|
||||||
|
<td><%= item.item_instance_name rescue '-' %></td>
|
||||||
|
<% else %>
|
||||||
|
<td><p style="font-size: 20px;">-</p></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= JSON.parse(MenuItemAttribute.where(id: item.item_attributes).pluck(:name).to_s).join(', ') %></td>
|
||||||
<td>
|
<td>
|
||||||
<% if item.is_out_of_stock %>
|
<% if item.is_out_of_stock %>
|
||||||
<div class="badge badge-success">Active</div>
|
<div class="badge badge-success">Active</div>
|
||||||
|
|||||||
@@ -30,8 +30,26 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
$(document).ready(function (){
|
||||||
|
getAllMenu();
|
||||||
|
});
|
||||||
|
|
||||||
$('#new_out_of_stock').on('click',function(){
|
$('#new_out_of_stock').on('click',function(){
|
||||||
window.location.href = '/settings/out_of_stock/new';
|
window.location.href = '/settings/out_of_stock/new';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getAllMenu(){
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: '/foodcourt/get_all_menu',
|
||||||
|
data: {},
|
||||||
|
success:function(result){
|
||||||
|
if (result != null ) {
|
||||||
|
var menus = JSON.stringify(result);
|
||||||
|
localStorage.setItem("menus", menus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
9
db/migrate/20200319113930_drop_out_of_stock_table.rb
Normal file
9
db/migrate/20200319113930_drop_out_of_stock_table.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class DropOutOfStockTable < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
drop_table :out_of_stocks
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
raise ActiveRecord::IrreversibleMigration
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -129,10 +129,6 @@ delete from sym_node;
|
|||||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
||||||
values('display_images','display_images','setting',current_timestamp,current_timestamp);
|
values('display_images','display_images','setting',current_timestamp,current_timestamp);
|
||||||
|
|
||||||
insert into sym_trigger
|
|
||||||
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
|
|
||||||
values('out_of_stocks','out_of_stocks','setting',current_timestamp,current_timestamp);
|
|
||||||
|
|
||||||
# Create Trigger for Dining Channel
|
# Create Trigger for Dining Channel
|
||||||
|
|
||||||
insert into sym_trigger
|
insert into sym_trigger
|
||||||
@@ -401,10 +397,6 @@ delete from sym_node;
|
|||||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||||
values('display_images','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
values('display_images','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
||||||
|
|
||||||
insert into sym_trigger_router
|
|
||||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
|
||||||
values('out_of_stocks','cloud_2_sx', 100, current_timestamp, current_timestamp);
|
|
||||||
|
|
||||||
# Setting Channel # From Master to cloud
|
# Setting Channel # From Master to cloud
|
||||||
|
|
||||||
insert into sym_trigger_router
|
insert into sym_trigger_router
|
||||||
@@ -447,10 +439,6 @@ delete from sym_node;
|
|||||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
||||||
values('display_images','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
values('display_images','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
||||||
|
|
||||||
insert into sym_trigger_router
|
|
||||||
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
|
|
||||||
values('out_of_stocks','sx_2_cloud', 100, current_timestamp, current_timestamp);
|
|
||||||
|
|
||||||
#End Setting Channel
|
#End Setting Channel
|
||||||
|
|
||||||
# Dining Channel # From cloud to SX
|
# Dining Channel # From cloud to SX
|
||||||
|
|||||||
Reference in New Issue
Block a user