adminizer 4.3.0-build.80 → 4.3.0-build.82
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-CZdDpNV2.js +1 -0
- package/assets/add-form-BjXOLDij.js +1 -0
- package/assets/add-group-form-BNmpvW8K.js +1 -0
- package/assets/add-group-urhA47Qf.js +1 -0
- package/assets/add-user-CzWUu7wG.js +1 -0
- package/assets/{add-user-form-yp020h4r.js → add-user-form-DrclnTOd.js} +1 -1
- package/assets/{app-CpGtjhxF.css → app-CSVBI-Lw.css} +1 -1
- package/assets/app-layout-CbyH1MDK.js +1 -0
- package/assets/{app-shell-xEVbINZV.js → app-shell-CHEYhVco.js} +1 -1
- package/assets/{app-sidebar-4lm9f_CG.js → app-sidebar-DeF8WNmW.js} +1 -1
- package/assets/app-sidebar-header-8KWnVpkN.js +1 -0
- package/assets/app.js +1628 -1628
- package/assets/breadcrumbs-C439DWrC.js +1 -0
- package/assets/catalog-CCSagWKW.js +6 -0
- package/assets/dashboard-DUNXib6b.js +3 -0
- package/assets/date-picker-DbJ8nHp5.js +1 -0
- package/assets/del-modal-_b3CSNHb.js +1 -0
- package/assets/{dynamic-controls-PxBg8yMz.js → dynamic-controls-BOYmRX_z.js} +1 -1
- package/assets/{field-renderer-CsBa_tMB.css → field-renderer-CRNLShJD.css} +1 -1
- package/assets/field-renderer-D0crIeQS.js +407 -0
- package/assets/{form-CSTeMDf5.js → form-B6LFaTgS.js} +1 -1
- package/assets/form-C8pRhEOA.js +1 -0
- package/assets/geo-json-uSUIgJf5.js +4 -0
- package/assets/{handsontable-D6MvFmcM.js → handsontable-PVakPtJV.js} +55 -55
- package/assets/home-D--JrFFj.js +2 -0
- package/assets/icon-DM49pZW3.js +1 -0
- package/assets/{init-user-L-oxFTOv.js → init-user-DNrB8Xt5.js} +1 -1
- package/assets/input-error--IOnWghB.js +1 -0
- package/assets/jsoneditor-D95dIAP2.js +3878 -0
- package/assets/list-CQivvagG.js +1 -0
- package/assets/{list-table-vIvydJV2.js → list-table-h_zXp43g.js} +4 -4
- package/assets/{login-DLMJ6l_r.js → login-6Xb8bcPq.js} +1 -1
- package/assets/manifest.json +259 -260
- package/assets/material-icon-BedgD2NE.js +1 -0
- package/assets/{media-manager-ASGJ4PcS.js → media-manager-Bms57WSN.js} +2 -2
- package/assets/module-DqrIORMW.js +1 -0
- package/assets/{monaco-B1uVVM7f.js → monaco-ICtx6xoc.js} +1 -1
- package/assets/{nav-footer-DbGCtmmN.js → nav-footer-BwkQkwow.js} +1 -1
- package/assets/{nav-main-BcWhl71g.js → nav-main-9Eb_A0rf.js} +1 -1
- package/assets/nav-user-CRAfyE-x.js +1 -0
- package/assets/notification-db0RD9I6.js +27 -0
- package/assets/{pagination-render-BceTnewI.js → pagination-render-D3UyVAlr.js} +1 -1
- package/assets/{register-C_W_hOmq.js → register-BIyjCy8M.js} +1 -1
- package/assets/tabs-BK_5wdPA.js +1 -0
- package/assets/theme-switcher-CKiJbMkh.js +1 -0
- package/assets/toast-editor-BZM5RHph.js +845 -0
- package/assets/{user-info-BrWerGLc.js → user-info-CcYdmjMZ.js} +1 -1
- package/assets/{user-menu-content-D61_auxX.js → user-menu-content-DbUk8ZeY.js} +1 -1
- package/assets/vanilla-picker-l5rcX3cq.js +8 -0
- package/assets/{vendor-DoC2WAmd.js → vendor-wzZzN_Jv.js} +2 -2
- package/assets/welcome-CZlWN4gM.js +1 -0
- 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 +2 -4
- package/lib/{v4/model → model}/adapter/sequelize.js +33 -13
- 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/umzug/0001.d.ts +7 -0
- package/migrations/umzug/0001.js +119 -0
- package/migrations/umzug.d.ts +2 -0
- package/migrations/umzug.js +8 -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-form-C04ZI5LT.js +0 -1
- package/assets/add-group-DWR7SBTO.js +0 -1
- package/assets/add-group-form-CyRwxTs3.js +0 -1
- package/assets/add-user-acATGxUL.js +0 -1
- package/assets/app-layout-BmT5KQwc.js +0 -1
- package/assets/app-sidebar-header-CxXmzszq.js +0 -1
- package/assets/breadcrumbs-livOfa2Z.js +0 -1
- package/assets/catalog-CG_EB2kz.js +0 -6
- package/assets/dashboard-CsmJfdLb.js +0 -3
- package/assets/date-picker-By3kj-Rx.js +0 -1
- package/assets/del-modal-DlcbcdR5.js +0 -1
- package/assets/field-renderer-Bp1lfm0v.js +0 -407
- package/assets/form-CxHRGp7p.js +0 -1
- package/assets/geo-json-CCgjEQfu.js +0 -4
- package/assets/home-D00XjLjD.js +0 -2
- package/assets/icon-ButfCBrt.js +0 -1
- package/assets/input-error-CHsDLcK0.js +0 -1
- package/assets/jsoneditor-CBqATVR0.js +0 -3833
- package/assets/list-4TOTsjqE.js +0 -1
- package/assets/material-icon-sXk4BK-N.js +0 -1
- package/assets/module-mxngd2cA.js +0 -1
- package/assets/nav-user-BN2veV3l.js +0 -1
- package/assets/notification-BEfA5sT6.js +0 -1
- package/assets/tabs-CgZW_LLn.js +0 -1
- package/assets/theme-switcher-D1G6OSMc.js +0 -1
- package/assets/toast-editor-CfgZXoQZ.js +0 -845
- package/assets/vanilla-picker-B6E6ObS_.js +0 -8
- package/assets/welcome-FHRCdke0.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/migrations/db-migrate/20230303171134-adminpanel-init.js +0 -122
- package/migrations/db-migrate/20231223215835-add-widgets.js +0 -32
- package/migrations/db-migrate/20240804191001-added-navigationap.js +0 -53
- package/migrations/db-migrate/20241121184236-v4-init.js +0 -134
- /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
|
@@ -3,8 +3,8 @@ import { InfoBase } from "./abstractInfo";
|
|
|
3
3
|
import { ActionBase } from "./abstractAction";
|
|
4
4
|
import { LinkBase } from "./abstractLink";
|
|
5
5
|
import { CustomBase } from "./abstractCustom";
|
|
6
|
-
import { AdminpanelIcon } from "
|
|
7
|
-
import { Adminizer } from "
|
|
6
|
+
import { AdminpanelIcon } from "../../interfaces/adminpanelConfig";
|
|
7
|
+
import { Adminizer } from "../Adminizer";
|
|
8
8
|
import { UserAP } from "models/UserAP";
|
|
9
9
|
import { I18n } from "../I18n";
|
|
10
10
|
export type WidgetType = (SwitchBase | InfoBase | ActionBase | LinkBase | CustomBase);
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { DataTypes } from "sequelize";
|
|
2
|
+
// Creates all system model tables according to src/models/* and
|
|
3
|
+
// SequelizeAdapter.generateSequelizeModel naming: tableName = modelName.toLowerCase()
|
|
4
|
+
// Associations:
|
|
5
|
+
// - UserAP <-> GroupAP: M:N via through table "groupapuserap" (UserAPId, GroupAPId)
|
|
6
|
+
// - MediaManagerAP.parent -> MediaManagerAP (parentId)
|
|
7
|
+
// - MediaManagerAP hasMany MediaManagerMetaAP via parent (MediaManagerMetaAP.parentId)
|
|
8
|
+
// - MediaManagerAP hasMany MediaManagerAssociationsAP via file (MediaManagerAssociationsAP.fileId)
|
|
9
|
+
// - UserNotificationAP belongsTo NotificationAP via alias "notificationId" -> FK column "notificationIdId"
|
|
10
|
+
export async function up({ context }) {
|
|
11
|
+
// userap
|
|
12
|
+
await context.createTable("userap", {
|
|
13
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
14
|
+
login: { type: DataTypes.STRING, unique: true },
|
|
15
|
+
fullName: { type: DataTypes.STRING },
|
|
16
|
+
email: { type: DataTypes.STRING },
|
|
17
|
+
avatar: { type: DataTypes.STRING },
|
|
18
|
+
passwordHashed: { type: DataTypes.STRING },
|
|
19
|
+
timezone: { type: DataTypes.STRING },
|
|
20
|
+
expires: { type: DataTypes.STRING },
|
|
21
|
+
locale: { type: DataTypes.STRING },
|
|
22
|
+
isDeleted: { type: DataTypes.BOOLEAN },
|
|
23
|
+
isActive: { type: DataTypes.BOOLEAN },
|
|
24
|
+
isAdministrator: { type: DataTypes.BOOLEAN },
|
|
25
|
+
widgets: { type: DataTypes.JSON },
|
|
26
|
+
isConfirmed: { type: DataTypes.BOOLEAN },
|
|
27
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
28
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
29
|
+
});
|
|
30
|
+
// groupap
|
|
31
|
+
await context.createTable("groupap", {
|
|
32
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
33
|
+
name: { type: DataTypes.STRING, unique: true },
|
|
34
|
+
description: { type: DataTypes.STRING },
|
|
35
|
+
tokens: { type: DataTypes.JSON },
|
|
36
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
37
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
38
|
+
});
|
|
39
|
+
// mediamanagerap (self-ref via parentId)
|
|
40
|
+
await context.createTable("mediamanagerap", {
|
|
41
|
+
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
42
|
+
parentId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
43
|
+
mimeType: { type: DataTypes.STRING },
|
|
44
|
+
path: { type: DataTypes.STRING },
|
|
45
|
+
size: { type: DataTypes.INTEGER },
|
|
46
|
+
group: { type: DataTypes.STRING },
|
|
47
|
+
tag: { type: DataTypes.STRING },
|
|
48
|
+
url: { type: DataTypes.STRING },
|
|
49
|
+
filename: { type: DataTypes.STRING },
|
|
50
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
51
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
52
|
+
});
|
|
53
|
+
// mediamanagermetaap (belongsTo mediamanagerap via parentId)
|
|
54
|
+
await context.createTable("mediamanagermetaap", {
|
|
55
|
+
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
56
|
+
key: { type: DataTypes.STRING },
|
|
57
|
+
value: { type: DataTypes.JSON },
|
|
58
|
+
isPublic: { type: DataTypes.BOOLEAN },
|
|
59
|
+
parentId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
60
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
61
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
62
|
+
});
|
|
63
|
+
// mediamanagerassociationsap (belongsTo mediamanagerap via fileId)
|
|
64
|
+
await context.createTable("mediamanagerassociationsap", {
|
|
65
|
+
id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, allowNull: false },
|
|
66
|
+
mediaManagerId: { type: DataTypes.STRING },
|
|
67
|
+
model: { type: DataTypes.JSON },
|
|
68
|
+
modelId: { type: DataTypes.JSON },
|
|
69
|
+
widgetName: { type: DataTypes.STRING },
|
|
70
|
+
sortOrder: { type: DataTypes.INTEGER },
|
|
71
|
+
fileId: { type: DataTypes.UUID, allowNull: true, references: { model: "mediamanagerap", key: "id" } },
|
|
72
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
73
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
74
|
+
});
|
|
75
|
+
// notificationap
|
|
76
|
+
await context.createTable("notificationap", {
|
|
77
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
78
|
+
title: { type: DataTypes.STRING },
|
|
79
|
+
message: { type: DataTypes.STRING },
|
|
80
|
+
notificationClass: { type: DataTypes.STRING },
|
|
81
|
+
channel: { type: DataTypes.STRING },
|
|
82
|
+
metadata: { type: DataTypes.JSON },
|
|
83
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
84
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
85
|
+
});
|
|
86
|
+
// usernotificationap (FK to notificationap via column notificationIdId)
|
|
87
|
+
await context.createTable("usernotificationap", {
|
|
88
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
89
|
+
userId: { type: DataTypes.INTEGER },
|
|
90
|
+
notificationIdId: { type: DataTypes.INTEGER, allowNull: true, references: { model: "notificationap", key: "id" } },
|
|
91
|
+
read: { type: DataTypes.BOOLEAN },
|
|
92
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
93
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
94
|
+
});
|
|
95
|
+
// navigationap
|
|
96
|
+
await context.createTable("navigationap", {
|
|
97
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, allowNull: false },
|
|
98
|
+
label: { type: DataTypes.STRING, unique: true },
|
|
99
|
+
tree: { type: DataTypes.JSON },
|
|
100
|
+
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
101
|
+
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
|
|
102
|
+
});
|
|
103
|
+
// M:N join: GroupAP <-> UserAP via "groupapuserap"
|
|
104
|
+
await context.createTable("groupapuserap", {
|
|
105
|
+
UserAPId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "userap", key: "id" } },
|
|
106
|
+
GroupAPId: { type: DataTypes.INTEGER, allowNull: false, references: { model: "groupap", key: "id" } },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export async function down({ context }) {
|
|
110
|
+
await context.dropTable("groupapuserap");
|
|
111
|
+
await context.dropTable("usernotificationap");
|
|
112
|
+
await context.dropTable("mediamanagermetaap");
|
|
113
|
+
await context.dropTable("mediamanagerassociationsap");
|
|
114
|
+
await context.dropTable("mediamanagerap");
|
|
115
|
+
await context.dropTable("navigationap");
|
|
116
|
+
await context.dropTable("notificationap");
|
|
117
|
+
await context.dropTable("groupap");
|
|
118
|
+
await context.dropTable("userap");
|
|
119
|
+
}
|
|
@@ -20,6 +20,14 @@ declare const _default: {
|
|
|
20
20
|
metadata: {
|
|
21
21
|
type: string;
|
|
22
22
|
};
|
|
23
|
+
createdAt: {
|
|
24
|
+
type: string;
|
|
25
|
+
autoCreatedAt: boolean;
|
|
26
|
+
};
|
|
27
|
+
updatedAt: {
|
|
28
|
+
type: string;
|
|
29
|
+
autoUpdatedAt: boolean;
|
|
30
|
+
};
|
|
23
31
|
};
|
|
24
32
|
export default _default;
|
|
25
33
|
export interface NotificationAP {
|
package/models/NotificationAP.js
CHANGED
package/models/UserAP.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adminizer",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.3.0-build.
|
|
4
|
+
"version": "4.3.0-build.82",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"dev:no-seed": "cross-env VITE_ENV=dev NO_SEED_DATA=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
16
16
|
"dev:no-seed-clean": "cross-env VITE_ENV=dev NO_SEED_DATA=true CLEAN_TMP=true ORM=sequelize tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
17
17
|
"dev:waterline": "cross-env VITE_ENV=dev ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
18
|
+
"dev:waterline:no-seed": "cross-env VITE_ENV=dev NO_SEED_DATA=true ORM=waterline tsx watch --tsconfig ./fixture/tsconfig.json ./fixture/index.ts",
|
|
18
19
|
"build:assets": "vite build",
|
|
19
20
|
"compile:backend": "tsc -p src/tsconfig.json",
|
|
20
21
|
"compile:ui": "tsc -p tsconfig.ui.json",
|
|
@@ -67,12 +68,11 @@
|
|
|
67
68
|
"react-dnd": "^16.0.1",
|
|
68
69
|
"reflect-metadata": "^0.2.2",
|
|
69
70
|
"sharp": "^0.33.5",
|
|
71
|
+
"sprintf-js": "^1.1.3",
|
|
70
72
|
"typeorm": "^0.3.20",
|
|
71
73
|
"uuid": "^11.0.5",
|
|
72
74
|
"waterline": "^0.15.2",
|
|
73
|
-
"winston": "^3.17.0"
|
|
74
|
-
"sprintf-js": "^1.1.3",
|
|
75
|
-
"sequelize": "^6.37.7"
|
|
75
|
+
"winston": "^3.17.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/plugin-proposal-decorators": "^7.27.1",
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
"sails-disk": "^2.1.2",
|
|
148
148
|
"sails-postgresql": "^5.0.1",
|
|
149
149
|
"sequelize-typescript": "^2.1.6",
|
|
150
|
+
"sequelize": "^6.37.7",
|
|
150
151
|
"shelljs": "^0.9.2",
|
|
151
152
|
"sonner": "^2.0.3",
|
|
152
153
|
"sqlite3": "^5.1.7",
|
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{V,bv as S,j as s,B as E,U as _,aC as z,bw as R,L as k,bx as $,f as A,a as L,l as P,H as D,J,K as U,aD as H,M as K,g as q}from"./app.js";import{r as p}from"./monaco-B1uVVM7f.js";import{Icon as M}from"./icon-ButfCBrt.js";import{F as O}from"./field-renderer-Bp1lfm0v.js";import T from"./input-error-CHsDLcK0.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./handsontable-D6MvFmcM.js";import"./dynamic-controls-PxBg8yMz.js";var F=new Map,N=new WeakMap,B=0,G=void 0;function Q(e){return e?(N.has(e)||(B+=1,N.set(e,B.toString())),N.get(e)):"0"}function X(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?Q(e.root):e[t]}`).toString()}function Y(e){const t=X(e);let a=F.get(t);if(!a){const i=new Map;let d;const c=new IntersectionObserver(o=>{o.forEach(n=>{var l;const f=n.isIntersecting&&d.some(u=>n.intersectionRatio>=u);e.trackVisibility&&typeof n.isVisible>"u"&&(n.isVisible=f),(l=i.get(n.target))==null||l.forEach(u=>{u(f,n)})})},e);d=c.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),a={id:t,observer:c,elements:i},F.set(t,a)}return a}function Z(e,t,a={},i=G){if(typeof window.IntersectionObserver>"u"&&i!==void 0){const l=e.getBoundingClientRect();return t(i,{isIntersecting:i,target:e,intersectionRatio:typeof a.threshold=="number"?a.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:d,observer:c,elements:o}=Y(a),n=o.get(e)||[];return o.has(e)||o.set(e,n),n.push(t),c.observe(e),function(){n.splice(n.indexOf(t),1),n.length===0&&(o.delete(e),c.unobserve(e)),o.size===0&&(c.disconnect(),F.delete(d))}}function W({threshold:e,delay:t,trackVisibility:a,rootMargin:i,root:d,triggerOnce:c,skip:o,initialInView:n,fallbackInView:l,onChange:f}={}){var u;const[j,C]=p.useState(null),m=p.useRef(f),[h,y]=p.useState({inView:!!n,entry:void 0});m.current=f,p.useEffect(()=>{if(o||!j)return;let g;return g=Z(j,(r,v)=>{y({inView:r,entry:v}),m.current&&m.current(r,v),v.isIntersecting&&c&&g&&(g(),g=void 0)},{root:d,rootMargin:i,threshold:e,trackVisibility:a,delay:t},l),()=>{g&&g()}},[Array.isArray(e)?e.toString():e,j,d,i,c,o,a,l,t]);const b=(u=h.entry)==null?void 0:u.target,w=p.useRef(void 0);!j&&b&&!c&&!o&&w.current!==b&&(w.current=b,y({inView:!!n,entry:void 0}));const x=[C,h.inView,h.entry];return x.ref=x[0],x.inView=x[1],x.entry=x[2],x}const I=p.memo(({field:e})=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(L,{htmlFor:`${e.type}-${e.name}`,children:e.label}),e.tooltip&&s.jsx(D,{children:s.jsxs(J,{children:[s.jsx(U,{onClick:t=>t.preventDefault(),children:s.jsx(M,{iconNode:H,className:"text-primary w-5 h-5 cursor-pointer"})}),s.jsx(K,{align:"center",side:"top",className:"z-[1002]",children:s.jsx("p",{children:e.tooltip})})]})})]})),ee=p.memo(({field:e,value:t,onChange:a,processing:i,notFound:d,search:c})=>{const[o,n]=W({triggerOnce:!0,rootMargin:"100px 0px"});return s.jsx("div",{ref:o,className:"grid gap-4 w-full",children:n?s.jsx(O,{field:e,value:t,onChange:a,notFound:d,search:c,processing:i}):s.jsx(P,{className:"w-full h-[250px] rounded-sm"})})}),de=({page:e,catalog:t,callback:a,openNewWindow:i,openNewWindowLabel:d,isNavigation:c})=>{const{fields:o,btnBack:n,view:l,notFound:f}=e.props,{data:u,setData:j,post:C,processing:m}=V({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),[h,y]=p.useState(!1),[b,w]=p.useState(i??!1);p.useEffect(()=>(w(i??!1),S(),j({...Object.fromEntries(o.map(r=>[r.name,r.value??void 0])),jsonPopupCatalog:t}),()=>S()),[o,t,i]);const x=p.useCallback((r,v)=>{j(r,v)},[]),g=async r=>{if(r.preventDefault(),t){y(!0);const v=await q.post(e.props.postLink,u);v.status===200&&a&&(c?a(v.data.record,b):a(v.data.record))}else C(e.props.postLink)};return s.jsxs("div",{className:"p-4 w-full",children:[!t&&s.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[s.jsx(E,{className:"w-fit",asChild:!0,children:s.jsxs(_,{href:n.link,preserveScroll:!0,children:[s.jsx(M,{iconNode:z}),n.title]})}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit lg:hidden",form:"addUserForm",disabled:h||m||e.props.view||R(),children:[h||m&&s.jsx(k,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]}),s.jsx("form",{id:"addUserForm",onSubmit:g,className:l?"cursor-not-allowed":"",children:s.jsxs("div",{className:`grid lg:grid-cols-[1fr_150px] gap-4 max-w-[1144px] pb-8 ${t?"lg:grid-cols-[1fr_200px]":"lg:grid-cols-[1fr_150px]"}`,children:[s.jsx("div",{className:"flex flex-col gap-10",children:o.map(r=>s.jsx("div",{className:`grid gap-4 w-full ${l?"pointer-events-none":""}`,children:r.type==="markdown"||r.type==="table"||r.type==="jsonEditor"||r.type==="codeEditor"||r.type==="geoJson"?s.jsxs(s.Fragment,{children:[s.jsx(I,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(ee,{field:r,value:u[r.name],onChange:x,processing:h||m||l,notFound:f,search:e.props.search})]}):s.jsxs(s.Fragment,{children:[s.jsx(I,{field:r}),s.jsx(T,{message:$(`${r.type}-${r.name}`)}),s.jsx(O,{field:r,value:u[r.name],onChange:x,processing:h||m||l,notFound:f,search:e.props.search})]})},r.name))}),s.jsxs("div",{className:`p-4 rounded-md h-fit sticky shadow ${t?"top-0 grid gap-4":"top-[84px] hidden lg:block"}`,children:[c&&s.jsxs("div",{className:"flex gap-4 items-center",children:[s.jsx(A,{id:"targetBlank",checked:b,onCheckedChange:r=>w(!!r),className:"cursor-pointer size-5"}),s.jsx(L,{htmlFor:"targetBlank",children:d})]}),s.jsxs(E,{variant:"green",type:"submit",className:"w-fit",disabled:h||m||e.props.view||R(),children:[(h||m)&&s.jsx(k,{className:"h-4 w-4 animate-spin"}),e.props.btnSave.title]})]})]})})]})};export{I as LabelRenderer,ee as LazyField,de 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{q as B,V as q,j as e,B as T,U as M,aC as O,L as S,a as x,I as y,f as U,H as z,J as H,K as J,aD as A,M as G}from"./app.js";import{Icon as I}from"./icon-ButfCBrt.js";import{r as h}from"./monaco-B1uVVM7f.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./handsontable-D6MvFmcM.js";const E=h.memo(({field:s,disabled:c,value:d,onCheckedChange:i,tooltip:n})=>{const m=h.useCallback(l=>{i(s.name,l)},[s.name,i]);return e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(U,{id:s.name,className:"cursor-pointer size-5",disabled:c,checked:d,onCheckedChange:m}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(x,{className:"cursor-pointer",htmlFor:s.name,children:s.label}),n&&e.jsx(z,{children:e.jsxs(H,{children:[e.jsx(J,{onClick:l=>l.preventDefault(),children:e.jsx(I,{iconNode:A,className:"text-primary w-5 h-5 cursor-pointer"})}),e.jsx(G,{align:"center",side:"top",children:e.jsx("p",{children:s.tooltip})})]})})]})]})});function W(){var u,j,g,b,v,f,N,C,k,w,F;const s=B(),{fields:c,groupedTokens:d,users:i}=s.props,{data:n,setData:m,clearErrors:l,post:D,processing:o}=q({...Object.fromEntries(c.map(a=>[a.name,a.value])),...Object.fromEntries(i.map(a=>[a.name,a.value])),...Object.fromEntries(d.flatMap(a=>a.fields.map(t=>[t.name,t.value])))}),r=a=>s.props.fields.find(t=>t.name===a),p=h.useCallback((a,t)=>{l(),m(a,t)},[]),L=a=>{a.preventDefault(),D(s.props.postLink)};return e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[e.jsx(T,{className:"mb-3 w-fit",asChild:!0,children:e.jsxs(M,{href:s.props.btnBack.link,children:[e.jsx(I,{iconNode:O}),s.props.btnBack.title]})}),e.jsxs(T,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:o||s.props.view,children:[o&&e.jsx(S,{className:"h-4 w-4 animate-spin"}),s.props.btnSave.title]})]}),e.jsx("form",{id:"addUserForm",onSubmit:L,className:`${s.props.view?"cursor-not-allowed":""}`,children:e.jsxs("div",{className:"flex flex-col gap-6 max-w-[1144px]",children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.head}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(x,{htmlFor:(u=r("name"))==null?void 0:u.name,children:(j=r("name"))==null?void 0:j.label}),e.jsx(y,{id:(g=r("name"))==null?void 0:g.name,type:"text",required:!0,tabIndex:1,autoComplete:(b=r("name"))==null?void 0:b.name,value:n.name,onChange:a=>p("name",a.target.value),disabled:o||s.props.view,placeholder:(v=r("name"))==null?void 0:v.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(x,{htmlFor:(f=r("description"))==null?void 0:f.name,children:(N=r("description"))==null?void 0:N.label}),e.jsx(y,{id:(C=r("description"))==null?void 0:C.name,type:"text",required:!0,tabIndex:1,autoComplete:(k=r("description"))==null?void 0:k.name,value:n.description,onChange:a=>p("description",a.target.value),disabled:o||s.props.view,placeholder:(w=r("description"))==null?void 0:w.label})]}),s.props.users.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.userHead}),s.props.users.map(a=>e.jsx(E,{field:a,disabled:o||s.props.view,value:n[a.name],onCheckedChange:p},a.name))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 xl:grid-cols-4 gap-4",children:((F=s.props.groupedTokens)==null?void 0:F.length)>0&&s.props.groupedTokens.map(a=>e.jsxs("div",{className:"grid gap-4 content-start justify-between",children:[e.jsx("h2",{className:"font-bold text-xl mt-3",children:a.header}),a.fields.map(t=>e.jsx(E,{field:t,disabled:o||s.props.view,value:n[t.name],onCheckedChange:p,tooltip:!0},t.name))]},a.header))})]})})]})}export{W 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{q as i,j as r,R as p,ac as m}from"./app.js";import n from"./app-shell-xEVbINZV.js";import{AppSidebar as x}from"./app-sidebar-4lm9f_CG.js";import{A as d,N as j}from"./app-sidebar-header-CxXmzszq.js";import{r as a}from"./monaco-B1uVVM7f.js";const c=a.memo(({children:s,breadcrumbs:t=[],className:e})=>{const o=i();return r.jsxs(n,{variant:"sidebar",children:[r.jsx(p,{title:o.props.title}),r.jsx(x,{}),r.jsxs(m,{className:e,children:[r.jsx(d,{breadcrumbs:t}),s]})]})}),S=a.memo(({children:s,className:t,breadcrumbs:e,...o})=>r.jsx(j,{children:r.jsx(c,{breadcrumbs:e,className:t,...o,children:s})}));export{S as A};
|
|
@@ -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,b5 as i,b6 as n,b7 as c,b8 as m,b9 as d,U as h,ba as l}from"./app.js";import{r as o}from"./monaco-B1uVVM7f.js";import"./jsoneditor-CBqATVR0.js";import"./vendor-DoC2WAmd.js";import"./handsontable-D6MvFmcM.js";function B({breadcrumbs:e}){return r.jsx(r.Fragment,{children:e.length>0&&r.jsx(i,{children:r.jsx(n,{children:e.map((s,t)=>{const a=t===e.length-1;return r.jsxs(o.Fragment,{children:[r.jsx(c,{children:a?r.jsx(m,{children:s.title}):r.jsx(d,{asChild:!0,children:r.jsx(h,{href:s.href,children:s.title})})}),!a&&r.jsx(l,{})]},t)})})})})}export{B as Breadcrumbs};
|