underpost 2.8.1 → 2.8.31
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 +4 -4
- package/.vscode/extensions.json +8 -71
- package/CHANGELOG.md +55 -3
- package/Dockerfile +22 -36
- package/README.md +0 -27
- package/bin/deploy.js +57 -17
- package/bin/file.js +30 -2
- package/bin/index.js +2 -13
- package/bin/ssl.js +19 -11
- package/bin/vs.js +3 -2
- package/conf.js +9 -0
- package/docker-compose.yml +1 -1
- 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/test/mongo-express.yaml +60 -0
- package/manifests/test/phpmyadmin.yaml +54 -0
- package/manifests/test/underpost-engine-mongodb-configmap.yaml +26 -0
- package/manifests/test/underpost-engine-pod.yaml +108 -0
- package/manifests/underpost-engine-backup-access.yaml +16 -0
- package/manifests/underpost-engine-backup-pv-pvc.yaml +22 -0
- package/manifests/underpost-engine-headless-service.yaml +10 -0
- package/manifests/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
- package/manifests/underpost-engine-pv-pvc.yaml +23 -0
- package/manifests/underpost-engine-statefulset.yaml +91 -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 +144 -136
- package/src/api/user/user.model.js +9 -1
- package/src/api/user/user.service.js +1 -1
- package/src/client/components/core/CalendarCore.js +112 -49
- package/src/client/components/core/CommonJs.js +125 -19
- package/src/client/components/core/CssCore.js +6 -0
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +17 -3
- package/src/client/components/core/Modal.js +5 -0
- package/src/client/components/core/Panel.js +81 -24
- package/src/client/components/core/PanelForm.js +4 -18
- package/src/client/components/core/Translate.js +30 -8
- package/src/db/mongo/MongooseDB.js +13 -1
- package/src/index.js +1 -1
- package/src/server/conf.js +2 -2
- package/src/server/process.js +25 -2
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +2 -0
- package/startup.cjs +12 -0
- package/startup.js +0 -11
package/package.json
CHANGED
|
@@ -1,137 +1,145 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
2
|
+
"type": "module",
|
|
3
|
+
"main": "src/index.js",
|
|
4
|
+
"name": "underpost",
|
|
5
|
+
"version": "2.8.31",
|
|
6
|
+
"description": "pwa api rest template",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
9
|
+
"pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine && pm2 logs",
|
|
10
|
+
"ssl": "env-cmd -f .env.production node bin/ssl",
|
|
11
|
+
"pm2-delete": "pm2 delete engine",
|
|
12
|
+
"build": "node bin/deploy build-full-client && node bin/deploy fix-deps",
|
|
13
|
+
"build-production": "env-cmd -f .env.production node bin/deploy build-full-client",
|
|
14
|
+
"dev": "env-cmd -f .env.development node src/client.dev default",
|
|
15
|
+
"dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
|
|
16
|
+
"docs": "jsdoc -c jsdoc.json",
|
|
17
|
+
"backup": "node bin/db default.net/ export",
|
|
18
|
+
"install-template": "npm install && npm run build",
|
|
19
|
+
"install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd && npm install -g yarn && npm install -g auto-changelog",
|
|
20
|
+
"install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
|
|
21
|
+
"install-vs-extensions": "node bin/vs import",
|
|
22
|
+
"preinstall": "npm config set audit false && npm config set loglevel error",
|
|
23
|
+
"restore-preinstall": "npm config set audit true && npm config set loglevel notice",
|
|
24
|
+
"install": "npm run install-global && npm run install-test && npm run restore-preinstall --no-audit --no-warnings",
|
|
25
|
+
"docker:start": "docker-compose up",
|
|
26
|
+
"prettier": "prettier --write .",
|
|
27
|
+
"coveralls": "nyc npm run test --reporter=text-lcov | coveralls -v",
|
|
28
|
+
"test": "env-cmd -f .env.test c8 mocha",
|
|
29
|
+
"update": "npm update -g && npm update && npm audit fix --force && npm audit fix --force",
|
|
30
|
+
"underpost-publish": "npm publish --provenance --access public",
|
|
31
|
+
"underpost-unpublish": "npm unpublish underpost@2.5.x",
|
|
32
|
+
"login": "npm adduser",
|
|
33
|
+
"bin": "npm link --force"
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"underpost": "bin/index.js"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"engine",
|
|
44
|
+
"server",
|
|
45
|
+
"proxy",
|
|
46
|
+
"client"
|
|
47
|
+
],
|
|
48
|
+
"author": "https://github.com/underpostnet",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/underpostnet/pwa-microservices-template/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/underpostnet/pwa-microservices-template#readme",
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@fortawesome/fontawesome-free": "^6.4.2",
|
|
56
|
+
"@fullcalendar/rrule": "^6.1.15",
|
|
57
|
+
"@google/generative-ai": "^0.21.0",
|
|
58
|
+
"@loadingio/css-spinner": "^2.0.2",
|
|
59
|
+
"@neodrag/vanilla": "^2.0.3",
|
|
60
|
+
"@nomiclabs/hardhat-ethers": "^2.2.3",
|
|
61
|
+
"@nomiclabs/hardhat-etherscan": "^3.1.8",
|
|
62
|
+
"@nomiclabs/hardhat-waffle": "^2.0.6",
|
|
63
|
+
"@openzeppelin/contracts": "^5.0.2",
|
|
64
|
+
"adm-zip": "^0.5.10",
|
|
65
|
+
"ag-grid-community": "31.0.0",
|
|
66
|
+
"axios": "^1.5.1",
|
|
67
|
+
"chai": "^5.1.0",
|
|
68
|
+
"cli-progress": "^3.12.0",
|
|
69
|
+
"cli-spinners": "^3.0.0",
|
|
70
|
+
"clipboardy": "^4.0.0",
|
|
71
|
+
"color": "^4.2.3",
|
|
72
|
+
"colors": "^1.4.0",
|
|
73
|
+
"commander": "^12.1.0",
|
|
74
|
+
"compression": "^1.7.4",
|
|
75
|
+
"cors": "^2.8.5",
|
|
76
|
+
"d3": "^7.9.0",
|
|
77
|
+
"deepmerge": "^4.3.1",
|
|
78
|
+
"detect-port": "^1.5.1",
|
|
79
|
+
"dotenv": "^16.3.1",
|
|
80
|
+
"easymde": "^2.18.0",
|
|
81
|
+
"env-cmd": "^10.1.0",
|
|
82
|
+
"eventemitter3": "^5.0.1",
|
|
83
|
+
"express": "^4.18.2",
|
|
84
|
+
"express-fileupload": "^1.4.3",
|
|
85
|
+
"favicons": "^7.2.0",
|
|
86
|
+
"font-awesome-assets": "^0.0.9",
|
|
87
|
+
"fs-extra": "^11.1.1",
|
|
88
|
+
"fullcalendar": "^6.1.15",
|
|
89
|
+
"html-minifier-terser": "^7.2.0",
|
|
90
|
+
"http-proxy-middleware": "^2.0.6",
|
|
91
|
+
"ignore-walk": "^6.0.4",
|
|
92
|
+
"iovalkey": "^0.2.1",
|
|
93
|
+
"is-admin": "^4.0.0",
|
|
94
|
+
"is-ip": "^5.0.1",
|
|
95
|
+
"jimp": "^0.22.12",
|
|
96
|
+
"joystick-controller": "^1.0.15",
|
|
97
|
+
"json-colorizer": "^2.2.2",
|
|
98
|
+
"jsonwebtoken": "^9.0.2",
|
|
99
|
+
"keyword-extractor": "^0.0.28",
|
|
100
|
+
"kill-port-process": "^3.2.0",
|
|
101
|
+
"log-update": "^6.0.0",
|
|
102
|
+
"mariadb": "^3.2.2",
|
|
103
|
+
"marked": "^12.0.2",
|
|
104
|
+
"mongoose": "^8.9.5",
|
|
105
|
+
"morgan": "^1.10.0",
|
|
106
|
+
"nodemailer": "^6.9.9",
|
|
107
|
+
"nodemon": "^3.0.1",
|
|
108
|
+
"pathfinding": "^0.4.18",
|
|
109
|
+
"peer": "^1.0.2",
|
|
110
|
+
"peerjs": "^1.5.2",
|
|
111
|
+
"pixi.js": "7.4.2",
|
|
112
|
+
"prom-client": "^15.1.2",
|
|
113
|
+
"public-ip": "^6.0.1",
|
|
114
|
+
"read": "^2.1.0",
|
|
115
|
+
"rrule": "^2.8.1",
|
|
116
|
+
"sharp": "^0.32.5",
|
|
117
|
+
"shelljs": "^0.8.5",
|
|
118
|
+
"simple-git": "^3.26.0",
|
|
119
|
+
"simple-icons": "^13.9.0",
|
|
120
|
+
"sitemap": "^7.1.1",
|
|
121
|
+
"socket.io": "^4.8.0",
|
|
122
|
+
"sortablejs": "^1.15.0",
|
|
123
|
+
"split-file": "^2.3.0",
|
|
124
|
+
"swagger-ui-express": "^5.0.0",
|
|
125
|
+
"systeminformation": "^5.23.7",
|
|
126
|
+
"uglify-js": "^3.17.4",
|
|
127
|
+
"validator": "^13.11.0",
|
|
128
|
+
"vanilla-jsoneditor": "^2.3.2",
|
|
129
|
+
"web3": "^4.13.0",
|
|
130
|
+
"winston": "^3.11.0"
|
|
131
|
+
},
|
|
132
|
+
"devDependencies": {
|
|
133
|
+
"clean-jsdoc-theme": "^4.3.0",
|
|
134
|
+
"easy-json-schema": "^0.0.2-beta",
|
|
135
|
+
"hardhat": "^2.22.13",
|
|
136
|
+
"mocha": "^10.4.0",
|
|
137
|
+
"plantuml": "^0.0.2",
|
|
138
|
+
"swagger-autogen": "^2.23.7"
|
|
139
|
+
},
|
|
140
|
+
"publishConfig": {
|
|
141
|
+
"provenance": true,
|
|
142
|
+
"access": "public",
|
|
143
|
+
"registry": "https://registry.npmjs.org/"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -26,7 +26,11 @@ const UserSchema = new Schema(
|
|
|
26
26
|
profileImageId: { type: Schema.Types.ObjectId, ref: 'File' },
|
|
27
27
|
phoneNumbers: [
|
|
28
28
|
{
|
|
29
|
-
type: {
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
enum: ['office', 'home', 'private'],
|
|
32
|
+
},
|
|
33
|
+
number: { type: String },
|
|
30
34
|
},
|
|
31
35
|
],
|
|
32
36
|
publicKey: {
|
|
@@ -58,6 +62,10 @@ const UserDto = {
|
|
|
58
62
|
},
|
|
59
63
|
},
|
|
60
64
|
auth: {
|
|
65
|
+
// TODO: -> set login device, location, ip, fingerprint
|
|
66
|
+
// and validate on authorization middleware
|
|
67
|
+
// -> dynamic refresh 100 tokens per session with 12h interval
|
|
68
|
+
// -> back secret per user, registrarion user model -> secret: { type: String }
|
|
61
69
|
payload: (user) => ({ _id: user._id.toString(), role: user.role, email: user.email }),
|
|
62
70
|
},
|
|
63
71
|
};
|
|
@@ -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) {
|
|
@@ -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,87 @@ 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
|
-
plugins: [
|
|
99
|
+
plugins: [
|
|
100
|
+
FullCalendar.DayGrid.default,
|
|
101
|
+
FullCalendar.TimeGrid.default,
|
|
102
|
+
FullCalendar.List.default,
|
|
103
|
+
// https://fullcalendar.io/docs/rrule-plugin
|
|
104
|
+
FullCalendar.RRule.default,
|
|
105
|
+
],
|
|
81
106
|
// initialView: 'dayGridWeek',
|
|
82
107
|
timeZone: getTimeZone(),
|
|
83
108
|
dateClick: function (arg) {
|
|
84
109
|
console.error('calendar dateClick', arg.date.toString());
|
|
85
110
|
},
|
|
86
|
-
events: [{ title: 'Meeting', start: new Date() }],
|
|
111
|
+
events: events ?? [{ title: 'Meeting', start: new Date() }],
|
|
87
112
|
initialView: 'dayGridMonth',
|
|
88
113
|
headerToolbar: {
|
|
89
114
|
left: 'prev,next today',
|
|
90
115
|
center: 'title',
|
|
91
116
|
right: 'dayGridMonth,timeGridWeek,listWeek',
|
|
92
117
|
},
|
|
118
|
+
eventClick: async function (args) {
|
|
119
|
+
const dateData = eventDateFactory(args.event);
|
|
120
|
+
// element -> args.el
|
|
121
|
+
// remove all events associated -> args.event.remove();
|
|
122
|
+
// console.error('eventClick', JSON.stringify(dateData, null, 4));
|
|
123
|
+
if (options.eventClick) await options.eventClick(dateData, args);
|
|
124
|
+
},
|
|
125
|
+
eventClassNames: function (args) {
|
|
126
|
+
// console.error('eventClassNames', JSON.stringify(dateData, null, 4));
|
|
127
|
+
if (!args.event.extendedProps._id) return args.event.remove();
|
|
128
|
+
const dateData = eventDateFactory(args.event);
|
|
129
|
+
if (
|
|
130
|
+
CalendarCore.Data[options.idModal].hiddenDates.find(
|
|
131
|
+
(d) => d.eventSchedulerId === dateData.event._id && d.date === dateData.start,
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
return ['hide'];
|
|
135
|
+
},
|
|
93
136
|
});
|
|
94
137
|
|
|
95
138
|
this.Data[options.idModal].calendar.render();
|
|
@@ -139,29 +182,52 @@ const CalendarCore = {
|
|
|
139
182
|
rules: [{ type: 'isEmpty' }],
|
|
140
183
|
},
|
|
141
184
|
{
|
|
142
|
-
id: '
|
|
143
|
-
model: '
|
|
185
|
+
id: 'title',
|
|
186
|
+
model: 'title',
|
|
144
187
|
inputType: 'text',
|
|
145
188
|
rules: [{ type: 'isEmpty' }],
|
|
146
189
|
panel: { type: 'title' },
|
|
147
190
|
},
|
|
148
191
|
{
|
|
149
|
-
id: '
|
|
150
|
-
model: '
|
|
151
|
-
inputType: '
|
|
152
|
-
rules: [],
|
|
153
|
-
panel: { type: 'info-row'
|
|
192
|
+
id: 'description',
|
|
193
|
+
model: 'description',
|
|
194
|
+
inputType: 'text',
|
|
195
|
+
rules: [{ type: 'isEmpty' }],
|
|
196
|
+
panel: { type: 'info-row' },
|
|
154
197
|
},
|
|
155
198
|
{
|
|
156
199
|
id: 'start',
|
|
157
200
|
model: 'start',
|
|
158
201
|
inputType: 'datetime-local',
|
|
159
|
-
|
|
202
|
+
translateCode: 'startTime',
|
|
203
|
+
panel: { type: 'info-row' },
|
|
160
204
|
},
|
|
161
205
|
{
|
|
162
206
|
id: 'end',
|
|
163
207
|
model: 'end',
|
|
164
208
|
inputType: 'datetime-local',
|
|
209
|
+
translateCode: 'endTime',
|
|
210
|
+
panel: { type: 'info-row' },
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: 'daysOfWeek',
|
|
214
|
+
model: 'daysOfWeek',
|
|
215
|
+
inputType: 'dropdown-checkbox',
|
|
216
|
+
dropdown: {
|
|
217
|
+
options: daysOfWeekOptions,
|
|
218
|
+
},
|
|
219
|
+
panel: { type: 'list' },
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: 'startTime',
|
|
223
|
+
model: 'startTime',
|
|
224
|
+
inputType: 'time',
|
|
225
|
+
panel: { type: 'info-row' },
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: 'endTime',
|
|
229
|
+
model: 'endTime',
|
|
230
|
+
inputType: 'time',
|
|
165
231
|
panel: { type: 'info-row' },
|
|
166
232
|
},
|
|
167
233
|
];
|
|
@@ -215,8 +281,7 @@ const CalendarCore = {
|
|
|
215
281
|
if (options.route) {
|
|
216
282
|
setQueryPath({ path: options.route, queryPath: payload._id });
|
|
217
283
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
218
|
-
|
|
219
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
284
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
220
285
|
}
|
|
221
286
|
},
|
|
222
287
|
titleIcon,
|
|
@@ -250,12 +315,19 @@ const CalendarCore = {
|
|
|
250
315
|
],
|
|
251
316
|
on: {
|
|
252
317
|
add: async function ({ data, editId }) {
|
|
318
|
+
if (data.daysOfWeek && data.daysOfWeek.length > 0 && daysOfWeekOptions[data.daysOfWeek[0]]) {
|
|
319
|
+
data.daysOfWeek = data.daysOfWeek.map((d) => daysOfWeekOptions[d]);
|
|
320
|
+
}
|
|
321
|
+
data.timeZoneClient = getTimeZone();
|
|
253
322
|
const {
|
|
254
323
|
status,
|
|
255
324
|
message,
|
|
256
325
|
data: documentData,
|
|
257
326
|
} = editId
|
|
258
|
-
? await EventSchedulerService.put({
|
|
327
|
+
? await EventSchedulerService.put({
|
|
328
|
+
id: editId,
|
|
329
|
+
body: { ...data, _id: undefined },
|
|
330
|
+
})
|
|
259
331
|
: await EventSchedulerService.post({ body: data });
|
|
260
332
|
NotificationManager.Push({
|
|
261
333
|
html:
|
|
@@ -268,10 +340,9 @@ const CalendarCore = {
|
|
|
268
340
|
});
|
|
269
341
|
|
|
270
342
|
if (status === 'success') {
|
|
271
|
-
|
|
272
|
-
data.
|
|
273
|
-
data
|
|
274
|
-
data._id = documentData._id;
|
|
343
|
+
documentData.tools = true;
|
|
344
|
+
// data._id = documentData._id;
|
|
345
|
+
data = documentData;
|
|
275
346
|
|
|
276
347
|
let originObj, indexOriginObj;
|
|
277
348
|
let filesData = {};
|
|
@@ -291,8 +362,7 @@ const CalendarCore = {
|
|
|
291
362
|
|
|
292
363
|
setQueryPath({ path: options.route, queryPath: documentData._id });
|
|
293
364
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
294
|
-
|
|
295
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
365
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
296
366
|
}
|
|
297
367
|
return { data, status, message };
|
|
298
368
|
},
|
|
@@ -319,11 +389,8 @@ const CalendarCore = {
|
|
|
319
389
|
status,
|
|
320
390
|
});
|
|
321
391
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
325
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
326
|
-
}
|
|
392
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
393
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
327
394
|
|
|
328
395
|
return { status };
|
|
329
396
|
}
|
|
@@ -334,17 +401,13 @@ const CalendarCore = {
|
|
|
334
401
|
<div class="in" style="margin-bottom: 100px"></div>`;
|
|
335
402
|
};
|
|
336
403
|
|
|
337
|
-
let lastCid;
|
|
338
|
-
let lasUserId;
|
|
339
404
|
this.Data[options.idModal].updatePanel = async () => {
|
|
340
405
|
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
341
|
-
if (lastCid === cid && lasUserId === options.Elements.Data.user.main.model.user._id) return;
|
|
342
406
|
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
343
|
-
lasUserId = newInstance(options.Elements.Data.user.main.model.user._id);
|
|
344
|
-
lastCid = cid;
|
|
345
407
|
if (s(`.main-body-calendar-${options.idModal}`)) {
|
|
346
|
-
if (Auth.getToken())
|
|
347
|
-
else getSrrData();
|
|
408
|
+
// if (Auth.getToken())
|
|
409
|
+
// else getSrrData();
|
|
410
|
+
await getPanelData();
|
|
348
411
|
htmls(`.main-body-calendar-${options.idModal}`, await panelRender());
|
|
349
412
|
}
|
|
350
413
|
};
|