finance-shared 0.0.15 → 0.0.17
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.
|
@@ -83,7 +83,7 @@ const locale$3 = {
|
|
|
83
83
|
INTEREST_RATE: "Interest Rate",
|
|
84
84
|
INTEREST_FEES: "Interest Fees",
|
|
85
85
|
REPAYMENT_AMOUNT: "Repayment Amount",
|
|
86
|
-
|
|
86
|
+
DISBURSEMENT: "Disbursement",
|
|
87
87
|
CONFIRM_INFORMATION_READ: "I confirm that I have read, understood, and agree to the loan amount, interest rate, repayment terms, deductions, tenure, and all related loan details.",
|
|
88
88
|
PDF_PREVIEW_TITLE: "Summary of loan application",
|
|
89
89
|
TOTAL_INTEREST_RATE: "Total Interest Rate",
|
|
@@ -151,7 +151,7 @@ const locale$2 = {
|
|
|
151
151
|
INTEREST_RATE: "Kadar Faedah",
|
|
152
152
|
INTEREST_FEES: "Yuran Faedah",
|
|
153
153
|
REPAYMENT_AMOUNT: "Amaun Bayaran Balik",
|
|
154
|
-
|
|
154
|
+
DISBURSEMENT: "Pengeluaran",
|
|
155
155
|
CONFIRM_INFORMATION_READ: "Saya mengesahkan bahawa saya telah membaca, memahami, dan bersetuju dengan jumlah pinjaman, kadar faedah, terma pembayaran balik, potongan, tempoh pinjaman, serta semua butiran pinjaman yang berkaitan.",
|
|
156
156
|
PDF_PREVIEW_TITLE: "Ringkasan permohonan pinjaman",
|
|
157
157
|
TOTAL_INTEREST_RATE: "Jumlah Kadar Faedah",
|
|
@@ -10392,7 +10392,8 @@ const DigitalProcessSignature = (request_data) => async (dispatch) => {
|
|
|
10392
10392
|
if (applicationDetails) {
|
|
10393
10393
|
dispatch(setActiveFinanceDetail(applicationDetails));
|
|
10394
10394
|
}
|
|
10395
|
-
dispatch(setDocumentSignJPDF(
|
|
10395
|
+
dispatch(setDocumentSignJPDF(""));
|
|
10396
|
+
dispatch(setSignedDocumentJPDF(response.result));
|
|
10396
10397
|
}
|
|
10397
10398
|
} catch (error) {
|
|
10398
10399
|
dispatch(showMessage({ message: error.message, variant: "error" }));
|
|
@@ -10464,6 +10465,10 @@ const getDocumentSignJPDF = (state) => {
|
|
|
10464
10465
|
var _a;
|
|
10465
10466
|
return ((_a = state.dialogs) == null ? void 0 : _a.documentSignJPDF) || "";
|
|
10466
10467
|
};
|
|
10468
|
+
const getSignedDocumentJPDF = (state) => {
|
|
10469
|
+
var _a;
|
|
10470
|
+
return ((_a = state.dialogs) == null ? void 0 : _a.signedDocumentJPDF) || "";
|
|
10471
|
+
};
|
|
10467
10472
|
const getActiveFinanceDetail = (state) => {
|
|
10468
10473
|
var _a;
|
|
10469
10474
|
return ((_a = state.dialogs) == null ? void 0 : _a.activeFinanceDetail) || null;
|
|
@@ -10494,6 +10499,7 @@ const initialState$1 = {
|
|
|
10494
10499
|
},
|
|
10495
10500
|
remarksList: [],
|
|
10496
10501
|
documentSignJPDF: "",
|
|
10502
|
+
signedDocumentJPDF: "",
|
|
10497
10503
|
activeFinanceDetail: null,
|
|
10498
10504
|
imagePath: "",
|
|
10499
10505
|
selectedMediaFilePath: ""
|
|
@@ -10515,6 +10521,9 @@ const dialogsSlice = createSlice({
|
|
|
10515
10521
|
setDocumentSignJPDF: (state, action) => {
|
|
10516
10522
|
state.documentSignJPDF = action.payload;
|
|
10517
10523
|
},
|
|
10524
|
+
setSignedDocumentJPDF: (state, action) => {
|
|
10525
|
+
state.signedDocumentJPDF = action.payload;
|
|
10526
|
+
},
|
|
10518
10527
|
setActiveFinanceDetail: (state, action) => {
|
|
10519
10528
|
state.activeFinanceDetail = action.payload;
|
|
10520
10529
|
},
|
|
@@ -10530,6 +10539,7 @@ const {
|
|
|
10530
10539
|
setLoading: setLoading$1,
|
|
10531
10540
|
setRemarkList,
|
|
10532
10541
|
setDocumentSignJPDF,
|
|
10542
|
+
setSignedDocumentJPDF,
|
|
10533
10543
|
setActiveFinanceDetail,
|
|
10534
10544
|
setImagePath,
|
|
10535
10545
|
setSelectedMediaFilePath
|
|
@@ -25179,27 +25189,20 @@ const SearchableAutocomplete = memo(
|
|
|
25179
25189
|
});
|
|
25180
25190
|
}
|
|
25181
25191
|
}, []);
|
|
25182
|
-
const fetchDebouncedOptions =
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
}, 1e3),
|
|
25194
|
-
[fetchOptions]
|
|
25195
|
-
);
|
|
25192
|
+
const fetchDebouncedOptions = useDebounce(async (search) => {
|
|
25193
|
+
setLoading2(true);
|
|
25194
|
+
try {
|
|
25195
|
+
const results = await fetchOptions(search, 0);
|
|
25196
|
+
setOptions(results);
|
|
25197
|
+
} catch (err) {
|
|
25198
|
+
console.error("Error fetching options:", err);
|
|
25199
|
+
} finally {
|
|
25200
|
+
setLoading2(false);
|
|
25201
|
+
}
|
|
25202
|
+
}, 1e3);
|
|
25196
25203
|
useEffect(() => {
|
|
25197
25204
|
if (isTyping) {
|
|
25198
|
-
|
|
25199
|
-
fetchDebouncedOptions(searchTerm);
|
|
25200
|
-
} else {
|
|
25201
|
-
fetchDebouncedOptions("");
|
|
25202
|
-
}
|
|
25205
|
+
fetchDebouncedOptions(searchTerm || "");
|
|
25203
25206
|
}
|
|
25204
25207
|
}, [searchTerm, isTyping, fetchDebouncedOptions]);
|
|
25205
25208
|
const loadMoreOptions = useCallback(async () => {
|
|
@@ -25243,10 +25246,12 @@ const SearchableAutocomplete = memo(
|
|
|
25243
25246
|
}
|
|
25244
25247
|
}
|
|
25245
25248
|
}, [onChange, fetchOptions]);
|
|
25246
|
-
const handleInputChange = useCallback((_event, inputValue) => {
|
|
25247
|
-
|
|
25248
|
-
|
|
25249
|
-
|
|
25249
|
+
const handleInputChange = useCallback((_event, inputValue, reason) => {
|
|
25250
|
+
if (reason === "input") {
|
|
25251
|
+
setSearchTerm(inputValue);
|
|
25252
|
+
setIsTyping(true);
|
|
25253
|
+
setPageIndex(0);
|
|
25254
|
+
}
|
|
25250
25255
|
}, []);
|
|
25251
25256
|
const listboxProps = useMemo(() => ({
|
|
25252
25257
|
onScroll: handleScroll
|
|
@@ -25297,30 +25302,26 @@ const MemberAutoComplete = ({
|
|
|
25297
25302
|
const dispatch = useDispatch();
|
|
25298
25303
|
const loading = useSelector(getIsUserListLoading);
|
|
25299
25304
|
const pagination = useSelector(getUserListPaginationData);
|
|
25300
|
-
const
|
|
25305
|
+
const hasMoreDataRef = useRef(true);
|
|
25301
25306
|
useEffect(() => {
|
|
25302
25307
|
return () => {
|
|
25303
25308
|
dispatch(setUserSearchKeyword(""));
|
|
25304
25309
|
dispatch(setUserListPagination({ pageIndex: 0 }));
|
|
25305
|
-
|
|
25310
|
+
hasMoreDataRef.current = true;
|
|
25306
25311
|
};
|
|
25307
25312
|
}, [dispatch]);
|
|
25308
|
-
const handleOptionChange = (value2) => {
|
|
25313
|
+
const handleOptionChange = useCallback((value2) => {
|
|
25309
25314
|
onChange(value2);
|
|
25310
25315
|
dispatch(setIsUserListLoading(false));
|
|
25311
|
-
};
|
|
25312
|
-
const fetchUserOptions = async (searchTerm, pageIndex) => {
|
|
25313
|
-
if (pageIndex > 0 && !
|
|
25314
|
-
return [];
|
|
25315
|
-
}
|
|
25316
|
+
}, [onChange, dispatch]);
|
|
25317
|
+
const fetchUserOptions = useCallback(async (searchTerm, pageIndex) => {
|
|
25318
|
+
if (pageIndex > 0 && !hasMoreDataRef.current) return [];
|
|
25316
25319
|
dispatch(setUserSearchKeyword(searchTerm));
|
|
25317
25320
|
dispatch(setUserListPagination({ pageIndex }));
|
|
25318
25321
|
const newOptions = await dispatch(getUserList(roleIds, tenantId, pageIndex, searchTerm));
|
|
25319
|
-
if (!newOptions ||
|
|
25320
|
-
|
|
25321
|
-
if (pageIndex > 0)
|
|
25322
|
-
return [];
|
|
25323
|
-
}
|
|
25322
|
+
if (!newOptions || newOptions.length === 0) {
|
|
25323
|
+
hasMoreDataRef.current = false;
|
|
25324
|
+
if (pageIndex > 0) return [];
|
|
25324
25325
|
}
|
|
25325
25326
|
return (newOptions == null ? void 0 : newOptions.map((item) => {
|
|
25326
25327
|
var _a, _b;
|
|
@@ -25329,7 +25330,7 @@ const MemberAutoComplete = ({
|
|
|
25329
25330
|
label: ((_a = item == null ? void 0 : item.additionalDetails) == null ? void 0 : _a.nationalId) ? `${item.userName} (${(_b = item == null ? void 0 : item.additionalDetails) == null ? void 0 : _b.nationalId})` : item.userName
|
|
25330
25331
|
};
|
|
25331
25332
|
})) || [];
|
|
25332
|
-
};
|
|
25333
|
+
}, [dispatch, roleIds, tenantId]);
|
|
25333
25334
|
return /* @__PURE__ */ jsx(
|
|
25334
25335
|
SearchableAutocomplete,
|
|
25335
25336
|
{
|
|
@@ -25914,6 +25915,7 @@ const PDFPreviewForTheSignature = ({
|
|
|
25914
25915
|
financeCalculation,
|
|
25915
25916
|
t: t2 = (key) => key,
|
|
25916
25917
|
showConfirmCheckbox = false,
|
|
25918
|
+
pdfOnly = false,
|
|
25917
25919
|
...props
|
|
25918
25920
|
}) => {
|
|
25919
25921
|
const showButton = shouldShowButton(
|
|
@@ -25923,7 +25925,7 @@ const PDFPreviewForTheSignature = ({
|
|
|
25923
25925
|
);
|
|
25924
25926
|
const [isTermsConfirmed, setIsTermsConfirmed] = useState(false);
|
|
25925
25927
|
return /* @__PURE__ */ jsx(Dialog$1, { open, onClose, maxWidth: "lg", fullWidth: true, ...props, children: /* @__PURE__ */ jsxs(DialogContent$1, { className: "p-0", children: [
|
|
25926
|
-
(dialogTitle || financeCalculation) && /* @__PURE__ */ jsxs("div", { className: "px-16 pt-12 pb-16", children: [
|
|
25928
|
+
!pdfOnly && (dialogTitle || financeCalculation) && /* @__PURE__ */ jsxs("div", { className: "px-16 pt-12 pb-16", children: [
|
|
25927
25929
|
dialogTitle && /* @__PURE__ */ jsx(Typography$1, { variant: "h6", className: "font-semibold mb-12", children: dialogTitle }),
|
|
25928
25930
|
financeCalculation && /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 2, children: [
|
|
25929
25931
|
financeCalculation.loanAmount !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
|
|
@@ -25980,7 +25982,7 @@ const PDFPreviewForTheSignature = ({
|
|
|
25980
25982
|
] }) }),
|
|
25981
25983
|
financeCalculation.cashInHand !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
|
|
25982
25984
|
/* @__PURE__ */ jsxs("strong", { children: [
|
|
25983
|
-
t2("
|
|
25985
|
+
t2("DISBURSEMENT"),
|
|
25984
25986
|
": "
|
|
25985
25987
|
] }),
|
|
25986
25988
|
formatAmount(financeCalculation.cashInHand)
|
|
@@ -25993,10 +25995,10 @@ const PDFPreviewForTheSignature = ({
|
|
|
25993
25995
|
src: filePath,
|
|
25994
25996
|
type: "application/pdf",
|
|
25995
25997
|
width: "100%",
|
|
25996
|
-
style: { height: "70vh" }
|
|
25998
|
+
style: { height: pdfOnly ? "85vh" : "70vh" }
|
|
25997
25999
|
}
|
|
25998
26000
|
) }),
|
|
25999
|
-
(showButton || showConfirmCheckbox) && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 bg-white w-full px-16 py-10", children: showConfirmCheckbox ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", children: [
|
|
26001
|
+
!pdfOnly && (showButton || showConfirmCheckbox) && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 bg-white w-full px-16 py-10", children: showConfirmCheckbox ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", children: [
|
|
26000
26002
|
/* @__PURE__ */ jsx(
|
|
26001
26003
|
CustomCheckbox,
|
|
26002
26004
|
{
|
|
@@ -26043,6 +26045,7 @@ function DocumentSigningDialog({
|
|
|
26043
26045
|
const { t: t2 } = useTranslation("Dialog");
|
|
26044
26046
|
const open = useSelector(getIsDocumentSignatureDialogOpen);
|
|
26045
26047
|
const documentSignJPDF = useSelector(getDocumentSignJPDF);
|
|
26048
|
+
const signedDocumentJPDF = useSelector(getSignedDocumentJPDF);
|
|
26046
26049
|
const isProcessSignatureLoading = useSelector(getIsProcessSignatureLoading);
|
|
26047
26050
|
const activeFinanceDetail = useSelector(getActiveFinanceDetail);
|
|
26048
26051
|
const dispatch = useDispatch();
|
|
@@ -26091,6 +26094,11 @@ function DocumentSigningDialog({
|
|
|
26091
26094
|
dispatch(setActiveFinanceDetail(null));
|
|
26092
26095
|
dispatch(setIsDocumentSignatureDialogOpen(false));
|
|
26093
26096
|
};
|
|
26097
|
+
const handleSignedPDFClose = () => {
|
|
26098
|
+
dispatch(setSignedDocumentJPDF(""));
|
|
26099
|
+
dispatch(setActiveFinanceDetail(null));
|
|
26100
|
+
dispatch(setIsDocumentSignatureDialogOpen(false));
|
|
26101
|
+
};
|
|
26094
26102
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Dialog$1, { open, onClose: handleClose, maxWidth: "xs", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col p-16", children: [
|
|
26095
26103
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx(
|
|
26096
26104
|
"img",
|
|
@@ -26159,10 +26167,10 @@ function DocumentSigningDialog({
|
|
|
26159
26167
|
/* @__PURE__ */ jsx(
|
|
26160
26168
|
PDFPreviewForTheSignature,
|
|
26161
26169
|
{
|
|
26162
|
-
filePath: documentSignJPDF,
|
|
26163
|
-
open: !!documentSignJPDF,
|
|
26170
|
+
filePath: signedDocumentJPDF || documentSignJPDF,
|
|
26171
|
+
open: !!(signedDocumentJPDF || documentSignJPDF),
|
|
26164
26172
|
isButtonLoading: isProcessSignatureLoading,
|
|
26165
|
-
onClose:
|
|
26173
|
+
onClose: signedDocumentJPDF ? handleSignedPDFClose : handlePDFPreviewClose,
|
|
26166
26174
|
bottomButtonLabel: t2("SIGN_DOCUMENT"),
|
|
26167
26175
|
onConfirm: handleButtonClick,
|
|
26168
26176
|
applicationDetailsData: activeFinanceDetail || financeDetail,
|
|
@@ -26172,7 +26180,8 @@ function DocumentSigningDialog({
|
|
|
26172
26180
|
financeCalculation,
|
|
26173
26181
|
t: t2,
|
|
26174
26182
|
dialogTitle: t2("PDF_PREVIEW_TITLE"),
|
|
26175
|
-
showConfirmCheckbox
|
|
26183
|
+
showConfirmCheckbox,
|
|
26184
|
+
pdfOnly: !!signedDocumentJPDF
|
|
26176
26185
|
}
|
|
26177
26186
|
)
|
|
26178
26187
|
] })
|