Skip to content

Commit ec0d3b7

Browse files
Merged in r2-2842-main-develop (pull request #6746)
R2-2842: Merging main to develop 04.04.24
2 parents 941bf18 + 49c77b1 commit ec0d3b7

Some content is hidden

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

52 files changed

+2208
-683
lines changed

app/javascript/components/application/selectors.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ export const getMaximumUsers = state => state.getIn([NAMESPACE, "systemOptions",
170170

171171
export const getMaximumUsersWarning = state => state.getIn([NAMESPACE, "systemOptions", "maximum_users_warning"]);
172172

173+
export const getMaximumAttachmentsPerRecord = state =>
174+
state.getIn([NAMESPACE, "systemOptions", "maximum_attachments_per_record"]);
175+
173176
export const getTheme = state => state.getIn([NAMESPACE, "theme"], fromJS({}));
174177

175178
export const getShowPoweredByPrimero = state => state.getIn([NAMESPACE, "theme", "showPoweredByPrimero"], false);
@@ -193,6 +196,7 @@ export const getAppData = memoize(state => {
193196
const useContainedNavStyle = getUseContainedNavStyle(state);
194197
const showPoweredByPrimero = getShowPoweredByPrimero(state);
195198
const hasLoginLogo = getLoginBackground(state);
199+
const maximumttachmentsPerRecord = getMaximumAttachmentsPerRecord(state);
196200

197201
return {
198202
modules,
@@ -206,7 +210,8 @@ export const getAppData = memoize(state => {
206210
maximumUsersWarning,
207211
useContainedNavStyle,
208212
showPoweredByPrimero,
209-
hasLoginLogo
213+
hasLoginLogo,
214+
maximumttachmentsPerRecord
210215
};
211216
});
212217

app/javascript/components/application/selectors.unit.test.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ const stateWithRecords = fromJS({
129129
disabledApplication: true,
130130
systemOptions: {
131131
maximum_users: 50,
132-
maximum_users_warning: 45
132+
maximum_users_warning: 45,
133+
maximum_attachments_per_record: 55
133134
}
134135
}
135136
});
@@ -611,4 +612,12 @@ describe("Application - Selectors", () => {
611612
expect(result).to.be.true;
612613
});
613614
});
615+
616+
describe("getMaximumAttachmentsPerRecord", () => {
617+
it("should return maximum users warning", () => {
618+
const result = selectors.getMaximumAttachmentsPerRecord(stateWithRecords);
619+
620+
expect(result).to.be.equal(55);
621+
});
622+
});
614623
});

app/javascript/components/insights/constants.js

+144-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import {
1313
INPROGRESS,
1414
ACCEPTED,
1515
REJECTED,
16-
DONE
16+
DONE,
17+
PROTECTION_CONCERNS_SUBREPORTS,
18+
REPORTING_LOCATIONS_SUBREPORTS,
19+
FOLLOWUPS_SUBREPORTS,
20+
SERVICES_SUBREPORTS,
21+
CASES_WORKFLOW_SUBREPORTS
1722
} from "../../config/constants";
1823
import { DATE_FIELD, SELECT_FIELD, HIDDEN_FIELD, OPTION_TYPES } from "../form/constants";
1924
import { FieldRecord } from "../form/records";
@@ -39,6 +44,7 @@ const VERIFICATION_STATUS = "verification_status";
3944
const GHN_DATE_FILTER = "ghn_date_filter";
4045
const VIOLATION_TYPE = "violation_type";
4146
const REGISTRATION_DATE = "registration_date";
47+
const SERVICE_IMPLEMENTED_DAY_TIME = "service_implemented_day_time";
4248
const CREATED_AT = "created_at";
4349

4450
const GBV_STATISTICS = "gbv_statistics";
@@ -68,6 +74,10 @@ export const USER_GROUP = "user_group";
6874
export const AGENCY = "agency";
6975
export const BY = "by";
7076
export const WORKFLOW = "workflow";
77+
export const PROTECTION_CONCERNS = "protection_concerns";
78+
export const REPORTING_LOCATIONS = "location_current";
79+
export const FOLLOWUPS = "followup_type";
80+
export const SERVICES = "service_type";
7181
export const VIOLENCE_TYPE = "cp_incident_violence_type";
7282
export const REFERRAL_TRANSFER_STATUS = "referral_transfer_status";
7383

