+ <%= pro.hidden_field :item_code,:class => "promo_product" %>
<% arr = MenuItem.active.order("name desc").pluck(:name,:item_code) %>
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
<% arr.push(p) %>
<% end %>
-
+
- <% sample = [] %>
-
<%= pro.input :item_code, :class => 'promoproduct', collection: sample,input_html: { selected: 2 }, label: false %>
+
+
+
<%= pro.input :item_code, :class => 'promoproduct', collection:[],input_html: { selected: 2 }, label: false %>
+
<%= pro.input :min_qty , label: false%>
<%= pro.input :net_off , label: false %>
<%= pro.input :net_price , label: false %>
@@ -156,14 +162,24 @@ $(document).ready(function(){
$('#promotion_promo_start_hour').datetimepicker({
datepicker:false,
format:'H:m'
- });
+ });
$('#promotion_promo_end_hour').datetimepicker({
datepicker:false,
format:'H:m'
});
+ $('#promotion_promo_start_hour').on('change', function(event) {
+ $('#promotion_promo_start_hour').val($('#promotion_promo_start_hour').val().split(":")[0]+":00");
+ });
+ $('#promotion_promo_end_hour').on('change', function(event) {
+ $('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
+ });
+ var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
+ jQuery.each( dayy.split(","), function( i, d ) {
+ $("input.selectDay[value='"+d+"']").prop( "checked", true );
+ });
var form = document.getElementById("new_promotion");
var inputs = $("input");
@@ -197,7 +213,7 @@ $(".selectDay").click(function() {
$("#promotion_original_product").select2();
$(".item_code_place").select2();
$(".item_code_place").on('change', function(event) {
- var ajax_url = "<%= settings_find_item_instance_path %>";
+ var ajax_url = "<%= settings_find_item_instance_path %>";
var item_code = this.value;
$.ajax({
type: "GET",
@@ -223,6 +239,29 @@ $(".selectDay").click(function() {
callforpromoproduct();
}, 0);
});
+
+ // for promotion products data showing
+ var promopdt = $(".promo_product");
+ jQuery.each( promopdt, function( i, ppdt ) {
+ var ajax_url = "<%= settings_find_parent_item_path %>";
+ var item_code = ppdt.value;
+ var select_id = ppdt.id;
+ $.ajax({
+ type: "GET",
+ url: ajax_url,
+ data: 'item_instance_code=' + item_code,
+ success: function (result) {
+ if(result.length > 0){
+ $("select#"+select_id).empty();
+ $("select#"+select_id).append("
"+result[0]+" ");
+ $("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").find("option[value='"+result[1]+"']").attr("selected","true")
+ $("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
+ }
+ }
+ });
+ });
+
+ // promotion_promotion_products_attributes_0_item_code
function callforpromoproduct(){
$(".item_code_place1").select2();
$(".item_code_place1").on('change', function(event) {
@@ -234,16 +273,17 @@ $(".selectDay").click(function() {
url: ajax_url,
data: 'item_code=' + item_code,
success: function (result) {
- $("#"+id).empty();
+ $("select#"+id).empty();
var itemlist;
for (var i = 0; i < result.length; i++) {
itemlist += "
"+result[i][0]+" "
}
- $("#"+id).append(itemlist);
- $("#"+id).select2();
+ $("select#"+id).append(itemlist);
+ $("select#"+id).select2();
}
});
});
}
+
});
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index bcb83367..3b43f5ea 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -36,3 +36,7 @@ Rails.application.config.assets.precompile += %w( fileinput.min.js )
# --- Customer/ Customer - Crm ----
Rails.application.config.assets.precompile += %w( addorder.css )
Rails.application.config.assets.precompile += %w( addorder.js )
+
+# --- Inventory Definition ----
+Rails.application.config.assets.precompile += %w( inventory_definitions.css )
+
diff --git a/config/routes.rb b/config/routes.rb
index 95315b8a..6ac723aa 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -88,14 +88,14 @@ Rails.application.routes.draw do
post 'item_void_cancel' => "sale_edit#item_void_cancel"
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
post 'apply_void' => 'sale_edit#apply_void'
- # in_juties
- get '/table/:table_id/assign_in_juty' => 'in_juties#assign_in_juty', as: 'assign_in_juty'
- get 'assign_in_juty/:table_id' => 'in_juties#index_in_juty', as: 'index_in_juty'
- post 'assign_in_juty/:table_id' => 'in_juties#create_for_in_juty'
+ # in_duties
+ get '/table/:table_id/assign_in_duty' => 'in_duties#assign_in_duty', as: 'assign_in_duty'
+ get 'assign_in_duty/:table_id' => 'in_duties#index_in_duty', as: 'index_in_duty'
+ post 'assign_in_duty/:table_id' => 'in_duties#create_for_in_duty'
- get 'assign_in_juty/table/:table_id/in_juty/:id/edit' => 'in_juties#edit_in_juty' ,as: 'edit_in_juty'
- patch 'edit_in_juty/:id' => 'in_juties#update_for_in_juty', as: 'update_for_in_juty'
- delete 'table/:table_id/destroy_in_juty/:id' => 'in_juties#destroy_in_juty', as: 'destroy_in_juty'
+ get 'assign_in_duty/table/:table_id/in_duty/:id/edit' => 'in_duties#edit_in_duty' ,as: 'edit_in_duty'
+ patch 'edit_in_duty/:id' => 'in_duties#update_for_in_duty', as: 'update_for_in_duty'
+ delete 'table/:table_id/destroy_in_duty/:id' => 'in_duties#destroy_in_duty', as: 'destroy_in_duty'
get 'table/:dining_id/movetable' => "movetable#move_dining"
get 'table/:dining_id/moveroom' => "moveroom#move_dining"
@@ -184,7 +184,8 @@ Rails.application.routes.draw do
resources :commissions
resources :commissioners
- resources :in_juties
+ resources :addorders
+ resources :in_duties
# product_commission
get 'table/:table_id/sale/:sale_id/load_commissioners' => 'product_commissions#load_commissioners', as: 'load_commissioners'
@@ -305,6 +306,7 @@ Rails.application.routes.draw do
resources :promotion_products
end
get '/find_item_instance' => 'promotions#find_item_instance', as:'find_item_instance'
+ get '/find_parent_item' => 'promotions#find_parent_item', as:'find_parent_item'
# commission
resources :commissions
@@ -335,6 +337,7 @@ Rails.application.routes.draw do
resources :credit_payment, :only => [:index, :show]
resources :void_sale, :only => [:index, :show]
resources :commission, :only => [:index, :show]
+ resources :stock_check, :only => [:index, :show]
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
end
diff --git a/db/migrate/20170823081747_create_in_juties.rb b/db/migrate/20170823081748_create_in_duties.rb
similarity index 54%
rename from db/migrate/20170823081747_create_in_juties.rb
rename to db/migrate/20170823081748_create_in_duties.rb
index 15e48483..ca6d15b2 100644
--- a/db/migrate/20170823081747_create_in_juties.rb
+++ b/db/migrate/20170823081748_create_in_duties.rb
@@ -1,7 +1,9 @@
-class CreateInJuties < ActiveRecord::Migration[5.1]
+class CreateInDuties < ActiveRecord::Migration[5.1]
def change
- create_table :in_juties do |t|
+ create_table :in_duties do |t|
t.integer :dinning_id
+ t.string :booking_id
+ t.string :sale_id
t.json :commissioner_ids
t.datetime :in_time
t.datetime :out_time
diff --git a/spec/controllers/origami/in_juties_controller_spec.rb b/spec/controllers/origami/in_duties_controller_spec.rb
similarity index 97%
rename from spec/controllers/origami/in_juties_controller_spec.rb
rename to spec/controllers/origami/in_duties_controller_spec.rb
index ac4dfe63..1d5c466b 100644
--- a/spec/controllers/origami/in_juties_controller_spec.rb
+++ b/spec/controllers/origami/in_duties_controller_spec.rb
@@ -23,7 +23,7 @@ require 'rails_helper'
# removed from Rails core in Rails 5, but can be added back in via the
# `rails-controller-testing` gem.
-RSpec.describe Origami::InJutiesController, type: :controller do
+RSpec.describe Origami::InDutiesController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# InJuty. As you add validations to InJuty, be sure to
@@ -38,7 +38,7 @@ RSpec.describe Origami::InJutiesController, type: :controller do
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
- # Origami::InJutiesController. Be sure to keep this updated too.
+ # Origami::InDutiesController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
diff --git a/spec/models/in_juty_spec.rb b/spec/models/in_duty_spec.rb
similarity index 68%
rename from spec/models/in_juty_spec.rb
rename to spec/models/in_duty_spec.rb
index 163b6534..b3015536 100644
--- a/spec/models/in_juty_spec.rb
+++ b/spec/models/in_duty_spec.rb
@@ -1,5 +1,5 @@
require 'rails_helper'
-RSpec.describe InJuty, type: :model do
+RSpec.describe InDuty, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end