merge with aung

This commit is contained in:
Yan
2017-11-21 16:47:07 +06:30
10 changed files with 90 additions and 57 deletions

View File

@@ -5,34 +5,35 @@
<%= f.error_notification %>
<div class="form-inputs p-l-10">
<%= f.input :child%>
<%= f.input :adult %>
<%= f.input :male %>
<%= f.input :female %>
<%= f.input :local %>
<%= f.input :child , input_html: { class: 'col-md-8' }%>
<%= f.input :adult , input_html: { class: 'col-md-8' }%>
<%= f.input :male , input_html: { class: 'col-md-8' }%>
<%= f.input :female , input_html: { class: 'col-md-8' }%>
<%= f.input :total_customer, input_html: { class: 'col-md-8'} %>
<%= f.input :local , input_html: { class: 'col-md-8' }%>
<div class="row clearfix">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="form-group">
<label>Foreigner</label>
<select class="form-control col-md-12 selectpicker show-tick" name="survey[foreigner][][]" style="height: " >
<% Lookup.where("lookup_type = ?", "country" ).each do |ct| %>
<option value="<%= ct.value %>">
<%= ct.name %>
</option>
<%end %>
</select>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
<div class="form-group p-l-10 p-r-10">
<label class="p-l-10">Foreigner</label>
<input type="text" class="form-control" name="survey[foreigner][]">
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="form-group">
<label>Number</label>
<input type="number" name="survey[foreigner][][]" class="form-control">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">
<div class="form-group p-l-10 p-r-10">
<label class="p-l-10">Number</label>
<input type="number" name="survey[foreigner][]" class="form-control">
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">
<br>
<button type="button" class="btn btn-success" id="addForeigner">Add</button>
</div>
</div>
<%= f.input :total_customer %>
<div class="hidden" id="newTemplate" >
</div>
<input type="hidden" name="table_id" value="<%=@dining_facility.id%>">
<%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %>
@@ -79,15 +80,45 @@
<script type="text/javascript">
$(document).ready(function(){
// click back button for redirect
$('#back').on('click',function(){
table_type = '<%=@table_type%>';
table_type = '<%=@table_type%>';
table_id = '<%=@dining_facility.id%>';
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}
else {
window.location.href = "/origami/room/" + table_id
}
})
if(table_type == "Table"){
window.location.href = "/origami/table/" + table_id
}
else {
window.location.href = "/origami/room/" + table_id
}
});
//click add button for new row
$('#addForeigner').on('click',function(){
$('#newTemplate').removeClass('hidden');
var text_box = '<div id="newRow" class="row clearfix">'
+'<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">'
+'<div class="form-group p-l-10 p-r-10">'
+' <input type="text" class="form-control" name="survey[foreigner][]">'
+'</div>'
+'</div>'
+'<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4 ">'
+'<div class="form-group p-l-10 p-r-10">'
+'<input type="number" name="survey[foreigner][]" class="form-control">'
+'</div>'
+'</div>'
+'<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1 ">'
+'<button type="button" class="btn btn-danger" id="removeRow">Remove</button>'
+'</div>'
+'</div>';
$('#newTemplate').append(text_box);
});
//click remove buttom
$('#newTemplate').on('click','#removeRow', function(){
$(this).parent().parent().remove()
});
});
</script>