@olenbetong/synergi-react 5.1.0 → 5.3.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 (76) hide show
  1. package/dist/styles/styles.css +1 -1
  2. package/dist/styles/styles.css.map +1 -1
  3. package/es/components/Checkbox/index.css +1 -1
  4. package/es/components/ColorCard/index.css +17 -28
  5. package/es/components/DateNavigator/index.css +5 -7
  6. package/es/components/ImageEditor/ImageEditor.css +10 -10
  7. package/es/components/ImageEditor/ImageEditor.d.ts +18 -1
  8. package/es/components/ImageEditor/ImageEditor.js +30 -13
  9. package/es/components/ImageEditor/ResponsiveButton.js +2 -2
  10. package/es/components/ImageEditor/encodeImage.d.ts +33 -0
  11. package/es/components/ImageEditor/encodeImage.js +60 -0
  12. package/es/components/ImageEditor/index.d.ts +2 -0
  13. package/es/components/ImageEditor/index.js +1 -0
  14. package/es/components/ImageEditor/plugins/cropPlugin/CropToolbar.js +1 -1
  15. package/es/components/ImageEditor/plugins/cropPlugin/useCropTool.js +3 -9
  16. package/es/components/ImageEditor/plugins/redactPlugin/RedactToolbar.js +1 -1
  17. package/es/components/ImageEditor/plugins/redactPlugin/useRedactTool.js +3 -4
  18. package/es/components/ImageEditor/plugins/rotatePlugin.js +2 -1
  19. package/es/components/MergeProgressDialog/MergeProgressDialogDs.js +3 -3
  20. package/es/components/PageBanner/index.css +1 -1
  21. package/es/components/PdfViewer/PdfViewer.js +1 -1
  22. package/es/components/Spinner/index.css +1 -1
  23. package/es/components/SplitContainer/index.css +1 -1
  24. package/es/components/ValueToggleGroup/index.css +2 -2
  25. package/es/elements/ElementLookupDialog/BarcodeScanner/BarcodeScanner.css +7 -7
  26. package/es/elements-ds/ElementLookupDialog.js +1 -1
  27. package/es/improve/ReportIssueAttachments.d.ts +6 -0
  28. package/es/improve/ReportIssueAttachments.js +45 -0
  29. package/es/improve/ReportIssueForm.css +133 -0
  30. package/es/improve/ReportIssueForm.d.ts +18 -0
  31. package/es/improve/ReportIssueForm.js +71 -0
  32. package/es/improve/data/dsReportIssueAreas.d.ts +8 -0
  33. package/es/improve/data/dsReportIssueAreas.js +37 -0
  34. package/es/improve/data/dsReportIssueFiles.d.ts +15 -0
  35. package/es/improve/data/dsReportIssueFiles.js +55 -0
  36. package/es/improve/data/index.d.ts +3 -0
  37. package/es/improve/data/index.js +3 -0
  38. package/es/improve/data/procReportIssue.d.ts +16 -0
  39. package/es/improve/data/procReportIssue.js +44 -0
  40. package/es/improve/index.d.ts +3 -0
  41. package/es/improve/index.js +3 -0
  42. package/es/index.css +1 -1
  43. package/package.json +7 -3
  44. package/src/components/Checkbox/index.scss +2 -2
  45. package/src/components/ColorCard/index.css +17 -28
  46. package/src/components/DateNavigator/index.css +5 -7
  47. package/src/components/ImageEditor/ImageEditor.browser.test.tsx +30 -5
  48. package/src/components/ImageEditor/ImageEditor.css +10 -10
  49. package/src/components/ImageEditor/ImageEditor.test.tsx +4 -3
  50. package/src/components/ImageEditor/ImageEditor.tsx +47 -14
  51. package/src/components/ImageEditor/ResponsiveButton.tsx +2 -2
  52. package/src/components/ImageEditor/encodeImage.browser.test.ts +88 -0
  53. package/src/components/ImageEditor/encodeImage.ts +80 -0
  54. package/src/components/ImageEditor/index.ts +2 -0
  55. package/src/components/ImageEditor/plugins/cropPlugin/CropToolbar.tsx +2 -8
  56. package/src/components/ImageEditor/plugins/cropPlugin/useCropTool.ts +3 -10
  57. package/src/components/ImageEditor/plugins/plugins.browser.test.ts +20 -2
  58. package/src/components/ImageEditor/plugins/redactPlugin/RedactToolbar.tsx +3 -3
  59. package/src/components/ImageEditor/plugins/redactPlugin/useRedactTool.ts +3 -4
  60. package/src/components/ImageEditor/plugins/rotatePlugin.ts +2 -1
  61. package/src/components/MergeProgressDialog/MergeProgressDialogDs.tsx +3 -3
  62. package/src/components/PageBanner/index.scss +10 -10
  63. package/src/components/PdfViewer/PdfViewer.tsx +1 -1
  64. package/src/components/Spinner/index.css +1 -1
  65. package/src/components/SplitContainer/index.scss +5 -1
  66. package/src/components/ValueToggleGroup/index.css +2 -2
  67. package/src/elements/ElementLookupDialog/BarcodeScanner/BarcodeScanner.css +7 -7
  68. package/src/elements-ds/ElementLookupDialog.tsx +1 -3
  69. package/src/improve/ReportIssueAttachments.tsx +138 -0
  70. package/src/improve/ReportIssueForm.css +133 -0
  71. package/src/improve/ReportIssueForm.tsx +218 -0
  72. package/src/improve/data/dsReportIssueAreas.ts +45 -0
  73. package/src/improve/data/dsReportIssueFiles.ts +66 -0
  74. package/src/improve/data/index.ts +3 -0
  75. package/src/improve/data/procReportIssue.ts +58 -0
  76. package/src/improve/index.ts +3 -0
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { fullImageQuad, useEdgeDetection } from "../../useEdgeDetection.js";
3
3
  import { loadOpenCV, useOpenCV } from "../../useOpenCV.js";
4
+ import { canvasToIntermediateBlob } from "../../encodeImage.js";
4
5
  /** Relative (0–1) tolerance for treating a quad as axis-aligned. */
5
6
  const RECT_TOLERANCE = 0.001;
6
7
  /** Minimum drag distance in CSS pixels before a drawn rectangle is accepted. */
@@ -259,7 +260,7 @@ async function rectCropAtFullResolution(imageUrl, relCorners) {
259
260
  canvas.width = width;
260
261
  canvas.height = height;
261
262
  canvas.getContext("2d").drawImage(img, x, y, width, height, 0, 0, width, height);
262
- return canvasToPngBlob(canvas);
263
+ return canvasToIntermediateBlob(canvas);
263
264
  }
