finance-shared 0.0.10 → 0.0.12

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.
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
5
- import { Dialog as Dialog$1, DialogTitle, DialogContent as DialogContent$1, DialogContentText, DialogActions as DialogActions$1, Button as Button$1, IconButton as IconButton$1, Typography as Typography$1, Box as Box$1, Tooltip, Zoom, TextField as TextField$1, Paper as Paper$1, Grid as Grid$1, styled as styled$3, CircularProgress as CircularProgress$1, Autocomplete as Autocomplete$1, Badge, Checkbox as Checkbox$1, Chip as Chip$1, Divider, RadioGroup, FormControlLabel, Radio, Popover as Popover$1 } from "@mui/material";
5
+ import { Dialog as Dialog$1, DialogTitle, DialogContent as DialogContent$1, DialogContentText, DialogActions as DialogActions$1, Button as Button$1, Typography as Typography$1, IconButton as IconButton$1, Box as Box$1, Tooltip, Zoom, TextField as TextField$1, Paper as Paper$1, Grid as Grid$1, styled as styled$3, CircularProgress as CircularProgress$1, Autocomplete as Autocomplete$1, Badge, Checkbox as Checkbox$1, Chip as Chip$1, Divider, RadioGroup, FormControlLabel, Radio, Popover as Popover$1 } from "@mui/material";
6
6
  import * as React from "react";
7
7
  import React__default, { createContext, useContext, useCallback, useState, useRef, useEffect, isValidElement, cloneElement, Children, memo, createElement, useMemo } from "react";
8
8
  import { unstable_createGetCssVar, createSpacing as createSpacing$1, useTheme as useTheme$3, GlobalStyles as GlobalStyles$1, unstable_memoTheme, css, keyframes, styled as styled$2, createBox, darken as darken$1, unstable_resolveBreakpointValues, handleBreakpoints as handleBreakpoints$1, alpha as alpha$1 } from "@mui/system";
