Skip to content

Commit b0f600c

Browse files
committed
Merge branch 'main' into 4333-remove-inventory-items
2 parents ba825b8 + 8a0e42f commit b0f600c

File tree

119 files changed

+2792
-358
lines changed

Some content is hidden

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

119 files changed

+2792
-358
lines changed

Gemfile.lock

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ GEM
162162
irb (~> 1.10)
163163
reline (>= 0.3.8)
164164
debug_inspector (1.2.0)
165-
delayed_job (4.1.11)
165+
delayed_job (4.1.12)
166166
activesupport (>= 3.0, < 8.0)
167-
delayed_job_active_record (4.1.8)
167+
delayed_job_active_record (4.1.10)
168168
activerecord (>= 3.0, < 8.0)
169169
delayed_job (>= 3.0, < 5)
170170
delayed_job_web (1.4.4)
@@ -209,15 +209,15 @@ GEM
209209
dry-inflector (~> 1.0)
210210
dry-logic (~> 1.4)
211211
zeitwerk (~> 2.6)
212-
erb_lint (0.6.0)
212+
erb_lint (0.7.0)
213213
activesupport
214214
better_html (>= 2.0.1)
215215
parser (>= 2.7.1.4)
216216
rainbow
217217
rubocop (>= 1)
218218
smart_properties
219219
erubi (1.13.0)
220-
execjs (2.9.1)
220+
execjs (2.10.0)
221221
factory_bot (6.4.5)
222222
activesupport (>= 5.0.0)
223223
factory_bot_rails (6.4.3)
@@ -259,14 +259,14 @@ GEM
259259
ffi (1.17.0-x86_64-darwin)
260260
ffi (1.17.0-x86_64-linux-gnu)
261261
filterrific (5.2.5)
262-
flipper (1.3.0)
262+
flipper (1.3.1)
263263
concurrent-ruby (< 2)
264264
flipper-active_record (1.3.0)
265265
activerecord (>= 4.2, < 8)
266266
flipper (~> 1.3.0)
267-
flipper-ui (1.3.0)
267+
flipper-ui (1.3.1)
268268
erubi (>= 1.0.0, < 2.0.0)
269-
flipper (~> 1.3.0)
269+
flipper (~> 1.3.1)
270270
rack (>= 1.4, < 4)
271271
rack-protection (>= 1.5.3, < 5.0.0)
272272
rack-session (>= 1.0.2, < 3.0.0)
@@ -321,7 +321,7 @@ GEM
321321
jbuilder (2.13.0)
322322
actionview (>= 5.0.0)
323323
activesupport (>= 5.0.0)
324-
json (2.7.2)
324+
json (2.7.5)
325325
jwt (2.9.1)
326326
base64
327327
kaminari (1.2.2)
@@ -354,7 +354,7 @@ GEM
354354
activesupport (>= 4)
355355
railties (>= 4)
356356
request_store (~> 1.0)
357-
loofah (2.22.0)
357+
loofah (2.23.1)
358358
crass (~> 1.0.2)
359359
nokogiri (>= 1.12.0)
360360
lumberjack (1.2.9)
@@ -442,7 +442,7 @@ GEM
442442
activerecord (>= 6.1)
443443
request_store (~> 1.4)
444444
parallel (1.26.3)
445-
parser (3.3.4.2)
445+
parser (3.3.5.1)
446446
ast (~> 2.4.1)
447447
racc
448448
pdf-core (0.9.0)
@@ -485,7 +485,7 @@ GEM
485485
puma (6.4.3)
486486
nio4r (~> 2.0)
487487
racc (1.8.1)
488-
rack (2.2.9)
488+
rack (2.2.10)
489489
rack-protection (3.1.0)
490490
rack (~> 2.2, >= 2.2.4)
491491
rack-session (1.0.2)
@@ -553,7 +553,7 @@ GEM
553553
responders (3.1.1)
554554
actionpack (>= 5.2)
555555
railties (>= 5.2)
556-
rexml (3.3.8)
556+
rexml (3.3.9)
557557
rolify (6.0.1)
558558
rouge (4.1.2)
559559
rspec (3.13.0)
@@ -588,9 +588,9 @@ GEM
588588
rubocop-ast (>= 1.31.1, < 2.0)
589589
ruby-progressbar (~> 1.7)
590590
unicode-display_width (>= 2.4.0, < 3.0)
591-
rubocop-ast (1.32.1)
591+
rubocop-ast (1.33.0)
592592
parser (>= 3.3.1.0)
593-
rubocop-performance (1.21.1)
593+
rubocop-performance (1.22.1)
594594
rubocop (>= 1.48.1, < 2.0)
595595
rubocop-ast (>= 1.31.1, < 2.0)
596596
rubocop-rails (2.25.1)
@@ -606,7 +606,7 @@ GEM
606606
ffi (~> 1.12)
607607
logger
608608
ruby2_keywords (0.0.5)
609-
sanitize (6.1.0)
609+
sanitize (6.1.3)
610610
crass (~> 1.0.2)
611611
nokogiri (>= 1.12.0)
612612
sass-rails (6.0.0)
@@ -657,15 +657,15 @@ GEM
657657
standard-custom (1.0.2)
658658
lint_roller (~> 1.0)
659659
rubocop (~> 1.50)
660-
standard-performance (1.4.0)
660+
standard-performance (1.5.0)
661661
lint_roller (~> 1.1)
662-
rubocop-performance (~> 1.21.0)
662+
rubocop-performance (~> 1.22.0)
663663
stimulus-rails (1.3.4)
664664
railties (>= 6.0.0)
665665
stringio (3.1.1)
666666
strong_migrations (1.8.0)
667667
activerecord (>= 5.2)
668-
terser (1.2.3)
668+
terser (1.2.4)
669669
execjs (>= 0.3.0, < 3)
670670
thor (1.3.2)
671671
tilt (2.2.0)
@@ -676,7 +676,7 @@ GEM
676676
railties (>= 6.0.0)
677677
tzinfo (2.0.6)
678678
concurrent-ruby (~> 1.0)
679-
unicode-display_width (2.5.0)
679+
unicode-display_width (2.6.0)
680680
uniform_notifier (1.16.0)
681681
version_gem (1.1.4)
682682
warden (1.2.9)
@@ -798,4 +798,4 @@ DEPENDENCIES
798798
webmock (~> 3.24)
799799

