update oqs view an d promotion form update
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
<div class="col-md-3">
|
||||
<label class="control-label"><abbr title="required">*</abbr> Promotion Day</label>
|
||||
</div>
|
||||
<%= f.hidden_field :promo_day, :class => "form-control" %>
|
||||
<%= f.hidden_field :promo_day, :class => "form-control", :id => "promotion_promo_day" %>
|
||||
<div class="col-md-9">
|
||||
<label><input class="selectDay" type="checkbox" name="Sunday" value="0" id="0"> Sun</label>
|
||||
<label><input class="selectDay" type="checkbox" name="Monday" value="1" id="1">Mon</label>
|
||||
@@ -97,15 +97,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="row">
|
||||
<div class="col-md-5 form-group">
|
||||
<select name="promotion[promo_type]" class="form-control">
|
||||
<option>Choose Promotion Type</option>
|
||||
<option>Net_off</option>
|
||||
<option>Net_price</option>
|
||||
<option>Percentage</option>
|
||||
</select> -->
|
||||
<%= f.input :promo_type, collection: %w{Quantity Net_off Net_price Percentage},:input_html=>{:class => 'col-md-5 form-control select'} ,:label => "Promotion Type", :include_blank => 'Choose Promotion Type', :selected => '' %>
|
||||
<!-- <%= f.input :promo_type, collection: %w{Quantity Net_off Net_price Percentage},:input_html=>{:class => 'col-md-5 form-control select'} ,:label => "Promotion Type", :include_blank => 'Choose Promotion Type', :selected => '' %> -->
|
||||
<%= f.input :promo_type,input_html: { :class => 'form-control col-md-5 form-control select' },
|
||||
collection: %w{Quantity Net_off Net_price Percentage},:label => "Promotion Type" %>
|
||||
<!-- </div>
|
||||
</div>
|
||||
-->
|
||||
@@ -147,7 +141,7 @@
|
||||
<% end %>
|
||||
<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 form-group"><%= f.input :min_qty %></div>
|
||||
<div class="col-md-6 form-group"><%= f.input :min_qty ,label: "Qualified Qty" %></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="card">
|
||||
@@ -155,10 +149,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-3" style="text-align:">Item Code</div>
|
||||
<div class="col-md-2" style="text-align:">Item Instance</div>
|
||||
<div class="col-md-1" style="text-align:">Min Qty</div>
|
||||
<div class="col-md-2" style="text-align:">Qualified Qty</div>
|
||||
<div class="col-md-1" style="text-align:">Net off</div>
|
||||
<div class="col-md-2" style="text-align:">Net Price</div>
|
||||
<div class="col-md-2" style="text-align:">Percentage</div>
|
||||
<div class="col-md-1" style="text-align:">Percentage</div>
|
||||
<div class="col-md-1" style="text-align:"></div>
|
||||
</div>
|
||||
<div class="row"></div >
|
||||
@@ -183,10 +177,10 @@
|
||||
<%= pro.input :item_code, :class => 'promoproduct', collection:[],input_html: { selected: 2 }, label: false %>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1"><%= pro.input :min_qty , label: false%></div>
|
||||
<div class="col-md-2"><%= pro.input :min_qty , label: false%></div>
|
||||
<div class="col-md-1"><%= pro.input :net_off , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :net_price , label: false %></div>
|
||||
<div class="col-md-2"><%= pro.input :percentage , label: false %></div>
|
||||
<div class="col-md-1"><%= pro.input :percentage , label: false %></div>
|
||||
<div class="col-md-1" style=""><%= pro.link_to_remove "X" ,:class=>"btn-primary btn m-r-25"%></div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -250,58 +244,56 @@
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
// $('#promotion_promo_start_date').datetimepicker({
|
||||
// timepicker:false,
|
||||
// format:'Y-m-d'
|
||||
// });
|
||||
// $('#promotion_promo_end_date').datetimepicker({
|
||||
// timepicker:false,
|
||||
// format:'Y-m-d'
|
||||
// });
|
||||
// $('#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_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");
|
||||
// });
|
||||
$('#promotion_promo_end_hour').on('change', function(event) {
|
||||
$('#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 ) {
|
||||
// $("input.selectDay[value='"+d+"']").prop( "checked", true );
|
||||
// });
|
||||
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 form = document.getElementById("new_promotion");
|
||||
var inputs = $("input");
|
||||
var arr = [];
|
||||
var count = 0;
|
||||
var day = "[";
|
||||
var day = "[";*/
|
||||
|
||||
|
||||
$(".selectDay").click(function() {
|
||||
// debugger;
|
||||
day = "[";
|
||||
var item_row = $('.selectDay');
|
||||
console.log(item_row);
|
||||
check = $(item_row).prop("checked");
|
||||
var attribute_arr = [];
|
||||
$(item_row).each(function(i){
|
||||
if ($(item_row[i]).prop("checked")) {
|
||||
value = $(item_row[i]).val();
|
||||
str = value;
|
||||
attribute_arr.push(str);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*day = "[";
|
||||
for (var j = 8; j <=15; j += 1){
|
||||
if (inputs[j].type === "checkbox" && inputs[j].checked)
|
||||
{
|
||||
@@ -316,9 +308,10 @@ $(".selectDay").click(function() {
|
||||
{
|
||||
day = day + "]";
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
document.getElementById("promotion_promo_day").value = '';
|
||||
document.getElementById("promotion_promo_day").value = day;
|
||||
document.getElementById("promotion_promo_day").value = "["+attribute_arr+"]";
|
||||
});
|
||||
|
||||
// $("#promotion_original_product").select2();
|
||||
|
||||
Reference in New Issue
Block a user