phx-react 1.3.985 → 1.3.987
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/cjs/components/LoginSsoV3/login-sso-v3.js +1 -1
- package/dist/cjs/components/LoginSsoV3/login-sso-v3.js.map +1 -1
- package/dist/cjs/components/MainWrapV3/MainWrapV3.js +256 -241
- package/dist/cjs/components/MainWrapV3/MainWrapV3.js.map +1 -1
- package/dist/cjs/query/index.d.ts +1 -1
- package/dist/cjs/query/index.js +1 -1
- package/dist/cjs/query/index.js.map +1 -1
- package/dist/esm/components/LoginSsoV3/login-sso-v3.js +1 -1
- package/dist/esm/components/LoginSsoV3/login-sso-v3.js.map +1 -1
- package/dist/esm/components/MainWrapV3/MainWrapV3.js +256 -241
- package/dist/esm/components/MainWrapV3/MainWrapV3.js.map +1 -1
- package/dist/esm/query/index.d.ts +1 -1
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,6 @@ import { GET_PERMISSION_DETAIL_USER_V3, GET_SCHOOL_V3, getCampaignNameV3, QUERY_
|
|
|
17
17
|
import { PHXCard } from '../Card';
|
|
18
18
|
import PHXGetEnvPublicV3 from '../Func/getEnvPublic';
|
|
19
19
|
import saveCookiesClient from '../Func/saveCookiesClient';
|
|
20
|
-
import { useLoading } from '../LoadingProvider';
|
|
21
20
|
import StyledCustomLayoutProps from './appearance/appearance-styled';
|
|
22
21
|
import NavMobile from './navigator/nav-mobile';
|
|
23
22
|
import { styles } from './style/sub-menu-style';
|
|
@@ -26,6 +25,7 @@ import Image from 'next/image';
|
|
|
26
25
|
import axios from 'axios';
|
|
27
26
|
import PHXFuncGetCookieSession from '../Func/getCookieSession';
|
|
28
27
|
import { decryptCookie } from '../../helpers/helpers';
|
|
28
|
+
import { useLoading } from '../LoadingProvider';
|
|
29
29
|
library.add(fas);
|
|
30
30
|
function classNames() {
|
|
31
31
|
var classes = [];
|
|
@@ -35,61 +35,48 @@ function classNames() {
|
|
|
35
35
|
return classes.filter(Boolean).join(' ');
|
|
36
36
|
}
|
|
37
37
|
export var PHXMainWrapV3 = function (_a) {
|
|
38
|
-
var _b, _c, _d, _e;
|
|
39
|
-
var children = _a.children, getDataCookies = _a.getDataCookies,
|
|
38
|
+
var _b, _c, _d, _e, _f;
|
|
39
|
+
var children = _a.children, getDataCookies = _a.getDataCookies, _g = _a.hiddenLeftMenu, hiddenLeftMenu = _g === void 0 ? false : _g, _h = _a.logoHeight, logoHeight = _h === void 0 ? '28px' : _h, _j = _a.multipleMenu, multipleMenu = _j === void 0 ? false : _j, params = _a.params, pathName = _a.pathName, router = _a.router;
|
|
40
40
|
var pid = (params ? params : {}).pid;
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
var _k = useState(false), modal = _k[0], setModal = _k[1];
|
|
42
|
+
var _l = useState(true), openSubMenu = _l[0], setOpenSubMenu = _l[1];
|
|
43
|
+
var _m = useState(''), campaignName = _m[0], setCampaignName = _m[1];
|
|
44
|
+
var _o = useState(false), sidebarOpen = _o[0], setSidebarOpen = _o[1];
|
|
45
|
+
var _p = useState([]), subNavigation = _p[0], setSubNavigation = _p[1];
|
|
46
|
+
var _q = useState([]), navigation = _q[0], setNavigation = _q[1];
|
|
47
|
+
var _r = useState(false), modalSignOut = _r[0], setModalSignOut = _r[1];
|
|
48
|
+
var _s = useState(true), showBanner = _s[0], setShowBanner = _s[1];
|
|
49
|
+
var _t = useState(true), isLoading = _t[0], setIsLoading = _t[1];
|
|
50
|
+
var sessionCookie = useRef(PHXFuncGetCookieSession());
|
|
51
|
+
var userSessionInfo = (_b = sessionCookie.current) === null || _b === void 0 ? void 0 : _b.user_info;
|
|
52
|
+
var schoolInfoId = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.school_id;
|
|
53
|
+
var userId = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.id;
|
|
54
|
+
var setGlobalLoading = useLoading().setLoading;
|
|
55
|
+
var _u = useState({
|
|
56
|
+
loadingMenu: true,
|
|
57
|
+
loadingSchool: true,
|
|
58
|
+
listSchool: [],
|
|
59
|
+
logo: {
|
|
60
|
+
path: '',
|
|
61
|
+
height: logoHeight
|
|
62
|
+
},
|
|
63
|
+
menu: [],
|
|
64
|
+
schoolId: null,
|
|
65
|
+
configLayout: undefined,
|
|
66
|
+
perCode: [],
|
|
67
|
+
roleCode: [],
|
|
68
|
+
isLoadingPermission: true,
|
|
69
|
+
sourceAvatar: ((_c = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.user_avatar) === null || _c === void 0 ? void 0 : _c.size_small) || (userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.avatar) || DEFAULT_AVATAR
|
|
70
|
+
}), dataInitMain = _u[0], setDataInitMain = _u[1];
|
|
59
71
|
var locationPathname = typeof window !== 'undefined' ? window.location.pathname : '';
|
|
60
72
|
var locationArr = locationPathname.split('/').filter(Boolean);
|
|
61
73
|
var basePath = locationArr.slice(0, locationArr.length - pathName.split('/').filter(Boolean).length).join('/');
|
|
62
74
|
var pathNameWithBasePath = "".concat(basePath ? "".concat('/' + basePath) : '').concat(pathName);
|
|
63
|
-
var setGlobalLoading = useLoading().setLoading;
|
|
64
75
|
function enablePer(code, arr) {
|
|
65
76
|
if (!code)
|
|
66
77
|
return true;
|
|
67
78
|
return arr === null || arr === void 0 ? void 0 : arr.some(function (item) { return item === code; });
|
|
68
79
|
}
|
|
69
|
-
var _2 = useState({
|
|
70
|
-
path: '',
|
|
71
|
-
height: logoHeight
|
|
72
|
-
}), logo = _2[0], setLogo = _2[1];
|
|
73
|
-
var sessionCookie = useRef(PHXFuncGetCookieSession());
|
|
74
|
-
var userSessionInfo = (_b = sessionCookie.current) === null || _b === void 0 ? void 0 : _b.user_info;
|
|
75
|
-
var schoolInfoId = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.school_id;
|
|
76
|
-
var userId = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.id;
|
|
77
|
-
function compareObjects(settingQuery, settingCookies) {
|
|
78
|
-
var keysSettingQuery = Object.keys(settingQuery);
|
|
79
|
-
if (keysSettingQuery.length !== Object.keys(settingCookies).length) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
for (var _i = 0, keysSettingQuery_1 = keysSettingQuery; _i < keysSettingQuery_1.length; _i++) {
|
|
83
|
-
var key = keysSettingQuery_1[_i];
|
|
84
|
-
if (!Object.prototype.hasOwnProperty.call(settingCookies, key)) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
if (settingQuery[key] !== settingCookies[key]) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
80
|
// Lấy code phân quyền trong menu từ path hiện tại
|
|
94
81
|
function getCodesByPath(dataMenu, currentPath) {
|
|
95
82
|
var lastMatchingCode = null;
|
|
@@ -117,6 +104,12 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
117
104
|
}
|
|
118
105
|
// code phân quyền path hiện tại
|
|
119
106
|
var currentCode = getCodesByPath(navigation, locationPathname);
|
|
107
|
+
var requireLoginValidation = function () {
|
|
108
|
+
var currentURL = window.location.href;
|
|
109
|
+
var url = currentURL.split('/');
|
|
110
|
+
var loginPush = "".concat(url[0], "//").concat(url[2], "/login-sso");
|
|
111
|
+
window.location.replace(loginPush);
|
|
112
|
+
};
|
|
120
113
|
var checkIsQuitJob = function (_a) {
|
|
121
114
|
var profileStaff = _a.profileStaff, profileTeacher = _a.profileTeacher;
|
|
122
115
|
try {
|
|
@@ -141,7 +134,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
141
134
|
return __generator(this, function (_e) {
|
|
142
135
|
switch (_e.label) {
|
|
143
136
|
case 0:
|
|
144
|
-
_e.trys.push([0, 2,
|
|
137
|
+
_e.trys.push([0, 2, , 3]);
|
|
145
138
|
return [4 /*yield*/, PHXClientQueryV3({
|
|
146
139
|
query: GET_PERMISSION_DETAIL_USER_V3,
|
|
147
140
|
variables: { id: userId, school_id: schoolInfoId }
|
|
@@ -155,117 +148,98 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
155
148
|
routePermissions = permissionCodes.filter(function (p) { return !p.is_action; }).map(function (p) { return p.code; });
|
|
156
149
|
actionPermissions = permissionCodes.filter(function (p) { return p.is_action; }).map(function (p) { return p.code; });
|
|
157
150
|
actionPermissionMap = Object.fromEntries(actionPermissions.map(function (code) { return [code, true]; }));
|
|
158
|
-
// Mã hoá và lưu vào cookie
|
|
159
|
-
saveCookiesClient({ value: __assign(__assign({}, sessionCookie.current), { action_permission: actionPermissionMap }) });
|
|
160
151
|
uniqueRoutePermissions = Array.from(new Set(routePermissions));
|
|
161
|
-
|
|
162
|
-
return [3 /*break*/, 4];
|
|
152
|
+
return [2 /*return*/, { uniqueRoutePermissions: uniqueRoutePermissions, actionPermissionMap: actionPermissionMap }];
|
|
163
153
|
case 2:
|
|
164
154
|
error_1 = _e.sent();
|
|
165
155
|
console.error('Error fetching school data:', error_1);
|
|
166
|
-
return [
|
|
167
|
-
case 3:
|
|
168
|
-
setIsLoadingPermission(false);
|
|
169
|
-
return [7 /*endfinally*/];
|
|
170
|
-
case 4: return [2 /*return*/];
|
|
156
|
+
return [2 /*return*/, { uniqueRoutePermissions: null, actionPermissionMap: null }];
|
|
157
|
+
case 3: return [2 /*return*/];
|
|
171
158
|
}
|
|
172
159
|
});
|
|
173
160
|
}); };
|
|
174
161
|
var getProfileByUser = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
175
|
-
var response, profileUser,
|
|
162
|
+
var response, profileUser, avatar, email, full_name, profile_staff, profile_teacher, user_avatar, user_roles, error_2;
|
|
176
163
|
return __generator(this, function (_a) {
|
|
177
164
|
switch (_a.label) {
|
|
178
165
|
case 0:
|
|
179
|
-
|
|
180
|
-
return [2 /*return*/];
|
|
181
|
-
_a.label = 1;
|
|
182
|
-
case 1:
|
|
183
|
-
_a.trys.push([1, 3, , 4]);
|
|
166
|
+
_a.trys.push([0, 2, , 3]);
|
|
184
167
|
return [4 /*yield*/, PHXClientQueryV3({
|
|
185
168
|
query: QUERY_GET_PROFILE_USER,
|
|
186
169
|
variables: {
|
|
187
170
|
user_id: userId
|
|
188
171
|
}
|
|
189
172
|
})];
|
|
190
|
-
case
|
|
173
|
+
case 1:
|
|
191
174
|
response = _a.sent();
|
|
192
175
|
profileUser = response.data.users_by_pk;
|
|
193
|
-
profile_staff = profileUser.profile_staff, profile_teacher = profileUser.profile_teacher, user_roles = profileUser.user_roles;
|
|
176
|
+
avatar = profileUser.avatar, email = profileUser.email, full_name = profileUser.full_name, profile_staff = profileUser.profile_staff, profile_teacher = profileUser.profile_teacher, user_avatar = profileUser.user_avatar, user_roles = profileUser.user_roles;
|
|
194
177
|
// check user is quit job
|
|
195
|
-
checkIsQuitJob({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
178
|
+
checkIsQuitJob({
|
|
179
|
+
profileStaff: profile_staff,
|
|
180
|
+
profileTeacher: profile_teacher
|
|
181
|
+
});
|
|
182
|
+
// renew list role in cookie
|
|
183
|
+
return [2 /*return*/, {
|
|
184
|
+
avatar: avatar,
|
|
185
|
+
user_avatar: user_avatar,
|
|
186
|
+
full_name: full_name,
|
|
187
|
+
email: email,
|
|
188
|
+
user_roles: user_roles
|
|
189
|
+
}];
|
|
190
|
+
case 2:
|
|
206
191
|
error_2 = _a.sent();
|
|
207
192
|
console.log(error_2);
|
|
208
|
-
return [
|
|
209
|
-
case
|
|
193
|
+
return [2 /*return*/];
|
|
194
|
+
case 3: return [2 /*return*/];
|
|
210
195
|
}
|
|
211
196
|
});
|
|
212
197
|
}); };
|
|
213
|
-
var fetchDataSchool = function () {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
var _a, _b, _c, _d, _e;
|
|
221
|
-
return __generator(this, function (_f) {
|
|
222
|
-
switch (_f.label) {
|
|
223
|
-
case 0:
|
|
224
|
-
setIsLoading(true);
|
|
225
|
-
_f.label = 1;
|
|
226
|
-
case 1:
|
|
227
|
-
_f.trys.push([1, 3, , 4]);
|
|
228
|
-
return [4 /*yield*/, PHXClientQueryV3({
|
|
229
|
-
query: GET_SCHOOL_V3,
|
|
230
|
-
variables: { group_id: group_id, school_name_id: school_name_id, user_id: id },
|
|
231
|
-
isDelay: false
|
|
232
|
-
})];
|
|
233
|
-
case 2:
|
|
234
|
-
res = _f.sent();
|
|
235
|
-
listSchool_1 = (_b = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.school_name[0]) === null || _b === void 0 ? void 0 : _b.schools;
|
|
236
|
-
if ((listSchool_1 === null || listSchool_1 === void 0 ? void 0 : listSchool_1.length) > 0) {
|
|
237
|
-
setLoadingSchool(false);
|
|
238
|
-
setListSchool(listSchool_1);
|
|
239
|
-
}
|
|
240
|
-
setIsLoading(false);
|
|
241
|
-
settingFetchData = (_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.setting_site[0]) === null || _d === void 0 ? void 0 : _d.value_setting;
|
|
242
|
-
if (settingFetchData) {
|
|
243
|
-
cleanedJsonString = settingFetchData.replace(/^"(.*)"$/, '$1');
|
|
244
|
-
jsonObjectSetting = JSON.parse(cleanedJsonString);
|
|
245
|
-
setConfigLayout(jsonObjectSetting);
|
|
246
|
-
settingSiteCookie = (_e = sessionCookie.current) === null || _e === void 0 ? void 0 : _e.setting_site;
|
|
247
|
-
// Nếu chưa có trong cookie hoặc data trong cookie và db khác nhau
|
|
248
|
-
if (!settingSiteCookie || !compareObjects(jsonObjectSetting, settingSiteCookie)) {
|
|
249
|
-
saveCookiesClient({ value: __assign(__assign({}, sessionCookie.current), { setting_site: jsonObjectSetting }) });
|
|
250
|
-
}
|
|
251
|
-
}
|
|
198
|
+
var fetchDataSchool = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
199
|
+
var id, _a, group_id, school_name_id, school_id, settingSiteDb, res, dataSchool, settingFetchData, cleanedJsonString, error_3;
|
|
200
|
+
var _b, _c, _d, _e;
|
|
201
|
+
return __generator(this, function (_f) {
|
|
202
|
+
switch (_f.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
if (!userSessionInfo)
|
|
252
205
|
return [2 /*return*/];
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
206
|
+
id = userSessionInfo.id, _a = userSessionInfo.school, group_id = _a.school_name.group_id, school_name_id = _a.school_name_id, school_id = userSessionInfo.school_id;
|
|
207
|
+
setIsLoading(true);
|
|
208
|
+
settingSiteDb = undefined;
|
|
209
|
+
_f.label = 1;
|
|
210
|
+
case 1:
|
|
211
|
+
_f.trys.push([1, 3, , 4]);
|
|
212
|
+
return [4 /*yield*/, PHXClientQueryV3({
|
|
213
|
+
query: GET_SCHOOL_V3,
|
|
214
|
+
variables: { group_id: group_id, school_name_id: school_name_id, user_id: id },
|
|
215
|
+
isDelay: false
|
|
216
|
+
})];
|
|
217
|
+
case 2:
|
|
218
|
+
res = _f.sent();
|
|
219
|
+
dataSchool = (_c = (_b = res === null || res === void 0 ? void 0 : res.data) === null || _b === void 0 ? void 0 : _b.school_name[0]) === null || _c === void 0 ? void 0 : _c.schools;
|
|
220
|
+
settingFetchData = (_e = (_d = res === null || res === void 0 ? void 0 : res.data) === null || _d === void 0 ? void 0 : _d.setting_site[0]) === null || _e === void 0 ? void 0 : _e.value_setting;
|
|
221
|
+
if (settingFetchData) {
|
|
222
|
+
cleanedJsonString = settingFetchData.replace(/^"(.*)"$/, '$1');
|
|
223
|
+
settingSiteDb = JSON.parse(cleanedJsonString);
|
|
224
|
+
}
|
|
225
|
+
setIsLoading(false);
|
|
226
|
+
return [2 /*return*/, {
|
|
227
|
+
settingSiteDb: settingSiteDb,
|
|
228
|
+
loadingSchool: dataSchool.length === 0,
|
|
229
|
+
listSchool: dataSchool,
|
|
230
|
+
schoolId: school_id
|
|
231
|
+
}];
|
|
232
|
+
case 3:
|
|
233
|
+
error_3 = _f.sent();
|
|
234
|
+
setIsLoading(false);
|
|
235
|
+
console.error('Error fetching school data:', error_3);
|
|
236
|
+
return [2 /*return*/];
|
|
237
|
+
case 4: return [2 /*return*/];
|
|
238
|
+
}
|
|
265
239
|
});
|
|
266
|
-
};
|
|
240
|
+
}); };
|
|
267
241
|
var fetchDataMenu = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
-
var envPublic, menuUrl, logoMenuTop, data,
|
|
242
|
+
var envPublic, menuUrl, logoMenuTop, data, menuJson;
|
|
269
243
|
return __generator(this, function (_a) {
|
|
270
244
|
switch (_a.label) {
|
|
271
245
|
case 0: return [4 /*yield*/, PHXGetEnvPublicV3()];
|
|
@@ -282,10 +256,53 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
282
256
|
data = _a.sent();
|
|
283
257
|
return [4 /*yield*/, data.json()];
|
|
284
258
|
case 3:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
259
|
+
menuJson = _a.sent();
|
|
260
|
+
return [2 /*return*/, {
|
|
261
|
+
loadingMenu: false,
|
|
262
|
+
logo: { path: logoMenuTop, height: logoHeight },
|
|
263
|
+
menu: menuJson
|
|
264
|
+
}];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}); };
|
|
268
|
+
var fetchInitData = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var _a, loadingMenu, logo, menu, profileNew, dataPer, dataSchool, actionPermissionMap, uniqueRoutePermissions;
|
|
270
|
+
var _b;
|
|
271
|
+
return __generator(this, function (_c) {
|
|
272
|
+
switch (_c.label) {
|
|
273
|
+
case 0: return [4 /*yield*/, fetchDataMenu()];
|
|
274
|
+
case 1:
|
|
275
|
+
_a = _c.sent(), loadingMenu = _a.loadingMenu, logo = _a.logo, menu = _a.menu;
|
|
276
|
+
return [4 /*yield*/, getProfileByUser()];
|
|
277
|
+
case 2:
|
|
278
|
+
profileNew = _c.sent();
|
|
279
|
+
return [4 /*yield*/, fetchDataPer()];
|
|
280
|
+
case 3:
|
|
281
|
+
dataPer = _c.sent();
|
|
282
|
+
return [4 /*yield*/, fetchDataSchool()];
|
|
283
|
+
case 4:
|
|
284
|
+
dataSchool = _c.sent();
|
|
285
|
+
actionPermissionMap = dataPer.actionPermissionMap, uniqueRoutePermissions = dataPer.uniqueRoutePermissions;
|
|
286
|
+
setDataInitMain({
|
|
287
|
+
logo: logo,
|
|
288
|
+
menu: menu,
|
|
289
|
+
loadingMenu: loadingMenu,
|
|
290
|
+
schoolId: (dataSchool === null || dataSchool === void 0 ? void 0 : dataSchool.schoolId) || null,
|
|
291
|
+
loadingSchool: !!(dataSchool === null || dataSchool === void 0 ? void 0 : dataSchool.loadingSchool),
|
|
292
|
+
listSchool: (dataSchool === null || dataSchool === void 0 ? void 0 : dataSchool.listSchool) || [],
|
|
293
|
+
isLoadingPermission: false,
|
|
294
|
+
perCode: uniqueRoutePermissions,
|
|
295
|
+
roleCode: (profileNew === null || profileNew === void 0 ? void 0 : profileNew.user_roles.map(function (userRole) { var _a; return (_a = userRole === null || userRole === void 0 ? void 0 : userRole.role) === null || _a === void 0 ? void 0 : _a.role_code; })) || [],
|
|
296
|
+
configLayout: (dataSchool === null || dataSchool === void 0 ? void 0 : dataSchool.settingSiteDb) || undefined,
|
|
297
|
+
sourceAvatar: ((_b = profileNew === null || profileNew === void 0 ? void 0 : profileNew.user_avatar) === null || _b === void 0 ? void 0 : _b.size_small) || (profileNew === null || profileNew === void 0 ? void 0 : profileNew.avatar) || DEFAULT_AVATAR
|
|
298
|
+
});
|
|
299
|
+
saveCookiesClient({
|
|
300
|
+
value: __assign(__assign(__assign(__assign({}, sessionCookie.current), (actionPermissionMap && {
|
|
301
|
+
action_permission: actionPermissionMap || []
|
|
302
|
+
})), { setting_site: (dataSchool === null || dataSchool === void 0 ? void 0 : dataSchool.settingSiteDb) || {} }), (profileNew && {
|
|
303
|
+
user_info: __assign(__assign({}, userSessionInfo), profileNew)
|
|
304
|
+
}))
|
|
305
|
+
});
|
|
289
306
|
return [2 /*return*/];
|
|
290
307
|
}
|
|
291
308
|
});
|
|
@@ -296,21 +313,13 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
296
313
|
requireLoginValidation();
|
|
297
314
|
return;
|
|
298
315
|
}
|
|
299
|
-
|
|
300
|
-
getProfileByUser();
|
|
301
|
-
fetchDataSchool();
|
|
316
|
+
fetchInitData();
|
|
302
317
|
}, []);
|
|
303
|
-
var
|
|
304
|
-
|
|
305
|
-
var url = currentURL.split('/');
|
|
306
|
-
var loginPush = "".concat(url[0], "//").concat(url[2], "/login-sso");
|
|
307
|
-
window.location.replace(loginPush);
|
|
308
|
-
};
|
|
309
|
-
var isEqualUrl = function (parentHref, pathName) {
|
|
310
|
-
if (!parentHref || !pathName) {
|
|
318
|
+
var isEqualUrl = function (parentHref, pathNameCompare) {
|
|
319
|
+
if (!parentHref || !pathNameCompare) {
|
|
311
320
|
return false;
|
|
312
321
|
}
|
|
313
|
-
var pathNameSplit =
|
|
322
|
+
var pathNameSplit = pathNameCompare.split('/');
|
|
314
323
|
var hrefSplit = parentHref.split('/');
|
|
315
324
|
if (!pathNameSplit || !hrefSplit) {
|
|
316
325
|
return false;
|
|
@@ -340,9 +349,9 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
340
349
|
return parentSplit[1] === pathNameSplit[3];
|
|
341
350
|
}
|
|
342
351
|
};
|
|
343
|
-
var isBelongParent = function (parentUrl,
|
|
352
|
+
var isBelongParent = function (parentUrl, pathNameCompare, isMicroservice) {
|
|
344
353
|
var parentSplit = parentUrl.split('/');
|
|
345
|
-
var pathNameSplit =
|
|
354
|
+
var pathNameSplit = pathNameCompare.split('/');
|
|
346
355
|
if (isMicroservice) {
|
|
347
356
|
return isBelongParentWithMicroservice(parentSplit, pathNameSplit);
|
|
348
357
|
}
|
|
@@ -358,7 +367,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
358
367
|
return pathNameSplit[1] === 'admissions';
|
|
359
368
|
};
|
|
360
369
|
var loadParentNavigation = function (path) {
|
|
361
|
-
var mainNavigation = menu;
|
|
370
|
+
var mainNavigation = dataInitMain.menu;
|
|
362
371
|
var naviSize = mainNavigation.length;
|
|
363
372
|
for (var i = 0; i < naviSize; i++) {
|
|
364
373
|
var item = mainNavigation[i];
|
|
@@ -397,7 +406,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
397
406
|
setNavigation(mainNavigation);
|
|
398
407
|
};
|
|
399
408
|
var loadChildrenCampaign = function (path) {
|
|
400
|
-
var mainNavigation = menu;
|
|
409
|
+
var mainNavigation = dataInitMain.menu;
|
|
401
410
|
var naviSize = mainNavigation.length;
|
|
402
411
|
for (var i = 0; i < naviSize; i++) {
|
|
403
412
|
var item = mainNavigation[i];
|
|
@@ -433,7 +442,8 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
433
442
|
setNavigation(mainNavigation);
|
|
434
443
|
};
|
|
435
444
|
var checkChildrenCampaign = function (path) {
|
|
436
|
-
var
|
|
445
|
+
var _a;
|
|
446
|
+
var campaignMenu = (_a = dataInitMain.menu) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.path === '/admissions/campaign/list'; });
|
|
437
447
|
var campaignChild = campaignMenu === null || campaignMenu === void 0 ? void 0 : campaignMenu.child;
|
|
438
448
|
var listChild = campaignChild === null || campaignChild === void 0 ? void 0 : campaignChild.find(function (item) { return item.path === '/campaign/list'; });
|
|
439
449
|
var isChild = listChild === null || listChild === void 0 ? void 0 : listChild.childrenByParentDetail.find(function (item) { return isBelongParent(item.path, path, false); });
|
|
@@ -465,7 +475,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
465
475
|
loadParentNavigation(pathNameWithBasePath);
|
|
466
476
|
}
|
|
467
477
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
468
|
-
}, [
|
|
478
|
+
}, [dataInitMain, pid, pathNameWithBasePath]);
|
|
469
479
|
useEffect(function () {
|
|
470
480
|
var isAdmissions = checkAdmissions(pathNameWithBasePath);
|
|
471
481
|
if (isAdmissions) {
|
|
@@ -482,7 +492,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
482
492
|
else {
|
|
483
493
|
setOpenSubMenu(true);
|
|
484
494
|
}
|
|
485
|
-
}, [pathNameWithBasePath,
|
|
495
|
+
}, [pathNameWithBasePath, dataInitMain]);
|
|
486
496
|
var loadSubNavigation = function (path, isChild, childPath) {
|
|
487
497
|
var subLength = subNavigation.length;
|
|
488
498
|
var newSub = [];
|
|
@@ -524,7 +534,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
524
534
|
router.push(item.path);
|
|
525
535
|
}
|
|
526
536
|
};
|
|
527
|
-
var
|
|
537
|
+
var _v = dataInitMain.logo, height = _v.height, topMenuLogoFromEnv = _v.path;
|
|
528
538
|
var handleModalSignOut = function () { return setModalSignOut(true); };
|
|
529
539
|
var handleRedirectRouter = function (path) {
|
|
530
540
|
var currentURL = window.location.href;
|
|
@@ -578,11 +588,11 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
578
588
|
var currentIndexActive = item.find(function (s) { return s.current; });
|
|
579
589
|
return currentIndexActive ? currentIndexActive.id > currentItem.id : false;
|
|
580
590
|
};
|
|
581
|
-
var
|
|
582
|
-
var
|
|
583
|
-
var
|
|
591
|
+
var _w = useState(false), openNavName = _w[0], setOpenNavName = _w[1];
|
|
592
|
+
var _x = useState(false), showSearchBar = _x[0], setShowSearchBar = _x[1];
|
|
593
|
+
var _y = useState(null), selected = _y[0], setSelected = _y[1];
|
|
584
594
|
var handleOpenModal = function (id) {
|
|
585
|
-
setModal(id !== schoolId);
|
|
595
|
+
setModal(id !== dataInitMain.schoolId);
|
|
586
596
|
setSelected(id);
|
|
587
597
|
};
|
|
588
598
|
var handlePrimaryModal = function () {
|
|
@@ -592,7 +602,9 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
592
602
|
var schoolIdCurrent = userSessionInfo.school_id;
|
|
593
603
|
if (newSchoolId && newSchoolId !== schoolIdCurrent) {
|
|
594
604
|
var userInfoNew = __assign(__assign({}, userSessionInfo), { school_id: newSchoolId });
|
|
595
|
-
saveCookiesClient({
|
|
605
|
+
saveCookiesClient({
|
|
606
|
+
value: __assign(__assign({}, sessionCookie.current), { user_info: userInfoNew })
|
|
607
|
+
});
|
|
596
608
|
window.location.replace(ROUTE_DASHBOARD);
|
|
597
609
|
}
|
|
598
610
|
}
|
|
@@ -602,20 +614,19 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
602
614
|
}
|
|
603
615
|
setModal(false);
|
|
604
616
|
};
|
|
605
|
-
var sourceAvatar = ((_c = userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.user_avatar) === null || _c === void 0 ? void 0 : _c.size_small) || (userSessionInfo === null || userSessionInfo === void 0 ? void 0 : userSessionInfo.avatar) || DEFAULT_AVATAR;
|
|
606
617
|
// settings page
|
|
607
618
|
var isSettings = function () {
|
|
608
619
|
var pathNameSplit = pathNameWithBasePath.split('/');
|
|
609
620
|
return pathNameSplit[1] === 'setting';
|
|
610
621
|
};
|
|
611
|
-
var checkLogoHeader = (configLayout === null ||
|
|
622
|
+
var checkLogoHeader = ((_d = dataInitMain.configLayout) === null || _d === void 0 ? void 0 : _d.logo_dashboard) || topMenuLogoFromEnv || DEFAULT_LOGO_DASHBOARD;
|
|
612
623
|
return (React.createElement(React.Fragment, null,
|
|
613
624
|
React.createElement("div", { className: 'flex min-h-full flex-col' },
|
|
614
|
-
React.createElement(StyledCustomLayoutProps, { configLayout: configLayout, settingSiteCookie: getDataCookies ? (
|
|
625
|
+
React.createElement(StyledCustomLayoutProps, { configLayout: dataInitMain === null || dataInitMain === void 0 ? void 0 : dataInitMain.configLayout, settingSiteCookie: getDataCookies ? (_e = decryptCookie(getDataCookies)) === null || _e === void 0 ? void 0 : _e.setting_site : null }),
|
|
615
626
|
React.createElement("header", { className: 'header-color-styled fixed top-0 z-50 min-w-full border-gray-200 bg-white' },
|
|
616
627
|
React.createElement("div", { className: 'header-styled mx-auto flex h-14 items-center justify-between bg-[#1a1a1a] pr-4' },
|
|
617
|
-
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
618
|
-
React.createElement("a", { className: 'flex w-full items-center', href: '/' }, topMenuLogoFromEnv ? (React.createElement(React.Fragment, null, isLoading ? (React.createElement("div", { className: 'header-loading-logo ml-3 h-8 w-full animate-pulse' })) : (React.createElement("img", { alt: 'Logo', className: 'ml-3
|
|
628
|
+
React.createElement("div", { className: 'flex items-center gap-x-3 lg:w-32' },
|
|
629
|
+
React.createElement("a", { className: 'flex w-full items-center', href: '/' }, topMenuLogoFromEnv ? (React.createElement(React.Fragment, null, isLoading ? (React.createElement("div", { className: 'header-loading-logo ml-3 h-8 w-full animate-pulse' })) : (React.createElement("img", { alt: 'Logo', className: 'ml-3 w-auto', src: checkLogoHeader, style: { height: height } })))) : (React.createElement(React.Fragment, null))),
|
|
619
630
|
React.createElement("div", { className: 'flex items-center lg:hidden' },
|
|
620
631
|
React.createElement("button", { className: 'bg-grey-100 mr-3 inline-flex items-center justify-center rounded-md p-1 text-gray-600 hover:bg-white focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white', onClick: function () { return setSidebarOpen(true); }, type: 'button' },
|
|
621
632
|
React.createElement("span", { className: 'sr-only' }, "Open sidebar"),
|
|
@@ -628,33 +639,34 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
628
639
|
React.createElement(Menu.Button, { className: 'flex max-w-xs items-center rounded-full bg-gray-800 text-sm focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-800' },
|
|
629
640
|
React.createElement("span", { className: 'sr-only' }, "Open user menu"),
|
|
630
641
|
isLoading ? (React.createElement("div", { className: 'flex animate-pulse' },
|
|
631
|
-
React.createElement("div", { className: 'header-loading-avatar h-8 w-8 rounded-full' }))) : (React.createElement("img", { alt: '', className: 'h-8 w-8 rounded-full', src: sourceAvatar })))),
|
|
642
|
+
React.createElement("div", { className: 'header-loading-avatar h-8 w-8 rounded-full' }))) : (React.createElement("img", { alt: '', className: 'h-8 w-8 rounded-full', src: dataInitMain.sourceAvatar })))),
|
|
632
643
|
React.createElement(Transition, { as: Fragment, enter: 'transition ease-out duration-100', enterFrom: 'transform opacity-0 scale-95', enterTo: 'transform opacity-100 scale-100', leave: 'transition ease-in duration-75', leaveFrom: 'transform opacity-100 scale-100', leaveTo: 'transform opacity-0 scale-95' },
|
|
633
644
|
React.createElement(Menu.Items, { className: ' absolute right-0 z-10 mt-2 w-[340px] origin-top-right rounded-md bg-white px-2 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none' },
|
|
634
645
|
React.createElement(Menu.Item, null,
|
|
635
646
|
React.createElement("div", { "aria-hidden": true, className: 'px-2 pb-2 pt-4 text-sm font-semibold text-gray-900 ' }, "Ch\u1ECDn tr\u01B0\u1EDDng")),
|
|
636
|
-
!loadingSchool ? (React.createElement(React.Fragment, null, listSchool
|
|
647
|
+
!dataInitMain.loadingSchool ? (React.createElement(React.Fragment, null, dataInitMain.listSchool
|
|
637
648
|
.filter(function (val) {
|
|
638
|
-
if (!enablePer(switchSchool, perCode)) {
|
|
639
|
-
return val.id === schoolId;
|
|
649
|
+
if (!enablePer(switchSchool, dataInitMain.perCode)) {
|
|
650
|
+
return val.id === dataInitMain.schoolId;
|
|
640
651
|
}
|
|
641
652
|
else {
|
|
642
653
|
return true;
|
|
643
654
|
}
|
|
644
655
|
})
|
|
645
656
|
.map(function (item) { return (React.createElement(Menu.Item, { key: item.id },
|
|
646
|
-
React.createElement("div", { "aria-hidden": true, className: "".concat(item.id === schoolId &&
|
|
647
|
-
listSchool.length > 1 &&
|
|
648
|
-
!enablePer(switchSchool, perCode) === false
|
|
657
|
+
React.createElement("div", { "aria-hidden": true, className: "".concat(item.id === dataInitMain.schoolId &&
|
|
658
|
+
dataInitMain.listSchool.length > 1 &&
|
|
659
|
+
!enablePer(switchSchool, dataInitMain.perCode) === false
|
|
649
660
|
? 'rounded-lg bg-zinc-200 font-semibold text-gray-900 '
|
|
650
|
-
: 'font-normal ', " \n ").concat(item.id !== schoolId &&
|
|
651
|
-
(listSchool.length === 1 ||
|
|
661
|
+
: 'font-normal ', " \n ").concat(item.id !== dataInitMain.schoolId &&
|
|
662
|
+
(dataInitMain.listSchool.length === 1 ||
|
|
663
|
+
!enablePer(switchSchool, dataInitMain.perCode)) === false
|
|
652
664
|
? 'cursor-pointer hover:rounded-lg hover:bg-gray-100'
|
|
653
665
|
: '', "\n relative mb-1 flex items-center justify-between px-2 py-1.5 text-sm text-gray-900"), onClick: function () { return handleOpenModal(item.id); } },
|
|
654
666
|
React.createElement("p", { className: 'max-w-[95%] truncate' }, item.name),
|
|
655
|
-
item.id === schoolId &&
|
|
656
|
-
listSchool.length > 1 &&
|
|
657
|
-
!enablePer(switchSchool, perCode) === false && (React.createElement(CheckIcon, { "aria-hidden": 'true', className: 'h-4 w-4' }))))); }))) : (React.createElement(PHXSkeleton, { className: 'flex-1 px-2 py-2', type: 'single' })),
|
|
667
|
+
item.id === dataInitMain.schoolId &&
|
|
668
|
+
dataInitMain.listSchool.length > 1 &&
|
|
669
|
+
!enablePer(switchSchool, dataInitMain.perCode) === false && (React.createElement(CheckIcon, { "aria-hidden": 'true', className: 'h-4 w-4' }))))); }))) : (React.createElement(PHXSkeleton, { className: 'flex-1 px-2 py-2', type: 'single' })),
|
|
658
670
|
React.createElement("div", { className: 'border-b pt-1.5' }),
|
|
659
671
|
React.createElement(Menu.Item, null,
|
|
660
672
|
React.createElement("div", { "aria-hidden": true, className: 'px-2 pb-2 pt-4 text-sm font-semibold text-gray-900' }, "T\u00F9y ch\u1ECDn")),
|
|
@@ -681,7 +693,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
681
693
|
React.createElement("span", { className: 'sr-only' }, "Close sidebar"),
|
|
682
694
|
React.createElement(XMarkIcon, { "aria-hidden": 'true', className: 'h-6 w-6 text-white' })))),
|
|
683
695
|
React.createElement("div", { className: 'mt-8 h-0 flex-1 overflow-y-auto pb-4 pt-5' },
|
|
684
|
-
React.createElement(NavMobile, { menu: menu, path: pathNameWithBasePath, permission: perCode, router: router, setSideBarOpen: function () { return setSidebarOpen(false); } })))),
|
|
696
|
+
React.createElement(NavMobile, { menu: dataInitMain.menu, path: pathNameWithBasePath, permission: dataInitMain.perCode, router: router, setSideBarOpen: function () { return setSidebarOpen(false); } })))),
|
|
685
697
|
React.createElement("div", { "aria-hidden": 'true', className: 'w-14 flex-shrink-0' })))),
|
|
686
698
|
React.createElement("div", { className: 'hidden lg:flex lg:flex-shrink-0' },
|
|
687
699
|
React.createElement("div", { className: 'flex' },
|
|
@@ -689,7 +701,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
689
701
|
React.createElement("div", { "aria-hidden": true, className: "".concat(openNavName ? 'w-64' : 'w-14', " menu-styled z-10 flex h-full flex-col justify-between border-r !bg-gray-200 transition-all duration-300 lg:fixed"), onMouseOut: function () { return setOpenNavName(false); }, onMouseOver: function () { return setOpenNavName(true); } },
|
|
690
702
|
React.createElement("div", { className: classNames('flex flex-1 flex-col', openNavName ? 'overflow-y-auto' : 'overflow-y-hidden') },
|
|
691
703
|
React.createElement("div", { className: 'relative flex-1' },
|
|
692
|
-
React.createElement("div", { "aria-label": 'Sidebar', className: 'hidden overflow-x-hidden md:block md:flex-shrink-0 md:overflow-y-auto' }, !hiddenLeftMenu && (React.createElement("div", { className: "space-y- flex ".concat(openNavName ? 'w-64' : 'w-12', " flex-col overflow-hidden p-3") }, navigation.map(function (item, index) { return (React.createElement("div", { key: index, className: 'w-full' }, enablePer(item.code, perCode) && (React.createElement("a", { className: "".concat(classNames(item.current && !openNavName
|
|
704
|
+
React.createElement("div", { "aria-label": 'Sidebar', className: 'hidden overflow-x-hidden md:block md:flex-shrink-0 md:overflow-y-auto' }, !hiddenLeftMenu && (React.createElement("div", { className: "space-y- flex ".concat(openNavName ? 'w-64' : 'w-12', " flex-col overflow-hidden p-3") }, navigation.map(function (item, index) { return (React.createElement("div", { key: index, className: 'w-full' }, enablePer(item.code, dataInitMain.perCode) && (React.createElement("a", { className: "".concat(classNames(item.current && !openNavName
|
|
693
705
|
? 'menu-bg-color-icon-active-styled font-semibold' // màu background của icon đang active của menu
|
|
694
706
|
: 'menu-icon-color-styled', // màu icon của menu
|
|
695
707
|
!openNavName
|
|
@@ -711,7 +723,7 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
711
723
|
React.createElement(Image, { alt: 'icon', className: classNames('h-[1.125rem] w-[1.125rem] text-gray-950', openNavName && 'mt-[0.2rem]'), height: 0, src: item.current ? Icons["".concat(item.code, "_SOLID")] : Icons[item.code], width: 0 })),
|
|
712
724
|
openNavName && (React.createElement("div", { className: 'h-6' },
|
|
713
725
|
React.createElement("p", { className: "mt-0.5 h-full text-[0.86rem] text-[#353A44] transition-all duration-300 ".concat(openNavName ? 'opacity-100' : 'opacity-0') }, item.name)))))))); })))))),
|
|
714
|
-
React.createElement("div", { className: classNames('border-t', navigation.length > 0 && ((
|
|
726
|
+
React.createElement("div", { className: classNames('border-t', navigation.length > 0 && ((_f = navigation[0]) === null || _f === void 0 ? void 0 : _f.isSchoolink) ? 'border-[#1c222b]' : 'border-indigo-100') },
|
|
715
727
|
React.createElement("div", { className: "mb-14 flex ".concat(openNavName ? 'w-64' : 'w-12', " overflow-hidden p-3") },
|
|
716
728
|
React.createElement("a", { className: classNames('z-0', !openNavName
|
|
717
729
|
? 'inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg'
|
|
@@ -739,75 +751,78 @@ export var PHXMainWrapV3 = function (_a) {
|
|
|
739
751
|
React.createElement("button", { className: 'mr-1 inline-flex items-center rounded-lg border-gray-300 bg-transparent px-2 py-1 text-xs font-medium text-gray-700 hover:bg-gray-200 active:bg-gray-300 active:pb-[0.2rem] active:pt-[0.3rem] active:shadow-[0rem_0.125rem_0.1rem_0rem_#0004_inset]', onClick: function () { return handleBackMenu(); }, type: 'button' },
|
|
740
752
|
React.createElement(ArrowLeftIcon, { className: 'h-5 w-5' })),
|
|
741
753
|
React.createElement("p", { className: 'text-sm font-medium text-slate-600' }, campaignName))),
|
|
742
|
-
React.createElement("div", { className: 'flex-1 overflow-y-auto pt-3' }, subNavigation.map(function (item, subNavIndex) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
: '
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
? styles.
|
|
761
|
-
:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
754
|
+
React.createElement("div", { className: 'flex-1 overflow-y-auto pt-3' }, subNavigation.map(function (item, subNavIndex) {
|
|
755
|
+
var _a;
|
|
756
|
+
return (React.createElement("div", { key: subNavIndex }, ((_a = dataInitMain.roleCode) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (React.createElement(React.Fragment, null, enablePer(item.code, dataInitMain.perCode) ? (React.createElement(React.Fragment, null,
|
|
757
|
+
(item === null || item === void 0 ? void 0 : item.isMicroservice) ? (React.createElement("a", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
758
|
+
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
759
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
760
|
+
'mx-3 flex cursor-pointer border-slate-200 p-2'), href: item.path }, !dataInitMain.loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
761
|
+
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
762
|
+
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
763
|
+
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))) : (React.createElement("div", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
764
|
+
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
765
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
766
|
+
'mx-3 flex cursor-pointer border-slate-200 p-2'), onClick: function () { return subNavigationTriggerClicked(item); } }, !dataInitMain.loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
767
|
+
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
768
|
+
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
769
|
+
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))),
|
|
770
|
+
item.showChild && item.child && (React.createElement(React.Fragment, null, item.child.map(function (children, childIndex) { return (React.createElement("div", { key: childIndex, className: classNames('relative') },
|
|
771
|
+
React.createElement("div", { style: (children === null || children === void 0 ? void 0 : children.current)
|
|
772
|
+
? styles.childMenuActiveBefore
|
|
773
|
+
: checkChildBefore(item.child, children)
|
|
774
|
+
? styles.childMenuBefBefore
|
|
775
|
+
: {} }),
|
|
776
|
+
React.createElement("div", { "aria-hidden": true, className: classNames('mx-3 flex cursor-pointer border-slate-200 p-2 text-[0.84rem]', (children === null || children === void 0 ? void 0 : children.current)
|
|
777
|
+
? 'rounded-lg bg-white text-[#353A44]' // màu chữ menu con khi active
|
|
778
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50 hover:text-[#353A44]'), onClick: enablePer(children.code, dataInitMain.perCode)
|
|
779
|
+
? function () { return subNavigationTriggerClicked(children, item); }
|
|
780
|
+
: undefined },
|
|
781
|
+
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
782
|
+
React.createElement("div", { className: 'w-3' }),
|
|
783
|
+
React.createElement("p", { className: classNames('my-[0.05rem] ml-3 leading-5', !enablePer(children.code, dataInitMain.perCode)
|
|
784
|
+
? 'font-normal text-gray-300'
|
|
785
|
+
: (children === null || children === void 0 ? void 0 : children.current)
|
|
786
|
+
? ''
|
|
787
|
+
: 'font-normal text-[#353A44]') }, children.name))),
|
|
788
|
+
React.createElement("div", { style: (children === null || children === void 0 ? void 0 : children.current)
|
|
789
|
+
? styles.childMenuActiveAfter
|
|
790
|
+
: checkChildBefore(item.child, children)
|
|
791
|
+
? styles.childMenuBefAfter
|
|
792
|
+
: {} }))); }))))) : (React.createElement("div", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
793
|
+
? 'rounded-lg bg-white '
|
|
794
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // hover:bg-white
|
|
795
|
+
'mx-3 flex cursor-pointer border-slate-200 p-2') }, !dataInitMain.loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
796
|
+
React.createElement("div", { className: 'flex items-center gap-x-3 text-gray-700' },
|
|
797
|
+
React.createElement("p", { className: classNames('font-normal leading-5 text-gray-300') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
798
|
+
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))))) : (React.createElement(React.Fragment, null,
|
|
799
|
+
(item === null || item === void 0 ? void 0 : item.isMicroservice) ? (React.createElement("a", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
800
|
+
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
801
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
802
|
+
'mx-3 flex cursor-pointer border-slate-200 p-2'), href: item.path }, !dataInitMain.loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
767
803
|
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
768
|
-
React.createElement("
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
: 'font-normal text-[#353A44]') }, children.name))),
|
|
774
|
-
React.createElement("div", { style: (children === null || children === void 0 ? void 0 : children.current)
|
|
775
|
-
? styles.childMenuActiveAfter
|
|
776
|
-
: checkChildBefore(item.child, children)
|
|
777
|
-
? styles.childMenuBefAfter
|
|
778
|
-
: {} }))); }))))) : (React.createElement("div", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
779
|
-
? 'rounded-lg bg-white '
|
|
780
|
-
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // hover:bg-white
|
|
781
|
-
'mx-3 flex cursor-pointer border-slate-200 p-2') }, !loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
782
|
-
React.createElement("div", { className: 'flex items-center gap-x-3 text-gray-700' },
|
|
783
|
-
React.createElement("p", { className: classNames('font-normal leading-5 text-gray-300') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
784
|
-
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))))) : (React.createElement(React.Fragment, null,
|
|
785
|
-
(item === null || item === void 0 ? void 0 : item.isMicroservice) ? (React.createElement("a", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
786
|
-
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
787
|
-
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
788
|
-
'mx-3 flex cursor-pointer border-slate-200 p-2'), href: item.path }, !loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
789
|
-
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
790
|
-
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
791
|
-
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))) : (React.createElement("div", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
792
|
-
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
793
|
-
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
794
|
-
'mx-3 flex cursor-pointer border-slate-200 p-2'), onClick: function () { return subNavigationTriggerClicked(item); } }, !loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
795
|
-
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
796
|
-
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
797
|
-
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))),
|
|
798
|
-
item.showChild && item.child && (React.createElement(React.Fragment, null, item.child.map(function (children, index) { return (React.createElement("div", { key: index, className: classNames('relative', (children === null || children === void 0 ? void 0 : children.current) && 'child-menu-active', checkChildBefore(item.child, children) && 'child-menu-bef') },
|
|
799
|
-
React.createElement("div", { "aria-hidden": true, className: classNames('mx-1 flex cursor-pointer border-slate-200 p-2 text-[0.84rem]', (children === null || children === void 0 ? void 0 : children.current)
|
|
800
|
-
? 'rounded-lg bg-white text-gray-900 '
|
|
801
|
-
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50 hover:text-gray-900'), onClick: function () { return subNavigationTriggerClicked(children, item); } },
|
|
804
|
+
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
805
|
+
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))) : (React.createElement("div", { "aria-current": (item === null || item === void 0 ? void 0 : item.current) ? 'page' : undefined, "aria-hidden": true, className: classNames((item === null || item === void 0 ? void 0 : item.current)
|
|
806
|
+
? 'rounded-lg bg-white' // màu background menu cha khi active
|
|
807
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50', // màu background khi hover vào menu cha
|
|
808
|
+
'mx-3 flex cursor-pointer border-slate-200 p-2'), onClick: function () { return subNavigationTriggerClicked(item); } }, !dataInitMain.loadingMenu ? (React.createElement("div", { className: 'ml-1 flex items-center text-[0.84rem]' },
|
|
802
809
|
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
803
|
-
React.createElement("
|
|
804
|
-
|
|
810
|
+
React.createElement("p", { className: classNames('leading-5', (item === null || item === void 0 ? void 0 : item.current) ? '' : 'font-normal text-[#353A44]') }, item === null || item === void 0 ? void 0 : item.name)),
|
|
811
|
+
React.createElement("p", { className: 'mt-1 text-slate-500' }, item === null || item === void 0 ? void 0 : item.description))) : (React.createElement(PHXSkeleton, { className: 'mr-3 flex-1', type: 'single' })))),
|
|
812
|
+
item.showChild && item.child && (React.createElement(React.Fragment, null, item.child.map(function (children, index) { return (React.createElement("div", { key: index, className: classNames('relative', (children === null || children === void 0 ? void 0 : children.current) && 'child-menu-active', checkChildBefore(item.child, children) && 'child-menu-bef') },
|
|
813
|
+
React.createElement("div", { "aria-hidden": true, className: classNames('mx-1 flex cursor-pointer border-slate-200 p-2 text-[0.84rem]', (children === null || children === void 0 ? void 0 : children.current)
|
|
814
|
+
? 'rounded-lg bg-white text-gray-900 '
|
|
815
|
+
: 'hover:rounded-lg hover:bg-white hover:bg-opacity-50 hover:text-gray-900'), onClick: function () { return subNavigationTriggerClicked(children, item); } },
|
|
816
|
+
React.createElement("div", { className: 'flex items-center gap-x-3' },
|
|
817
|
+
React.createElement("div", { className: 'w-3' }),
|
|
818
|
+
React.createElement("p", { className: classNames('my-[0.05rem] ml-3 leading-5', (children === null || children === void 0 ? void 0 : children.current) ? 'font-semibold' : 'font-normal text-gray-600') }, children.name))))); })))))));
|
|
819
|
+
}))))))))),
|
|
805
820
|
React.createElement("div", { className: 'flex min-w-0 flex-1 flex-col overflow-hidden' },
|
|
806
821
|
React.createElement("main", { className: 'flex flex-1 overflow-hidden' },
|
|
807
822
|
React.createElement("section", { "aria-labelledby": 'primary-heading', className: 'flex h-full min-w-0 flex-1 flex-col lg:order-last' },
|
|
808
823
|
React.createElement("div", { className: 'sticky top-0 z-10 flex h-14 flex-shrink-0 border-b border-l bg-bgcl-50 px-4 sm:px-6 lg:px-4' }),
|
|
809
824
|
React.createElement("div", { className: "".concat(openSubMenu ? 'lg:ml-[20.063rem]' : 'lg:ml-[5.063rem]', " bg-gray-100 px-6") },
|
|
810
|
-
React.createElement("div", { className: 'py-4' }, isLoadingPermission ? ('') : enablePer(currentCode, perCode) ? (children) : (React.createElement(PHXCard, null,
|
|
825
|
+
React.createElement("div", { className: 'py-4' }, dataInitMain.isLoadingPermission ? ('') : enablePer(currentCode, dataInitMain.perCode) ? (children) : (React.createElement(PHXCard, null,
|
|
811
826
|
React.createElement("div", { className: 'mb-10 mt-10 sm:mb-20 sm:mt-20 lg:mb-32 lg:mt-32' },
|
|
812
827
|
React.createElement("div", { className: 'flex items-center justify-center' },
|
|
813
828
|
React.createElement(LockClosedIcon, { className: 'text-gray-400', height: 70, width: 70 })),
|