nodebb-plugin-equipment-calendar 0.2.2 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-equipment-calendar",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Equipment reservation calendar for NodeBB (FullCalendar, approvals, HelloAsso payments)",
5
5
  "main": "library.js",
6
6
  "scripts": {
package/plugin.json CHANGED
@@ -1,16 +1,9 @@
1
1
  {
2
- "id": "nodebb-plugin-calendar-onekite",
3
- "name": "Calendar Onekite",
4
- "description": "Calendrier + réservation matériel + validation admin + paiement HelloAsso pour NodeBB v4",
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:widgets.getWidgets",
25
- "method": "defineWidgets"
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,2 @@
1
+ .equipment-calendar-page {}
2
+ .ec-status-pending {}
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+ /* global socket */
3
+
4
+ define('admin/plugins/equipment-calendar', ['jquery'], 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) {
26
+ if (window.app && window.app.alertError) {
27
+ return window.app.alertError(err.message || err);
28
+ }
29
+ return alert(err.message || err);
30
+ }
31
+ if (window.app && window.app.alertSuccess) {
32
+ return window.app.alertSuccess('Sauvegardé');
33
+ }
34
+ alert('Sauvegardé');
35
+ });
36
+ });
37
+ };
38
+
39
+ return EquipmentCalendar;
40
+ });
@@ -0,0 +1,53 @@
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
+ const startInput = form.querySelector('input[name="start"]');
9
+ const endInput = form.querySelector('input[name="end"]');
10
+ if (startInput) startInput.value = startISO;
11
+ if (endInput) endInput.value = endISO;
12
+ form.submit();
13
+ }
14
+
15
+ function init() {
16
+ const el = document.getElementById('equipment-calendar');
17
+ if (!el || typeof FullCalendar === 'undefined') return;
18
+
19
+ const events = window.EC_EVENTS || [];
20
+ const initialDate = window.EC_INITIAL_DATE;
21
+ const initialView = window.EC_INITIAL_VIEW || 'dayGridMonth';
22
+
23
+ const calendar = new FullCalendar.Calendar(el, {
24
+ initialView: initialView,
25
+ initialDate: initialDate,
26
+ timeZone: window.EC_TZ || 'local',
27
+ selectable: window.EC_CAN_CREATE === true,
28
+ selectMirror: true,
29
+ events: events,
30
+ select: function (info) {
31
+ submitCreate(info.startStr, info.endStr);
32
+ },
33
+ dateClick: function (info) {
34
+ const start = info.date;
35
+ const end = new Date(start.getTime() + 60 * 60 * 1000);
36
+ submitCreate(start.toISOString(), end.toISOString());
37
+ },
38
+ headerToolbar: {
39
+ left: 'prev,next today',
40
+ center: 'title',
41
+ right: 'dayGridMonth,timeGridWeek,timeGridDay'
42
+ },
43
+ });
44
+
45
+ calendar.render();
46
+ }
47
+
48
+ if (document.readyState === 'loading') {
49
+ document.addEventListener('DOMContentLoaded', init);
50
+ } else {
51
+ init();
52
+ }
53
+ }());
@@ -50,9 +50,8 @@
50
50
  {{/if}}
51
51
  </div>
52
52
 
53
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.css">
54
53
  <script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js"></script>
55
- <script src="/plugins/nodebb-plugin-equipment-calendar/lib/client.js"></script>
54
+ <script src="/plugins/nodebb-plugin-equipment-calendar/js/client.js"></script>
56
55
 
57
56
  <script>
58
57
  // eventsJson is already JSON, we output it unescaped by using data attribute trick