Edit Dining Queue in CRM

This commit is contained in:
San Wai Lwin
2018-05-11 15:29:06 +06:30
parent 800fa41abb
commit 33e71f63a3

View File

@@ -11,8 +11,8 @@
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
<%= f.hidden_field :customer_id %>
<%= f.input :name %>
<%= f.input :contact_no %>
<%= f.input :seater %>
<%= f.input :contact_no , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notChar(this.value);" } %>
<%= f.input :seater , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notNegative(this.value);" } %>
<%= f.input :remark %>
</div>
<br>
@@ -111,11 +111,29 @@
<script type="text/javascript">
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
} else {
return true;
}
}
function notNegative(val){
if(parseInt(val)< 1) $("#dining_queue_seater").val(0);
}
function notNegative(val){
if(typeof val == "string") $("#dining_queue_seater").val(0);
}
$(document).ready(function(){
if($('form').attr('id') == "new_dining_queue"){
var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no);
var queue_no = $('.generate_no').text();
$('#dining_queue_queue_no').val(queue_no);
}
$( "input" ).focusin(function() {