Created
December 30, 2019 06:01
-
-
Save cjlaborde/70cef61e33af3e22cf9143b92c741dc3 to your computer and use it in GitHub Desktop.
Calendar Form Modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="modal fade" id="new_calendar"> | |
<div class="modal-dialog"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button class="close" data-dismiss="modal">×</button> | |
</div> | |
<div class="modal-body"> | |
<%= form_for [@room, Calendar.new] do |f| %> | |
<div class="row"> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<%= f.text_field :start_date, readonly: true, value: Date.today, class: "form-control datepicker" %> | |
</div> | |
</div> | |
<div class="col-md-6"> | |
<div class="form-group"> | |
<%= f.text_field :end_date, readonly: true, value: Date.today, class: "form-control datepicker" %> | |
</div> | |
</div> | |
</div> | |
<div class="form-group"> | |
<div class="btn-group" data-toggle="buttons-radio"> | |
<%= f.collection_radio_buttons :status, Calendar.statuses, :first, :first, checked: Calendar.statuses.first do |b| | |
b.radio_button + b.label {b.text.split("_").join(" ").capitalize} | |
end %> | |
</div> | |
</div> | |
<div class="row new-pricing"> | |
<div class="col-md-10"> | |
<div class="form-group"> | |
<div class="input-group"> | |
<span class="input-group-addon">$</span> | |
<%= f.text_field :price, class: "form-control", value: @room.price, required: true %> | |
</div> | |
</div> | |
</div> | |
<div class="col-md-2"> | |
<p style="margin-top: 10px">Per Night</p> | |
</div> | |
</div> | |
<div class="no-pricing hide"> | |
</div> | |
<div class="form-group"> | |
<%= f.button "Save", type: :submit, class: "btn btn-success" %> | |
</div> | |
<% end %> | |
</div> | |
</div> | |
</div> | |
</div> | |
<script> | |
$(function() { | |
var notAvailable = $('#calendar_status_not_available'), | |
available = $('#calendar_status_available'); | |
notAvailable.click(function() { | |
$('.no-pricing').show(); | |
$('.new-pricing').hide(); | |
}); | |
available.click(function() { | |
$('.no-pricing').hide(); | |
$('.new-pricing').show(); | |
}); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment