finance-shared 0.0.15 → 0.0.16

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
- CASH_IN_HAND: "Cash In Hand",
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
- CASH_IN_HAND: "Wang tunai di tangan",
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(response.result));
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
@@ -25914,6 +25924,7 @@ const PDFPreviewForTheSignature = ({
25914
25924
  financeCalculation,
25915
25925
  t: t2 = (key) => key,
25916
25926
  showConfirmCheckbox = false,
25927
+ pdfOnly = false,
25917
25928
  ...props
25918
25929
  }) => {
25919
25930
  const showButton = shouldShowButton(
@@ -25923,7 +25934,7 @@ const PDFPreviewForTheSignature = ({
25923
25934
  );
25924
25935
  const [isTermsConfirmed, setIsTermsConfirmed] = useState(false);
25925
25936
  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: [
25937
+ !pdfOnly && (dialogTitle || financeCalculation) && /* @__PURE__ */ jsxs("div", { className: "px-16 pt-12 pb-16", children: [
25927
25938
  dialogTitle && /* @__PURE__ */ jsx(Typography$1, { variant: "h6", className: "font-semibold mb-12", children: dialogTitle }),
25928
25939
  financeCalculation && /* @__PURE__ */ jsxs(Grid2, { container: true, spacing: 2, children: [
25929
25940
  financeCalculation.loanAmount !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
@@ -25980,7 +25991,7 @@ const PDFPreviewForTheSignature = ({
25980
25991
  ] }) }),
25981
25992
  financeCalculation.cashInHand !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
25982
25993
  /* @__PURE__ */ jsxs("strong", { children: [
25983
- t2("CASH_IN_HAND"),
25994
+ t2("DISBURSEMENT"),
25984
25995
  ": "
25985
25996
  ] }),
25986
25997
  formatAmount(financeCalculation.cashInHand)
@@ -25993,10 +26004,10 @@ const PDFPreviewForTheSignature = ({
25993
26004
  src: filePath,
25994
26005
  type: "application/pdf",
25995
26006
  width: "100%",
25996
- style: { height: "70vh" }
26007
+ style: { height: pdfOnly ? "85vh" : "70vh" }
25997
26008
  }
25998
26009
  ) }),
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: [
26010
+ !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
26011
  /* @__PURE__ */ jsx(
26001
26012
  CustomCheckbox,
26002
26013
  {
@@ -26043,6 +26054,7 @@ function DocumentSigningDialog({
26043
26054
  const { t: t2 } = useTranslation("Dialog");
26044
26055
  const open = useSelector(getIsDocumentSignatureDialogOpen);
26045
26056
  const documentSignJPDF = useSelector(getDocumentSignJPDF);
26057
+ const signedDocumentJPDF = useSelector(getSignedDocumentJPDF);
26046
26058
  const isProcessSignatureLoading = useSelector(getIsProcessSignatureLoading);
26047
26059
  const activeFinanceDetail = useSelector(getActiveFinanceDetail);
26048
26060
  const dispatch = useDispatch();
@@ -26091,6 +26103,11 @@ function DocumentSigningDialog({
26091
26103
  dispatch(setActiveFinanceDetail(null));
26092
26104
  dispatch(setIsDocumentSignatureDialogOpen(false));
26093
26105
  };
26106
+ const handleSignedPDFClose = () => {
26107
+ dispatch(setSignedDocumentJPDF(""));
26108
+ dispatch(setActiveFinanceDetail(null));
26109
+ dispatch(setIsDocumentSignatureDialogOpen(false));
26110
+ };
26094
26111
  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
26112
  /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx(
26096
26113
  "img",
@@ -26159,10 +26176,10 @@ function DocumentSigningDialog({
26159
26176
  /* @__PURE__ */ jsx(
26160
26177
  PDFPreviewForTheSignature,
26161
26178
  {
26162
- filePath: documentSignJPDF,
26163
- open: !!documentSignJPDF,
26179
+ filePath: signedDocumentJPDF || documentSignJPDF,
26180
+ open: !!(signedDocumentJPDF || documentSignJPDF),
26164
26181
  isButtonLoading: isProcessSignatureLoading,
26165
- onClose: () => handlePDFPreviewClose(),
26182
+ onClose: signedDocumentJPDF ? handleSignedPDFClose : handlePDFPreviewClose,
26166
26183
  bottomButtonLabel: t2("SIGN_DOCUMENT"),
26167
26184
  onConfirm: handleButtonClick,
26168
26185
  applicationDetailsData: activeFinanceDetail || financeDetail,
@@ -26172,7 +26189,8 @@ function DocumentSigningDialog({
26172
26189
  financeCalculation,
26173
26190
  t: t2,
26174
26191
  dialogTitle: t2("PDF_PREVIEW_TITLE"),
26175
- showConfirmCheckbox
26192
+ showConfirmCheckbox,
26193
+ pdfOnly: !!signedDocumentJPDF
26176
26194
  }
26177
26195
  )
26178
26196
  ] })