264
265
  function loadImage(url) {
265
266
  return new Promise((resolve, reject) => {
@@ -269,13 +270,6 @@ function loadImage(url) {
269
270
  img.src = url;
270
271
  });
271
272
  }
272
- function canvasToPngBlob(canvas) {
273
- return new Promise((resolve, reject) => {
274
- // PNG is lossless — critical for receipts and screenshots where JPEG
275
- // compression would make text unreadable.
276
- canvas.toBlob((b) => (b ? resolve(b) : reject(new Error("toBlob failed"))), "image/png");
277
- });
278
- }
279
273
  /** Loads the image at native resolution, maps relative corners, and warps. */
280
274
  // oxlint-disable-next-line typescript/no-explicit-any -- OpenCV.js types
281
275
  async function cropImageAtFullResolution(cv, imageUrl, relCorners) {
@@ -306,7 +300,7 @@ function perspectiveCrop(cv, srcCanvas, corners) {
306
300
  cv.imshow(outCanvas, dst);
307
301
  for (let m of [src, dst, srcPts, dstPts, M])
308
302
  m.delete();
309
- return canvasToPngBlob(outCanvas);
303
+ return canvasToIntermediateBlob(outCanvas);
310
304
  }
311
305
  /**
312
306
  * Standalone replay handler for the "crop" action type.
@@ -23,5 +23,5 @@ export function RedactToolbar() {
23
23
  setApplying(false);
24
24
  }
25
25
  }
26
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "image-editor__toolbar-group", children: [_jsxs(Button, { variant: "tertiary", "data-size": "sm", onClick: onCancel, disabled: applying, children: [_jsx(XMarkIcon, { "aria-hidden": true }), getLocalizedString("Cancel")] }), _jsxs(Button, { variant: "tertiary", "data-size": "sm", onClick: clearAll, disabled: applying || rects.length === 0, children: [_jsx(EraserIcon, { "aria-hidden": true }), getLocalizedString("Clear all")] })] }), _jsx("div", { className: "image-editor__toolbar-group", children: _jsxs(Button, { variant: "primary", "data-size": "sm", onClick: handleApply, disabled: applying, children: [applying ? _jsx(Spinner, { "aria-hidden": true, "data-size": "xs" }) : _jsx(CheckmarkIcon, { "aria-hidden": true }), rects.length === 0 ? getLocalizedString("Done") : getLocalizedString("Apply redact")] }) })] }));
26
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "image-editor__toolbar-group", children: [_jsxs(Button, { variant: "tertiary", onClick: onCancel, disabled: applying, children: [_jsx(XMarkIcon, { "aria-hidden": true }), getLocalizedString("Cancel")] }), _jsxs(Button, { variant: "tertiary", onClick: clearAll, disabled: applying || rects.length === 0, children: [_jsx(EraserIcon, { "aria-hidden": true }), getLocalizedString("Clear all")] })] }), _jsx("div", { className: "image-editor__toolbar-group", children: _jsxs(Button, { variant: "primary", onClick: handleApply, disabled: applying, children: [applying ? _jsx(Spinner, { "aria-hidden": true, "data-size": "xs" }) : _jsx(CheckmarkIcon, { "aria-hidden": true }), rects.length === 0 ? getLocalizedString("Done") : getLocalizedString("Apply redact")] }) })] }));
27
27
  }
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useRef, useState } from "react";
2
+ import { canvasToIntermediateBlob } from "../../encodeImage.js";
2
3
  /** Manages state and logic for the blur-redaction tool. */
3
4
  export function useRedactTool(imageUrl) {
4
5
  let [rects, setRects] = useState([]);
@@ -58,9 +59,7 @@ export function useRedactTool(imageUrl) {
58
59
  let nh = Math.round(r.h * scaleY);
59
60
  blurRegionOnCanvas(ctx, img, nx, ny, nw, nh);
60
61
  }
61
- let blob = await new Promise((resolve, reject) => {
62
- canvas.toBlob((b) => (b ? resolve(b) : reject(new Error("toBlob failed"))), "image/jpeg", 0.92);
63
- });
62
+ let blob = await canvasToIntermediateBlob(canvas);
64
63
  // Store natural-pixel coords so replay doesn't need display size.
65
64
  let actions = rects.map((r) => ({
66
65
  type: "redact-blur",
@@ -106,7 +105,7 @@ export function replayRedactBlur(imageUrl, params) {
106
105
  let ctx = canvas.getContext("2d");
107
106
  ctx.drawImage(img, 0, 0);
108
107
  blurRegionOnCanvas(ctx, img, x, y, w, h);
109
- canvas.toBlob((b) => (b ? resolve(b) : reject(new Error("toBlob failed"))), "image/jpeg", 0.92);
108
+ canvasToIntermediateBlob(canvas).then(resolve, reject);
110
109
  };
111
110
  img.onerror = () => reject(new Error("Failed to load image for redact replay"));
112
111
  img.src = imageUrl;
@@ -1,4 +1,5 @@
1
1
  import { RotateLeftIcon, RotateRightIcon } from "@navikt/aksel-icons";
2
+ import { canvasToIntermediateBlob } from "../encodeImage.js";
2
3
  function rotateBlob(imageUrl, direction) {
3
4
  return new Promise((resolve, reject) => {
4
5
  let img = new Image();
@@ -16,7 +17,7 @@ function rotateBlob(imageUrl, direction) {
16
17
  ctx.rotate(-Math.PI / 2);
17
18
  }
18
19
  ctx.drawImage(img, 0, 0);
19
- canvas.toBlob((b) => (b ? resolve(b) : reject(new Error("toBlob failed"))), "image/jpeg", 0.92);
20
+ canvasToIntermediateBlob(canvas).then(resolve, reject);
20
21
  };
21
22
  img.onerror = () => reject(new Error("Failed to load image"));
22
23
  img.src = imageUrl;
@@ -10,11 +10,11 @@ const subtle = { color: "var(--ds-color-neutral-text-subtle)" };
10
10
  */
11
11
  export function MergeProgressDialogDs(props) {
12
12
  let { phase, pct, remaining, title, canClose, handleClose } = useMergeJob(props);
13
- return (_jsxs(ResponsiveDialog, { open: props.open, onClose: handleClose, closedby: canClose ? "any" : "none", closeButton: canClose ? undefined : false, title: title, maxWidth: "sm", children: [_jsxs(Dialog.Block, { children: [(phase.kind === "preparing" || phase.kind === "processing") && (_jsx(LinearProgress, { value: phase.kind === "processing" && phase.total > 0 ? pct : undefined, style: { marginBottom: "0.75rem" } })), phase.kind === "preparing" && (_jsx(Paragraph, { "data-size": "sm", style: subtle, children: getLocalizedString("Starting merge job…") })), phase.kind === "processing" && (_jsxs(_Fragment, { children: [_jsxs(Paragraph, { "data-size": "sm", children: [phase.completed, " / ", phase.total, " ", getLocalizedString("files"), remaining && _jsxs("span", { style: subtle, children: [" \u2014 ", remaining] })] }), phase.currentFile && (_jsx(Paragraph, { "data-size": "sm", title: phase.currentFile, style: {
13
+ return (_jsxs(ResponsiveDialog, { open: props.open, onClose: handleClose, closedby: canClose ? "any" : "none", closeButton: canClose ? undefined : false, title: title, maxWidth: "sm", children: [_jsxs(Dialog.Block, { children: [(phase.kind === "preparing" || phase.kind === "processing") && (_jsx(LinearProgress, { value: phase.kind === "processing" && phase.total > 0 ? pct : undefined, style: { marginBottom: "var(--ds-size-3)" } })), phase.kind === "preparing" && (_jsx(Paragraph, { "data-size": "sm", style: subtle, children: getLocalizedString("Starting merge job…") })), phase.kind === "processing" && (_jsxs(_Fragment, { children: [_jsxs(Paragraph, { "data-size": "sm", children: [phase.completed, " / ", phase.total, " ", getLocalizedString("files"), remaining && _jsxs("span", { style: subtle, children: [" \u2014 ", remaining] })] }), phase.currentFile && (_jsx(Paragraph, { "data-size": "sm", title: phase.currentFile, style: {
14
14
  ...subtle,
15
- marginTop: "0.25rem",
15
+ marginTop: "var(--ds-size-1)",
16
16
  overflow: "hidden",
17
17
  textOverflow: "ellipsis",
18
18
  whiteSpace: "nowrap",
19
- }, children: phase.currentFile }))] })), phase.kind === "completed" && (_jsxs(_Fragment, { children: [_jsx(Paragraph, { "data-size": "sm", style: { color: "var(--ds-color-success-text-default)" }, children: getLocalizedString("Download started. You can close this dialog.") }), _jsxs(Paragraph, { "data-size": "sm", style: { ...subtle, marginTop: "0.5rem" }, children: [getLocalizedString("If the file did not open automatically, "), " ", _jsx(Link, { href: `/api/ob/merger/download/${phase.jobId}`, target: "_blank", rel: "noopener noreferrer", children: getLocalizedString("click here to open it") }), "."] })] })), phase.kind === "failed" && (_jsx(Paragraph, { "data-size": "sm", style: { color: "var(--ds-color-danger-text-default)" }, children: phase.error }))] }), _jsx(Dialog.Block, { style: { display: "flex", justifyContent: "flex-end" }, children: _jsx(Button, { variant: "tertiary", onClick: handleClose, disabled: !canClose, children: getLocalizedString("Close") }) })] }));
19
+ }, children: phase.currentFile }))] })), phase.kind === "completed" && (_jsxs(_Fragment, { children: [_jsx(Paragraph, { "data-size": "sm", style: { color: "var(--ds-color-success-text-default)" }, children: getLocalizedString("Download started. You can close this dialog.") }), _jsxs(Paragraph, { "data-size": "sm", style: { ...subtle, marginTop: "var(--ds-size-2)" }, children: [getLocalizedString("If the file did not open automatically, "), " ", _jsx(Link, { href: `/api/ob/merger/download/${phase.jobId}`, target: "_blank", rel: "noopener noreferrer", children: getLocalizedString("click here to open it") }), "."] })] })), phase.kind === "failed" && (_jsx(Paragraph, { "data-size": "sm", style: { color: "var(--ds-color-danger-text-default)" }, children: phase.error }))] }), _jsx(Dialog.Block, { style: { display: "flex", justifyContent: "flex-end" }, children: _jsx(Button, { variant: "tertiary", onClick: handleClose, disabled: !canClose, children: getLocalizedString("Close") }) })] }));
20
20
  }
@@ -1 +1 @@
1
- .ObPageBanner-root{background-color:hsl(186,72%,24%);background-color:var(--brand-dark);box-shadow:0px 8px 8px rgba(0,0,0,.2);color:#fff}.ObPageBanner-root a{color:hsl(200,50%,80%)}.ObPageBanner-inner{display:flex;align-items:center;flex-direction:column}@media screen and (min-width: 768px){.ObPageBanner-inner{align-items:flex-start;flex-direction:row}}.ObPageBanner-plantTitle{font-size:2rem}@media screen and (min-width: 992px){.ObPageBanner-plantTitle{font-size:3rem}}.ObPageBanner-bannerImage{align-self:stretch;background-color:#ddd;display:inline-block;height:20vh;object-fit:cover;object-position:center center;width:100%}@media screen and (min-width: 576px){.ObPageBanner-bannerImage{align-self:center;margin:0;margin-right:1rem;border:.4rem solid #fff;border-radius:50%;height:150px;width:150px}}@media screen and (min-width: 992px){.ObPageBanner-bannerImage{height:250px;width:250px}}.ObPageBanner-bannerTitle{margin-bottom:1rem;margin-top:1rem;font-size:2rem}@media screen and (min-width: 768px){.ObPageBanner-bannerTitle{margin-top:0}}@media screen and (min-width: 992px){.ObPageBanner-bannerTitle{font-size:3rem}}.ObPageBanner-tabList.sticky{position:-webkit-sticky;position:sticky;top:0;z-index:1000}.ObPageBanner-tabListInner{overflow-x:auto;scrollbar-width:thin;white-space:nowrap}.ObPageBanner-tab{border-bottom:.25rem solid rgba(0,0,0,0);display:inline-block;margin-top:.5rem;min-width:8rem;padding:.5rem 1rem;text-align:center;text-transform:capitalize}.ObPageBanner-tab.active{border-color:#fff}
1
+ .ObPageBanner-root{background-color:hsl(186,72%,24%);background-color:var(--brand-dark);box-shadow:0px 8px 8px rgba(0,0,0,.2);color:#fff}.ObPageBanner-root a{color:hsl(200,50%,80%)}.ObPageBanner-inner{display:flex;align-items:center;flex-direction:column}@media screen and (min-width: 768px){.ObPageBanner-inner{align-items:flex-start;flex-direction:row}}.ObPageBanner-plantTitle{font-size:var(--ds-font-size-7, 2rem)}@media screen and (min-width: 992px){.ObPageBanner-plantTitle{font-size:var(--ds-font-size-9, 3rem)}}.ObPageBanner-bannerImage{align-self:stretch;background-color:#ddd;display:inline-block;height:20vh;object-fit:cover;object-position:center center;width:100%}@media screen and (min-width: 576px){.ObPageBanner-bannerImage{align-self:center;margin:0;margin-right:var(--ds-size-4, 1rem);border:.4rem solid #fff;border-radius:50%;height:150px;width:150px}}@media screen and (min-width: 992px){.ObPageBanner-bannerImage{height:250px;width:250px}}.ObPageBanner-bannerTitle{margin-bottom:var(--ds-size-4, 1rem);margin-top:var(--ds-size-4, 1rem);font-size:var(--ds-font-size-7, 2rem)}@media screen and (min-width: 768px){.ObPageBanner-bannerTitle{margin-top:0}}@media screen and (min-width: 992px){.ObPageBanner-bannerTitle{font-size:var(--ds-font-size-9, 3rem)}}.ObPageBanner-tabList.sticky{position:-webkit-sticky;position:sticky;top:0;z-index:1000}.ObPageBanner-tabListInner{overflow-x:auto;scrollbar-width:thin;white-space:nowrap}.ObPageBanner-tab{border-bottom:.25rem solid rgba(0,0,0,0);display:inline-block;margin-top:var(--ds-size-2, 0.5rem);min-width:calc(var(--ds-size-8, 2rem)*4);padding:var(--ds-size-2, 0.5rem) var(--ds-size-4, 1rem);text-align:center;text-transform:capitalize}.ObPageBanner-tab.active{border-color:#fff}
@@ -123,5 +123,5 @@ export function PdfViewer({ url, file }) {
123
123
  catch {
124
124
  // Ignore, fallback to fit-to-width when unknown
125
125
  }
126
- } }, pageNumber))) }) }), error && _jsxs("div", { style: { color: "#b00020", padding: 8 }, children: ["Error loading PDF: ", error] })] }));
126
+ } }, pageNumber))) }) }), error && _jsxs("div", { style: { color: "#b00020", padding: "var(--ds-size-2, 8px)" }, children: ["Error loading PDF: ", error] })] }));
127
127
  }
