add interger checked for promotions
This commit is contained in:
@@ -142,7 +142,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 ,label: "Qualified Qty", :input_html => {:style => 'height: 37px'} %></div>
|
||||
<div class="col-md-6 form-group"><%= f.input :min_qty ,label: "Qualified Qty", :input_html => {:style => 'height: 37px', min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this);"} %></div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="card">
|
||||
@@ -179,13 +179,13 @@
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<%= pro.input :min_qty , label: false, :input_html => {:style => 'height: 37px'}%>
|
||||
<%= pro.input :min_qty , label: false, :input_html => {:style => 'height: 37px', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this);"}%>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<%= pro.input :net_off , label: false, :input_html => {:style => 'height: 37px'} %>
|
||||
<%= pro.input :net_off , label: false, :input_html => {:style => 'height: 37px', min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this);"} %>
|
||||
</div>
|
||||
<div class="col-md-1"><%= pro.input :net_price , label: false, :input_html => {:style => 'height: 37px'} %></div>
|
||||
<div class="col-md-2"><%= pro.input :percentage , label: false, :input_html => {:style => 'height: 37px'} %></div>
|
||||
<div class="col-md-1"><%= pro.input :net_price , label: false, :input_html => {:style => 'height: 37px', min: 1, step: '1', :onkeypress => "return isNumberKey(event);"} %></div>
|
||||
<div class="col-md-2"><%= pro.input :percentage , label: false, :input_html => {:style => 'height: 37px', min: 1, step: '1', :onkeypress => "return isNumberKey(event);", :onkeyup => "greaterThanOne(this);"} %></div>
|
||||
<div class="col-md-1"><%= pro.link_to_remove "X" ,:class=>"btn-primary btn m-r-45", :style => 'width: 25px'%></div>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -432,5 +432,16 @@ $(document).on('turbolinks:load', function() {
|
||||
$('body').bootstrapMaterialDesign();
|
||||
});
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function greaterThanOne(obj){
|
||||
if(parseInt(obj.value)<=0) $(obj).val(1);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user