finance-shared 0.0.5 → 0.0.6
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.
|
@@ -12921,6 +12921,10 @@ const getImagePath = (state) => {
|
|
|
12921
12921
|
var _a;
|
|
12922
12922
|
return ((_a = state.dialogs) == null ? void 0 : _a.imagePath) || "";
|
|
12923
12923
|
};
|
|
12924
|
+
const getSelectedMediaFilePath = (state) => {
|
|
12925
|
+
var _a;
|
|
12926
|
+
return ((_a = state.dialogs) == null ? void 0 : _a.selectedMediaFilePath) || "";
|
|
12927
|
+
};
|
|
12924
12928
|
const initialState$1 = {
|
|
12925
12929
|
loading: {
|
|
12926
12930
|
isDeleteUserDialogOpen: false,
|
|
@@ -12940,7 +12944,8 @@ const initialState$1 = {
|
|
|
12940
12944
|
remarksList: [],
|
|
12941
12945
|
documentSignJPDF: "",
|
|
12942
12946
|
activeFinanceDetail: null,
|
|
12943
|
-
imagePath: ""
|
|
12947
|
+
imagePath: "",
|
|
12948
|
+
selectedMediaFilePath: ""
|
|
12944
12949
|
};
|
|
12945
12950
|
const dialogsSlice = createSlice({
|
|
12946
12951
|
name: "dialogs",
|
|
@@ -12964,6 +12969,9 @@ const dialogsSlice = createSlice({
|
|
|
12964
12969
|
},
|
|
12965
12970
|
setImagePath: (state, action) => {
|
|
12966
12971
|
state.imagePath = action.payload;
|
|
12972
|
+
},
|
|
12973
|
+
setSelectedMediaFilePath: (state, action) => {
|
|
12974
|
+
state.selectedMediaFilePath = action.payload;
|
|
12967
12975
|
}
|
|
12968
12976
|
}
|
|
12969
12977
|
});
|
|
@@ -12972,7 +12980,8 @@ const {
|
|
|
12972
12980
|
setRemarkList,
|
|
12973
12981
|
setDocumentSignJPDF,
|
|
12974
12982
|
setActiveFinanceDetail,
|
|
12975
|
-
setImagePath
|
|
12983
|
+
setImagePath,
|
|
12984
|
+
setSelectedMediaFilePath
|
|
12976
12985
|
} = dialogsSlice.actions;
|
|
12977
12986
|
const uploadFile = (file) => async (dispatch) => {
|
|
12978
12987
|
try {
|
|
@@ -12990,15 +12999,17 @@ const uploadFile = (file) => async (dispatch) => {
|
|
|
12990
12999
|
instance.addResourceBundle("en", "Dialog", locale$3);
|
|
12991
13000
|
instance.addResourceBundle("ms", "Dialog", locale$2);
|
|
12992
13001
|
const ChangeDetectDialog = ({
|
|
13002
|
+
open,
|
|
12993
13003
|
onClose,
|
|
12994
13004
|
onButtonClick
|
|
12995
13005
|
}) => {
|
|
12996
13006
|
const { t: t2 } = useTranslation("Dialog");
|
|
12997
|
-
const
|
|
13007
|
+
const isChangeDetectDialogOpen = useSelector(getIsChangeDetectDialogOpen);
|
|
13008
|
+
const isOpen = open ?? isChangeDetectDialogOpen;
|
|
12998
13009
|
return /* @__PURE__ */ jsx(
|
|
12999
13010
|
InfoDialog,
|
|
13000
13011
|
{
|
|
13001
|
-
open,
|
|
13012
|
+
open: isOpen,
|
|
13002
13013
|
onClose,
|
|
13003
13014
|
color: "warning",
|
|
13004
13015
|
onButtonClick,
|
|
@@ -19701,9 +19712,6 @@ const ImageUpload = ({
|
|
|
19701
19712
|
] }) })
|
|
19702
19713
|
] }) });
|
|
19703
19714
|
};
|
|
19704
|
-
const PlayCircleOutlineIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
19705
|
-
d: "m10 16.5 6-4.5-6-4.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"
|
|
19706
|
-
}), "PlayCircleOutline");
|
|
19707
19715
|
var dayjs_min$1 = { exports: {} };
|
|
19708
19716
|
var dayjs_min = dayjs_min$1.exports;
|
|
19709
19717
|
var hasRequiredDayjs_min;
|
|
@@ -20121,6 +20129,17 @@ function requireCustomParseFormat() {
|
|
|
20121
20129
|
}
|
|
20122
20130
|
var customParseFormatExports = requireCustomParseFormat();
|
|
20123
20131
|
const customParseFormat = /* @__PURE__ */ getDefaultExportFromCjs(customParseFormatExports);
|
|
20132
|
+
const userStatusEnum = ["Active", "Pending", "Inactive", "Delete"];
|
|
20133
|
+
const loginUserRoles = {
|
|
20134
|
+
Agent: "agent",
|
|
20135
|
+
MiniAgent: "mini-agent",
|
|
20136
|
+
Customer: "customer-user",
|
|
20137
|
+
Admin: "tenant-admin",
|
|
20138
|
+
Lawyer: "lawyer",
|
|
20139
|
+
Staff: "staff",
|
|
20140
|
+
SuperAdmin: "super-admin"
|
|
20141
|
+
};
|
|
20142
|
+
const IMAGE_TYPES = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg"];
|
|
20124
20143
|
dayjs.extend(customParseFormat);
|
|
20125
20144
|
function decodeUrlAndGetFileType(url) {
|
|
20126
20145
|
try {
|
|
@@ -20172,33 +20191,108 @@ const getSectionTitle = (sectionName) => {
|
|
|
20172
20191
|
};
|
|
20173
20192
|
return sectionTitleMap[sectionName] || "";
|
|
20174
20193
|
};
|
|
20175
|
-
|
|
20194
|
+
function isImageFileType(fileType) {
|
|
20195
|
+
return fileType ? IMAGE_TYPES.includes(fileType.toLowerCase()) : false;
|
|
20196
|
+
}
|
|
20197
|
+
const DIALOG_HEIGHT = {
|
|
20198
|
+
PDF_DESKTOP: "80vh",
|
|
20199
|
+
PDF_MOBILE: "30vh",
|
|
20200
|
+
IMAGE_MAX: "80vh"
|
|
20201
|
+
};
|
|
20202
|
+
const PdfDialog = ({
|
|
20203
|
+
filePath: propFilePath,
|
|
20204
|
+
isMobile = false,
|
|
20205
|
+
open: propOpen,
|
|
20206
|
+
onClose: propOnClose
|
|
20207
|
+
}) => {
|
|
20208
|
+
const selectedFilePath = useSelector(getSelectedMediaFilePath);
|
|
20209
|
+
const filePath = propFilePath || selectedFilePath;
|
|
20176
20210
|
const fileType = decodeUrlAndGetFileType(filePath);
|
|
20177
|
-
const
|
|
20211
|
+
const IsPdfDialogOpen = useSelector(getIsPdfDialogOpen);
|
|
20212
|
+
const open = propOpen !== void 0 ? propOpen : IsPdfDialogOpen;
|
|
20178
20213
|
const dispatch = useDispatch();
|
|
20179
20214
|
const onClose = () => {
|
|
20180
|
-
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20215
|
+
if (propOnClose) {
|
|
20216
|
+
propOnClose();
|
|
20217
|
+
} else {
|
|
20218
|
+
dispatch(setIsPdfDialogOpen(false));
|
|
20219
|
+
dispatch(setSelectedMediaFilePath(""));
|
|
20220
|
+
}
|
|
20185
20221
|
};
|
|
20186
|
-
|
|
20222
|
+
const isImageType = isImageFileType(fileType);
|
|
20223
|
+
const isPdfType = fileType === "pdf";
|
|
20224
|
+
const pdfHeight = isMobile ? DIALOG_HEIGHT.PDF_MOBILE : DIALOG_HEIGHT.PDF_DESKTOP;
|
|
20225
|
+
return /* @__PURE__ */ jsx(
|
|
20226
|
+
Dialog$1,
|
|
20227
|
+
{
|
|
20228
|
+
open,
|
|
20229
|
+
onClose,
|
|
20230
|
+
maxWidth: isPdfType ? "lg" : "md",
|
|
20231
|
+
fullWidth: isPdfType,
|
|
20232
|
+
PaperProps: {
|
|
20233
|
+
className: isImageType ? "bg-white" : ""
|
|
20234
|
+
},
|
|
20235
|
+
children: /* @__PURE__ */ jsx(
|
|
20236
|
+
DialogContent$1,
|
|
20237
|
+
{
|
|
20238
|
+
className: "p-0 flex justify-center items-center",
|
|
20239
|
+
sx: {
|
|
20240
|
+
height: isPdfType ? pdfHeight : "auto",
|
|
20241
|
+
backgroundColor: isImageType ? "#ffffff" : "inherit"
|
|
20242
|
+
},
|
|
20243
|
+
children: isPdfType ? /* @__PURE__ */ jsx("embed", { src: filePath, type: "application/pdf", className: "w-full h-full" }) : isImageType ? /* @__PURE__ */ jsx(
|
|
20244
|
+
"img",
|
|
20245
|
+
{
|
|
20246
|
+
src: filePath,
|
|
20247
|
+
alt: "Preview",
|
|
20248
|
+
className: "w-full h-auto object-contain",
|
|
20249
|
+
style: { maxHeight: DIALOG_HEIGHT.IMAGE_MAX }
|
|
20250
|
+
}
|
|
20251
|
+
) : /* @__PURE__ */ jsx("img", { src: filePath, alt: "Preview", className: "w-full h-auto" })
|
|
20252
|
+
}
|
|
20253
|
+
)
|
|
20254
|
+
}
|
|
20255
|
+
);
|
|
20187
20256
|
};
|
|
20188
20257
|
const PreviewMedia = ({ children, filePath = "", showDefaultView = true }) => {
|
|
20189
|
-
const
|
|
20258
|
+
const [open, setOpen] = useState(false);
|
|
20190
20259
|
const fileType = decodeUrlAndGetFileType(filePath);
|
|
20191
20260
|
const handleOpen = () => {
|
|
20192
|
-
|
|
20261
|
+
if (filePath) {
|
|
20262
|
+
setOpen(true);
|
|
20263
|
+
}
|
|
20193
20264
|
};
|
|
20265
|
+
const handleClose = () => {
|
|
20266
|
+
setOpen(false);
|
|
20267
|
+
};
|
|
20268
|
+
const isImageType = isImageFileType(fileType);
|
|
20194
20269
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20195
|
-
|
|
20196
|
-
|
|
20270
|
+
isImageType && showDefaultView ? /* @__PURE__ */ jsx(
|
|
20271
|
+
"div",
|
|
20272
|
+
{
|
|
20273
|
+
onClick: handleOpen,
|
|
20274
|
+
className: "size-[100px] min-w-[100px] min-h-[100px] max-w-[100px] max-h-[100px] flex-shrink-0 overflow-hidden cursor-pointer",
|
|
20275
|
+
children: /* @__PURE__ */ jsx(
|
|
20276
|
+
"img",
|
|
20277
|
+
{
|
|
20278
|
+
src: filePath,
|
|
20279
|
+
alt: "Preview",
|
|
20280
|
+
className: "size-full object-cover"
|
|
20281
|
+
}
|
|
20282
|
+
)
|
|
20283
|
+
}
|
|
20284
|
+
) : /* @__PURE__ */ jsx("div", { onClick: handleOpen, className: "cursor-pointer", children }),
|
|
20285
|
+
/* @__PURE__ */ jsx(
|
|
20286
|
+
PdfDialog,
|
|
20287
|
+
{
|
|
20288
|
+
filePath,
|
|
20289
|
+
isMobile: false,
|
|
20290
|
+
open,
|
|
20291
|
+
onClose: handleClose
|
|
20292
|
+
}
|
|
20293
|
+
)
|
|
20197
20294
|
] });
|
|
20198
20295
|
};
|
|
20199
|
-
PreviewMedia.propTypes = {
|
|
20200
|
-
children: PropTypes.element.isRequired
|
|
20201
|
-
};
|
|
20202
20296
|
const amber = {
|
|
20203
20297
|
600: "#ffb300"
|
|
20204
20298
|
};
|
|
@@ -24593,16 +24687,17 @@ const initialState = {
|
|
|
24593
24687
|
},
|
|
24594
24688
|
tenantListForDropdownLoading: false
|
|
24595
24689
|
};
|
|
24596
|
-
const getUserList = (roleIds, tenantId) => async (dispatch, getState) => {
|
|
24690
|
+
const getUserList = (roleIds, tenantId, pageIndexParam) => async (dispatch, getState) => {
|
|
24597
24691
|
var _a, _b;
|
|
24598
24692
|
dispatch(setIsUserListLoading(true));
|
|
24599
24693
|
const searchUser = getUserSearchKeyword(getState());
|
|
24600
24694
|
const pagination = getUserListPaginationData(getState());
|
|
24695
|
+
const pageIndexToUse = pageIndexParam !== void 0 ? pageIndexParam : pagination.pageIndex;
|
|
24601
24696
|
try {
|
|
24602
24697
|
const roleIdsArray = Array.isArray(roleIds) ? roleIds : [roleIds].filter(Boolean);
|
|
24603
24698
|
const queryParams = [
|
|
24604
24699
|
pagination.pageSize && `PageSize=${pagination.pageSize}`,
|
|
24605
|
-
|
|
24700
|
+
pageIndexToUse !== void 0 && `PageIndex=${pageIndexToUse + 1}`,
|
|
24606
24701
|
searchUser && `Search=${searchUser}`,
|
|
24607
24702
|
tenantId && `TenantId=${tenantId}`
|
|
24608
24703
|
].filter((param) => param).join("&");
|
|
@@ -24757,6 +24852,132 @@ const {
|
|
|
24757
24852
|
setDropdownFilters,
|
|
24758
24853
|
setTenantListForDropdownLoadingState
|
|
24759
24854
|
} = userSlice.actions;
|
|
24855
|
+
const en = {
|
|
24856
|
+
LOADING: "Loading...",
|
|
24857
|
+
NO_OPTION_AVAILABLE: "No options available",
|
|
24858
|
+
FINANCE_APPLICATION: "Finance Application",
|
|
24859
|
+
FINANCE_APPLICATION_NUMBER: "Finance Application Number",
|
|
24860
|
+
TENANT: "Tenant"
|
|
24861
|
+
};
|
|
24862
|
+
const ms = {
|
|
24863
|
+
LOADING: "Memuatkan...",
|
|
24864
|
+
NO_OPTION_AVAILABLE: "Tiada pilihan tersedia",
|
|
24865
|
+
FINANCE_APPLICATION: "Permohonan Kewangan",
|
|
24866
|
+
FINANCE_APPLICATION_NUMBER: "Nombor Permohonan Kewangan",
|
|
24867
|
+
TENANT: "Penyewa"
|
|
24868
|
+
};
|
|
24869
|
+
instance.addResourceBundle("en", "Autocomplete", en);
|
|
24870
|
+
instance.addResourceBundle("ms", "Autocomplete", ms);
|
|
24871
|
+
const CustomAutocomplete = React.memo(
|
|
24872
|
+
({
|
|
24873
|
+
label,
|
|
24874
|
+
isTooltipShow = true,
|
|
24875
|
+
variant = "filled",
|
|
24876
|
+
onChange,
|
|
24877
|
+
onInputChange,
|
|
24878
|
+
loading = false,
|
|
24879
|
+
options = [],
|
|
24880
|
+
error = "",
|
|
24881
|
+
required = false,
|
|
24882
|
+
value,
|
|
24883
|
+
isSmall = false,
|
|
24884
|
+
style = {},
|
|
24885
|
+
isUpperCase = true,
|
|
24886
|
+
getListboxProps = {},
|
|
24887
|
+
ref,
|
|
24888
|
+
disableClearable = false,
|
|
24889
|
+
...props
|
|
24890
|
+
}) => {
|
|
24891
|
+
const { t: t2 } = useTranslation("Autocomplete");
|
|
24892
|
+
const selectedValue = React.useMemo(() => {
|
|
24893
|
+
if (!value || !(options == null ? void 0 : options.length)) return null;
|
|
24894
|
+
if (typeof options[0] === "object") {
|
|
24895
|
+
return options.find((option) => option.id === value) || null;
|
|
24896
|
+
}
|
|
24897
|
+
return value;
|
|
24898
|
+
}, [value, options]);
|
|
24899
|
+
const handleOnChange = React.useCallback((_event, selectedOption) => {
|
|
24900
|
+
if (selectedOption) {
|
|
24901
|
+
onChange(typeof selectedOption === "object" ? selectedOption : selectedOption);
|
|
24902
|
+
} else {
|
|
24903
|
+
onChange(null);
|
|
24904
|
+
}
|
|
24905
|
+
}, [onChange]);
|
|
24906
|
+
const getOptionLabel = React.useCallback((option) => {
|
|
24907
|
+
if (!option) return "";
|
|
24908
|
+
const label2 = typeof option === "string" ? option : (option == null ? void 0 : option.label) || "";
|
|
24909
|
+
return isUpperCase ? label2.toUpperCase() : label2;
|
|
24910
|
+
}, [isUpperCase]);
|
|
24911
|
+
const isOptionEqualToValue = React.useCallback((option, val) => {
|
|
24912
|
+
if (!option || !val) return false;
|
|
24913
|
+
if (typeof option === "object" && typeof val === "object") {
|
|
24914
|
+
return option.id === val.id;
|
|
24915
|
+
}
|
|
24916
|
+
return option === val;
|
|
24917
|
+
}, []);
|
|
24918
|
+
const renderOption = React.useCallback((props2, option) => {
|
|
24919
|
+
const { key, ...otherProps } = props2;
|
|
24920
|
+
return /* @__PURE__ */ createElement("li", { ...otherProps, key: typeof option === "object" ? option.id : option }, typeof option === "object" ? option.label : option);
|
|
24921
|
+
}, []);
|
|
24922
|
+
const listboxProps = React.useMemo(() => ({
|
|
24923
|
+
onScroll: getListboxProps == null ? void 0 : getListboxProps.onScroll,
|
|
24924
|
+
style: {
|
|
24925
|
+
maxHeight: "40vh",
|
|
24926
|
+
overflow: "auto"
|
|
24927
|
+
}
|
|
24928
|
+
}), [getListboxProps]);
|
|
24929
|
+
const renderInput = React.useCallback((params) => /* @__PURE__ */ jsx(
|
|
24930
|
+
TextField$1,
|
|
24931
|
+
{
|
|
24932
|
+
...params,
|
|
24933
|
+
label,
|
|
24934
|
+
required,
|
|
24935
|
+
size: isSmall ? "small" : "medium",
|
|
24936
|
+
variant,
|
|
24937
|
+
error: !!error,
|
|
24938
|
+
helperText: error,
|
|
24939
|
+
InputProps: {
|
|
24940
|
+
...params.InputProps,
|
|
24941
|
+
endAdornment: /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
24942
|
+
loading ? /* @__PURE__ */ jsx(CircularProgress$1, { color: "primary", size: 15 }) : null,
|
|
24943
|
+
params.InputProps.endAdornment
|
|
24944
|
+
] }),
|
|
24945
|
+
sx: style
|
|
24946
|
+
}
|
|
24947
|
+
}
|
|
24948
|
+
), [label, required, isSmall, variant, error, loading, style]);
|
|
24949
|
+
return /* @__PURE__ */ jsx(
|
|
24950
|
+
Tooltip,
|
|
24951
|
+
{
|
|
24952
|
+
title: isTooltipShow ? label : "",
|
|
24953
|
+
arrow: true,
|
|
24954
|
+
TransitionComponent: Zoom,
|
|
24955
|
+
placement: "top-start",
|
|
24956
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
24957
|
+
Autocomplete$1,
|
|
24958
|
+
{
|
|
24959
|
+
...props,
|
|
24960
|
+
onChange: handleOnChange,
|
|
24961
|
+
onInputChange,
|
|
24962
|
+
options: options || [],
|
|
24963
|
+
getOptionLabel,
|
|
24964
|
+
isOptionEqualToValue,
|
|
24965
|
+
ref,
|
|
24966
|
+
value: selectedValue,
|
|
24967
|
+
renderOption,
|
|
24968
|
+
ListboxProps: listboxProps,
|
|
24969
|
+
loading,
|
|
24970
|
+
disableClearable,
|
|
24971
|
+
loadingText: t2("LOADING"),
|
|
24972
|
+
noOptionsText: !loading ? t2("NO_OPTION_AVAILABLE") : "",
|
|
24973
|
+
renderInput
|
|
24974
|
+
}
|
|
24975
|
+
) })
|
|
24976
|
+
}
|
|
24977
|
+
);
|
|
24978
|
+
}
|
|
24979
|
+
);
|
|
24980
|
+
CustomAutocomplete.displayName = "CustomAutocomplete";
|
|
24760
24981
|
var lodash$1 = { exports: {} };
|
|
24761
24982
|
/**
|
|
24762
24983
|
* @license
|
|
@@ -30246,118 +30467,6 @@ function requireLodash() {
|
|
|
30246
30467
|
}
|
|
30247
30468
|
var lodashExports = requireLodash();
|
|
30248
30469
|
const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
|
|
30249
|
-
const en = {
|
|
30250
|
-
LOADING: "Loading...",
|
|
30251
|
-
NO_OPTION_AVAILABLE: "No options available",
|
|
30252
|
-
FINANCE_APPLICATION: "Finance Application",
|
|
30253
|
-
FINANCE_APPLICATION_NUMBER: "Finance Application Number",
|
|
30254
|
-
TENANT: "Tenant"
|
|
30255
|
-
};
|
|
30256
|
-
const ms = {
|
|
30257
|
-
LOADING: "Memuatkan...",
|
|
30258
|
-
NO_OPTION_AVAILABLE: "Tiada pilihan tersedia",
|
|
30259
|
-
FINANCE_APPLICATION: "Permohonan Kewangan",
|
|
30260
|
-
FINANCE_APPLICATION_NUMBER: "Nombor Permohonan Kewangan",
|
|
30261
|
-
TENANT: "Penyewa"
|
|
30262
|
-
};
|
|
30263
|
-
instance.addResourceBundle("en", "Autocomplete", en);
|
|
30264
|
-
instance.addResourceBundle("ms", "Autocomplete", ms);
|
|
30265
|
-
const CustomAutocomplete = React.memo(
|
|
30266
|
-
({
|
|
30267
|
-
label,
|
|
30268
|
-
isTooltipShow = true,
|
|
30269
|
-
variant = "filled",
|
|
30270
|
-
onChange,
|
|
30271
|
-
loading = false,
|
|
30272
|
-
options = [],
|
|
30273
|
-
error = "",
|
|
30274
|
-
required = false,
|
|
30275
|
-
value,
|
|
30276
|
-
isSmall = false,
|
|
30277
|
-
style = {},
|
|
30278
|
-
isUpperCase = true,
|
|
30279
|
-
getListboxProps = {},
|
|
30280
|
-
ref,
|
|
30281
|
-
disableClearable = false,
|
|
30282
|
-
...props
|
|
30283
|
-
}) => {
|
|
30284
|
-
const { t: t2 } = useTranslation("Autocomplete");
|
|
30285
|
-
options = options || [];
|
|
30286
|
-
let selectedValues = value;
|
|
30287
|
-
if (options.length > 0 && typeof options[0] === "object" && value) {
|
|
30288
|
-
selectedValues = lodashExports.find(options, (option) => option.id === value);
|
|
30289
|
-
}
|
|
30290
|
-
const handleOnChange = React.useCallback((_event, selectedOption) => {
|
|
30291
|
-
if (selectedOption) {
|
|
30292
|
-
selectedOption = typeof selectedOption === "object" ? { ...selectedOption, label: selectedOption.label } : selectedOption;
|
|
30293
|
-
} else {
|
|
30294
|
-
selectedOption = null;
|
|
30295
|
-
}
|
|
30296
|
-
onChange(selectedOption);
|
|
30297
|
-
}, [onChange]);
|
|
30298
|
-
const getOptionLabel = React.useCallback((option) => {
|
|
30299
|
-
const label2 = typeof option === "string" ? option : typeof (option == null ? void 0 : option.label) === "string" ? option.label : "";
|
|
30300
|
-
return isUpperCase ? label2.toUpperCase() : label2;
|
|
30301
|
-
}, [isUpperCase]);
|
|
30302
|
-
const renderOption = React.useCallback((props2, option) => /* @__PURE__ */ createElement("li", { ...props2, key: option.id || option.label || option }, option.label || option), []);
|
|
30303
|
-
const listboxProps = React.useMemo(() => ({
|
|
30304
|
-
onScroll: getListboxProps == null ? void 0 : getListboxProps.onScroll,
|
|
30305
|
-
style: {
|
|
30306
|
-
maxHeight: "40vh",
|
|
30307
|
-
overflow: "auto"
|
|
30308
|
-
}
|
|
30309
|
-
}), [getListboxProps]);
|
|
30310
|
-
const renderInput = React.useCallback((params) => /* @__PURE__ */ jsx(
|
|
30311
|
-
TextField$1,
|
|
30312
|
-
{
|
|
30313
|
-
...params,
|
|
30314
|
-
label,
|
|
30315
|
-
required,
|
|
30316
|
-
size: isSmall ? "small" : "medium",
|
|
30317
|
-
variant,
|
|
30318
|
-
error: !!error,
|
|
30319
|
-
helperText: error,
|
|
30320
|
-
InputProps: {
|
|
30321
|
-
...params.InputProps,
|
|
30322
|
-
endAdornment: /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
30323
|
-
loading ? /* @__PURE__ */ jsx(CircularProgress$1, { color: "primary", size: 15 }) : null,
|
|
30324
|
-
params.InputProps.endAdornment
|
|
30325
|
-
] }),
|
|
30326
|
-
sx: style
|
|
30327
|
-
}
|
|
30328
|
-
}
|
|
30329
|
-
), [label, required, isSmall, variant, error, loading, style]);
|
|
30330
|
-
return /* @__PURE__ */ jsx(
|
|
30331
|
-
Tooltip,
|
|
30332
|
-
{
|
|
30333
|
-
title: isTooltipShow ? label : "",
|
|
30334
|
-
arrow: true,
|
|
30335
|
-
TransitionComponent: Zoom,
|
|
30336
|
-
placement: "top-start",
|
|
30337
|
-
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
30338
|
-
Autocomplete$1,
|
|
30339
|
-
{
|
|
30340
|
-
...props,
|
|
30341
|
-
onChange: handleOnChange,
|
|
30342
|
-
options,
|
|
30343
|
-
getOptionLabel,
|
|
30344
|
-
ref,
|
|
30345
|
-
defaultValue: selectedValues,
|
|
30346
|
-
value: selectedValues || null,
|
|
30347
|
-
renderOption,
|
|
30348
|
-
ListboxProps: listboxProps,
|
|
30349
|
-
loading,
|
|
30350
|
-
disableClearable,
|
|
30351
|
-
loadingText: t2("LOADING"),
|
|
30352
|
-
noOptionsText: !loading ? t2("NO_OPTION_AVAILABLE") : "",
|
|
30353
|
-
renderInput
|
|
30354
|
-
}
|
|
30355
|
-
) })
|
|
30356
|
-
}
|
|
30357
|
-
);
|
|
30358
|
-
}
|
|
30359
|
-
);
|
|
30360
|
-
CustomAutocomplete.displayName = "CustomAutocomplete";
|
|
30361
30470
|
function useDebounce(callback, delay) {
|
|
30362
30471
|
const callbackRef = useRef(callback);
|
|
30363
30472
|
useEffect(() => {
|
|
@@ -30405,6 +30514,7 @@ const SearchableAutocomplete = memo(
|
|
|
30405
30514
|
const [isTyping, setIsTyping] = useState(false);
|
|
30406
30515
|
const [pageIndex, setPageIndex] = useState((pagination == null ? void 0 : pagination.pageIndex) ?? 0);
|
|
30407
30516
|
const [isFetching, setIsFetching] = useState(false);
|
|
30517
|
+
const hasInitialLoadRef = useRef(false);
|
|
30408
30518
|
const deduplicateOptions = useCallback((existingOptions, newOptions) => {
|
|
30409
30519
|
const existingIds = new Set(existingOptions == null ? void 0 : existingOptions.map((option) => option.id));
|
|
30410
30520
|
const filteredNewOptions = newOptions == null ? void 0 : newOptions.filter((option) => !(existingIds == null ? void 0 : existingIds.has(option.id)));
|
|
@@ -30422,8 +30532,11 @@ const SearchableAutocomplete = memo(
|
|
|
30422
30532
|
}
|
|
30423
30533
|
}, [fetchOptions]);
|
|
30424
30534
|
useEffect(() => {
|
|
30425
|
-
|
|
30426
|
-
|
|
30535
|
+
if (!hasInitialLoadRef.current) {
|
|
30536
|
+
hasInitialLoadRef.current = true;
|
|
30537
|
+
fetchDefaultOptions();
|
|
30538
|
+
}
|
|
30539
|
+
}, []);
|
|
30427
30540
|
const fetchDebouncedOptions = useCallback(
|
|
30428
30541
|
useDebounce(async (search) => {
|
|
30429
30542
|
setLoading2(true);
|
|
@@ -30452,8 +30565,10 @@ const SearchableAutocomplete = memo(
|
|
|
30452
30565
|
setIsFetching(true);
|
|
30453
30566
|
try {
|
|
30454
30567
|
const newOptions = await fetchOptions(searchTerm, pageIndex + 1);
|
|
30455
|
-
|
|
30456
|
-
|
|
30568
|
+
if (newOptions && newOptions.length > 0) {
|
|
30569
|
+
setPageIndex(pageIndex + 1);
|
|
30570
|
+
setOptions((prevOptions) => deduplicateOptions(prevOptions, newOptions));
|
|
30571
|
+
}
|
|
30457
30572
|
} catch (err) {
|
|
30458
30573
|
console.error("Failed to load more options:", err);
|
|
30459
30574
|
} finally {
|
|
@@ -30468,7 +30583,8 @@ const SearchableAutocomplete = memo(
|
|
|
30468
30583
|
}, [loadMoreOptions]);
|
|
30469
30584
|
const handleChange = useCallback((selectedValue) => {
|
|
30470
30585
|
if (selectedValue) {
|
|
30471
|
-
|
|
30586
|
+
const valueToPass = typeof selectedValue === "object" ? selectedValue.id : selectedValue;
|
|
30587
|
+
onChange(valueToPass);
|
|
30472
30588
|
setIsTyping(false);
|
|
30473
30589
|
setSearchTerm("");
|
|
30474
30590
|
} else {
|
|
@@ -30530,6 +30646,7 @@ const MemberAutoComplete = ({
|
|
|
30530
30646
|
const [hasMoreData, setHasMoreData] = useState(true);
|
|
30531
30647
|
const onChangeRef = useRef(onChange);
|
|
30532
30648
|
const roleIdsRef = useRef(roleIds);
|
|
30649
|
+
const previousSearchTermRef = useRef("");
|
|
30533
30650
|
useEffect(() => {
|
|
30534
30651
|
onChangeRef.current = onChange;
|
|
30535
30652
|
roleIdsRef.current = roleIds;
|
|
@@ -30546,12 +30663,16 @@ const MemberAutoComplete = ({
|
|
|
30546
30663
|
dispatch(setIsUserListLoading(false));
|
|
30547
30664
|
}, [dispatch]);
|
|
30548
30665
|
const fetchUserOptions = useCallback(async (searchTerm, pageIndex) => {
|
|
30666
|
+
if (previousSearchTermRef.current !== searchTerm) {
|
|
30667
|
+
previousSearchTermRef.current = searchTerm;
|
|
30668
|
+
setHasMoreData(true);
|
|
30669
|
+
}
|
|
30549
30670
|
if (pageIndex > 0 && !hasMoreData) {
|
|
30550
30671
|
return [];
|
|
30551
30672
|
}
|
|
30552
30673
|
dispatch(setUserSearchKeyword(searchTerm));
|
|
30553
30674
|
dispatch(setUserListPagination({ pageIndex }));
|
|
30554
|
-
const newOptions = await dispatch(getUserList(roleIdsRef.current, tenantId));
|
|
30675
|
+
const newOptions = await dispatch(getUserList(roleIdsRef.current, tenantId, pageIndex));
|
|
30555
30676
|
if (!newOptions || Array.isArray(newOptions) && newOptions.length === 0) {
|
|
30556
30677
|
setHasMoreData(false);
|
|
30557
30678
|
if (pageIndex > 0) {
|
|
@@ -30951,16 +31072,6 @@ function RemarksDialog({
|
|
|
30951
31072
|
)
|
|
30952
31073
|
] });
|
|
30953
31074
|
}
|
|
30954
|
-
const userStatusEnum = ["Active", "Pending", "Inactive", "Delete"];
|
|
30955
|
-
const loginUserRoles = {
|
|
30956
|
-
Agent: "agent",
|
|
30957
|
-
MiniAgent: "mini-agent",
|
|
30958
|
-
Customer: "customer-user",
|
|
30959
|
-
Admin: "tenant-admin",
|
|
30960
|
-
Lawyer: "lawyer",
|
|
30961
|
-
Staff: "staff",
|
|
30962
|
-
SuperAdmin: "super-admin"
|
|
30963
|
-
};
|
|
30964
31075
|
const defaultValues = {
|
|
30965
31076
|
status: ""
|
|
30966
31077
|
};
|
|
@@ -44206,7 +44317,7 @@ const FinanceApplicationAutocomplete = ({
|
|
|
44206
44317
|
}) => {
|
|
44207
44318
|
const { t: t2 } = useTranslation("Autocomplete");
|
|
44208
44319
|
const handleChange = (selectedValue) => {
|
|
44209
|
-
onChange(selectedValue
|
|
44320
|
+
onChange(selectedValue || "");
|
|
44210
44321
|
};
|
|
44211
44322
|
const fetchFinanceApplicationOptions = useCallback(async (searchTerm, pageIndex) => {
|
|
44212
44323
|
if (!tenantId) {
|
|
@@ -44221,16 +44332,21 @@ const FinanceApplicationAutocomplete = ({
|
|
|
44221
44332
|
pageSize: 20,
|
|
44222
44333
|
pageIndex
|
|
44223
44334
|
};
|
|
44224
|
-
|
|
44225
|
-
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
44230
|
-
|
|
44231
|
-
|
|
44232
|
-
|
|
44233
|
-
|
|
44335
|
+
try {
|
|
44336
|
+
const newOptions = await onFetchData({
|
|
44337
|
+
tenantId,
|
|
44338
|
+
filters,
|
|
44339
|
+
pagination: paginationParams
|
|
44340
|
+
});
|
|
44341
|
+
return (newOptions == null ? void 0 : newOptions.map((item) => ({
|
|
44342
|
+
id: item.id,
|
|
44343
|
+
label: `${item.applicationNumber}`
|
|
44344
|
+
}))) || [];
|
|
44345
|
+
} catch (error2) {
|
|
44346
|
+
console.error("Error fetching finance applications:", error2);
|
|
44347
|
+
return [];
|
|
44348
|
+
}
|
|
44349
|
+
}, [tenantId, status, isTenantInvoiceGenerated, onFetchData]);
|
|
44234
44350
|
return /* @__PURE__ */ jsx(
|
|
44235
44351
|
SearchableAutocomplete,
|
|
44236
44352
|
{
|
|
@@ -44260,32 +44376,31 @@ const TenantAutocomplete = ({
|
|
|
44260
44376
|
const hasAutoSelected = useRef(false);
|
|
44261
44377
|
const { t: t2 } = useTranslation("Autocomplete");
|
|
44262
44378
|
const handleChange = (selectedValue, isAutoSelection = false) => {
|
|
44263
|
-
|
|
44264
|
-
onChange(selectedId, isAutoSelection);
|
|
44379
|
+
onChange(selectedValue, isAutoSelection);
|
|
44265
44380
|
};
|
|
44266
44381
|
const fetchTenants = useCallback(
|
|
44267
|
-
async ({ status: status2, pageSize: pageSize2, pageIndex }) => {
|
|
44382
|
+
async ({ status: status2, pageSize: pageSize2, pageIndex, searchKeyword = "" }) => {
|
|
44268
44383
|
const statusString = status2.length > 0 ? status2.join(",") : "";
|
|
44269
|
-
dispatch(setDropdownFilters({ status: statusString }));
|
|
44384
|
+
dispatch(setDropdownFilters({ status: statusString, searchKeyword }));
|
|
44270
44385
|
dispatch(setTenantListForDropdownPagination({ pageSize: pageSize2, pageIndex }));
|
|
44271
44386
|
const result = await dispatch(getTenantListForDropdown({ pageIndex }));
|
|
44272
|
-
dispatch(setDropdownFilters({ status: "", searchKeyword: "" }));
|
|
44273
44387
|
return result;
|
|
44274
44388
|
},
|
|
44275
44389
|
[dispatch]
|
|
44276
44390
|
);
|
|
44277
44391
|
const fetchTenantOptions = useCallback(
|
|
44278
|
-
async (
|
|
44392
|
+
async (searchTerm, pageIndex) => {
|
|
44279
44393
|
const statusArray = Array.isArray(status) ? status : [status].filter((s4) => s4 !== "");
|
|
44280
44394
|
const tenants = await fetchTenants({
|
|
44281
44395
|
status: statusArray,
|
|
44282
44396
|
pageSize: 20,
|
|
44283
|
-
pageIndex
|
|
44397
|
+
pageIndex,
|
|
44398
|
+
searchKeyword: searchTerm || ""
|
|
44284
44399
|
});
|
|
44285
|
-
return tenants == null ? void 0 : tenants.map((item) => ({
|
|
44400
|
+
return (tenants == null ? void 0 : tenants.map((item) => ({
|
|
44286
44401
|
id: item.id,
|
|
44287
44402
|
label: item.name
|
|
44288
|
-
}));
|
|
44403
|
+
}))) || [];
|
|
44289
44404
|
},
|
|
44290
44405
|
[fetchTenants, status]
|
|
44291
44406
|
);
|
|
@@ -44296,7 +44411,7 @@ const TenantAutocomplete = ({
|
|
|
44296
44411
|
if (tenants && tenants.length > 0) {
|
|
44297
44412
|
const firstTenant = tenants[0];
|
|
44298
44413
|
hasAutoSelected.current = true;
|
|
44299
|
-
handleChange(firstTenant, true);
|
|
44414
|
+
handleChange(firstTenant.id, true);
|
|
44300
44415
|
}
|
|
44301
44416
|
};
|
|
44302
44417
|
autoSelectFirstTenant();
|
|
@@ -60143,6 +60258,7 @@ export {
|
|
|
60143
60258
|
getIsUserChangeStatusFormLoading,
|
|
60144
60259
|
getRemarkListByFinanceApplicationId,
|
|
60145
60260
|
getRemarkListData,
|
|
60261
|
+
getSelectedMediaFilePath,
|
|
60146
60262
|
hideMessage,
|
|
60147
60263
|
instance as i18n,
|
|
60148
60264
|
reassignStaffMember,
|
|
@@ -60158,6 +60274,7 @@ export {
|
|
|
60158
60274
|
setIsPopoverOpen,
|
|
60159
60275
|
setIsUserChangeStatusFormLoading,
|
|
60160
60276
|
setRemarkList,
|
|
60277
|
+
setSelectedMediaFilePath,
|
|
60161
60278
|
showMessage,
|
|
60162
60279
|
updateRemark,
|
|
60163
60280
|
updateUserStatus
|