Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions app/views/conservation_records/_cost_return_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<%# expects local `conservation_record` %>
<div class="card-body">
<div class="header">
<h3 id="cost-and-return-information">Cost and Return Information</h3>
</div>

<%= form_with model: [conservation_record, conservation_record.cost_return_report],
class: 'disable_input',
local: true do |f| %>
<p>
<%= f.label :shipping_cost, 'Shipping To Vendor Cost' %><br>
<%= f.number_field :shipping_cost,
value: (number_with_precision(f.object.shipping_cost, precision: 2) || 0),
step: 0.01,
class: 'form-control' %>
</p>
<p>
<%= f.label :repair_estimate, 'Repair Cost Estimate' %><br>
<%= f.number_field :repair_estimate,
value: (number_with_precision(f.object.repair_estimate, precision: 2) || 0),
step: 0.01,
class: 'form-control' %>
</p>
<p>
<%= f.label :repair_cost, 'Actual Billed Repair Cost' %><br>
<%= f.number_field :repair_cost,
value: (number_with_precision(f.object.repair_cost, precision: 2) || 0),
step: 0.01,
class: 'form-control' %>
</p>
<p>
<%= f.label :invoice_sent_to_business_office,
'Date Invoice Sent to Business Office' %><br>
<%= f.date_field :invoice_sent_to_business_office,
class: 'form-control' %>
</p>
<p>
<%= f.check_box :complete %>
<%= f.label :complete, 'Complete (returned to origin)' %>
</p>
<p>
<%= f.label :returned_to_origin, 'Date Returned to Origin' %><br>
<%= f.date_field :returned_to_origin,
class: 'form-control' %>
</p>
<p>
<%= f.label :note, 'Note' %><br>
<%= f.text_area :note, class: 'form-control' %>
</p>
<p>
<%= f.submit 'Save Cost and Return Information',
class: 'btn btn-primary' %>
</p>
<% end %>
</div>
26 changes: 26 additions & 0 deletions app/views/conservation_records/_details_table.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<%# expects local `conservation_record` %>
<table class="table table-striped">
<tbody>
<% fields = [
['Database ID', :id],
['Date Received', ->(r) { r.date_received_in_preservation_services&.strftime('%m/%d/%Y') }],
['Department', ->(r) { controlled_vocabulary_lookup(r.department) }],
['Title', :title],
['Author', :author],
['Imprint', :imprint],
['Call Number', :call_number],
['Item Record Number', :item_record_number],
['Is Digitized?', :digitization]
] %>

<% fields.each do |label, extractor| %>
<tr>
<th scope="row"><%= label %></th>
<td>
<% value = extractor.is_a?(Symbol) ? conservation_record.public_send(extractor) : extractor.call(conservation_record) %>
<%= value %>
</td>
</tr>
<% end %>
</tbody>
</table>
52 changes: 52 additions & 0 deletions app/views/conservation_records/_repair_section.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<%# locals:
type, # e.g. "InHouseRepairs"
title, # e.g. "In-House Repairs"
klass, # e.g. InHouseRepairRecord
collection, # e.g. @in_house_repairs
modal_id, # e.g. "inHouseRepairModal"
generator_method # OPTIONAL: exact helper name, e.g. "generate_con_tech_string"
%>

<%# Derive a default helper if none was passed %>
<% default_gen = "generate_#{type.singularize.underscore}_string" %>
<% gen = local_assigns[:generator_method] || default_gen %>
<% btn_label = local_assigns[:button_label] || title.singularize %>

<div class="header">
<h3><%= title %></h3>
<% if can? :crud, klass %>
<button type="button"
class="btn btn-primary cta-btn"
data-bs-toggle="modal"
data-bs-target="#<%= modal_id %>">
Add <%= btn_label %>
</button>
<% end %>
</div>

<% if collection.empty? %>
<div class="card"><div class="card-body">
There are no <%= title.downcase %> to show.
</div></div>
<% else %>
<ul class="list-group">
<% collection.each_with_index do |item, i| %>
<li class="list-group-item">
<%# Call the correct helper %>
<%= send(gen, item, i) %>

<% if can? :crud, klass %>
<%= link_to [item.conservation_record, item],
method: :delete,
data: { confirm: 'Are you sure?' } do %>
<button class="btn btn-danger justify-content-right">
<%= image_tag webpack_image_path('delete.png'),
class: 'delete-icon',
alt: 'Delete' %>
</button>
<% end %>
<% end %>
</li>
<% end %>
</ul>
<% end %>
12 changes: 12 additions & 0 deletions app/views/conservation_records/_tab_content.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%# locals: id_prefix, tabs, content_partials, plus any others like conservation_record %>
<div class="tab-content" id="<%= id_prefix %>Content">
<% tabs.keys.each_with_index do |tab_id, idx| %>
<div class="tab-pane fade <%= 'show active' if idx.zero? %>"
id="<%= tab_id %>"
role="tabpanel"
aria-labelledby="<%= "#{tab_id}-tab" %>">
<%= render partial: content_partials[idx],
locals: { conservation_record: local_assigns[:conservation_record] } %>
</div>
<% end %>
</div>
16 changes: 16 additions & 0 deletions app/views/conservation_records/_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<%# locals: type, id_prefix, tabs (hash of id => label) %>
<ul class="nav <%= type %>" id="<%= id_prefix %>" role="tablist">
<% tabs.each_with_index do |(tab_id, label), idx| %>
<li class="nav-item">
<a class="nav-link <%= 'active' if idx.zero? %>"
id="<%= "#{tab_id}-tab" %>"
data-bs-toggle="tab"
href="#<%= tab_id %>"
role="tab"
aria-controls="<%= label %>"
aria-selected="<%= idx.zero? %>">
<%= label %>
</a>
</li>
<% end %>
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="modal fade"
id="ConservatorsTechniciansModal"
tabindex="-1"
role="dialog"
aria-labelledby="ConservatorsTechniciansModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="ConservatorsTechniciansModalLabel">
Conservators and Technicians
</h5>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>

