finance-shared 0.0.4 → 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
|
};
|
|
@@ -24584,7 +24678,7 @@ const initialState = {
|
|
|
24584
24678
|
tenantListForDropdown: [],
|
|
24585
24679
|
tenantListForDropdownPagination: {
|
|
24586
24680
|
pageIndex: 0,
|
|
24587
|
-
pageSize:
|
|
24681
|
+
pageSize: 20,
|
|
24588
24682
|
totalCount: 0
|
|
24589
24683
|
},
|
|
24590
24684
|
dropdownFilters: {
|
|
@@ -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,114 +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.onScroll
|
|
30305
|
-
}), [getListboxProps.onScroll]);
|
|
30306
|
-
const renderInput = React.useCallback((params) => /* @__PURE__ */ jsx(
|
|
30307
|
-
TextField$1,
|
|
30308
|
-
{
|
|
30309
|
-
...params,
|
|
30310
|
-
label,
|
|
30311
|
-
required,
|
|
30312
|
-
size: isSmall ? "small" : "medium",
|
|
30313
|
-
variant,
|
|
30314
|
-
error: !!error,
|
|
30315
|
-
helperText: error,
|
|
30316
|
-
InputProps: {
|
|
30317
|
-
...params.InputProps,
|
|
30318
|
-
endAdornment: /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
30319
|
-
loading ? /* @__PURE__ */ jsx(CircularProgress$1, { color: "primary", size: 15 }) : null,
|
|
30320
|
-
params.InputProps.endAdornment
|
|
30321
|
-
] }),
|
|
30322
|
-
sx: style
|
|
30323
|
-
}
|
|
30324
|
-
}
|
|
30325
|
-
), [label, required, isSmall, variant, error, loading, style]);
|
|
30326
|
-
return /* @__PURE__ */ jsx(
|
|
30327
|
-
Tooltip,
|
|
30328
|
-
{
|
|
30329
|
-
title: isTooltipShow ? label : "",
|
|
30330
|
-
arrow: true,
|
|
30331
|
-
TransitionComponent: Zoom,
|
|
30332
|
-
placement: "top-start",
|
|
30333
|
-
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
30334
|
-
Autocomplete$1,
|
|
30335
|
-
{
|
|
30336
|
-
...props,
|
|
30337
|
-
onChange: handleOnChange,
|
|
30338
|
-
options,
|
|
30339
|
-
getOptionLabel,
|
|
30340
|
-
ref,
|
|
30341
|
-
defaultValue: selectedValues,
|
|
30342
|
-
value: selectedValues || null,
|
|
30343
|
-
renderOption,
|
|
30344
|
-
ListboxProps: listboxProps,
|
|
30345
|
-
loading,
|
|
30346
|
-
disableClearable,
|
|
30347
|
-
loadingText: t2("LOADING"),
|
|
30348
|
-
noOptionsText: !loading ? t2("NO_OPTION_AVAILABLE") : "",
|
|
30349
|
-
renderInput
|
|
30350
|
-
}
|
|
30351
|
-
) })
|
|
30352
|
-
}
|
|
30353
|
-
);
|
|
30354
|
-
}
|
|
30355
|
-
);
|
|
30356
|
-
CustomAutocomplete.displayName = "CustomAutocomplete";
|
|
30357
30470
|
function useDebounce(callback, delay) {
|
|
30358
30471
|
const callbackRef = useRef(callback);
|
|
30359
30472
|
useEffect(() => {
|
|
@@ -30401,6 +30514,7 @@ const SearchableAutocomplete = memo(
|
|
|
30401
30514
|
const [isTyping, setIsTyping] = useState(false);
|
|
30402
30515
|
const [pageIndex, setPageIndex] = useState((pagination == null ? void 0 : pagination.pageIndex) ?? 0);
|
|
30403
30516
|
const [isFetching, setIsFetching] = useState(false);
|
|
30517
|
+
const hasInitialLoadRef = useRef(false);
|
|
30404
30518
|
const deduplicateOptions = useCallback((existingOptions, newOptions) => {
|
|
30405
30519
|
const existingIds = new Set(existingOptions == null ? void 0 : existingOptions.map((option) => option.id));
|
|
30406
30520
|
const filteredNewOptions = newOptions == null ? void 0 : newOptions.filter((option) => !(existingIds == null ? void 0 : existingIds.has(option.id)));
|
|
@@ -30418,8 +30532,11 @@ const SearchableAutocomplete = memo(
|
|
|
30418
30532
|
}
|
|
30419
30533
|
}, [fetchOptions]);
|
|
30420
30534
|
useEffect(() => {
|
|
30421
|
-
|
|
30422
|
-
|
|
30535
|
+
if (!hasInitialLoadRef.current) {
|
|
30536
|
+
hasInitialLoadRef.current = true;
|
|
30537
|
+
fetchDefaultOptions();
|
|
30538
|
+
}
|
|
30539
|
+
}, []);
|
|
30423
30540
|
const fetchDebouncedOptions = useCallback(
|
|
30424
30541
|
useDebounce(async (search) => {
|
|
30425
30542
|
setLoading2(true);
|
|
@@ -30448,8 +30565,10 @@ const SearchableAutocomplete = memo(
|
|
|
30448
30565
|
setIsFetching(true);
|
|
30449
30566
|
try {
|
|
30450
30567
|
const newOptions = await fetchOptions(searchTerm, pageIndex + 1);
|
|
30451
|
-
|
|
30452
|
-
|
|
30568
|
+
if (newOptions && newOptions.length > 0) {
|
|
30569
|
+
setPageIndex(pageIndex + 1);
|
|
30570
|
+
setOptions((prevOptions) => deduplicateOptions(prevOptions, newOptions));
|
|
30571
|
+
}
|
|
30453
30572
|
} catch (err) {
|
|
30454
30573
|
console.error("Failed to load more options:", err);
|
|
30455
30574
|
} finally {
|
|
@@ -30464,7 +30583,8 @@ const SearchableAutocomplete = memo(
|
|
|
30464
30583
|
}, [loadMoreOptions]);
|
|
30465
30584
|
const handleChange = useCallback((selectedValue) => {
|
|
30466
30585
|
if (selectedValue) {
|
|
30467
|
-
|
|
30586
|
+
const valueToPass = typeof selectedValue === "object" ? selectedValue.id : selectedValue;
|
|
30587
|
+
onChange(valueToPass);
|
|
30468
30588
|
setIsTyping(false);
|
|
30469
30589
|
setSearchTerm("");
|
|
30470
30590
|
} else {
|
|
@@ -30526,6 +30646,7 @@ const MemberAutoComplete = ({
|
|
|
30526
30646
|
const [hasMoreData, setHasMoreData] = useState(true);
|
|
30527
30647
|
const onChangeRef = useRef(onChange);
|
|
30528
30648
|
const roleIdsRef = useRef(roleIds);
|
|
30649
|
+
const previousSearchTermRef = useRef("");
|
|
30529
30650
|
useEffect(() => {
|
|
30530
30651
|
onChangeRef.current = onChange;
|
|
30531
30652
|
roleIdsRef.current = roleIds;
|
|
@@ -30542,12 +30663,16 @@ const MemberAutoComplete = ({
|
|
|
30542
30663
|
dispatch(setIsUserListLoading(false));
|
|
30543
30664
|
}, [dispatch]);
|
|
30544
30665
|
const fetchUserOptions = useCallback(async (searchTerm, pageIndex) => {
|
|
30666
|
+
if (previousSearchTermRef.current !== searchTerm) {
|
|
30667
|
+
previousSearchTermRef.current = searchTerm;
|
|
30668
|
+
setHasMoreData(true);
|
|
30669
|
+
}
|
|
30545
30670
|
if (pageIndex > 0 && !hasMoreData) {
|
|
30546
30671
|
return [];
|
|
30547
30672
|
}
|
|
30548
30673
|
dispatch(setUserSearchKeyword(searchTerm));
|
|
30549
30674
|
dispatch(setUserListPagination({ pageIndex }));
|
|
30550
|
-
const newOptions = await dispatch(getUserList(roleIdsRef.current, tenantId));
|
|
30675
|
+
const newOptions = await dispatch(getUserList(roleIdsRef.current, tenantId, pageIndex));
|
|
30551
30676
|
if (!newOptions || Array.isArray(newOptions) && newOptions.length === 0) {
|
|
30552
30677
|
setHasMoreData(false);
|
|
30553
30678
|
if (pageIndex > 0) {
|
|
@@ -30947,16 +31072,6 @@ function RemarksDialog({
|
|
|
30947
31072
|
)
|
|
30948
31073
|
] });
|
|
30949
31074
|
}
|
|
30950
|
-
const userStatusEnum = ["Active", "Pending", "Inactive", "Delete"];
|
|
30951
|
-
const loginUserRoles = {
|
|
30952
|
-
Agent: "agent",
|
|
30953
|
-
MiniAgent: "mini-agent",
|
|
30954
|
-
Customer: "customer-user",
|
|
30955
|
-
Admin: "tenant-admin",
|
|
30956
|
-
Lawyer: "lawyer",
|
|
30957
|
-
Staff: "staff",
|
|
30958
|
-
SuperAdmin: "super-admin"
|
|
30959
|
-
};
|
|
30960
31075
|
const defaultValues = {
|
|
30961
31076
|
status: ""
|
|
30962
31077
|
};
|
|
@@ -44202,7 +44317,7 @@ const FinanceApplicationAutocomplete = ({
|
|
|
44202
44317
|
}) => {
|
|
44203
44318
|
const { t: t2 } = useTranslation("Autocomplete");
|
|
44204
44319
|
const handleChange = (selectedValue) => {
|
|
44205
|
-
onChange(selectedValue
|
|
44320
|
+
onChange(selectedValue || "");
|
|
44206
44321
|
};
|
|
44207
44322
|
const fetchFinanceApplicationOptions = useCallback(async (searchTerm, pageIndex) => {
|
|
44208
44323
|
if (!tenantId) {
|
|
@@ -44217,16 +44332,21 @@ const FinanceApplicationAutocomplete = ({
|
|
|
44217
44332
|
pageSize: 20,
|
|
44218
44333
|
pageIndex
|
|
44219
44334
|
};
|
|
44220
|
-
|
|
44221
|
-
|
|
44222
|
-
|
|
44223
|
-
|
|
44224
|
-
|
|
44225
|
-
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
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]);
|
|
44230
44350
|
return /* @__PURE__ */ jsx(
|
|
44231
44351
|
SearchableAutocomplete,
|
|
44232
44352
|
{
|
|
@@ -44256,32 +44376,31 @@ const TenantAutocomplete = ({
|
|
|
44256
44376
|
const hasAutoSelected = useRef(false);
|
|
44257
44377
|
const { t: t2 } = useTranslation("Autocomplete");
|
|
44258
44378
|
const handleChange = (selectedValue, isAutoSelection = false) => {
|
|
44259
|
-
|
|
44260
|
-
onChange(selectedId, isAutoSelection);
|
|
44379
|
+
onChange(selectedValue, isAutoSelection);
|
|
44261
44380
|
};
|
|
44262
44381
|
const fetchTenants = useCallback(
|
|
44263
|
-
async ({ status: status2, pageSize: pageSize2, pageIndex }) => {
|
|
44382
|
+
async ({ status: status2, pageSize: pageSize2, pageIndex, searchKeyword = "" }) => {
|
|
44264
44383
|
const statusString = status2.length > 0 ? status2.join(",") : "";
|
|
44265
|
-
dispatch(setDropdownFilters({ status: statusString }));
|
|
44384
|
+
dispatch(setDropdownFilters({ status: statusString, searchKeyword }));
|
|
44266
44385
|
dispatch(setTenantListForDropdownPagination({ pageSize: pageSize2, pageIndex }));
|
|
44267
44386
|
const result = await dispatch(getTenantListForDropdown({ pageIndex }));
|
|
44268
|
-
dispatch(setDropdownFilters({ status: "", searchKeyword: "" }));
|
|
44269
44387
|
return result;
|
|
44270
44388
|
},
|
|
44271
44389
|
[dispatch]
|
|
44272
44390
|
);
|
|
44273
44391
|
const fetchTenantOptions = useCallback(
|
|
44274
|
-
async (
|
|
44392
|
+
async (searchTerm, pageIndex) => {
|
|
44275
44393
|
const statusArray = Array.isArray(status) ? status : [status].filter((s4) => s4 !== "");
|
|
44276
44394
|
const tenants = await fetchTenants({
|
|
44277
44395
|
status: statusArray,
|
|
44278
44396
|
pageSize: 20,
|
|
44279
|
-
pageIndex
|
|
44397
|
+
pageIndex,
|
|
44398
|
+
searchKeyword: searchTerm || ""
|
|
44280
44399
|
});
|
|
44281
|
-
return tenants == null ? void 0 : tenants.map((item) => ({
|
|
44400
|
+
return (tenants == null ? void 0 : tenants.map((item) => ({
|
|
44282
44401
|
id: item.id,
|
|
44283
44402
|
label: item.name
|
|
44284
|
-
}));
|
|
44403
|
+
}))) || [];
|
|
44285
44404
|
},
|
|
44286
44405
|
[fetchTenants, status]
|
|
44287
44406
|
);
|
|
@@ -44292,7 +44411,7 @@ const TenantAutocomplete = ({
|
|
|
44292
44411
|
if (tenants && tenants.length > 0) {
|
|
44293
44412
|
const firstTenant = tenants[0];
|
|
44294
44413
|
hasAutoSelected.current = true;
|
|
44295
|
-
handleChange(firstTenant, true);
|
|
44414
|
+
handleChange(firstTenant.id, true);
|
|
44296
44415
|
}
|
|
44297
44416
|
};
|
|
44298
44417
|
autoSelectFirstTenant();
|
|
@@ -60139,6 +60258,7 @@ export {
|
|
|
60139
60258
|
getIsUserChangeStatusFormLoading,
|
|
60140
60259
|
getRemarkListByFinanceApplicationId,
|
|
60141
60260
|
getRemarkListData,
|
|
60261
|
+
getSelectedMediaFilePath,
|
|
60142
60262
|
hideMessage,
|
|
60143
60263
|
instance as i18n,
|
|
60144
60264
|
reassignStaffMember,
|
|
@@ -60154,6 +60274,7 @@ export {
|
|
|
60154
60274
|
setIsPopoverOpen,
|
|
60155
60275
|
setIsUserChangeStatusFormLoading,
|
|
60156
60276
|
setRemarkList,
|
|
60277
|
+
setSelectedMediaFilePath,
|
|
60157
60278
|
showMessage,
|
|
60158
60279
|
updateRemark,
|
|
60159
60280
|
updateUserStatus
|