|
| 1 | +<div class="appointments-page"> |
| 2 | + <h1 class="new_title">Upcoming Appointments</h1> |
| 3 | + |
| 4 | + <% @appointments.each_with_index do |appointment, index| %> |
| 5 | + <section class="appointment"> |
| 6 | + <div class="appointment-date"> |
| 7 | + <h2 class="title_bold"><%= index + 1 %>.</h2> |
| 8 | + <h2 class="title_bold"> |
| 9 | + <%= appointment.starts_at.strftime("%a") %> |
| 10 | + • |
| 11 | + <%= appointment.starts_at.strftime("%b %-d, %Y") %> |
| 12 | + <br /> |
| 13 | + <small class="gray-dark"><%= "#{appointment.starts_at.strftime("%I:%M%P")} - #{appointment.ends_at.strftime("%I:%M%P")}" %></small> |
| 14 | + </h2> |
| 15 | + </div> |
| 16 | + |
| 17 | + <div class="appointment-wrapper"> |
| 18 | + <section> |
| 19 | + <h3 class="title_bold">Here's what you're returning</h3> |
| 20 | + |
| 21 | + <% if appointment.loans.any? %> |
| 22 | + <table class="table table-scroll mb-2" id="items-to-pickup-table"> |
| 23 | + <thead> |
| 24 | + <tr> |
| 25 | + <th class="caption">Image</th> |
| 26 | + <th class="caption">Item</th> |
| 27 | + <th class="caption">Inventory Number</th> |
| 28 | + <th class="caption">Due Date</th> |
| 29 | + <th class="caption">Status</th> |
| 30 | + </tr> |
| 31 | + </thead> |
| 32 | + |
| 33 | + <tbody> |
| 34 | + <% appointment.loans.each do |loan| %> |
| 35 | + <tr> |
| 36 | + <td> |
| 37 | + <%= link_to item_path(loan.item) do %> |
| 38 | + <% if loan.item.image.attached? %> |
| 39 | + <%= image_tag url_for(rotated_variant(loan.item.image, resize_to_limit: [200, 140])), class: "p-centered" %> |
| 40 | + <% end %> |
| 41 | + <% end %> |
| 42 | + </td> |
| 43 | + <td><%= link_to loan.item.name, item_path(loan.item) %></td> |
| 44 | + <td><%= loan.item.complete_number %></td> |
| 45 | + <td class=<%= loan.due_at - Time.now < 3.days ? "warning" : "" %>><%= "Due #{humanize_due_date(loan)}" %></td> |
| 46 | + <td><%= loan.status %></td> |
| 47 | + </tr> |
| 48 | + <% end %> |
| 49 | + </tbody> |
| 50 | + </table> |
| 51 | + <% else %> |
| 52 | + No items to return |
| 53 | + <% end %> |
| 54 | + </section> |
| 55 | + |
| 56 | + <section> |
| 57 | + <h3 class="title_bold">Here's what you're picking up</h3> |
| 58 | + |
| 59 | + <table class="table table-scroll" id="items-to-pickup-table"> |
| 60 | + <thead> |
| 61 | + <tr> |
| 62 | + <th class="caption">Image</th> |
| 63 | + <th class="caption">Item</th> |
| 64 | + <th class="caption">Inventory Number</th> |
| 65 | + <th class="caption">Status</th> |
| 66 | + </tr> |
| 67 | + </thead> |
| 68 | + |
| 69 | + <tbody> |
| 70 | + <% appointment.holds.each do |hold| %> |
| 71 | + <tr> |
| 72 | + <td> |
| 73 | + <%= link_to item_path(hold.item) do %> |
| 74 | + <% if hold.item.image.attached? %> |
| 75 | + <%= image_tag url_for(rotated_variant(hold.item.image, resize_to_limit: [200, 140])), class: "p-centered" %> |
| 76 | + <% end %> |
| 77 | + <% end %> |
| 78 | + </td> |
| 79 | + <td><%= link_to hold.item.name, item_path(hold.item) %></td> |
| 80 | + <td><%= hold.item.complete_number %></td> |
| 81 | + <td><%= render_place_in_queue(hold) %></td> |
| 82 | + </tr> |
| 83 | + <% end %> |
| 84 | + </tbody> |
| 85 | + </table> |
| 86 | + </section> |
| 87 | + |
| 88 | + <% if appointment.comment.present? %> |
| 89 | + <section> |
| 90 | + <label class="form-label">What kind of project are you working on?</label> |
| 91 | + <%= appointment.comment %> |
| 92 | + </section> |
| 93 | + <% end %> |
| 94 | + |
| 95 | + <section> |
| 96 | + <%= button_to "Edit this Appointment", edit_appointment_path(appointment.id), class: "btn btn-primary btn-sm", method: :get %> |
| 97 | + </section> |
| 98 | + </div> |
| 99 | + </section> |
| 100 | + <% end %> |
| 101 | +</div> |
0 commit comments