Skip to content

Commit f8b054b

Browse files
Merge branch 'main' into 4473-expand-reminder-date-possibilities
2 parents f12ad32 + 83508dc commit f8b054b

64 files changed

Lines changed: 572 additions & 324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/assets/stylesheets/resources/partners.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ div#partner-notes {
4949
padding: 0px 20px;
5050
}
5151

52+
div#info-for-partner {
53+
padding: 0px 20px;
54+
}
55+
5256
div#approve-application-button {
5357
position: fixed;
5458

app/controllers/admin/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def destroy
7171

7272
def organization_params
7373
params.require(:organization)
74-
.permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id,
74+
.permit(:name, :street, :city, :state, :zipcode, :email, :url, :logo, :intake_location, :default_email_text, :account_request_id, :bank_is_set_up,
7575
:reminder_schedule_definition, :deadline_day,
7676
users_attributes: %i(name email organization_admin), account_request_attributes: %i(ndbn_member_id id))
7777
end

app/controllers/audits_controller.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ def edit
2121
end
2222

2323
def finalize
24-
@audit.adjustment = Adjustment.new(organization_id: @audit.organization_id, storage_location_id: @audit.storage_location_id, user_id: current_user.id, comment: 'Created Automatically through the Auditing Process')
25-
@audit.save
26-
2724
AuditEvent.publish(@audit)
2825
@audit.finalized!
2926
redirect_to audit_path(@audit), notice: "Audit is Finalized."

app/controllers/dashboard_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class DashboardController < ApplicationController
33
respond_to :html, :js
44

55
def index
6-
@org_stats = OrganizationStats.new(current_organization, inventory)
6+
@org_is_set_up = current_organization.bank_is_set_up
77
@partners_awaiting_review = current_organization.partners.awaiting_review
88
@outstanding_requests = current_organization
99
.ordered_requests

app/controllers/donations_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,12 @@ def destroy
127127

128128
def load_form_collections
129129
@storage_locations = current_organization.storage_locations.active.alphabetized
130-
@donation_sites = current_organization.donation_sites.active.alphabetized
131130
@product_drives = current_organization.product_drives.alphabetized
132131
@product_drive_participants = current_organization.product_drive_participants.alphabetized
133132
@manufacturers = current_organization.manufacturers.alphabetized
134133
@items = current_organization.items.active.alphabetized
134+
# Return all active donation sites, or the donation site that was selected for the donation if it's inactive
135+
@donation_sites = current_organization.donation_sites.active.or(DonationSite.where(id: @donation.donation_site_id)).alphabetized
135136
end
136137

137138
def clean_donation_money_raised

app/controllers/organizations_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def organization_params
102102
:ytd_on_distribution_printout, :one_step_partner_invite,
103103
:hide_value_columns_on_receipt, :hide_package_column_on_receipt,
104104
:signature_for_distribution_pdf, :receive_email_on_requests,
105+
:bank_is_set_up,
105106
:include_in_kind_values_in_exported_files,
106107
partner_form_fields: [],
107108
request_unit_names: []

app/controllers/partners_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def validate_user_role
182182

183183
def partner_params
184184
params.require(:partner).permit(:name, :email, :send_reminders, :quota,
185-
:notes, :partner_group_id, :default_storage_location_id, documents: [])
185+
:notes, :partner_group_id, :default_storage_location_id, :info_for_partner, documents: [])
186186
end
187187

188188
helper_method \

app/controllers/product_drives_controller.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,18 @@ def update
8888
end
8989

9090
def destroy
91-
current_organization.product_drives.find(params[:id]).destroy
91+
product_drive = current_organization.product_drives.find(params[:id])
92+
success = product_drive.destroy
93+
9294
respond_to do |format|
93-
format.html { redirect_to product_drives_url, notice: 'Product drive was successfully destroyed.' }
94-
format.json { head :no_content }
95+
if success
96+
format.html { redirect_to product_drives_url, notice: 'Product drive was successfully destroyed.' }
97+
format.json { head :no_content }
98+
else
99+
error_message = product_drive.errors.full_messages.to_sentence
100+
format.html { redirect_to product_drive_path(product_drive), error: error_message }
101+
format.json { render json: {error: error_message}, status: :unprocessable_entity }
102+
end
95103
end
96104
end
97105

app/controllers/transfers_controller.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def index
2121

2222
def create
2323
@transfer = current_organization.transfers.new(transfer_params)
24+
@transfer.line_items.combine!
2425

2526
TransferCreateService.call(@transfer)
2627
redirect_to transfers_path, notice: "#{@transfer.line_items.total} items have been transferred from #{@transfer.from.name} to #{@transfer.to.name}!"
@@ -57,6 +58,18 @@ def destroy
5758
redirect_to transfers_path
5859
end
5960

61+
def validate
62+
@transfer = current_organization.transfers.new(transfer_params)
63+
@transfer.line_items.combine!
64+
65+
if @transfer.valid?
66+
body = render_to_string(partial: "transfers/validate_modal", formats: [:html], layout: false)
67+
render json: {valid: true, body: body}
68+
else
69+
render json: {valid: false}, status: :unprocessable_entity
70+
end
71+
end
72+
6073
private
6174

6275
def load_form_collections

app/helpers/ui_helper.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ def _link_to(link, options = {}, properties = {})
162162
text = options[:text]
163163
size = options[:size]
164164
type = options[:type]
165+
166+
properties[:data] ||= {}
167+
properties[:data][:disable_with] ||= "Please wait..."
168+
165169
if options[:data].present?
166-
properties[:data] ||= {}
167170
properties[:data].merge!(options[:data])
168171
end
169172
properties[:title] = options[:title] if options[:title].present?
@@ -180,7 +183,7 @@ def _link_to(link, options = {}, properties = {})
180183
end
181184
end
182185

183-
def _button_to(options = {}, other_properties = {})
186+
def _button_to(options = {}, properties = {})
184187
submit_type = options[:submit_type] || "submit"
185188
id = options[:id]
186189
type = options[:type]
@@ -189,7 +192,10 @@ def _button_to(options = {}, other_properties = {})
189192
text = options[:text]
190193
align = options[:align]
191194

192-
button_tag({ type: submit_type, id: id, class: "btn btn-#{type} btn-#{size} #{align}" }.merge(other_properties)) do
195+
properties[:data] ||= {}
196+
properties[:data][:disable_with] ||= "Please wait..."
197+
198+
button_tag({ type: submit_type, id: id, class: "btn btn-#{type} btn-#{size} #{align}" }.merge(properties)) do
193199
fa_icon icon, text: text
194200
end
195201
end

0 commit comments

Comments
 (0)