- <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
- <%= f.input :in_time %>
- <%= f.input :out_time %>
-
+
+ <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
+
+ <%= f.input :in_time %>
+ <%= f.input :out_time %>
+
-
-<%= simple_form_for([:origami,@in_juty]) do |f| %>
- <%= f.error_notification %>
+<%= simple_form_for @in_juty, :url => origami_index_in_juty_path(@table.id), :method => :post do |f| %>
+
+ <%= f.error_notification %>
+ <%= f.hidden_field :id, :class => "form-control col-md-6 " %>
+
+
+
+ <%= f.hidden_field :dinning_id, :value => @table.id, :class => "form-control col-md-4 " %>
+
+
+ <%= @table.name %>
+
+
+
+
+ <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
+
+
+ <%= f.input :in_time, :placeholder => "From Date", :class => "form-control" %>
+
+ <%= f.input :out_time, :placeholder => "To Date", :class => "form-control" %>
+
+
+
+
+ <% f.button :submit, "Create", :class => 'btn btn-primary ', :id => 'create' %>
+ <% f.button :submit, "Update", :class => 'btn btn-primary ', :disabled => '', :id => 'update' %>
+ <% f.button :button, "Reset", :class => 'btn btn-danger ', :id => 'reset' %>
+
+
+ <%= f.button :submit, :class => 'btn btn-primary' %>
+
-
- <%= f.label :dinning_id %>
- <%= f.collection_select :dinning_id, DiningFacility.all, :id, :name, {prompt: 'Select Dining Facilities'}, {class: 'form-control'} %>
- <%= f.label :commissioner_ids %>
- <%= f.collection_select :commissioner_ids, Commissioner.all, :id, :name, {prompt: 'Select Commissioner'}, {class: 'form-control'} %>
-
- <%= f.text_field :in_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
-
- <%= f.text_field :out_time, :value=>DateTime.now.strftime("%Y-%m-%d / %I:%M %p"),:class=>"form-control datepicker"%>
-
-
- <%= link_to 'Back', origami_in_juties_path, class: 'btn btn-success' %>
- <%= f.button :submit, class: 'btn btn-info' %>
-
<% end %>
-
+
\ No newline at end of file
+ });
+
+
diff --git a/app/views/origami/in_juties/index.html.erb b/app/views/origami/in_juties/index.html.erb
index 6efeb999..ff5a0fd3 100644
--- a/app/views/origami/in_juties/index.html.erb
+++ b/app/views/origami/in_juties/index.html.erb
@@ -1,38 +1,91 @@
-
diff --git a/app/views/settings/promotions/_form.html.erb b/app/views/settings/promotions/_form.html.erb
index 1e4a3f86..7ac413d0 100644
--- a/app/views/settings/promotions/_form.html.erb
+++ b/app/views/settings/promotions/_form.html.erb
@@ -49,32 +49,79 @@
-
<%= f.input :original_product,collection: MenuItem.order("name desc").pluck(:name,:item_code),input_html: { selected: 2 } %>
+ <% 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 = [] %>
+ <% if !@promotion.original_product.nil? %>
+ <% if !MenuItemInstance.find_by_item_instance_code(@promotion.original_product).nil? %>
+ <% sample = MenuItemInstance.where("item_instance_code=?",@promotion.original_product).pluck(:item_instance_name,:item_instance_code)%>
+ <% else %>
+ <% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
+ <% end %>
+ <% end %>
+
<%= f.input :original_product,collection: sample %>
+
<%= f.input :min_qty %>
-
Item Code
+
Item Code
Min Qty
Net off
Net Price
-
Percentage
-
+
Percentage
+
<%= f.fields_for :promotion_products do |pro| %>
-
<%= pro.input :item_code, label: false,collection: MenuItem.order("name desc").pluck(:name,:item_code)%>
+ <% 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 :min_qty , label: false%>
<%= pro.input :net_off , label: false %>
<%= pro.input :net_price , label: false %>
-
<%= pro.input :percentage , label: false %>
-
<%= pro.link_to_remove "X" %>
+
<%= pro.input :percentage , label: false %>
+
<%= pro.link_to_remove "X" %>
<% end %>
-
<%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary' %>
+
<%= f.link_to_add "Add Product", :promotion_products, :class => 'btn btn-primary addProduct' %>
@@ -103,5 +150,56 @@ $(document).ready(function(){
datepicker:false,
format:'H:m'
});
+ $("#promotion_original_product").select2();
+ $(".item_code_place").select2();
+ $(".item_code_place").on('change', function(event) {
+ var ajax_url = "<%= settings_find_item_instance_path %>";
+ var item_code = this.value;
+ $.ajax({
+ type: "GET",
+ url: ajax_url,
+ data: 'item_code=' + item_code,
+ success: function (result) {
+ $("#promotion_original_product").empty();
+ var itemlist;
+ for (var i = 0; i < result.length; i++) {
+ itemlist += "