finance-shared 0.0.16 → 0.0.18

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.
@@ -81,12 +81,13 @@ const locale$3 = {
81
81
  DOCUMENTS_REMARKS: "Documents Remarks",
82
82
  LOAN_AMOUNT: "Loan Amount",
83
83
  INTEREST_RATE: "Interest Rate",
84
- INTEREST_FEES: "Interest Fees",
85
- REPAYMENT_AMOUNT: "Repayment Amount",
84
+ INTEREST_FEES: "Total Interest",
85
+ REPAYMENT_AMOUNT: "Monthly Installment",
86
+ PRINCIPLE_PLUS_INTEREST: "Principal + Interest",
86
87
  DISBURSEMENT: "Disbursement",
87
88
  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
89
  PDF_PREVIEW_TITLE: "Summary of loan application",
89
- TOTAL_INTEREST_RATE: "Total Interest Rate",
90
+ TOTAL_INTEREST_RATE: "Interest Rate",
90
91
  DURATION: "Duration",
91
92
  STAMP_DUTY: "Stamp Duty",
92
93
  LEGAL_FEES: "Legal Fees",
@@ -149,12 +150,13 @@ const locale$2 = {
149
150
  DOCUMENTS_REMARKS: "Documents Remarks",
150
151
  LOAN_AMOUNT: "Jumlah Pinjaman",
151
152
  INTEREST_RATE: "Kadar Faedah",
152
- INTEREST_FEES: "Yuran Faedah",
153
- REPAYMENT_AMOUNT: "Amaun Bayaran Balik",
153
+ INTEREST_FEES: "Jumlah Faedah",
154
+ REPAYMENT_AMOUNT: "Ansuran Bulanan",
155
+ PRINCIPLE_PLUS_INTEREST: "Prinsipal + Faedah",
154
156
  DISBURSEMENT: "Pengeluaran",
155
157
  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
158
  PDF_PREVIEW_TITLE: "Ringkasan permohonan pinjaman",
157
- TOTAL_INTEREST_RATE: "Jumlah Kadar Faedah",
159
+ TOTAL_INTEREST_RATE: "Kadar Faedah",
158
160
  DURATION: "Tempoh",
159
161
  STAMP_DUTY: "Duti Setem",
160
162
  LEGAL_FEES: "Yuran Guaman",
@@ -25189,27 +25191,20 @@ const SearchableAutocomplete = memo(
25189
25191
  });
25190
25192
  }
25191
25193
  }, []);
25192
- const fetchDebouncedOptions = useCallback(
25193
- useDebounce(async (search) => {
25194
- setLoading2(true);
25195
- try {
25196
- const results = await fetchOptions(search, 0);
25197
- setOptions(results);
25198
- } catch (err) {
25199
- console.error("Error fetching options:", err);
25200
- } finally {
25201
- setLoading2(false);
25202
- }
25203
- }, 1e3),
25204
- [fetchOptions]
25205
- );
25194
+ const fetchDebouncedOptions = useDebounce(async (search) => {
25195
+ setLoading2(true);
25196
+ try {
25197
+ const results = await fetchOptions(search, 0);
25198
+ setOptions(results);
25199
+ } catch (err) {
25200
+ console.error("Error fetching options:", err);
25201
+ } finally {
25202
+ setLoading2(false);
25203
+ }
25204
+ }, 1e3);
25206
25205
  useEffect(() => {
25207
25206
  if (isTyping) {
25208
- if (searchTerm) {
25209
- fetchDebouncedOptions(searchTerm);
25210
- } else {
25211
- fetchDebouncedOptions("");
25212
- }
25207
+ fetchDebouncedOptions(searchTerm || "");
25213
25208
  }
25214
25209
  }, [searchTerm, isTyping, fetchDebouncedOptions]);
25215
25210
  const loadMoreOptions = useCallback(async () => {
@@ -25253,10 +25248,12 @@ const SearchableAutocomplete = memo(
25253
25248
  }
25254
25249
  }
25255
25250
  }, [onChange, fetchOptions]);
