Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% provide(:title, "New Reservation") %>
- <script>
- document.addEventListener("turbolinks:load", function() {
- $( ".datepicker" ).datepicker({ minDate: 0, dateFormat: 'mm/dd/yy' });
- $("#reservation_lab_id").on('change', function() {
- $(".datepicker").datepicker("destroy");
- if ($("#reservation_lab_id option:selected").text() == "Security") {
- $(".datepicker").datepicker({
- minDate: 0,
- dateFormat: 'mm/dd/yy',
- beforeShowDay: $(".datepicker").datepicker.noWeekends
- });
- }
- });
- })
- </script>
- <h1>New Reservation</h1>
- <div class="row">
- <div class="col">
- <%= form_for(@reservation) do |f| %>
- <% if @reservation.errors.any? %>
- <% @reservation.errors.full_messages.each do |message| %>
- <div class="alert alert-danger"><%= message %></div>
- <% end %>
- <% end %>
- <div class="row">
- <div class="col">
- <%= f.label :lab_id %>
- <%= f.collection_select(:lab_id, Lab.order("name ASC"), :id, :name, {:selected => params[:lab_id] ? params[:lab_id] : @reservation.lab_id}, {class: "form-control"}) %>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <%= f.label :user_ids, 'Additional Team Members' %>
- <%= f.collection_select(:user_ids, User.order("name ASC"), :id, :name, {}, {:multiple => true, class: "form-control"}) %>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <%= f.label :start_date %>
- <%= f.text_field :start_date, class: 'datepicker form-control' %><br>
- </div>
- <div class="col">
- <%= f.label :end_date %>
- <%= f.text_field :end_date, class: 'datepicker form-control' %><br>
- </div>
- </div>
- <div class="row">
- <%= f.submit "Submit", class: "btn btn-primary" %>
- </div>
- <% end %>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement