update promtion and dining charges

This commit is contained in:
Aung Myo
2017-10-25 18:13:44 +06:30
parent fa5b544416
commit d5141c30bb
12 changed files with 245 additions and 194 deletions

View File

@@ -6,7 +6,7 @@
<div class="form-inputs p-l-15">
<div class="div-border">
<div class="row">
<div class="col-md-6">
<div class="col-md-6 form-group">
<label>*Promo Code</label>
<div class="input-group">
<span class="input-group-addon">
@@ -18,58 +18,58 @@
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-6 form-group">
<label>* Start Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@promotion.promo_start_date.nil?%>
<input type="text" name="promotion[promo_start_date]" value="<%= @promotion.promo_start_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control" placeholder="Start Date...">
<input type="text" name="promotion[promo_start_date]" value="<%= @promotion.promo_start_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-8" placeholder="Start Date...">
<% else %>
<input type="text" name="promotion[promo_start_date]" class="datepicker form-control" placeholder="Start Date...">
<input type="text" name="promotion[promo_start_date]" class="datepicker form-control col-md-8" placeholder="Start Date...">
<% end %>
</div>
</div>
<div class="col-md-6">
<div class="col-md-6 form-group">
<label>* End Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">date_range</i>
</span>
<% if !@promotion.promo_end_date.nil?%>
<input type="text" name="promotion[promo_end_date]" value="<%= @promotion.promo_end_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control" placeholder="Start Date...">
<input type="text" name="promotion[promo_end_date]" value="<%= @promotion.promo_end_date.strftime('%A, %d-%m-%Y') %>" class="datepicker form-control col-md-8" placeholder="Start Date...">
<% else %>
<input type="text" name="promotion[promo_end_date]" class="datepicker form-control" placeholder="End Date...">
<input type="text" name="promotion[promo_end_date]" class="datepicker form-control col-md-8" placeholder="End Date...">
<% end %>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-6 form-group">
<label class="control-label">* Start Hour</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">access_time</i>
</span>
<% if !@promotion.promo_start_hour.nil?%>
<input type="text" name="promotion[promo_start_hour]" value="<%= @promotion.promo_start_hour.utc.strftime('%H:%M') %>" class="timepicker form-control" placeholder="Start Time...">
<input type="text" name="promotion[promo_start_hour]" value="<%= @promotion.promo_start_hour.utc.strftime('%H:%M') %>" class="timepicker form-control col-md-8" placeholder="Start Time...">
<% else %>
<input type="text" name="promotion[promo_start_hour]" class="timepicker form-control" placeholder="Start Time...">
<input type="text" name="promotion[promo_start_hour]" class="timepicker form-control col-md-8" placeholder="Start Time...">
<% end %>
</div>
</div>
<div class="col-md-6">
<div class="col-md-6 form-group">
<label class="control-label">* End Hour</label>
<div class="input-group">
<span class="input-group-addon">
<i class="material-icons">access_time</i>
</span>
<% if !@promotion.promo_end_hour.nil?%>
<input type="text" name="promotion[promo_end_hour]" value="<%= @promotion.promo_end_hour.utc.strftime('%H:%M') %>" class="timepicker form-control" placeholder="End Time...">
<input type="text" name="promotion[promo_end_hour]" value="<%= @promotion.promo_end_hour.utc.strftime('%H:%M') %>" class="timepicker form-control col-md-8" placeholder="End Time...">
<% else %>
<input type="text" name="promotion[promo_end_hour]" class="timepicker form-control" placeholder="End Time...">
<input type="text" name="promotion[promo_end_hour]" class="timepicker form-control col-md-8" placeholder="End Time...">
<% end %>
</div>
<!-- <% if !@promotion.promo_end_hour.nil?%>
@@ -81,8 +81,10 @@
</div>
<br>
<div class="row checkboxes">
<div class="col-md-2"><label class="control-label"><abbr title="required">*</abbr> Promotion Day</label></div>
<div class="row checkboxes ">
<div class="col-md-2">
<label class="control-label font-14"><abbr title="required">*</abbr> Promotion Day</label>
</div>
<%= f.hidden_field :promo_day, :class => "form-control" %>
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</label></div>
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</label></div>
@@ -92,10 +94,9 @@
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Friday" value="5" id="5"> Fri</label></div>
<div class="col-md-1"><label><input class="selectDay" type="checkbox" name="Saturday" value="6" id="6"> Sat</label></div>
</div>
<br>
<div class="row">
<div class="col-md-6">
<div class="col-md-5 form-group">
<select name="promotion[promo_type]" class="form-control">
<option>Quantity</option>
<option>Net_off</option>
@@ -111,7 +112,7 @@
<% Product.order("name desc").pluck(:name,:item_code).each do |p| %>
<% arr.push(p) %>
<% end %>
<div class="col-md-3">
<div class="col-md-3 form-group">
<label class="control-label"><abbr title="required">*</abbr> Item</label>
<select class="form-control item_code_place">
<% if !@promotion.original_product.nil? %>
@@ -142,12 +143,12 @@
<% sample = Product.where("item_code=?",@promotion.original_product).pluck(:name,:item_code)%>
<% end %>
<% end %>
<div class="col-md-3"><%= f.input :original_product,collection: sample %></div>
<div class="col-md-3 form-group"><%= f.input :original_product,collection: sample %></div>
<!-- <div class="col-md-6"><%= f.input :original_product,collection: MenuItemInstance.order("item_instance_name desc").pluck(:item_instance_name,:item_instance_code),input_html: { selected: 2 } %></div> -->
<div class="col-md-6"><%= f.input :min_qty %></div>
<div class="col-md-6 form-group"><%= f.input :min_qty %></div>
</div>
<br>
<div class="" style="border: 1px solid #cccccc;padding:1%">
<div class="card">
<div class="row">
<div class="col-md-4" style="text-align:center">Item Code</div>
<div class="col-md-2" style="text-align:center">Min Qty</div>
@@ -237,18 +238,18 @@ $(document).ready(function(){
// $('#promotion_promo_end_hour').val($('#promotion_promo_end_hour').val().split(":")[0]+":00");
// });
$('.datepicker').bootstrapMaterialDatePicker({
format: 'dddd DD MM YYYY',
clearButton: true,
weekStart: 1,
time: false
});
// $('.datepicker').bootstrapMaterialDatePicker({
// format: 'dddd DD MM YYYY',
// clearButton: true,
// weekStart: 1,
// time: false
// });
$('.timepicker').bootstrapMaterialDatePicker({
format: 'HH:mm',
clearButton: true,
date: false
});
// $('.timepicker').bootstrapMaterialDatePicker({
// format: 'HH:mm',
// clearButton: true,
// date: false
// });
// var dayy = $("#promotion_promo_day").val().replace("[","").replace("]","");
// jQuery.each( dayy.split(","), function( i, d ) {
@@ -283,8 +284,8 @@ $(".selectDay").click(function() {
document.getElementById("promotion_promo_day").value = day;
});
$("#promotion_original_product").select2();
$(".item_code_place").select2();
// $("#promotion_original_product").select2();
// $(".item_code_place").select2();
$(".item_code_place").on('change', function(event) {
var ajax_url = "<%= settings_find_item_instance_path %>";
@@ -300,19 +301,19 @@ $(".selectDay").click(function() {
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
}
$("#promotion_original_product").append(itemlist);
$("#promotion_original_product").select2();
//$("#promotion_original_product").select2();
}
});
});
$(".promotion_promotion_products_item_code select").select2();
$(".item_code_place1").select2();
//$(".promotion_promotion_products_item_code select").select2();
//$(".item_code_place1").select2();
callforpromoproduct();
$(".addProduct").on('click', function(event) {
setTimeout(function(){
$(".promotion_promotion_products_item_code select").select2();
// $(".promotion_promotion_products_item_code select").select2();
callforpromoproduct();
}, 0);
});
@@ -332,7 +333,7 @@ $(".selectDay").click(function() {
$("select#"+select_id).empty();
$("select#"+select_id).append("<option value='"+item_code+"'>"+result[0]+"</option>");
$("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();
// $("select#"+select_id).parent().parent().siblings("div.menu_item_choose").find("select").select2();
}
}
});
@@ -340,7 +341,7 @@ $(".selectDay").click(function() {
// promotion_promotion_products_attributes_0_item_code
function callforpromoproduct(){
$(".item_code_place1").select2();
//$(".item_code_place1").select2();
$(".item_code_place1").on('change', function(event) {
id = $(this).parent().next().find("select").attr("id");
var ajax_url = "<%= settings_find_item_instance_path %>";
@@ -356,7 +357,7 @@ $(".selectDay").click(function() {
itemlist += "<option value ="+result[i][1]+">"+result[i][0]+"</option>"
}
$("select#"+id).append(itemlist);
$("select#"+id).select2();
//$("select#"+id).select2();
}
});
});