@olenbetong/synergi-react 4.3.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/styles/styles.css +1 -1
  2. package/dist/styles/styles.css.map +1 -1
  3. package/es/components/CodeEditor/CodeEditor.css +6 -6
  4. package/es/components/MergeProgressDialog/MergeProgressDialogDs.d.ts +7 -0
  5. package/es/components/MergeProgressDialog/MergeProgressDialogDs.js +20 -0
  6. package/es/components/MergeProgressDialog/index.d.ts +3 -8
  7. package/es/components/MergeProgressDialog/index.js +4 -133
  8. package/es/components/MergeProgressDialog/useMergeJob.d.ts +36 -0
  9. package/es/components/MergeProgressDialog/useMergeJob.js +141 -0
  10. package/es/components/ProgressBar/index.css +1 -1
  11. package/es/components/Toolbar/Toolbar.css +137 -137
  12. package/es/elements/ElementLookupDialog/BarcodeScanner/BarcodeScanner.css +81 -0
  13. package/es/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.d.ts +2 -2
  14. package/es/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.js +1 -2
  15. package/es/elements/ElementLookupDialog/BarcodeScanner/Error.js +3 -29
  16. package/es/elements/ElementLookupDialog/BarcodeScanner/index.d.ts +1 -0
  17. package/es/elements/ElementLookupDialog/BarcodeScanner/index.js +3 -28
  18. package/es/index.css +1 -1
  19. package/es/index.d.ts +2 -1
  20. package/es/index.js +2 -1
  21. package/es/mui/index.d.ts +1 -0
  22. package/es/mui/index.js +1 -0
  23. package/es/test/setup.d.ts +5 -0
  24. package/package.json +21 -14
  25. package/src/chrome/AppShell/index.tsx +29 -29
  26. package/src/chrome/openReport.ts +34 -34
  27. package/src/colorScheme.ts +125 -125
  28. package/src/components/CodeEditor/CodeEditor.css +6 -6
  29. package/src/components/CodeEditor/CodeEditor.tsx +173 -173
  30. package/src/components/CodeEditor/index.ts +1 -1
  31. package/src/components/DateNavigator/index.tsx +186 -186
  32. package/src/components/FilePond.tsx +312 -312
  33. package/src/components/ImageEditor/ImageEditor.tsx +348 -348
  34. package/src/components/ImageEditor/index.ts +9 -9
  35. package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
  36. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
  37. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +405 -405
  38. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
  39. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
  40. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
  41. package/src/components/ImageEditor/useActiveTool.ts +21 -21
  42. package/src/components/ImageEditor/useEdgeDetection.ts +319 -319
  43. package/src/components/ImageEditor/useImageHistory.ts +197 -197
  44. package/src/components/ImageEditor/useOpenCV.ts +184 -184
  45. package/src/components/LinkedCardList/index.scss +95 -95
  46. package/src/components/MergeProgressDialog/MergeProgressDialogDs.tsx +91 -0
  47. package/src/components/MergeProgressDialog/index.tsx +5 -158
  48. package/src/components/MergeProgressDialog/useMergeJob.ts +169 -0
  49. package/src/components/PageBanner/index.tsx +80 -80
  50. package/src/components/PdfViewer/PdfViewer.tsx +158 -158
  51. package/src/components/ProgressBar/index.scss +23 -54
  52. package/src/components/SplitContainer/index.tsx +333 -333
  53. package/src/components/Toolbar/Toolbar.css +137 -137
  54. package/src/components/Toolbar/index.tsx +265 -265
  55. package/src/designsystemet-web-types.d.ts +24 -24
  56. package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
  57. package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
  58. package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
  59. package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
  60. package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
  61. package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
  62. package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
  63. package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
  64. package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
  65. package/src/elements/ElementLookup.tsx +123 -123
  66. package/src/elements/ElementLookupDialog/BarcodeScanner/BarcodeScanner.css +81 -0
  67. package/src/elements/ElementLookupDialog/BarcodeScanner/DeadIcon.tsx +4 -4
  68. package/src/elements/ElementLookupDialog/BarcodeScanner/Error.tsx +7 -36
  69. package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +20 -49
  70. package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
  71. package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
  72. package/src/elements/ElementLookupDialog/index.tsx +226 -226
  73. package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
  74. package/src/elements/ProjectSelect.tsx +130 -130
  75. package/src/elements/index.ts +15 -15
  76. package/src/filter/index.ts +34 -34
  77. package/src/i18n.ts +13 -13
  78. package/src/index.ts +5 -1
  79. package/src/mui/MuiThemeProvider.tsx +135 -135
  80. package/src/mui/index.ts +1 -0
  81. package/src/test/setup.ts +23 -8
