underpost 2.6.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.
Files changed (269) hide show
  1. package/.dockerignore +14 -0
  2. package/.env.development +8 -0
  3. package/.env.production +8 -0
  4. package/.env.test +8 -0
  5. package/.nycrc +9 -0
  6. package/.prettierignore +13 -0
  7. package/.prettierrc +9 -0
  8. package/.vscode/extensions.json +72 -0
  9. package/.vscode/settings.json +99 -0
  10. package/Dockerfile +88 -0
  11. package/LICENSE +21 -0
  12. package/README.md +51 -0
  13. package/bin/db.js +119 -0
  14. package/bin/deploy.js +600 -0
  15. package/bin/dns.js +1 -0
  16. package/bin/file.js +92 -0
  17. package/bin/help.js +110 -0
  18. package/bin/index.js +29 -0
  19. package/bin/install.js +357 -0
  20. package/bin/shortcut.js +44 -0
  21. package/bin/ssl.js +61 -0
  22. package/bin/util.js +182 -0
  23. package/bin/vs.js +35 -0
  24. package/conf.js +244 -0
  25. package/docker-compose.yml +67 -0
  26. package/jsconfig.json +7 -0
  27. package/jsdoc.json +32 -0
  28. package/nodemon.json +6 -0
  29. package/package.json +128 -0
  30. package/prometheus.yml +36 -0
  31. package/setup.sh +25 -0
  32. package/src/api/core/core.controller.js +69 -0
  33. package/src/api/core/core.model.js +11 -0
  34. package/src/api/core/core.router.js +23 -0
  35. package/src/api/core/core.service.js +29 -0
  36. package/src/api/crypto/crypto.controller.js +51 -0
  37. package/src/api/crypto/crypto.model.js +23 -0
  38. package/src/api/crypto/crypto.router.js +20 -0
  39. package/src/api/crypto/crypto.service.js +64 -0
  40. package/src/api/default/default.controller.js +69 -0
  41. package/src/api/default/default.model.js +20 -0
  42. package/src/api/default/default.router.js +23 -0
  43. package/src/api/default/default.service.js +31 -0
  44. package/src/api/file/file.controller.js +51 -0
  45. package/src/api/file/file.model.js +19 -0
  46. package/src/api/file/file.router.js +20 -0
  47. package/src/api/file/file.service.js +70 -0
  48. package/src/api/instance/instance.controller.js +69 -0
  49. package/src/api/instance/instance.model.js +36 -0
  50. package/src/api/instance/instance.router.js +33 -0
  51. package/src/api/instance/instance.service.js +48 -0
  52. package/src/api/test/test.controller.js +59 -0
  53. package/src/api/test/test.model.js +14 -0
  54. package/src/api/test/test.router.js +21 -0
  55. package/src/api/test/test.service.js +35 -0
  56. package/src/api/user/user.controller.js +70 -0
  57. package/src/api/user/user.model.js +65 -0
  58. package/src/api/user/user.router.js +345 -0
  59. package/src/api/user/user.service.js +479 -0
  60. package/src/api.js +23 -0
  61. package/src/client/Default.index.js +40 -0
  62. package/src/client/components/core/Account.js +290 -0
  63. package/src/client/components/core/AgGrid.js +160 -0
  64. package/src/client/components/core/Auth.js +19 -0
  65. package/src/client/components/core/Badge.js +32 -0
  66. package/src/client/components/core/BlockChain.js +41 -0
  67. package/src/client/components/core/Blog.js +9 -0
  68. package/src/client/components/core/BtnIcon.js +91 -0
  69. package/src/client/components/core/CalendarCore.js +319 -0
  70. package/src/client/components/core/Chat.js +64 -0
  71. package/src/client/components/core/ColorPalette.js +5267 -0
  72. package/src/client/components/core/CommonJs.js +708 -0
  73. package/src/client/components/core/Content.js +49 -0
  74. package/src/client/components/core/Css.js +1027 -0
  75. package/src/client/components/core/CssCore.js +792 -0
  76. package/src/client/components/core/D3Chart.js +44 -0
  77. package/src/client/components/core/Docs.js +130 -0
  78. package/src/client/components/core/DropDown.js +164 -0
  79. package/src/client/components/core/EventsUI.js +54 -0
  80. package/src/client/components/core/FileExplorer.js +624 -0
  81. package/src/client/components/core/FullScreen.js +45 -0
  82. package/src/client/components/core/Input.js +259 -0
  83. package/src/client/components/core/JoyStick.js +77 -0
  84. package/src/client/components/core/Keyboard.js +73 -0
  85. package/src/client/components/core/LoadingAnimation.js +157 -0
  86. package/src/client/components/core/LogIn.js +181 -0
  87. package/src/client/components/core/LogOut.js +52 -0
  88. package/src/client/components/core/Logger.js +26 -0
  89. package/src/client/components/core/Modal.js +1596 -0
  90. package/src/client/components/core/NotificationManager.js +84 -0
  91. package/src/client/components/core/Panel.js +413 -0
  92. package/src/client/components/core/Polyhedron.js +162 -0
  93. package/src/client/components/core/Recover.js +204 -0
  94. package/src/client/components/core/Responsive.js +53 -0
  95. package/src/client/components/core/RichText.js +27 -0
  96. package/src/client/components/core/Router.js +77 -0
  97. package/src/client/components/core/SignUp.js +125 -0
  98. package/src/client/components/core/SocketIo.js +72 -0
  99. package/src/client/components/core/Stream.js +113 -0
  100. package/src/client/components/core/ToggleSwitch.js +87 -0
  101. package/src/client/components/core/ToolTip.js +26 -0
  102. package/src/client/components/core/Translate.js +408 -0
  103. package/src/client/components/core/Validator.js +100 -0
  104. package/src/client/components/core/VanillaJs.js +454 -0
  105. package/src/client/components/core/Wallet.js +106 -0
  106. package/src/client/components/core/Webhook.js +25 -0
  107. package/src/client/components/core/Worker.js +272 -0
  108. package/src/client/components/default/CommonDefault.js +29 -0
  109. package/src/client/components/default/CssDefault.js +13 -0
  110. package/src/client/components/default/ElementsDefault.js +38 -0
  111. package/src/client/components/default/LogInDefault.js +41 -0
  112. package/src/client/components/default/LogOutDefault.js +28 -0
  113. package/src/client/components/default/MenuDefault.js +389 -0
  114. package/src/client/components/default/RoutesDefault.js +48 -0
  115. package/src/client/components/default/SettingsDefault.js +16 -0
  116. package/src/client/components/default/SignUpDefault.js +9 -0
  117. package/src/client/components/default/SocketIoDefault.js +54 -0
  118. package/src/client/components/default/TranslateDefault.js +7 -0
  119. package/src/client/public/default/android-chrome-144x144.png +0 -0
  120. package/src/client/public/default/android-chrome-192x192.png +0 -0
  121. package/src/client/public/default/android-chrome-256x256.png +0 -0
  122. package/src/client/public/default/android-chrome-36x36.png +0 -0
  123. package/src/client/public/default/android-chrome-384x384.png +0 -0
  124. package/src/client/public/default/android-chrome-48x48.png +0 -0
  125. package/src/client/public/default/android-chrome-512x512.png +0 -0
  126. package/src/client/public/default/android-chrome-72x72.png +0 -0
  127. package/src/client/public/default/android-chrome-96x96.png +0 -0
  128. package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
  129. package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
  130. package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
  131. package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
  132. package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
  133. package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
  134. package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
  135. package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
  136. package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
  137. package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
  138. package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
  139. package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
  140. package/src/client/public/default/apple-touch-icon.png +0 -0
  141. package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
  142. package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
  143. package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
  144. package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
  145. package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
  146. package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
  147. package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
  148. package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
  149. package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
  150. package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
  151. package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
  152. package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
  153. package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
  154. package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
  155. package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
  156. package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
  157. package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
  158. package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
  159. package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
  160. package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
  161. package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
  162. package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
  163. package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
  164. package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
  165. package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
  166. package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
  167. package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
  168. package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
  169. package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
  170. package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
  171. package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
  172. package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
  173. package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
  174. package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
  175. package/src/client/public/default/assets/background/white.jpg +0 -0
  176. package/src/client/public/default/assets/background/white0-min.jpg +0 -0
  177. package/src/client/public/default/assets/background/white0.jpg +0 -0
  178. package/src/client/public/default/assets/logo/base-icon.png +0 -0
  179. package/src/client/public/default/browserconfig.xml +12 -0
  180. package/src/client/public/default/favicon-16x16.png +0 -0
  181. package/src/client/public/default/favicon-32x32.png +0 -0
  182. package/src/client/public/default/favicon-48x48.png +0 -0
  183. package/src/client/public/default/favicon.ico +0 -0
  184. package/src/client/public/default/manifest.webmanifest +69 -0
  185. package/src/client/public/default/mstile-144x144.png +0 -0
  186. package/src/client/public/default/mstile-150x150.png +0 -0
  187. package/src/client/public/default/mstile-310x150.png +0 -0
  188. package/src/client/public/default/mstile-310x310.png +0 -0
  189. package/src/client/public/default/mstile-70x70.png +0 -0
  190. package/src/client/public/default/sitemap +148 -0
  191. package/src/client/public/default/yandex-browser-50x50.png +0 -0
  192. package/src/client/public/default/yandex-browser-manifest.json +9 -0
  193. package/src/client/public/doc/favicon.ico +0 -0
  194. package/src/client/public/doc/sitemap +148 -0
  195. package/src/client/public/test/favicon.ico +0 -0
  196. package/src/client/public/test/sitemap +148 -0
  197. package/src/client/services/core/core.service.js +152 -0
  198. package/src/client/services/crypto/crypto.service.js +70 -0
  199. package/src/client/services/default/default.management.js +345 -0
  200. package/src/client/services/default/default.service.js +89 -0
  201. package/src/client/services/file/file.service.js +70 -0
  202. package/src/client/services/instance/instance.management.js +74 -0
  203. package/src/client/services/instance/instance.service.js +89 -0
  204. package/src/client/services/test/test.service.js +70 -0
  205. package/src/client/services/user/user.management.js +50 -0
  206. package/src/client/services/user/user.service.js +89 -0
  207. package/src/client/ssr/Render.js +16 -0
  208. package/src/client/ssr/body-components/CacheControl.js +113 -0
  209. package/src/client/ssr/body-components/DefaultSplashScreen.js +79 -0
  210. package/src/client/ssr/email-components/DefaultRecoverEmail.js +21 -0
  211. package/src/client/ssr/email-components/DefaultVerifyEmail.js +17 -0
  212. package/src/client/ssr/head-components/Css.js +241 -0
  213. package/src/client/ssr/head-components/DefaultScripts.js +3 -0
  214. package/src/client/ssr/head-components/Microdata.js +11 -0
  215. package/src/client/ssr/head-components/Production.js +1 -0
  216. package/src/client/ssr/head-components/PwaDefault.js +60 -0
  217. package/src/client/ssr/head-components/Seo.js +14 -0
  218. package/src/client/sw/default.sw.js +201 -0
  219. package/src/client/sw/template.sw.js +84 -0
  220. package/src/client.build.js +22 -0
  221. package/src/client.dev.js +21 -0
  222. package/src/cron.js +25 -0
  223. package/src/db/DataBaseProvider.js +34 -0
  224. package/src/db/mariadb/MariaDB.js +33 -0
  225. package/src/db/mongo/MongooseDB.js +46 -0
  226. package/src/dns.js +22 -0
  227. package/src/mailer/EmailRender.js +69 -0
  228. package/src/mailer/MailerProvider.js +96 -0
  229. package/src/proxy.js +22 -0
  230. package/src/runtime/lampp/Lampp.js +44 -0
  231. package/src/runtime/nginx/Nginx.js +3 -0
  232. package/src/runtime/xampp/Xampp.js +49 -0
  233. package/src/server/auth.js +204 -0
  234. package/src/server/backup.js +83 -0
  235. package/src/server/client-build-live.js +72 -0
  236. package/src/server/client-build.js +688 -0
  237. package/src/server/client-dev-server.js +58 -0
  238. package/src/server/client-formatted.js +48 -0
  239. package/src/server/client-icons.js +150 -0
  240. package/src/server/conf.js +611 -0
  241. package/src/server/dns.js +87 -0
  242. package/src/server/downloader.js +42 -0
  243. package/src/server/logger.js +135 -0
  244. package/src/server/network.js +122 -0
  245. package/src/server/peer.js +33 -0
  246. package/src/server/process.js +66 -0
  247. package/src/server/proxy.js +118 -0
  248. package/src/server/runtime.js +393 -0
  249. package/src/server/ssl.js +107 -0
  250. package/src/server.js +25 -0
  251. package/src/ws/IoInterface.js +45 -0
  252. package/src/ws/IoServer.js +39 -0
  253. package/src/ws/core/channels/core.ws.chat.js +23 -0
  254. package/src/ws/core/channels/core.ws.mailer.js +35 -0
  255. package/src/ws/core/channels/core.ws.stream.js +31 -0
  256. package/src/ws/core/core.ws.connection.js +28 -0
  257. package/src/ws/core/core.ws.emit.js +14 -0
  258. package/src/ws/core/core.ws.server.js +24 -0
  259. package/src/ws/core/management/core.ws.chat.js +8 -0
  260. package/src/ws/core/management/core.ws.mailer.js +16 -0
  261. package/src/ws/core/management/core.ws.stream.js +8 -0
  262. package/src/ws/default/channels/default.ws.main.js +16 -0
  263. package/src/ws/default/default.ws.connection.js +22 -0
  264. package/src/ws/default/default.ws.emit.js +14 -0
  265. package/src/ws/default/default.ws.server.js +20 -0
  266. package/src/ws/default/management/default.ws.main.js +8 -0
  267. package/startup.js +11 -0
  268. package/supervisord-openssh-server.conf +5 -0
  269. package/test/api.test.js +60 -0
