underpost 2.8.1 → 2.8.7
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 +1 -0
- package/.github/workflows/ghpkg.yml +19 -49
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +12 -4
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/extensions.json +18 -71
- package/.vscode/settings.json +20 -3
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +123 -3
- package/Dockerfile +27 -70
- package/README.md +39 -29
- package/bin/build.js +186 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +1467 -236
- package/bin/file.js +67 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +1 -77
- package/bin/ssl.js +19 -11
- package/bin/util.js +9 -104
- package/bin/vs.js +26 -2
- package/cli.md +451 -0
- package/conf.js +29 -138
- package/docker-compose.yml +1 -1
- package/jsdoc.json +1 -1
- package/manifests/calico-custom-resources.yaml +25 -0
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +55 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +125 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +17 -0
- package/manifests/valkey/statefulset.yaml +41 -0
- package/package.json +127 -136
- package/src/api/core/core.service.js +1 -1
- package/src/api/default/default.service.js +1 -1
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +15 -12
- package/src/cli/cluster.js +389 -0
- package/src/cli/cron.js +121 -0
- package/src/cli/db.js +222 -0
- package/src/cli/deploy.js +487 -0
- package/src/cli/env.js +58 -0
- package/src/cli/fs.js +161 -0
- package/src/cli/image.js +66 -0
- package/src/cli/index.js +312 -0
- package/src/cli/monitor.js +236 -0
- package/src/cli/repository.js +128 -0
- package/src/cli/script.js +53 -0
- package/src/cli/secrets.js +37 -0
- package/src/cli/test.js +118 -0
- package/src/client/components/core/Account.js +28 -24
- package/src/client/components/core/Auth.js +22 -4
- package/src/client/components/core/Blockchain.js +1 -1
- package/src/client/components/core/CalendarCore.js +128 -121
- package/src/client/components/core/CommonJs.js +283 -19
- package/src/client/components/core/CssCore.js +16 -4
- package/src/client/components/core/Docs.js +1 -2
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/EventsUI.js +3 -3
- package/src/client/components/core/FileExplorer.js +86 -78
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/JoyStick.js +2 -2
- package/src/client/components/core/LoadingAnimation.js +3 -12
- package/src/client/components/core/LogIn.js +3 -3
- package/src/client/components/core/LogOut.js +1 -1
- package/src/client/components/core/Modal.js +54 -20
- package/src/client/components/core/Panel.js +109 -90
- package/src/client/components/core/PanelForm.js +23 -30
- package/src/client/components/core/Recover.js +3 -3
- package/src/client/components/core/RichText.js +1 -11
- package/src/client/components/core/Router.js +3 -1
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/SignUp.js +2 -2
- package/src/client/components/core/Translate.js +47 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/client/components/default/RoutesDefault.js +3 -2
- package/src/client/services/core/core.service.js +15 -10
- package/src/client/services/default/default.management.js +46 -37
- package/src/client/ssr/Render.js +6 -1
- package/src/client/ssr/body/CacheControl.js +2 -3
- package/src/client/sw/default.sw.js +3 -3
- package/src/db/mongo/MongooseDB.js +29 -1
- package/src/index.js +101 -19
- package/src/mailer/MailerProvider.js +3 -0
- package/src/runtime/lampp/Dockerfile +65 -0
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/backup.js +49 -93
- package/src/server/client-build.js +49 -46
- package/src/server/client-formatted.js +6 -3
- package/src/server/conf.js +297 -55
- package/src/server/dns.js +75 -62
- package/src/server/downloader.js +0 -8
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +15 -10
- package/src/server/network.js +20 -161
- package/src/server/peer.js +2 -2
- package/src/server/process.js +25 -2
- package/src/server/proxy.js +7 -29
- package/src/server/runtime.js +53 -40
- package/src/server/ssl.js +1 -1
- package/src/server/start.js +122 -0
- package/src/server/valkey.js +27 -11
- package/test/api.test.js +0 -8
- package/src/dns.js +0 -22
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
|
@@ -3,7 +3,10 @@ import { Account } from './Account.js';
|
|
|
3
3
|
import { loggerFactory } from './Logger.js';
|
|
4
4
|
import { LogIn } from './LogIn.js';
|
|
5
5
|
import { LogOut } from './LogOut.js';
|
|
6
|
+
import { NotificationManager } from './NotificationManager.js';
|
|
6
7
|
import { SignUp } from './SignUp.js';
|
|
8
|
+
import { Translate } from './Translate.js';
|
|
9
|
+
import { s } from './VanillaJs.js';
|
|
7
10
|
|
|
8
11
|
const logger = loggerFactory(import.meta);
|
|
9
12
|
|
|
@@ -65,6 +68,7 @@ const Auth = {
|
|
|
65
68
|
const _result = await UserService.get({ id: 'auth' });
|
|
66
69
|
return {
|
|
67
70
|
status: _result.status,
|
|
71
|
+
message: _result.message,
|
|
68
72
|
data: {
|
|
69
73
|
user: _result.data,
|
|
70
74
|
},
|
|
@@ -77,6 +81,15 @@ const Auth = {
|
|
|
77
81
|
await Account.updateForm(data.user);
|
|
78
82
|
return { user: data.user };
|
|
79
83
|
}
|
|
84
|
+
if (message && message.match('expired'))
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
s(`.main-btn-log-in`).click();
|
|
87
|
+
NotificationManager.Push({
|
|
88
|
+
html: Translate.Render(`expired-session`),
|
|
89
|
+
status: 'warning',
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
return await Auth.sessionOut();
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
// anon guest session
|
|
@@ -92,20 +105,25 @@ const Auth = {
|
|
|
92
105
|
|
|
93
106
|
this.setGuestToken(guestToken);
|
|
94
107
|
let { data, status, message } = await UserService.get({ id: 'auth' });
|
|
95
|
-
if (status === 'error')
|
|
108
|
+
if (status === 'error') {
|
|
109
|
+
if (message && message.match('expired')) {
|
|
110
|
+
localStorage.removeItem('jwt.g');
|
|
111
|
+
return await Auth.sessionOut();
|
|
112
|
+
} else throw new Error(message);
|
|
113
|
+
}
|
|
96
114
|
await Account.updateForm(data);
|
|
97
115
|
return { user: data };
|
|
98
116
|
} catch (error) {
|
|
99
117
|
logger.error(error);
|
|
100
|
-
localStorage.removeItem('jwt');
|
|
101
|
-
localStorage.removeItem('jwt.g');
|
|
102
118
|
return { user: UserMock.default };
|
|
103
119
|
}
|
|
104
120
|
},
|
|
105
121
|
sessionOut: async function () {
|
|
106
122
|
this.deleteToken();
|
|
107
123
|
localStorage.removeItem('jwt');
|
|
108
|
-
|
|
124
|
+
const result = await this.sessionIn();
|
|
125
|
+
await LogOut.Trigger(result);
|
|
126
|
+
return result;
|
|
109
127
|
},
|
|
110
128
|
};
|
|
111
129
|
|
|
@@ -25,7 +25,7 @@ const BlockChainManagement = {
|
|
|
25
25
|
placeholder: true,
|
|
26
26
|
})}
|
|
27
27
|
${await BtnIcon.Render({
|
|
28
|
-
class: `section-mp btn-custom btn-upload-blockchain`,
|
|
28
|
+
class: `inl section-mp btn-custom btn-upload-blockchain`,
|
|
29
29
|
label: html`<i class="fas fa-plus"></i> ${Translate.Render(`create`)}`,
|
|
30
30
|
})}
|
|
31
31
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventSchedulerService } from '../../services/event-scheduler/event-scheduler.service.js';
|
|
2
2
|
import { Auth } from './Auth.js';
|
|
3
3
|
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
-
import { newInstance, range, s4 } from './CommonJs.js';
|
|
4
|
+
import { isValidDate, newInstance, range, s4 } from './CommonJs.js';
|
|
5
5
|
import { renderCssAttr } from './Css.js';
|
|
6
6
|
import { Modal } from './Modal.js';
|
|
7
7
|
import { NotificationManager } from './NotificationManager.js';
|
|
@@ -13,83 +13,116 @@ import { append, getQueryParams, getTimeZone, htmls, s, sa } from './VanillaJs.j
|
|
|
13
13
|
|
|
14
14
|
// https://fullcalendar.io/docs/event-object
|
|
15
15
|
|
|
16
|
+
const daysOfWeekOptions = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
17
|
+
|
|
18
|
+
const eventDateFactory = (event) =>
|
|
19
|
+
newInstance({
|
|
20
|
+
event: { ...event.extendedProps, title: event._def.title },
|
|
21
|
+
start: event.start,
|
|
22
|
+
end: event.end,
|
|
23
|
+
});
|
|
24
|
+
|
|
16
25
|
const CalendarCore = {
|
|
17
26
|
RenderStyle: async function () {},
|
|
18
27
|
Data: {},
|
|
19
|
-
Render: async function (
|
|
28
|
+
Render: async function (
|
|
29
|
+
options = { idModal: '', Elements: {}, heightTopBar: 50, heightBottomBar: 50, hiddenDates: [] },
|
|
30
|
+
) {
|
|
20
31
|
this.Data[options.idModal] = {
|
|
21
32
|
data: [],
|
|
22
33
|
originData: [],
|
|
23
34
|
filesData: [],
|
|
24
35
|
calendar: {},
|
|
36
|
+
hiddenDates: options.hiddenDates ? options.hiddenDates : [],
|
|
25
37
|
};
|
|
26
38
|
|
|
27
39
|
const { heightTopBar, heightBottomBar } = options;
|
|
28
40
|
|
|
29
41
|
const titleIcon = html`<i class="fas fa-calendar-alt"></i>`;
|
|
30
42
|
|
|
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
43
|
const getPanelData = async () => {
|
|
55
44
|
const result = await EventSchedulerService.get({
|
|
56
|
-
id: `${getQueryParams().cid ? getQueryParams().cid : 'creatorUser'}`,
|
|
45
|
+
id: `${getQueryParams().cid ? getQueryParams().cid : Auth.getToken() ? 'creatorUser' : ''}`,
|
|
57
46
|
});
|
|
58
47
|
NotificationManager.Push({
|
|
59
48
|
html: result.status === 'success' ? Translate.Render('success-get-events-scheduler') : result.message,
|
|
60
49
|
status: result.status,
|
|
61
50
|
});
|
|
62
51
|
if (result.status === 'success') {
|
|
63
|
-
const resultData = Array.isArray(result.data) ? result.data : [result.data];
|
|
52
|
+
const resultData = Array.isArray(result.data) ? result.data : result.data ? [result.data] : [];
|
|
64
53
|
this.Data[options.idModal].filesData = [];
|
|
65
54
|
this.Data[options.idModal].originData = newInstance(resultData);
|
|
66
55
|
this.Data[options.idModal].data = resultData.map((o) => {
|
|
67
56
|
if (o.creatorUserId && options.Elements.Data.user.main.model.user._id === o.creatorUserId) o.tools = true;
|
|
68
57
|
o.id = o._id;
|
|
69
|
-
|
|
70
|
-
o.end = dateFormat(o.end);
|
|
58
|
+
|
|
71
59
|
this.Data[options.idModal].filesData.push({});
|
|
72
60
|
return o;
|
|
73
61
|
});
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
renderCalendar(
|
|
64
|
+
resultData.map((o) => {
|
|
65
|
+
// FREQ=WEEKLY;
|
|
66
|
+
// if (o.daysOfWeek && o.daysOfWeek.length > 0) {
|
|
67
|
+
// o.rrule = `RRULE:BYDAY=${o.daysOfWeek.map((d) => `${d[0]}${d[1]}`.toUpperCase()).join(',')}`;
|
|
68
|
+
// }
|
|
69
|
+
// o.rrule = 'FREQ=WEEKLY;BYDAY=SU;BYHOUR=10,11;COUNT=10';
|
|
70
|
+
if (o.daysOfWeek && o.daysOfWeek.length > 0)
|
|
71
|
+
o.daysOfWeek = o.daysOfWeek.map((v, i) => daysOfWeekOptions.indexOf(v));
|
|
72
|
+
else delete o.daysOfWeek;
|
|
73
|
+
// o.exdate = ['2024-04-02'];
|
|
74
|
+
// delete o.end;
|
|
75
|
+
// delete o.start;
|
|
76
|
+
|
|
77
|
+
return o;
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
80
|
+
});
|
|
74
81
|
}
|
|
75
82
|
};
|
|
76
83
|
|
|
77
|
-
const renderCalendar = () => {
|
|
84
|
+
const renderCalendar = (events) => {
|
|
78
85
|
const calendarEl = s(`.calendar-${idPanel}`);
|
|
79
86
|
this.Data[options.idModal].calendar = new FullCalendar.Calendar(calendarEl, {
|
|
80
|
-
|
|
87
|
+
allDaySlot: false,
|
|
88
|
+
plugins: [
|
|
89
|
+
FullCalendar.DayGrid.default,
|
|
90
|
+
FullCalendar.TimeGrid.default,
|
|
91
|
+
FullCalendar.List.default,
|
|
92
|
+
// https://fullcalendar.io/docs/rrule-plugin
|
|
93
|
+
FullCalendar.RRule.default,
|
|
94
|
+
],
|
|
81
95
|
// initialView: 'dayGridWeek',
|
|
82
96
|
timeZone: getTimeZone(),
|
|
83
97
|
dateClick: function (arg) {
|
|
84
98
|
console.error('calendar dateClick', arg.date.toString());
|
|
85
99
|
},
|
|
86
|
-
events: [{ title: 'Meeting', start: new Date() }],
|
|
100
|
+
events: events ?? [{ title: 'Meeting', start: new Date() }],
|
|
87
101
|
initialView: 'dayGridMonth',
|
|
88
102
|
headerToolbar: {
|
|
89
103
|
left: 'prev,next today',
|
|
90
104
|
center: 'title',
|
|
91
105
|
right: 'dayGridMonth,timeGridWeek,listWeek',
|
|
92
106
|
},
|
|
107
|
+
eventClick: async function (args) {
|
|
108
|
+
const dateData = eventDateFactory(args.event);
|
|
109
|
+
// element -> args.el
|
|
110
|
+
// remove all events associated -> args.event.remove();
|
|
111
|
+
// console.error('eventClick', JSON.stringify(dateData, null, 4));
|
|
112
|
+
if (options.eventClick) await options.eventClick(dateData, args);
|
|
113
|
+
},
|
|
114
|
+
eventClassNames: function (args) {
|
|
115
|
+
// console.error('eventClassNames', JSON.stringify(dateData, null, 4));
|
|
116
|
+
if (!args.event.extendedProps._id) return args.event.remove();
|
|
117
|
+
const dateData = eventDateFactory(args.event);
|
|
118
|
+
if (
|
|
119
|
+
new Date(dateData.start).getTime() <= new Date().getTime() ||
|
|
120
|
+
CalendarCore.Data[options.idModal].hiddenDates.find(
|
|
121
|
+
(d) => d.eventSchedulerId === dateData.event._id && d.date === dateData.start,
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
return ['hide'];
|
|
125
|
+
},
|
|
93
126
|
});
|
|
94
127
|
|
|
95
128
|
this.Data[options.idModal].calendar.render();
|
|
@@ -139,63 +172,60 @@ const CalendarCore = {
|
|
|
139
172
|
rules: [{ type: 'isEmpty' }],
|
|
140
173
|
},
|
|
141
174
|
{
|
|
142
|
-
id: '
|
|
143
|
-
model: '
|
|
175
|
+
id: 'title',
|
|
176
|
+
model: 'title',
|
|
144
177
|
inputType: 'text',
|
|
145
178
|
rules: [{ type: 'isEmpty' }],
|
|
146
179
|
panel: { type: 'title' },
|
|
147
180
|
},
|
|
148
181
|
{
|
|
149
|
-
id: '
|
|
150
|
-
model: '
|
|
151
|
-
inputType: '
|
|
152
|
-
rules: [],
|
|
153
|
-
panel: { type: 'info-row'
|
|
182
|
+
id: 'description',
|
|
183
|
+
model: 'description',
|
|
184
|
+
inputType: 'text',
|
|
185
|
+
rules: [{ type: 'isEmpty' }],
|
|
186
|
+
panel: { type: 'info-row' },
|
|
154
187
|
},
|
|
155
188
|
{
|
|
156
189
|
id: 'start',
|
|
157
190
|
model: 'start',
|
|
158
191
|
inputType: 'datetime-local',
|
|
159
|
-
|
|
192
|
+
translateCode: 'startTime',
|
|
193
|
+
panel: { type: 'info-row' },
|
|
160
194
|
},
|
|
161
195
|
{
|
|
162
196
|
id: 'end',
|
|
163
197
|
model: 'end',
|
|
164
198
|
inputType: 'datetime-local',
|
|
199
|
+
translateCode: 'endTime',
|
|
200
|
+
panel: { type: 'info-row' },
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'daysOfWeek',
|
|
204
|
+
model: 'daysOfWeek',
|
|
205
|
+
inputType: 'dropdown-checkbox',
|
|
206
|
+
dropdown: {
|
|
207
|
+
options: daysOfWeekOptions,
|
|
208
|
+
},
|
|
209
|
+
panel: { type: 'list' },
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: 'startTime',
|
|
213
|
+
model: 'startTime',
|
|
214
|
+
inputType: 'time',
|
|
215
|
+
panel: { type: 'info-row' },
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: 'endTime',
|
|
219
|
+
model: 'endTime',
|
|
220
|
+
inputType: 'time',
|
|
165
221
|
panel: { type: 'info-row' },
|
|
166
222
|
},
|
|
167
223
|
];
|
|
168
224
|
|
|
169
225
|
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
226
|
s(`.close-calendar-container`).onclick = () => {
|
|
189
227
|
s(`.calendar-container`).classList.add('hide');
|
|
190
228
|
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
229
|
};
|
|
200
230
|
});
|
|
201
231
|
|
|
@@ -209,14 +239,14 @@ const CalendarCore = {
|
|
|
209
239
|
data: this.Data[options.idModal].data,
|
|
210
240
|
formContainerClass: '',
|
|
211
241
|
scrollClassContainer: `main-body-calendar-${options.idModal}`,
|
|
242
|
+
role: options.role,
|
|
212
243
|
originData: () => this.Data[options.idModal].originData,
|
|
213
244
|
filesData: () => this.Data[options.idModal].filesData,
|
|
214
245
|
onClick: async function ({ payload }) {
|
|
215
246
|
if (options.route) {
|
|
216
247
|
setQueryPath({ path: options.route, queryPath: payload._id });
|
|
217
248
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
218
|
-
|
|
219
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
249
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
220
250
|
}
|
|
221
251
|
},
|
|
222
252
|
titleIcon,
|
|
@@ -237,25 +267,24 @@ const CalendarCore = {
|
|
|
237
267
|
// renderCalendar();
|
|
238
268
|
CalendarCore.Data[options.idModal].calendar.setOption('height', 700);
|
|
239
269
|
Translate.Event['fullcalendar-lang']();
|
|
240
|
-
htmls(
|
|
241
|
-
`.style-calendar`,
|
|
242
|
-
html`<style>
|
|
243
|
-
.modal-calendar {
|
|
244
|
-
overflow: auto;
|
|
245
|
-
}
|
|
246
|
-
</style>`,
|
|
247
|
-
);
|
|
248
270
|
},
|
|
249
271
|
},
|
|
250
272
|
],
|
|
251
273
|
on: {
|
|
252
274
|
add: async function ({ data, editId }) {
|
|
275
|
+
if (data.daysOfWeek && data.daysOfWeek.length > 0 && daysOfWeekOptions[data.daysOfWeek[0]]) {
|
|
276
|
+
data.daysOfWeek = data.daysOfWeek.map((d) => daysOfWeekOptions[d]);
|
|
277
|
+
}
|
|
278
|
+
data.timeZoneClient = getTimeZone();
|
|
253
279
|
const {
|
|
254
280
|
status,
|
|
255
281
|
message,
|
|
256
282
|
data: documentData,
|
|
257
283
|
} = editId
|
|
258
|
-
? await EventSchedulerService.put({
|
|
284
|
+
? await EventSchedulerService.put({
|
|
285
|
+
id: editId,
|
|
286
|
+
body: { ...data, _id: undefined },
|
|
287
|
+
})
|
|
259
288
|
: await EventSchedulerService.post({ body: data });
|
|
260
289
|
NotificationManager.Push({
|
|
261
290
|
html:
|
|
@@ -268,10 +297,9 @@ const CalendarCore = {
|
|
|
268
297
|
});
|
|
269
298
|
|
|
270
299
|
if (status === 'success') {
|
|
271
|
-
|
|
272
|
-
data.
|
|
273
|
-
data
|
|
274
|
-
data._id = documentData._id;
|
|
300
|
+
documentData.tools = true;
|
|
301
|
+
// data._id = documentData._id;
|
|
302
|
+
data = documentData;
|
|
275
303
|
|
|
276
304
|
let originObj, indexOriginObj;
|
|
277
305
|
let filesData = {};
|
|
@@ -291,8 +319,7 @@ const CalendarCore = {
|
|
|
291
319
|
|
|
292
320
|
setQueryPath({ path: options.route, queryPath: documentData._id });
|
|
293
321
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
294
|
-
|
|
295
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
322
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
296
323
|
}
|
|
297
324
|
return { data, status, message };
|
|
298
325
|
},
|
|
@@ -319,11 +346,8 @@ const CalendarCore = {
|
|
|
319
346
|
status,
|
|
320
347
|
});
|
|
321
348
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
325
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
326
|
-
}
|
|
349
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
350
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
327
351
|
|
|
328
352
|
return { status };
|
|
329
353
|
}
|
|
@@ -335,50 +359,35 @@ const CalendarCore = {
|
|
|
335
359
|
};
|
|
336
360
|
|
|
337
361
|
let lastCid;
|
|
338
|
-
let lasUserId;
|
|
339
362
|
this.Data[options.idModal].updatePanel = async () => {
|
|
340
363
|
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
341
|
-
if (lastCid === cid
|
|
342
|
-
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
343
|
-
lasUserId = newInstance(options.Elements.Data.user.main.model.user._id);
|
|
364
|
+
if (lastCid === cid) return;
|
|
344
365
|
lastCid = cid;
|
|
366
|
+
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
345
367
|
if (s(`.main-body-calendar-${options.idModal}`)) {
|
|
346
|
-
if (Auth.getToken())
|
|
347
|
-
else getSrrData();
|
|
368
|
+
// if (Auth.getToken())
|
|
369
|
+
// else getSrrData();
|
|
370
|
+
await getPanelData();
|
|
348
371
|
htmls(`.main-body-calendar-${options.idModal}`, await panelRender());
|
|
349
372
|
}
|
|
350
373
|
};
|
|
351
374
|
|
|
352
|
-
if (options.route)
|
|
375
|
+
if (options.route) {
|
|
353
376
|
listenQueryPathInstance({
|
|
354
377
|
id: options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body',
|
|
355
378
|
routeId: options.route,
|
|
356
379
|
event: async (path) => {
|
|
357
|
-
|
|
358
|
-
CalendarCore.Data[options.idModal].updatePanel();
|
|
359
|
-
});
|
|
380
|
+
CalendarCore.Data[options.idModal].updatePanel();
|
|
360
381
|
},
|
|
361
382
|
});
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
383
|
+
if (!options.parentIdModal)
|
|
384
|
+
Modal.Data['modal-menu'].onHome[idPanel] = async () => {
|
|
385
|
+
lastCid = undefined;
|
|
386
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
387
|
+
await this.Data[idPanel].updatePanel();
|
|
388
|
+
};
|
|
389
|
+
}
|
|
365
390
|
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
391
|
<div class="in main-body-calendar-${options.idModal}">${await panelRender()}</div>
|
|
383
392
|
<style>
|
|
384
393
|
.calendar-container {
|
|
@@ -436,15 +445,13 @@ const CalendarCore = {
|
|
|
436
445
|
|
|
437
446
|
.calendar-buttons-container {
|
|
438
447
|
padding-bottom: 15px;
|
|
439
|
-
top: ${Modal.headerTitleHeight}px;
|
|
440
448
|
height: 60px;
|
|
441
|
-
z-index: 4;
|
|
442
449
|
}
|
|
443
450
|
</style>
|
|
444
451
|
<div class="in calendar-container hide">
|
|
445
|
-
<div class="
|
|
452
|
+
<div class="in modal calendar-buttons-container">
|
|
446
453
|
${await BtnIcon.Render({
|
|
447
|
-
class: `section-mp btn-custom close-calendar-container flr`,
|
|
454
|
+
class: `inl section-mp btn-custom close-calendar-container flr`,
|
|
448
455
|
label: html`<i class="fa-solid fa-xmark"></i> ${Translate.Render('close')}`,
|
|
449
456
|
type: 'button',
|
|
450
457
|
})}
|