-
-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathnew.html.erb
More file actions
78 lines (73 loc) · 3.6 KB
/
new.html.erb
File metadata and controls
78 lines (73 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "New Request - #{current_partner ? current_user.display_name : @partner.name}" %>
<h1><i class="fa fa-users"></i>
New Request
<small>for <%= current_partner ? current_user.display_name : @partner.name %></small>
</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="<%= current_partner ? partner_user_root_path : dashboard_path %>"><i class="fa fa-home fa-lg"></i></a></li>
<li class="breadcrumb-item"><a href="#">New Essentials Request</a></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- Default box -->
<div class="card"
data-controller="confirmation"
data-confirmation-pre-check-path-value="<%= validate_partners_requests_path(format: :json) %>">
<div class="card-body">
<%= simple_form_for @partner_request, url: partners_requests_path(@partner_request),
html: {role: 'form', class: 'form-horizontal'}, method: :post, data: { controller: 'form-input', confirmation_target: "form" } do |form| %>
<%= form.input :comments, label: "Comments:", as: :text, class: "form-control", wrapper: :input_group %>
<%= hidden_field_tag :partner_id, params[:partner_id] %>
<table class='table'>
<thead>
<tr>
<th>Item Requested</th>
<th>Quantity</th>
<% if Flipper.enabled?(:enable_packs) && (current_partner ? current_partner.organization.request_units.any? : current_organization.request_units.any?) %>
<th>Units (if applicable)</th>
<% end %>
</tr>
</thead>
<tbody class='fields'>
<%= render partial: 'item_request', locals: { form: form, item_units: @item_units } %>
</tbody>
</table>
<div>
<%= add_element_button('Add Another Item', container_selector: '.fields') do %>
<%= render partial: 'item_request', locals: { form: form, item_units: @item_units }, object: @partner_request.item_requests.build %>
<% end %>
</div>
<hr>
</div>
<div class="card-footer">
<!-- TODO(chaserx): we should add some js to prevent submission if the items selected are the blank option or any item has an empty quantity -->
<%= form.submit("Submit Essentials Request", class: "btn btn-success", data: { action: "click->confirmation#openModal" }) %> <%= link_to "Cancel Request", (current_partner ? partners_requests_path : requests_path), class: "btn btn-danger" %>
</div>
<% end %>
<%# Confirmation modal: See confirmation_controller.js for how this gets displayed %>
<%# and app/controllers/partners/requests_controller.rb#validate for how it gets populated. %>
<div id="partnerRequestConfirmationModal"
class="modal confirm"
aria-labelledby="partnerRequestConfirmationModal"
aria-hidden="true"
tabindex="-1"
data-bs-backdrop="static"
data-confirmation-target="modal">
</div>
</div>
</div>
</div>
</div>
</section>