@@ -0,0 +1,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 { range, s4 } from './CommonJs.js';
5
+ import { Modal } from './Modal.js';
6
+ import { NotificationManager } from './NotificationManager.js';
7
+ import { Panel } from './Panel.js';
8
+ import { Responsive } from './Responsive.js';
9
+ import { RouterEvents } from './Router.js';
10
+ import { Translate } from './Translate.js';
11
+ import { append, getTimeZone, htmls, s, sa } from './VanillaJs.js';
12
+
13
+ // https://fullcalendar.io/docs/event-object
14
+
15
+ const CalendarCore = {
16
+ RenderStyle: async function () {},
17
+ Render: async function (options = { idModal: '' }) {
18
+ let calendar;
19
+ let data = range(0, 5).map((i) => {
20
+ return {
21
+ id: `event-${i}`,
22
+ description: `Event ${s4()}${s4()}${s4()}`,
23
+ start: new Date().toTimeString(),
24
+ end: new Date().toTimeString(),
25
+ };
26
+ });
27
+
28
+ {
29
+ if (Auth.getToken()) {
30
+ const result = await EventSchedulerService.get({
31
+ id: `creatorUser`,
32
+ });
33
+ NotificationManager.Push({
34
+ html: result.status === 'success' ? Translate.Render('success-get-events-scheduler') : result.message,
35
+ status: result.status,
36
+ });
37
+ if (result.status === 'success')
38
+ data = result.data
39
+ .map((o) => {
40
+ o.id = o._id;
41
+ return o;
42
+ })
43
+ .reverse();
44
+ }
45
+ }
46
+ const renderCalendar = () => {
47
+ const calendarEl = s('#calendar');
48
+ calendar = new FullCalendar.Calendar(calendarEl, {
49
+ plugins: [FullCalendar.DayGrid.default, FullCalendar.TimeGrid.default, FullCalendar.List.default],
50
+ // initialView: 'dayGridWeek',
51
+ timeZone: getTimeZone(),
52
+ dateClick: function (arg) {
53
+ console.error('calendar dateClick', arg.date.toString());
54
+ },
55
+ events: [{ title: 'Meeting', start: new Date() }],
56
+ initialView: 'dayGridMonth',
57
+ headerToolbar: {
58
+ left: 'prev,next today',
59
+ center: 'title',
60
+ right: 'dayGridMonth,timeGridWeek,listWeek',
61
+ },
62
+ });
63
+
64
+ calendar.render();
65
+ };
66
+ setTimeout(() => {
67
+ renderCalendar();
68
+ Translate.Event['fullcalendar-lang'] = () => {
69
+ calendar.setOption('locale', s(`html`).lang);
70
+ if (s(`.fc-timegrid-axis-cushion`)) htmls(`.fc-timegrid-axis-cushion`, Translate.Render('all-day'));
71
+ if (s(`.fc-dayGridMonth-button`)) htmls(`.fc-dayGridMonth-button`, Translate.Render('month'));
72
+ if (s(`.fc-timeGridWeek-button`)) htmls(`.fc-timeGridWeek-button`, Translate.Render('week'));
73
+ if (s(`.fc-listWeek-button`)) htmls(`.fc-listWeek-button`, Translate.Render('summary'));
74
+ if (s(`.fc-today-button`)) htmls(`.fc-today-button`, Translate.Render('today'));
75
+ };
76
+ setTimeout(() => {
77
+ Translate.Event['fullcalendar-lang']();
78
+ s(`.fc-dayGridMonth-button`).onclick = () => {
79
+ Translate.Event['fullcalendar-lang']();
80
+ };
81
+ s(`.fc-listWeek-button`).onclick = () => {
82
+ Translate.Event['fullcalendar-lang']();
83
+ };
84
+ s(`.fc-timeGridWeek-button`).onclick = () => {
85
+ Translate.Event['fullcalendar-lang']();
86
+ };
87
+ s(`.fc-next-button`).onclick = () => {
88
+ Translate.Event['fullcalendar-lang']();
89
+ };
90
+ s(`.fc-prev-button`).onclick = () => {
91
+ Translate.Event['fullcalendar-lang']();
92
+ };
93
+ s(`.fc-today-button`).onclick = () => {
94
+ Translate.Event['fullcalendar-lang']();
95
+ };
96
+ });
97
+
98
+ sa(`.fc-button-group`)[1].style.float = 'right';
99
+ });
100
+
101
+ const idPanel = 'calendar-panel';
102
+ const formData = [
103
+ {
104
+ model: 'id',
105
+ id: 'id',
106
+ inputType: 'text',
107
+ disableRender: true,
108
+ rules: [{ type: 'isEmpty' }],
109
+ },
110
+ {
111
+ id: 'description',
112
+ model: 'description',
113
+ inputType: 'text',
114
+ rules: [{ type: 'isEmpty' }],
115
+ panel: { type: 'title' },
116
+ },
117
+ {
118
+ id: 'allDay',
119
+ model: 'allDay',
120
+ inputType: 'checkbox-on-off',
121
+ rules: [],
122
+ panel: { type: 'info-row', icon: html`<i class="fa-solid fa-infinity"></i>` },
123
+ },
124
+ {
125
+ id: 'start',
126
+ model: 'start',
127
+ inputType: 'datetime-local',
128
+ panel: { type: 'subtitle' },
129
+ },
130
+ {
131
+ id: 'end',
132
+ model: 'end',
133
+ inputType: 'datetime-local',
134
+ panel: { type: 'info-row' },
135
+ },
136
+ ];
137
+
138
+ const heightTopBar = 100;
139
+ const heightBottomBar = 0;
140
+
141
+ setTimeout(() => {
142
+ const resizeModal = () => {
143
+ Modal.Data[options.idModal].onObserverListener[options.idModal] = () => {
144
+ if (s(`.main-body-calendar`))
145
+ s(`.main-body-calendar`).style.height = `${
146
+ s(`.${options.idModal}`).offsetHeight - Modal.headerTitleHeight
147
+ }px`;
148
+ };
149
+ Modal.Data[options.idModal].onObserverListener[options.idModal]();
150
+ };
151
+ setTimeout(resizeModal);
152
+ RouterEvents[`${options.idModal}-main-body`] = ({ route }) => {
153
+ if (route === 'calendar') {
154
+ setTimeout(() => {
155
+ resizeModal();
156
+ }, 400);
157
+ }
158
+ };
159
+
160
+ s(`.close-calendar-container`).onclick = () => {
161
+ s(`.calendar-container`).classList.add('hide');
162
+ s(`.main-body-calendar`).classList.remove('hide');
163
+ htmls(
164
+ `.style-calendar`,
165
+ html`<style>
166
+ .modal-calendar {
167
+ overflow: hidden;
168
+ }
169
+ </style>`,
170
+ );
171
+ };
172
+ });
173
+
174
+ return html`
175
+ <style>
176
+ .main-body-calendar {
177
+ overflow: auto;
178
+ }
179
+ .${idPanel}-form {
180
+ max-width: 750px !important;
181
+ }
182
+ </style>
183
+ <div class="style-calendar">
184
+ <style>
185
+ .modal-calendar {
186
+ overflow: hidden;
187
+ }
188
+ </style>
189
+ </div>
190
+
191
+ <div class="in main-body-calendar">
192
+ ${await Panel.Render({
193
+ idPanel,
194
+ parentIdModal: options.idModal,
195
+ formData,
196
+ heightTopBar,
197
+ heightBottomBar,
198
+ data,
199
+ formContainerClass: '',
200
+ customFormHeightAdjust: 120,
201
+ scrollClassContainer: 'main-body-calendar',
202
+ titleIcon: html`<i class="fas fa-calendar-alt"></i>`,
203
+ route: 'calendar',
204
+ callBackPanelRender: async function ({ data, imgRender, htmlRender }) {
205
+ return await htmlRender({
206
+ render: html`<div class="abs center">
207
+ <i class="far fa-calendar" style="font-size: 130px; color: #d3d3d3cf;"></i>
208
+ </div>`,
209
+ });
210
+ },
211
+ customButtons: [
212
+ {
213
+ label: html`<i class="fa-regular fa-calendar-days"></i> ${Translate.Render('calendar')}`,
214
+ onClick: function () {
215
+ s(`.calendar-container`).classList.remove('hide');
216
+ s(`.main-body-calendar`).classList.add('hide');
217
+ // renderCalendar();
218
+ calendar.setOption('height', 700);
219
+ Translate.Event['fullcalendar-lang']();
220
+ htmls(
221
+ `.style-calendar`,
222
+ html`<style>
223
+ .modal-calendar {
224
+ overflow: auto;
225
+ }
226
+ </style>`,
227
+ );
228
+ },
229
+ },
230
+ ],
231
+ on: {
232
+ add: async function ({ data }) {
233
+ const { status, message } = await EventSchedulerService.post({ body: data });
234
+ NotificationManager.Push({
235
+ html: status === 'success' ? Translate.Render('success-add-event-scheduler') : message,
236
+ status: status,
237
+ });
238
+ return { data, status, message };
239
+ },
240
+ },
241
+ })}
242
+ <div class="in" style="margin-bottom: 100px"></div>
243
+ </div>
244
+ <style>
245
+ .calendar-container {
246
+ color: black;
247
+ background: #fcfcfc;
248
+ }
249
+
250
+ .calendar-container a {
251
+ color: #4a4a4a;
252
+ cursor: pointer;
253
+ }
254
+ .calendar-container a:hover {
255
+ color: #8a8a8a;
256
+ }
257
+
258
+ .fc-toolbar-title {
259
+ font-size: 20px !important;
260
+ margin: 0px !important;
261
+ text-transform: uppercase;
262
+ color: #8a8a8a;
263
+ padding: 10px 5px 5px 5px;
264
+ }
265
+
266
+ .fc-button,
267
+ .fc-button-primary {
268
+ border: none !important;
269
+ border-radius: 0px !important;
270
+ background: #b1b1b1 !important;
271
+ margin: 3px !important;
272
+ /* color: #4a4a4a; */
273
+ }
274
+
275
+ .fc-button-primary:hover,
276
+ .fc-button:hover {
277
+ background: #4a4a4a !important;
278
+ /* background: #b1b1b1 !important; */
279
+ /* box-shadow: none !important;
280
+ border-radius: 0px !important;
281
+ border: none !important; */
282
+ }
283
+
284
+ .fc-button-primary:active .fc-button:active {
285
+ /* box-shadow: none !important;
286
+ border-radius: 0px !important;
287
+ border: none !important; */
288
+ }
289
+
290
+ .fc-toolbar {
291
+ display: block !important;
292
+ }
293
+
294
+ .fc-toolbar-chunk {
295
+ padding: 5px;
296
+ }
297
+
298
+ .calendar-buttons-container {
299
+ padding-bottom: 15px;
300
+ top: ${Modal.headerTitleHeight}px;
301
+ height: 60px;
302
+ z-index: 4;
303
+ }
304
+ </style>
305
+ <div class="in calendar-container hide">
306
+ <div class="stq modal calendar-buttons-container">
307
+ ${await BtnIcon.Render({
308
+ class: `section-mp btn-custom close-calendar-container flr`,
309
+ label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
310
+ type: 'button',
311
+ })}
312
+ </div>
313
+ <div class="in"><div id="calendar"></div></div>
314
+ </div>
315
+ `;
316
+ },
317
+ };
318
+
319
+ export { CalendarCore };
@@ -0,0 +1,64 @@
1
+ import { BtnIcon } from './BtnIcon.js';
2
+ import { getId, getIsoDate } from './CommonJs.js';
3
+ import { Input } from './Input.js';
4
+ import { Modal } from './Modal.js';
5
+ import { SocketIo } from './SocketIo.js';
6
+ import { Translate } from './Translate.js';
7
+ import { s, append } from './VanillaJs.js';
8
+
9
+ const Chat = {
10
+ Data: {},
11
+ Render: async function (options) {
12
+ const { idModal } = options;
13
+ this.Data[idModal] = {};
14
+ setTimeout(() => {
15
+ Modal.Data[idModal].onObserverListener[`chat-${idModal}`] = (options) => {
16
+ const { width, height } = options;
17
+ s(`.chat-box`).style.height = `${height * 0.5}px`;
18
+ };
19
+ s(`.btn-send-chat-${idModal}`).onclick = (e) => {
20
+ e.preventDefault();
21
+ if (!s(`.input-chat-${idModal}`).value) return;
22
+ this.appendChatBox({ id: SocketIo.socket.id, idModal, message: s(`.input-chat-${idModal}`).value });
23
+ SocketIo.Emit('chat', {
24
+ message: s(`.input-chat-${idModal}`).value,
25
+ });
26
+ s(`.input-chat-${idModal}`).value = '';
27
+ };
28
+ });
29
+ return html`
30
+ <form>
31
+ <div class="in section-mp chat-box ${idModal}-chat-box"></div>
32
+ ${await Input.Render({
33
+ id: `input-chat-${idModal}`,
34
+ label: html`<i class="fa-solid fa-pen-to-square"></i> ${Translate.Render('write')}`,
35
+ containerClass: 'in section-mp width-mini-box-hover input-container-width',
36
+ placeholder: true,
37
+ })}
38
+ <div class="in">
39
+ ${await BtnIcon.Render({
40
+ class: `btn-send-chat-${idModal}`,
41
+ label: Translate.Render('send'),
42
+ type: 'submit',
43
+ })}
44
+ </div>
45
+ </form>
46
+ `;
47
+ },
48
+ appendChatBox: function (options) {
49
+ const { idModal, id, message } = options;
50
+ if (!s(`.${idModal}-chat-box`)) return;
51
+ append(
52
+ `.${idModal}-chat-box`,
53
+ html`
54
+ <div class="in">
55
+ <span class="chat-message-header">${getIsoDate(new Date())} | ${id}:</span><br />
56
+ ${message}
57
+ </div>
58
+ `,
59
+ );
60
+ s(`.${idModal}-chat-box`).scrollTop = s(`.${idModal}-chat-box`).scrollHeight;
61
+ },
62
+ };
63
+
64
+ export { Chat };