@@ -110,6 +120,10 @@ export const BY_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, BY];
110120
export const USER_GROUP_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, USER_GROUP];
111121
export const AGENCY_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, AGENCY];
112122
export const WORKFLOW_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, WORKFLOW];
123+
export const PROTECTION_CONCERNS_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, PROTECTION_CONCERNS];
124+
export const REPORTING_LOCATIONS_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, REPORTING_LOCATIONS];
125+
export const FOLLOWUPS_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, FOLLOWUPS];
126+
export const SERVICES_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, SERVICES];
113127
export const VIOLENCE_TYPE_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, VIOLENCE_TYPE];
114128
export const REFERRAL_TRANSFER_STATUS_DISPLAY_NAME = [MANAGED_REPORTS, FILTER_BY, REFERRAL_TRANSFER_STATUS];
115129

@@ -308,6 +322,35 @@ export const DEFAULT_VIOLATION_FILTERS = {
308322
[VERIFIED_CTFMR_TECHNICAL]: VERIFIED
309323
};
310324

325+
export const SHARED_WORKFLOW_CONFIG = {
326+
ids: WORKFLOW_SUBREPORTS,
327+
defaultFilterValues: {
328+
[GROUPED_BY]: WEEK,
329+
[DATE_RANGE]: LAST_WEEK,
330+
[STATUS]: [STATUS_OPEN],
331+
[DATE]: REGISTRATION_DATE,
332+
[BY]: OWNED_BY_GROUPS
333+
},
334+
filters: [
335+
RECORD_FILTERS[GROUPED_BY],
336+
RECORD_FILTERS[DATE_RANGE],
337+
RECORD_FILTERS[FROM],
338+
RECORD_FILTERS[TO],
339+
RECORD_FILTERS[STATUS],
340+
{
341+
name: WORKFLOW,
342+
type: SELECT_FIELD,
343+
display_name: WORKFLOW_DISPLAY_NAME
344+
},
345+
RECORD_FILTERS[BY],
346+
RECORD_FILTERS[CREATED_BY_GROUPS],
347+
RECORD_FILTERS[OWNED_BY_GROUPS],
348+
RECORD_FILTERS[CREATED_ORGANIZATION],
349+
RECORD_FILTERS[OWNED_BY_AGENCY_ID],
350+
RECORD_FILTERS[DATE]
351+
].map(filter => FieldRecord(filter))
352+
};
353+
311354
export const INSIGHTS_CONFIG = {
312355
[MODULES.MRM]: {
313356
violations: {
@@ -385,8 +428,38 @@ export const INSIGHTS_CONFIG = {
385428
}
386429
},
387430
[MODULES.CP]: {
388-
workflow_report: {
389-
ids: WORKFLOW_SUBREPORTS,
431+
protection_concerns_report: {
432+
ids: PROTECTION_CONCERNS_SUBREPORTS,
433+
defaultFilterValues: {
434+
[GROUPED_BY]: WEEK,
435+
[DATE_RANGE]: LAST_WEEK,
436+
[STATUS]: [STATUS_OPEN],
437+
[DATE]: REGISTRATION_DATE,
438+
[BY]: OWNED_BY_GROUPS
439+
},
440+
filters: [
441+
RECORD_FILTERS[GROUPED_BY],
442+
RECORD_FILTERS[DATE_RANGE],
443+
RECORD_FILTERS[FROM],
444+
RECORD_FILTERS[TO],
445+
RECORD_FILTERS[STATUS],
446+
{
447+
name: PROTECTION_CONCERNS,
448+
type: SELECT_FIELD,
449+
display_name: PROTECTION_CONCERNS_DISPLAY_NAME,
450+
multi_select: true,
451+
option_strings_source: LOOKUPS.protection_concerns
452+
},
453+
RECORD_FILTERS[BY],
454+
RECORD_FILTERS[CREATED_BY_GROUPS],
455+
RECORD_FILTERS[OWNED_BY_GROUPS],
456+
RECORD_FILTERS[CREATED_ORGANIZATION],
457+
RECORD_FILTERS[OWNED_BY_AGENCY_ID],
458+
RECORD_FILTERS[DATE]
459+
].map(filter => FieldRecord(filter))
460+
},
461+
reporting_locations_report: {
462+
ids: REPORTING_LOCATIONS_SUBREPORTS,
390463
defaultFilterValues: {
391464
[GROUPED_BY]: WEEK,
392465
[DATE_RANGE]: LAST_WEEK,
@@ -401,9 +474,10 @@ export const INSIGHTS_CONFIG = {
401474
RECORD_FILTERS[TO],
402475
RECORD_FILTERS[STATUS],
403476
{
404-
name: WORKFLOW,
477+
name: REPORTING_LOCATIONS,
405478
type: SELECT_FIELD,
406-
display_name: WORKFLOW_DISPLAY_NAME
479+
display_name: REPORTING_LOCATIONS_DISPLAY_NAME,
480+
option_strings_source: LOOKUPS.reporting_locations
407481
},
408482
RECORD_FILTERS[BY],
409483
RECORD_FILTERS[CREATED_BY_GROUPS],
@@ -413,6 +487,71 @@ export const INSIGHTS_CONFIG = {
413487
RECORD_FILTERS[DATE]
414488
].map(filter => FieldRecord(filter))
415489
},
490+
followups_report: {
491+
ids: FOLLOWUPS_SUBREPORTS,
492+
defaultFilterValues: {
493+
[GROUPED_BY]: WEEK,
494+
[DATE_RANGE]: LAST_WEEK,
495+
[STATUS]: [STATUS_OPEN],
496+
[DATE]: REGISTRATION_DATE,
497+
[BY]: OWNED_BY_GROUPS
498+
},
499+
filters: [
500+
RECORD_FILTERS[GROUPED_BY],
501+
RECORD_FILTERS[DATE_RANGE],
502+
RECORD_FILTERS[FROM],
503+
RECORD_FILTERS[TO],
504+
RECORD_FILTERS[STATUS],
505+
{
506+
name: FOLLOWUPS,
507+
type: SELECT_FIELD,
508+
display_name: FOLLOWUPS_DISPLAY_NAME,
509+
multi_select: true,
510+
option_strings_source: LOOKUPS.followup_type
511+
},
512+
RECORD_FILTERS[BY],
513+
RECORD_FILTERS[CREATED_BY_GROUPS],
514+
RECORD_FILTERS[OWNED_BY_GROUPS],
515+
RECORD_FILTERS[CREATED_ORGANIZATION],
516+
RECORD_FILTERS[OWNED_BY_AGENCY_ID],
517+
RECORD_FILTERS[DATE]
518+
].map(filter => FieldRecord(filter))
519+
},
520+
services_report: {
521+
ids: SERVICES_SUBREPORTS,
522+
defaultFilterValues: {
523+
[GROUPED_BY]: WEEK,
524+
[DATE_RANGE]: LAST_WEEK,
525+
[STATUS]: [STATUS_OPEN],
526+
[DATE]: SERVICE_IMPLEMENTED_DAY_TIME,
527+
[BY]: OWNED_BY_GROUPS
528+
},
529+
filters: [
530+
RECORD_FILTERS[GROUPED_BY],
531+
RECORD_FILTERS[DATE_RANGE],
532+
RECORD_FILTERS[FROM],
533+
RECORD_FILTERS[TO],
534+
RECORD_FILTERS[STATUS],
535+
{
536+
name: SERVICES,
537+
type: SELECT_FIELD,
538+
display_name: SERVICES_DISPLAY_NAME,
539+
multi_select: true,
540+
option_strings_source: LOOKUPS.service_type
541+
},
542+
RECORD_FILTERS[BY],
543+
RECORD_FILTERS[CREATED_BY_GROUPS],
544+
RECORD_FILTERS[OWNED_BY_GROUPS],
545+
RECORD_FILTERS[CREATED_ORGANIZATION],
546+
RECORD_FILTERS[OWNED_BY_AGENCY_ID],
547+
RECORD_FILTERS[DATE]
548+
].map(filter => FieldRecord(filter))
549+
},
550+
workflow_report: SHARED_WORKFLOW_CONFIG,
551+
cases_workflow_report: {
552+
ids: CASES_WORKFLOW_SUBREPORTS,
553+
...SHARED_WORKFLOW_CONFIG
554+
},
416555
violence_type_report: {
417556
ids: VIOLENCE_TYPE_SUBREPORTS,
418557
defaultFilterValues: {

app/javascript/components/insights/constants.unit.test.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ describe("<Report /> - constants", () => {
7878
"WORKFLOW_DISPLAY_NAME",
7979
"WORKFLOW",
8080
"YEAR_OPTION_IDS",
81-
"YEAR"
81+
"YEAR",
82+
"PROTECTION_CONCERNS",
83+
"PROTECTION_CONCERNS_DISPLAY_NAME",
84+
"REPORTING_LOCATIONS",
85+
"REPORTING_LOCATIONS_DISPLAY_NAME",
86+
"FOLLOWUPS",
87+
"FOLLOWUPS_DISPLAY_NAME",
88+
"SERVICES",
89+
"SERVICES_DISPLAY_NAME",
90+
"SHARED_WORKFLOW_CONFIG"
8291
].forEach(property => {
8392
expect(clone).to.have.property(property);
8493
delete clone[property];

app/javascript/components/layouts/components/login-layout/component.jsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ const Component = ({ children }) => {
2121
const { demo, hasLoginLogo, useContainedNavStyle } = useApp();
2222
const hasLogos = useMemoizedSelector(state => hasAgencyLogos(state));
2323

24-
// TODO: Module hardcoded till we figure out when to switch modules
25-
const primeroModule = "cp";
26-
const moduleClass = `${primeroModule}${demo ? "-demo" : ""}`;
27-
const classes = clsx(css.primeroBackground, css[moduleClass], {
28-
[css.primeroBackgroundImage]: hasLoginLogo
24+
const classes = clsx(css.primeroBackground, {
25+
[css.primeroBackgroundImage]: hasLoginLogo,
26+
[css.primeroBackgroundImageDemo]: hasLoginLogo && demo,
27+
[css.demoBackground]: demo
2928
});
3029
const classesLoginLogo = clsx(css.loginLogo, { [css.hideLoginLogo]: !hasLogos });
3130
const classesAuthDiv = clsx(css.auth, { [css.noLogosWidth]: !hasLogos });

app/javascript/components/layouts/components/login-layout/styles.css

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
background-color: var(--c-blue);
2121
}
2222

23-
.cp-demo {
24-
background: repeating-linear-gradient(45deg, var(--c-dark-blue), var(--c-dark-blue) 10px, var(--c-blue) 10px, var(--c-blue) 20px) !important;
25-
}
26-
2723
:global html, :global body {
2824
height: var(--doc-height, 100vh);
2925
}
@@ -41,6 +37,14 @@
4137
background: center/70% no-repeat var(--c-login-background-image), linear-gradient(108deg, var(--c-login-background-gradient-start) 0%, var(--c-login-background-gradient-end) 100%);
4238
}
4339

40+
.primeroBackgroundImageDemo {
41+
background: center/70% no-repeat var(--c-login-background-image), repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0, .05) 10px, rgba(0,0,0,.05) 20px), linear-gradient(108deg, var(--c-login-background-gradient-start) 0%, var(--c-login-background-gradient-end) 100%);
42+
}
43+
44+
.demoBackground {
45+
background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0, .05) 10px, rgba(0,0,0,.05) 20px), linear-gradient(108deg, var(--c-login-background-gradient-start) 0%, var(--c-login-background-gradient-end) 100%);
46+
}
47+
4448
.content {
4549
flex: 1 0 auto;
4650
display: flex;

app/javascript/components/mobile-toolbar/styles.css

+12-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@
2727
height: 2.5rem;
2828
display: flex;
2929

30-
& div {
30+
& > div {
3131
margin: 0;
3232
display: flex;
33+
align-items: center;
34+
}
35+
36+
& div {
37+
display: flex;
38+
align-items: center;
39+
}
40+
41+
& > div div:first-of-type {
42+
margin: 0;
3343
}
3444

3545
& img {
@@ -70,6 +80,7 @@
7080
color: var(--c-dark-grey);
7181
font-weight: bold;
7282
text-transform: uppercase;
83+
flex: 1;
7384
}
7485

7586
@media (max-width: 959.95px) {

app/javascript/components/nav/styles.css

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
justify-content: flex-end;
3131
align-items: center;
3232
padding: var(--spacing-0-1);
33-
background: var(--c-toolbar-background-color-mobile-header, var(--c-light-grey));
33+
background: transparent;
3434

3535
& button {
3636
padding: 6px;
@@ -60,7 +60,7 @@
6060
}
6161

6262
.drawerPaper-demo {
63-
background: repeating-linear-gradient(45deg, var(--c-light-grey), var(--c-light-grey) 10px, var(--c-white) 10px, var(--c-white) 20px);
63+
background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0, .05) 10px, rgba(0,0,0,.05) 20px), var(--c-toolbar-background-color);
6464
}
6565

6666
.listIcon {
@@ -277,4 +277,3 @@
277277
}
278278
}
279279
}
280-

app/javascript/components/record-form/form/components/validation-errors.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ const ValidationErrors = ({ formErrors, forms, submitCount }) => {
4545
.get("fields")
4646
.filter(field => fieldNames.includes(field.get("name")))
4747
.map(field => ({
48-
[field.get("name")]: formErrors[field.get("name")]
48+
[field.get("name")]: Array.isArray(formErrors[field.get("name")])
49+
? formErrors[field.get("name")].join("")
50+
: formErrors[field.get("name")]
4951
}))
5052
.reduce((acc, subCurrent) => ({ ...acc, ...subCurrent }), {})
5153
}

0 commit comments

Comments
 (0)