adminizer 4.3.0-build.79 → 4.3.0-build.81
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/assets/add-ChaPnvFv.js +1 -0
- package/assets/{add-form-C04ZI5LT.js → add-form-DNqlORQQ.js} +1 -1
- package/assets/add-group-D6YsQVrC.js +1 -0
- package/assets/{add-group-form-CyRwxTs3.js → add-group-form-CDi1y4af.js} +1 -1
- package/assets/{add-user-form-yp020h4r.js → add-user-form-BzXHahSY.js} +1 -1
- package/assets/add-user-psdNyGx8.js +1 -0
- package/assets/{app-CpGtjhxF.css → app-PLVuwM-H.css} +1 -1
- package/assets/{app-layout-BmT5KQwc.js → app-layout-AWzEe1aH.js} +1 -1
- package/assets/{app-sidebar-4lm9f_CG.js → app-sidebar-Bd4nWVXq.js} +1 -1
- package/assets/app-sidebar-header-jBFp1qZb.js +1 -0
- package/assets/app.js +3 -3
- package/assets/{catalog-CG_EB2kz.js → catalog-XiWBZptC.js} +1 -1
- package/assets/{dashboard-CsmJfdLb.js → dashboard-DcRJErQB.js} +1 -1
- package/assets/date-picker-A6CYw4SC.js +1 -0
- package/assets/del-modal-0klf0PNC.js +1 -0
- package/assets/{field-renderer-Bp1lfm0v.js → field-renderer-CYB5W2He.js} +3 -3
- package/assets/form-B-he6_tT.js +1 -0
- package/assets/{form-CSTeMDf5.js → form-BGRpsR-M.js} +1 -1
- package/assets/{home-D00XjLjD.js → home-B7aZTHTv.js} +2 -2
- package/assets/icon-k6999vVE.js +1 -0
- package/assets/{init-user-L-oxFTOv.js → init-user-Btm16ElL.js} +1 -1
- package/assets/input-error-Dbp_lp61.js +1 -0
- package/assets/list-_tZumymo.js +1 -0
- package/assets/{list-table-vIvydJV2.js → list-table-OzVUH7i4.js} +4 -4
- package/assets/{login-DLMJ6l_r.js → login-DeqxLVx3.js} +1 -1
- package/assets/manifest.json +74 -74
- package/assets/material-icon-B9BY_7p9.js +1 -0
- package/assets/{media-manager-ASGJ4PcS.js → media-manager-DQ5CA_na.js} +1 -1
- package/assets/{module-mxngd2cA.js → module-Drcr0QjC.js} +1 -1
- package/assets/{nav-footer-DbGCtmmN.js → nav-footer-DWHxIgb7.js} +1 -1
- package/assets/{nav-main-BcWhl71g.js → nav-main-CRT9ezos.js} +1 -1
- package/assets/notification-C7K-zK4k.js +27 -0
- package/assets/{register-C_W_hOmq.js → register-CMhPasDj.js} +1 -1
- package/assets/tabs-GDFuClHU.js +1 -0
- package/assets/{theme-switcher-D1G6OSMc.js → theme-switcher-C35zBCil.js} +1 -1
- package/assets/{welcome-FHRCdke0.js → welcome-CbhDDQlg.js} +1 -1
- package/controllers/add.js +1 -1
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +4 -4
- package/controllers/edit.js +1 -15
- package/controllers/list.js +2 -2
- package/controllers/login.js +2 -2
- package/controllers/navigation/edit.js +1 -1
- package/controllers/notifications/NotificationController.d.ts +5 -5
- package/controllers/notifications/NotificationController.js +77 -78
- package/controllers/remove.js +1 -11
- package/controllers/view.js +1 -1
- package/helpers/configHelper.d.ts +1 -1
- package/helpers/fieldsHelper.d.ts +1 -1
- package/helpers/fieldsHelper.js +1 -1
- package/helpers/inertiaAddHelper.d.ts +1 -1
- package/helpers/translationHelper.d.ts +1 -1
- package/helpers/translationHelper.js +1 -1
- package/index.d.ts +14 -13
- package/index.js +14 -13
- package/interfaces/adminpanelConfig.d.ts +1 -1
- package/interfaces/global.d.ts +3 -3
- package/interfaces/types.d.ts +10 -1
- package/lib/Adminizer.d.ts +7 -7
- package/lib/Adminizer.js +7 -7
- package/lib/{v4/DataAccessor.d.ts → DataAccessor.d.ts} +4 -4
- package/lib/{v4/DataAccessor.js → DataAccessor.js} +3 -3
- package/lib/{v4/I18n.js → I18n.js} +2 -2
- package/lib/{v4/PolicyManager.d.ts → PolicyManager.d.ts} +1 -1
- package/lib/{v4/PolicyManager.js → PolicyManager.js} +2 -2
- package/lib/{v4/catalog → catalog}/AbstractCatalog.d.ts +1 -1
- package/lib/{v4/catalog → catalog}/Navigation.d.ts +2 -2
- package/lib/{v4/catalog → catalog}/Navigation.js +1 -1
- package/lib/{v4/controls → controls}/AbstractControls.d.ts +1 -1
- package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/markdown/ToastUiEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/table/Handsontable.d.ts +1 -1
- package/lib/{v4/controls → controls}/wysiwyg/CKeditor.d.ts +1 -1
- package/lib/{v4/datatable → datatable}/NodeTable.d.ts +1 -1
- package/lib/{v4/model → model}/AbstractModel.d.ts +12 -0
- package/lib/model/AbstractModel.js +178 -0
- package/lib/{v4/model → model}/ModelHandler.js +1 -1
- package/lib/{v4/model → model}/adapter/sequelize.d.ts +0 -1
- package/lib/{v4/model → model}/adapter/sequelize.js +7 -4
- package/lib/{v4/notifications → notifications}/AbstractNotificationService.d.ts +14 -7
- package/lib/notifications/AbstractNotificationService.js +233 -0
- package/lib/{v4/notifications → notifications}/GeneralNotificationService.d.ts +1 -1
- package/lib/{v4/notifications → notifications}/GeneralNotificationService.js +4 -2
- package/lib/notifications/NotificationHandler.d.ts +27 -0
- package/lib/notifications/NotificationHandler.js +41 -0
- package/lib/{v4/notifications → notifications}/SystemNotificationService.d.ts +5 -4
- package/lib/notifications/SystemNotificationService.js +173 -0
- package/lib/{v4/widgets → widgets}/abstractCustom.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/abstractLink.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/abstractWidgetBase.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/widgetHandler.d.ts +2 -2
- package/migrations/index.d.ts +3 -0
- package/migrations/index.js +4 -0
- package/migrations/index.ts +5 -0
- package/migrations/umzug/0001.d.ts +7 -0
- package/migrations/umzug/0001.js +119 -0
- package/migrations/umzug/0001.ts +132 -0
- package/migrations/umzug.d.ts +2 -0
- package/migrations/umzug.js +8 -0
- package/migrations/umzug.ts +9 -0
- package/models/NotificationAP.d.ts +8 -0
- package/models/NotificationAP.js +8 -0
- package/models/UserAP.d.ts +1 -1
- package/package.json +5 -4
- package/system/Router.js +4 -8
- package/system/bindControls.js +6 -6
- package/system/bindInertia.js +4 -3
- package/system/bindNavigation.js +1 -1
- package/system/bindNotifications.js +3 -3
- package/system/bindReqFunctions.js +8 -25
- package/system/defaults.js +1 -1
- package/ui/components/ui/table.d.ts +1 -1
- package/ui/components/ui/table.js +2 -2
- package/assets/add-DSapOiv0.js +0 -1
- package/assets/add-group-DWR7SBTO.js +0 -1
- package/assets/add-user-acATGxUL.js +0 -1
- package/assets/app-sidebar-header-CxXmzszq.js +0 -1
- package/assets/date-picker-By3kj-Rx.js +0 -1
- package/assets/del-modal-DlcbcdR5.js +0 -1
- package/assets/form-CxHRGp7p.js +0 -1
- package/assets/icon-ButfCBrt.js +0 -1
- package/assets/input-error-CHsDLcK0.js +0 -1
- package/assets/list-4TOTsjqE.js +0 -1
- package/assets/material-icon-sXk4BK-N.js +0 -1
- package/assets/notification-BEfA5sT6.js +0 -1
- package/assets/tabs-CgZW_LLn.js +0 -1
- package/lib/v4/model/AbstractModel.js +0 -79
- package/lib/v4/notifications/AbstractNotificationService.js +0 -150
- package/lib/v4/notifications/NotificationHandler.d.ts +0 -69
- package/lib/v4/notifications/NotificationHandler.js +0 -127
- package/lib/v4/notifications/SystemNotificationService.js +0 -124
- /package/lib/{v4/I18n.d.ts → I18n.d.ts} +0 -0
- /package/lib/{v4/POWCaptcha.d.ts → POWCaptcha.d.ts} +0 -0
- /package/lib/{v4/POWCaptcha.js → POWCaptcha.js} +0 -0
- /package/lib/{v4/catalog → catalog}/AbstractCatalog.js +0 -0
- /package/lib/{v4/catalog → catalog}/CatalogHandler.d.ts +0 -0
- /package/lib/{v4/catalog → catalog}/CatalogHandler.js +0 -0
- /package/lib/{v4/controls → controls}/AbstractControls.js +0 -0
- /package/lib/{v4/controls → controls}/ControlsHandler.d.ts +0 -0
- /package/lib/{v4/controls → controls}/ControlsHandler.js +0 -0
- /package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.js +0 -0
- /package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.js +0 -0
- /package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.js +0 -0
- /package/lib/{v4/controls → controls}/markdown/ToastUiEditor.js +0 -0
- /package/lib/{v4/controls → controls}/table/Handsontable.js +0 -0
- /package/lib/{v4/controls → controls}/wysiwyg/CKeditor.js +0 -0
- /package/lib/{v4/datatable → datatable}/NodeTable.js +0 -0
- /package/lib/{v4/helper → helper}/jwt.d.ts +0 -0
- /package/lib/{v4/helper → helper}/jwt.js +0 -0
- /package/lib/{v4/inertia → inertia}/flash.d.ts +0 -0
- /package/lib/{v4/inertia → inertia}/flash.js +0 -0
- /package/lib/{v4/inertia → inertia}/inertiaAdapter.d.ts +0 -0
- /package/lib/{v4/inertia → inertia}/inertiaAdapter.js +0 -0
- /package/lib/{v4/model → model}/ModelHandler.d.ts +0 -0
- /package/lib/{v4/model → model}/adapter/waterline.d.ts +0 -0
- /package/lib/{v4/model → model}/adapter/waterline.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractAction.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractAction.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractCustom.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractInfo.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractInfo.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractLink.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractSwitch.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractSwitch.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractWidgetBase.js +0 -0
- /package/lib/{v4/widgets → widgets}/widgetHandler.js +0 -0
package/system/Router.js
CHANGED
|
@@ -84,19 +84,15 @@ export default class Router {
|
|
|
84
84
|
/**
|
|
85
85
|
* Notifications
|
|
86
86
|
*/
|
|
87
|
-
if (adminizer.config.
|
|
87
|
+
if (adminizer.config.notifications.enabled) {
|
|
88
88
|
adminizer.app.get(`${adminizer.config.routePrefix}/notifications`, adminizer.policyManager.bindPolicies(policies, NotificationController.viewAll));
|
|
89
89
|
adminizer.app.get(`${adminizer.config.routePrefix}/api/notifications/stream`, adminizer.policyManager.bindPolicies(policies, NotificationController.getNotificationsStream));
|
|
90
90
|
adminizer.app.get(`${adminizer.config.routePrefix}/api/notifications/:notificationClass`, adminizer.policyManager.bindPolicies(policies, NotificationController.getNotificationsByClass));
|
|
91
91
|
adminizer.app.get(`${adminizer.config.routePrefix}/api/notifications`, adminizer.policyManager.bindPolicies(policies, NotificationController.getUserNotifications));
|
|
92
|
-
adminizer.app.
|
|
92
|
+
adminizer.app.put(`${adminizer.config.routePrefix}/api/notifications/get-classes`, adminizer.policyManager.bindPolicies(policies, NotificationController.getNotificationClasses));
|
|
93
93
|
adminizer.app.put(`${adminizer.config.routePrefix}/api/notifications/:notificationClass/:id/read`, adminizer.policyManager.bindPolicies(policies, NotificationController.markAsRead));
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// adminizer.policyManager.bindPolicies([...policies, 'isAdmin'],
|
|
97
|
-
// (req: ReqType, res: ResType) => NotificationController.sendNotification(req, res)
|
|
98
|
-
// )
|
|
99
|
-
// );
|
|
94
|
+
adminizer.app.put(`${adminizer.config.routePrefix}/api/notifications/read-all`, adminizer.policyManager.bindPolicies(policies, NotificationController.markAllAsRead));
|
|
95
|
+
adminizer.app.post(`${adminizer.config.routePrefix}/api/notifications/search`, adminizer.policyManager.bindPolicies(policies, NotificationController.search));
|
|
100
96
|
}
|
|
101
97
|
/**
|
|
102
98
|
* List of records
|
package/system/bindControls.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CKeditor } from "../lib/
|
|
2
|
-
import { ToastUiEditor } from "../lib/
|
|
3
|
-
import { Handsontable } from "../lib/
|
|
4
|
-
import { JsonEditor } from "../lib/
|
|
5
|
-
import { MonacoEditor } from "../lib/
|
|
6
|
-
import { GeoEditor } from "../lib/
|
|
1
|
+
import { CKeditor } from "../lib/controls/wysiwyg/CKeditor";
|
|
2
|
+
import { ToastUiEditor } from "../lib/controls/markdown/ToastUiEditor";
|
|
3
|
+
import { Handsontable } from "../lib/controls/table/Handsontable";
|
|
4
|
+
import { JsonEditor } from "../lib/controls/jsoneditor/JsonEditor";
|
|
5
|
+
import { MonacoEditor } from "../lib/controls/codeEditor/MonacoEditor";
|
|
6
|
+
import { GeoEditor } from "../lib/controls/geojsoneditor/GeoEditor";
|
|
7
7
|
export function bindControls(adminizer) {
|
|
8
8
|
// bind wysiwyg
|
|
9
9
|
adminizer.controlsHandler.add(new CKeditor(adminizer));
|
package/system/bindInertia.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import flash from "../lib/
|
|
2
|
-
import inertia from "../lib/
|
|
1
|
+
import flash from "../lib/inertia/flash";
|
|
2
|
+
import inertia from "../lib/inertia/inertiaAdapter";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { InertiaMenuHelper } from "../helpers/inertiaMenuHelper";
|
|
@@ -132,7 +132,8 @@ export function bindInertia(adminizer) {
|
|
|
132
132
|
title: req.i18n.__(sec.title),
|
|
133
133
|
})))
|
|
134
134
|
] : null,
|
|
135
|
-
showVersion: req.adminizer.config.showVersion ?? false
|
|
135
|
+
showVersion: req.adminizer.config.showVersion ?? false,
|
|
136
|
+
notifications: req.adminizer.config.notifications.enabled ?? false,
|
|
136
137
|
});
|
|
137
138
|
next();
|
|
138
139
|
});
|
package/system/bindNavigation.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Adminizer } from '../lib/Adminizer';
|
|
2
|
-
import { NotificationHandler } from '../lib/
|
|
3
|
-
import { GeneralNotificationService } from '../lib/
|
|
4
|
-
import { SystemNotificationService } from '../lib/
|
|
2
|
+
import { NotificationHandler } from '../lib/notifications/NotificationHandler';
|
|
3
|
+
import { GeneralNotificationService } from '../lib/notifications/GeneralNotificationService';
|
|
4
|
+
import { SystemNotificationService } from '../lib/notifications/SystemNotificationService';
|
|
5
5
|
export async function bindNotifications(adminizer) {
|
|
6
6
|
// Создаем хендлер
|
|
7
7
|
adminizer.notificationHandler = new NotificationHandler();
|
|
@@ -1,32 +1,13 @@
|
|
|
1
1
|
import { Adminizer } from "../lib/Adminizer";
|
|
2
|
-
import { I18n } from "../lib/
|
|
2
|
+
import { I18n } from "../lib/I18n";
|
|
3
3
|
import { parse } from "cookie";
|
|
4
|
-
import { verifyUser } from "../lib/
|
|
4
|
+
import { verifyUser } from "../lib/helper/jwt";
|
|
5
5
|
export default function bindReqFunctions(adminizer) {
|
|
6
|
-
let
|
|
6
|
+
let bindReqFunctionsF = async function (req, res, next) {
|
|
7
7
|
/**
|
|
8
8
|
* Add adminizer to use in controllers
|
|
9
9
|
* */
|
|
10
10
|
req.adminizer = adminizer;
|
|
11
|
-
/**
|
|
12
|
-
* Function to upload files using multer.
|
|
13
|
-
* Filename can be set dynamically based on you filename using simple function
|
|
14
|
-
* */
|
|
15
|
-
// req.upload = (options?: { destination?: string; filename?: (file: Express.Multer.File) => string }) => {
|
|
16
|
-
// const storage = multer.diskStorage({
|
|
17
|
-
// destination: (req, file, cb) => {
|
|
18
|
-
// const destination = options?.destination || "uploads/";
|
|
19
|
-
// cb(null, destination);
|
|
20
|
-
// },
|
|
21
|
-
// filename: (req, file, cb) => {
|
|
22
|
-
// const filename =
|
|
23
|
-
// options?.filename?.(file) || `${Date.now()}-${file.originalname}`;
|
|
24
|
-
// cb(null, filename);
|
|
25
|
-
// },
|
|
26
|
-
// });
|
|
27
|
-
//
|
|
28
|
-
// return multer({storage});
|
|
29
|
-
// };
|
|
30
11
|
/**
|
|
31
12
|
* Add i18n
|
|
32
13
|
* */
|
|
@@ -41,7 +22,8 @@ export default function bindReqFunctions(adminizer) {
|
|
|
41
22
|
if (token) {
|
|
42
23
|
const user = verifyUser(token, req.adminizer.jwtSecret);
|
|
43
24
|
if (user) {
|
|
44
|
-
req.user = user;
|
|
25
|
+
req.user = await req.adminizer.modelHandler.model.get('userap')['_findOne']({ id: user.id });
|
|
26
|
+
// req.user = user;
|
|
45
27
|
}
|
|
46
28
|
}
|
|
47
29
|
if (req.session.userPretended) {
|
|
@@ -49,7 +31,8 @@ export default function bindReqFunctions(adminizer) {
|
|
|
49
31
|
}
|
|
50
32
|
next();
|
|
51
33
|
};
|
|
52
|
-
adminizer.app.use('/',
|
|
53
|
-
adminizer.app.use('/*',
|
|
34
|
+
// adminizer.app.use('/', bindReqFunctionsF);
|
|
35
|
+
// adminizer.app.use('/*', bindReqFunctionsF);
|
|
36
|
+
adminizer.app.use(bindReqFunctionsF);
|
|
54
37
|
Adminizer.log.info("Adminizer upload loaded");
|
|
55
38
|
}
|
package/system/defaults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare function Table({ className, wrapperHeight, ...props }: React.ComponentProps<"table"> & {
|
|
2
|
+
declare function Table({ className, wrapperHeight, ref, ...props }: React.ComponentProps<"table"> & {
|
|
3
3
|
wrapperHeight?: string;
|
|
4
4
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "@/lib/utils";
|
|
3
|
-
function Table({ className, wrapperHeight, ...props }) {
|
|
4
|
-
return (_jsx("div", { "data-slot": "table-container", className: cn('relative w-full overflow-x-auto', wrapperHeight), children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
3
|
+
function Table({ className, wrapperHeight, ref, ...props }) {
|
|
4
|
+
return (_jsx("div", { "data-slot": "table-container", ref: ref, className: cn('relative w-full overflow-x-auto', wrapperHeight), children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
5
5
|
}
|
|
6
6
|
function TableHeader({ className, ...props }) {
|
|
7
7
|
return (_jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props }));
|
package/assets/add-DSapOiv0.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{q as t,j as o}from"./app.js";import{A as m}from"./app-layout-BmT5KQwc.js";import p from"./add-form-C04ZI5LT.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./app-sidebar-header-CxXmzszq.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";import"./field-renderer-Bp1lfm0v.js";import"./dynamic-controls-PxBg8yMz.js";import"./input-error-CHsDLcK0.js";const i=[];function k(){const r=t();return o.jsx(m,{breadcrumbs:i,children:o.jsx(p,{page:r,catalog:!1})})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-BmT5KQwc.js";import t from"./add-group-form-CyRwxTs3.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./app-sidebar-header-CxXmzszq.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";const m=[];function E(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-BmT5KQwc.js";import t from"./add-user-form-yp020h4r.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./app-sidebar-header-CxXmzszq.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";import"./input-error-CHsDLcK0.js";const m=[];function F(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,g as N,aF as C,r as M,B as v,aG as S,u as E,v as $,aH as I,J as P,K as T,a2 as A,M as D,m as k,aI as B,U as R,L as z,aJ as L}from"./app.js";import{Breadcrumbs as O}from"./breadcrumbs-livOfa2Z.js";import{NavUser as _}from"./nav-user-BN2veV3l.js";import{ThemeSwitcher as J}from"./theme-switcher-D1G6OSMc.js";import{r as d}from"./monaco-B1uVVM7f.js";import H from"./material-icon-sXk4BK-N.js";const y=d.createContext(void 0),X=({children:i})=>{const[m,x]=d.useState([]),[j,c]=d.useState([]),[p,h]=d.useState(!1),f=async()=>{try{const r=await N.get(`${window.routePrefix}/api/notifications`,{params:{unreadOnly:!0,limit:4}});x(r.data)}catch(r){console.error("Error fetching bell notifications:",r)}},t=async()=>{await f()},n=async r=>{h(!0);try{const a=r?`${window.routePrefix}/api/notifications/${r}`:`${window.routePrefix}/api/notifications`,s=await N.get(a);return c(s.data),s.data}catch(a){return console.error("Error fetching all notifications:",a),[]}finally{h(!1)}};d.useEffect(()=>{f();const r=new EventSource(`${window.routePrefix}/api/notifications/stream`);return r.addEventListener("connected",a=>{const s=JSON.parse(a.data);console.log("Connected event:",s)}),r.addEventListener("notification",a=>{const s=JSON.parse(a.data);x(o=>[s,...o.filter(l=>l.id!==s.id)].slice(0,4)),c(o=>[s,...o.filter(l=>l.id!==s.id)])}),r.onerror=()=>{console.error("SSE connection error")},()=>r.close()},[]);const u=async(r,a)=>{try{await N.put(`${window.routePrefix}/api/notifications/${r}/${a}/read`,{}),c(s=>s.map(o=>o.id===a?{...o,read:!0}:o)),await f()}catch(s){throw console.error("Error marking as read:",s),s}},w=m.filter(r=>!r.read).length;return e.jsx(y.Provider,{value:{bellNotifications:m,allNotifications:j,unreadCount:w,markAsRead:u,fetchAllNotifications:n,loading:p,refreshBellNotifications:t},children:i})},F=()=>{const i=d.useContext(y);if(i===void 0)throw new Error("useNotifications must be used within a NotificationProvider");return i};function G(){const{bellNotifications:i,markAsRead:m,unreadCount:x,refreshBellNotifications:j}=F(),[c,p]=d.useState(!1),h=async(t,n)=>{p(!0);try{await m(t,n),await j()}catch(u){console.error("Error marking as read:",u)}finally{p(!1)}},f=t=>{const n=new Date,u=new Date(t),w=n.getTime()-u.getTime(),r=Math.floor(w/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});if(r<60)return a.format(-r,"second");const s=Math.floor(r/60);if(s<60)return a.format(-s,"minute");const o=Math.floor(s/60);if(o<24)return a.format(-o,"hour");const l=Math.floor(o/24);if(l<30)return a.format(-l,"day");const g=Math.floor(l/30);if(g<12)return a.format(-g,"month");const b=Math.floor(g/12);return a.format(-b,"year")};return e.jsxs(C,{children:[e.jsx(M,{asChild:!0,className:"cursor-pointer data-[state=open]:bg-sidebar-accent",children:e.jsxs(v,{variant:"ghost",className:"relative",children:[e.jsx(S,{}),x>0&&e.jsx("div",{className:"absolute top-1.5 right-1.5 size-1.5 rounded-full bg-destructive"})]})}),e.jsxs(E,{className:"z-[1002] p-2",align:"end",onCloseAutoFocus:t=>t.preventDefault(),children:[e.jsx($,{className:`${c?"opacity-50 pointer-events-none":""}`,children:i.length===0?e.jsx("div",{className:"p-4 text-center text-muted-foreground",children:"No notifications"}):i.map(t=>e.jsxs("div",{children:[e.jsx(I,{asChild:!0,className:"cursor-pointer",onSelect:n=>{n.preventDefault(),k.visit(`${window.routePrefix}/notifications?type=${t.notificationClass}`)},children:e.jsxs("div",{className:"grid grid-cols-[32px_250px] grid-rows-[auto_1fr] items-start gap-x-4 gap-y-2",children:[t.icon?e.jsx(H,{name:t.icon.icon,style:{color:t.icon.iconColor},className:"!text-[32px]"}):e.jsx("div",{}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:t.title}),e.jsx("span",{className:"truncate",children:t.message})]}),e.jsxs("div",{className:"col-start-2 flex justify-between flex-nowrap items-center",children:[e.jsxs("div",{className:"flex flex-nowrap gap-2 items-center",children:[t.notificationClass==="general"?e.jsx("div",{className:"font-medium",children:"Info"}):e.jsx("div",{className:"font-medium",children:"Activity"}),e.jsx("span",{children:"●"}),e.jsx("div",{children:f(t.createdAt)})]}),e.jsxs(P,{children:[e.jsx(T,{asChild:!0,children:e.jsx(v,{variant:"ghost",size:"icon",className:"size-4",onClick:n=>{n.stopPropagation(),h(t.notificationClass,t.id)},children:e.jsx(A,{className:"text-primary"})})}),e.jsx(D,{side:"left",className:"z-[1003]",children:e.jsx("p",{children:"Make read"})})]})]})]})}),e.jsx(B,{})]},t.id))}),e.jsx(v,{variant:"secondary",asChild:!0,children:e.jsxs(R,{href:`${window.routePrefix}/notifications?type=general`,className:`w-full ${c?"opacity-50 pointer-events-none":""}`,children:["View All",c&&e.jsx(z,{className:"h-4 w-4 animate-spin"})]})})]})]})}function U({breadcrumbs:i=[]}){return e.jsx("header",{className:"border-sidebar-border/50 flex h-16 shrink-0 items-center gap-2 border-b px-6 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 md:px-4",children:e.jsxs("div",{className:"flex justify-between w-full",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"-ml-1"}),e.jsx(O,{breadcrumbs:i})]}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx(J,{}),e.jsx(G,{}),e.jsx(_,{})]})]})})}const Z=Object.freeze(Object.defineProperty({__proto__:null,AppSidebarHeader:U},Symbol.toStringTag,{value:"Module"}));export{U as A,X as N,Z as a,F as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r,bb as p,bc as u,B as x,bd as c,a3 as t,be as d,bf as j,bg as f}from"./app.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";function C({selected:a,onSelect:s,placeholder:o="Pick a date",className:e,buttonClassName:i,disabled:n=!1,fromDate:l,toDate:m}){return r.jsxs(p,{children:[r.jsx(u,{asChild:!0,children:r.jsxs(x,{variant:"outline",className:t("w-[240px] justify-start text-left font-normal cursor-pointer border-input",!a&&"text-muted-foreground",i),disabled:n,children:[r.jsx(d,{className:"mr-2 h-4 w-4"}),a?c(a,"PPP"):r.jsx("span",{children:o})]})}),r.jsx(j,{className:t("w-auto p-0",e),align:"start",children:r.jsx(f,{mode:"single",selected:a,onSelect:s,initialFocus:!0,fromDate:l,toDate:m})})]})}export{C as DatePicker};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,a8 as x,ar as h,B as e,a3 as j,aj as m,a9 as u,aa as p,ab as D,am as g,an as r,U as C}from"./app.js";import{r as v}from"./monaco-B1uVVM7f.js";import{Icon as f}from"./icon-ButfCBrt.js";const y=v.forwardRef(({btnTitle:i,link:t,delModal:a,handleDelete:n,variant:l,btnCLass:o,isLink:c=!0},d)=>s.jsxs(x,{children:[s.jsx(h,{asChild:!0,children:s.jsxs(e,{ref:d,size:"list",variant:l??"ghost",className:j("cursor-pointer",o),children:[s.jsx(f,{iconNode:m}),i]})}),s.jsxs(u,{className:"sm:max-w-[425px] z-[1011]",children:[s.jsxs(p,{children:[s.jsx(D,{children:"Delete"}),s.jsx("div",{className:"mt-2 text-base",children:a.text})]}),s.jsxs(g,{children:[s.jsx(r,{asChild:!0,children:c?s.jsx(e,{variant:"destructive",asChild:!0,children:s.jsx(C,{href:t??"#",children:a.yes})}):s.jsx(e,{variant:"destructive",asChild:!0,onClick:n,children:s.jsx("span",{children:a.yes})})}),s.jsx(r,{asChild:!0,children:s.jsx(e,{type:"button",variant:"secondary",children:a.no})})]})]})]}));y.displayName="DeleteModal";export{y as D};
|
package/assets/form-CxHRGp7p.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./app.js";import{A as o}from"./app-layout-BmT5KQwc.js";import t from"./form-CSTeMDf5.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./app-sidebar-header-CxXmzszq.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";import"./add-form-C04ZI5LT.js";import"./field-renderer-Bp1lfm0v.js";import"./dynamic-controls-PxBg8yMz.js";import"./input-error-CHsDLcK0.js";const m=[];function g(){return r.jsx(o,{breadcrumbs:m,children:r.jsx(t,{})})}export{g as default};
|
package/assets/icon-ButfCBrt.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i,a3 as m}from"./app.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";function e({iconNode:o,className:r,...t}){return i.jsx(o,{className:m("h-4 w-4",r),...t})}export{e as Icon};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,a3 as p}from"./app.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";function x({message:t,className:r="",...o}){return t?e.jsx("p",{...o,className:p("text-sm text-red-600 dark:text-red-400",r),children:t}):null}export{x as default};
|
package/assets/list-4TOTsjqE.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./app.js";import{A as r}from"./app-layout-BmT5KQwc.js";import t from"./list-table-vIvydJV2.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./app-sidebar-header-CxXmzszq.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";import"./del-modal-DlcbcdR5.js";import"./pagination-render-BceTnewI.js";const m=[],E=()=>o.jsx(r,{breadcrumbs:m,className:"overflow-auto h-[calc(100svh-16px)]",children:o.jsx(t,{})});export{E as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i,a3 as o}from"./app.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";function c({name:t,className:r,style:a}){return i.jsx("span",{className:o("material-icons-outlined",r),style:a,children:t})}export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,Y as S,Z as L,_ as j,$ as n,a0 as R,a1 as c,J as z,K as M,B as v,a2 as w,M as E,a3 as f,a4 as A,P,a5 as B,a6 as H,a7 as O,a8 as $,a9 as I,aa as U,ab as q,q as G,m as J,L as F}from"./app.js";import{A as K}from"./app-layout-BmT5KQwc.js";import{e as Y,r as h}from"./monaco-B1uVVM7f.js";import{T as Z,a as _,b as C,c as D}from"./tabs-CgZW_LLn.js";import{u as Q}from"./app-sidebar-header-CxXmzszq.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./handsontable-D6MvFmcM.js";import"./app-shell-xEVbINZV.js";import"./app-sidebar-4lm9f_CG.js";import"./nav-main-BcWhl71g.js";import"./material-icon-sXk4BK-N.js";import"./breadcrumbs-livOfa2Z.js";import"./nav-user-BN2veV3l.js";import"./user-info-BrWerGLc.js";import"./user-menu-content-D61_auxX.js";import"./theme-switcher-D1G6OSMc.js";import"./icon-ButfCBrt.js";const W=({notifications:a,onMarkAsRead:o})=>{const m=async(t,p)=>{try{await o(t,p)}catch(r){console.error("Error marking as read:",r)}};return e.jsxs(S,{wrapperHeight:"max-h-[75vh]",children:[e.jsx(L,{className:"sticky top-0 bg-background shadow z-1",children:e.jsxs(j,{children:[e.jsx(n,{className:"p-2 text-left"}),e.jsx(n,{className:"p-2 text-left",children:"Title"}),e.jsx(n,{className:"p-2 text-left",children:"Message"}),e.jsx(n,{className:"p-2 text-left",children:"Date"})]})}),e.jsx(R,{children:a.map(t=>e.jsxs(j,{className:`${t.read?"":"bg-chart-1/20 hover:bg-chart-1/20"}`,children:[e.jsx(c,{className:"p-2 align-top pt-2.5",children:e.jsxs(z,{children:[e.jsx(M,{asChild:!0,children:e.jsx(v,{variant:"ghost",size:"icon",className:`size-4 ${t.read?"opacity-50 pointer-events-none":""}`,onClick:()=>m(t.notificationClass,t.id),children:e.jsx(w,{className:"text-primary"})})}),e.jsx(E,{side:"right",className:"z-[1003]",children:e.jsx("p",{children:"Make read"})})]})}),e.jsx(c,{className:"p-2 align-top font-medium",children:t.title}),e.jsx(c,{className:"p-2 whitespace-break-spaces",children:e.jsx("div",{className:"max-w-[500px] whitespace-break-spaces",children:t.message})}),e.jsx(c,{className:"p-2 align-top",children:new Date(t.createdAt).toLocaleString()})]},t.id))})]})},X=({changes:a,title:o="Changes",className:m=""})=>{if(!a||a.length===0)return e.jsx("div",{className:f("bg-muted border border-border rounded-lg p-4",m),children:e.jsxs("div",{className:"flex items-center text-muted-foreground",children:[e.jsx(w,{className:"w-5 h-5 mr-2"}),e.jsx("span",{children:"Changes not found"})]})});const t=r=>r===null?"null":r===void 0?"—":typeof r=="boolean"?r?"Да":"Нет":typeof r=="object"?JSON.stringify(r):String(r),p=r=>r.oldValue===void 0?"added":r.newValue===void 0?"removed":"modified";return e.jsxs("div",{className:f("bg-card border border-border rounded-lg shadow-sm",m),children:[e.jsx("div",{className:"px-4 py-3 border-b border-border bg-muted",children:e.jsxs("h3",{className:"text-lg font-semibold text-card-foreground flex items-center",children:[e.jsx(A,{className:"w-5 h-5 mr-2"}),o," (",a.length,")"]})}),e.jsx("div",{className:"divide-y divide-border",children:a.map((r,u)=>{const s=p(r),d=s==="added"?P:s==="removed"?B:A,x=f("text-xs px-2 py-1 rounded-full bg-opacity-10",s==="added"&&"text-green-600 bg-green-100",s==="removed"&&"text-destructive bg-destructive/20",s==="modified"&&"text-primary bg-primary/20"),N=s==="added"?"text-green-600":s==="removed"?"text-destructive":"text-primary";return e.jsxs("div",{className:"p-4 hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center",children:[Y.createElement(d,{className:f("w-4 h-4 mr-2",N)}),e.jsx("span",{className:"font-medium text-card-foreground",children:r.field})]}),e.jsx("span",{className:x,children:s==="added"?"Added":s==="removed"?"Removed":"Updated"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 text-sm",children:[s!=="added"&&e.jsxs("div",{className:"p-2 bg-destructive/10 border border-destructive/20 rounded",children:[e.jsx("div",{className:"text-xs text-destructive font-medium mb-1",children:"Old:"}),e.jsx("div",{className:"text-destructive-foreground font-mono break-words",children:t(r.oldValue)})]}),s!=="removed"&&e.jsxs("div",{className:"p-2 bg-green-50 border border-green-100 rounded",children:[e.jsx("div",{className:"text-xs text-green-600 font-medium mb-1",children:"New:"}),e.jsx("div",{className:"text-green-800 font-mono break-words",children:t(r.newValue)})]})]}),s==="modified"&&e.jsxs("div",{className:"mt-2 flex items-center text-xs text-muted-foreground",children:[e.jsx(H,{className:"w-3 h-3 mr-1"}),"changed type: ",r.type]})]},u)})})]})},ee=({notifications:a,onMarkAsRead:o})=>{const[m,t]=h.useState(!1),[p,r]=h.useState(null),u=async(s,d)=>{try{await o(s,d)}catch(x){console.error("Error marking as read:",x)}};return e.jsxs("div",{children:[e.jsxs(S,{wrapperHeight:"max-h-[75vh]",children:[e.jsx(L,{className:"sticky top-0 bg-background shadow z-1",children:e.jsxs(j,{children:[e.jsx(n,{className:"p-2 text-left"}),e.jsx(n,{className:"p-2 text-left",children:"Title"}),e.jsx(n,{className:"p-2 text-left",children:"Message"}),e.jsx(n,{className:"p-2 text-left",children:"Date"}),e.jsx(n,{className:"p-2 text-left",children:"Diff"})]})}),e.jsx(R,{children:a.map(s=>{var d;return e.jsxs(j,{className:`${s.read?"":"bg-chart-1/20 hover:bg-chart-1/20"}`,children:[e.jsx(c,{className:"p-2 pt-2.5",children:e.jsxs(z,{children:[e.jsx(M,{asChild:!0,children:e.jsx(v,{variant:"ghost",size:"icon",className:`size-4 ${s.read?"opacity-50 pointer-events-none":""}`,onClick:()=>u(s.notificationClass,s.id),children:e.jsx(w,{className:"text-primary"})})}),e.jsx(E,{side:"right",className:"z-[1003]",children:e.jsx("p",{children:"Make read"})})]})}),e.jsx(c,{className:"p-2 font-medium",children:s.title}),e.jsx(c,{className:"p-2 whitespace-break-spaces",children:e.jsx("div",{className:"max-w-[500px] whitespace-break-spaces",children:s.message})}),e.jsx(c,{className:"p-2",children:new Date(s.createdAt).toLocaleString()}),e.jsx(c,{className:"p-2",children:((d=s.metadata)==null?void 0:d.changes)&&e.jsx(v,{variant:"green",size:"sm",onClick:()=>{var x;r((x=s.metadata)==null?void 0:x.changes),t(!0)},children:e.jsx(O,{})})})]},s.id)})})]}),e.jsx($,{open:m,onOpenChange:s=>{t(s),s||setTimeout(()=>{document.body.removeAttribute("style")},300)},children:e.jsxs(I,{className:"z-[1022] sm:max-w-[60vw]",children:[e.jsx(U,{children:e.jsx(q,{children:"Diff"})}),e.jsx(X,{changes:p,className:"max-h-[80vh] overflow-auto sm:max-w-[60vw] w-full"})]})})]})},se=()=>{const a=G(),{allNotifications:o,markAsRead:m,fetchAllNotifications:t,loading:p,refreshBellNotifications:r}=Q(),[u,s]=h.useState(!0),[d,x]=h.useState([]),N=()=>{const l=new URL(a.url,window.location.origin).searchParams.get("type");return l==="system"&&a.props.auth.user.isAdministrator?"system":"general"},[g,b]=h.useState(N());h.useEffect(()=>{const l=new URL(a.url,window.location.origin).searchParams.get("type");if(l&&l!==g){if(l==="system"&&!a.props.auth.user.isAdministrator){b("general");return}b(l)}},[a.url,g,a.props.auth.user.isAdministrator]),h.useEffect(()=>{(async()=>{s(!0),await t(g),s(!1)})()},[g]),h.useEffect(()=>{const i=o.filter(l=>l.notificationClass===g);x(i)},[o,g]);const V=async i=>{i==="system"&&!a.props.auth.user.isAdministrator||(b(i),s(!0),J.get(a.url,{type:i},{preserveState:!0,preserveScroll:!0,replace:!0}),await t(i),s(!1))},y=async(i,l)=>{try{await m(i,l),await r()}catch(k){throw console.error("Error marking as read:",k),k}},T=i=>u||p?e.jsx(F,{className:"mx-auto mt-14 size-8 animate-spin"}):d.length===0?e.jsx("div",{className:"text-center font-medium mt-8",children:"No notifications found"}):i==="general"?e.jsx(W,{notifications:d,onMarkAsRead:y}):e.jsx(ee,{notifications:d,onMarkAsRead:y});return e.jsxs("div",{className:"flex h-auto flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsx("h1",{className:"font-bold text-xl",children:a.props.title}),e.jsxs(Z,{value:g,className:"w-full",onValueChange:V,children:[e.jsxs(_,{className:"w-full mb-4",children:[e.jsx(C,{value:"general",disabled:u,children:"General"}),a.props.auth.user.isAdministrator&&e.jsx(C,{value:"system",disabled:u,children:"System"})]}),e.jsx(D,{value:"general",children:T("general")}),a.props.auth.user.isAdministrator&&e.jsx(D,{value:"system",children:T("system")})]})]})},re=[],ve=()=>e.jsx(K,{breadcrumbs:re,children:e.jsx(se,{})});export{ve as default};
|
package/assets/tabs-CgZW_LLn.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as d,at as de,au as G,av as O,aw as $,ax as R,ay as B,az as U,aA as fe,aB as pe,a3 as P}from"./app.js";import{r as s,e as E}from"./monaco-B1uVVM7f.js";import"./handsontable-D6MvFmcM.js";function L(e){const t=me(e),n=s.forwardRef((o,r)=>{const{children:i,...a}=o,l=s.Children.toArray(i),v=l.find(be);if(v){const p=v.props.children,c=l.map(f=>f===v?s.Children.count(p)>1?s.Children.only(null):s.isValidElement(p)?p.props.children:null:f);return d.jsx(t,{...a,ref:r,children:s.isValidElement(p)?s.cloneElement(p,void 0,c):null})}return d.jsx(t,{...a,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function me(e){const t=s.forwardRef((n,o)=>{const{children:r,...i}=n;if(s.isValidElement(r)){const a=Ie(r),l=ge(i,r.props);return r.type!==s.Fragment&&(l.ref=o?de(o,a):a),s.cloneElement(r,l)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ve=Symbol("radix.slottable");function be(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ve}function ge(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...l)=>{const v=i(...l);return r(...l),v}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Ie(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xe(e){const t=e+"CollectionProvider",[n,o]=G(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=C=>{const{scope:u,children:g}=C,T=E.useRef(null),m=E.useRef(new Map).current;return d.jsx(r,{scope:u,itemMap:m,collectionRef:T,children:g})};a.displayName=t;const l=e+"CollectionSlot",v=L(l),p=E.forwardRef((C,u)=>{const{scope:g,children:T}=C,m=i(l,g),b=O(u,m.collectionRef);return d.jsx(v,{ref:b,children:T})});p.displayName=l;const c=e+"CollectionItemSlot",f="data-radix-collection-item",I=L(c),y=E.forwardRef((C,u)=>{const{scope:g,children:T,...m}=C,b=E.useRef(null),w=O(u,b),F=i(c,g);return E.useEffect(()=>(F.itemMap.set(b,{ref:b,...m}),()=>void F.itemMap.delete(b))),d.jsx(I,{[f]:"",ref:w,children:T})});y.displayName=c;function h(C){const u=i(e+"CollectionConsumer",C);return E.useCallback(()=>{const T=u.collectionRef.current;if(!T)return[];const m=Array.from(T.querySelectorAll(`[${f}]`));return Array.from(u.itemMap.values()).sort((F,N)=>m.indexOf(F.ref.current)-m.indexOf(N.ref.current))},[u.collectionRef,u.itemMap])}return[{Provider:a,Slot:p,ItemSlot:y},h,o]}var Ce=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_=Ce.reduce((e,t)=>{const n=L(`Primitive.${t}`),o=s.forwardRef((r,i)=>{const{asChild:a,...l}=r,v=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(v,{...l,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),D="rovingFocusGroup.onEntryFocus",Te={bubbles:!1,cancelable:!0},A="RovingFocusGroup",[k,z,Re]=xe(A),[ye,W]=G(A,[Re]),[Se,Ee]=ye(A),H=s.forwardRef((e,t)=>d.jsx(k.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(k.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(he,{...e,ref:t})})}));H.displayName=A;var he=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:v,onEntryFocus:p,preventScrollOnEntryFocus:c=!1,...f}=e,I=s.useRef(null),y=O(t,I),h=B(i),[C,u]=U({prop:a,defaultProp:l??null,onChange:v,caller:A}),[g,T]=s.useState(!1),m=fe(p),b=z(n),w=s.useRef(!1),[F,N]=s.useState(0);return s.useEffect(()=>{const x=I.current;if(x)return x.addEventListener(D,m),()=>x.removeEventListener(D,m)},[m]),d.jsx(Se,{scope:n,orientation:o,dir:h,loop:r,currentTabStopId:C,onItemFocus:s.useCallback(x=>u(x),[u]),onItemShiftTab:s.useCallback(()=>T(!0),[]),onFocusableItemAdd:s.useCallback(()=>N(x=>x+1),[]),onFocusableItemRemove:s.useCallback(()=>N(x=>x-1),[]),children:d.jsx(_.div,{tabIndex:g||F===0?-1:0,"data-orientation":o,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{w.current=!0}),onFocus:R(e.onFocus,x=>{const ie=!w.current;if(x.target===x.currentTarget&&ie&&!g){const K=new CustomEvent(D,Te);if(x.currentTarget.dispatchEvent(K),!K.defaultPrevented){const M=b().filter(S=>S.focusable),ce=M.find(S=>S.active),le=M.find(S=>S.id===C),ue=[ce,le,...M].filter(Boolean).map(S=>S.ref.current);Z(ue,c)}}w.current=!1}),onBlur:R(e.onBlur,()=>T(!1))})})}),Y="RovingFocusGroupItem",q=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:i,children:a,...l}=e,v=$(),p=i||v,c=Ee(Y,n),f=c.currentTabStopId===p,I=z(n),{onFocusableItemAdd:y,onFocusableItemRemove:h,currentTabStopId:C}=c;return s.useEffect(()=>{if(o)return y(),()=>h()},[o,y,h]),d.jsx(k.ItemSlot,{scope:n,id:p,focusable:o,active:r,children:d.jsx(_.span,{tabIndex:f?0:-1,"data-orientation":c.orientation,...l,ref:t,onMouseDown:R(e.onMouseDown,u=>{o?c.onItemFocus(p):u.preventDefault()}),onFocus:R(e.onFocus,()=>c.onItemFocus(p)),onKeyDown:R(e.onKeyDown,u=>{if(u.key==="Tab"&&u.shiftKey){c.onItemShiftTab();return}if(u.target!==u.currentTarget)return;const g=_e(u,c.orientation,c.dir);if(g!==void 0){if(u.metaKey||u.ctrlKey||u.altKey||u.shiftKey)return;u.preventDefault();let m=I().filter(b=>b.focusable).map(b=>b.ref.current);if(g==="last")m.reverse();else if(g==="prev"||g==="next"){g==="prev"&&m.reverse();const b=m.indexOf(u.currentTarget);m=c.loop?Ae(m,b+1):m.slice(b+1)}setTimeout(()=>Z(m))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:C!=null}):a})})});q.displayName=Y;var we={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Fe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _e(e,t,n){const o=Fe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return we[o]}function Z(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Ae(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Ne=H,Pe=q,j="Tabs",[je,Be]=G(j,[W]),J=W(),[Me,V]=je(j),Q=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:v="automatic",...p}=e,c=B(l),[f,I]=U({prop:o,onChange:r,defaultProp:i??"",caller:j});return d.jsx(Me,{scope:n,baseId:$(),value:f,onValueChange:I,orientation:a,dir:c,activationMode:v,children:d.jsx(_.div,{dir:c,"data-orientation":a,...p,ref:t})})});Q.displayName=j;var X="TabsList",ee=s.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,i=V(X,n),a=J(n);return d.jsx(Ne,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:o,children:d.jsx(_.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});ee.displayName=X;var te="TabsTrigger",oe=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...i}=e,a=V(te,n),l=J(n),v=se(a.baseId,o),p=ae(a.baseId,o),c=o===a.value;return d.jsx(Pe,{asChild:!0,...l,focusable:!r,active:c,children:d.jsx(_.button,{type:"button",role:"tab","aria-selected":c,"aria-controls":p,"data-state":c?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...i,ref:t,onMouseDown:R(e.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?a.onValueChange(o):f.preventDefault()}),onKeyDown:R(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(o)}),onFocus:R(e.onFocus,()=>{const f=a.activationMode!=="manual";!c&&!r&&f&&a.onValueChange(o)})})})});oe.displayName=te;var ne="TabsContent",re=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:i,...a}=e,l=V(ne,n),v=se(l.baseId,o),p=ae(l.baseId,o),c=o===l.value,f=s.useRef(c);return s.useEffect(()=>{const I=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(I)},[]),d.jsx(pe,{present:r||c,children:({present:I})=>d.jsx(_.div,{"data-state":c?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!I,id:p,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:I&&i})})});re.displayName=ne;function se(e,t){return`${e}-trigger-${t}`}function ae(e,t){return`${e}-content-${t}`}var De=Q,Oe=ee,Le=oe,ke=re;function Ue({className:e,...t}){return d.jsx(De,{"data-slot":"tabs",className:P("flex flex-col gap-2",e),...t})}function ze({className:e,...t}){return d.jsx(Oe,{"data-slot":"tabs-list",className:P("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function We({className:e,...t}){return d.jsx(Le,{"data-slot":"tabs-trigger",className:P("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer",e),...t})}function He({className:e,...t}){return d.jsx(ke,{"data-slot":"tabs-content",className:P("flex-1 outline-none",e),...t})}export{Ue as T,ze as a,We as b,He as c};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { formatChanges, sanitizeForDiff } from "../../../helpers/diffHelpers";
|
|
2
|
-
export class AbstractModel {
|
|
3
|
-
modelname;
|
|
4
|
-
attributes;
|
|
5
|
-
primaryKey;
|
|
6
|
-
identity;
|
|
7
|
-
constructor(modelname, attributes, primaryKey, identity) {
|
|
8
|
-
this.modelname = modelname;
|
|
9
|
-
this.attributes = attributes;
|
|
10
|
-
this.primaryKey = primaryKey;
|
|
11
|
-
this.identity = identity;
|
|
12
|
-
}
|
|
13
|
-
async create(data, dataAccessor) {
|
|
14
|
-
let _data = await dataAccessor.setUserRelationAccess(dataAccessor.process(data));
|
|
15
|
-
let record = await this._create(_data);
|
|
16
|
-
// console.log(record.toJSON());
|
|
17
|
-
//Create diff
|
|
18
|
-
const cleanNewRecord = sanitizeForDiff(_data);
|
|
19
|
-
const formattedChanges = formatChanges({}, {}, cleanNewRecord, 'add');
|
|
20
|
-
// log system event notification с diff
|
|
21
|
-
await dataAccessor.adminizer.logSystemCreatedEvent('Created',
|
|
22
|
-
//@ts-ignore
|
|
23
|
-
`user ${dataAccessor.user.login} create ${dataAccessor.entity.name} ${record[this.primaryKey]}`, {
|
|
24
|
-
changes: formattedChanges,
|
|
25
|
-
summary: `Created ${formattedChanges.length} fields`
|
|
26
|
-
});
|
|
27
|
-
return dataAccessor.process(record);
|
|
28
|
-
}
|
|
29
|
-
async findOne(criteria, dataAccessor) {
|
|
30
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
31
|
-
let record = await this._findOne(criteria);
|
|
32
|
-
return record ? dataAccessor.process(record) : null;
|
|
33
|
-
}
|
|
34
|
-
async find(criteria, dataAccessor) {
|
|
35
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
36
|
-
let records = await this._find(criteria);
|
|
37
|
-
return records.map(record => dataAccessor.process(record));
|
|
38
|
-
}
|
|
39
|
-
async updateOne(criteria, data, dataAccessor) {
|
|
40
|
-
let _data = dataAccessor.process(data);
|
|
41
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
42
|
-
let record = await this._updateOne(criteria, _data);
|
|
43
|
-
return record ? dataAccessor.process(record) : null;
|
|
44
|
-
}
|
|
45
|
-
async update(criteria, data, dataAccessor) {
|
|
46
|
-
let _data = dataAccessor.process(data);
|
|
47
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
48
|
-
let records = await this._update(criteria, _data);
|
|
49
|
-
return records.map(record => dataAccessor.process(record));
|
|
50
|
-
}
|
|
51
|
-
async destroyOne(criteria, dataAccessor) {
|
|
52
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
53
|
-
let record = await this._destroyOne(criteria);
|
|
54
|
-
return record ? dataAccessor.process(record) : null;
|
|
55
|
-
}
|
|
56
|
-
async destroy(criteria, dataAccessor) {
|
|
57
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
58
|
-
let records = await this._destroy(criteria);
|
|
59
|
-
return records.map(record => dataAccessor.process(record));
|
|
60
|
-
}
|
|
61
|
-
async count(criteria, dataAccessor) {
|
|
62
|
-
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
63
|
-
return this._count(criteria);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export class AbstractAdapter {
|
|
67
|
-
orm;
|
|
68
|
-
ormType;
|
|
69
|
-
constructor(type, orm) {
|
|
70
|
-
this.ormType = type;
|
|
71
|
-
this.orm = orm;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* This method must ensure system models registration and throw an error in case of errors. We force all adapters to realize it
|
|
75
|
-
*/
|
|
76
|
-
static registerSystemModels(orm) {
|
|
77
|
-
throw new Error("Function 'registerSystemModels' must be implemented by subclass");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { Adminizer } from '../../Adminizer';
|
|
3
|
-
export class AbstractNotificationService extends EventEmitter {
|
|
4
|
-
clients = new Map();
|
|
5
|
-
adminizer;
|
|
6
|
-
constructor(adminizer) {
|
|
7
|
-
super();
|
|
8
|
-
this.adminizer = adminizer;
|
|
9
|
-
}
|
|
10
|
-
// Добавление клиента
|
|
11
|
-
// TODO - Проверить, что клиент имеет права на получение уведомлений
|
|
12
|
-
addClient(clientId, sendFn) {
|
|
13
|
-
this.clients.set(clientId, sendFn);
|
|
14
|
-
Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} connected. Total: ${this.clients.size}`);
|
|
15
|
-
}
|
|
16
|
-
// Удаление клиента
|
|
17
|
-
removeClient(clientId) {
|
|
18
|
-
this.clients.delete(clientId);
|
|
19
|
-
Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} disconnected. Total: ${this.clients.size}`);
|
|
20
|
-
}
|
|
21
|
-
// abstract getNotifications(userId?: number, limit?: number, unreadOnly?: boolean): Promise<INotification[]>;
|
|
22
|
-
// Рассылка события всем клиентам
|
|
23
|
-
broadcast(event) {
|
|
24
|
-
this.clients.forEach((sendFn, clientId) => {
|
|
25
|
-
try {
|
|
26
|
-
sendFn(event);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
Adminizer.log.error(`[${this.notificationClass}] Error sending to client ${clientId}:`, error);
|
|
30
|
-
this.removeClient(clientId);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
// Отправка heartbeat
|
|
35
|
-
sendHeartbeat(clientId) {
|
|
36
|
-
const sendFn = this.clients.get(clientId);
|
|
37
|
-
if (sendFn) {
|
|
38
|
-
const heartbeatEvent = {
|
|
39
|
-
type: 'heartbeat',
|
|
40
|
-
data: 'ping'
|
|
41
|
-
};
|
|
42
|
-
sendFn(heartbeatEvent);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Генерация ID
|
|
46
|
-
generateId() {
|
|
47
|
-
return `${this.notificationClass}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
48
|
-
}
|
|
49
|
-
// Получение количества подключенных клиентов
|
|
50
|
-
getClientCount() {
|
|
51
|
-
return this.clients.size;
|
|
52
|
-
}
|
|
53
|
-
// Метод для создания записи в UserNotificationAP
|
|
54
|
-
async createUserNotification(notificationId, userId) {
|
|
55
|
-
if (this.adminizer.modelHandler.model.has('usernotificationap') && userId) {
|
|
56
|
-
try {
|
|
57
|
-
await this.adminizer.modelHandler.model.get('usernotificationap')["_create"]({
|
|
58
|
-
userId: userId,
|
|
59
|
-
notificationId: notificationId,
|
|
60
|
-
read: false
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
Adminizer.log.error(`Error creating user notification record:`, error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// Метод для получения UserNotificationAP по ID уведомления и пользователя
|
|
69
|
-
async getUserNotification(notificationId, userId) {
|
|
70
|
-
if (this.adminizer.modelHandler.model.has('usernotificationap')) {
|
|
71
|
-
try {
|
|
72
|
-
return await this.adminizer.modelHandler.model.get('usernotificationap')["_findOne"]({
|
|
73
|
-
where: { notificationId: notificationId, userId: userId }
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
Adminizer.log.error(`Error getting user notification:`, error);
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
async getNotifications(userId, limit = 50, unreadOnly = false) {
|
|
84
|
-
if (!this.adminizer.modelHandler.model.has('notificationap')) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
let query = { notificationClass: this.notificationClass };
|
|
89
|
-
// Если запрашиваются уведомления для конкретного пользователя
|
|
90
|
-
// Получаем ID уведомлений пользователя
|
|
91
|
-
const userNotifications = await this.adminizer.modelHandler.model.get('usernotificationap')["_find"]({
|
|
92
|
-
where: {
|
|
93
|
-
userId: userId
|
|
94
|
-
},
|
|
95
|
-
include: ['notificationap']
|
|
96
|
-
});
|
|
97
|
-
const notificationIds = userNotifications.map((un) => un.notificationId.id);
|
|
98
|
-
if (unreadOnly) {
|
|
99
|
-
// Только непрочитанные
|
|
100
|
-
query.id = userNotifications
|
|
101
|
-
.filter((un) => !un.read)
|
|
102
|
-
.map((un) => un.notificationId.id);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
query.id = notificationIds;
|
|
106
|
-
}
|
|
107
|
-
let notificationsDB;
|
|
108
|
-
if (query.id.length === 0)
|
|
109
|
-
return [];
|
|
110
|
-
notificationsDB = await this.adminizer.modelHandler.model.get('notificationap')["_find"]({
|
|
111
|
-
where: query,
|
|
112
|
-
sort: 'createdAt DESC',
|
|
113
|
-
limit: limit
|
|
114
|
-
});
|
|
115
|
-
let notifications = [];
|
|
116
|
-
for (const notification of notificationsDB) {
|
|
117
|
-
let readStatus = false;
|
|
118
|
-
// Получаем статус прочтения из UserNotificationAP
|
|
119
|
-
const userNotification = await this.getUserNotification(notification.id, userId);
|
|
120
|
-
readStatus = userNotification ? userNotification.read : false;
|
|
121
|
-
notifications.push({
|
|
122
|
-
...notification,
|
|
123
|
-
read: readStatus,
|
|
124
|
-
icon: {
|
|
125
|
-
icon: this.icon,
|
|
126
|
-
iconColor: this.iconColor
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return notifications;
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
Adminizer.log.error('Error fetching notifications:', error);
|
|
134
|
-
return [];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
async markAsRead(userId, id) {
|
|
138
|
-
try {
|
|
139
|
-
const userNotification = await this.getUserNotification(id, userId);
|
|
140
|
-
if (userNotification) {
|
|
141
|
-
await this.adminizer.modelHandler.model.get('usernotificationap')["_update"]({
|
|
142
|
-
id: userNotification.id
|
|
143
|
-
}, { read: true });
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
Adminizer.log.error('Error marking notification as read:', error);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { AbstractNotificationService } from "./AbstractNotificationService";
|
|
3
|
-
import { INotification } from '../../../interfaces/types';
|
|
4
|
-
export declare class NotificationHandler extends EventEmitter {
|
|
5
|
-
private services;
|
|
6
|
-
constructor();
|
|
7
|
-
/**
|
|
8
|
-
* Register a new notification service
|
|
9
|
-
* @param service
|
|
10
|
-
*/
|
|
11
|
-
registerService(service: AbstractNotificationService): void;
|
|
12
|
-
/**
|
|
13
|
-
* Remove a notification service
|
|
14
|
-
* @param notificationClass
|
|
15
|
-
*/
|
|
16
|
-
removeService(notificationClass: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Get a notification service by class
|
|
19
|
-
* @param notificationClass
|
|
20
|
-
*/
|
|
21
|
-
getService(notificationClass: string): AbstractNotificationService | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Get all registered services
|
|
24
|
-
*/
|
|
25
|
-
getAllServices(): AbstractNotificationService[];
|
|
26
|
-
/**
|
|
27
|
-
* Dispatch a notification to a service
|
|
28
|
-
* @param notificationClass
|
|
29
|
-
* @param notification
|
|
30
|
-
*/
|
|
31
|
-
dispatchNotification(notificationClass: string, notification: Omit<INotification, 'id' | 'createdAt' | 'notificationClass' | 'icon'>): Promise<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* Get notifications by class
|
|
34
|
-
* @param notificationClass
|
|
35
|
-
* @param userId
|
|
36
|
-
* @param limit
|
|
37
|
-
* @param unreadOnly
|
|
38
|
-
*/
|
|
39
|
-
getNotifications(notificationClass: string, userId?: number, limit?: number, unreadOnly?: boolean): Promise<INotification[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Get all notifications for a user
|
|
42
|
-
* @param user
|
|
43
|
-
* @param limit
|
|
44
|
-
* @param unreadOnly
|
|
45
|
-
*/
|
|
46
|
-
getUserNotifications(user: any, limit?: number, unreadOnly?: boolean): Promise<INotification[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Mark a notification as read
|
|
49
|
-
* @param notificationClass
|
|
50
|
-
* @param id
|
|
51
|
-
* @param userId
|
|
52
|
-
*/
|
|
53
|
-
markAsRead(notificationClass: string, id: string, userId: number): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Check if user is admin
|
|
56
|
-
* @param user
|
|
57
|
-
* @private
|
|
58
|
-
*/
|
|
59
|
-
private isAdmin;
|
|
60
|
-
/**
|
|
61
|
-
* Get client count for a notification class
|
|
62
|
-
* @param notificationClass
|
|
63
|
-
*/
|
|
64
|
-
getClientCount(notificationClass: string): number;
|
|
65
|
-
/**
|
|
66
|
-
* Get total client count
|
|
67
|
-
*/
|
|
68
|
-
getTotalClientCount(): number;
|
|
69
|
-
}
|