Skip to content

Commit e145b84

Browse files
authored
MMI-3245 Enhance Report Sections (bcgov#2443)
* Enhance Report Sections * Add DB migratino 1.3.28
1 parent aaae148 commit e145b84

23 files changed

+8312
-26
lines changed

app/editor/.yarn/cache/tno-core-npm-1.0.10-41a83b5783-ded4a852f5.zip renamed to app/editor/.yarn/cache/tno-core-npm-1.0.11-ac3cb59c33-e76e3c02bf.zip

2.01 MB
Binary file not shown.

app/editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"redux-logger": "3.0.6",
6161
"styled-components": "6.1.11",
6262
"stylis": "4.3.2",
63-
"tno-core": "1.0.10"
63+
"tno-core": "1.0.11"
6464
},
6565
"devDependencies": {
6666
"@simbathesailor/use-what-changed": "2.0.0",

app/editor/src/features/admin/report-templates/templates/body/CustomReport.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@
8282
{
8383
@* TABLE OF CONTENTS SECTION *@
8484
var tocCount = 0;
85-
@foreach (var tableSection in Sections.Where(s => new [] {ReportSectionType.Content, ReportSectionType.Gallery, ReportSectionType.Text}.Contains(s.Value.SectionType)))
85+
@foreach (var tableSection in Sections.Where(s => new [] {ReportSectionType.Content, ReportSectionType.Gallery, ReportSectionType.Text, ReportSectionType.Image}.Contains(s.Value.SectionType)))
8686
{
87-
if ((!tableSection.Value.Settings.HideEmpty || tableSection.Value.Content.Any()) && tableSection.Value.IsEnabled)
87+
if ((!tableSection.Value.Settings.InTableOfContents.HasValue || tableSection.Value.Settings.InTableOfContents.Value)
88+
&& (!tableSection.Value.Settings.HideEmpty || tableSection.Value.Content.Any()) && tableSection.Value.IsEnabled)
8889
{
8990
<div id="toc" name="toc">
9091
<div style="border-bottom:1px solid #675f62; margin: 2px 0 4px 0;">

app/editor/src/features/admin/reports/components/ReportSectionContent.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,18 @@ export const ReportSectionContent = ({ index }: IReportSectionContentProps) => {
9797
label="Show Image"
9898
tooltip="Display the image for each content item in this section (if there is an image)"
9999
/>
100+
<Checkbox
101+
name={`sections.${index}.settings.inTableOfContents`}
102+
label="Include in Table of Contents"
103+
checked={
104+
values.sections[index].settings.inTableOfContents === undefined
105+
? true
106+
: values.sections[index].settings.inTableOfContents
107+
}
108+
onChange={(e) => {
109+
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
110+
}}
111+
/>
100112
</Col>
101113
<Col>
102114
<hr />

app/editor/src/features/admin/reports/components/ReportSectionGallery.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useFilters, useFolders } from 'store/hooks/admin';
55
import {
66
Button,
77
ButtonVariant,
8+
Checkbox,
89
Col,
910
FormikCheckbox,
1011
FormikSelect,
@@ -85,6 +86,18 @@ export const ReportSectionGallery = ({ index }: IReportSectionGalleryProps) => {
8586
label="Show Image"
8687
tooltip="Display the image for each content item in this section (if there is an image)"
8788
/>
89+
<Checkbox
90+
name={`sections.${index}.settings.inTableOfContents`}
91+
label="Include in Table of Contents"
92+
checked={
93+
values.sections[index].settings.inTableOfContents === undefined
94+
? true
95+
: values.sections[index].settings.inTableOfContents
96+
}
97+
onChange={(e) => {
98+
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
99+
}}
100+
/>
88101
</Col>
89102
<FormikSelect
90103
name={`sections.${index}.settings.direction`}

app/editor/src/features/admin/reports/components/ReportSectionImage.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { Col, FormikText, FormikTextArea } from 'tno-core';
1+
import { useFormikContext } from 'formik';
2+
import { Checkbox, Col, FormikText, FormikTextArea, IReportModel } from 'tno-core';
23

34
export interface IReportSectionImageProps {
45
index: number;
56
}
67

78
export const ReportSectionImage = ({ index }: IReportSectionImageProps) => {
9+
const { values, setFieldValue } = useFormikContext<IReportModel>();
10+
811
return (
912
<Col gap="1rem" className="section">
1013
<FormikText
@@ -22,6 +25,18 @@ export const ReportSectionImage = ({ index }: IReportSectionImageProps) => {
2225
<Col>
2326
<FormikText label="Url" name={`sections.${index}.settings.url`} />
2427
</Col>
28+
<Checkbox
29+
name={`sections.${index}.settings.inTableOfContents`}
30+
label="Include in Table of Contents"
31+
checked={
32+
values.sections[index].settings.inTableOfContents === undefined
33+
? true
34+
: values.sections[index].settings.inTableOfContents
35+
}
36+
onChange={(e) => {
37+
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
38+
}}
39+
/>
2540
</Col>
2641
);
2742
};

app/editor/src/features/admin/reports/components/ReportSectionMediaAnalytics.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useFilters, useFolders, useReports } from 'store/hooks/admin';
55
import {
66
Button,
77
ButtonVariant,
8+
Checkbox,
89
Col,
910
FormikCheckbox,
1011
FormikSelect,
@@ -106,6 +107,18 @@ export const ReportSectionMediaAnalytics = ({ index }: IReportSectionMediaAnalyt
106107
);
107108
}}
108109
/>
110+
<Checkbox
111+
name={`sections.${index}.settings.inTableOfContents`}
112+
label="Include in Table of Contents"
113+
checked={
114+
values.sections[index].settings.inTableOfContents === undefined
115+
? true
116+
: values.sections[index].settings.inTableOfContents
117+
}
118+
onChange={(e) => {
119+
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
120+
}}
121+
/>
109122
</Row>
110123
</Col>
111124
<Show visible={!section.settings.useAllContent}>

app/editor/src/features/admin/reports/components/ReportSectionText.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import { Col, FormikText, FormikTextArea } from 'tno-core';
1+
import { useFormikContext } from 'formik';
2+
import { Checkbox, Col, FormikText, FormikTextArea, IReportModel } from 'tno-core';
23

34
export interface IReportSectionTextProps {
45
index: number;
56
}
67

78
export const ReportSectionText = ({ index }: IReportSectionTextProps) => {
9+
const { values, setFieldValue } = useFormikContext<IReportModel>();
10+
811
return (
912
<Col gap="1rem" className="section">
1013
<FormikText
@@ -19,6 +22,18 @@ export const ReportSectionText = ({ index }: IReportSectionTextProps) => {
1922
tooltip="The summary will be displayed at the beginning of the section"
2023
placeholder="Executive summary for this section or the whole report"
2124
/>
25+
<Checkbox
26+
name={`sections.${index}.settings.inTableOfContents`}
27+
label="Include in Table of Contents"
28+
checked={
29+
values.sections[index].settings.inTableOfContents === undefined
30+
? true
31+
: values.sections[index].settings.inTableOfContents
32+
}
33+
onChange={(e) => {
34+
setFieldValue(`sections.${index}.settings.inTableOfContents`, e.target.checked);
35+
}}
36+
/>
2237
</Col>
2338
);
2439
};

app/editor/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12209,7 +12209,7 @@ __metadata:
1220912209
sass-extract-loader: 1.1.0
1221012210
styled-components: 6.1.11
1221112211
stylis: 4.3.2
12212-
tno-core: 1.0.10
12212+
tno-core: 1.0.11
1221312213
typescript: 4.9.5
1221412214
vitest: 3.0.7
1221512215
languageName: unknown
@@ -16674,9 +16674,9 @@ __metadata:
1667416674
languageName: node
1667516675
linkType: hard
1667616676

16677-
"tno-core@npm:1.0.10":
16678-
version: 1.0.10
16679-
resolution: "tno-core@npm:1.0.10"
16677+
"tno-core@npm:1.0.11":
16678+
version: 1.0.11
16679+
resolution: "tno-core@npm:1.0.11"
1668016680
dependencies:
1668116681
"@elastic/elasticsearch": ^8.13.1
1668216682
"@fortawesome/free-solid-svg-icons": ^6.4.2
@@ -16709,7 +16709,7 @@ __metadata:
1670916709
styled-components: ^6.1.11
1671016710
stylis: ^4.3.2
1671116711
yup: ^1.1.1
16712-
checksum: ded4a852f53bda09aa9cdb06c3e098735d2acc65707e1371f0f80408ab954f880c8af96796468105d0842b722ef803640f1c95d62e8df190d62b25cf465e779d
16712+
checksum: e76e3c02bf3c97b783b81d99f8869f5919910dea03b04723c545a2e96501ff21d7ce4748175531b69164352c90f4d5e03d0bf92b70b11cea93c62929e11db366
1671316713
languageName: node
1671416714
linkType: hard
1671516715

app/subscriber/.yarn/cache/tno-core-npm-1.0.10-41a83b5783-ded4a852f5.zip renamed to app/subscriber/.yarn/cache/tno-core-npm-1.0.11-ac3cb59c33-e76e3c02bf.zip

2.01 MB
Binary file not shown.

0 commit comments

Comments
 (0)