@olenbetong/synergi-react 4.2.5 → 4.2.6

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 (56) hide show
  1. package/package.json +5 -5
  2. package/src/chrome/AppShell/index.tsx +29 -29
  3. package/src/chrome/openReport.ts +34 -34
  4. package/src/colorScheme.ts +81 -81
  5. package/src/components/DateNavigator/index.tsx +186 -186
  6. package/src/components/FilePond.tsx +312 -312
  7. package/src/components/ImageEditor/ImageEditor.tsx +348 -348
  8. package/src/components/ImageEditor/index.ts +9 -9
  9. package/src/components/ImageEditor/plugins/cropPlugin/CropOverlay.tsx +165 -165
  10. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +48 -48
  11. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +405 -405
  12. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +47 -47
  13. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomContext.tsx +23 -23
  14. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +40 -40
  15. package/src/components/ImageEditor/useActiveTool.ts +21 -21
  16. package/src/components/ImageEditor/useEdgeDetection.ts +319 -319
  17. package/src/components/ImageEditor/useImageHistory.ts +197 -197
  18. package/src/components/ImageEditor/useOpenCV.ts +184 -184
  19. package/src/components/LinkedCardList/index.scss +95 -95
  20. package/src/components/MergeProgressDialog/index.tsx +249 -249
  21. package/src/components/PageBanner/index.tsx +80 -80
  22. package/src/components/PdfViewer/PdfViewer.tsx +158 -158
  23. package/src/components/ProgressBar/index.scss +96 -96
  24. package/src/components/SplitContainer/index.tsx +333 -333
  25. package/src/components/Toolbar/index.tsx +232 -232
  26. package/src/designsystemet-web-types.d.ts +24 -24
  27. package/src/elements/ElementDamage/DamageFormButtons.tsx +35 -35
  28. package/src/elements/ElementDamage/DescriptionInput.tsx +120 -120
  29. package/src/elements/ElementDamage/DuplicateDamage/DesktopView.tsx +82 -82
  30. package/src/elements/ElementDamage/DuplicateDamage/DublicateElementDamageDialog.tsx +67 -67
  31. package/src/elements/ElementDamage/DuplicateDamage/PhoneView.tsx +45 -45
  32. package/src/elements/ElementDamage/ElementNumberTextField.tsx +41 -41
  33. package/src/elements/ElementDamage/RegisterFix.tsx +100 -100
  34. package/src/elements/ElementDamage/SubmitButtons.tsx +40 -40
  35. package/src/elements/ElementDamage/TransportElementSelect.tsx +52 -52
  36. package/src/elements/ElementLookup.tsx +123 -123
  37. package/src/elements/ElementLookupDialog/BarcodeScanner/decoder.ts +32 -32
  38. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/dbr.ts +118 -118
  39. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/native.ts +103 -103
  40. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders/zxing.ts +95 -95
  41. package/src/elements/ElementLookupDialog/BarcodeScanner/decoders.test.ts +118 -118
  42. package/src/elements/ElementLookupDialog/BarcodeScanner/duplicateFilter.ts +21 -21
  43. package/src/elements/ElementLookupDialog/BarcodeScanner/index.tsx +90 -90
  44. package/src/elements/ElementLookupDialog/BarcodeScanner/useScanner.ts +280 -280
  45. package/src/elements/ElementLookupDialog/HIDScanner/index.tsx +67 -67
  46. package/src/elements/ElementLookupDialog/Manual/ManualForm.tsx +141 -141
  47. package/src/elements/ElementLookupDialog/index.tsx +226 -226
  48. package/src/elements/ElementLookupDialog/utils/Giai.ts +209 -209
  49. package/src/elements/ProjectSelect.tsx +130 -130
  50. package/src/elements/index.ts +15 -15
  51. package/src/filter/index.ts +34 -34
  52. package/src/i18n.ts +13 -13
  53. package/src/index.ts +77 -77
  54. package/src/mui/MuiThemeProvider.tsx +174 -174
  55. package/src/mui/index.ts +1 -1
  56. package/src/test/setup.ts +8 -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
+ }