@@ -2509,6 +2509,7 @@ const locale$3 = {
2509
2509
  REMARKS: "Remarks",
2510
2510
  REMOVE_FILE: "Remove File",
2511
2511
  NO_REMARKS_ADDED: "No remarks added",
2512
+ NO_REMARK: "No Remark",
2512
2513
  SUPPORT_FILE: "Supported files",
2513
2514
  CREATED_BY: "Added By",
2514
2515
  DELETE: "Delete",
@@ -2540,7 +2541,12 @@ const locale$3 = {
2540
2541
  REFERRAL_DETAIL_REMARKS: "Referral Detail Remarks",
2541
2542
  RELATIVE_DETAIL_REMARKS: "Relative Detail Remarks",
2542
2543
  NEXT_OF_KIN_DETAIL_REMARKS: "Next Of Kin Detail Remarks",
2543
- DOCUMENTS_REMARKS: "Documents Remarks"
2544
+ DOCUMENTS_REMARKS: "Documents Remarks",
2545
+ LOAN_AMOUNT: "Loan Amount",
2546
+ INTEREST_RATE: "Interest Rate",
2547
+ FEES_DEDUCTION: "Fees Deduction",
2548
+ REPAYMENT_AMOUNT: "Repayment Amount",
2549
+ CASH_IN_HAND: "Cash In Hand"
2544
2550
  };
2545
2551
  const locale$2 = {
2546
2552
  CHANGE_DETECT_TITLE: "Adakah anda pasti mahu membuang perubahan?",
@@ -2564,6 +2570,7 @@ const locale$2 = {
2564
2570
  ASSIGN_TO: "Tugaskan Kepada",
2565
2571
  REMARKS: "Kenyataan",
2566
2572
  NO_REMARKS_ADDED: "Tiada komen ditambah",
2573
+ NO_REMARK: "Tiada Catatan",
2567
2574
  SUPPORT_FILE: "Fail yang disokong",
2568
2575
  CREATED_BY: "Ditambah Oleh",
2569
2576
  DELETE: "Padam",
@@ -2595,7 +2602,12 @@ const locale$2 = {
2595
2602
  REFERRAL_DETAIL_REMARKS: "Catatan Perincian Rujukan",
2596
2603
  RELATIVE_DETAIL_REMARKS: "Catatan Perincian Relatif",
2597
2604
  NEXT_OF_KIN_DETAIL_REMARKS: "Ucapan Perincian Keluarga Seterusnya",
2598
- DOCUMENTS_REMARKS: "Documents Remarks"
2605
+ DOCUMENTS_REMARKS: "Documents Remarks",
2606
+ LOAN_AMOUNT: "Jumlah Pinjaman",
2607
+ INTEREST_RATE: "Kadar Faedah",
2608
+ FEES_DEDUCTION: "Potongan Yuran",
2609
+ REPAYMENT_AMOUNT: "Amaun Bayaran Balik",
2610
+ CASH_IN_HAND: "Wang tunai di tangan"
2599
2611
  };
2600
2612
  instance.addResourceBundle("en", "Dialog", locale$3);
2601
2613
  instance.addResourceBundle("ms", "Dialog", locale$2);
@@ -2606,7 +2618,8 @@ const ConfirmDialog = ({
2606
2618
  cancelText,
2607
2619
  okText,
2608
2620
  handleClose,
2609
- handleConfirm
2621
+ handleConfirm,
2622
+ capitalize: capitalize2 = false
2610
2623
  }) => {
2611
2624
  const { t: t2 } = useTranslation("Dialog");
2612
2625
  return /* @__PURE__ */ jsxs(
@@ -2620,8 +2633,8 @@ const ConfirmDialog = ({
2620
2633
  /* @__PURE__ */ jsx(DialogTitle, { id: "alert-dialog-title", children: title }),
2621
2634
  description && /* @__PURE__ */ jsx(DialogContent$1, { children: /* @__PURE__ */ jsx(DialogContentText, { id: "alert-dialog-description", children: description }) }),
2622
2635
  /* @__PURE__ */ jsxs(DialogActions$1, { children: [
2623
- /* @__PURE__ */ jsx(Button$1, { onClick: handleClose, children: cancelText || t2("CANCEL") }),
2624
- /* @__PURE__ */ jsx(Button$1, { onClick: handleConfirm, color: "primary", autoFocus: true, children: okText || t2("OK") })
2636
+ /* @__PURE__ */ jsx(Button$1, { onClick: handleClose, className: capitalize2 ? "capitalize" : "lowercase", children: cancelText || t2("CANCEL") }),
2637
+ /* @__PURE__ */ jsx(Button$1, { onClick: handleConfirm, autoFocus: true, className: capitalize2 ? "capitalize" : "lowercase", children: okText || t2("OK") })
2625
2638
  ] })
2626
2639
  ]
2627
2640
  }
@@ -8285,9 +8298,10 @@ function CustomDialog({
8285
8298
  onClose,
8286
8299
  content,
8287
8300
  size,
8301
+ maxWidth: maxWidth2,
8288
8302
  hideCloseIcon = false
8289
8303
  }) {
8290
- const dialogSize = size || "md";
8304
+ const dialogSize = maxWidth2 !== void 0 ? maxWidth2 : size || "md";
8291
8305
  const handleClose = (_event, reason) => {
8292
8306
  if (hideCloseIcon && reason && reason === "backdropClick") return;
8293
8307
  onClose();
@@ -8302,6 +8316,7 @@ function CustomDialog({
8302
8316
  children: [
8303
8317
  /* @__PURE__ */ jsxs(DialogTitle, { children: [
8304
8318
  content.title,
8319
+ content.description && /* @__PURE__ */ jsx(Typography$1, { variant: "body2", color: "text.secondary", className: "mb-5 text-14 font-400 italic", children: content.description }),
8305
8320
  !hideCloseIcon && /* @__PURE__ */ jsx(
8306
8321
  IconButton$1,
8307
8322
  {
@@ -8630,7 +8645,8 @@ function InfoDialog({
8630
8645
  color: color2 = "inherit",
8631
8646
  isLoading = false,
8632
8647
  t: t2,
8633
- discardText = "Cancel"
8648
+ discardText = "Cancel",
8649
+ buttonDataTestId
8634
8650
  }) {
8635
8651
  const handleClose = (_2, reason) => {
8636
8652
  if (reason && reason === "backdropClick") return;
@@ -8650,7 +8666,15 @@ function InfoDialog({
8650
8666
  }
8651
8667
  ) }),
8652
8668
  /* @__PURE__ */ jsxs(DialogActions$1, { className: "flex flex-col gap-10 pointer-events-auto", children: [
8653
- /* @__PURE__ */ jsx(CustomButton, { onClick: onButtonClick, className: "capitalize", children: isLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, className: "button-progress" }) : buttonText }),
8669
+ /* @__PURE__ */ jsx(
8670
+ CustomButton,
8671
+ {
8672
+ onClick: onButtonClick,
8673
+ className: "capitalize",
8674
+ ...buttonDataTestId && { "data-test-id": buttonDataTestId },
8675
+ children: isLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, className: "button-progress" }) : buttonText
8676
+ }
8677
+ ),
8654
8678
  /* @__PURE__ */ jsx(
8655
8679
  Typography$1,
8656
8680
  {
@@ -20164,7 +20188,7 @@ function setLocalStorageItem(key, value) {
20164
20188
  function removeLocalStorageItem(key) {
20165
20189
  localStorage.removeItem(key);
20166
20190
  }
20167
- function formatAmount({ num, showCurrency = true }) {
20191
+ function formatAmount(num, showCurrency = true) {
20168
20192
  if (num === null || num === void 0 || typeof num !== "number" && isNaN(Number(num))) {
20169
20193
  return showCurrency ? "RM 00.00" : "00.00";
20170
20194
  }
@@ -20183,9 +20207,9 @@ const getSectionTitle = (sectionName) => {
20183
20207
  UserIncomeDetail: "INCOME_DETAIL_REMARKS",
20184
20208
  UserAdditionalInformation: "ADDITONAL_INFORMATION_REMARKS",
20185
20209
  UserExistingFinance: "EXISTING_FINANCE_DETAIL_REMARKS",
20186
- UserReferral: "REFERRAL_DETAIL_REMARKS",
20187
- UserRelative: "RELATIVE_DETAIL_REMARKS",
20188
- UserNextOfKin: "NEXT_OF_KIN_DETAIL_REMARKS",
20210
+ UserReferralDetail: "REFERRAL_DETAIL_REMARKS",
20211
+ UserRelativeDetail: "RELATIVE_DETAIL_REMARKS",
20212
+ UserNextofkin: "NEXT_OF_KIN_DETAIL_REMARKS",
20189
20213
  UserDocuments: "DOCUMENTS_REMARKS"
20190
20214
  };
20191
20215
  return sectionTitleMap[sectionName] || "";
@@ -21704,6 +21728,9 @@ function FuseMessage() {
21704
21728
  );
21705
21729
  }
21706
21730
  const FuseMessage$1 = memo(FuseMessage);
21731
+ const MessageOutlinedIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
21732
+ d: "M4 4h16v12H5.17L4 17.17zm0-2c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm2 10h12v2H6zm0-3h12v2H6zm0-3h12v2H6z"
21733
+ }), "MessageOutlined");
21707
21734
  const PendingActionsIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
21708
21735
  d: "M17 12c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m1.65 7.35L16.5 17.2V14h1v2.79l1.85 1.85zM18 3h-3.18C14.4 1.84 13.3 1 12 1s-2.4.84-2.82 2H6c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h6.11c-.59-.57-1.07-1.25-1.42-2H6V5h2v3h8V5h2v5.08c.71.1 1.38.31 2 .6V5c0-1.1-.9-2-2-2m-6 2c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"
21709
21736
  }), "PendingActions");
@@ -21932,6 +21959,7 @@ const CustomAutocomplete = React.memo(
21932
21959
  getListboxProps = {},
21933
21960
  ref,
21934
21961
  disableClearable = false,
21962
+ optionTestId,
21935
21963
  ...props
21936
21964
  }) => {
21937
21965
  const { t: t2 } = useTranslation("Autocomplete");
@@ -21963,8 +21991,19 @@ const CustomAutocomplete = React.memo(
21963
21991
  }, []);
21964
21992
  const renderOption = React.useCallback((props2, option) => {
21965
21993
  const { key, ...otherProps } = props2;
21966
- return /* @__PURE__ */ createElement("li", { ...otherProps, key: typeof option === "object" ? option.id : option }, typeof option === "object" ? option.label : option);
21967
- }, []);
21994
+ const optionLabel = typeof option === "object" ? option.label : option;
21995
+ const testIdPrefix = optionTestId || "autocomplete-option";
21996
+ const testIdSafeLabel = optionLabel ? String(optionLabel).trim().replace(/\s+/g, "-") : "";
21997
+ return /* @__PURE__ */ createElement(
21998
+ "li",
21999
+ {
22000
+ ...otherProps,
22001
+ key: typeof option === "object" ? option.id : option,
22002
+ "data-test-id": `${testIdPrefix}-${testIdSafeLabel}`
22003
+ },
22004
+ optionLabel
22005
+ );
22006
+ }, [optionTestId]);
21968
22007
  const listboxProps = React.useMemo(() => ({
21969
22008
  onScroll: getListboxProps == null ? void 0 : getListboxProps.onScroll,
21970
22009
  style: {
@@ -27534,6 +27573,7 @@ function useDebounce(callback, delay) {
27534
27573
  const SearchableAutocomplete = memo(
27535
27574
  ({
27536
27575
  dataTestId = "",
27576
+ optionTestId = "autocomplete-option",
27537
27577
  label,
27538
27578
  value,
27539
27579
  variant = "filled",
@@ -27662,6 +27702,7 @@ const SearchableAutocomplete = memo(
27662
27702
  CustomAutocomplete,
27663
27703
  {
27664
27704
  "data-test-id": dataTestId,
27705
+ optionTestId,
27665
27706
  ref,
27666
27707
  label,
27667
27708
  variant,
@@ -27693,6 +27734,7 @@ const MemberAutoComplete = ({
27693
27734
  isTooltipShow = true,
27694
27735
  variant = "filled",
27695
27736
  dataTestId = "",
27737
+ optionTestId = "autocomplete-option",
27696
27738
  tenantId,
27697
27739
  initialSearchTerm = ""
27698
27740
  }) => {
@@ -27736,6 +27778,7 @@ const MemberAutoComplete = ({
27736
27778
  SearchableAutocomplete,
27737
27779
  {
27738
27780
  dataTestId,
27781
+ optionTestId,
27739
27782
  label,
27740
27783
  variant,
27741
27784
  value,
@@ -27757,9 +27800,13 @@ const defaultValues$1 = {
27757
27800
  assignedToUserId: ""
27758
27801
  };
27759
27802
  function RemarksDialog({
27803
+ variant = "simple",
27760
27804
  sectionName,
27805
+ sectionTitle: propSectionTitle,
27761
27806
  financeApplicationId,
27762
27807
  tenantId,
27808
+ remarksList: propRemarksList,
27809
+ onRemarkUpdate,
27763
27810
  permissions = {},
27764
27811
  isApplicationRejected = false,
27765
27812
  ReassignStaffFormComponent,
@@ -27775,7 +27822,7 @@ function RemarksDialog({
27775
27822
  } = permissions;
27776
27823
  const { t: t2 } = useTranslation("Dialog");
27777
27824
  const dispatch = useDispatch();
27778
- const sectionTitle = getSectionTitle(sectionName);
27825
+ const sectionTitle = propSectionTitle || getSectionTitle(sectionName);
27779
27826
  const [open, setOpen] = useState(false);
27780
27827
  const [hasOpened, setHasOpened] = useState(false);
27781
27828
  const [localPendingCount, setLocalPendingCount] = useState(null);
@@ -27784,14 +27831,16 @@ function RemarksDialog({
27784
27831
  remarkId: null,
27785
27832
  remarkDetails: null
27786
27833
  });
27787
- const remarksList = useSelector(getRemarkListData);
27834
+ const reduxRemarksList = useSelector(getRemarkListData);
27788
27835
  const isFormLoading = useSelector(getIsAddRemarkFormLoading);
27836
+ const remarksList = variant === "simple" ? propRemarksList || [] : reduxRemarksList;
27789
27837
  const pendingRemarksCount = remarksList.filter(
27790
- (remark) => !remark.hasActionTaken && remark.sectionName === sectionName
27838
+ (remark) => {
27839
+ const isActionTaken = variant === "simple" ? remark.hasActionTakenByCustomer : remark.hasActionTaken;
27840
+ return !isActionTaken && (variant === "simple" || remark.sectionName === sectionName);
27841
+ }
27791
27842
  ).length;
27792
- const isSectionDataLoaded = !!remarksList.find(
27793
- (remark) => remark.sectionName === sectionName
27794
- );
27843
+ const isSectionDataLoaded = variant === "simple" ? true : !!reduxRemarksList.find((remark) => remark.sectionName === sectionName);
27795
27844
  useEffect(() => {
27796
27845
  if (isSectionDataLoaded) {
27797
27846
  setLocalPendingCount(pendingRemarksCount);
@@ -27828,17 +27877,27 @@ function RemarksDialog({
27828
27877
  name: "remarkType"
27829
27878
  });
27830
27879
  useEffect(() => {
27831
- if (open && financeApplicationId) {
27880
+ if (variant === "full" && open && financeApplicationId) {
27832
27881
  dispatch(getRemarkListByFinanceApplicationId({
27833
27882
  financeApplicationId,
27834
27883
  SectionName: sectionName
27835
27884
  }));
27836
27885
  }
27837
- }, [open, financeApplicationId, sectionName, dispatch]);
27886
+ }, [variant, open, financeApplicationId, sectionName, dispatch]);
27838
27887
  const handleToggleRemark = (index) => {
27839
27888
  const remark = remarksList[index];
27840
- const updatedRemark = { ...remark, hasActionTaken: !remark.hasActionTaken };
27841
- dispatch(updateRemark(updatedRemark));
27889
+ if (variant === "simple") {
27890
+ const updatedRemark = {
27891
+ ...remark,
27892
+ hasActionTakenByCustomer: !remark.hasActionTakenByCustomer
27893
+ };
27894
+ if (onRemarkUpdate) {
27895
+ onRemarkUpdate(updatedRemark);
27896
+ }
27897
+ } else {
27898
+ const updatedRemark = { ...remark, hasActionTaken: !remark.hasActionTaken };
27899
+ dispatch(updateRemark(updatedRemark));
27900
+ }
27842
27901
  };
27843
27902
  const handleOpen = () => {
27844
27903
  setOpen(true);
@@ -27890,19 +27949,25 @@ function RemarksDialog({
27890
27949
  }
27891
27950
  };
27892
27951
  return /* @__PURE__ */ jsxs(Fragment, { children: [
27893
- /* @__PURE__ */ jsx(Badge, { badgeContent: displayCount, color: "error", children: /* @__PURE__ */ jsx(
27894
- Button$1,
27895
- {
27896
- "data-test-id": dataTestId,
27897
- className: "rounded",
27898
- variant: "contained",
27899
- size: "small",
27900
- startIcon: /* @__PURE__ */ jsx(PendingActionsIcon, {}),
27901
- onClick: handleOpen,
27902
- sx: remarksButtonStyle,
27903
- children: t2("REMARKS")
27904
- }
27905
- ) }),
27952
+ variant === "simple" ? (
27953
+ // Simple variant: Icon button trigger
27954
+ remarksList.length > 0 && /* @__PURE__ */ jsx(IconButton$1, { onClick: handleOpen, className: "m-0 p-3", children: /* @__PURE__ */ jsx(Badge, { badgeContent: remarksList.length, color: "error", className: "text-white", children: /* @__PURE__ */ jsx(MessageOutlinedIcon, { color: "warning" }) }) })
27955
+ ) : (
27956
+ // Full variant: Button trigger
27957
+ /* @__PURE__ */ jsx(Badge, { badgeContent: displayCount, color: "error", children: /* @__PURE__ */ jsx(
27958
+ Button$1,
27959
+ {
27960
+ "data-test-id": dataTestId,
27961
+ className: "rounded",
27962
+ variant: "contained",
27963
+ size: "small",
27964
+ startIcon: /* @__PURE__ */ jsx(PendingActionsIcon, {}),
27965
+ onClick: handleOpen,
27966
+ sx: remarksButtonStyle,
27967
+ children: t2("REMARKS")
27968
+ }
27969
+ ) })
27970
+ ),
27906
27971
  /* @__PURE__ */ jsxs(
27907
27972
  Dialog$1,
27908
27973
  {
@@ -27932,99 +27997,103 @@ function RemarksDialog({
27932
27997
  )
27933
27998
  ] }),
27934
27999
  /* @__PURE__ */ jsxs(DialogContent$1, { children: [
27935
- canViewRemarks && ((remarksList == null ? void 0 : remarksList.length) === 0 ? /* @__PURE__ */ jsx(Typography$1, { variant: "body1", align: "center", className: "mb-8", children: t2("NO_REMARKS_ADDED") }) : remarksList == null ? void 0 : remarksList.map((remark, index) => /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
27936
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
28000
+ canViewRemarks && ((remarksList == null ? void 0 : remarksList.length) === 0 ? /* @__PURE__ */ jsx(Typography$1, { variant: "body1", align: "center", className: "mb-8", children: variant === "simple" ? t2("NO_REMARK") : t2("NO_REMARKS_ADDED") }) : remarksList == null ? void 0 : remarksList.map((remark, index) => {
28001
+ const isChecked = variant === "simple" ? remark.hasActionTakenByCustomer : remark.hasActionTaken;
28002
+ return /* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
27937
28003
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
27938
- canToggleAction && /* @__PURE__ */ jsx(
27939
- Tooltip,
28004
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
28005
+ canToggleAction && /* @__PURE__ */ jsx(
28006
+ Tooltip,
28007
+ {
28008
+ title: isApplicationRejected ? t2("REJECTED_TOOLTIP") : "",
28009
+ children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
28010
+ Checkbox$1,
28011
+ {
28012
+ checked: isChecked,
28013
+ onChange: () => handleToggleRemark(index),
28014
+ disabled: isApplicationRejected
28015
+ }
28016
+ ) })
28017
+ }
28018
+ ),
28019
+ /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx(Typography$1, { variant: "body1", children: isChecked ? /* @__PURE__ */ jsx("s", { children: remark.remark }) : remark.remark }) })
28020
+ ] }),
28021
+ variant === "full" && /* @__PURE__ */ jsx("div", { className: "ml-10", children: /* @__PURE__ */ jsx(
28022
+ Chip$1,
27940
28023
  {
27941
- title: isApplicationRejected ? t2("REJECTED_TOOLTIP") : "",
27942
- children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
27943
- Checkbox$1,
27944
- {
27945
- checked: remark.hasActionTaken,
27946
- onChange: () => handleToggleRemark(index),
27947
- disabled: isApplicationRejected
27948
- }
27949
- ) })
28024
+ sx: {
28025
+ backgroundColor: (remark == null ? void 0 : remark.remarkType) === "Internal" ? themesConfig.internalChipBg || "#90EE90" : themesConfig.externalChipBg || "#87CEEB"
28026
+ },
28027
+ size: "small",
28028
+ label: remark.remarkType
27950
28029
  }
27951
- ),
27952
- /* @__PURE__ */ jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsx(Typography$1, { variant: "body1", children: remark.remark }) })
28030
+ ) })
27953
28031
  ] }),
27954
- /* @__PURE__ */ jsx("div", { className: "ml-10", children: /* @__PURE__ */ jsx(
27955
- Chip$1,
28032
+ variant === "full" && /* @__PURE__ */ jsxs(
28033
+ "div",
27956
28034
  {
27957
- sx: {
27958
- backgroundColor: (remark == null ? void 0 : remark.remarkType) === "Internal" ? themesConfig.internalChipBg || "#90EE90" : themesConfig.externalChipBg || "#87CEEB"
27959
- },
27960
- size: "small",
27961
- label: remark.remarkType
27962
- }
27963
- ) })
27964
- ] }),
27965
- /* @__PURE__ */ jsxs(
27966
- "div",
27967
- {
27968
- className: `flex items-center justify-between ${!canToggleAction ? "ml-40" : ""} mb-10`,
27969
- children: [
27970
- (remark == null ? void 0 : remark.createdBy) && /* @__PURE__ */ jsxs(
27971
- Typography$1,
27972
- {
27973
- variant: "body2",
27974
- className: "italic text-sm text-grey-700",
27975
- children: [
27976
- t2("CREATED_BY"),
27977
- " : ",
27978
- remark == null ? void 0 : remark.createdBy
27979
- ]
27980
- }
27981
- ),
27982
- (remark == null ? void 0 : remark.assignedToUserName) && /* @__PURE__ */ jsxs(
27983
- Typography$1,
27984
- {
27985
- variant: "body2",
27986
- className: "italic text-sm text-grey-700",
27987
- children: [
27988
- t2("ASSIGN_TO"),
27989
- " : ",
27990
- remark.assignedToUserName,
27991
- ReassignStaffFormComponent && /* @__PURE__ */ jsx(
27992
- IconButton$1,
27993
- {
27994
- onClick: (event) => handleReassignStaffMember(event, remark),
27995
- size: "small",
27996
- children: /* @__PURE__ */ jsx(EditIcon, { fontSize: "small" })
27997
- }
27998
- )
27999
- ]
28000
- }
28001
- ),
28002
- ReassignStaffFormComponent && (popoverState == null ? void 0 : popoverState.remarkDetails) && /* @__PURE__ */ jsx(
28003
- ReassignStaffFormComponent,
28004
- {
28005
- open: popoverState.remarkId === remark.id,
28006
- anchorEl: popoverState.anchorEl,
28007
- onClose: handleCloseReassignStaffMemberPopover,
28008
- remarkDetails: popoverState.remarkDetails,
28009
- onReassign: (remarkId, newUserId) => {
28010
- dispatch(reassignStaffMember(remarkId, newUserId, remarksList));
28035
+ className: `flex items-center justify-between ${!canToggleAction ? "ml-40" : ""} mb-10`,
28036
+ children: [
28037
+ (remark == null ? void 0 : remark.createdBy) && /* @__PURE__ */ jsxs(
28038
+ Typography$1,
28039
+ {
28040
+ variant: "body2",
28041
+ className: "italic text-sm text-grey-700",
28042
+ children: [
28043
+ t2("CREATED_BY"),
28044
+ " : ",
28045
+ remark == null ? void 0 : remark.createdBy
28046
+ ]
28011
28047
  }
28012
- }
28013
- ),
28014
- /* @__PURE__ */ jsx(
28015
- Typography$1,
28016
- {
28017
- variant: "body2",
28018
- className: "italic ml-2 text-sm text-grey-700",
28019
- children: remark.created
28020
- }
28021
- )
28022
- ]
28023
- }
28024
- ),
28025
- /* @__PURE__ */ jsx(Divider, {})
28026
- ] }, remark.id))),
28027
- canCreateRemark && !isApplicationRejected && /* @__PURE__ */ jsxs(Paper$1, { elevation: 3, className: "p-20 mt-20", children: [
28048
+ ),
28049
+ (remark == null ? void 0 : remark.assignedToUserName) && /* @__PURE__ */ jsxs(
28050
+ Typography$1,
28051
+ {
28052
+ variant: "body2",
28053
+ className: "italic text-sm text-grey-700",
28054
+ children: [
28055
+ t2("ASSIGN_TO"),
28056
+ " : ",
28057
+ remark.assignedToUserName,
28058
+ ReassignStaffFormComponent && /* @__PURE__ */ jsx(
28059
+ IconButton$1,
28060
+ {
28061
+ onClick: (event) => handleReassignStaffMember(event, remark),
28062
+ size: "small",
28063
+ children: /* @__PURE__ */ jsx(EditIcon, { fontSize: "small" })
28064
+ }
28065
+ )
28066
+ ]
28067
+ }
28068
+ ),
28069
+ ReassignStaffFormComponent && (popoverState == null ? void 0 : popoverState.remarkDetails) && /* @__PURE__ */ jsx(
28070
+ ReassignStaffFormComponent,
28071
+ {
28072
+ open: popoverState.remarkId === remark.id,
28073
+ anchorEl: popoverState.anchorEl,
28074
+ onClose: handleCloseReassignStaffMemberPopover,
28075
+ remarkDetails: popoverState.remarkDetails,
28076
+ onReassign: (remarkId, newUserId) => {
28077
+ dispatch(reassignStaffMember(remarkId, newUserId, remarksList));
28078
+ }
28079
+ }
28080
+ ),
28081
+ /* @__PURE__ */ jsx(
28082
+ Typography$1,
28083
+ {
28084
+ variant: "body2",
28085
+ className: "italic ml-2 text-sm text-grey-700",
28086
+ children: remark.created
28087
+ }
28088
+ )
28089
+ ]
28090
+ }
28091
+ ),
28092
+ variant === "simple" && remark.created && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Typography$1, { variant: "body2", className: "ml-auto", children: remark.created }) }),
28093
+ /* @__PURE__ */ jsx(Divider, {})
28094
+ ] }, remark.id);
28095
+ })),
28096
+ variant === "full" && canCreateRemark && !isApplicationRejected && /* @__PURE__ */ jsxs(Paper$1, { elevation: 3, className: "p-20 mt-20", children: [
28028
28097
  /* @__PURE__ */ jsx(Typography$1, { variant: "h5", gutterBottom: true, children: t2("ADD_REMARK") }),
28029
28098
  /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit(onSubmit), children: /* @__PURE__ */ jsxs(Grid$1, { container: true, justifyContent: "space-between", spacing: 2, children: [
28030
28099
  /* @__PURE__ */ jsxs(Grid$1, { item: true, xs: 12, md: 6, children: [
@@ -28227,12 +28296,14 @@ const CommonStatusChangeDialog = ({
28227
28296
  );
28228
28297
  };
28229
28298
  function shouldShowButton(loginUserDetail, loginUserRoles2, applicationDetailsData) {
28230
- var _a, _b, _c, _d;
28299
+ var _a, _b, _c, _d, _e, _f;
28231
28300
  const isAdmin = ((_a = loginUserDetail == null ? void 0 : loginUserDetail.data) == null ? void 0 : _a.slug) === loginUserRoles2.Admin;
28232
28301
  const isLawyer = ((_b = loginUserDetail == null ? void 0 : loginUserDetail.data) == null ? void 0 : _b.slug) === loginUserRoles2.Lawyer;
28233
- const isAdminNotSigned = !((_c = applicationDetailsData == null ? void 0 : applicationDetailsData.digitalSignatureDetails) == null ? void 0 : _c.isAdminSinged);
28234
- const isLawyerNotSigned = !((_d = applicationDetailsData == null ? void 0 : applicationDetailsData.digitalSignatureDetails) == null ? void 0 : _d.isLawyerSinged);
28235
- return isAdmin && isAdminNotSigned || isLawyer && isLawyerNotSigned;
28302
+ const isUser = ((_c = loginUserDetail == null ? void 0 : loginUserDetail.data) == null ? void 0 : _c.slug) === loginUserRoles2.User;
28303
+ const isAdminNotSigned = !((_d = applicationDetailsData == null ? void 0 : applicationDetailsData.digitalSignatureDetails) == null ? void 0 : _d.isAdminSinged);
28304
+ const isLawyerNotSigned = !((_e = applicationDetailsData == null ? void 0 : applicationDetailsData.digitalSignatureDetails) == null ? void 0 : _e.isLawyerSinged);
28305
+ const isCustomerNotSigned = !((_f = applicationDetailsData == null ? void 0 : applicationDetailsData.digitalSignatureDetails) == null ? void 0 : _f.isCustomerSinged);
28306
+ return isAdmin && isAdminNotSigned || isLawyer && isLawyerNotSigned || isUser && isCustomerNotSigned;
28236
28307
  }
28237
28308
  const PDFPreviewForTheSignature = ({
28238
28309
  filePath,
@@ -28244,43 +28315,91 @@ const PDFPreviewForTheSignature = ({
28244
28315
  applicationDetailsData,
28245
28316
  loginUserDetail,
28246
28317
  loginUserRoles: loginUserRoles2,
28247
- ColoredSubmitButton
28318
+ ColoredSubmitButton,
28319
+ financeCalculation,
28320
+ t: t2 = (key) => key
28248
28321
  }) => {
28249
28322
  const showButton = shouldShowButton(
28250
28323
  loginUserDetail,
28251
28324
  loginUserRoles2,
28252
28325
  applicationDetailsData
28253
28326
  );
28254
- return /* @__PURE__ */ jsx(Dialog$1, { open, onClose, maxWidth: "lg", fullWidth: true, children: /* @__PURE__ */ jsxs(DialogContent$1, { className: "p-0 h-[80vh]", children: [
28327
+ return /* @__PURE__ */ jsx(Dialog$1, { open, onClose, maxWidth: "lg", fullWidth: true, children: /* @__PURE__ */ jsxs(DialogContent$1, { className: "p-0", children: [
28255
28328
  /* @__PURE__ */ jsx(
28256
28329
  "embed",
28257
28330
  {
28258
28331
  src: filePath,
28259
28332
  type: "application/pdf",
28260
28333
  width: "100%",
28261
- height: "100%"
28334
+ style: { height: "80vh" }
28262
28335
  }
28263
28336
  ),
28264
- showButton && /* @__PURE__ */ jsx("div", { className: "sticky bottom-0 bg-white w-full border-t-1 border-solid border-grey-500 px-10 py-10 text-end", children: /* @__PURE__ */ jsx(
28265
- ColoredSubmitButton,
28266
- {
28267
- variant: "contained",
28268
- disabled: isButtonLoading,
28269
- onClick: onConfirm,
28270
- isLoading: isButtonLoading,
28271
- className: "rounded-6",
28272
- text: bottomButtonLabel
28273
- }
28274
- ) })
28337
+ showButton && /* @__PURE__ */ jsxs("div", { className: "sticky bottom-0 bg-white w-full border-t-1 border-solid border-grey-500 px-10 py-10 text-end", children: [
28338
+ financeCalculation && /* @__PURE__ */ jsxs(Grid$1, { container: true, spacing: 2, children: [
28339
+ /* @__PURE__ */ jsx(Grid$1, { item: true, xs: 12, sm: 12, md: 4, className: "flex justify-start", children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body1", children: [
28340
+ /* @__PURE__ */ jsxs("strong", { children: [
28341
+ t2("LOAN_AMOUNT"),
28342
+ ": "
28343
+ ] }),
28344
+ formatAmount(financeCalculation == null ? void 0 : financeCalculation.loanAmount)
28345
+ ] }) }),
28346
+ /* @__PURE__ */ jsx(Grid$1, { item: true, xs: 12, sm: 12, md: 4, className: "flex justify-start", children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body1", children: [
28347
+ /* @__PURE__ */ jsxs("strong", { children: [
28348
+ t2("INTEREST_RATE"),
28349
+ ": "
28350
+ ] }),
28351
+ formatAmount(financeCalculation == null ? void 0 : financeCalculation.interestFees)
28352
+ ] }) }),
28353
+ /* @__PURE__ */ jsx(Grid$1, { item: true, xs: 12, sm: 12, md: 4, className: "flex justify-start", children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body1", children: [
28354
+ /* @__PURE__ */ jsxs("strong", { children: [
28355
+ t2("FEES_DEDUCTION"),
28356
+ ": "
28357
+ ] }),
28358
+ formatAmount(financeCalculation == null ? void 0 : financeCalculation.feesDeduction)
28359
+ ] }) }),
28360
+ /* @__PURE__ */ jsx(Grid$1, { item: true, xs: 12, sm: 12, md: 4, className: "flex justify-start", children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body1", children: [
28361
+ /* @__PURE__ */ jsxs("strong", { children: [
28362
+ t2("REPAYMENT_AMOUNT"),
28363
+ ": "
28364
+ ] }),
28365
+ formatAmount(financeCalculation == null ? void 0 : financeCalculation.repaymentAmount)
28366
+ ] }) }),
28367
+ /* @__PURE__ */ jsx(Grid$1, { item: true, xs: 12, sm: 12, md: 4, className: "flex justify-start", children: /* @__PURE__ */ jsxs(Typography$1, { variant: "body1", children: [
28368
+ /* @__PURE__ */ jsxs("strong", { children: [
28369
+ t2("CASH_IN_HAND"),
28370
+ ": "
28371
+ ] }),
28372
+ formatAmount(financeCalculation == null ? void 0 : financeCalculation.cashInHand)
28373
+ ] }) })
28374
+ ] }),
28375
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end mt-10", children: /* @__PURE__ */ jsx(
28376
+ ColoredSubmitButton,
28377
+ {
28378
+ variant: "contained",
28379
+ disabled: isButtonLoading,
28380
+ onClick: onConfirm,
28381
+ isLoading: isButtonLoading,
28382
+ className: "rounded-6",
28383
+ text: bottomButtonLabel
28384
+ }
28385
+ ) })
28386
+ ] })
28275
28387
  ] }) });
28276
28388
  };
28277
- const CustomCheckbox = ({ label, onChange, ...props }) => {
28278
- const [checked, setChecked] = React__default.useState(false);
28279
- const handleChange = (isChecked) => {
28280
- setChecked(isChecked);
28281
- if (onChange) {
28282
- onChange(isChecked);
28389
+ const CustomCheckbox = ({
28390
+ label,
28391
+ onChange,
28392
+ checked: controlledChecked,
28393
+ ...props
28394
+ }) => {
28395
+ const [internalChecked, setInternalChecked] = React__default.useState(false);
28396
+ const isControlled = controlledChecked !== void 0;
28397
+ const isChecked = isControlled ? controlledChecked : internalChecked;
28398
+ const handleChange = (newChecked) => {
28399
+ if (!isControlled) {
28400
+ setInternalChecked(newChecked);
28283
28401
  }
28402
+ onChange == null ? void 0 : onChange(newChecked);
28284
28403
  };
28285
28404
  return /* @__PURE__ */ jsx(Fragment, { children: label ? /* @__PURE__ */ jsx(
28286
28405
  FormControlLabel,
@@ -28288,7 +28407,7 @@ const CustomCheckbox = ({ label, onChange, ...props }) => {
28288
28407
  control: /* @__PURE__ */ jsx(
28289
28408
  Checkbox$1,
28290
28409
  {
28291
- checked,
28410
+ checked: isChecked,
28292
28411
  onChange: (event) => handleChange(event.target.checked),
28293
28412
  ...props
28294
28413
  }
@@ -28298,30 +28417,40 @@ const CustomCheckbox = ({ label, onChange, ...props }) => {
28298
28417
  ) : /* @__PURE__ */ jsx(
28299
28418
  Checkbox$1,
28300
28419
  {
28301
- checked,
28420
+ checked: isChecked,
28302
28421
  onChange: (event) => handleChange(event.target.checked),
28303
28422
  ...props
28304
28423
  }
28305
28424
  ) });
28306
28425
  };
28426
+ instance.addResourceBundle("en", "Dialog", locale$3);
28427
+ instance.addResourceBundle("ms", "Dialog", locale$2);
28307
28428
  function DocumentSigningDialog({
28308
28429
  financeDetail,
28309
28430
  loginUserDetail,
28310
28431
  digitalSignatureRole,
28311
- ColoredSubmitButton
28432
+ ColoredSubmitButton,
28433
+ financeCalculation
28312
28434
  }) {
28313
28435
  const { t: t2 } = useTranslation("Dialog");
28314
28436
  const open = useSelector(getIsDocumentSignatureDialogOpen);
28315
28437
  const documentSignJPDF = useSelector(getDocumentSignJPDF);
28316
28438
  const isProcessSignatureLoading = useSelector(getIsProcessSignatureLoading);
28439
+ const activeFinanceDetail = useSelector(getActiveFinanceDetail);
28317
28440
  const dispatch = useDispatch();
28318
28441
  const onClose = () => {
28319
28442
  dispatch(setIsDocumentSignatureDialogOpen(false));
28320
28443
  };
28321
28444
  const handleButtonClick = () => {
28445
+ let signatureRole = digitalSignatureRole.User;
28446
+ if (loginUserDetail.data.slug === loginUserRoles.Admin) {
28447
+ signatureRole = digitalSignatureRole.Admin;
28448
+ } else if (loginUserDetail.data.slug === loginUserRoles.Lawyer) {
28449
+ signatureRole = digitalSignatureRole.Lawyer;
28450
+ }
28322
28451
  const request_data = {
28323
28452
  FinanceApplicationId: financeDetail.id,
28324
- SignatureRole: loginUserDetail.data.slug === loginUserRoles.Admin ? digitalSignatureRole.Admin : digitalSignatureRole.Lawyer
28453
+ SignatureRole: signatureRole
28325
28454
  };
28326
28455
  dispatch(DigitalProcessSignature(request_data));
28327
28456
  };
@@ -28428,10 +28557,12 @@ function DocumentSigningDialog({
28428
28557
  onClose: () => handlePDFPreviewClose(),
28429
28558
  bottomButtonLabel: t2("SIGN_DOCUMENT"),
28430
28559
  onConfirm: handleButtonClick,
28431
- applicationDetailsData: financeDetail,
28560
+ applicationDetailsData: activeFinanceDetail || financeDetail,
28432
28561
  loginUserDetail,
28433
28562
  loginUserRoles,
28434
- ColoredSubmitButton
28563
+ ColoredSubmitButton,
28564
+ financeCalculation,
28565
+ t: t2
28435
28566
  }
28436
28567
  )
28437
28568
  ] })
@@ -57287,31 +57418,69 @@ const CustomDatePicker = ({
57287
57418
  minDate,
57288
57419
  disabled = false,
57289
57420
  required = false,
57290
- locale: locale$12 = locale
57421
+ locale: locale$12 = locale,
57422
+ dataTestId,
57423
+ iconColor,
57424
+ open,
57425
+ anchorEl,
57426
+ onClose,
57427
+ hideTextField = false,
57428
+ applyCustomStyling = false,
57429
+ style: style2
57291
57430
  }) => {
57292
- return /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: locale$12, children: /* @__PURE__ */ jsx(
57293
- DatePicker,
57294
- {
57295
- value,
57296
- onChange,
57297
- maxDate,
57298
- minDate,
57299
- disabled,
57300
- className: "w-full",
57301
- slotProps: {
57302
- actionBar: {
57303
- actions: ["clear", "cancel"]
57431
+ const conditionalStyling = applyCustomStyling && style2 ? {
57432
+ ...style2,
57433
+ "& .MuiFilledInput-root": {
57434
+ backgroundColor: "#ffffff"
57435
+ }
57436
+ } : style2 || {};
57437
+ const datePickerProps = {
57438
+ value,
57439
+ onChange,
57440
+ maxDate,
57441
+ minDate,
57442
+ disabled,
57443
+ className: "w-full",
57444
+ sx: {
57445
+ "& .MuiSvgIcon-root": {
57446
+ color: iconColor
57447
+ }
57448
+ },
57449
+ slotProps: {
57450
+ actionBar: {
57451
+ actions: ["clear", "cancel"]
57452
+ },
57453
+ textField: hideTextField ? { sx: { display: "none" } } : {
57454
+ label,
57455
+ variant,
57456
+ error: !!error,
57457
+ helperText: error || "",
57458
+ required,
57459
+ inputProps: {
57460
+ "data-test-id": dataTestId
57304
57461
  },
57305
- textField: {
57306
- label,
57307
- variant,
57308
- error: !!error,
57309
- helperText: error || "",
57310
- required
57311
- }
57462
+ sx: conditionalStyling
57312
57463
  }
57313
57464
  }
57314
- ) });
57465
+ };
57466
+ if (hideTextField) {
57467
+ datePickerProps.open = open;
57468
+ datePickerProps.onClose = onClose;
57469
+ datePickerProps.slotProps.popper = {
57470
+ anchorEl,
57471
+ placement: "top-start"
57472
+ };
57473
+ }
57474
+ return /* @__PURE__ */ jsx(
57475
+ Tooltip,
57476
+ {
57477
+ title: label,
57478
+ arrow: true,
57479
+ TransitionComponent: Zoom,
57480
+ placement: "top-start",
57481
+ children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: locale$12, children: /* @__PURE__ */ jsx(DatePicker, { ...datePickerProps }) }) })
57482
+ }
57483
+ );
57315
57484
  };
57316
57485
  const defaultConfig = {
57317
57486
  apiUrl: "",
@@ -57357,6 +57526,7 @@ export {
57357
57526
  CommonTextField,
57358
57527
  ConfirmDialog,
57359
57528
  CustomAutocomplete,
57529
+ CustomCheckbox,
57360
57530
  CustomDatePicker,
57361
57531
  CustomDialog,
57362
57532
  CustomPopover,
@@ -57375,6 +57545,7 @@ export {
57375
57545
  PdfDialog,
57376
57546
  PreviewMedia,
57377
57547
  RemarksDialog,
57548
+ SaveButton,
57378
57549
  SearchableAutocomplete,
57379
57550
  TenantAutocomplete,
57380
57551
  addSectionWiseRemark,