800800
BUNDLED WITH
801-
2.5.20
801+
2.5.22
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Source: http://simple-form-bootstrap.plataformatec.com.br/documentation
22

3-
abbr[title] {
3+
form abbr[title] {
44
text-decoration: none;
5-
}
5+
cursor: inherit;
6+
}

app/controllers/concerns/importable.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ def import_csv
2727
data = File.read(params[:file].path, encoding: "BOM|UTF-8")
2828
csv = CSV.parse(data, headers: true).reject { |row| row.to_hash.values.any?(&:nil?) }
2929
if csv.count.positive? && csv.first.headers.all? { |header| !header.nil? }
30-
resource_model.import_csv(csv, current_organization.id)
31-
flash[:notice] = "#{resource_model_humanized} were imported successfully!"
30+
errors = resource_model.import_csv(csv, current_organization.id)
31+
if errors.empty?
32+
flash[:notice] = "#{resource_model_humanized} were imported successfully!"
33+
else
34+
flash[:error] = "The following #{resource_model_humanized} did not import successfully:\n#{errors.join("\n")}"
35+
end
3236
else
3337
flash[:error] = "Check headers in file!"
3438
end

app/controllers/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def demote_to_user
5959
RemoveRoleService.call(user_id: params[:user_id],
6060
resource_type: Role::ORG_ADMIN,
6161
resource_id: current_organization.id)
62-
redirect_to user_update_redirect_path, notice: notice
62+
redirect_to user_update_redirect_path, notice: "User has been demoted!"
6363
rescue => e
6464
redirect_back(fallback_location: organization_path, alert: e.message)
6565
end

