nodebb-plugin-equipment-calendar 0.2.6 → 0.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-equipment-calendar",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Equipment reservation calendar for NodeBB (FullCalendar, approvals, HelloAsso payments)",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"axios": "^1.7.9",
|
|
20
20
|
"luxon": "^3.5.0",
|
|
21
|
-
"uuid": "^9.0.1"
|
|
22
|
-
"fullcalendar": "^6.1.19"
|
|
21
|
+
"uuid": "^9.0.1"
|
|
23
22
|
}
|
|
24
23
|
}
|
package/plugin.json
CHANGED
package/public/js/admin.js
CHANGED
|
@@ -1,40 +1,55 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* global socket */
|
|
2
|
+
/* global window, document, socket, app */
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
(function () {
|
|
5
|
+
function byId(id) { return document.getElementById(id); }
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
function collect() {
|
|
8
|
+
return {
|
|
9
|
+
creatorGroups: byId('creatorGroups') ? byId('creatorGroups').value : '',
|
|
10
|
+
approverGroup: byId('approverGroup') ? byId('approverGroup').value : '',
|
|
11
|
+
notifyGroup: byId('notifyGroup') ? byId('notifyGroup').value : '',
|
|
12
|
+
itemsJson: byId('itemsJson') ? byId('itemsJson').value : '[]',
|
|
13
|
+
ha_clientId: byId('ha_clientId') ? byId('ha_clientId').value : '',
|
|
14
|
+
ha_clientSecret: byId('ha_clientSecret') ? byId('ha_clientSecret').value : '',
|
|
15
|
+
ha_organizationSlug: byId('ha_organizationSlug') ? byId('ha_organizationSlug').value : '',
|
|
16
|
+
ha_returnUrl: byId('ha_returnUrl') ? byId('ha_returnUrl').value : '',
|
|
17
|
+
ha_webhookSecret: byId('ha_webhookSecret') ? byId('ha_webhookSecret').value : '',
|
|
18
|
+
defaultView: byId('defaultView') ? byId('defaultView').value : 'dayGridMonth',
|
|
19
|
+
timezone: byId('timezone') ? byId('timezone').value : 'Europe/Paris',
|
|
20
|
+
showRequesterToAll: (byId('showRequesterToAll') && byId('showRequesterToAll').checked) ? '1' : '0',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function onReady(fn) {
|
|
25
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fn);
|
|
26
|
+
else fn();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onReady(function () {
|
|
30
|
+
const btn = byId('save');
|
|
31
|
+
if (!btn) return;
|
|
32
|
+
|
|
33
|
+
btn.addEventListener('click', function () {
|
|
34
|
+
if (typeof socket === 'undefined' || !socket.emit) {
|
|
35
|
+
const msg = 'Socket NodeBB indisponible (socket.emit). Vérifie que tu es bien dans l\'ACP.';
|
|
36
|
+
if (window.app && window.app.alertError) window.app.alertError(msg);
|
|
37
|
+
else alert(msg);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const payload = collect();
|
|
23
42
|
|
|
24
43
|
socket.emit('admin.settings.save', { hash: 'equipmentCalendar', values: payload }, function (err) {
|
|
25
44
|
if (err) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return
|
|
30
|
-
}
|
|
31
|
-
if (window.app && window.app.alertSuccess) {
|
|
32
|
-
return window.app.alertSuccess('Sauvegardé');
|
|
45
|
+
const m = (err.message || err) + '';
|
|
46
|
+
if (window.app && window.app.alertError) return window.app.alertError(m);
|
|
47
|
+
alert(m);
|
|
48
|
+
return;
|
|
33
49
|
}
|
|
50
|
+
if (window.app && window.app.alertSuccess) return window.app.alertSuccess('Sauvegardé');
|
|
34
51
|
alert('Sauvegardé');
|
|
35
52
|
});
|
|
36
53
|
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return EquipmentCalendar;
|
|
40
|
-
});
|
|
54
|
+
});
|
|
55
|
+
}());
|
|
@@ -50,8 +50,7 @@
|
|
|
50
50
|
{{{ end }}}
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
|
-
<
|
|
54
|
-
<script src="/plugins/nodebb-plugin-equipment-calendar/vendor/index.global.min.js"></script>
|
|
53
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/6.1.19/index.global.min.js"></script>
|
|
55
54
|
<script src="/plugins/nodebb-plugin-equipment-calendar/js/client.js"></script>
|
|
56
55
|
|
|
57
56
|
<script>
|