@syzy/apphost 1.0.1 → 1.0.2
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.
- package/dist/App.js +83 -0
- package/dist/AppHostProvider.js +4 -0
- package/dist/AppHostRoutes.js +7 -0
- package/dist/api/image-api.js +45 -0
- package/dist/api/mapping-api.js +427 -0
- package/dist/bookingModule/components/AmenityForm.js +19 -0
- package/dist/bookingModule/components/BillingManagement.js +17 -0
- package/dist/bookingModule/components/CreateRoomForm.js +19 -0
- package/dist/bookingModule/components/ExtraRequirementForm.js +19 -0
- package/dist/bookingModule/components/ReservationForm.js +18 -0
- package/dist/bookingModule/components/RoomCategoryForm.js +19 -0
- package/dist/bookingModule/components/RoomCategoryPriceForm.js +20 -0
- package/dist/bookingModule/components/RoomExtraRequirementCapture.js +18 -0
- package/dist/bookingModule/components/RoomFacilityForm.js +19 -0
- package/dist/bookingModule/components/RoomReservationAction.js +18 -0
- package/dist/components/Home/Home.js +14 -0
- package/dist/components/Loader/Loader.js +5 -0
- package/dist/components/Login/Login.js +149 -0
- package/dist/components/Login/loginSchema.js +41 -0
- package/dist/components/Mappings/BranchMapping/Branch.js +135 -0
- package/dist/components/Mappings/BranchMapping/BranchTableColumns.js +21 -0
- package/dist/components/Mappings/BranchMapping/MappingFormBranchUser.js +150 -0
- package/dist/components/Mappings/BranchMapping/MappingTableColumns.js +29 -0
- package/dist/components/Mappings/BranchMapping/branchSchema.js +34 -0
- package/dist/components/Mappings/ComponentMapping/ComponentRoleMapping.js +98 -0
- package/dist/components/Mappings/ComponentMapping/componentRoleColumns.js +29 -0
- package/dist/components/Mappings/MappingForm/MappingForm.js +142 -0
- package/dist/components/Mappings/MappingForm/mappingSchema.js +32 -0
- package/dist/components/Mappings/RoleMapping/MappingFormUserRole.js +194 -0
- package/dist/components/Mappings/RoleMapping/UserRoleTableColumns.js +33 -0
- package/dist/components/NavBar/Sidebar.js +56 -0
- package/dist/components/ProfileForm/ProfileForm.js +190 -0
- package/dist/components/ProfileForm/ProfileList.js +33 -0
- package/dist/components/ProfileForm/profileColumns.js +67 -0
- package/dist/components/ProfileForm/profileSchema.js +50 -0
- package/dist/components/SettingsPage/SettingsPage.js +240 -0
- package/dist/components/api/settings-api.js +131 -0
- package/dist/components/common/Form/FormActionButtons.js +6 -0
- package/dist/components/common/Form/FormLabel.js +6 -0
- package/dist/components/common/ListTable/ListHeader.js +5 -0
- package/dist/components/common/ListTable/ListTable.js +31 -0
- package/dist/components/common/Modal/Modal.js +6 -0
- package/dist/config/EnvConfig.js +13 -0
- package/dist/config/amplifyConfig.js +45 -0
- package/dist/configureAppHost.js +5 -0
- package/dist/customGraphQL/customMutations.js +53 -0
- package/dist/customGraphQL/customQueries.js +104 -0
- package/dist/domain/input/input-types.js +1 -0
- package/dist/domain/model/BranchDto.js +8 -0
- package/dist/domain/model/ComponentMappingDto.js +19 -0
- package/dist/domain/model/MappingDto.js +16 -0
- package/dist/domain/model/PrefixDescriptionDto.js +13 -0
- package/dist/domain/model/ProfileDto.js +20 -0
- package/dist/domain/model/RoleMappingDto.js +19 -0
- package/dist/domain/model/SettingsDto.js +7 -0
- package/dist/domain/model/UserMappingDto.js +28 -0
- package/dist/domain/model/imageDto.js +1 -0
- package/dist/domain/type/EntityTypes.js +6 -0
- package/dist/domain/type/MappingOptions.js +1 -0
- package/dist/domain/type/MappingTypes.js +7 -0
- package/dist/domain/type/Nullable.js +1 -0
- package/dist/domain/type/ResettingPeriodOptions.js +8 -0
- package/dist/domain/type/RolesEnum.js +7 -0
- package/dist/domain/type/SelectType.js +1 -0
- package/dist/domain/type/StatusEnum.js +6 -0
- package/dist/domain/type/signUpOptions.js +4 -0
- package/dist/domain/type/statusOptions.js +4 -0
- package/dist/graphql/profileQueries.js +89 -0
- package/dist/hoc/withSyzyAuth.js +87 -0
- package/dist/hooks/useCurrentUser.js +6 -0
- package/dist/hooks/useDispatch.js +7 -0
- package/dist/hooks/usePermission.js +7 -0
- package/dist/index.js +3 -15
- package/dist/main.js +60 -0
- package/dist/services/Client.Service.js +96 -0
- package/dist/services/Storage-service.js +26 -0
- package/dist/services/navigationMenu.js +9 -0
- package/dist/static/constants.js +34 -0
- package/dist/store/AppAction.js +5 -0
- package/dist/store/AppContext.js +3 -0
- package/dist/store/AppContextType.js +6 -0
- package/dist/store/AppProvider.js +32 -0
- package/dist/store/HostedInContainerContext.js +11 -0
- package/dist/store/SesssionReducer.js +16 -0
- package/dist/types/App.d.ts +4 -0
- package/dist/types/AppHostProvider.d.ts +6 -0
- package/dist/types/AppHostRoutes.d.ts +1 -0
- package/dist/types/api/image-api.d.ts +8 -0
- package/dist/types/api/mapping-api.d.ts +80 -0
- package/dist/types/bookingModule/components/AmenityForm.d.ts +3 -0
- package/dist/types/bookingModule/components/BillingManagement.d.ts +3 -0
- package/dist/types/bookingModule/components/CreateRoomForm.d.ts +3 -0
- package/dist/types/bookingModule/components/ExtraRequirementForm.d.ts +3 -0
- package/dist/types/bookingModule/components/ReservationForm.d.ts +3 -0
- package/dist/types/bookingModule/components/RoomCategoryForm.d.ts +3 -0
- package/dist/types/bookingModule/components/RoomCategoryPriceForm.d.ts +3 -0
- package/dist/types/bookingModule/components/RoomExtraRequirementCapture.d.ts +3 -0
- package/dist/types/bookingModule/components/RoomFacilityForm.d.ts +3 -0
- package/dist/types/bookingModule/components/RoomReservationAction.d.ts +3 -0
- package/dist/types/components/Home/Home.d.ts +3 -0
- package/dist/types/components/Loader/Loader.d.ts +2 -0
- package/dist/types/components/Login/Login.d.ts +7 -0
- package/dist/types/components/Login/loginSchema.d.ts +27 -0
- package/dist/types/components/Mappings/BranchMapping/Branch.d.ts +5 -0
- package/dist/types/components/Mappings/BranchMapping/BranchTableColumns.d.ts +10 -0
- package/dist/types/components/Mappings/BranchMapping/MappingFormBranchUser.d.ts +3 -0
- package/dist/types/components/Mappings/BranchMapping/MappingTableColumns.d.ts +14 -0
- package/dist/types/components/Mappings/BranchMapping/branchSchema.d.ts +37 -0
- package/dist/types/components/Mappings/ComponentMapping/ComponentRoleMapping.d.ts +3 -0
- package/dist/types/components/Mappings/ComponentMapping/componentRoleColumns.d.ts +3 -0
- package/dist/types/components/Mappings/MappingForm/MappingForm.d.ts +35 -0
- package/dist/types/components/Mappings/MappingForm/mappingSchema.d.ts +23 -0
- package/dist/types/components/Mappings/RoleMapping/MappingFormUserRole.d.ts +5 -0
- package/dist/types/components/Mappings/RoleMapping/UserRoleTableColumns.d.ts +3 -0
- package/dist/types/components/NavBar/Sidebar.d.ts +4 -0
- package/dist/types/components/ProfileForm/ProfileForm.d.ts +3 -0
- package/dist/types/components/ProfileForm/ProfileList.d.ts +3 -0
- package/dist/types/components/ProfileForm/profileColumns.d.ts +3 -0
- package/dist/types/components/ProfileForm/profileSchema.d.ts +52 -0
- package/dist/types/components/SettingsPage/SettingsPage.d.ts +3 -0
- package/dist/types/components/api/settings-api.d.ts +26 -0
- package/dist/types/components/common/Form/FormActionButtons.d.ts +11 -0
- package/dist/types/components/common/Form/FormLabel.d.ts +8 -0
- package/dist/types/components/common/ListTable/ListHeader.d.ts +8 -0
- package/dist/types/components/common/ListTable/ListTable.d.ts +17 -0
- package/dist/types/components/common/Modal/Modal.d.ts +11 -0
- package/dist/types/config/EnvConfig.d.ts +13 -0
- package/dist/types/config/amplifyConfig.d.ts +1 -0
- package/dist/types/configureAppHost.d.ts +6 -0
- package/dist/types/customGraphQL/customMutations.d.ts +3 -0
- package/dist/types/customGraphQL/customQueries.d.ts +7 -0
- package/dist/types/domain/input/input-types.d.ts +47 -0
- package/dist/types/domain/model/BranchDto.d.ts +9 -0
- package/dist/types/domain/model/ComponentMappingDto.d.ts +24 -0
- package/dist/types/domain/model/MappingDto.d.ts +30 -0
- package/dist/types/domain/model/PrefixDescriptionDto.d.ts +16 -0
- package/dist/types/domain/model/ProfileDto.d.ts +21 -0
- package/dist/types/domain/model/RoleMappingDto.d.ts +14 -0
- package/dist/types/domain/model/SettingsDto.d.ts +8 -0
- package/dist/types/domain/model/UserMappingDto.d.ts +14 -0
- package/dist/types/domain/model/imageDto.d.ts +4 -0
- package/dist/types/domain/type/EntityTypes.d.ts +5 -0
- package/dist/types/domain/type/MappingOptions.d.ts +5 -0
- package/dist/types/domain/type/MappingTypes.d.ts +6 -0
- package/dist/types/domain/type/Nullable.d.ts +13 -0
- package/dist/types/domain/type/ResettingPeriodOptions.d.ts +2 -0
- package/dist/types/domain/type/RolesEnum.d.ts +6 -0
- package/dist/types/domain/type/SelectType.d.ts +16 -0
- package/dist/types/domain/type/StatusEnum.d.ts +5 -0
- package/dist/types/domain/type/signUpOptions.d.ts +2 -0
- package/dist/types/domain/type/statusOptions.d.ts +2 -0
- package/dist/types/graphql/profileQueries.d.ts +4 -0
- package/dist/types/hoc/withSyzyAuth.d.ts +2 -0
- package/dist/types/hooks/useCurrentUser.d.ts +3 -0
- package/dist/types/hooks/useDispatch.d.ts +3 -0
- package/dist/types/hooks/usePermission.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/main.d.ts +4 -0
- package/dist/types/services/Client.Service.d.ts +12 -0
- package/dist/types/services/Storage-service.d.ts +2 -0
- package/dist/types/services/navigationMenu.d.ts +1 -0
- package/dist/types/static/constants.d.ts +34 -0
- package/dist/types/store/AppAction.d.ts +11 -0
- package/dist/types/store/AppContext.d.ts +3 -0
- package/dist/types/store/AppContextType.d.ts +12 -0
- package/dist/types/store/AppProvider.d.ts +7 -0
- package/dist/types/store/HostedInContainerContext.d.ts +5 -0
- package/dist/types/store/SesssionReducer.d.ts +4 -0
- package/dist/types/types.d.ts +26 -0
- package/dist/types/util/AuthUtils.d.ts +1 -0
- package/dist/types/util/LogEnum.d.ts +6 -0
- package/dist/types/util/Logger.d.ts +6 -0
- package/dist/types/util/SyzyDate.d.ts +69 -0
- package/dist/types/util/dateUtils.d.ts +10 -0
- package/dist/types/util/hostedinContainer.d.ts +1 -0
- package/dist/types/util/model-types.d.ts +96 -0
- package/dist/types/util/prefixAndResettingValidation.d.ts +9 -0
- package/dist/types/util/transformToData.d.ts +1 -0
- package/dist/types.js +14 -0
- package/dist/util/AuthUtils.js +10 -0
- package/dist/util/LogEnum.js +7 -0
- package/dist/util/Logger.js +18 -0
- package/dist/util/SyzyDate.js +265 -0
- package/dist/util/dateUtils.js +24 -0
- package/dist/util/hostedinContainer.js +9 -0
- package/dist/util/model-types.js +18 -0
- package/dist/util/prefixAndResettingValidation.js +54 -0
- package/dist/util/transformToData.js +9 -0
- package/package.json +14 -9
- package/dist/__federation_shared_@tanstack/react-query-DHuUsaNz.js +0 -2517
- package/dist/__federation_shared_react-CikWE6qG.js +0 -7
- package/dist/__federation_shared_react-bootstrap-BKlZRvMR.js +0 -7516
- package/dist/__federation_shared_react-dom-vrQ70Ay8.js +0 -372
- package/dist/__federation_shared_react-router-dom-BKminmS4.js +0 -10448
- package/dist/__federation_shared_react-select-B6kehBDI.js +0 -4056
- package/dist/__federation_shared_react-toastify-B0S0UGr3.js +0 -412
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/_virtual___federation_fn_import-XZCKozko.js +0 -217
- package/dist/favicon.ico +0 -0
- package/dist/index-DgtWMtjZ.js +0 -184
- package/dist/index-eZknuYwc.js +0 -1219
- package/dist/jsx-runtime-D_t4bG-_.js +0 -264
- package/dist/manifest.webmanifest +0 -1
- package/dist/pwa/Hotel-icon.jpg +0 -0
- package/dist/pwa/apple-touch-icon-180x180.png +0 -0
- package/dist/pwa/favicon.ico +0 -0
- package/dist/pwa/maskable-icon-512x512.png +0 -0
- package/dist/pwa/pwa-192x192.png +0 -0
- package/dist/pwa/pwa-512x512.png +0 -0
- package/dist/pwa/pwa-64x64.png +0 -0
- package/dist/registerSW.js +0 -1
- package/dist/sw.js +0 -1
- package/dist/workbox-1ef09536.js +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { EnvConfig } from "../../config/EnvConfig";
|
|
3
|
+
import { initSettings } from "../../domain/model/SettingsDto";
|
|
4
|
+
import { Client } from "../../services/Client.Service";
|
|
5
|
+
import { transformToData } from "../../util/transformToData";
|
|
6
|
+
import { logger } from "../../util/Logger";
|
|
7
|
+
import { ALL } from "../../static/constants";
|
|
8
|
+
export const GET_SETTINGS_BY_PK = "settingsbypk";
|
|
9
|
+
export const GET_SETTINGS_BY_PK_AND_SK = "settingsbypkandsk";
|
|
10
|
+
const endpoint = EnvConfig.appHostAPi;
|
|
11
|
+
export const listSettings = `query listSettings(
|
|
12
|
+
$pk: ID
|
|
13
|
+
$sk: ModelStringKeyConditionInput
|
|
14
|
+
$filter: ModelSettingsFilterInput
|
|
15
|
+
) {
|
|
16
|
+
listSettings(pk: $pk, sk: $sk, filter: $filter) {
|
|
17
|
+
pk
|
|
18
|
+
sk
|
|
19
|
+
value
|
|
20
|
+
description
|
|
21
|
+
createdDt
|
|
22
|
+
__typename
|
|
23
|
+
}
|
|
24
|
+
}`;
|
|
25
|
+
export const updateSettings = `mutation updateSettings($input: SettingsInput!) {
|
|
26
|
+
updateSettings(input: $input) {
|
|
27
|
+
pk
|
|
28
|
+
sk
|
|
29
|
+
value
|
|
30
|
+
description
|
|
31
|
+
createdDt
|
|
32
|
+
__typename
|
|
33
|
+
}
|
|
34
|
+
}`;
|
|
35
|
+
export const transformtoSettingsDto = (interviewProspectData) => transformToData(interviewProspectData);
|
|
36
|
+
export const transformdToPrefixDescription = (description) => {
|
|
37
|
+
return JSON.parse(description);
|
|
38
|
+
};
|
|
39
|
+
export const getSettingsByPkFun = async (pk) => {
|
|
40
|
+
try {
|
|
41
|
+
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
42
|
+
const variables = {
|
|
43
|
+
filter: {
|
|
44
|
+
or: [
|
|
45
|
+
{ pk: { eq: pk } },
|
|
46
|
+
{ pk: { eq: ALL } }
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const response = await client.request(listSettings, variables);
|
|
51
|
+
const settingsData = response.listSettings;
|
|
52
|
+
return (settingsData && settingsData.length > 0) ? settingsData.map((eventSchedule) => transformtoSettingsDto(eventSchedule)) : [];
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export const useGetSettingsByPk = (pk) => {
|
|
59
|
+
const { data, isLoading, error, isFetching, isSuccess } = useQuery({
|
|
60
|
+
queryKey: [GET_SETTINGS_BY_PK, pk],
|
|
61
|
+
queryFn: () => getSettingsByPkFun(pk),
|
|
62
|
+
placeholderData: keepPreviousData,
|
|
63
|
+
staleTime: 1000 * 5 * 60,
|
|
64
|
+
enabled: pk !== "" && pk !== undefined,
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
settingsByPK: data,
|
|
68
|
+
settingsByPKError: error,
|
|
69
|
+
settingsByPKLoading: isLoading,
|
|
70
|
+
settingsByPKFetching: isFetching,
|
|
71
|
+
settingsByPKSuccess: isSuccess,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export const getSettingsByPkAndSKFun = async (pk, sk) => {
|
|
75
|
+
try {
|
|
76
|
+
const client = await Client.getCustomGraphqlClient(endpoint);
|
|
77
|
+
const variables = {
|
|
78
|
+
pk: pk,
|
|
79
|
+
sk: {
|
|
80
|
+
eq: sk
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const response = await client.request(listSettings, variables);
|
|
84
|
+
const settingsData = response.listSettings;
|
|
85
|
+
return (settingsData && settingsData.length > 0) ? transformtoSettingsDto(settingsData[0]) : initSettings;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return initSettings;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
export const useGetSettingsByPkAndSk = (pk, sk) => {
|
|
92
|
+
const { data, isLoading, error, isFetching, isSuccess } = useQuery({
|
|
93
|
+
queryKey: [GET_SETTINGS_BY_PK_AND_SK, pk, sk],
|
|
94
|
+
queryFn: () => getSettingsByPkAndSKFun(pk, sk),
|
|
95
|
+
placeholderData: keepPreviousData,
|
|
96
|
+
staleTime: 1000 * 5 * 60,
|
|
97
|
+
enabled: pk !== "" && pk !== undefined && sk !== "" && sk !== undefined,
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
settingsByPkAndSk: data,
|
|
101
|
+
settingsByPkAndSkError: error,
|
|
102
|
+
settingsByPkAndSkLoading: isLoading,
|
|
103
|
+
settingsByPkAndSkFetching: isFetching,
|
|
104
|
+
settingsByPkAndSkSuccess: isSuccess,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export const useUpdateSettingsMutation = () => {
|
|
108
|
+
async function createVersionFn(settingsData) {
|
|
109
|
+
const client = await Client.getClient();
|
|
110
|
+
const response = await client.graphql({
|
|
111
|
+
query: updateSettings,
|
|
112
|
+
variables: {
|
|
113
|
+
input: settingsData
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
return response;
|
|
117
|
+
}
|
|
118
|
+
const queryClient = useQueryClient();
|
|
119
|
+
return useMutation({
|
|
120
|
+
mutationFn: createVersionFn,
|
|
121
|
+
onSuccess: (_data, variables) => {
|
|
122
|
+
const settingsByPKQueryKey = [GET_SETTINGS_BY_PK, variables.pk];
|
|
123
|
+
queryClient.invalidateQueries({ queryKey: settingsByPKQueryKey });
|
|
124
|
+
const settingsByPKAndSKQueryKey = [GET_SETTINGS_BY_PK_AND_SK, variables.pk, variables.sk];
|
|
125
|
+
queryClient.invalidateQueries({ queryKey: settingsByPKAndSKQueryKey });
|
|
126
|
+
},
|
|
127
|
+
onError: (err) => {
|
|
128
|
+
logger.error("Error while settings updating", err);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const FormActionButtons = ({ isEditMode = false, loading = false, onClear, submitLabel = "Submit", updateLabel = "Update", disableSubmit = false, }) => {
|
|
3
|
+
const isSubmitDisabled = loading || disableSubmit;
|
|
4
|
+
return (_jsxs("div", { className: "mt-4 d-flex gap-4 justify-content-center", children: [_jsx("button", { type: "submit", className: "btn-primary-global m-0 py-2 px-4 fs-6", disabled: isSubmitDisabled, children: isEditMode ? updateLabel : submitLabel }), _jsx("button", { type: "button", className: "btn-secondary-global m-0 py-2 px-4 fs-6", onClick: onClear, children: "Clear" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default FormActionButtons;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Form } from "react-bootstrap";
|
|
3
|
+
const FormLabel = ({ label, required = false, className = "mt-2 mb-1 form-label", }) => {
|
|
4
|
+
return (_jsxs(Form.Label, { className: className, children: [label, required && _jsx("span", { className: "text-danger ms-1", children: "*" })] }));
|
|
5
|
+
};
|
|
6
|
+
export default FormLabel;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const ListHeader = ({ title, buttonLabel, onButtonClick, }) => {
|
|
3
|
+
return (_jsxs("div", { className: "mb-3", children: [buttonLabel && onButtonClick && (_jsx("div", { className: "d-flex justify-content-center", children: _jsx("button", { className: "btn-primary-global", onClick: onButtonClick, children: buttonLabel }) })), _jsx("h5", { className: "text-start text-md-center font-title", children: title })] }));
|
|
4
|
+
};
|
|
5
|
+
export default ListHeader;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Table, Pagination } from "react-bootstrap";
|
|
4
|
+
import LoadingSpinner from "../../Loader/Loader";
|
|
5
|
+
function ListTable({ columns, data, emptyMessage = "No records found", onEdit, pageSize = 10, loading = false, pageSizeOptions = [10, 25, 50, 100], }) {
|
|
6
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
7
|
+
const [rowsPerPage, setRowsPerPage] = useState(pageSize);
|
|
8
|
+
const hasData = data && data.length > 0;
|
|
9
|
+
const totalPages = Math.ceil(data.length / rowsPerPage);
|
|
10
|
+
const paginatedData = useMemo(() => {
|
|
11
|
+
const start = (currentPage - 1) * rowsPerPage;
|
|
12
|
+
return data.slice(start, start + rowsPerPage);
|
|
13
|
+
}, [data, currentPage, rowsPerPage]);
|
|
14
|
+
const handlePageChange = (page) => {
|
|
15
|
+
if (page >= 1 && page <= totalPages) {
|
|
16
|
+
setCurrentPage(page);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const handleRowsPerPageChange = (value) => {
|
|
20
|
+
setRowsPerPage(value);
|
|
21
|
+
setCurrentPage(1);
|
|
22
|
+
};
|
|
23
|
+
const colSpan = columns.length + (onEdit ? 1 : 0);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "table-responsive", children: _jsxs(Table, { bordered: true, hover: true, className: "mb-0", children: [_jsx("thead", { className: "table-head", children: _jsxs("tr", { children: [columns.map((col, index) => (_jsx("th", { className: `text-${col.align ?? "left"}`, children: col.header }, index))), onEdit && _jsx("th", { className: "text-center", children: "Actions" })] }) }), _jsx("tbody", { children: loading ? (_jsx("tr", { children: _jsx("td", { colSpan: colSpan, className: "text-center py-5", children: _jsx(LoadingSpinner, {}) }) })) : !hasData ? (_jsx("tr", { children: _jsx("td", { colSpan: colSpan, className: "text-center fs-5 text-danger py-3", children: emptyMessage }) })) : (paginatedData.map((row, rowIndex) => (_jsxs("tr", { children: [columns.map((col, colIndex) => (_jsx("td", { className: `text-${col.align ?? "left"}`, children: typeof col.accessor === "function"
|
|
25
|
+
? col.accessor(row, rowIndex)
|
|
26
|
+
: row[col.accessor] }, colIndex))), onEdit && (_jsx("td", { className: "text-center", children: _jsx("button", { className: "btn-primary-global table-edit-btn m-0 py-1 px-3 fs-6", onClick: () => onEdit(row), children: "Edit" }) }))] }, rowIndex)))) })] }) }), hasData && !loading && (_jsxs("div", { className: "d-flex justify-content-center gap-5 align-items-center mt-3 flex-wrap gap-2", children: [_jsxs(Pagination, { className: "mb-0", children: [_jsx(Pagination.Prev, { disabled: currentPage === 1 || totalPages <= 1, onClick: () => handlePageChange(currentPage - 1) }), [...Array(totalPages)].map((_, index) => {
|
|
27
|
+
const page = index + 1;
|
|
28
|
+
return (_jsx(Pagination.Item, { active: page === currentPage, disabled: totalPages <= 1, onClick: () => handlePageChange(page), children: page }, page));
|
|
29
|
+
}), _jsx(Pagination.Next, { disabled: currentPage === totalPages || totalPages <= 1, onClick: () => handlePageChange(currentPage + 1) })] }), _jsxs("div", { className: "d-flex align-items-center gap-2", children: [_jsx("span", { className: "fw-semibold", children: "Rows per page:" }), _jsx("select", { className: "form-select form-select-sm w-auto", value: rowsPerPage, onChange: (e) => handleRowsPerPageChange(Number(e.target.value)), children: pageSizeOptions.map((size) => (_jsx("option", { value: size, children: size }, size))) })] })] }))] }));
|
|
30
|
+
}
|
|
31
|
+
export default ListTable;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal } from "react-bootstrap";
|
|
3
|
+
const FormModal = ({ show, title, onClose, children, size = "lg", backdrop = "static", }) => {
|
|
4
|
+
return (_jsxs(Modal, { show: show, onHide: onClose, centered: true, size: size, backdrop: backdrop, children: [_jsx(Modal.Header, { className: "py-0 px-4 px-md-5", closeButton: true, children: _jsx(Modal.Title, { className: "font-title", children: title }) }), _jsx(Modal.Body, { className: "py-3 py-md-4 px-4 px-md-5", children: children })] }));
|
|
5
|
+
};
|
|
6
|
+
export default FormModal;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const EnvConfig = {
|
|
2
|
+
env: import.meta.env.VITE_SERVER_ENV || "local",
|
|
3
|
+
appHostAPi: import.meta.env.VITE_HMS_SERVICE_SERVER_URL || "",
|
|
4
|
+
region: import.meta.env.VITE_AWS_REGION || "",
|
|
5
|
+
userPoolId: import.meta.env.VITE_USERPOOL_ID || "",
|
|
6
|
+
userPoolClientId: import.meta.env.VITE_USERPOOL_CLIENT_ID || "",
|
|
7
|
+
identityPoolId: import.meta.env.VITE_IDPOOL_ID || "",
|
|
8
|
+
storage: import.meta.env.VITE_STORAGE_NAME || "",
|
|
9
|
+
apiKey: import.meta.env.VITE_API_KEY || undefined,
|
|
10
|
+
template: import.meta.env.VITE_TEMPLATE || undefined,
|
|
11
|
+
imageStorageBucketUrl: import.meta.env.VITE_IMAGE_STORAGE_BUCKET_URL || "",
|
|
12
|
+
applicationName: import.meta.env.VITE_APPLICATION_NAME || "",
|
|
13
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Amplify } from 'aws-amplify';
|
|
2
|
+
import { EnvConfig } from './EnvConfig';
|
|
3
|
+
import { VITE_API_AUTHMODE } from "../static/constants";
|
|
4
|
+
// Optional global marker for debugging
|
|
5
|
+
const AMPLIFY_INIT_FLAG = '__AMPLIFY_INITIALIZED__';
|
|
6
|
+
export function configureAmplify() {
|
|
7
|
+
const apiConfig = {
|
|
8
|
+
GraphQL: {
|
|
9
|
+
endpoint: EnvConfig.appHostAPi,
|
|
10
|
+
region: EnvConfig.region,
|
|
11
|
+
defaultAuthMode: VITE_API_AUTHMODE,
|
|
12
|
+
apiKey: EnvConfig.apiKey,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
const authConfig = {
|
|
16
|
+
Cognito: {
|
|
17
|
+
allowGuestAccess: true,
|
|
18
|
+
userPoolId: EnvConfig.userPoolId,
|
|
19
|
+
userPoolClientId: EnvConfig.userPoolClientId,
|
|
20
|
+
identityPoolId: EnvConfig.identityPoolId,
|
|
21
|
+
signUpVerificationMethod: 'code',
|
|
22
|
+
loginWith: { email: true },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const storageConfig = {
|
|
26
|
+
S3: {
|
|
27
|
+
bucket: EnvConfig.storage,
|
|
28
|
+
region: EnvConfig.region,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
// 1️⃣ If running inside a host, do nothing — assume host already configured Amplify
|
|
32
|
+
if (window.hosted_in_container === true) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// 2️⃣ If already initialized (e.g. hot reload), skip
|
|
36
|
+
if (window[AMPLIFY_INIT_FLAG]) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
Amplify.configure({
|
|
40
|
+
API: apiConfig,
|
|
41
|
+
Auth: authConfig,
|
|
42
|
+
Storage: storageConfig,
|
|
43
|
+
});
|
|
44
|
+
window[AMPLIFY_INIT_FLAG] = true;
|
|
45
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// ---------- Branch GraphQL Mutation ----------
|
|
2
|
+
export const createBranchMutationGQL = `
|
|
3
|
+
mutation CreateBranch($input: BranchInput!) {
|
|
4
|
+
createBranch(input: $input) {
|
|
5
|
+
pk
|
|
6
|
+
sk
|
|
7
|
+
branchAddress
|
|
8
|
+
branchContactNumber
|
|
9
|
+
createdDt
|
|
10
|
+
status
|
|
11
|
+
__typename
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
export const createMapping = `mutation CreateMapping($input: MappingInput!) {
|
|
16
|
+
createMapping(input: $input) {
|
|
17
|
+
pk
|
|
18
|
+
sk
|
|
19
|
+
branchName
|
|
20
|
+
entity
|
|
21
|
+
userId
|
|
22
|
+
userName
|
|
23
|
+
roleId
|
|
24
|
+
roleName
|
|
25
|
+
componentId
|
|
26
|
+
componentTitle
|
|
27
|
+
disabledDt
|
|
28
|
+
createdDt
|
|
29
|
+
createdBy
|
|
30
|
+
status
|
|
31
|
+
__typename
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
export const updateMapping = `mutation UpdateMapping($input: MappingInput!) {
|
|
36
|
+
updateMapping(input: $input) {
|
|
37
|
+
pk
|
|
38
|
+
sk
|
|
39
|
+
entity
|
|
40
|
+
userId
|
|
41
|
+
userName
|
|
42
|
+
roleId
|
|
43
|
+
roleName
|
|
44
|
+
componentId
|
|
45
|
+
componentTitle
|
|
46
|
+
disabledDt
|
|
47
|
+
createdDt
|
|
48
|
+
createdBy
|
|
49
|
+
status
|
|
50
|
+
__typename
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const listBranchesQuery = `
|
|
2
|
+
query ListBranches {
|
|
3
|
+
listBranch {
|
|
4
|
+
pk
|
|
5
|
+
sk
|
|
6
|
+
branchAddress
|
|
7
|
+
branchContactNumber
|
|
8
|
+
status
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
export const updateBranchMutationQuery = `
|
|
13
|
+
mutation UpdateBranch($input: BranchInput!) {
|
|
14
|
+
updateBranch(input: $input) {
|
|
15
|
+
pk
|
|
16
|
+
sk
|
|
17
|
+
branchAddress
|
|
18
|
+
branchContactNumber
|
|
19
|
+
status
|
|
20
|
+
createdDt
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
export const ListBranchUserMappings = `query ListBranchUserMappings {
|
|
25
|
+
listMapping(filter: { entity: { eq: "USER" } }) {
|
|
26
|
+
pk
|
|
27
|
+
sk
|
|
28
|
+
userId
|
|
29
|
+
userName
|
|
30
|
+
status
|
|
31
|
+
createdDt
|
|
32
|
+
disabledDt
|
|
33
|
+
createdBy
|
|
34
|
+
}
|
|
35
|
+
}`;
|
|
36
|
+
export const listMapping = `query ListMapping(
|
|
37
|
+
$pk: String
|
|
38
|
+
$sk: ModelStringKeyConditionInput
|
|
39
|
+
$filter: ModelMappingFilterInput
|
|
40
|
+
) {
|
|
41
|
+
listMapping(pk: $pk, sk: $sk, filter: $filter) {
|
|
42
|
+
pk
|
|
43
|
+
sk
|
|
44
|
+
entity
|
|
45
|
+
userId
|
|
46
|
+
userName
|
|
47
|
+
roleId
|
|
48
|
+
roleName
|
|
49
|
+
componentId
|
|
50
|
+
componentTitle
|
|
51
|
+
disabledDt
|
|
52
|
+
createdDt
|
|
53
|
+
status
|
|
54
|
+
__typename
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
export const getMappingByRoleId = `query GetMappingByRoleId($roleId: String) {
|
|
59
|
+
getMappingByRoleId(roleId: $roleId) {
|
|
60
|
+
pk
|
|
61
|
+
sk
|
|
62
|
+
entity
|
|
63
|
+
userId
|
|
64
|
+
userName
|
|
65
|
+
roleId
|
|
66
|
+
roleName
|
|
67
|
+
componentId
|
|
68
|
+
componentTitle
|
|
69
|
+
disabledDt
|
|
70
|
+
createdDt
|
|
71
|
+
status
|
|
72
|
+
__typename
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
export const ListUserRoleMapping = `query ListUserRoleMappings {
|
|
77
|
+
listMapping(filter: { entity: { eq: "ROLE" } }) {
|
|
78
|
+
pk
|
|
79
|
+
sk
|
|
80
|
+
userId
|
|
81
|
+
userName
|
|
82
|
+
roleId
|
|
83
|
+
roleName
|
|
84
|
+
status
|
|
85
|
+
createdDt
|
|
86
|
+
disabledDt
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
export const ListComponentRoleMappings = `
|
|
91
|
+
query ListComponentRoleMappings {
|
|
92
|
+
listMapping(filter: { entity: { eq: "COMPONENT" } }) {
|
|
93
|
+
pk
|
|
94
|
+
sk
|
|
95
|
+
roleId
|
|
96
|
+
roleName
|
|
97
|
+
componentId
|
|
98
|
+
componentTitle
|
|
99
|
+
status
|
|
100
|
+
createdDt
|
|
101
|
+
disabledDt
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { logger } from "../../util/Logger";
|
|
2
|
+
export const initComponentMappingDto = {
|
|
3
|
+
pk: "",
|
|
4
|
+
sk: "",
|
|
5
|
+
entity: "",
|
|
6
|
+
roleId: "",
|
|
7
|
+
roleName: "",
|
|
8
|
+
componentId: "",
|
|
9
|
+
componentTitle: "",
|
|
10
|
+
disabledDt: "",
|
|
11
|
+
createdDt: "",
|
|
12
|
+
status: "",
|
|
13
|
+
};
|
|
14
|
+
export const transformtoComponentMappingDto = (userData) => {
|
|
15
|
+
const { __typename, createdAt, updatedAt, userId, userName, ...itm } = userData;
|
|
16
|
+
const transformedCompoData = { ...itm };
|
|
17
|
+
logger.debug("transformed component mapping data:", transformedCompoData);
|
|
18
|
+
return transformedCompoData;
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const initMappingDto = {
|
|
2
|
+
pk: "",
|
|
3
|
+
sk: "",
|
|
4
|
+
branchName: "",
|
|
5
|
+
entity: "",
|
|
6
|
+
userId: "",
|
|
7
|
+
userName: "",
|
|
8
|
+
roleId: "",
|
|
9
|
+
roleName: "",
|
|
10
|
+
componentId: "",
|
|
11
|
+
componentTitle: "",
|
|
12
|
+
disabledDt: "",
|
|
13
|
+
createdDt: "",
|
|
14
|
+
createdBy: "",
|
|
15
|
+
status: "",
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Status } from "../type/StatusEnum";
|
|
2
|
+
export const initProfileDto = {
|
|
3
|
+
pk: "",
|
|
4
|
+
sk: "",
|
|
5
|
+
customId: "",
|
|
6
|
+
name: "",
|
|
7
|
+
email: "",
|
|
8
|
+
phoneNumber: "",
|
|
9
|
+
address: "",
|
|
10
|
+
dob: "",
|
|
11
|
+
contactRelation: "",
|
|
12
|
+
contactPersonName: "",
|
|
13
|
+
contactPersonNumber: "",
|
|
14
|
+
aadhaarNumber: "",
|
|
15
|
+
aadhaarFile: "",
|
|
16
|
+
isAdmin: false,
|
|
17
|
+
status: Status.Active || Status.Inactive,
|
|
18
|
+
createdDt: new Date().toISOString(),
|
|
19
|
+
createdBy: "",
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { logger } from "../../util/Logger";
|
|
2
|
+
export const initRoleMappingDto = {
|
|
3
|
+
pk: "",
|
|
4
|
+
sk: "",
|
|
5
|
+
entity: "",
|
|
6
|
+
userId: "",
|
|
7
|
+
userName: "",
|
|
8
|
+
roleId: "",
|
|
9
|
+
roleName: "",
|
|
10
|
+
disabledDt: "",
|
|
11
|
+
createdDt: "",
|
|
12
|
+
status: "",
|
|
13
|
+
};
|
|
14
|
+
export const transformtoRoleMappingDto = (userData) => {
|
|
15
|
+
const { __typename, createdAt, updatedAt, componentId, componentTitle, ...itm } = userData;
|
|
16
|
+
const transformedRoleData = { ...itm };
|
|
17
|
+
logger.info("transformed role mapping data:", transformedRoleData);
|
|
18
|
+
return transformedRoleData;
|
|
19
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { logger } from "../../util/Logger";
|
|
2
|
+
export const initUserMappingDto = {
|
|
3
|
+
pk: "",
|
|
4
|
+
sk: "",
|
|
5
|
+
entity: "",
|
|
6
|
+
userId: "",
|
|
7
|
+
userName: "",
|
|
8
|
+
roleId: "",
|
|
9
|
+
roleName: "",
|
|
10
|
+
disabledDt: "",
|
|
11
|
+
createdDt: "",
|
|
12
|
+
status: "",
|
|
13
|
+
};
|
|
14
|
+
export const transformtoUserMappingDto = (userData) => {
|
|
15
|
+
try {
|
|
16
|
+
if (!userData || typeof userData !== "object") {
|
|
17
|
+
logger.error("Invalid userData:", userData);
|
|
18
|
+
}
|
|
19
|
+
const { __typename, createdAt, updatedAt, componentId, componentTitle, ...itm } = userData;
|
|
20
|
+
const transformedUserData = { ...itm };
|
|
21
|
+
logger.info("transformtoUserMappingDto -> Output:", transformedUserData);
|
|
22
|
+
return transformedUserData;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
logger.error("transformtoUserMappingDto ERROR:", error);
|
|
26
|
+
return initUserMappingDto;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DAILY, FINANCIAL_YEARLY, MONTHLY, NEVER, YEARLY } from "../../static/constants";
|
|
2
|
+
export const ResettingPeriodOptions = [
|
|
3
|
+
{ value: FINANCIAL_YEARLY, label: FINANCIAL_YEARLY },
|
|
4
|
+
{ value: YEARLY, label: YEARLY },
|
|
5
|
+
{ value: MONTHLY, label: MONTHLY },
|
|
6
|
+
{ value: DAILY, label: DAILY },
|
|
7
|
+
{ value: NEVER, label: NEVER }
|
|
8
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|