app/controllers/requests_controller.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def index
88
.undiscarded
99
.during(helpers.selected_range)
1010
.class_filter(filter_params)
11-
11+
@unfulfilled_requests_count = current_organization.requests.where(status: [:pending, :started]).count
1212
@paginated_requests = @requests.page(params[:page])
1313
@calculate_product_totals = RequestsTotalItemsService.new(requests: @requests).calculate
1414
@items = current_organization.items.alphabetized
@@ -40,6 +40,24 @@ def start
4040
redirect_to new_distribution_path(request_id: request.id)
4141
end
4242

43+
def print_unfulfilled
44+
requests = current_organization
45+
.requests
46+
.includes(:item_requests, partner: [:profile])
47+
.where(status: [:pending, :started])
48+
.order(created_at: :desc)
49+
50+
respond_to do |format|
51+
format.any do
52+
pdf = PicklistsPdf.new(current_organization, requests)
53+
send_data pdf.compute_and_render,
54+
filename: format("Picklists_%s.pdf", Time.current.to_fs(:long)),
55+
type: "application/pdf",
56+
disposition: "inline"
57+
end
58+
end
59+
end
60+
4361
private
4462

4563
def load_items

app/helpers/date_range_helper.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Encapsulates methods used on the Dashboard that need some business logic
22
module DateRangeHelper
33
def date_range_params
4-
params.dig(:filters, :date_range).presence || this_year
4+
params.dig(:filters, :date_range).presence || default_date
55
end
66

77
def date_range_label
@@ -23,8 +23,10 @@ def date_range_label
2323
end
2424
end
2525

26-
def this_year
27-
"January 1, #{Time.zone.today.year} - December 31, #{Time.zone.today.year}"
26+
def default_date
27+
start_date = 2.months.ago.to_date
28+
end_date = 1.month.from_now.to_date
29+
"#{start_date.strftime("%B %d, %Y")} - #{end_date.strftime("%B %d, %Y")}"
2830
end
2931

3032
def selected_interval

app/javascript/application.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ $(document).ready(function(){
9090
format: "MMMM D, YYYY",
9191
ranges: {
9292
customRanges: {
93-
'All Time': [today.minus({ 'years': 100}).toJSDate(), today.toJSDate()],
93+
'Default': [today.minus({'months': 2}).toJSDate(), today.plus({'months': 1}).toJSDate()],
94+
'All Time': [today.minus({ 'years': 100 }).toJSDate(), today.plus({ 'years': 1 }).toJSDate()],
9495
'Today': [today.toJSDate(), today.toJSDate()],
9596
'Yesterday': [today.minus({'days': 1}).toJSDate(), today.minus({'days': 1}).toJSDate()],
9697
'Last 7 Days': [today.minus({'days': 6}).toJSDate(), today.toJSDate()],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Controller } from "@hotwired/stimulus";
2+
3+
export default class extends Controller {
4+
static targets = ["password", "icon"];
5+
6+
toggle() {
7+
const isPasswordVisible = this.passwordTarget.type === "text";
8+
9+
this.passwordTarget.type = isPasswordVisible ? "password" : "text";
10+
this.iconTarget.classList.toggle("fa-eye", !isPasswordVisible);
11+
this.iconTarget.classList.toggle("fa-eye-slash", isPasswordVisible);
12+
}
13+
}

app/models/concerns/issued_at.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module IssuedAt
1010
scope :by_issued_at, ->(issued_at) { where(issued_at: issued_at.beginning_of_month..issued_at.end_of_month) }
1111
scope :for_year, ->(year) { where("extract(year from issued_at) = ?", year) }
1212
validate :issued_at_cannot_be_before_2000
13+
validate :issued_at_cannot_be_further_than_1_year
1314
end
1415

1516
private
@@ -23,4 +24,10 @@ def issued_at_cannot_be_before_2000
2324
errors.add(:issued_at, "Cannot be before 2000")
2425
end
2526
end
27+
28+
def issued_at_cannot_be_further_than_1_year
29+
if issued_at.present? && issued_at > DateTime.now.next_year
30+
errors.add(:issued_at, "cannot be more than 1 year in the future")
31+
end
32+
end
2633
end

app/models/concerns/provideable.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def self.import_csv(csv, organization)
1919

2020
loc.save!
2121
end
22+
[]
2223
end
2324

2425
def self.csv_export_headers

0 commit comments

Comments
 (0)