udp-react-enterprise-component-library 25.18.1-beta.77 → 25.18.1-beta.79
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.
- package/dist/{UdpTransactionsPage-Dr3XbvFa.js → UdpTransactionsPage-DXhT7CVV.js} +223 -48
- package/dist/UdpTransactionsPage-DXhT7CVV.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/types/src/maintenanceEngine/tableBrowser/TableColumnDefs.d.ts +1 -1
- package/dist/types/src/maintenanceEngine/tableBrowser/TableColumnDefs.d.ts.map +1 -1
- package/dist/types/src/udp/pages/UdpTransactionsPage/UdpTransactionSidesheet.d.ts.map +1 -1
- package/dist/types/src/udp/pages/UdpTransactionsPage/components/UdpTransactionCustomPage.d.ts.map +1 -1
- package/dist/types/src/udp/pages/UdpTransactionsPage/components/transactionHistory/TransactionTimeline.d.ts +1 -1
- package/dist/types/src/udp/pages/UdpTransactionsPage/components/transactionHistory/TransactionTimeline.d.ts.map +1 -1
- package/dist/types/src/udp/pages/UdpTransactionsPage/sidesheets/EditTransaction.d.ts.map +1 -1
- package/dist/types/src/udp/utilities/useDateStringColumnDef.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/udp/pages/UdpPages/index.js +1 -1
- package/dist/udp/pages/UdpTransactionsPage/index.js +1 -1
- package/export-map.json +1 -1
- package/package.json +1 -1
- package/dist/UdpTransactionsPage-Dr3XbvFa.js.map +0 -1
|
@@ -39,7 +39,7 @@ import { i as getLocalizedDateTimeString, t as formatDate } from "./dateUtils-CO
|
|
|
39
39
|
import { t as UdpActionCard } from "./UdpActionCard-VtAacuCM.js";
|
|
40
40
|
import { t as Attachments } from "./uploader-BdeUKdYW.js";
|
|
41
41
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
42
|
-
import { CircularProgress, FormControlLabel, LinearProgress, Switch, makeStyles } from "@material-ui/core";
|
|
42
|
+
import { Badge, CircularProgress, FormControlLabel, LinearProgress, Switch, makeStyles } from "@material-ui/core";
|
|
43
43
|
import { useSnackbar } from "notistack";
|
|
44
44
|
import { useLocation } from "react-router-dom";
|
|
45
45
|
import { AddIcon, ContactIcon, DocumentIcon, FileImageIcon, PDFIcon, ViewIcon, WordDocumentIcon } from "@fluentui/react-icons";
|
|
@@ -629,7 +629,7 @@ var AttachmentTransaction_default = AttachmentTransaction;
|
|
|
629
629
|
//#endregion
|
|
630
630
|
//#region src/udp/pages/UdpTransactionsPage/components/UdpTransactionCustomPage.jsx
|
|
631
631
|
const UdpTransactionCustomPage = (props) => {
|
|
632
|
-
const { pageId, transactionTypeId, transactionUiActionType, formRef, transaction, transactionTypeTransactionActionId, setHasUnsavedChanges } = props;
|
|
632
|
+
const { pageId, transactionTypeId, transactionUiActionType, formRef, refetchTransaction, transaction, transactionTypeTransactionActionId, setHasUnsavedChanges, onSubmitSuccess } = props;
|
|
633
633
|
const { getUiActionRenderPageId, getHiddenFields, getRequiredFields } = useTransactionEngine(transactionTypeId);
|
|
634
634
|
const { handleErrorSnackbar, handleSuccessSnackbar } = useHandleAxiosSnackbar();
|
|
635
635
|
const { t } = useTranslation();
|
|
@@ -660,8 +660,10 @@ const UdpTransactionCustomPage = (props) => {
|
|
|
660
660
|
message = "Action has been submitted successfully";
|
|
661
661
|
errorMessagePart = "submitting action for";
|
|
662
662
|
}
|
|
663
|
-
if (response?.status === 200)
|
|
664
|
-
|
|
663
|
+
if (response?.status === 200) {
|
|
664
|
+
handleSuccessSnackbar(t(`${message} `));
|
|
665
|
+
onSubmitSuccess?.(response);
|
|
666
|
+
} else if (response) handleErrorSnackbar(new Error(t(`Error ${errorMessagePart} Transaction. Please try again later.`)));
|
|
665
667
|
} catch (error) {
|
|
666
668
|
handleErrorSnackbar(error);
|
|
667
669
|
} finally {
|
|
@@ -669,6 +671,7 @@ const UdpTransactionCustomPage = (props) => {
|
|
|
669
671
|
formRef.current?.form?.restart(values);
|
|
670
672
|
setHasUnsavedChanges(false);
|
|
671
673
|
}
|
|
674
|
+
if (refetchTransaction) refetchTransaction();
|
|
672
675
|
}
|
|
673
676
|
}, [
|
|
674
677
|
executeCreateTransactionAction,
|
|
@@ -681,7 +684,9 @@ const UdpTransactionCustomPage = (props) => {
|
|
|
681
684
|
t,
|
|
682
685
|
transactionTypeTransactionActionId,
|
|
683
686
|
setHasUnsavedChanges,
|
|
684
|
-
formRef
|
|
687
|
+
formRef,
|
|
688
|
+
onSubmitSuccess,
|
|
689
|
+
refetchTransaction
|
|
685
690
|
]);
|
|
686
691
|
const isFieldRequired = useCallback((fieldName) => {
|
|
687
692
|
return getRequiredFields(transaction)?.includes(fieldName);
|
|
@@ -898,7 +903,7 @@ const TransactionTimelineItem = (props) => {
|
|
|
898
903
|
|
|
899
904
|
//#endregion
|
|
900
905
|
//#region src/udp/pages/UdpTransactionsPage/components/transactionHistory/TransactionTimeline.jsx
|
|
901
|
-
const TransactionTimeline = (props) => {
|
|
906
|
+
const TransactionTimeline = forwardRef((props, ref) => {
|
|
902
907
|
const { transactionId } = props;
|
|
903
908
|
const { t } = useTranslation();
|
|
904
909
|
const searchObj = useMemo(() => {
|
|
@@ -922,6 +927,9 @@ const TransactionTimeline = (props) => {
|
|
|
922
927
|
method: "post",
|
|
923
928
|
data: searchObj
|
|
924
929
|
});
|
|
930
|
+
useImperativeHandle(ref, () => ({ refresh: () => {
|
|
931
|
+
fetchTransactionHistory();
|
|
932
|
+
} }));
|
|
925
933
|
useEffect(() => {
|
|
926
934
|
fetchTransactionHistory();
|
|
927
935
|
}, [fetchTransactionHistory]);
|
|
@@ -932,7 +940,8 @@ const TransactionTimeline = (props) => {
|
|
|
932
940
|
date: item?.createdOn ? formatDate(item?.createdOn, "dd/mm/yyyy") : null,
|
|
933
941
|
status: item?.udpTransactionHistoryUdpTransactionTypeStatus?.name
|
|
934
942
|
})))) : /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(EmptyStateDisplay, { primaryText: t("No History") })));
|
|
935
|
-
};
|
|
943
|
+
});
|
|
944
|
+
TransactionTimeline.displayName = "TransactionTimeline";
|
|
936
945
|
|
|
937
946
|
//#endregion
|
|
938
947
|
//#region src/udp/pages/UdpTransactionsPage/components/transactionAttachment/TransactionAttachment.jsx
|
|
@@ -1456,26 +1465,25 @@ var EditTransactionDetailsForm_default = EditTransactionDetailsForm;
|
|
|
1456
1465
|
//#endregion
|
|
1457
1466
|
//#region src/udp/pages/UdpTransactionsPage/sidesheets/EditTransaction.jsx
|
|
1458
1467
|
const EditTransaction = (props) => {
|
|
1459
|
-
const { transaction: initialTransaction, transactionTypeId, transactionIsClosed, openInnerSidesheetState, setOpenInnerSidesheetState, refreshGridData, closeSideSheet, setSidesheetLoading, setHasUnsavedChanges } = props;
|
|
1468
|
+
const { transaction: initialTransaction, transactionTypeId, transactionIsClosed, openInnerSidesheetState, setOpenInnerSidesheetState, refreshGridData, closeSideSheet, setSidesheetLoading, setHasUnsavedChanges, attachmentType, setAttachmentType, currentAttachments, setCurrentAttachments, attachmentProgress, setAttachmentProgress, transactionAttachmentTypes, transactionAttachments, setTransactionAttachments, filePreview, setFilePreview } = props;
|
|
1460
1469
|
const { t } = useTranslation();
|
|
1461
1470
|
const [selectedTab, setSelectedTab] = useState(0);
|
|
1462
1471
|
const [transaction, setTransaction] = useState(initialTransaction);
|
|
1463
|
-
const [transactionAttachments, setTransactionAttachments] = useState([]);
|
|
1464
|
-
const [filePreview, setFilePreview] = useState(false);
|
|
1465
|
-
const [currentAttachments, setCurrentAttachments] = useState([]);
|
|
1466
|
-
const [attachmentType, setAttachmentType] = useState(null);
|
|
1467
|
-
const [attachmentProgress, setAttachmentProgress] = useState(false);
|
|
1468
1472
|
const [refreshNotes, setRefreshNotes] = useState(false);
|
|
1469
1473
|
const [{ data: noteTypes, loading: fetchNoteTypesLoading }] = useAxiosGet(ConfigService$1.productV1ApiUrl, `UdpNoteType`, {});
|
|
1470
1474
|
const { getUiActionRenderPageId, transactionTypeStatusColorsMap } = useTransactionEngine(transactionTypeId);
|
|
1471
1475
|
const refetchTransaction = useCallback(async () => {
|
|
1472
1476
|
setSidesheetLoading(true);
|
|
1473
1477
|
const response = await apiMutate(ConfigService$1.productV1ApiUrl, `udpTransaction/${initialTransaction.transactionId}/full`, { method: "get" });
|
|
1474
|
-
if (response?.status === 200)
|
|
1478
|
+
if (response?.status === 200) {
|
|
1479
|
+
setTransaction(response.data);
|
|
1480
|
+
transactionTimelineRef.current?.refresh();
|
|
1481
|
+
}
|
|
1475
1482
|
setSidesheetLoading(false);
|
|
1476
1483
|
}, [initialTransaction.transactionId, setSidesheetLoading]);
|
|
1477
1484
|
const formRef = useRef(null);
|
|
1478
1485
|
const transactionNoteFormRef = useRef(null);
|
|
1486
|
+
const transactionTimelineRef = useRef();
|
|
1479
1487
|
const handleNoteFormSubmit = useCallback(() => {
|
|
1480
1488
|
transactionNoteFormRef.current?.handleSubmit?.();
|
|
1481
1489
|
}, []);
|
|
@@ -1507,17 +1515,6 @@ const EditTransaction = (props) => {
|
|
|
1507
1515
|
}]
|
|
1508
1516
|
}
|
|
1509
1517
|
});
|
|
1510
|
-
const [{ data: transactionAttachmentTypes }, fetchTransactionAttachmentType] = useAxiosMutate(process.env.REACT_APP_PRODUCT_API_BASE, `UdpTransactionAttachmentType/search`, {
|
|
1511
|
-
method: "post",
|
|
1512
|
-
data: {
|
|
1513
|
-
pageSize: 50,
|
|
1514
|
-
filterElements: [{
|
|
1515
|
-
searchField: "TransactionTypeId",
|
|
1516
|
-
searchValue: transaction.transactionTypeId,
|
|
1517
|
-
searchOperator: "="
|
|
1518
|
-
}]
|
|
1519
|
-
}
|
|
1520
|
-
});
|
|
1521
1518
|
const { enqueueSnackbar } = useSnackbar();
|
|
1522
1519
|
const getAttachments = useCallback(async () => {
|
|
1523
1520
|
try {
|
|
@@ -1536,7 +1533,8 @@ const EditTransaction = (props) => {
|
|
|
1536
1533
|
}, [
|
|
1537
1534
|
fetchTransactionAttachments,
|
|
1538
1535
|
enqueueSnackbar,
|
|
1539
|
-
refetchTransaction
|
|
1536
|
+
refetchTransaction,
|
|
1537
|
+
setTransactionAttachments
|
|
1540
1538
|
]);
|
|
1541
1539
|
const tabNames = [
|
|
1542
1540
|
t("Details"),
|
|
@@ -1601,7 +1599,9 @@ const EditTransaction = (props) => {
|
|
|
1601
1599
|
enqueueSnackbar,
|
|
1602
1600
|
getAttachments,
|
|
1603
1601
|
setOpenInnerSidesheetState,
|
|
1604
|
-
transaction.transactionId
|
|
1602
|
+
transaction.transactionId,
|
|
1603
|
+
setCurrentAttachments,
|
|
1604
|
+
setAttachmentProgress
|
|
1605
1605
|
]);
|
|
1606
1606
|
const innerSidesheetList = useMemo(() => [
|
|
1607
1607
|
{
|
|
@@ -1680,7 +1680,12 @@ const EditTransaction = (props) => {
|
|
|
1680
1680
|
fetchNoteTypesLoading,
|
|
1681
1681
|
setOpenInnerSidesheetState,
|
|
1682
1682
|
refetchTransaction,
|
|
1683
|
-
handleUploadFiles
|
|
1683
|
+
handleUploadFiles,
|
|
1684
|
+
setAttachmentType,
|
|
1685
|
+
setCurrentAttachments,
|
|
1686
|
+
setAttachmentProgress,
|
|
1687
|
+
setTransactionAttachments,
|
|
1688
|
+
setFilePreview
|
|
1684
1689
|
]);
|
|
1685
1690
|
const transactionDetailPageId = useMemo(() => {
|
|
1686
1691
|
return getUiActionRenderPageId(TransactionUiActionTypeEnums.Render_Transaction_Details_Page);
|
|
@@ -1690,14 +1695,6 @@ const EditTransaction = (props) => {
|
|
|
1690
1695
|
if (!transactionAttachmentsData) getAttachments();
|
|
1691
1696
|
})();
|
|
1692
1697
|
}, [transactionAttachmentsData, getAttachments]);
|
|
1693
|
-
useEffect(() => {
|
|
1694
|
-
if (!transactionAttachmentTypes) {
|
|
1695
|
-
setAttachmentProgress(true);
|
|
1696
|
-
fetchTransactionAttachmentType().then(() => {
|
|
1697
|
-
setAttachmentProgress(false);
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
1700
|
-
}, [fetchTransactionAttachmentType, transactionAttachmentTypes]);
|
|
1701
1698
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "edit-transaction-sidesheet" }, /* @__PURE__ */ React.createElement("div", { className: `edit-transaction-sidesheet-header 'is-sticky'` }, /* @__PURE__ */ React.createElement("div", { className: "edit-transaction-sidesheet-header-title" }), /* @__PURE__ */ React.createElement("div", { className: "edit-transaction-sidesheet-header-content" }, /* @__PURE__ */ React.createElement("div", { className: "edit-transaction-sidesheet-header-items" }, headerItemInfo.map((headerItem) => {
|
|
1702
1699
|
return /* @__PURE__ */ React.createElement(EditTransactionHeaderItem_default, {
|
|
1703
1700
|
key: headerItem.label,
|
|
@@ -1738,6 +1735,7 @@ const EditTransaction = (props) => {
|
|
|
1738
1735
|
transactionUiActionType: TransactionUiActionTypeEnums.Render_Transaction_Details_Page,
|
|
1739
1736
|
formRef,
|
|
1740
1737
|
transaction,
|
|
1738
|
+
refetchTransaction,
|
|
1741
1739
|
setHasUnsavedChanges
|
|
1742
1740
|
}) : /* @__PURE__ */ React.createElement(EditTransactionDetailsForm_default, {
|
|
1743
1741
|
transaction,
|
|
@@ -1745,7 +1743,10 @@ const EditTransaction = (props) => {
|
|
|
1745
1743
|
})), /* @__PURE__ */ React.createElement(UdpTabPanel, {
|
|
1746
1744
|
value: selectedTab,
|
|
1747
1745
|
index: TRANSACTION_TAB.HISTORY
|
|
1748
|
-
}, /* @__PURE__ */ React.createElement(TransactionTimeline, {
|
|
1746
|
+
}, /* @__PURE__ */ React.createElement(TransactionTimeline, {
|
|
1747
|
+
ref: transactionTimelineRef,
|
|
1748
|
+
transactionId: transaction?.transactionId
|
|
1749
|
+
})), /* @__PURE__ */ React.createElement(UdpTabPanel, {
|
|
1749
1750
|
value: selectedTab,
|
|
1750
1751
|
index: TRANSACTION_TAB.ATTACHMENTS
|
|
1751
1752
|
}, /* @__PURE__ */ React.createElement(TransactionAttachments, {
|
|
@@ -1797,19 +1798,47 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1797
1798
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
1798
1799
|
const [unsavedChangesDialogOpen, setUnsavedChangesDialogOpen] = useState(false);
|
|
1799
1800
|
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
|
|
1801
|
+
const [createTransactionOpenInnerSidesheetState, setCreateTransactionOpenInnerSidesheetState] = useState({ attachments: false });
|
|
1802
|
+
const [attachmentType, setAttachmentType] = useState(null);
|
|
1803
|
+
const [currentAttachments, setCurrentAttachments] = useState([]);
|
|
1804
|
+
const [attachmentProgress, setAttachmentProgress] = useState(false);
|
|
1805
|
+
const [transactionAttachments, setTransactionAttachments] = useState([]);
|
|
1806
|
+
const [filePreview, setFilePreview] = useState(false);
|
|
1800
1807
|
const { handleSuccessSnackbar, handleErrorSnackbar } = useHandleAxiosSnackbar();
|
|
1801
1808
|
const { hasClosedStatus, checkIfTransactionIsClosed, getTransactionTypeLabel, getUiActionRenderPageId } = useTransactionEngine(transactionTypeId);
|
|
1802
1809
|
const { t } = useTranslation();
|
|
1803
1810
|
const formRef = useRef(null);
|
|
1811
|
+
const createdTransactionIdRef = useRef(null);
|
|
1804
1812
|
const attachmentRef = useRef();
|
|
1805
1813
|
const sidesheetWidth = openStates?.width ?? 800;
|
|
1806
1814
|
const transactionTypeEntry = transaction?.entityBusinessObject;
|
|
1815
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
1816
|
+
const [{ data: transactionAttachmentTypes }, fetchTransactionAttachmentType] = useAxiosMutate(process.env.REACT_APP_PRODUCT_API_BASE, `UdpTransactionAttachmentType/search`, {
|
|
1817
|
+
method: "post",
|
|
1818
|
+
data: {
|
|
1819
|
+
pageSize: 50,
|
|
1820
|
+
filterElements: [{
|
|
1821
|
+
searchField: "TransactionTypeId",
|
|
1822
|
+
searchValue: transactionTypeId,
|
|
1823
|
+
searchOperator: "="
|
|
1824
|
+
}]
|
|
1825
|
+
}
|
|
1826
|
+
});
|
|
1807
1827
|
const handleDialogClose = () => {
|
|
1808
1828
|
setDialogOpen(false);
|
|
1809
1829
|
};
|
|
1810
1830
|
const handleUnsavedChangesDialogClose = () => {
|
|
1811
1831
|
setUnsavedChangesDialogOpen(false);
|
|
1812
1832
|
};
|
|
1833
|
+
const handleResetAttachmentState = useCallback((resetSavedAttachmentsState) => {
|
|
1834
|
+
if (resetSavedAttachmentsState) {
|
|
1835
|
+
setAttachmentType(null);
|
|
1836
|
+
setCurrentAttachments([]);
|
|
1837
|
+
}
|
|
1838
|
+
setAttachmentProgress(false);
|
|
1839
|
+
setTransactionAttachments([]);
|
|
1840
|
+
setFilePreview(false);
|
|
1841
|
+
}, []);
|
|
1813
1842
|
const executeCloseTransaction = useCallback(async () => {
|
|
1814
1843
|
if ((await apiMutate(ConfigService$1.productV1ApiUrl, `udpTransaction/${transaction?.transactionId}/closeTransaction`, { method: "post" }))?.status === 200) {
|
|
1815
1844
|
handleSidesheet("edit", false);
|
|
@@ -1836,16 +1865,79 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1836
1865
|
}
|
|
1837
1866
|
}, [executeCloseTransaction, handleErrorSnackbar]);
|
|
1838
1867
|
const formattedBusinesskey = transactionTypeEntry?.businessObjectKey?.split("|")?.pop();
|
|
1868
|
+
const handleTransactionCreationSuccess = useCallback((response) => {
|
|
1869
|
+
createdTransactionIdRef.current = response?.data?.transactionId ?? null;
|
|
1870
|
+
}, []);
|
|
1871
|
+
const handleFilesSelectedForUpload = useCallback(() => {
|
|
1872
|
+
setCreateTransactionOpenInnerSidesheetState({ attachments: false });
|
|
1873
|
+
enqueueSnackbar(`${currentAttachments.length} file(s) added for upload`, {
|
|
1874
|
+
variant: "success",
|
|
1875
|
+
anchorOrigin: {
|
|
1876
|
+
vertical: "top",
|
|
1877
|
+
horizontal: "center"
|
|
1878
|
+
}
|
|
1879
|
+
});
|
|
1880
|
+
}, [enqueueSnackbar, currentAttachments.length]);
|
|
1881
|
+
const handleUploadFilesForCreateTransaction = useCallback(async (transactionId) => {
|
|
1882
|
+
if (!currentAttachments.length) throw new Error("No files added for upload");
|
|
1883
|
+
const formData = new FormData();
|
|
1884
|
+
currentAttachments.forEach((file) => formData.append("files", file));
|
|
1885
|
+
formData.append("attachmentTypeId", attachmentType.transactionAttachmentTypeId);
|
|
1886
|
+
try {
|
|
1887
|
+
setAttachmentProgress(true);
|
|
1888
|
+
await apiMutate(ConfigService$1.productV1ApiUrl, `UdpTransactionAttachment/transaction/${transactionId}/upload`, {
|
|
1889
|
+
method: "post",
|
|
1890
|
+
headers: {
|
|
1891
|
+
transactionId,
|
|
1892
|
+
attachmentTypeId: attachmentType.transactionAttachmentTypeId
|
|
1893
|
+
},
|
|
1894
|
+
data: formData
|
|
1895
|
+
});
|
|
1896
|
+
setCurrentAttachments([]);
|
|
1897
|
+
setCreateTransactionOpenInnerSidesheetState({ attachments: false });
|
|
1898
|
+
enqueueSnackbar("Files uploaded successfully", {
|
|
1899
|
+
variant: "success",
|
|
1900
|
+
anchorOrigin: {
|
|
1901
|
+
vertical: "top",
|
|
1902
|
+
horizontal: "center"
|
|
1903
|
+
}
|
|
1904
|
+
});
|
|
1905
|
+
} catch (error) {
|
|
1906
|
+
enqueueSnackbar(`File upload failed: We encountered a system error. Please try again or contact support if the issue persists.`, {
|
|
1907
|
+
variant: "error",
|
|
1908
|
+
anchorOrigin: {
|
|
1909
|
+
vertical: "top",
|
|
1910
|
+
horizontal: "center"
|
|
1911
|
+
}
|
|
1912
|
+
});
|
|
1913
|
+
throw error;
|
|
1914
|
+
} finally {
|
|
1915
|
+
setAttachmentProgress(false);
|
|
1916
|
+
}
|
|
1917
|
+
}, [
|
|
1918
|
+
attachmentType,
|
|
1919
|
+
currentAttachments,
|
|
1920
|
+
enqueueSnackbar,
|
|
1921
|
+
setCurrentAttachments,
|
|
1922
|
+
setAttachmentProgress
|
|
1923
|
+
]);
|
|
1839
1924
|
const handleTransactionCreation = useCallback(async () => {
|
|
1840
1925
|
setSidesheetLoading(true);
|
|
1926
|
+
createdTransactionIdRef.current = null;
|
|
1841
1927
|
await formRef.current?.form?.submit();
|
|
1928
|
+
const newTransactionId = createdTransactionIdRef.current;
|
|
1929
|
+
if (newTransactionId && currentAttachments.length > 0) await handleUploadFilesForCreateTransaction(newTransactionId);
|
|
1842
1930
|
setSidesheetLoading(false);
|
|
1843
1931
|
handleSidesheet("add", false);
|
|
1932
|
+
handleResetAttachmentState(true);
|
|
1844
1933
|
refreshGridData();
|
|
1845
1934
|
}, [
|
|
1846
1935
|
handleSidesheet,
|
|
1847
1936
|
refreshGridData,
|
|
1848
|
-
formRef
|
|
1937
|
+
formRef,
|
|
1938
|
+
handleResetAttachmentState,
|
|
1939
|
+
currentAttachments.length,
|
|
1940
|
+
handleUploadFilesForCreateTransaction
|
|
1849
1941
|
]);
|
|
1850
1942
|
const handleCreateRevision = useCallback(async () => {
|
|
1851
1943
|
setSidesheetLoading(true);
|
|
@@ -1890,16 +1982,53 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1890
1982
|
return [
|
|
1891
1983
|
{
|
|
1892
1984
|
open: openStates.addTransaction,
|
|
1893
|
-
closeSheet: () =>
|
|
1985
|
+
closeSheet: () => {
|
|
1986
|
+
handleSidesheet("add", false);
|
|
1987
|
+
handleResetAttachmentState(true);
|
|
1988
|
+
},
|
|
1894
1989
|
title: domainName,
|
|
1895
1990
|
width: sidesheetWidth,
|
|
1896
1991
|
onSubmit: handleTransactionCreation,
|
|
1897
|
-
children: /* @__PURE__ */ React.createElement(UdpTransactionCustomPage_default, {
|
|
1992
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UdpTransactionCustomPage_default, {
|
|
1898
1993
|
transactionTypeId,
|
|
1899
1994
|
transactionUiActionType: TransactionUiActionTypeEnums.Render_Create_Transaction_Page,
|
|
1900
|
-
formRef
|
|
1901
|
-
|
|
1902
|
-
|
|
1995
|
+
formRef,
|
|
1996
|
+
onSubmitSuccess: handleTransactionCreationSuccess
|
|
1997
|
+
}), /* @__PURE__ */ React.createElement(SideSheet, {
|
|
1998
|
+
key: "Create Transaction: Add Attachment",
|
|
1999
|
+
open: createTransactionOpenInnerSidesheetState?.attachments,
|
|
2000
|
+
width: 600,
|
|
2001
|
+
title: t("Add Attachment"),
|
|
2002
|
+
onClose: () => {
|
|
2003
|
+
setCreateTransactionOpenInnerSidesheetState({ attachments: false });
|
|
2004
|
+
handleResetAttachmentState(true);
|
|
2005
|
+
},
|
|
2006
|
+
buttonLabel: t("Save"),
|
|
2007
|
+
buttonOneDisabled: !attachmentType || currentAttachments.length <= 0,
|
|
2008
|
+
onSubmit: handleFilesSelectedForUpload,
|
|
2009
|
+
color: "primary"
|
|
2010
|
+
}, /* @__PURE__ */ React.createElement(Attachments, {
|
|
2011
|
+
attachmentTypes: transactionAttachmentTypes,
|
|
2012
|
+
attachmentType,
|
|
2013
|
+
setAttachmentType,
|
|
2014
|
+
attachmentProgress,
|
|
2015
|
+
setAttachmentProgress,
|
|
2016
|
+
currentAttachments,
|
|
2017
|
+
setCurrentAttachments,
|
|
2018
|
+
transaction,
|
|
2019
|
+
previousAttachments: transactionAttachments,
|
|
2020
|
+
setPreviousAttachments: setTransactionAttachments,
|
|
2021
|
+
MAX_FILE_SIZE_MB,
|
|
2022
|
+
allowedExtensions,
|
|
2023
|
+
filePreview,
|
|
2024
|
+
setFilePreview
|
|
2025
|
+
}))),
|
|
2026
|
+
buttonLabel: "Add",
|
|
2027
|
+
buttonTwoLabel: /* @__PURE__ */ React.createElement(Badge, {
|
|
2028
|
+
badgeContent: currentAttachments?.length,
|
|
2029
|
+
color: "primary"
|
|
2030
|
+
}, "Add Attachment"),
|
|
2031
|
+
buttonTwoAction: () => setCreateTransactionOpenInnerSidesheetState({ attachments: true })
|
|
1903
2032
|
},
|
|
1904
2033
|
{
|
|
1905
2034
|
open: openStates.viewTransaction,
|
|
@@ -1941,7 +2070,10 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1941
2070
|
},
|
|
1942
2071
|
{
|
|
1943
2072
|
open: openStates.editTransaction,
|
|
1944
|
-
closeSheet: () =>
|
|
2073
|
+
closeSheet: () => {
|
|
2074
|
+
handleSidesheet("edit", false);
|
|
2075
|
+
handleResetAttachmentState(true);
|
|
2076
|
+
},
|
|
1945
2077
|
title: `Edit ${domainName} ${transactionLabel}`,
|
|
1946
2078
|
width: sidesheetWidth,
|
|
1947
2079
|
buttonLabel: "Next Steps",
|
|
@@ -1957,9 +2089,23 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1957
2089
|
openInnerSidesheetState: editTransactionopenInnerSidesheetState,
|
|
1958
2090
|
setOpenInnerSidesheetState: setEditTransactionOpenInnerSidesheetState,
|
|
1959
2091
|
refreshGridData,
|
|
1960
|
-
closeSideSheet: () =>
|
|
2092
|
+
closeSideSheet: () => {
|
|
2093
|
+
handleSidesheet("edit", false);
|
|
2094
|
+
handleResetAttachmentState(true);
|
|
2095
|
+
},
|
|
1961
2096
|
setSidesheetLoading,
|
|
1962
|
-
setHasUnsavedChanges
|
|
2097
|
+
setHasUnsavedChanges,
|
|
2098
|
+
attachmentType,
|
|
2099
|
+
setAttachmentType,
|
|
2100
|
+
currentAttachments,
|
|
2101
|
+
setCurrentAttachments,
|
|
2102
|
+
attachmentProgress,
|
|
2103
|
+
setAttachmentProgress,
|
|
2104
|
+
transactionAttachmentTypes,
|
|
2105
|
+
transactionAttachments,
|
|
2106
|
+
setTransactionAttachments,
|
|
2107
|
+
filePreview,
|
|
2108
|
+
setFilePreview
|
|
1963
2109
|
})
|
|
1964
2110
|
},
|
|
1965
2111
|
{
|
|
@@ -1989,13 +2135,42 @@ const UdpTransactionSidesheet = (props) => {
|
|
|
1989
2135
|
refreshGridData,
|
|
1990
2136
|
transactionTypeId,
|
|
1991
2137
|
handleTransactionCreation,
|
|
2138
|
+
handleTransactionCreationSuccess,
|
|
1992
2139
|
hasClosedStatus,
|
|
1993
2140
|
handleCreateRevision,
|
|
1994
2141
|
transactionIsClosed,
|
|
1995
2142
|
viewTransactionPage,
|
|
1996
2143
|
pdfViewPageId,
|
|
1997
2144
|
sidesheetWidth,
|
|
1998
|
-
handleNextStepsAction
|
|
2145
|
+
handleNextStepsAction,
|
|
2146
|
+
createTransactionOpenInnerSidesheetState,
|
|
2147
|
+
t,
|
|
2148
|
+
attachmentType,
|
|
2149
|
+
setAttachmentType,
|
|
2150
|
+
currentAttachments,
|
|
2151
|
+
setCurrentAttachments,
|
|
2152
|
+
attachmentProgress,
|
|
2153
|
+
setAttachmentProgress,
|
|
2154
|
+
transactionAttachmentTypes,
|
|
2155
|
+
transactionAttachments,
|
|
2156
|
+
setTransactionAttachments,
|
|
2157
|
+
filePreview,
|
|
2158
|
+
setFilePreview,
|
|
2159
|
+
handleResetAttachmentState,
|
|
2160
|
+
handleFilesSelectedForUpload
|
|
2161
|
+
]);
|
|
2162
|
+
useEffect(() => {
|
|
2163
|
+
if ((openStates?.addTransaction || openStates?.editTransaction) && !transactionAttachmentTypes) {
|
|
2164
|
+
setAttachmentProgress(true);
|
|
2165
|
+
fetchTransactionAttachmentType().then(() => {
|
|
2166
|
+
setAttachmentProgress(false);
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
}, [
|
|
2170
|
+
fetchTransactionAttachmentType,
|
|
2171
|
+
transactionAttachmentTypes,
|
|
2172
|
+
openStates.addTransaction,
|
|
2173
|
+
openStates.editTransaction
|
|
1999
2174
|
]);
|
|
2000
2175
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, openStates && sidesheetList.map((item) => {
|
|
2001
2176
|
return /* @__PURE__ */ React.createElement(SideSheet, {
|
|
@@ -2266,4 +2441,4 @@ var UdpTransactionsPage_exports = /* @__PURE__ */ __exportAll({ default: () => U
|
|
|
2266
2441
|
|
|
2267
2442
|
//#endregion
|
|
2268
2443
|
export { UdpTransactionsPage_default as n, UdpTransactionsPage_exports as t };
|
|
2269
|
-
//# sourceMappingURL=UdpTransactionsPage-
|
|
2444
|
+
//# sourceMappingURL=UdpTransactionsPage-DXhT7CVV.js.map
|