@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,265 @@
|
|
|
1
|
+
import { DATE_FORMAT_ISO_YYYY_MM_DD } from "./dateUtils";
|
|
2
|
+
export class SyzyDate extends Date {
|
|
3
|
+
static months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
4
|
+
addDays = (days) => {
|
|
5
|
+
if (!days)
|
|
6
|
+
return this;
|
|
7
|
+
this.setDate(this.getDate() + days);
|
|
8
|
+
return this;
|
|
9
|
+
};
|
|
10
|
+
reduceDays = (days) => {
|
|
11
|
+
if (!days)
|
|
12
|
+
return this;
|
|
13
|
+
this.setDate(this.getDate() - days);
|
|
14
|
+
return this;
|
|
15
|
+
};
|
|
16
|
+
isSameDate = (date) => {
|
|
17
|
+
return date && this.getFullYear() === date.getFullYear() && this.getMonth() === date.getMonth() && this.getDate() === date.getDate();
|
|
18
|
+
};
|
|
19
|
+
isToday = () => {
|
|
20
|
+
const today = new Date();
|
|
21
|
+
return this.isSameDate(today);
|
|
22
|
+
};
|
|
23
|
+
clone = () => {
|
|
24
|
+
return new Date(+this);
|
|
25
|
+
};
|
|
26
|
+
isAnotherMonth = (date) => {
|
|
27
|
+
return date && this.getMonth() !== date.getMonth();
|
|
28
|
+
};
|
|
29
|
+
isWeekend = () => {
|
|
30
|
+
return this.getDay() === 0 || this.getDay() === 6;
|
|
31
|
+
};
|
|
32
|
+
toISODate = () => {
|
|
33
|
+
return this.toISOString().split('T')[0];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @returns Current Date as ISO string with T between date and time
|
|
38
|
+
*/
|
|
39
|
+
toISODateTime = () => {
|
|
40
|
+
let dt = this.toISOString();
|
|
41
|
+
dt = dt.replace('T', ' ');
|
|
42
|
+
dt = dt.substring(0, dt.indexOf('.'));
|
|
43
|
+
return dt;
|
|
44
|
+
};
|
|
45
|
+
toISODateString() {
|
|
46
|
+
return this.toDateFormatString(DATE_FORMAT_ISO_YYYY_MM_DD);
|
|
47
|
+
}
|
|
48
|
+
/***
|
|
49
|
+
* To Given Format
|
|
50
|
+
* DD- Date
|
|
51
|
+
* MM- Month in 2 digits
|
|
52
|
+
* Mon- Month in 3 letters
|
|
53
|
+
* mm- Minutes
|
|
54
|
+
* HH- Hours in 24 hour format
|
|
55
|
+
* hh- Hours in 12 hour format
|
|
56
|
+
* ss- Seconds
|
|
57
|
+
* YYYY- Year in 4 digits
|
|
58
|
+
* YY- Year in 2 digits
|
|
59
|
+
*/
|
|
60
|
+
toDateFormatString(format) {
|
|
61
|
+
let formatString = format;
|
|
62
|
+
// HH - 24 hour format
|
|
63
|
+
if (formatString.includes("HH")) {
|
|
64
|
+
formatString = formatString.replace("HH", this.getHours().toString().padStart(2, '0'));
|
|
65
|
+
}
|
|
66
|
+
if (formatString.includes("mm")) {
|
|
67
|
+
formatString = formatString.replace("mm", this.getMinutes().toString().padStart(2, '0'));
|
|
68
|
+
}
|
|
69
|
+
if (formatString.includes("ss")) {
|
|
70
|
+
formatString = formatString.replace("ss", this.getSeconds().toString().padStart(2, '0'));
|
|
71
|
+
}
|
|
72
|
+
if (formatString.includes("DD")) {
|
|
73
|
+
formatString = formatString.replace("DD", this.getDate().toString().padStart(2, '0'));
|
|
74
|
+
}
|
|
75
|
+
if (formatString.includes("MM")) {
|
|
76
|
+
formatString = formatString.replace("MM", (this.getMonth() + 1).toString().padStart(2, '0'));
|
|
77
|
+
}
|
|
78
|
+
if (formatString.includes("YYYY")) {
|
|
79
|
+
formatString = formatString.replace("YYYY", this.getFullYear().toString().padStart(2, '0'));
|
|
80
|
+
}
|
|
81
|
+
if (formatString.includes("YY")) {
|
|
82
|
+
formatString = formatString.replace("YY", this.getFullYear().toString().substring(2));
|
|
83
|
+
}
|
|
84
|
+
if (formatString.includes("Mon")) {
|
|
85
|
+
formatString = formatString.replace("Mon", SyzyDate.months[this.getMonth()]);
|
|
86
|
+
}
|
|
87
|
+
// hh will have am/pm
|
|
88
|
+
if (formatString.includes("hh")) {
|
|
89
|
+
const hr = this.getHours();
|
|
90
|
+
formatString = formatString.replace("hh", (hr % 12).toString());
|
|
91
|
+
const am_pm = hr < 12 ? "AM" : "PM";
|
|
92
|
+
formatString = `${formatString} ${am_pm}`;
|
|
93
|
+
}
|
|
94
|
+
return formatString;
|
|
95
|
+
}
|
|
96
|
+
getCurrentISODate = () => {
|
|
97
|
+
return this.toISODate();
|
|
98
|
+
};
|
|
99
|
+
toDate = () => {
|
|
100
|
+
const dateOnly = this.toISODate();
|
|
101
|
+
return new Date(Date.parse(dateOnly));
|
|
102
|
+
};
|
|
103
|
+
getCurrentDate = () => {
|
|
104
|
+
return new SyzyDate();
|
|
105
|
+
};
|
|
106
|
+
currentWeek = () => {
|
|
107
|
+
const tempDate = new Date(this.getTime());
|
|
108
|
+
const startOfYear = new Date(tempDate.getFullYear(), 0, 1);
|
|
109
|
+
const pastDaysOfYear = Math.floor((tempDate.getTime() - startOfYear.getTime()) / 86400000);
|
|
110
|
+
// Calculate the day of the week (0 for Sunday, 1 for Monday, ..., 6 for Saturday)
|
|
111
|
+
const dayOfWeek = tempDate.getDay();
|
|
112
|
+
// Adjust the day count based on the day of the week to align with Sunday as the start of the week
|
|
113
|
+
const adjustedDayOfYear = pastDaysOfYear - dayOfWeek + (dayOfWeek === 0 ? 0 : 7);
|
|
114
|
+
const weekNumber = Math.ceil(adjustedDayOfYear / 7);
|
|
115
|
+
return weekNumber;
|
|
116
|
+
};
|
|
117
|
+
currentTerm = () => {
|
|
118
|
+
let term = 0;
|
|
119
|
+
const currentMon = this.getMonth() + 1;
|
|
120
|
+
if (currentMon && currentMon <= 6) {
|
|
121
|
+
term = 1;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
term = 2;
|
|
125
|
+
}
|
|
126
|
+
return term;
|
|
127
|
+
};
|
|
128
|
+
currentQuarter = () => {
|
|
129
|
+
let quarter = 0;
|
|
130
|
+
const currentMon = this.getMonth() + 1;
|
|
131
|
+
if (currentMon >= 1 && currentMon <= 3) {
|
|
132
|
+
quarter = 1;
|
|
133
|
+
}
|
|
134
|
+
else if (currentMon >= 4 && currentMon <= 6) {
|
|
135
|
+
quarter = 2;
|
|
136
|
+
}
|
|
137
|
+
else if (currentMon >= 7 && currentMon <= 9) {
|
|
138
|
+
quarter = 3;
|
|
139
|
+
}
|
|
140
|
+
else if (currentMon >= 10 && currentMon <= 12) {
|
|
141
|
+
quarter = 4;
|
|
142
|
+
}
|
|
143
|
+
return quarter;
|
|
144
|
+
};
|
|
145
|
+
getCurrentYrAndMonAndQuarterAndTerm = () => {
|
|
146
|
+
const currentYr = this.getFullYear();
|
|
147
|
+
const currentMon = this.getMonth() + 1;
|
|
148
|
+
const currTerm = this.currentTerm();
|
|
149
|
+
const currentQuarter = this.currentQuarter();
|
|
150
|
+
return { currentYr, currentMon, currTerm, currentQuarter };
|
|
151
|
+
};
|
|
152
|
+
getWeekNo = () => {
|
|
153
|
+
const startOfYear = new Date(this.getFullYear(), 0, 1);
|
|
154
|
+
const pastDaysOfYear = Math.floor((this.getTime() - startOfYear.getTime()) / 86400000);
|
|
155
|
+
// Calculate the day of the week (0 for Sunday, 1 for Monday, ..., 6 for Saturday)
|
|
156
|
+
const dayOfWeek = this.getDay();
|
|
157
|
+
// Adjust the day count based on the day of the week to align with Sunday as the start of the week
|
|
158
|
+
const adjustedDayOfYear = pastDaysOfYear - dayOfWeek + (dayOfWeek === 0 ? 0 : 7);
|
|
159
|
+
const weekNumber = Math.ceil(adjustedDayOfYear / 7);
|
|
160
|
+
return weekNumber;
|
|
161
|
+
};
|
|
162
|
+
getcurrentTerm = () => {
|
|
163
|
+
let term = 0;
|
|
164
|
+
const currentMon = this.getMonth() + 1;
|
|
165
|
+
if (currentMon >= 1 && currentMon <= 6) {
|
|
166
|
+
term = 1; // First term (Jan-Jun)
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
term = 2; // Second term (Jul-Dec)
|
|
170
|
+
}
|
|
171
|
+
return term;
|
|
172
|
+
};
|
|
173
|
+
getCurrentQuarter = () => {
|
|
174
|
+
let quarter = 0;
|
|
175
|
+
const currentMon = this.getMonth() + 1;
|
|
176
|
+
if (currentMon >= 1 && currentMon <= 3) {
|
|
177
|
+
quarter = 1; // First quarter (Jan-Mar)
|
|
178
|
+
}
|
|
179
|
+
else if (currentMon >= 4 && currentMon <= 6) {
|
|
180
|
+
quarter = 2; // Second quarter (Apr-Jun)
|
|
181
|
+
}
|
|
182
|
+
else if (currentMon >= 7 && currentMon <= 9) {
|
|
183
|
+
quarter = 3; // Third quarter (Jul-Sep)
|
|
184
|
+
}
|
|
185
|
+
else if (currentMon >= 10 && currentMon <= 12) {
|
|
186
|
+
quarter = 4; // Fourth quarter (Oct-Dec)
|
|
187
|
+
}
|
|
188
|
+
return quarter;
|
|
189
|
+
};
|
|
190
|
+
getCurrentMonthStartAndEnd = () => {
|
|
191
|
+
const dt = new Date();
|
|
192
|
+
const startOfMonth = new Date(dt.getFullYear(), dt.getMonth(), 1);
|
|
193
|
+
const endOfMonth = new Date(dt.getFullYear(), dt.getMonth() + 1, 0);
|
|
194
|
+
return { startOfMonth, endOfMonth };
|
|
195
|
+
};
|
|
196
|
+
getCurrentTermStartAndEnd = () => {
|
|
197
|
+
const currentYear = this.getFullYear();
|
|
198
|
+
let startOfTerm;
|
|
199
|
+
let endDateOfTerm;
|
|
200
|
+
if (this.getMonth() < 6) {
|
|
201
|
+
startOfTerm = new Date(currentYear, 0, 1);
|
|
202
|
+
endDateOfTerm = new Date(currentYear, 5, 30);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
// Second term: July to December
|
|
206
|
+
startOfTerm = new Date(currentYear, 6, 1);
|
|
207
|
+
endDateOfTerm = new Date(currentYear, 11, 31);
|
|
208
|
+
}
|
|
209
|
+
return { startOfTerm, endDateOfTerm };
|
|
210
|
+
};
|
|
211
|
+
getCurrentYearStartAndEnd = () => {
|
|
212
|
+
const currentYear = this.getFullYear();
|
|
213
|
+
// Start of the year: January 1st
|
|
214
|
+
const startOfYear = new Date(currentYear, 0, 1);
|
|
215
|
+
// End of the year: December 31st
|
|
216
|
+
const endOfYear = new Date(currentYear, 11, 31);
|
|
217
|
+
return { startOfYear, endOfYear };
|
|
218
|
+
};
|
|
219
|
+
getCurrentQuarterStartAndEnd = () => {
|
|
220
|
+
const currentYear = this.getFullYear();
|
|
221
|
+
const currentQuarter = this.currentQuarter();
|
|
222
|
+
let startMonth = 0, endMonth = 0;
|
|
223
|
+
if (currentQuarter === 1) {
|
|
224
|
+
startMonth = 1;
|
|
225
|
+
endMonth = 3;
|
|
226
|
+
}
|
|
227
|
+
else if (currentQuarter === 2) {
|
|
228
|
+
startMonth = 4;
|
|
229
|
+
endMonth = 6;
|
|
230
|
+
}
|
|
231
|
+
else if (currentQuarter === 3) {
|
|
232
|
+
startMonth = 7;
|
|
233
|
+
endMonth = 9;
|
|
234
|
+
}
|
|
235
|
+
else if (currentQuarter === 4) {
|
|
236
|
+
startMonth = 10;
|
|
237
|
+
endMonth = 12;
|
|
238
|
+
}
|
|
239
|
+
const startDateOfQuarter = new Date(currentYear, startMonth - 1, 1);
|
|
240
|
+
const endDateOfQuarter = new Date(currentYear, endMonth, 0);
|
|
241
|
+
return { startDateOfQuarter, endDateOfQuarter };
|
|
242
|
+
};
|
|
243
|
+
getCurrentWeekStartAndEnd = () => {
|
|
244
|
+
const today = new Date();
|
|
245
|
+
// Sunday = 0, Monday = 1, ..., Saturday = 6
|
|
246
|
+
const dayOfWeek = today.getDay();
|
|
247
|
+
// Calculate Sunday (start of week)
|
|
248
|
+
const startDateOfWeek = new Date(today);
|
|
249
|
+
startDateOfWeek.setDate(today.getDate() - dayOfWeek);
|
|
250
|
+
// Calculate Saturday (end of week)
|
|
251
|
+
const endDateOfWeek = new Date(today);
|
|
252
|
+
endDateOfWeek.setDate(today.getDate() + (6 - dayOfWeek));
|
|
253
|
+
// Clear time part for consistency
|
|
254
|
+
startDateOfWeek.setHours(0, 0, 0, 0);
|
|
255
|
+
endDateOfWeek.setHours(23, 59, 59, 999);
|
|
256
|
+
return { startDateOfWeek, endDateOfWeek };
|
|
257
|
+
};
|
|
258
|
+
getSelectedMonthStartAndEnd = (month) => {
|
|
259
|
+
const dt = new Date();
|
|
260
|
+
const year = dt.getFullYear(); // You can optionally pass year as well
|
|
261
|
+
const startOfSelectedMonth = new Date(year, month - 1, 1);
|
|
262
|
+
const endOfSelectedMonth = new Date(year, month, 0); // 0th day of next month = last day of current month
|
|
263
|
+
return { startOfSelectedMonth, endOfSelectedMonth };
|
|
264
|
+
};
|
|
265
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { logger } from "./Logger";
|
|
2
|
+
export const DATE_FORMAT_ISO_DD_MON_YYYY = 'DD-Mon-YYYY';
|
|
3
|
+
export const DATE_FORMAT_ISO_YYYY_MM_DD = 'YYYY-MM-DD';
|
|
4
|
+
export const DATE_FORMAT_DD_MM_YYYY = 'DD-MM-YYYY';
|
|
5
|
+
export const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM = 'YYYY-MM-DD HH:mm';
|
|
6
|
+
export const DATE_FORMAT_ISO_YYYY_MM_DD_HH_MM_SS = 'YYYY-MM-DD HH:mm:ss';
|
|
7
|
+
export const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM = 'DD-Mon-YYYY HH:mm';
|
|
8
|
+
export const DATE_FORMAT_ISO_DD_MON_YYYY_HH_MM_SS = 'DD-Mon-YYYY HH:mm:ss';
|
|
9
|
+
export const formatDateWithShortMonth = (isoDateString) => {
|
|
10
|
+
const date = new Date(isoDateString);
|
|
11
|
+
return new Intl.DateTimeFormat('en-gb', {
|
|
12
|
+
day: '2-digit',
|
|
13
|
+
month: 'short',
|
|
14
|
+
year: 'numeric',
|
|
15
|
+
}).format(date);
|
|
16
|
+
};
|
|
17
|
+
export const compareDate = (date1, date2) => {
|
|
18
|
+
const dateOnly1 = date1.toISODate();
|
|
19
|
+
const dateOnly2 = date2.toISODate();
|
|
20
|
+
logger.error("dateOnly1", dateOnly1);
|
|
21
|
+
logger.error("dateOnly2", dateOnly2);
|
|
22
|
+
const result = dateOnly1 >= dateOnly2;
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const isHostedInContainer = () => {
|
|
2
|
+
let returnValue = false;
|
|
3
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
4
|
+
if (urlParams.get('hosted_in_container') === 'true') {
|
|
5
|
+
window.hosted_in_container = true;
|
|
6
|
+
returnValue = true;
|
|
7
|
+
}
|
|
8
|
+
return returnValue;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export var ModelSortDirection;
|
|
2
|
+
(function (ModelSortDirection) {
|
|
3
|
+
ModelSortDirection["ASC"] = "ASC";
|
|
4
|
+
ModelSortDirection["DESC"] = "DESC";
|
|
5
|
+
})(ModelSortDirection || (ModelSortDirection = {}));
|
|
6
|
+
export var ModelAttributeTypes;
|
|
7
|
+
(function (ModelAttributeTypes) {
|
|
8
|
+
ModelAttributeTypes["binary"] = "binary";
|
|
9
|
+
ModelAttributeTypes["binarySet"] = "binarySet";
|
|
10
|
+
ModelAttributeTypes["bool"] = "bool";
|
|
11
|
+
ModelAttributeTypes["list"] = "list";
|
|
12
|
+
ModelAttributeTypes["map"] = "map";
|
|
13
|
+
ModelAttributeTypes["number"] = "number";
|
|
14
|
+
ModelAttributeTypes["numberSet"] = "numberSet";
|
|
15
|
+
ModelAttributeTypes["string"] = "string";
|
|
16
|
+
ModelAttributeTypes["stringSet"] = "stringSet";
|
|
17
|
+
ModelAttributeTypes["_null"] = "_null";
|
|
18
|
+
})(ModelAttributeTypes || (ModelAttributeTypes = {}));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DAILY, FINANCIAL_YEARLY, MONTHLY, NEVER, PREFIX_CONSTANT_D, PREFIX_CONSTANT_fy, PREFIX_CONSTANT_FY, PREFIX_CONSTANT_fyminus1, PREFIX_CONSTANT_FYMINUS1, PREFIX_CONSTANT_fyplus1, PREFIX_CONSTANT_FYPLUS1, PREFIX_CONSTANT_M, PREFIX_CONSTANT_y, PREFIX_CONSTANT_Y, YEARLY } from "../static/constants";
|
|
2
|
+
// Find all {...} wrappers in the string
|
|
3
|
+
export const validateFullWrapper = (val) => {
|
|
4
|
+
const matches = val?.match(/\{.*?\}/g) || [];
|
|
5
|
+
const validTokens = [
|
|
6
|
+
PREFIX_CONSTANT_FY, // "{FY}"
|
|
7
|
+
PREFIX_CONSTANT_fy, // "{fy}"
|
|
8
|
+
PREFIX_CONSTANT_FYPLUS1, // full next financial year
|
|
9
|
+
PREFIX_CONSTANT_fyplus1, // short next financial year
|
|
10
|
+
PREFIX_CONSTANT_FYMINUS1, // full previous financial year
|
|
11
|
+
PREFIX_CONSTANT_fyminus1, // short previous financial year
|
|
12
|
+
PREFIX_CONSTANT_Y, // "{Y}"
|
|
13
|
+
PREFIX_CONSTANT_y, // "{y}"
|
|
14
|
+
PREFIX_CONSTANT_M, // "{M}"
|
|
15
|
+
PREFIX_CONSTANT_D // "{D}"
|
|
16
|
+
];
|
|
17
|
+
// Check that each wrapper is valid
|
|
18
|
+
const invalidWrapper = matches.find(wrapper => !validTokens.includes(wrapper));
|
|
19
|
+
return invalidWrapper;
|
|
20
|
+
};
|
|
21
|
+
// Find first {...} wrapper using regex
|
|
22
|
+
export const validateFirstOccurance = (val) => {
|
|
23
|
+
const match = val?.match(/\{.*?\}/); // first wrapper like {FY}, {M}, etc.
|
|
24
|
+
const firstWrapper = match ? match[0] : null;
|
|
25
|
+
const validTokens = [
|
|
26
|
+
PREFIX_CONSTANT_FY, // "{FY}"
|
|
27
|
+
PREFIX_CONSTANT_fy, // "{fy}"
|
|
28
|
+
PREFIX_CONSTANT_Y, // "{Y}"
|
|
29
|
+
PREFIX_CONSTANT_y, // "{y}"
|
|
30
|
+
PREFIX_CONSTANT_M, // "{M}"
|
|
31
|
+
PREFIX_CONSTANT_D // "{D}"
|
|
32
|
+
];
|
|
33
|
+
return { firstWrapper, validTokens };
|
|
34
|
+
};
|
|
35
|
+
export const resettingOptions = (prefix) => {
|
|
36
|
+
// Define possible constants in order of priority
|
|
37
|
+
const constants = [
|
|
38
|
+
{ tokens: [PREFIX_CONSTANT_FY, PREFIX_CONSTANT_fy], periods: [FINANCIAL_YEARLY, NEVER] },
|
|
39
|
+
{ tokens: [PREFIX_CONSTANT_Y, PREFIX_CONSTANT_y], periods: [YEARLY, NEVER] },
|
|
40
|
+
{ tokens: [PREFIX_CONSTANT_M], periods: [MONTHLY, NEVER] },
|
|
41
|
+
{ tokens: [PREFIX_CONSTANT_D], periods: [DAILY, NEVER] }
|
|
42
|
+
];
|
|
43
|
+
// Find the first occurring token and return its allowed periods
|
|
44
|
+
let firstMatch = null;
|
|
45
|
+
for (const group of constants) {
|
|
46
|
+
for (const token of group.tokens) {
|
|
47
|
+
const idx = prefix.indexOf(token);
|
|
48
|
+
if (idx !== -1 && (firstMatch === null || idx < firstMatch.index)) {
|
|
49
|
+
firstMatch = { index: idx, periods: group.periods };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return firstMatch;
|
|
54
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// import { LogCategoryEnum } from "./LogEnum";
|
|
2
|
+
// import { log } from "./Logger";
|
|
3
|
+
export const transformToData = (data) => {
|
|
4
|
+
// log(LogCategoryEnum.Info, `before transformation`, data)
|
|
5
|
+
const { __typename, createdAt, updatedAt, ...itm } = data;
|
|
6
|
+
const transformedData = { ...itm };
|
|
7
|
+
// log(LogCategoryEnum.Info, "after transformed data", transformedData)
|
|
8
|
+
return transformedData;
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syzy/apphost",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"clean": "rimraf dist",
|
|
12
|
-
"build": "npm run clean && tsc && vite build",
|
|
14
|
+
"build": "npm run clean && tsc -p tsconfig.app.json && vite build",
|
|
13
15
|
"dev": "vite"
|
|
14
16
|
},
|
|
15
17
|
"peerDependencies": {
|
|
16
|
-
"react": "^19
|
|
17
|
-
"react-dom": "^19
|
|
18
|
+
"react": "^18 || ^19",
|
|
19
|
+
"react-dom": "^18 || ^19",
|
|
18
20
|
"react-router-dom": "^6.0.0"
|
|
19
21
|
},
|
|
20
22
|
"dependencies": {
|
|
21
23
|
"@tanstack/react-query": "^5.89.0",
|
|
24
|
+
"@tanstack/react-query-devtools": "^5.91.3",
|
|
25
|
+
"aws-amplify": "^6.16.2",
|
|
22
26
|
"react-bootstrap": "^2.10.10",
|
|
23
27
|
"react-select": "^5.10.2",
|
|
24
28
|
"react-toastify": "^11.0.5",
|
|
25
29
|
"zod": "^4.1.9"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.3.3",
|
|
28
33
|
"@types/react": "^19.1.13",
|
|
29
34
|
"@types/react-dom": "^19.1.9",
|
|
30
|
-
"typescript": "^5.9.3",
|
|
31
|
-
"vite": "^7.1.6",
|
|
32
35
|
"@vitejs/plugin-react": "^5.1.1",
|
|
33
|
-
"rimraf": "^6.0.1"
|
|
36
|
+
"rimraf": "^6.0.1",
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vite": "^7.1.6"
|
|
34
39
|
}
|
|
35
|
-
}
|
|
40
|
+
}
|