add two select box
This commit is contained in:
@@ -21,6 +21,8 @@ class BatchesController < ApplicationController
|
||||
|
||||
def new
|
||||
@batch = Batch.new
|
||||
@clients=Client.all.order('id desc')
|
||||
@product=ProductCategory.all.order('id desc')
|
||||
end
|
||||
|
||||
def edit
|
||||
@@ -30,12 +32,10 @@ class BatchesController < ApplicationController
|
||||
def create
|
||||
date = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
|
||||
order_ref = params[:batch][:order_ref]
|
||||
puts order_ref
|
||||
adult_or_child=params[:adult_or_child]
|
||||
client_id=params[:client_id]
|
||||
product_category_id=params[:product_category_id]
|
||||
@batch = Batch.create_batch(date,order_ref,2,"adult_or_child",6,3)
|
||||
puts @batch.order_ref
|
||||
|
||||
respond_to do |format|
|
||||
if @batch.save
|
||||
|
||||
@@ -16,7 +16,15 @@
|
||||
<label for="name" class="string optional control-label">Name:</label>
|
||||
<%= f.input :order_ref ,:label =>false,:error => false,:placeholder =>'Please enter name',input_html: { class: "form-control" } %>
|
||||
<%= f.error :order_ref ,style: 'color: red' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="client" class="string optional control-label">Select Client:</label>
|
||||
<%= select_tag "client", options_from_collection_for_select(@clients, "id", "name"), :class => 'form-control'%>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="product" class="string optional control-label">Select Product:</label>
|
||||
<%= select_tag "product", options_from_collection_for_select(@product, "id", "name"), :class => 'form-control'%>
|
||||
</div>
|
||||
<div class ="form-group" >
|
||||
<label></label>
|
||||
<div class="actions">
|
||||
|
||||
Reference in New Issue
Block a user