@@ -29,7 +29,7 @@
29
29
  border-radius: 50%;
30
30
  height: var(--bullet-size);
31
31
  position: absolute;
32
- top: 0.2rem;
32
+ top: calc(var(--bullet-size) * 0.4);
33
33
  width: var(--bullet-size);
34
34
 
35
35
  &:nth-child(1) {
@@ -1 +1 @@
1
- .😖{display:initial}.ObSplitContainer-root{display:flex;flex-direction:column;height:100%;width:100%}.ObSplitContainer-root.horizontal{flex-direction:row}.ObSplitContainer-panel{overflow:hidden}.ObSplitContainer-divider{flex:0 0 .5rem;background-color:rgba(0,0,0,0);line-height:.75;cursor:ns-resize;display:flex;align-items:center;justify-content:center}.ObSplitContainer-divider:focus{background-color:rgba(0,0,0,.3)}.ObSplitContainer-root.horizontal>.ObSplitContainer-divider{cursor:ew-resize;writing-mode:vertical-lr}.ObSplitContainer-panel.dragging{pointer-events:none}
1
+ .😖{display:initial}.ObSplitContainer-root{display:flex;flex-direction:column;height:100%;width:100%}.ObSplitContainer-root.horizontal{flex-direction:row}.ObSplitContainer-panel{overflow:hidden}.ObSplitContainer-divider{flex:0 0 var(--ds-size-2, 0.5rem);background-color:rgba(0,0,0,0);color:var(--ds-color-neutral-text-subtle, currentColor);font-size:var(--ds-font-size-2, 0.875rem);line-height:.75;cursor:ns-resize;display:flex;align-items:center;justify-content:center}.ObSplitContainer-divider:focus{background-color:rgba(0,0,0,.3)}.ObSplitContainer-root.horizontal>.ObSplitContainer-divider{cursor:ew-resize;writing-mode:vertical-lr}.ObSplitContainer-panel.dragging{pointer-events:none}
@@ -17,12 +17,12 @@
17
17
  }