25256
- const handleInputChange = useCallback((_event, inputValue) => {
25257
- setSearchTerm(inputValue);
25258
- setIsTyping(true);
25259
- setPageIndex(0);
25251
+ const handleInputChange = useCallback((_event, inputValue, reason) => {
25252
+ if (reason === "input") {
25253
+ setSearchTerm(inputValue);
25254
+ setIsTyping(true);
25255
+ setPageIndex(0);
25256
+ }
25260
25257
  }, []);
25261
25258
  const listboxProps = useMemo(() => ({
25262
25259
  onScroll: handleScroll
@@ -25307,30 +25304,26 @@ const MemberAutoComplete = ({
25307
25304
  const dispatch = useDispatch();
25308
25305
  const loading = useSelector(getIsUserListLoading);
25309
25306
  const pagination = useSelector(getUserListPaginationData);
25310
- const [hasMoreData, setHasMoreData] = useState(true);
25307
+ const hasMoreDataRef = useRef(true);
25311
25308
  useEffect(() => {
25312
25309
  return () => {
25313
25310
  dispatch(setUserSearchKeyword(""));
25314
25311
  dispatch(setUserListPagination({ pageIndex: 0 }));
25315
- setHasMoreData(true);
25312
+ hasMoreDataRef.current = true;
25316
25313
  };
25317
25314
  }, [dispatch]);
25318
- const handleOptionChange = (value2) => {
25315
+ const handleOptionChange = useCallback((value2) => {
25319
25316
  onChange(value2);
25320
25317
  dispatch(setIsUserListLoading(false));
25321
- };
25322
- const fetchUserOptions = async (searchTerm, pageIndex) => {
25323
- if (pageIndex > 0 && !hasMoreData) {
25324
- return [];
25325
- }
25318
+ }, [onChange, dispatch]);
25319
+ const fetchUserOptions = useCallback(async (searchTerm, pageIndex) => {
25320
+ if (pageIndex > 0 && !hasMoreDataRef.current) return [];
25326
25321
  dispatch(setUserSearchKeyword(searchTerm));
25327
25322
  dispatch(setUserListPagination({ pageIndex }));
25328
25323
  const newOptions = await dispatch(getUserList(roleIds, tenantId, pageIndex, searchTerm));
25329
- if (!newOptions || Array.isArray(newOptions) && newOptions.length === 0) {
25330
- setHasMoreData(false);
25331
- if (pageIndex > 0) {
25332
- return [];
25333
- }
25324
+ if (!newOptions || newOptions.length === 0) {
25325
+ hasMoreDataRef.current = false;
25326
+ if (pageIndex > 0) return [];
25334
25327
  }
25335
25328
  return (newOptions == null ? void 0 : newOptions.map((item) => {
25336
25329
  var _a, _b;
@@ -25339,7 +25332,7 @@ const MemberAutoComplete = ({
25339
25332
  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
25340
25333
  };
25341
25334
  })) || [];
25342
- };
25335
+ }, [dispatch, roleIds, tenantId]);
25343
25336
  return /* @__PURE__ */ jsx(
25344
25337
  SearchableAutocomplete,
25345
25338
  {
@@ -25950,7 +25943,7 @@ const PDFPreviewForTheSignature = ({
25950
25943
  ": "
25951
25944
  ] }),
25952
25945
  financeCalculation.totalInterestRate,
25953
- " %"
25946
+ "% p.a."
25954
25947
  ] }) }),
25955
25948
  financeCalculation.interestFees !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
25956
25949
  /* @__PURE__ */ jsxs("strong", { children: [
@@ -25959,6 +25952,13 @@ const PDFPreviewForTheSignature = ({
25959
25952
  ] }),
25960
25953
  formatAmount(financeCalculation.interestFees)
25961
25954
  ] }) }),
25955
+ financeCalculation.principalPlusInterest !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
25956
+ /* @__PURE__ */ jsxs("strong", { children: [
25957
+ t2("PRINCIPLE_PLUS_INTEREST"),
25958
+ ": "
25959
+ ] }),
25960
+ formatAmount(financeCalculation.principalPlusInterest)
25961
+ ] }) }),
25962
25962
  financeCalculation.repaymentAmount !== void 0 && /* @__PURE__ */ jsx(Grid2, { size: { xs: 12, sm: 4 }, children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body2", children: [
25963
25963
  /* @__PURE__ */ jsxs("strong", { children: [
25964
25964
  t2("REPAYMENT_AMOUNT"),