underpost 2.6.3 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +13 -13
- package/.env.development +7 -7
- package/.env.production +7 -7
- package/.env.test +7 -7
- package/.github/workflows/publish.yml +26 -0
- package/.nycrc +9 -9
- package/.prettierignore +12 -12
- package/.prettierrc +9 -9
- package/.vscode/extensions.json +72 -72
- package/.vscode/settings.json +100 -99
- package/AUTHORS.md +10 -0
- package/CHANGELOG.md +91 -0
- package/Dockerfile +89 -89
- package/LICENSE +21 -21
- package/README.md +96 -96
- package/bin/db.js +172 -119
- package/bin/deploy.js +582 -626
- package/bin/dns.js +1 -1
- package/bin/file.js +92 -92
- package/bin/index.js +53 -34
- package/bin/install.js +398 -357
- package/bin/shortcut.js +44 -44
- package/bin/ssl.js +65 -61
- package/bin/util.js +182 -182
- package/bin/vs.js +35 -35
- package/conf.js +251 -249
- package/docker-compose.yml +67 -67
- package/jsconfig.json +7 -7
- package/jsdoc.json +32 -32
- package/nodemon.json +6 -6
- package/package.json +137 -128
- package/prometheus.yml +36 -36
- package/setup.sh +24 -24
- package/src/api/core/core.controller.js +69 -69
- package/src/api/core/core.model.js +11 -11
- package/src/api/core/core.router.js +23 -23
- package/src/api/core/core.service.js +29 -29
- package/src/api/crypto/crypto.controller.js +51 -51
- package/src/api/crypto/crypto.model.js +23 -23
- package/src/api/crypto/crypto.router.js +20 -20
- package/src/api/crypto/crypto.service.js +64 -64
- package/src/api/default/default.controller.js +69 -69
- package/src/api/default/default.model.js +20 -20
- package/src/api/default/default.router.js +23 -23
- package/src/api/default/default.service.js +31 -31
- package/src/api/file/file.controller.js +53 -51
- package/src/api/file/file.model.js +19 -19
- package/src/api/file/file.router.js +21 -20
- package/src/api/file/file.service.js +76 -70
- package/src/api/instance/instance.controller.js +69 -69
- package/src/api/instance/instance.model.js +36 -36
- package/src/api/instance/instance.router.js +33 -33
- package/src/api/instance/instance.service.js +48 -48
- package/src/api/test/test.controller.js +59 -59
- package/src/api/test/test.model.js +14 -14
- package/src/api/test/test.router.js +21 -21
- package/src/api/test/test.service.js +35 -35
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +70 -70
- package/src/api/user/user.model.js +65 -65
- package/src/api/user/user.router.js +345 -345
- package/src/api/user/user.service.js +479 -479
- package/src/api.js +23 -23
- package/src/client/Default.index.js +40 -40
- package/src/client/components/core/Account.js +290 -290
- package/src/client/components/core/AgGrid.js +160 -160
- package/src/client/components/core/Auth.js +19 -19
- package/src/client/components/core/Badge.js +32 -32
- package/src/client/components/core/BlockChain.js +41 -41
- package/src/client/components/core/Blog.js +9 -9
- package/src/client/components/core/BtnIcon.js +101 -94
- package/src/client/components/core/CalendarCore.js +458 -319
- package/src/client/components/core/Chat.js +64 -64
- package/src/client/components/core/ColorPalette.js +5267 -5267
- package/src/client/components/core/CommonJs.js +735 -732
- package/src/client/components/core/Content.js +193 -49
- package/src/client/components/core/Css.js +1064 -1027
- package/src/client/components/core/CssCore.js +817 -796
- package/src/client/components/core/D3Chart.js +44 -44
- package/src/client/components/core/Docs.js +229 -229
- package/src/client/components/core/DropDown.js +164 -164
- package/src/client/components/core/EventsUI.js +46 -54
- package/src/client/components/core/FileExplorer.js +699 -624
- package/src/client/components/core/FullScreen.js +45 -45
- package/src/client/components/core/Input.js +346 -259
- package/src/client/components/core/JoyStick.js +77 -77
- package/src/client/components/core/Keyboard.js +73 -73
- package/src/client/components/core/LoadingAnimation.js +179 -157
- package/src/client/components/core/LogIn.js +187 -181
- package/src/client/components/core/LogOut.js +58 -52
- package/src/client/components/core/Logger.js +26 -26
- package/src/client/components/core/Modal.js +1612 -1596
- package/src/client/components/core/NotificationManager.js +84 -84
- package/src/client/components/core/Panel.js +613 -413
- package/src/client/components/core/PanelForm.js +468 -0
- package/src/client/components/core/Polyhedron.js +162 -162
- package/src/client/components/core/Recover.js +204 -204
- package/src/client/components/core/Responsive.js +53 -53
- package/src/client/components/core/RichText.js +51 -27
- package/src/client/components/core/Router.js +76 -77
- package/src/client/components/core/Scroll.js +34 -0
- package/src/client/components/core/SignUp.js +125 -125
- package/src/client/components/core/SocketIo.js +72 -72
- package/src/client/components/core/Stream.js +113 -113
- package/src/client/components/core/ToggleSwitch.js +87 -87
- package/src/client/components/core/ToolTip.js +26 -26
- package/src/client/components/core/Translate.js +437 -408
- package/src/client/components/core/Validator.js +100 -100
- package/src/client/components/core/VanillaJs.js +460 -457
- package/src/client/components/core/Wallet.js +106 -106
- package/src/client/components/core/Webhook.js +25 -25
- package/src/client/components/core/Worker.js +272 -272
- package/src/client/components/default/CommonDefault.js +29 -29
- package/src/client/components/default/CssDefault.js +13 -13
- package/src/client/components/default/ElementsDefault.js +38 -38
- package/src/client/components/default/LogInDefault.js +41 -41
- package/src/client/components/default/LogOutDefault.js +28 -28
- package/src/client/components/default/MenuDefault.js +389 -389
- package/src/client/components/default/RoutesDefault.js +48 -48
- package/src/client/components/default/SettingsDefault.js +16 -16
- package/src/client/components/default/SignUpDefault.js +9 -9
- package/src/client/components/default/SocketIoDefault.js +54 -54
- package/src/client/components/default/TranslateDefault.js +7 -7
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +11 -11
- package/src/client/public/default/manifest.webmanifest +68 -68
- package/src/client/public/default/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/sitemap +147 -147
- package/src/client/public/default/yandex-browser-manifest.json +8 -8
- package/src/client/public/doc/sitemap +147 -147
- package/src/client/public/test/sitemap +147 -147
- package/src/client/services/core/core.service.js +170 -152
- package/src/client/services/crypto/crypto.service.js +70 -70
- package/src/client/services/default/default.management.js +345 -345
- package/src/client/services/default/default.service.js +89 -89
- package/src/client/services/file/file.service.js +70 -70
- package/src/client/services/instance/instance.management.js +74 -74
- package/src/client/services/instance/instance.service.js +89 -89
- package/src/client/services/test/test.service.js +70 -70
- package/src/client/services/user/user.management.js +50 -50
- package/src/client/services/user/user.service.js +89 -89
- package/src/client/ssr/Render.js +16 -16
- package/src/client/ssr/body-components/CacheControl.js +114 -113
- package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -79
- package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -21
- package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -17
- package/src/client/ssr/head-components/Css.js +241 -241
- package/src/client/ssr/head-components/DefaultScripts.js +3 -3
- package/src/client/ssr/head-components/Microdata.js +11 -11
- package/src/client/ssr/head-components/Production.js +1 -1
- package/src/client/ssr/head-components/PwaDefault.js +59 -59
- package/src/client/ssr/head-components/Seo.js +14 -14
- package/src/client/sw/default.sw.js +201 -201
- package/src/client/sw/template.sw.js +84 -84
- package/src/client.build.js +22 -22
- package/src/client.dev.js +21 -21
- package/src/cron.js +25 -25
- package/src/db/DataBaseProvider.js +34 -34
- package/src/db/mariadb/MariaDB.js +33 -33
- package/src/db/mongo/MongooseDB.js +46 -46
- package/src/dns.js +22 -22
- package/src/index.js +42 -0
- package/src/mailer/EmailRender.js +69 -69
- package/src/mailer/MailerProvider.js +96 -96
- package/src/proxy.js +22 -22
- package/src/runtime/lampp/Lampp.js +69 -44
- package/src/runtime/nginx/Nginx.js +3 -3
- package/src/runtime/xampp/Xampp.js +49 -49
- package/src/server/auth.js +235 -204
- package/src/server/backup.js +101 -84
- package/src/server/client-build-live.js +72 -72
- package/src/server/client-build.js +705 -699
- package/src/server/client-dev-server.js +60 -58
- package/src/server/client-formatted.js +48 -48
- package/src/server/client-icons.js +149 -150
- package/src/server/conf.js +860 -611
- package/src/server/dns.js +98 -87
- package/src/server/downloader.js +42 -42
- package/src/server/logger.js +180 -135
- package/src/server/network.js +122 -122
- package/src/server/peer.js +33 -33
- package/src/server/process.js +66 -66
- package/src/server/prompt-optimizer.js +28 -0
- package/src/server/proxy.js +118 -118
- package/src/server/runtime.js +444 -393
- package/src/server/ssl.js +109 -107
- package/src/server.js +25 -25
- package/src/ws/IoInterface.js +45 -45
- package/src/ws/IoServer.js +39 -39
- package/src/ws/core/channels/core.ws.chat.js +23 -23
- package/src/ws/core/channels/core.ws.mailer.js +35 -35
- package/src/ws/core/channels/core.ws.stream.js +31 -31
- package/src/ws/core/core.ws.connection.js +28 -28
- package/src/ws/core/core.ws.emit.js +14 -14
- package/src/ws/core/core.ws.server.js +24 -24
- package/src/ws/core/management/core.ws.chat.js +8 -8
- package/src/ws/core/management/core.ws.mailer.js +16 -16
- package/src/ws/core/management/core.ws.stream.js +8 -8
- package/src/ws/default/channels/default.ws.main.js +16 -16
- package/src/ws/default/default.ws.connection.js +22 -22
- package/src/ws/default/default.ws.emit.js +14 -14
- package/src/ws/default/default.ws.server.js +20 -20
- package/src/ws/default/management/default.ws.main.js +8 -8
- package/startup.js +11 -11
- package/supervisord-openssh-server.conf +4 -4
- package/test/api.test.js +60 -60
- package/bin/help.js +0 -110
|
@@ -1,319 +1,458 @@
|
|
|
1
|
-
import { EventSchedulerService } from '../../services/event-scheduler/event-scheduler.service.js';
|
|
2
|
-
import { Auth } from './Auth.js';
|
|
3
|
-
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
-
import { range, s4 } from './CommonJs.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
1
|
+
import { EventSchedulerService } from '../../services/event-scheduler/event-scheduler.service.js';
|
|
2
|
+
import { Auth } from './Auth.js';
|
|
3
|
+
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
+
import { newInstance, range, s4 } from './CommonJs.js';
|
|
5
|
+
import { renderCssAttr } from './Css.js';
|
|
6
|
+
import { Modal } from './Modal.js';
|
|
7
|
+
import { NotificationManager } from './NotificationManager.js';
|
|
8
|
+
import { Panel } from './Panel.js';
|
|
9
|
+
import { Responsive } from './Responsive.js';
|
|
10
|
+
import { listenQueryPathInstance, RouterEvents, setQueryPath } from './Router.js';
|
|
11
|
+
import { Translate } from './Translate.js';
|
|
12
|
+
import { append, getQueryParams, getTimeZone, htmls, s, sa } from './VanillaJs.js';
|
|
13
|
+
|
|
14
|
+
// https://fullcalendar.io/docs/event-object
|
|
15
|
+
|
|
16
|
+
const CalendarCore = {
|
|
17
|
+
RenderStyle: async function () {},
|
|
18
|
+
Data: {},
|
|
19
|
+
Render: async function (options = { idModal: '', Elements: {}, heightTopBar: 50, heightBottomBar: 50 }) {
|
|
20
|
+
this.Data[options.idModal] = {
|
|
21
|
+
data: [],
|
|
22
|
+
originData: [],
|
|
23
|
+
filesData: [],
|
|
24
|
+
calendar: {},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const { heightTopBar, heightBottomBar } = options;
|
|
28
|
+
|
|
29
|
+
const titleIcon = html`<i class="fas fa-calendar-alt"></i>`;
|
|
30
|
+
|
|
31
|
+
const getSrrData = () => {
|
|
32
|
+
this.Data[options.idModal].data = range(0, 5).map((i) => {
|
|
33
|
+
return {
|
|
34
|
+
id: `event-${i}`,
|
|
35
|
+
description: `Event ${s4()}${s4()}${s4()}`,
|
|
36
|
+
start: new Date().toTimeString(),
|
|
37
|
+
end: new Date().toTimeString(),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
getSrrData();
|
|
42
|
+
|
|
43
|
+
const dateFormat = (date) =>
|
|
44
|
+
html`<span
|
|
45
|
+
style="${renderCssAttr({
|
|
46
|
+
style: {
|
|
47
|
+
'font-size': '14px',
|
|
48
|
+
color: '#888',
|
|
49
|
+
},
|
|
50
|
+
})}"
|
|
51
|
+
>${new Date(date).toLocaleString().replaceAll(',', '')}</span
|
|
52
|
+
>`;
|
|
53
|
+
|
|
54
|
+
const getPanelData = async () => {
|
|
55
|
+
const result = await EventSchedulerService.get({
|
|
56
|
+
id: `${getQueryParams().cid ? getQueryParams().cid : 'creatorUser'}`,
|
|
57
|
+
});
|
|
58
|
+
NotificationManager.Push({
|
|
59
|
+
html: result.status === 'success' ? Translate.Render('success-get-events-scheduler') : result.message,
|
|
60
|
+
status: result.status,
|
|
61
|
+
});
|
|
62
|
+
if (result.status === 'success') {
|
|
63
|
+
const resultData = Array.isArray(result.data) ? result.data : [result.data];
|
|
64
|
+
this.Data[options.idModal].filesData = [];
|
|
65
|
+
this.Data[options.idModal].originData = newInstance(resultData);
|
|
66
|
+
this.Data[options.idModal].data = resultData.map((o) => {
|
|
67
|
+
if (o.creatorUserId && options.Elements.Data.user.main.model.user._id === o.creatorUserId) o.tools = true;
|
|
68
|
+
o.id = o._id;
|
|
69
|
+
o.start = dateFormat(o.start);
|
|
70
|
+
o.end = dateFormat(o.end);
|
|
71
|
+
this.Data[options.idModal].filesData.push({});
|
|
72
|
+
return o;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const renderCalendar = () => {
|
|
78
|
+
const calendarEl = s(`.calendar-${idPanel}`);
|
|
79
|
+
this.Data[options.idModal].calendar = new FullCalendar.Calendar(calendarEl, {
|
|
80
|
+
plugins: [FullCalendar.DayGrid.default, FullCalendar.TimeGrid.default, FullCalendar.List.default],
|
|
81
|
+
// initialView: 'dayGridWeek',
|
|
82
|
+
timeZone: getTimeZone(),
|
|
83
|
+
dateClick: function (arg) {
|
|
84
|
+
console.error('calendar dateClick', arg.date.toString());
|
|
85
|
+
},
|
|
86
|
+
events: [{ title: 'Meeting', start: new Date() }],
|
|
87
|
+
initialView: 'dayGridMonth',
|
|
88
|
+
headerToolbar: {
|
|
89
|
+
left: 'prev,next today',
|
|
90
|
+
center: 'title',
|
|
91
|
+
right: 'dayGridMonth,timeGridWeek,listWeek',
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
this.Data[options.idModal].calendar.render();
|
|
96
|
+
};
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
renderCalendar();
|
|
99
|
+
Translate.Event['fullcalendar-lang'] = () => {
|
|
100
|
+
this.Data[options.idModal].calendar.setOption('locale', s(`html`).lang);
|
|
101
|
+
if (s(`.fc-timegrid-axis-cushion`)) htmls(`.fc-timegrid-axis-cushion`, Translate.Render('all-day'));
|
|
102
|
+
if (s(`.fc-dayGridMonth-button`)) htmls(`.fc-dayGridMonth-button`, Translate.Render('month'));
|
|
103
|
+
if (s(`.fc-timeGridWeek-button`)) htmls(`.fc-timeGridWeek-button`, Translate.Render('week'));
|
|
104
|
+
if (s(`.fc-listWeek-button`)) htmls(`.fc-listWeek-button`, Translate.Render('summary'));
|
|
105
|
+
if (s(`.fc-today-button`)) htmls(`.fc-today-button`, Translate.Render('today'));
|
|
106
|
+
};
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
Translate.Event['fullcalendar-lang']();
|
|
109
|
+
s(`.fc-dayGridMonth-button`).onclick = () => {
|
|
110
|
+
Translate.Event['fullcalendar-lang']();
|
|
111
|
+
};
|
|
112
|
+
s(`.fc-listWeek-button`).onclick = () => {
|
|
113
|
+
Translate.Event['fullcalendar-lang']();
|
|
114
|
+
};
|
|
115
|
+
s(`.fc-timeGridWeek-button`).onclick = () => {
|
|
116
|
+
Translate.Event['fullcalendar-lang']();
|
|
117
|
+
};
|
|
118
|
+
s(`.fc-next-button`).onclick = () => {
|
|
119
|
+
Translate.Event['fullcalendar-lang']();
|
|
120
|
+
};
|
|
121
|
+
s(`.fc-prev-button`).onclick = () => {
|
|
122
|
+
Translate.Event['fullcalendar-lang']();
|
|
123
|
+
};
|
|
124
|
+
s(`.fc-today-button`).onclick = () => {
|
|
125
|
+
Translate.Event['fullcalendar-lang']();
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
sa(`.fc-button-group`)[1].style.float = 'right';
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const idPanel = `calendar-panel-${options.idModal}`;
|
|
133
|
+
const formData = [
|
|
134
|
+
{
|
|
135
|
+
model: 'id',
|
|
136
|
+
id: 'id',
|
|
137
|
+
inputType: 'text',
|
|
138
|
+
disableRender: true,
|
|
139
|
+
rules: [{ type: 'isEmpty' }],
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: 'description',
|
|
143
|
+
model: 'description',
|
|
144
|
+
inputType: 'text',
|
|
145
|
+
rules: [{ type: 'isEmpty' }],
|
|
146
|
+
panel: { type: 'title' },
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
id: 'allDay',
|
|
150
|
+
model: 'allDay',
|
|
151
|
+
inputType: 'checkbox-on-off',
|
|
152
|
+
rules: [],
|
|
153
|
+
panel: { type: 'info-row', icon: html`<i class="fa-solid fa-infinity"></i>` },
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: 'start',
|
|
157
|
+
model: 'start',
|
|
158
|
+
inputType: 'datetime-local',
|
|
159
|
+
panel: { type: 'subtitle' },
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: 'end',
|
|
163
|
+
model: 'end',
|
|
164
|
+
inputType: 'datetime-local',
|
|
165
|
+
panel: { type: 'info-row' },
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
const resizeModal = () => {
|
|
171
|
+
Modal.Data[options.idModal].onObserverListener[options.idModal] = () => {
|
|
172
|
+
if (s(`.main-body-calendar-${options.idModal}`))
|
|
173
|
+
s(`.main-body-calendar-${options.idModal}`).style.height = `${
|
|
174
|
+
s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
|
|
175
|
+
}px`;
|
|
176
|
+
};
|
|
177
|
+
Modal.Data[options.idModal].onObserverListener[options.idModal]();
|
|
178
|
+
};
|
|
179
|
+
setTimeout(resizeModal);
|
|
180
|
+
RouterEvents[`${options.idModal}-main-body`] = ({ route }) => {
|
|
181
|
+
if (route === 'calendar') {
|
|
182
|
+
setTimeout(() => {
|
|
183
|
+
resizeModal();
|
|
184
|
+
}, 400);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
s(`.close-calendar-container`).onclick = () => {
|
|
189
|
+
s(`.calendar-container`).classList.add('hide');
|
|
190
|
+
s(`.main-body-calendar-${options.idModal}`).classList.remove('hide');
|
|
191
|
+
htmls(
|
|
192
|
+
`.style-calendar`,
|
|
193
|
+
html`<style>
|
|
194
|
+
.modal-calendar {
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
}
|
|
197
|
+
</style>`,
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const panelRender = async () => {
|
|
203
|
+
return html`${await Panel.Render({
|
|
204
|
+
idPanel,
|
|
205
|
+
parentIdModal: options.idModal,
|
|
206
|
+
formData,
|
|
207
|
+
heightTopBar,
|
|
208
|
+
heightBottomBar,
|
|
209
|
+
data: this.Data[options.idModal].data,
|
|
210
|
+
formContainerClass: '',
|
|
211
|
+
scrollClassContainer: `main-body-calendar-${options.idModal}`,
|
|
212
|
+
originData: () => this.Data[options.idModal].originData,
|
|
213
|
+
filesData: () => this.Data[options.idModal].filesData,
|
|
214
|
+
onClick: async function ({ payload }) {
|
|
215
|
+
if (options.route) {
|
|
216
|
+
setQueryPath({ path: options.route, queryPath: payload._id });
|
|
217
|
+
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
218
|
+
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
219
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
titleIcon,
|
|
223
|
+
route: 'calendar',
|
|
224
|
+
callBackPanelRender: async function ({ data, fileRender, htmlRender }) {
|
|
225
|
+
return await htmlRender({
|
|
226
|
+
render: html`<div class="abs center">
|
|
227
|
+
<i class="far fa-calendar" style="font-size: 130px; color: #d3d3d3cf;"></i>
|
|
228
|
+
</div>`,
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
customButtons: [
|
|
232
|
+
{
|
|
233
|
+
label: html`<i class="fa-regular fa-calendar-days"></i> ${Translate.Render('calendar')}`,
|
|
234
|
+
onClick: function () {
|
|
235
|
+
s(`.calendar-container`).classList.remove('hide');
|
|
236
|
+
s(`.main-body-calendar-${options.idModal}`).classList.add('hide');
|
|
237
|
+
// renderCalendar();
|
|
238
|
+
CalendarCore.Data[options.idModal].calendar.setOption('height', 700);
|
|
239
|
+
Translate.Event['fullcalendar-lang']();
|
|
240
|
+
htmls(
|
|
241
|
+
`.style-calendar`,
|
|
242
|
+
html`<style>
|
|
243
|
+
.modal-calendar {
|
|
244
|
+
overflow: auto;
|
|
245
|
+
}
|
|
246
|
+
</style>`,
|
|
247
|
+
);
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
on: {
|
|
252
|
+
add: async function ({ data, editId }) {
|
|
253
|
+
const {
|
|
254
|
+
status,
|
|
255
|
+
message,
|
|
256
|
+
data: documentData,
|
|
257
|
+
} = editId
|
|
258
|
+
? await EventSchedulerService.put({ id: editId, body: { ...data, _id: undefined } })
|
|
259
|
+
: await EventSchedulerService.post({ body: data });
|
|
260
|
+
NotificationManager.Push({
|
|
261
|
+
html:
|
|
262
|
+
status === 'success'
|
|
263
|
+
? editId
|
|
264
|
+
? Translate.Render('success-edit-event-scheduler')
|
|
265
|
+
: Translate.Render('success-add-event-scheduler')
|
|
266
|
+
: message,
|
|
267
|
+
status: status,
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
if (status === 'success') {
|
|
271
|
+
data.start = dateFormat(data.start);
|
|
272
|
+
data.end = dateFormat(data.end);
|
|
273
|
+
data.tools = true;
|
|
274
|
+
data._id = documentData._id;
|
|
275
|
+
|
|
276
|
+
let originObj, indexOriginObj;
|
|
277
|
+
let filesData = {};
|
|
278
|
+
if (editId) {
|
|
279
|
+
indexOriginObj = CalendarCore.Data[options.idModal].originData.findIndex((d) => d._id === editId);
|
|
280
|
+
if (indexOriginObj > -1) originObj = CalendarCore.Data[options.idModal].originData[indexOriginObj];
|
|
281
|
+
}
|
|
282
|
+
if (originObj) {
|
|
283
|
+
CalendarCore.Data[options.idModal].originData[indexOriginObj] = documentData;
|
|
284
|
+
CalendarCore.Data[options.idModal].data[indexOriginObj] = data;
|
|
285
|
+
CalendarCore.Data[options.idModal].filesData[indexOriginObj] = filesData;
|
|
286
|
+
} else {
|
|
287
|
+
CalendarCore.Data[options.idModal].originData.push(documentData);
|
|
288
|
+
CalendarCore.Data[options.idModal].data.push(data);
|
|
289
|
+
CalendarCore.Data[options.idModal].filesData.push(filesData);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
setQueryPath({ path: options.route, queryPath: documentData._id });
|
|
293
|
+
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
294
|
+
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
295
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
296
|
+
}
|
|
297
|
+
return { data, status, message };
|
|
298
|
+
},
|
|
299
|
+
remove: async function ({ e, data }) {
|
|
300
|
+
e.preventDefault();
|
|
301
|
+
const confirmResult = await Modal.RenderConfirm({
|
|
302
|
+
html: async () => {
|
|
303
|
+
return html`
|
|
304
|
+
<div class="in section-mp" style="text-align: center">
|
|
305
|
+
${Translate.Render('confirm-delete-item')}
|
|
306
|
+
<br />
|
|
307
|
+
"${data.description}"
|
|
308
|
+
</div>
|
|
309
|
+
`;
|
|
310
|
+
},
|
|
311
|
+
id: `delete-${idPanel}`,
|
|
312
|
+
});
|
|
313
|
+
if (confirmResult.status === 'confirm') {
|
|
314
|
+
const { status, message } = await EventSchedulerService.delete({
|
|
315
|
+
id: data._id,
|
|
316
|
+
});
|
|
317
|
+
NotificationManager.Push({
|
|
318
|
+
html: status,
|
|
319
|
+
status,
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
if (getQueryParams().cid === data.id) {
|
|
323
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
324
|
+
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
325
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return { status };
|
|
329
|
+
}
|
|
330
|
+
return { status: 'error' };
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
})}
|
|
334
|
+
<div class="in" style="margin-bottom: 100px"></div>`;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
let lastCid;
|
|
338
|
+
let lasUserId;
|
|
339
|
+
this.Data[options.idModal].updatePanel = async () => {
|
|
340
|
+
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
341
|
+
if (lastCid === cid && lasUserId === options.Elements.Data.user.main.model.user._id) return;
|
|
342
|
+
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
343
|
+
lasUserId = newInstance(options.Elements.Data.user.main.model.user._id);
|
|
344
|
+
lastCid = cid;
|
|
345
|
+
if (s(`.main-body-calendar-${options.idModal}`)) {
|
|
346
|
+
if (Auth.getToken()) await getPanelData();
|
|
347
|
+
else getSrrData();
|
|
348
|
+
htmls(`.main-body-calendar-${options.idModal}`, await panelRender());
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
if (options.route)
|
|
353
|
+
listenQueryPathInstance({
|
|
354
|
+
id: options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body',
|
|
355
|
+
routeId: options.route,
|
|
356
|
+
event: async (path) => {
|
|
357
|
+
setTimeout(() => {
|
|
358
|
+
CalendarCore.Data[options.idModal].updatePanel();
|
|
359
|
+
});
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
if (options.route === 'home') setTimeout(CalendarCore.Data[options.idModal].updatePanel);
|
|
364
|
+
|
|
365
|
+
return html`
|
|
366
|
+
<style>
|
|
367
|
+
.main-body-calendar-${options.idModal} {
|
|
368
|
+
overflow: auto;
|
|
369
|
+
}
|
|
370
|
+
.${idPanel}-form {
|
|
371
|
+
max-width: 750px !important;
|
|
372
|
+
}
|
|
373
|
+
</style>
|
|
374
|
+
<div class="style-calendar">
|
|
375
|
+
<style>
|
|
376
|
+
.modal-calendar {
|
|
377
|
+
overflow: hidden;
|
|
378
|
+
}
|
|
379
|
+
</style>
|
|
380
|
+
</div>
|
|
381
|
+
|
|
382
|
+
<div class="in main-body-calendar-${options.idModal}">${await panelRender()}</div>
|
|
383
|
+
<style>
|
|
384
|
+
.calendar-container {
|
|
385
|
+
color: black;
|
|
386
|
+
background: #fcfcfc;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.calendar-container a {
|
|
390
|
+
color: #4a4a4a;
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
}
|
|
393
|
+
.calendar-container a:hover {
|
|
394
|
+
color: #8a8a8a;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.fc-toolbar-title {
|
|
398
|
+
font-size: 20px !important;
|
|
399
|
+
margin: 0px !important;
|
|
400
|
+
text-transform: uppercase;
|
|
401
|
+
color: #8a8a8a;
|
|
402
|
+
padding: 10px 5px 5px 5px;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.fc-button,
|
|
406
|
+
.fc-button-primary {
|
|
407
|
+
border: none !important;
|
|
408
|
+
border-radius: 0px !important;
|
|
409
|
+
background: #b1b1b1 !important;
|
|
410
|
+
margin: 3px !important;
|
|
411
|
+
/* color: #4a4a4a; */
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.fc-button-primary:hover,
|
|
415
|
+
.fc-button:hover {
|
|
416
|
+
background: #4a4a4a !important;
|
|
417
|
+
/* background: #b1b1b1 !important; */
|
|
418
|
+
/* box-shadow: none !important;
|
|
419
|
+
border-radius: 0px !important;
|
|
420
|
+
border: none !important; */
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.fc-button-primary:active .fc-button:active {
|
|
424
|
+
/* box-shadow: none !important;
|
|
425
|
+
border-radius: 0px !important;
|
|
426
|
+
border: none !important; */
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.fc-toolbar {
|
|
430
|
+
display: block !important;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.fc-toolbar-chunk {
|
|
434
|
+
padding: 5px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.calendar-buttons-container {
|
|
438
|
+
padding-bottom: 15px;
|
|
439
|
+
top: ${Modal.headerTitleHeight}px;
|
|
440
|
+
height: 60px;
|
|
441
|
+
z-index: 4;
|
|
442
|
+
}
|
|
443
|
+
</style>
|
|
444
|
+
<div class="in calendar-container hide">
|
|
445
|
+
<div class="stq modal calendar-buttons-container">
|
|
446
|
+
${await BtnIcon.Render({
|
|
447
|
+
class: `section-mp btn-custom close-calendar-container flr`,
|
|
448
|
+
label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
|
|
449
|
+
type: 'button',
|
|
450
|
+
})}
|
|
451
|
+
</div>
|
|
452
|
+
<div class="in"><div class="calendar-${idPanel}"></div></div>
|
|
453
|
+
</div>
|
|
454
|
+
`;
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
export { CalendarCore };
|