@underpostnet/underpost 2.8.0 → 2.8.4
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 +14 -11
- package/.github/workflows/pwa-microservices-template.page.yml +10 -3
- package/.vscode/extensions.json +17 -71
- package/.vscode/settings.json +12 -5
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +63 -3
- package/Dockerfile +41 -62
- package/README.md +1 -28
- package/bin/build.js +278 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +107 -71
- package/bin/file.js +33 -4
- package/bin/index.js +35 -54
- package/bin/ssl.js +19 -11
- package/bin/util.js +27 -89
- package/bin/vs.js +25 -2
- package/conf.js +32 -132
- package/docker-compose.yml +1 -1
- package/manifests/core/kustomization.yaml +11 -0
- package/manifests/core/underpost-engine-backup-access.yaml +16 -0
- package/manifests/core/underpost-engine-backup-pv-pvc.yaml +22 -0
- package/manifests/core/underpost-engine-headless-service.yaml +10 -0
- package/manifests/core/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
- package/manifests/core/underpost-engine-mongodb-configmap.yaml +26 -0
- package/manifests/core/underpost-engine-pv-pvc.yaml +23 -0
- package/manifests/core/underpost-engine-statefulset.yaml +91 -0
- package/manifests/deployment/mongo-express.yaml +60 -0
- package/manifests/deployment/phpmyadmin.yaml +54 -0
- package/manifests/kind-config.yaml +12 -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/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
- package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
- package/package.json +16 -35
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +1 -1
- package/src/client/components/core/Account.js +4 -2
- package/src/client/components/core/Auth.js +2 -2
- package/src/client/components/core/CalendarCore.js +115 -49
- package/src/client/components/core/CommonJs.js +150 -19
- package/src/client/components/core/Css.js +1 -1
- package/src/client/components/core/CssCore.js +6 -0
- package/src/client/components/core/Docs.js +2 -1
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +17 -3
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/Modal.js +17 -11
- package/src/client/components/core/Panel.js +85 -25
- package/src/client/components/core/PanelForm.js +11 -19
- package/src/client/components/core/SignUp.js +4 -1
- package/src/client/components/core/Translate.js +57 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/services/core/core.service.js +2 -0
- package/src/client/services/default/default.management.js +4 -2
- package/src/client/ssr/body/CacheControl.js +2 -1
- package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/sw/default.sw.js +23 -3
- package/src/db/mongo/MongooseDB.js +13 -1
- package/src/index.js +15 -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/client-build.js +8 -17
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +299 -32
- package/src/server/dns.js +2 -3
- package/src/server/logger.js +18 -11
- package/src/server/network.js +0 -36
- package/src/server/process.js +25 -2
- package/src/server/project.js +39 -0
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +6 -7
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +3 -0
- package/startup.cjs +12 -0
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Schema, model } from 'mongoose';
|
|
2
2
|
import validator from 'validator';
|
|
3
|
+
import { userRoleEnum } from '../../client/components/core/CommonJs.js';
|
|
3
4
|
|
|
4
5
|
// https://mongoosejs.com/docs/2.7.x/docs/schematypes.html
|
|
5
6
|
|
|
6
|
-
const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
|
|
7
|
-
|
|
8
7
|
const UserSchema = new Schema(
|
|
9
8
|
{
|
|
10
9
|
email: {
|
|
@@ -26,7 +25,11 @@ const UserSchema = new Schema(
|
|
|
26
25
|
profileImageId: { type: Schema.Types.ObjectId, ref: 'File' },
|
|
27
26
|
phoneNumbers: [
|
|
28
27
|
{
|
|
29
|
-
type: {
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
enum: ['office', 'home', 'private'],
|
|
31
|
+
},
|
|
32
|
+
number: { type: String },
|
|
30
33
|
},
|
|
31
34
|
],
|
|
32
35
|
publicKey: {
|
|
@@ -38,6 +41,12 @@ const UserSchema = new Schema(
|
|
|
38
41
|
],
|
|
39
42
|
default: [],
|
|
40
43
|
},
|
|
44
|
+
associatedCompanies: [
|
|
45
|
+
{
|
|
46
|
+
company: { type: Schema.Types.ObjectId, ref: 'Company', required: true },
|
|
47
|
+
context: [{ type: String, enum: ['client', 'supplier', 'employee', 'owner'] }],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
41
50
|
},
|
|
42
51
|
{
|
|
43
52
|
timestamps: true,
|
|
@@ -58,6 +67,10 @@ const UserDto = {
|
|
|
58
67
|
},
|
|
59
68
|
},
|
|
60
69
|
auth: {
|
|
70
|
+
// TODO: -> set login device, location, ip, fingerprint
|
|
71
|
+
// and validate on authorization middleware
|
|
72
|
+
// -> dynamic refresh 100 tokens per session with 12h interval
|
|
73
|
+
// -> back secret per user, registrarion user model -> secret: { type: String }
|
|
61
74
|
payload: (user) => ({ _id: user._id.toString(), role: user.role, email: user.email }),
|
|
62
75
|
},
|
|
63
76
|
};
|
|
@@ -237,7 +237,7 @@ const UserService = {
|
|
|
237
237
|
const validatePassword = validatePasswordMiddleware(req.body.password);
|
|
238
238
|
if (validatePassword.status === 'error') throw new Error(validatePassword.message);
|
|
239
239
|
req.body.password = await hashPassword(req.body.password);
|
|
240
|
-
req.body.role = 'user';
|
|
240
|
+
req.body.role = req.body.role === 'guest' ? 'guest' : 'user';
|
|
241
241
|
req.body.profileImageId = await getDefaultProfileImageId(File);
|
|
242
242
|
const { _id } = await new User(req.body).save();
|
|
243
243
|
if (_id) {
|
|
@@ -300,8 +300,10 @@ const Account = {
|
|
|
300
300
|
s(`.account-profile-image`).style.opacity = 0;
|
|
301
301
|
for (const inputData of this.formData)
|
|
302
302
|
if (s(`.${inputData.id}`)) s(`.${inputData.id}`).value = user[inputData.model];
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
if (LogIn.Scope.user.main.model.user.profileImage) {
|
|
304
|
+
s(`.account-profile-image`).src = LogIn.Scope.user.main.model.user.profileImage.imageSrc;
|
|
305
|
+
s(`.account-profile-image`).style.opacity = 1;
|
|
306
|
+
}
|
|
305
307
|
},
|
|
306
308
|
};
|
|
307
309
|
|
|
@@ -46,8 +46,8 @@ const Auth = {
|
|
|
46
46
|
) {
|
|
47
47
|
try {
|
|
48
48
|
localStorage.setItem('jwt', result.data.token);
|
|
49
|
-
await Auth.sessionIn();
|
|
50
49
|
await SignUp.Trigger(result.data);
|
|
50
|
+
await Auth.sessionIn();
|
|
51
51
|
} catch (error) {
|
|
52
52
|
logger.error(error);
|
|
53
53
|
localStorage.removeItem('jwt');
|
|
@@ -76,7 +76,7 @@ const Auth = {
|
|
|
76
76
|
await LogIn.Trigger({ user: data.user });
|
|
77
77
|
await Account.updateForm(data.user);
|
|
78
78
|
return { user: data.user };
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// anon guest session
|
|
@@ -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,15 +13,27 @@ 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;
|
|
@@ -40,56 +52,89 @@ const CalendarCore = {
|
|
|
40
52
|
};
|
|
41
53
|
getSrrData();
|
|
42
54
|
|
|
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
55
|
const getPanelData = async () => {
|
|
55
56
|
const result = await EventSchedulerService.get({
|
|
56
|
-
id: `${getQueryParams().cid ? getQueryParams().cid : 'creatorUser'}`,
|
|
57
|
+
id: `${getQueryParams().cid ? getQueryParams().cid : Auth.getToken() ? 'creatorUser' : ''}`,
|
|
57
58
|
});
|
|
58
59
|
NotificationManager.Push({
|
|
59
60
|
html: result.status === 'success' ? Translate.Render('success-get-events-scheduler') : result.message,
|
|
60
61
|
status: result.status,
|
|
61
62
|
});
|
|
62
63
|
if (result.status === 'success') {
|
|
63
|
-
const resultData = Array.isArray(result.data) ? result.data : [result.data];
|
|
64
|
+
const resultData = Array.isArray(result.data) ? result.data : result.data ? [result.data] : [];
|
|
64
65
|
this.Data[options.idModal].filesData = [];
|
|
65
66
|
this.Data[options.idModal].originData = newInstance(resultData);
|
|
66
67
|
this.Data[options.idModal].data = resultData.map((o) => {
|
|
67
68
|
if (o.creatorUserId && options.Elements.Data.user.main.model.user._id === o.creatorUserId) o.tools = true;
|
|
68
69
|
o.id = o._id;
|
|
69
|
-
|
|
70
|
-
o.end = dateFormat(o.end);
|
|
70
|
+
|
|
71
71
|
this.Data[options.idModal].filesData.push({});
|
|
72
72
|
return o;
|
|
73
73
|
});
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
renderCalendar(
|
|
76
|
+
resultData.map((o) => {
|
|
77
|
+
// FREQ=WEEKLY;
|
|
78
|
+
// if (o.daysOfWeek && o.daysOfWeek.length > 0) {
|
|
79
|
+
// o.rrule = `RRULE:BYDAY=${o.daysOfWeek.map((d) => `${d[0]}${d[1]}`.toUpperCase()).join(',')}`;
|
|
80
|
+
// }
|
|
81
|
+
// o.rrule = 'FREQ=WEEKLY;BYDAY=SU;BYHOUR=10,11;COUNT=10';
|
|
82
|
+
if (o.daysOfWeek && o.daysOfWeek.length > 0)
|
|
83
|
+
o.daysOfWeek = o.daysOfWeek.map((v, i) => daysOfWeekOptions.indexOf(v));
|
|
84
|
+
else delete o.daysOfWeek;
|
|
85
|
+
// o.exdate = ['2024-04-02'];
|
|
86
|
+
// delete o.end;
|
|
87
|
+
// delete o.start;
|
|
88
|
+
|
|
89
|
+
return o;
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
});
|
|
74
93
|
}
|
|
75
94
|
};
|
|
76
95
|
|
|
77
|
-
const renderCalendar = () => {
|
|
96
|
+
const renderCalendar = (events) => {
|
|
78
97
|
const calendarEl = s(`.calendar-${idPanel}`);
|
|
79
98
|
this.Data[options.idModal].calendar = new FullCalendar.Calendar(calendarEl, {
|
|
80
|
-
|
|
99
|
+
allDaySlot: false,
|
|
100
|
+
plugins: [
|
|
101
|
+
FullCalendar.DayGrid.default,
|
|
102
|
+
FullCalendar.TimeGrid.default,
|
|
103
|
+
FullCalendar.List.default,
|
|
104
|
+
// https://fullcalendar.io/docs/rrule-plugin
|
|
105
|
+
FullCalendar.RRule.default,
|
|
106
|
+
],
|
|
81
107
|
// initialView: 'dayGridWeek',
|
|
82
108
|
timeZone: getTimeZone(),
|
|
83
109
|
dateClick: function (arg) {
|
|
84
110
|
console.error('calendar dateClick', arg.date.toString());
|
|
85
111
|
},
|
|
86
|
-
events: [{ title: 'Meeting', start: new Date() }],
|
|
112
|
+
events: events ?? [{ title: 'Meeting', start: new Date() }],
|
|
87
113
|
initialView: 'dayGridMonth',
|
|
88
114
|
headerToolbar: {
|
|
89
115
|
left: 'prev,next today',
|
|
90
116
|
center: 'title',
|
|
91
117
|
right: 'dayGridMonth,timeGridWeek,listWeek',
|
|
92
118
|
},
|
|
119
|
+
eventClick: async function (args) {
|
|
120
|
+
const dateData = eventDateFactory(args.event);
|
|
121
|
+
// element -> args.el
|
|
122
|
+
// remove all events associated -> args.event.remove();
|
|
123
|
+
// console.error('eventClick', JSON.stringify(dateData, null, 4));
|
|
124
|
+
if (options.eventClick) await options.eventClick(dateData, args);
|
|
125
|
+
},
|
|
126
|
+
eventClassNames: function (args) {
|
|
127
|
+
// console.error('eventClassNames', JSON.stringify(dateData, null, 4));
|
|
128
|
+
if (!args.event.extendedProps._id) return args.event.remove();
|
|
129
|
+
const dateData = eventDateFactory(args.event);
|
|
130
|
+
if (
|
|
131
|
+
new Date(dateData.start).getTime() <= new Date().getTime() ||
|
|
132
|
+
CalendarCore.Data[options.idModal].hiddenDates.find(
|
|
133
|
+
(d) => d.eventSchedulerId === dateData.event._id && d.date === dateData.start,
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
return ['hide'];
|
|
137
|
+
},
|
|
93
138
|
});
|
|
94
139
|
|
|
95
140
|
this.Data[options.idModal].calendar.render();
|
|
@@ -139,29 +184,52 @@ const CalendarCore = {
|
|
|
139
184
|
rules: [{ type: 'isEmpty' }],
|
|
140
185
|
},
|
|
141
186
|
{
|
|
142
|
-
id: '
|
|
143
|
-
model: '
|
|
187
|
+
id: 'title',
|
|
188
|
+
model: 'title',
|
|
144
189
|
inputType: 'text',
|
|
145
190
|
rules: [{ type: 'isEmpty' }],
|
|
146
191
|
panel: { type: 'title' },
|
|
147
192
|
},
|
|
148
193
|
{
|
|
149
|
-
id: '
|
|
150
|
-
model: '
|
|
151
|
-
inputType: '
|
|
152
|
-
rules: [],
|
|
153
|
-
panel: { type: 'info-row'
|
|
194
|
+
id: 'description',
|
|
195
|
+
model: 'description',
|
|
196
|
+
inputType: 'text',
|
|
197
|
+
rules: [{ type: 'isEmpty' }],
|
|
198
|
+
panel: { type: 'info-row' },
|
|
154
199
|
},
|
|
155
200
|
{
|
|
156
201
|
id: 'start',
|
|
157
202
|
model: 'start',
|
|
158
203
|
inputType: 'datetime-local',
|
|
159
|
-
|
|
204
|
+
translateCode: 'startTime',
|
|
205
|
+
panel: { type: 'info-row' },
|
|
160
206
|
},
|
|
161
207
|
{
|
|
162
208
|
id: 'end',
|
|
163
209
|
model: 'end',
|
|
164
210
|
inputType: 'datetime-local',
|
|
211
|
+
translateCode: 'endTime',
|
|
212
|
+
panel: { type: 'info-row' },
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'daysOfWeek',
|
|
216
|
+
model: 'daysOfWeek',
|
|
217
|
+
inputType: 'dropdown-checkbox',
|
|
218
|
+
dropdown: {
|
|
219
|
+
options: daysOfWeekOptions,
|
|
220
|
+
},
|
|
221
|
+
panel: { type: 'list' },
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: 'startTime',
|
|
225
|
+
model: 'startTime',
|
|
226
|
+
inputType: 'time',
|
|
227
|
+
panel: { type: 'info-row' },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: 'endTime',
|
|
231
|
+
model: 'endTime',
|
|
232
|
+
inputType: 'time',
|
|
165
233
|
panel: { type: 'info-row' },
|
|
166
234
|
},
|
|
167
235
|
];
|
|
@@ -209,14 +277,14 @@ const CalendarCore = {
|
|
|
209
277
|
data: this.Data[options.idModal].data,
|
|
210
278
|
formContainerClass: '',
|
|
211
279
|
scrollClassContainer: `main-body-calendar-${options.idModal}`,
|
|
280
|
+
role: options.role,
|
|
212
281
|
originData: () => this.Data[options.idModal].originData,
|
|
213
282
|
filesData: () => this.Data[options.idModal].filesData,
|
|
214
283
|
onClick: async function ({ payload }) {
|
|
215
284
|
if (options.route) {
|
|
216
285
|
setQueryPath({ path: options.route, queryPath: payload._id });
|
|
217
286
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
218
|
-
|
|
219
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
287
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
220
288
|
}
|
|
221
289
|
},
|
|
222
290
|
titleIcon,
|
|
@@ -250,12 +318,19 @@ const CalendarCore = {
|
|
|
250
318
|
],
|
|
251
319
|
on: {
|
|
252
320
|
add: async function ({ data, editId }) {
|
|
321
|
+
if (data.daysOfWeek && data.daysOfWeek.length > 0 && daysOfWeekOptions[data.daysOfWeek[0]]) {
|
|
322
|
+
data.daysOfWeek = data.daysOfWeek.map((d) => daysOfWeekOptions[d]);
|
|
323
|
+
}
|
|
324
|
+
data.timeZoneClient = getTimeZone();
|
|
253
325
|
const {
|
|
254
326
|
status,
|
|
255
327
|
message,
|
|
256
328
|
data: documentData,
|
|
257
329
|
} = editId
|
|
258
|
-
? await EventSchedulerService.put({
|
|
330
|
+
? await EventSchedulerService.put({
|
|
331
|
+
id: editId,
|
|
332
|
+
body: { ...data, _id: undefined },
|
|
333
|
+
})
|
|
259
334
|
: await EventSchedulerService.post({ body: data });
|
|
260
335
|
NotificationManager.Push({
|
|
261
336
|
html:
|
|
@@ -268,10 +343,9 @@ const CalendarCore = {
|
|
|
268
343
|
});
|
|
269
344
|
|
|
270
345
|
if (status === 'success') {
|
|
271
|
-
|
|
272
|
-
data.
|
|
273
|
-
data
|
|
274
|
-
data._id = documentData._id;
|
|
346
|
+
documentData.tools = true;
|
|
347
|
+
// data._id = documentData._id;
|
|
348
|
+
data = documentData;
|
|
275
349
|
|
|
276
350
|
let originObj, indexOriginObj;
|
|
277
351
|
let filesData = {};
|
|
@@ -291,8 +365,7 @@ const CalendarCore = {
|
|
|
291
365
|
|
|
292
366
|
setQueryPath({ path: options.route, queryPath: documentData._id });
|
|
293
367
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
294
|
-
|
|
295
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
368
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
296
369
|
}
|
|
297
370
|
return { data, status, message };
|
|
298
371
|
},
|
|
@@ -319,11 +392,8 @@ const CalendarCore = {
|
|
|
319
392
|
status,
|
|
320
393
|
});
|
|
321
394
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
325
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
326
|
-
}
|
|
395
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
396
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
327
397
|
|
|
328
398
|
return { status };
|
|
329
399
|
}
|
|
@@ -334,17 +404,13 @@ const CalendarCore = {
|
|
|
334
404
|
<div class="in" style="margin-bottom: 100px"></div>`;
|
|
335
405
|
};
|
|
336
406
|
|
|
337
|
-
let lastCid;
|
|
338
|
-
let lasUserId;
|
|
339
407
|
this.Data[options.idModal].updatePanel = async () => {
|
|
340
408
|
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
341
|
-
if (lastCid === cid && lasUserId === options.Elements.Data.user.main.model.user._id) return;
|
|
342
409
|
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
343
|
-
lasUserId = newInstance(options.Elements.Data.user.main.model.user._id);
|
|
344
|
-
lastCid = cid;
|
|
345
410
|
if (s(`.main-body-calendar-${options.idModal}`)) {
|
|
346
|
-
if (Auth.getToken())
|
|
347
|
-
else getSrrData();
|
|
411
|
+
// if (Auth.getToken())
|
|
412
|
+
// else getSrrData();
|
|
413
|
+
await getPanelData();
|
|
348
414
|
htmls(`.main-body-calendar-${options.idModal}`, await panelRender());
|
|
349
415
|
}
|
|
350
416
|
};
|
|
@@ -518,25 +518,25 @@ function getDirname(path) {
|
|
|
518
518
|
return parts.join('/'); // Adjust separator if needed for Windows ('\')
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
const isDayValid = (day) => {
|
|
522
|
-
const date = new Date();
|
|
523
|
-
date.setDate(day);
|
|
524
|
-
return date.getDate() === day;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
const isMonthValid = (month) => {
|
|
528
|
-
const date = new Date();
|
|
529
|
-
date.setMonth(month - 1);
|
|
530
|
-
return date.getMonth() === month - 1;
|
|
531
|
-
};
|
|
532
|
-
|
|
533
521
|
const isValidDate = (day, month, year) => {
|
|
534
|
-
if (!
|
|
535
|
-
|
|
536
|
-
|
|
522
|
+
if (!month && !year) return !(new Date(day) == 'Invalid Date');
|
|
523
|
+
// new Date('2025-12-28')
|
|
524
|
+
// Sat Dec 27 2025 19:00:00 GMT-0500 (Eastern Standard Time)
|
|
525
|
+
// new Date('2025/12/28')
|
|
526
|
+
// Sun Dec 28 2025 00:00:00 GMT-0500 (Eastern Standard Time)
|
|
527
|
+
return !(new Date(`${year}/${month}/${day}`) == 'Invalid Date');
|
|
528
|
+
};
|
|
537
529
|
|
|
538
|
-
|
|
539
|
-
|
|
530
|
+
// console.log(req.body.timeZoneClient, Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
531
|
+
// DateTime.fromISO("2017-05-15T09:10:23", { zone: "Europe/Paris" });
|
|
532
|
+
const strToDateUTC = (date = '2025-01-30T14:32') => {
|
|
533
|
+
const year = parseInt(date.split('-')[0]);
|
|
534
|
+
const month = parseInt(date.split('-')[1]);
|
|
535
|
+
const day = parseInt(date.split('-')[2].split('T')[0]);
|
|
536
|
+
const hour = parseInt(date.split('T')[1].split(':')[0]);
|
|
537
|
+
const minute = parseInt(date.split('T')[1].split(':')[1]);
|
|
538
|
+
date = new Date(Date.UTC(year, month - 1, day, hour, minute, 0, 0));
|
|
539
|
+
return date;
|
|
540
540
|
};
|
|
541
541
|
|
|
542
542
|
const isValidFormat = (value, format) => {
|
|
@@ -662,6 +662,22 @@ function componentFromStr(numStr, percent) {
|
|
|
662
662
|
return percent ? Math.floor((255 * Math.min(100, num)) / 100) : Math.min(255, num);
|
|
663
663
|
}
|
|
664
664
|
|
|
665
|
+
const isChileanIdentityDocument = function (rutCompleto) {
|
|
666
|
+
const dv = function (T) {
|
|
667
|
+
let M = 0,
|
|
668
|
+
S = 1;
|
|
669
|
+
for (; T; T = Math.floor(T / 10)) S = (S + (T % 10) * (9 - (M++ % 6))) % 11;
|
|
670
|
+
return S ? S - 1 : 'k';
|
|
671
|
+
};
|
|
672
|
+
rutCompleto = rutCompleto.replace('‐', '-');
|
|
673
|
+
if (!/^[0-9]+[-|‐]{1}[0-9kK]{1}$/.test(rutCompleto)) return false;
|
|
674
|
+
var tmp = rutCompleto.split('-');
|
|
675
|
+
var digv = tmp[1];
|
|
676
|
+
var rut = tmp[0];
|
|
677
|
+
if (digv == 'K') digv = 'k';
|
|
678
|
+
return dv(rut) == digv;
|
|
679
|
+
};
|
|
680
|
+
|
|
665
681
|
function rgbToHex(rgb) {
|
|
666
682
|
const rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
|
|
667
683
|
let result,
|
|
@@ -685,10 +701,121 @@ const hexToNumber = (hex = 0xdc) => Number(hex) || parseFloat(hex, 16);
|
|
|
685
701
|
|
|
686
702
|
const numberToHex = (number = 0) => number.toString(16);
|
|
687
703
|
|
|
704
|
+
const generateRandomPasswordSelection = (length) => {
|
|
705
|
+
const _random = (arr) => {
|
|
706
|
+
const rand = Math.floor(Math.random() * arr.length);
|
|
707
|
+
return arr[rand];
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
const uppercase = [
|
|
711
|
+
'A',
|
|
712
|
+
'B',
|
|
713
|
+
'C',
|
|
714
|
+
'D',
|
|
715
|
+
'E',
|
|
716
|
+
'F',
|
|
717
|
+
'G',
|
|
718
|
+
'H',
|
|
719
|
+
'I',
|
|
720
|
+
'J',
|
|
721
|
+
'K',
|
|
722
|
+
'L',
|
|
723
|
+
'M',
|
|
724
|
+
'N',
|
|
725
|
+
'O',
|
|
726
|
+
'P',
|
|
727
|
+
'Q',
|
|
728
|
+
'R',
|
|
729
|
+
'S',
|
|
730
|
+
'T',
|
|
731
|
+
'U',
|
|
732
|
+
'V',
|
|
733
|
+
'W',
|
|
734
|
+
'X',
|
|
735
|
+
'Y',
|
|
736
|
+
'Z',
|
|
737
|
+
];
|
|
738
|
+
const lowercase = [
|
|
739
|
+
'a',
|
|
740
|
+
'b',
|
|
741
|
+
'c',
|
|
742
|
+
'd',
|
|
743
|
+
'e',
|
|
744
|
+
'f',
|
|
745
|
+
'g',
|
|
746
|
+
'h',
|
|
747
|
+
'i',
|
|
748
|
+
'j',
|
|
749
|
+
'k',
|
|
750
|
+
'l',
|
|
751
|
+
'm',
|
|
752
|
+
'n',
|
|
753
|
+
'o',
|
|
754
|
+
'p',
|
|
755
|
+
'q',
|
|
756
|
+
'r',
|
|
757
|
+
's',
|
|
758
|
+
't',
|
|
759
|
+
'u',
|
|
760
|
+
'v',
|
|
761
|
+
'w',
|
|
762
|
+
'x',
|
|
763
|
+
'y',
|
|
764
|
+
'z',
|
|
765
|
+
];
|
|
766
|
+
const special = [
|
|
767
|
+
'~',
|
|
768
|
+
'!',
|
|
769
|
+
'@',
|
|
770
|
+
'#',
|
|
771
|
+
'$',
|
|
772
|
+
'%',
|
|
773
|
+
'^',
|
|
774
|
+
'&',
|
|
775
|
+
'*',
|
|
776
|
+
'(',
|
|
777
|
+
')',
|
|
778
|
+
'_',
|
|
779
|
+
'+',
|
|
780
|
+
'-',
|
|
781
|
+
'=',
|
|
782
|
+
'{',
|
|
783
|
+
'}',
|
|
784
|
+
'[',
|
|
785
|
+
']',
|
|
786
|
+
':',
|
|
787
|
+
';',
|
|
788
|
+
'?',
|
|
789
|
+
',',
|
|
790
|
+
'.',
|
|
791
|
+
'|',
|
|
792
|
+
'\\',
|
|
793
|
+
];
|
|
794
|
+
const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
795
|
+
|
|
796
|
+
const nonSpecial = [...uppercase, ...lowercase, ...numbers];
|
|
797
|
+
|
|
798
|
+
let password = '';
|
|
799
|
+
|
|
800
|
+
for (let i = 0; i < length; i++) {
|
|
801
|
+
// Previous character is a special character
|
|
802
|
+
if (i !== 0 && special.includes(password[i - 1])) {
|
|
803
|
+
password += _random(nonSpecial);
|
|
804
|
+
} else password += _random([...nonSpecial, ...special]);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
return password;
|
|
808
|
+
};
|
|
809
|
+
|
|
688
810
|
// 0x = Hexadecimal
|
|
689
811
|
// 0b = Binary
|
|
690
812
|
// 0o = Octal
|
|
691
813
|
|
|
814
|
+
const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
|
|
815
|
+
|
|
816
|
+
const commonAdminGuard = (role) => userRoleEnum.indexOf(role) === userRoleEnum.indexOf('admin');
|
|
817
|
+
const commonModeratorGuard = (role) => userRoleEnum.indexOf(role) <= userRoleEnum.indexOf('moderator');
|
|
818
|
+
|
|
692
819
|
export {
|
|
693
820
|
s4,
|
|
694
821
|
range,
|
|
@@ -727,10 +854,9 @@ export {
|
|
|
727
854
|
getSubpaths,
|
|
728
855
|
formatBytes,
|
|
729
856
|
getDirname,
|
|
730
|
-
isDayValid,
|
|
731
|
-
isMonthValid,
|
|
732
857
|
isValidDate,
|
|
733
858
|
isValidFormat,
|
|
859
|
+
strToDateUTC,
|
|
734
860
|
getTimezoneOffset,
|
|
735
861
|
cleanString,
|
|
736
862
|
splitEveryXChar,
|
|
@@ -742,4 +868,9 @@ export {
|
|
|
742
868
|
getCapVariableName,
|
|
743
869
|
hexToNumber,
|
|
744
870
|
numberToHex,
|
|
871
|
+
generateRandomPasswordSelection,
|
|
872
|
+
userRoleEnum,
|
|
873
|
+
commonAdminGuard,
|
|
874
|
+
commonModeratorGuard,
|
|
875
|
+
isChileanIdentityDocument,
|
|
745
876
|
};
|
|
@@ -344,7 +344,7 @@ const renderBubbleDialog = async function (
|
|
|
344
344
|
}
|
|
345
345
|
if (options.trianglePositionCss) cssTrianglePosition = options.trianglePositionCss;
|
|
346
346
|
return html` <div
|
|
347
|
-
class="${options?.classSelectors ? options.classSelectors : '
|
|
347
|
+
class="${options?.classSelectors ? options.classSelectors : 'inl'} bubble-dialog bubble-dialog-${id}"
|
|
348
348
|
${options.bubbleCss ? `style='${options.bubbleCss}'` : ''}
|
|
349
349
|
>
|
|
350
350
|
<style class="style-bubble-dialog-triangle-${id}">
|
|
@@ -117,6 +117,12 @@ const CssCommonCore = async () => {
|
|
|
117
117
|
animation: ripple 600ms linear;
|
|
118
118
|
background-color: rgba(137, 137, 137, 0.503);
|
|
119
119
|
}
|
|
120
|
+
.slide-menu-top-bar-fix {
|
|
121
|
+
top: 0;
|
|
122
|
+
left: 0;
|
|
123
|
+
width: 100%;
|
|
124
|
+
z-index: 1;
|
|
125
|
+
}
|
|
120
126
|
@keyframes ripple {
|
|
121
127
|
to {
|
|
122
128
|
transform: scale(4);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _VERSION, CoreService } from '../../services/core/core.service.js';
|
|
1
2
|
import { Badge } from './Badge.js';
|
|
2
3
|
import { BtnIcon } from './BtnIcon.js';
|
|
3
4
|
import { rgbToHex } from './CommonJs.js';
|
|
@@ -79,7 +80,7 @@ const Docs = {
|
|
|
79
80
|
icon: html`<i class="fa-brands fa-osi"></i>`,
|
|
80
81
|
text: 'Source Docs',
|
|
81
82
|
url: function () {
|
|
82
|
-
return `${getProxyPath()}docs/engine
|
|
83
|
+
return `${getProxyPath()}docs/engine/${_VERSION}`;
|
|
83
84
|
},
|
|
84
85
|
},
|
|
85
86
|
{
|
|
@@ -16,7 +16,11 @@ const DropDown = {
|
|
|
16
16
|
onClick: () => {
|
|
17
17
|
console.log('DropDown onClick', this.value);
|
|
18
18
|
if (options && options.resetOnClick) options.resetOnClick();
|
|
19
|
-
|
|
19
|
+
if (options && options.type === 'checkbox')
|
|
20
|
+
for (const opt of DropDown.Tokens[id].value) {
|
|
21
|
+
s(`.dropdown-option-${id}-${opt}`).click();
|
|
22
|
+
}
|
|
23
|
+
else this.Tokens[id].value = undefined;
|
|
20
24
|
},
|
|
21
25
|
});
|
|
22
26
|
|