18
18
 
19
19
  .ObValueToggleGroup {
20
- padding: 0.25rem;
20
+ padding: var(--ds-size-1, 0.25rem);
21
21
  border: 2px solid rgb(0 0 0 / 0.2);
22
22
  border-radius: 4px;
23
23
 
24
24
  display: flex;
25
- gap: 0.25rem;
25
+ gap: var(--ds-size-1, 0.25rem);
26
26
  flex-wrap: wrap;
27
27
 
28
28
  &.vertical {
@@ -24,18 +24,18 @@
24
24
  display: flex;
25
25
  align-items: center;
26
26
  justify-content: space-between;
27
- padding: 0.5rem 1.5rem;
27
+ padding: var(--ds-size-2, 0.5rem) var(--ds-size-6, 1.5rem);
28
28
  color: white;
29
29
  }
30
30
 
31
31
  .ob-barcode-scanner__actions {
32
32
  display: flex;
33
33
  align-items: center;
34
- gap: 0.5rem;
34
+ gap: var(--ds-size-2, 0.5rem);
35
35
  }
36
36
 
37
37
  .ob-barcode-scanner__engine {
38
- font-size: 0.75rem;
38
+ font-size: var(--ds-font-size-1, 0.75rem);
39
39
  opacity: 0.7;
40
40
  }
41
41
 
@@ -43,12 +43,12 @@
43
43
  display: inline-flex;
44
44
  align-items: center;
45
45
  justify-content: center;
46
- padding: 0.75rem;
46
+ padding: var(--ds-size-3, 0.75rem);
47
47
  border: 0;
48
48
  border-radius: 50%;
49
49
  background: transparent;
50
50
  color: inherit;
51
- font-size: 1.75rem;
51
+ font-size: var(--ds-font-size-7, 1.75rem);
52
52
  cursor: pointer;
53
53
  }
54
54
 
@@ -75,7 +75,7 @@
75
75
  }
76
76
 
77
77
  .ob-barcode-scanner__error-icon {
78
- margin: 1rem 0;
78
+ margin: var(--ds-size-4, 1rem) 0;
79
79
  color: #eee;
80
- font-size: 3.5rem;
80
+ font-size: var(--ds-font-size-10, 3.5rem);
81
81
  }
@@ -78,7 +78,7 @@ export function ElementLookupDialog(props) {
78
78
  alert(error.message);
79
79
  }
80
80
  }