@@ -1,120 +1,120 @@
1
- import { Autocomplete, Button, TextField } from "@mui/material";
2
- import { useEffect, useRef, useState } from "react";
3
- import { getLocalizedString } from "../../i18n.js";
4
-
5
- export type DescriptionInputType = {
6
- Description?: string | null;
7
- Cause?: string | null;
8
- Action?: string | null;
9
- Date?: Date;
10
- };
11
-
12
- type DescriptionInputProps = {
13
- value?: DescriptionInputType | null;
14
- defaultValue?: DescriptionInputType | null;
15
- descriptionOptions?: string[];
16
- storageNamespace?: string;
17
- onCopyPrevDamage?: (value: DescriptionInputType) => void;
18
- onChange?: (value: DescriptionInputType) => void;
19
- };
20
-
21
- export function DescriptionInput({
22
- value,
23
- defaultValue,
24
- descriptionOptions = [
25
- getLocalizedString("Tear in element"),
26
- getLocalizedString("Damage around lifting anchor"),
27
- getLocalizedString("Damage on underside"),
28
- ],
29
- storageNamespace = "ElementDamage",
30
- onCopyPrevDamage,
31
- onChange,
32
- }: DescriptionInputProps) {
33
- let initializedRef = useRef<boolean>(false);
34
-
35
- let [input, setInput] = useState<DescriptionInputType | null>(defaultValue ?? null);
36
- let inputValue = value === undefined ? input : value;
37
-
38
- // biome-ignore lint: intentionally skipping "value" dependency as this shouldn't run when "value" changes
39
- useEffect(() => {
40
- if (initializedRef.current) {
41
- return;
42
- }
43
-
44
- if (value === undefined && defaultValue) {
45
- setInput(defaultValue);
46
- initializedRef.current = true;
47
- }
48
- }, [defaultValue]);
49
-
50
- function handleCopyPrevDamage() {
51
- let description = localStorage.getItem(`${storageNamespace}_Description`) ?? "";
52
- let cause = localStorage.getItem(`${storageNamespace}_Cause`) ?? "";
53
- let action = localStorage.getItem(`${storageNamespace}_Action`) ?? "";
54
-
55
- onCopyPrevDamage?.({
56
- Description: description,
57
- Cause: cause,
58
- Action: action,
59
- });
60
- setInput({
61
- ...inputValue,
62
- Description: description,
63
- Cause: cause,
64
- Action: action,
65
- });
66
- }
67
-
68
- function handleOnChange(value: DescriptionInputType) {
69
- onChange?.(value);
70
- setInput(value);
71
- }
72
-
73
- return (
74
- <>
75
- <TextField
76
- name="Date"
77
- type="date"
78
- value={(inputValue?.Date ?? new Date()).toISOString().split("T")[0]}
79
- onChange={(event) => handleOnChange({ ...inputValue, Date: new Date(event.target.value) })}
80
- id="NewElementDamage_Date"
81
- label={getLocalizedString("Date")}
82
- fullWidth
83
- required
84
- slotProps={{ inputLabel: { shrink: true } }}
85
- />
86
-
87
- <Button variant="contained" onClick={handleCopyPrevDamage}>
88
- {getLocalizedString("Copy previous damage")}
89
- </Button>
90
-
91
- <Autocomplete
92
- value={inputValue?.Description ?? ""}
93
- onChange={(_event, value) => handleOnChange({ ...inputValue, Description: value ?? "" })}
94
- options={descriptionOptions}
95
- freeSolo
96
- renderInput={(params) => (
97
- <TextField name="Description" required {...(params as any)} label={getLocalizedString("Description")} />
98
- )}
99
- />
100
-
101
- <TextField
102
- name="Cause"
103
- id="NewElementDamage_Cause"
104
- value={inputValue?.Cause ?? ""}
105
- onChange={(event) => handleOnChange({ ...inputValue, Cause: event.currentTarget.value })}
106
- label={getLocalizedString("Cause")}
107
- fullWidth
108
- />
109
-
110
- <TextField
111
- name="Action"
112
- id="NewElementDamage_Action"
113
- value={inputValue?.Action ?? ""}
114
- onChange={(event) => handleOnChange({ ...inputValue, Action: event.currentTarget.value })}
115
- label={getLocalizedString("Action")}
116
- fullWidth
117
- />
118
- </>
119
- );
120
- }
1
+ import { Autocomplete, Button, TextField } from "@mui/material";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { getLocalizedString } from "../../i18n.js";
4
+
5
+ export type DescriptionInputType = {
6
+ Description?: string | null;
7
+ Cause?: string | null;
8
+ Action?: string | null;
9
+ Date?: Date;
10
+ };
11
+
12
+ type DescriptionInputProps = {
13
+ value?: DescriptionInputType | null;
14
+ defaultValue?: DescriptionInputType | null;
15
+ descriptionOptions?: string[];
16
+ storageNamespace?: string;
17
+ onCopyPrevDamage?: (value: DescriptionInputType) => void;
18
+ onChange?: (value: DescriptionInputType) => void;
19
+ };
20
+
21
+ export function DescriptionInput({
22
+ value,
23
+ defaultValue,
24
+ descriptionOptions = [
25
+ getLocalizedString("Tear in element"),
26
+ getLocalizedString("Damage around lifting anchor"),
27
+ getLocalizedString("Damage on underside"),
28
+ ],
29
+ storageNamespace = "ElementDamage",
30
+ onCopyPrevDamage,
31
+ onChange,
32
+ }: DescriptionInputProps) {
33
+ let initializedRef = useRef<boolean>(false);
34
+
35
+ let [input, setInput] = useState<DescriptionInputType | null>(defaultValue ?? null);
36
+ let inputValue = value === undefined ? input : value;
37
+
38
+ // biome-ignore lint: intentionally skipping "value" dependency as this shouldn't run when "value" changes
39
+ useEffect(() => {
40
+ if (initializedRef.current) {
41
+ return;
42
+ }
43
+
44
+ if (value === undefined && defaultValue) {
45
+ setInput(defaultValue);
46
+ initializedRef.current = true;
47
+ }
48
+ }, [defaultValue]);
49
+
50
+ function handleCopyPrevDamage() {
51
+ let description = localStorage.getItem(`${storageNamespace}_Description`) ?? "";
52
+ let cause = localStorage.getItem(`${storageNamespace}_Cause`) ?? "";
53
+ let action = localStorage.getItem(`${storageNamespace}_Action`) ?? "";
54
+
55
+ onCopyPrevDamage?.({
56
+ Description: description,
57
+ Cause: cause,
58
+ Action: action,
59
+ });
60
+ setInput({
61
+ ...inputValue,
62
+ Description: description,
63
+ Cause: cause,
64
+ Action: action,
65
+ });
66
+ }
67
+
68
+ function handleOnChange(value: DescriptionInputType) {
69
+ onChange?.(value);
70
+ setInput(value);
71
+ }
72
+
73
+ return (
74
+ <>
75
+ <TextField
76
+ name="Date"
77
+ type="date"
78
+ value={(inputValue?.Date ?? new Date()).toISOString().split("T")[0]}
79
+ onChange={(event) => handleOnChange({ ...inputValue, Date: new Date(event.target.value) })}
80
+ id="NewElementDamage_Date"
81
+ label={getLocalizedString("Date")}
82
+ fullWidth
83
+ required
84
+ slotProps={{ inputLabel: { shrink: true } }}
85
+ />
86
+
87
+ <Button variant="contained" onClick={handleCopyPrevDamage}>
88
+ {getLocalizedString("Copy previous damage")}
89
+ </Button>
90
+
91
+ <Autocomplete
92
+ value={inputValue?.Description ?? ""}
93
+ onChange={(_event, value) => handleOnChange({ ...inputValue, Description: value ?? "" })}
94
+ options={descriptionOptions}
95
+ freeSolo
96
+ renderInput={(params) => (
97
+ <TextField name="Description" required {...(params as any)} label={getLocalizedString("Description")} />
98
+ )}
99
+ />
100
+
101
+ <TextField
102
+ name="Cause"
103
+ id="NewElementDamage_Cause"
104
+ value={inputValue?.Cause ?? ""}
105
+ onChange={(event) => handleOnChange({ ...inputValue, Cause: event.currentTarget.value })}
106
+ label={getLocalizedString("Cause")}
107
+ fullWidth
108
+ />
109
+
110
+ <TextField
111
+ name="Action"
112
+ id="NewElementDamage_Action"
113
+ value={inputValue?.Action ?? ""}
114
+ onChange={(event) => handleOnChange({ ...inputValue, Action: event.currentTarget.value })}
115
+ label={getLocalizedString("Action")}
116
+ fullWidth
117
+ />
118
+ </>
119
+ );
120
+ }
@@ -1,82 +1,82 @@
1
- import { Grid, type GridSize, Typography } from "@mui/material";
2
- import { Link } from "@olenbetong/appframe-mui";
3
- import type { DamagesRecord } from "../../data";
4
- import { getLocalizedString } from "../../../i18n.js";
5
-
6
- type SummaryItemProps = {
7
- col: GridSize;
8
- label?: string;
9
- children?: React.ReactNode;
10
- em?: boolean;
11
- align?: "center" | "left" | "right";
12
- padding?: string | number;
13
- };
14
-
15
- function SummaryItem({ col, label, children, em, align, padding }: SummaryItemProps) {
16
- return (
17
- <Grid size={col} sx={{ p: padding ?? 2, borderBottom: (t) => `1px solid ${t.palette.divider}` }}>
18
- {label && (
19
- <Typography variant="body1" sx={{ fontSize: "0.9rem", fontWeight: 500, mb: 1, textAlign: align }}>
20
- {getLocalizedString(label)}
21
- </Typography>
22
- )}
23
- {children && (
24
- <Typography
25
- sx={{
26
- fontSize: em ? "1.4rem" : "0.9rem",
27
- fontWeight: em ? 600 : undefined,
28
- textAlign: align,
29
- whiteSpace: "pre-line",
30
- }}
31
- >
32
- {children}
33
- </Typography>
34
- )}
35
- </Grid>
36
- );
37
- }
38
-
39
- type ElementDamagesItemProps = {
40
- record: DamagesRecord;
41
- linkToDamage: boolean;
42
- };
43
-
44
- export function ElementDamagesItem({ record, linkToDamage }: ElementDamagesItemProps) {
45
- return (
46
- <>
47
- <SummaryItem col={1.5}>
48
- {linkToDamage ? (
49
- <Link
50
- href="#"
51
- onClick={(e) => {
52
- e.preventDefault();
53
- window.location.href = `${record.ID}`;
54
- }}
55
- >
56
- {record.ID}
57
- </Link>
58
- ) : (
59
- <span>{record.ID}</span>
60
- )}
61
- </SummaryItem>
62
- <SummaryItem col={2.5} align="right">
63
- {record.Date.toISOString().split("T")[0]}
64
- </SummaryItem>
65
- <SummaryItem col={3}>{record.Description}</SummaryItem>
66
- <SummaryItem col={2.5}>{record.Cause}</SummaryItem>
67
- <SummaryItem col={2.5}>{record.Action}</SummaryItem>
68
- </>
69
- );
70
- }
71
-
72
- export function ElementDamagesHeader() {
73
- return (
74
- <>
75
- <SummaryItem col={1.5} label="ID" />
76
- <SummaryItem col={2.5} label="Date" align="right" />
77
- <SummaryItem col={3} label="Description" />
78
- <SummaryItem col={2.5} label="Cause" />
79
- <SummaryItem col={2.5} label="Action" />
80
- </>
81
- );
82
- }
1
+ import { Grid, type GridSize, Typography } from "@mui/material";
2
+ import { Link } from "@olenbetong/appframe-mui";
3
+ import type { DamagesRecord } from "../../data";
4
+ import { getLocalizedString } from "../../../i18n.js";
5
+
6
+ type SummaryItemProps = {
7
+ col: GridSize;
8
+ label?: string;
9
+ children?: React.ReactNode;
10
+ em?: boolean;
11
+ align?: "center" | "left" | "right";
12
+ padding?: string | number;
13
+ };
14
+
15
+ function SummaryItem({ col, label, children, em, align, padding }: SummaryItemProps) {
16
+ return (
17
+ <Grid size={col} sx={{ p: padding ?? 2, borderBottom: (t) => `1px solid ${t.palette.divider}` }}>
18
+ {label && (
19
+ <Typography variant="body1" sx={{ fontSize: "0.9rem", fontWeight: 500, mb: 1, textAlign: align }}>
20
+ {getLocalizedString(label)}
21
+ </Typography>
22
+ )}
23
+ {children && (
24
+ <Typography
25
+ sx={{
26
+ fontSize: em ? "1.4rem" : "0.9rem",
27
+ fontWeight: em ? 600 : undefined,
28
+ textAlign: align,
29
+ whiteSpace: "pre-line",
30
+ }}
31
+ >
32
+ {children}
33
+ </Typography>
34
+ )}
35
+ </Grid>
36
+ );
37
+ }
38
+
39
+ type ElementDamagesItemProps = {
40
+ record: DamagesRecord;
41
+ linkToDamage: boolean;
42
+ };
43
+
44
+ export function ElementDamagesItem({ record, linkToDamage }: ElementDamagesItemProps) {
45
+ return (
46
+ <>
47
+ <SummaryItem col={1.5}>
48
+ {linkToDamage ? (
49
+ <Link
50
+ href="#"
51
+ onClick={(e) => {
52
+ e.preventDefault();
53
+ window.location.href = `${record.ID}`;
54
+ }}
55
+ >
56
+ {record.ID}
57
+ </Link>
58
+ ) : (
59
+ <span>{record.ID}</span>
60
+ )}
61
+ </SummaryItem>
62
+ <SummaryItem col={2.5} align="right">
63
+ {record.Date.toISOString().split("T")[0]}
64
+ </SummaryItem>
65
+ <SummaryItem col={3}>{record.Description}</SummaryItem>
66
+ <SummaryItem col={2.5}>{record.Cause}</SummaryItem>
67
+ <SummaryItem col={2.5}>{record.Action}</SummaryItem>
68
+ </>
69
+ );
70
+ }
71
+
72
+ export function ElementDamagesHeader() {
73
+ return (
74
+ <>
75
+ <SummaryItem col={1.5} label="ID" />
76
+ <SummaryItem col={2.5} label="Date" align="right" />
77
+ <SummaryItem col={3} label="Description" />
78
+ <SummaryItem col={2.5} label="Cause" />
79
+ <SummaryItem col={2.5} label="Action" />
80
+ </>
81
+ );
82
+ }
@@ -1,67 +1,67 @@
1
- import Add from "@mui/icons-material/Add";
2
- import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Grid, useMediaQuery } from "@mui/material";
3
- import { theme } from "@olenbetong/appframe-mui";
4
- import type { DamagesRecord } from "../../data";
5
- import { ElementDamagesHeader, ElementDamagesItem } from "./DesktopView";
6
- import { DuplicatePhoneViewItem } from "./PhoneView";
7
- import { getLocalizedString } from "../../../i18n.js";
8
-
9
- type DuplicateElementDamageDialogProps = {
10
- open: boolean;
11
- onClose: () => void;
12
- record: DamagesRecord[];
13
- onRegisterAnyway: () => void;
14
- loading: boolean;
15
- linkToDamage: boolean;
16
- };
17
-
18
- export function DuplicateElementDamageDialog({
19
- open,
20
- onClose,
21
- record,
22
- onRegisterAnyway,
23
- loading,
24
- linkToDamage,
25
- }: DuplicateElementDamageDialogProps) {
26
- let matches = useMediaQuery(theme.breakpoints.up("lg"));
27
- let backgroundColor = "#e9ebee";
28
-
29
- return (
30
- <Dialog open={open} onClose={onClose} fullWidth fullScreen={!matches}>
31
- <DialogTitle sx={{ backgroundColor: backgroundColor }}>
32
- {getLocalizedString("This element has one or more unfixed registered damage")}
33
- </DialogTitle>
34
- <DialogContent sx={{ backgroundColor: backgroundColor }}>
35
- <Grid container>
36
- {matches ? (
37
- <>
38
- <ElementDamagesHeader />
39
- {record.map((record) => (
40
- <ElementDamagesItem key={record.PrimKey} record={record} linkToDamage={linkToDamage} />
41
- ))}
42
- </>
43
- ) : (
44
- <div className="flow" style={{ width: "100%" }}>
45
- {record.map((record) => (
46
- <DuplicatePhoneViewItem key={record.PrimKey} record={record} linkToDamage={linkToDamage} />
47
- ))}
48
- </div>
49
- )}
50
- </Grid>
51
- </DialogContent>
52
- <DialogActions sx={{ backgroundColor: backgroundColor }}>
53
- <Button onClick={onClose}>{getLocalizedString("Cancel")}</Button>
54
- <Button
55
- startIcon={<Add />}
56
- variant="contained"
57
- type="submit"
58
- onClick={onRegisterAnyway}
59
- loading={loading}
60
- loadingPosition="start"
61
- >
62
- {getLocalizedString("Register damage anyway")}
63
- </Button>
64
- </DialogActions>
65
- </Dialog>
66
- );
67
- }
1
+ import Add from "@mui/icons-material/Add";
2
+ import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Grid, useMediaQuery } from "@mui/material";
3
+ import { theme } from "@olenbetong/appframe-mui";
4
+ import type { DamagesRecord } from "../../data";
5
+ import { ElementDamagesHeader, ElementDamagesItem } from "./DesktopView";
6
+ import { DuplicatePhoneViewItem } from "./PhoneView";
7
+ import { getLocalizedString } from "../../../i18n.js";
8
+
9
+ type DuplicateElementDamageDialogProps = {
10
+ open: boolean;
11
+ onClose: () => void;
12
+ record: DamagesRecord[];
13
+ onRegisterAnyway: () => void;
14
+ loading: boolean;
15
+ linkToDamage: boolean;
16
+ };
17
+
18
+ export function DuplicateElementDamageDialog({
19
+ open,
20
+ onClose,
21
+ record,
22
+ onRegisterAnyway,
23
+ loading,
24
+ linkToDamage,
25
+ }: DuplicateElementDamageDialogProps) {
26
+ let matches = useMediaQuery(theme.breakpoints.up("lg"));
27
+ let backgroundColor = "#e9ebee";
28
+
29
+ return (
30
+ <Dialog open={open} onClose={onClose} fullWidth fullScreen={!matches}>
31
+ <DialogTitle sx={{ backgroundColor: backgroundColor }}>
32
+ {getLocalizedString("This element has one or more unfixed registered damage")}
33
+ </DialogTitle>
34
+ <DialogContent sx={{ backgroundColor: backgroundColor }}>
35
+ <Grid container>
36
+ {matches ? (
37
+ <>
38
+ <ElementDamagesHeader />
39
+ {record.map((record) => (
40
+ <ElementDamagesItem key={record.PrimKey} record={record} linkToDamage={linkToDamage} />
41
+ ))}
42
+ </>
43
+ ) : (
44
+ <div className="flow" style={{ width: "100%" }}>
45
+ {record.map((record) => (
46
+ <DuplicatePhoneViewItem key={record.PrimKey} record={record} linkToDamage={linkToDamage} />
47
+ ))}
48
+ </div>
49
+ )}
50
+ </Grid>
51
+ </DialogContent>
52
+ <DialogActions sx={{ backgroundColor: backgroundColor }}>
53
+ <Button onClick={onClose}>{getLocalizedString("Cancel")}</Button>
54
+ <Button
55
+ startIcon={<Add />}
56
+ variant="contained"
57
+ type="submit"
58
+ onClick={onRegisterAnyway}
59
+ loading={loading}
60
+ loadingPosition="start"
61
+ >
62
+ {getLocalizedString("Register damage anyway")}
63
+ </Button>
64
+ </DialogActions>
65
+ </Dialog>
66
+ );
67
+ }
@@ -1,45 +1,45 @@
1
- import { Card, CardContent, Typography } from "@mui/material";
2
- import type { DamagesRecord } from "../../data";
3
- import { getLocalizedString } from "../../../i18n.js";
4
-
5
- type DuplicatePhoneViewItemProps = {
6
- record: DamagesRecord;
7
- linkToDamage: boolean;
8
- };
9
-
10
- export function DuplicatePhoneViewItem({ record, linkToDamage }: DuplicatePhoneViewItemProps) {
11
- return (
12
- <Card
13
- variant="outlined"
14
- onClick={() => {
15
- if (linkToDamage) {
16
- window.location.href = `${record.ID}`;
17
- }
18
- }}
19
- >
20
- <CardContent>
21
- <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
22
- {record.Date.toLocaleDateString()}
23
- </Typography>
24
- <Typography variant="h5" sx={{ mb: 1.5 }}>
25
- {record.ElementID} - {record.DisplayName}
26
- </Typography>
27
-
28
- <Typography>{getLocalizedString("Description")}:</Typography>
29
- <Typography sx={{ mb: 1.5 }} color="text.secondary">
30
- {record.Description}
31
- </Typography>
32
-
33
- <Typography>{getLocalizedString("Cause")}: </Typography>
34
- <Typography sx={{ mb: 1.5 }} color="text.secondary">
35
- {record.Cause}
36
- </Typography>
37
-
38
- <Typography>{getLocalizedString("Action")}: </Typography>
39
- <Typography sx={{ mb: 1.5 }} color="text.secondary">
40
- {record.Action}
41
- </Typography>
42
- </CardContent>
43
- </Card>
44
- );
45
- }
1
+ import { Card, CardContent, Typography } from "@mui/material";
2
+ import type { DamagesRecord } from "../../data";
3
+ import { getLocalizedString } from "../../../i18n.js";
4
+
5
+ type DuplicatePhoneViewItemProps = {
6
+ record: DamagesRecord;
7
+ linkToDamage: boolean;
8
+ };
9
+
10
+ export function DuplicatePhoneViewItem({ record, linkToDamage }: DuplicatePhoneViewItemProps) {
11
+ return (
12
+ <Card
13
+ variant="outlined"
14
+ onClick={() => {
15
+ if (linkToDamage) {
16
+ window.location.href = `${record.ID}`;
17
+ }
18
+ }}
19
+ >
20
+ <CardContent>
21
+ <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
22
+ {record.Date.toLocaleDateString()}
23
+ </Typography>
24
+ <Typography variant="h5" sx={{ mb: 1.5 }}>
25
+ {record.ElementID} - {record.DisplayName}
26
+ </Typography>
27
+
28
+ <Typography>{getLocalizedString("Description")}:</Typography>
29
+ <Typography sx={{ mb: 1.5 }} color="text.secondary">
30
+ {record.Description}
31
+ </Typography>
32
+
33
+ <Typography>{getLocalizedString("Cause")}: </Typography>
34
+ <Typography sx={{ mb: 1.5 }} color="text.secondary">
35
+ {record.Cause}
36
+ </Typography>
37
+
38
+ <Typography>{getLocalizedString("Action")}: </Typography>
39
+ <Typography sx={{ mb: 1.5 }} color="text.secondary">
40
+ {record.Action}
41
+ </Typography>
42
+ </CardContent>
43
+ </Card>
44
+ );
45
+ }