Add Total Customer

This commit is contained in:
San Wai Lwin
2018-04-11 17:53:57 +06:30
parent f159673c60
commit b11480a90c

View File

@@ -9,12 +9,12 @@
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10' }%>
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
<div class="form-group p-l-10 p-r-10">
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10' }%>
<%= f.input :adult, input_html: { value: @survey_data.adult, class: 'col-md-10', :onChange => "total_customer();" }%>
</div>
</div>
</div>
@@ -30,7 +30,7 @@
</div>
</div>
</div>
<%= f.input :total_customer, input_html: { value: @survey_data.total_customer, class: 'col-md-11'} %>
<%= f.input :total_customer, input_html: { value:@survey_data.total_customer , :readonly => true, class: 'col-md-11'} %>
<%= f.input :local , input_html: { value: @survey_data.local, class: 'col-md-11' }%>
<!--<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;"> -->
<!-- <legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend> -->
@@ -457,4 +457,11 @@ var cashier_type = "<%= @cashier_type %>";
});
}
}
function total_customer(){
var child = $("#survey_child").val() || 0;
var adult = $("#survey_adult").val() || 0;
var result = parseInt(child) + parseInt(adult);
$("#survey_total_customer").val(result);
}
</script>