81
- return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, closeButton: false, children: [_jsxs(Dialog.Block, { className: "ObElementsLookupDialog-body", children: [_jsx(Tabs, { value: currentTab, onChange: (value) => setTab(value), className: "ObElementsLookupDialog-tabs", children: _jsxs(Tabs.List, { children: [props.mode !== "search" && (_jsxs(Tabs.Tab, { value: "manual", children: [_jsx(PencilIcon, { "aria-hidden": true }), getLocalizedString("Manual")] })), _jsxs(Tabs.Tab, { value: "scanner", children: [_jsx(MobileIcon, { "aria-hidden": true }), getLocalizedString("Scanner")] }), _jsxs(Tabs.Tab, { value: "camera", children: [_jsx(QrCodeScanningIcon, { "aria-hidden": true }), getLocalizedString("Camera")] })] }) }), currentTab === "camera" && (_jsx("div", { className: "ObElementsLookupDialog-source", children: _jsx(BarcodeScanner, { decoder: decoder, actions: scannerActions, onRead: (element) => handleElementAdd(element, "camera-barcode") }) })), currentTab === "manual" && (_jsx("div", { className: "ObElementsLookupDialog-manual", children: _jsx(AddElementManualForm, { mode: props.mode === "multi" ? "multi" : "single", onAdd: (element) => handleElementAdd(element, "manual"), allowEmptyElement: props.allowEmptyElement }) })), currentTab === "scanner" && (_jsx("div", { className: "ObElementsLookupDialog-source", children: _jsx(AddElementHIDScanner, { onScan: (element) => handleElementAdd(element, element.startsWith(Giai.BARCODE_PREFIX) ? "hid-barcode" : "hid-rfid") }) })), _jsxs("div", { className: "ObElementsLookupDialog-list", children: [props.mode === "multi" && (_jsx(Alert, { "data-color": "info", "data-size": "sm", children: localize `${elements.length} elements selected` })), _jsx(ItemList, { children: elements.map(({ element }) => (_jsxs(ItemList.Item, { className: "ObElementsLookupDialog-item", "data-recent": recent === element.ElementID || undefined, children: [_jsx(ItemList.ItemText, { primary: element.DisplayName || element.ProjectName, secondary: element.ElementID || element.ProjectID }), _jsx(Button, { "data-color": "danger", variant: "tertiary", icon: true, "aria-label": getLocalizedString("Remove"), onClick: () => {
81
+ return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, closeButton: false, children: [_jsxs(Dialog.Block, { className: "ObElementsLookupDialog-body", children: [_jsx(Tabs, { value: currentTab, onChange: (value) => setTab(value), className: "ObElementsLookupDialog-tabs", children: _jsxs(Tabs.List, { children: [props.mode !== "search" && (_jsxs(Tabs.Tab, { value: "manual", children: [_jsx(PencilIcon, { "aria-hidden": true }), getLocalizedString("Manual")] })), _jsxs(Tabs.Tab, { value: "scanner", children: [_jsx(MobileIcon, { "aria-hidden": true }), getLocalizedString("Scanner")] }), _jsxs(Tabs.Tab, { value: "camera", children: [_jsx(QrCodeScanningIcon, { "aria-hidden": true }), getLocalizedString("Camera")] })] }) }), currentTab === "camera" && (_jsx("div", { className: "ObElementsLookupDialog-source", children: _jsx(BarcodeScanner, { decoder: decoder, actions: scannerActions, onRead: (element) => handleElementAdd(element, "camera-barcode") }) })), currentTab === "manual" && (_jsx("div", { className: "ObElementsLookupDialog-manual", children: _jsx(AddElementManualForm, { mode: props.mode === "multi" ? "multi" : "single", onAdd: (element) => handleElementAdd(element, "manual"), allowEmptyElement: props.allowEmptyElement }) })), currentTab === "scanner" && (_jsx("div", { className: "ObElementsLookupDialog-source", children: _jsx(AddElementHIDScanner, { onScan: (element) => handleElementAdd(element, element.startsWith(Giai.BARCODE_PREFIX) ? "hid-barcode" : "hid-rfid") }) })), _jsxs("div", { className: "ObElementsLookupDialog-list", children: [props.mode === "multi" && _jsx(Alert, { "data-color": "info", children: localize `${elements.length} elements selected` }), _jsx(ItemList, { children: elements.map(({ element }) => (_jsxs(ItemList.Item, { className: "ObElementsLookupDialog-item", "data-recent": recent === element.ElementID || undefined, children: [_jsx(ItemList.ItemText, { primary: element.DisplayName || element.ProjectName, secondary: element.ElementID || element.ProjectID }), _jsx(Button, { "data-color": "danger", variant: "tertiary", icon: true, "aria-label": getLocalizedString("Remove"), onClick: () => {
82
82
  setElements((current) => props.mode === "multi" ? current.filter((e) => e.element.ElementID !== element.ElementID) : []);
83
83
  }, children: _jsx(TrashIcon, { "aria-hidden": true }) })] }, element.ElementID || element.ProjectID))) })] })] }), _jsxs(Dialog.Block, { className: "ObElementsLookupDialog-actions", children: [_jsx(Button, { variant: "tertiary", onClick: onClose, children: getLocalizedString("Cancel") }), _jsxs(Button, { variant: "primary", loading: adding, disabled: !elements.length, onClick: handleConfirm, children: [!adding && _jsx(PlusIcon, { "aria-hidden": true }), props.mode === "search" ? getLocalizedString("Search for element") : getLocalizedString("Add element")] })] })] }));
84
84
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The attachments of an issue that is still being written. They are uploaded at once, to the
3
+ * user's temp files, and the report moves them onto the issue. Files left there from a report that
4
+ * was never sent show up again the next time.
5
+ */
6
+ export declare function ReportIssueAttachments(): import("react").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Alert, Button, Heading, Paragraph } from "@digdir/designsystemet-react";
3
+ import { FileIcon, TrashIcon, UploadIcon } from "@navikt/aksel-icons";
4
+ import { useData, useDragAndDropUpload, useFilter } from "@olenbetong/appframe-react";
5
+ import clsx from "clsx";
6
+ import { useRef, useState } from "react";
7
+ import { getLocalizedString } from "../i18n.js";
8
+ import { dsReportIssueFiles } from "./data/dsReportIssueFiles.js";
9
+ const IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "svg", "webp", "avif"];
10
+ function isImage(file) {
11
+ let extension = (file.Extension ?? file.FileName?.split(".").pop() ?? "").replace(/^\./, "").toLowerCase();
12
+ return IMAGE_EXTENSIONS.includes(extension);
13
+ }
14
+ /**
15
+ * File upload is broken in the old Synergi iOS app's webview, which Apple will not let us replace,
16
+ * so the form says to open the site in Safari instead.
17
+ */
18
+ function isIosWebview() {
19
+ return /(iPad|iPhone)/.test(navigator.userAgent) && !navigator.userAgent.includes("Safari");
20
+ }
21
+ function WebViewWarning() {
22
+ return (_jsxs(Paragraph, { "data-size": "sm", children: [getLocalizedString("File upload is unfortunately broken in the Synergi iOS application, and Apple's policies prevent us from publishing a new version to fix it."), " ", getLocalizedString("To upload attachments, please open"), " ", _jsx("a", { href: "https://synergi.olenbetong.no", target: "_blank", rel: "noopener noreferrer", children: "s.obet.no" }), " ", getLocalizedString("in Safari instead"), ".", " ", getLocalizedString("You can also add the website to your home screen using the share dialog in Safari for easy access.")] }));
23
+ }
24
+ /**
25
+ * The attachments of an issue that is still being written. They are uploaded at once, to the
26
+ * user's temp files, and the report moves them onto the issue. Files left there from a report that
27
+ * was never sent show up again the next time.
28
+ */
29
+ export function ReportIssueAttachments() {
30
+ let files = useData(dsReportIssueFiles);
31
+ let { dragProps, dragOver, removeStatus, status, upload } = useDragAndDropUpload({
32
+ dataObject: dsReportIssueFiles,
33
+ });
34
+ let inputRef = useRef(null);
35
+ let [webview] = useState(isIosWebview);
36
+ useFilter(dsReportIssueFiles, `[CreatedBy] = '${af.userSession.login.replace(/'/g, "''")}'`, "whereClause");
37
+ let uploading = status.filter((item) => !item.error && !item.complete);
38
+ let failed = status.filter((item) => item.error);
39
+ return (_jsxs("section", { className: "ObReportIssue-attachments", "aria-labelledby": "ObReportIssue-attachments-heading", children: [_jsx(Heading, { level: 2, "data-size": "xs", id: "ObReportIssue-attachments-heading", children: getLocalizedString("Attachments") }), webview ? (_jsx(WebViewWarning, {})) : (_jsxs("div", { className: clsx("ObReportIssue-dropzone", dragOver && "ObReportIssue-dropzone--over"), ...dragProps, children: [files.length > 0 && (_jsx("ul", { className: "ObReportIssue-files", children: files.map((file, index) => (_jsxs("li", { className: "ObReportIssue-file", children: [_jsx("div", { className: "ObReportIssue-thumbnail", children: isImage(file) ? (_jsx("img", { src: dsReportIssueFiles.getFileStoreURL(file), alt: "" })) : (_jsx(FileIcon, { "aria-hidden": true })) }), _jsx("span", { className: "ObReportIssue-fileName", children: file.FileName }), _jsx(Button, { variant: "tertiary", "data-size": "sm", icon: true, "aria-label": `${getLocalizedString("Delete")} ${file.FileName ?? ""}`, onClick: () => dsReportIssueFiles.deleteRow(index), children: _jsx(TrashIcon, { "aria-hidden": true }) })] }, file.PrimKey))) })), _jsxs("div", { className: "ObReportIssue-uploadActions", children: [_jsxs(Button, { variant: "secondary", onClick: () => inputRef.current?.click(), children: [_jsx(UploadIcon, { "aria-hidden": true }), getLocalizedString("Upload File")] }), _jsx("span", { className: "ObReportIssue-dropHint", children: getLocalizedString("or drag and drop from your computer") })] }), _jsx("input", { tabIndex: -1, type: "file", multiple: true, className: "ObReportIssue-fileInput", ref: inputRef, onChange: (event) => {
40
+ let selected = event.currentTarget.files;
41
+ if (selected && selected.length > 0)
42
+ upload(Array.from(selected));
43
+ event.currentTarget.value = "";
44
+ } })] })), uploading.map((item) => (_jsxs("div", { className: "ObReportIssue-progress", children: [_jsx("span", { children: item.name }), _jsx("progress", { max: item.progress.total, value: item.progress.loaded })] }, item.index))), failed.map((item) => (_jsxs(Alert, { "data-color": "danger", "data-size": "sm", className: "ObReportIssue-uploadError", children: [_jsxs("span", { children: [getLocalizedString("Failed to upload"), " ", `'${item.name}'`, ": ", item.error] }), _jsx(Button, { variant: "tertiary", "data-size": "sm", onClick: () => removeStatus(item.index), children: getLocalizedString("Close") })] }, item.index)))] }));
45
+ }
@@ -0,0 +1,133 @@
1
+ .ObReportIssue {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: var(--ds-size-6, 1.5rem);
5
+ }
6
+
7
+ .ObReportIssue-checklist {
8
+ margin: var(--ds-size-2, 0.5rem) 0 0;
9
+ padding-inline-start: 1.5rem;
10
+ }
11
+
12
+ .ObReportIssue-actions {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ gap: var(--ds-size-2, 0.5rem);
16
+ }
17
+
18
+ .ObReportIssue-submit {
19
+ flex-grow: 1;
20
+ }
21
+
22
+ .ObReportIssue-attachments {
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: var(--ds-size-3, 0.75rem);
26
+ }
27
+
28
+ .ObReportIssue-dropzone {
29
+ border-radius: var(--ds-border-radius-md, 0.25rem);
30
+ outline: 0 dashed var(--ds-color-neutral-border-default, rgba(0, 0, 0, 0.24));
31
+ outline-offset: 0.25rem;
32
+ transition: outline-width 50ms ease-out;
33
+ }
34
+
35
+ .ObReportIssue-dropzone--over {
36
+ outline-width: 0.125rem;
37
+ background-color: var(--ds-color-accent-surface-tinted);
38
+ }
39
+
40
+ .ObReportIssue-files {
41
+ display: grid;
42
+ grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
43
+ gap: var(--ds-size-3, 0.75rem);
44
+ margin: 0 0 var(--ds-size-3, 0.75rem);
45
+ padding: 0;
46
+ list-style: none;
47
+ }
48
+
49
+ .ObReportIssue-file {
50
+ display: grid;
51
+ grid-template-columns: 1fr auto;
52
+ align-items: center;
53
+ gap: var(--ds-size-1, 0.25rem);
54
+ }
55
+
56
+ .ObReportIssue-thumbnail {
57
+ grid-column: 1 / -1;
58
+ display: grid;
59
+ place-items: center;
60
+ height: 6rem;
61
+ border-radius: var(--ds-border-radius-md, 0.25rem);
62
+ background-color: var(--ds-color-neutral-background-tinted);
63
+ overflow: hidden;
64
+
65
+ img {
66
+ width: 100%;
67
+ height: 100%;
68
+ object-fit: cover;
69
+ }
70
+
71
+ svg {
72
+ width: 2.5rem;
73
+ height: 2.5rem;
74
+ }
75
+ }
76
+
77
+ .ObReportIssue-fileName {
78
+ overflow: hidden;
79
+ text-overflow: ellipsis;
80
+ white-space: nowrap;
81
+ font-size: var(--ds-font-size-2, 0.875rem);
82
+ }
83
+
84
+ .ObReportIssue-uploadActions {
85
+ display: flex;
86
+ flex-wrap: wrap;
87
+ align-items: center;
88
+ gap: var(--ds-size-3, 0.75rem);
89
+ }
90
+
91
+ .ObReportIssue-dropHint {
92
+ color: var(--ds-color-neutral-text-subtle);
93
+ font-size: var(--ds-font-size-2, 0.875rem);
94
+ }
95
+
96
+ /* Touch devices have nothing to drag files from. */
97
+ @media (pointer: coarse) {
98
+ .ObReportIssue-dropHint {
99
+ display: none;
100
+ }
101
+ }
102
+
103
+ .ObReportIssue-fileInput {
104
+ position: absolute;
105
+ width: 1px;
106
+ height: 1px;
107
+ padding: 0;
108
+ margin: -1px;
109
+ overflow: hidden;
110
+ clip: rect(0, 0, 0, 0);
111
+ white-space: nowrap;
112
+ border: 0;
113
+ }
114
+
115
+ .ObReportIssue-progress {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: space-between;
119
+ gap: var(--ds-size-4, 1rem);
120
+ font-size: var(--ds-font-size-2, 0.875rem);
121
+
122
+ progress {
123
+ flex-basis: 25%;
124
+ accent-color: var(--ds-color-accent-base-default);
125
+ }
126
+ }
127
+
128
+ .ObReportIssue-uploadError {
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: space-between;
132
+ gap: var(--ds-size-2, 0.5rem);
133
+ }
@@ -0,0 +1,18 @@
1
+ import "./ReportIssueForm.css";
2
+ export type ReportIssueType = "Issue" | "Suggestion";
3
+ export type ReportIssueFormProps = {
4
+ /** The type chosen when the form opens. The user can change it. Defaults to `Issue`. */
5
+ defaultType?: ReportIssueType;
6
+ /** Called with the new issue's number once it has been reported. */
7
+ onCreated: (issueId: number) => void;
8
+ /** Shows a Cancel button beside Send, for a form in a dialog. */
9
+ onCancel?: () => void;
10
+ className?: string;
11
+ };
12
+ /**
13
+ * The form for reporting an issue or a suggestion to Improve: the type, what happened, the area it
14
+ * belongs to and any attachments. It is the report-issue app's page, and the issue tracker opens it
15
+ * in a dialog. The form creates the issue itself and hands its number to `onCreated`; where to go
16
+ * from there is up to the app.
17
+ */
18
+ export declare function ReportIssueForm({ defaultType, onCreated, onCancel, className }: ReportIssueFormProps): import("react").JSX.Element;
@@ -0,0 +1,71 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./ReportIssueForm.css";
3
+ import { Alert, Button, Divider, Field, Fieldset, Heading, Label, Radio, Select, Textfield, } from "@digdir/designsystemet-react";
4
+ import { logError, startActivity } from "@olenbetong/appframe-core";
5
+ import { useData, useLoading } from "@olenbetong/appframe-react";
6
+ import clsx from "clsx";
7
+ import { useEffect, useId, useState } from "react";
8
+ import { getLocalizedString } from "../i18n.js";
9
+ import { dsReportIssueAreas } from "./data/dsReportIssueAreas.js";
10
+ import { procReportIssue } from "./data/procReportIssue.js";
11
+ import { ReportIssueAttachments } from "./ReportIssueAttachments.js";
12
+ /** Today at 08:00, as a `datetime-local` value: most incidents are reported the same day. */
13
+ function defaultIncidentDate() {
14
+ let now = new Date();
15
+ let pad = (value) => String(value).padStart(2, "0");
16
+ return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}T08:00`;
17
+ }
18
+ /**
19
+ * The form for reporting an issue or a suggestion to Improve: the type, what happened, the area it
20
+ * belongs to and any attachments. It is the report-issue app's page, and the issue tracker opens it
21
+ * in a dialog. The form creates the issue itself and hands its number to `onCreated`; where to go
22
+ * from there is up to the app.
23
+ */
24
+ export function ReportIssueForm({ defaultType = "Issue", onCreated, onCancel, className }) {
25
+ let areas = useData(dsReportIssueAreas);
26
+ let areasLoading = useLoading(dsReportIssueAreas);
27
+ let [issueType, setIssueType] = useState(defaultType);
28
+ let [incidentDate, setIncidentDate] = useState(defaultIncidentDate);
29
+ let [description, setDescription] = useState("");
30
+ let [cause, setCause] = useState("");
31
+ let [area, setArea] = useState("");
32
+ let [sending, setSending] = useState(false);
33
+ let [error, setError] = useState(null);
34
+ let areaId = useId();
35
+ useEffect(() => {
36
+ if (!dsReportIssueAreas.isDataLoaded())
37
+ dsReportIssueAreas.refreshDataSource();
38
+ }, []);
39
+ let isIssue = issueType === "Issue";
40
+ async function submit(event) {
41
+ event.preventDefault();
42
+ if (sending)
43
+ return;
44
+ let logActivity = startActivity("ReportIssue");
45
+ try {
46
+ setSending(true);
47
+ setError(null);
48
+ let result = await procReportIssue.execute({
49
+ IssueType: issueType,
50
+ Area: area,
51
+ Description: description,
52
+ IncidentDate: isIssue ? incidentDate : null,
53
+ CauseAnalysis: isIssue && cause.trim() ? cause : null,
54
+ SubmitFiles: true,
55
+ });
56
+ let issueId = result.Table?.[0]?.IssueID;
57
+ if (!issueId)
58
+ throw new Error(getLocalizedString("The issue was not created. Please try again."));
59
+ logActivity({ Area: area, IssueID: issueId });
60
+ onCreated(issueId);
61
+ }
62
+ catch (reason) {
63
+ logError(reason);
64
+ setError(reason instanceof Error ? reason.message : String(reason));
65
+ }
66
+ finally {
67
+ setSending(false);
68
+ }
69
+ }
70
+ return (_jsxs("form", { className: clsx("ObReportIssue", className), "aria-label": getLocalizedString("Report Issue"), onSubmit: submit, children: [_jsxs(Fieldset, { children: [_jsx(Fieldset.Legend, { children: _jsx(Heading, { level: 2, "data-size": "xs", children: getLocalizedString("Issue type") }) }), _jsx(Radio, { name: "IssueType", value: "Issue", checked: isIssue, onChange: () => setIssueType("Issue"), label: getLocalizedString("Report a non-conformity or RUH"), description: getLocalizedString("If something has happened that we should document and learn from, please tell us.") }), _jsx(Radio, { name: "IssueType", value: "Suggestion", checked: !isIssue, onChange: () => setIssueType("Suggestion"), label: getLocalizedString("Make a suggestion"), description: getLocalizedString("Make a suggestion and contribute to Ølen Betong’s best practices. It could be something new or something you think should be done differently.") })] }), isIssue && (_jsxs(_Fragment, { children: [_jsxs("div", { children: [_jsxs(Heading, { level: 2, "data-size": "xs", children: [getLocalizedString("Remember to enter the following"), ":"] }), _jsxs("ul", { className: "ObReportIssue-checklist", children: [_jsx("li", { children: getLocalizedString("Where the event occured, and if there are any witnesses") }), _jsx("li", { children: getLocalizedString("Write in a few words - Your observation") }), _jsx("li", { children: getLocalizedString("Why did it happen?") }), _jsx("li", { children: getLocalizedString("Immediate measures performed") }), _jsx("li", { children: getLocalizedString("If possible - recommend measures") })] })] }), _jsx(Textfield, { type: "datetime-local", required: true, name: "IncidentDate", value: incidentDate, onChange: (event) => setIncidentDate(event.target.value), label: getLocalizedString("Incident date and time") })] })), _jsx(Textfield, { required: true, multiline: true, rows: 6, name: "Description", value: description, onChange: (event) => setDescription(event.target.value), label: getLocalizedString("Description") }), isIssue && (_jsx(Textfield, { multiline: true, rows: 3, name: "CauseAnalysis", value: cause, onChange: (event) => setCause(event.target.value), label: getLocalizedString("Cause - Describe why the incident occurred"), description: getLocalizedString("Try to find the root cause of the incident. Why did it happen? What were the contributing factors? This will help us find good measures to prevent similar incidents in the future. If the cause is unknown, leave the field blank.") })), _jsxs(Field, { children: [_jsxs(Label, { htmlFor: areaId, children: [getLocalizedString("Area"), " / ", getLocalizedString("Department")] }), _jsxs(Select, { id: areaId, name: "Area", required: true, value: area, onChange: (event) => setArea(event.target.value), children: [_jsx(Select.Option, { value: "", children: areasLoading ? getLocalizedString("Loading...") : "" }), areas.map((row) => (_jsx(Select.Option, { value: row.Area, children: row.Area }, row.Area)))] })] }), _jsx(Divider, {}), _jsx(ReportIssueAttachments, {}), _jsx(Divider, {}), error && (_jsx(Alert, { "data-color": "danger", "data-size": "sm", role: "alert", children: error })), _jsxs("div", { className: "ObReportIssue-actions", children: [_jsx(Button, { type: "submit", loading: sending, className: "ObReportIssue-submit", children: isIssue ? getLocalizedString("Send issue") : getLocalizedString("Send suggestion") }), onCancel && (_jsx(Button, { type: "button", variant: "secondary", onClick: onCancel, disabled: sending, children: getLocalizedString("Cancel") }))] })] }));
71
+ }
@@ -0,0 +1,8 @@
1
+ export type ReportIssueAreasRecord = {
2
+ Area: string;
3
+ Responsible: string;
4
+ SortOrder: string | null;
5
+ CompanySort: number;
6
+ };
7
+ /** The areas an issue can be reported to: the user's areas that are not archived. */
8
+ export declare const dsReportIssueAreas: import("@olenbetong/appframe-data").DataObject<ReportIssueAreasRecord>;
@@ -0,0 +1,37 @@
1
+ import { generateApiDataObject, SortOrder } from "@olenbetong/appframe-data";
2
+ /** The areas an issue can be reported to: the user's areas that are not archived. */
3
+ export const dsReportIssueAreas = generateApiDataObject({
4
+ resource: "aviw_Improve_MyAreas",
5
+ id: "dsReportIssueAreas",
6
+ allowUpdate: false,
7
+ allowInsert: false,
8
+ allowDelete: false,
9
+ dynamicLoading: false,
10
+ fields: [
11
+ {
12
+ name: "Area",
13
+ type: "string",
14
+ nullable: false,
15
+ },
16
+ {
17
+ name: "Responsible",
18
+ type: "string",
19
+ nullable: false,
20
+ },
21
+ {
22
+ name: "SortOrder",
23
+ type: "string",
24
+ nullable: true,
25
+ },
26
+ {
27
+ name: "CompanySort",
28
+ type: "number",
29
+ nullable: false,
30
+ },
31
+ ],
32
+ parameters: {
33
+ maxRecords: -1,
34
+ whereClause: "[Archived] IS NULL",
35
+ sortOrder: [{ CompanySort: SortOrder.Asc }, { SortOrder: SortOrder.Asc }, { Area: SortOrder.Asc }],
36
+ },
37
+ });
@@ -0,0 +1,15 @@
1
+ export type ReportIssueFilesRecord = {
2
+ PrimKey: string;
3
+ Created: Date;
4
+ CreatedBy: string;
5
+ FileName: string | null;
6
+ FileSize: number | null;
7
+ FileRef: string | null;
8
+ Extension: string | null;
9
+ };
10
+ /**
11
+ * Attachments uploaded before the issue exists. They wait in a temp table, one set per user, until
12
+ * the issue is reported, and the report moves them onto the new issue. The form filters this on
13
+ * the user's login: users with access to the table see everyone's.
14
+ */
15
+ export declare const dsReportIssueFiles: import("@olenbetong/appframe-data").DataObject<ReportIssueFilesRecord>;
@@ -0,0 +1,55 @@
1
+ import { generateApiDataObject } from "@olenbetong/appframe-data";
2
+ /**
3
+ * Attachments uploaded before the issue exists. They wait in a temp table, one set per user, until
4
+ * the issue is reported, and the report moves them onto the new issue. The form filters this on
5
+ * the user's login: users with access to the table see everyone's.
6
+ */
7
+ export const dsReportIssueFiles = generateApiDataObject({
8
+ resource: "atbv_Improve_IssuesFiles_Temp",
9
+ uniqueName: "atbv_Improve_IssuesFiles_Temp",
10
+ id: "dsReportIssueFiles",
11
+ allowUpdate: false,
12
+ allowInsert: true,
13
+ allowDelete: true,
14
+ dynamicLoading: false,
15
+ fields: [
16
+ {
17
+ name: "PrimKey",
18
+ type: "string",
19
+ nullable: false,
20
+ },
21
+ {
22
+ name: "Created",
23
+ type: "datetime",
24
+ nullable: false,
25
+ },
26
+ {
27
+ name: "CreatedBy",
28
+ type: "string",
29
+ nullable: false,
30
+ },
31
+ {
32
+ name: "FileName",
33
+ type: "string",
34
+ nullable: true,
35
+ },
36
+ {
37
+ name: "FileSize",
38
+ type: "number",
39
+ nullable: true,
40
+ },
41
+ {
42
+ name: "FileRef",
43
+ type: "string",
44
+ nullable: true,
45
+ },
46
+ {
47
+ name: "Extension",
48
+ type: "string",
49
+ nullable: true,
50
+ },
51
+ ],
52
+ parameters: {
53
+ maxRecords: -1,
54
+ },
55
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./dsReportIssueAreas.js";
2
+ export * from "./dsReportIssueFiles.js";
3
+ export * from "./procReportIssue.js";