nodebb-plugin-equipment-calendar 0.2.2 → 0.2.3
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 +1 -1
- package/plugin.json +17 -18
- package/public/css/style.css +2 -0
- package/public/js/admin.js +32 -0
- package/public/js/client.js +50 -0
- package/public/templates/equipment-calendar/calendar.tpl +1 -1
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "nodebb-plugin-calendar
|
|
3
|
-
"name": "Calendar
|
|
4
|
-
"description": "
|
|
5
|
-
"url": "",
|
|
6
|
-
"version": "0.2.2",
|
|
2
|
+
"id": "nodebb-plugin-equipment-calendar",
|
|
3
|
+
"name": "Equipment Calendar",
|
|
4
|
+
"description": "Calendar-based equipment reservations with group approvals and HelloAsso payments.",
|
|
5
|
+
"url": "https://example.invalid",
|
|
7
6
|
"library": "./library.js",
|
|
8
|
-
"staticDirs": {
|
|
9
|
-
"static": "static"
|
|
10
|
-
},
|
|
11
|
-
"acpScripts": [
|
|
12
|
-
"static/js/admin.js"
|
|
13
|
-
],
|
|
14
7
|
"hooks": [
|
|
15
8
|
{
|
|
16
9
|
"hook": "static:app.load",
|
|
@@ -21,13 +14,19 @@
|
|
|
21
14
|
"method": "addAdminNavigation"
|
|
22
15
|
},
|
|
23
16
|
{
|
|
24
|
-
"hook": "filter:
|
|
25
|
-
"method": "
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"hook": "filter:widget.render:calendarUpcoming",
|
|
29
|
-
"method": "renderUpcomingWidget"
|
|
17
|
+
"hook": "filter:router.page",
|
|
18
|
+
"method": "addPageRoutes"
|
|
30
19
|
}
|
|
31
20
|
],
|
|
32
|
-
"templates": "templates"
|
|
21
|
+
"templates": "./public/templates",
|
|
22
|
+
"staticDirs": {
|
|
23
|
+
"js": "public/js",
|
|
24
|
+
"css": "public/css"
|
|
25
|
+
},
|
|
26
|
+
"scripts": [
|
|
27
|
+
"public/js/client.js"
|
|
28
|
+
],
|
|
29
|
+
"acpScripts": [
|
|
30
|
+
"public/js/admin.js"
|
|
31
|
+
]
|
|
33
32
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* global $, app */
|
|
3
|
+
|
|
4
|
+
define('admin/plugins/equipment-calendar', function () {
|
|
5
|
+
const EquipmentCalendar = {};
|
|
6
|
+
|
|
7
|
+
EquipmentCalendar.init = function () {
|
|
8
|
+
$('#save').on('click', function () {
|
|
9
|
+
const payload = {
|
|
10
|
+
creatorGroups: $('#creatorGroups').val(),
|
|
11
|
+
approverGroup: $('#approverGroup').val(),
|
|
12
|
+
notifyGroup: $('#notifyGroup').val(),
|
|
13
|
+
itemsJson: $('#itemsJson').val(),
|
|
14
|
+
ha_clientId: $('#ha_clientId').val(),
|
|
15
|
+
ha_clientSecret: $('#ha_clientSecret').val(),
|
|
16
|
+
ha_organizationSlug: $('#ha_organizationSlug').val(),
|
|
17
|
+
ha_returnUrl: $('#ha_returnUrl').val(),
|
|
18
|
+
ha_webhookSecret: $('#ha_webhookSecret').val(),
|
|
19
|
+
defaultView: $('#defaultView').val(),
|
|
20
|
+
timezone: $('#timezone').val(),
|
|
21
|
+
showRequesterToAll: $('#showRequesterToAll').is(':checked') ? '1' : '0',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
socket.emit('admin.settings.save', { hash: 'equipmentCalendar', values: payload }, function (err) {
|
|
25
|
+
if (err) return app.alertError(err.message || err);
|
|
26
|
+
app.alertSuccess('Sauvegardé');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return EquipmentCalendar;
|
|
32
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* global $, window, document, FullCalendar */
|
|
3
|
+
|
|
4
|
+
(function () {
|
|
5
|
+
function submitCreate(startISO, endISO) {
|
|
6
|
+
const form = document.getElementById('ec-create-form');
|
|
7
|
+
if (!form) return;
|
|
8
|
+
form.querySelector('input[name="start"]').value = startISO;
|
|
9
|
+
form.querySelector('input[name="end"]').value = endISO;
|
|
10
|
+
form.submit();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$(document).ready(function () {
|
|
14
|
+
const el = document.getElementById('equipment-calendar');
|
|
15
|
+
if (!el) return;
|
|
16
|
+
|
|
17
|
+
const events = window.EC_EVENTS || [];
|
|
18
|
+
const initialDate = window.EC_INITIAL_DATE;
|
|
19
|
+
const initialView = window.EC_INITIAL_VIEW || 'dayGridMonth';
|
|
20
|
+
|
|
21
|
+
const calendar = new FullCalendar.Calendar(el, {
|
|
22
|
+
initialView: initialView,
|
|
23
|
+
initialDate: initialDate,
|
|
24
|
+
timeZone: window.EC_TZ || 'local',
|
|
25
|
+
selectable: window.EC_CAN_CREATE === true,
|
|
26
|
+
selectMirror: true,
|
|
27
|
+
events: events,
|
|
28
|
+
select: function (info) {
|
|
29
|
+
// FullCalendar provides end exclusive for all-day; for timed selections it's fine.
|
|
30
|
+
submitCreate(info.startStr, info.endStr);
|
|
31
|
+
},
|
|
32
|
+
dateClick: function (info) {
|
|
33
|
+
// Create 1-hour slot by default
|
|
34
|
+
const start = info.date;
|
|
35
|
+
const end = new Date(start.getTime() + 60 * 60 * 1000);
|
|
36
|
+
submitCreate(start.toISOString(), end.toISOString());
|
|
37
|
+
},
|
|
38
|
+
eventClick: function (info) {
|
|
39
|
+
// optionally show details
|
|
40
|
+
},
|
|
41
|
+
headerToolbar: {
|
|
42
|
+
left: 'prev,next today',
|
|
43
|
+
center: 'title',
|
|
44
|
+
right: 'dayGridMonth,timeGridWeek,timeGridDay'
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
calendar.render();
|
|
49
|
+
});
|
|
50
|
+
}());
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
|
|
53
53
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.css">
|
|
54
54
|
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js"></script>
|
|
55
|
-
<script src="/plugins/nodebb-plugin-equipment-calendar/
|
|
55
|
+
<script src="/plugins/nodebb-plugin-equipment-calendar/js/client.js"></script>
|
|
56
56
|
|
|
57
57
|
<script>
|
|
58
58
|
// eventsJson is already JSON, we output it unescaped by using data attribute trick
|