<%= form_with model: [@conservation_record,
@conservation_record.con_tech_records.build],
local: true,
html: { 'data-turbo': false } do |f| %>
<div class="modal-body">
<div class="mb-3">
<%= f.label :performed_by_user_id,
'Conservators and Technicians',
class: 'form-label' %>
<%= f.select :performed_by_user_id,
options_from_collection_for_select(@users, 'id', 'display_name'),
{ prompt: 'Select User' },
id: 'cons_tech_performed_by_user_id',
class: 'form-control',
required: true %>
</div>
</div>

<div class="modal-footer">
<button type="button"
class="btn btn-secondary"
data-bs-dismiss="modal">
Close
</button>
<%= f.submit 'Create Conservators and Technicians Record',
class: 'btn btn-primary',
data: { disable_with: 'Saving…' } %>
</div>
<% end %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<div class="modal fade"
id="externalRepairModal"
tabindex="-1"
role="dialog"
aria-labelledby="externalRepairModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="externalRepairModalLabel">
External Repair
</h5>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>

<%= form_with model: [@conservation_record,
@conservation_record.external_repair_records.build],
local: true,
html: { 'data-turbo': false } do |f| %>
<div class="modal-body">
<div class="mb-3">
<%= f.label :performed_by_vendor_id,
'Repaired By',
class: 'form-label' %>
<%= f.select :performed_by_vendor_id,
options_from_collection_for_select(@contract_conservators, 'id', 'key'),
{ prompt: 'Select Vendor' },
{ id: 'performed_by_vendor_id',
class: 'form-control',
required: true } %>
</div>

<div class="mb-3">
<%= f.label :repair_type,
'Repair Type',
class: 'form-label' %>
<%= f.select :repair_type,
options_from_collection_for_select(@repair_types, 'id', 'key'),
{ prompt: 'Select Repair Type' },
{ id: 'external_repair_type',
class: 'form-control',
required: true } %>
</div>

<div class="mb-3">
<%= f.label :other_note,
'Other Note',
class: 'form-label' %>
<%= f.text_field :other_note,
id: 'external_other_note',
class: 'form-control',
placeholder: 'Other Notes' %>
</div>
</div>

<div class="modal-footer">
<button type="button"
class="btn btn-secondary"
data-bs-dismiss="modal">
Close
</button>
<%= f.submit 'Create External Repair Record',
class: 'btn btn-primary',
data: { disable_with: 'Saving…' } %>
</div>
<% end %>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<div class="modal fade"
id="inHouseRepairModal"
tabindex="-1"
role="dialog"
aria-labelledby="inHouseRepairModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="inHouseRepairModalLabel">In-House Repair</h5>
<button type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"></button>
</div>

<%= form_with model: [@conservation_record,
@conservation_record.in_house_repair_records.build],
local: true,
html: { 'data-turbo': false } do |f| %>
<div class="modal-body">
<div class="mb-3">
<%= f.label :performed_by_user_id, 'Repaired By', class: 'form-label' %>
<%= f.select :performed_by_user_id,
options_from_collection_for_select(@users, 'id', 'display_name'),
{ prompt: 'Select User' },
id: 'in_house_performed_by_user_id',
class: 'form-control',
required: true %>
</div>

<div class="mb-3">
<%= f.label :repair_type, 'Repair Type', class: 'form-label' %>
<%= f.select :repair_type,
options_from_collection_for_select(@repair_types, 'id', 'key'),
{ prompt: 'Select Repair Type' },
id: 'in_house_repair_type',
class: 'form-control',
required: true %>
</div>

<div class="mb-3">
<%= f.label :minutes_spent, 'Minutes Spent', class: 'form-label' %>
<%= f.number_field :minutes_spent,
id: 'in_house_minutes_spent',
class: 'form-control',
placeholder: 'Minutes',
required: true %>
</div>

<div class="mb-3">
<%= f.label :other_note, 'Other Note', class: 'form-label' %>
<%= f.text_field :other_note,
id: 'in_house_other_note',
class: 'form-control',
placeholder: 'Other Notes' %>
</div>

<div class="mb-3">
<%= f.label :staff_code_id, 'Staff Code', class: 'form-label' %>
<%= f.select :staff_code_id,
options_from_collection_for_select(@staff_codes, 'id', 'code'),
{ prompt: 'Select Staff Code' },
id: 'in_house_staff_code_id',
class: 'form-control',
required: true %>
</div>
</div>

<div class="modal-footer">
<button type="button"
class="btn btn-secondary"
data-bs-dismiss="modal">
Close
</button>
<%= f.submit 'Create In-House Repair Record',
class: 'btn btn-primary',
data: { disable_with: 'Saving…' } %>
</div>
<% end %>
</div>
</div>
</div>
Loading
Loading