nodebb-plugin-equipment-calendar 2.0.1 → 2.0.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": "2.0.1",
3
+ "version": "2.0.4",
4
4
  "description": "Equipment reservation calendar for NodeBB (FullCalendar, approvals, HelloAsso payments)",
5
5
  "main": "library.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- require(['jquery'], function ($) {
1
+ require(['jquery', 'bootstrap'], function ($, bootstrap) {
2
2
  'use strict';
3
3
  /* global window, document, FullCalendar */
4
4
 
@@ -76,8 +76,12 @@ require(['jquery'], function ($) {
76
76
  updateTotalPrice();
77
77
 
78
78
  const modalEl = document.getElementById('ec-create-modal');
79
- if (modalEl && window.bootstrap && window.bootstrap.Modal) {
80
- window.bootstrap.Modal.getOrCreateInstance(modalEl).show();
79
+ const BS = (bootstrap && bootstrap.Modal) ? bootstrap : (window.bootstrap && window.bootstrap.Modal ? window.bootstrap : null);
80
+ if (modalEl && BS && BS.Modal) {
81
+ BS.Modal.getOrCreateInstance(modalEl).show();
82
+ } else {
83
+ // Fallback: if bootstrap modal isn't available, scroll to form area
84
+ modalEl?.scrollIntoView({ behavior: 'smooth', block: 'center' });
81
85
  }
82
86
  }
83
87
 
@@ -97,12 +101,14 @@ require(['jquery'], function ($) {
97
101
  if (!canCreate) return;
98
102
  const startMs = Date.UTC(info.date.getUTCFullYear(), info.date.getUTCMonth(), info.date.getUTCDate());
99
103
  const endMs = startMs + 24 * 60 * 60 * 1000;
104
+ console.debug('[equipment-calendar] open modal', { startMs, endMs });
100
105
  openModalWithRange(startMs, endMs);
101
106
  },
102
107
  select: function (info) {
103
108
  if (!canCreate) return;
104
109
  const startMs = Date.UTC(info.start.getUTCFullYear(), info.start.getUTCMonth(), info.start.getUTCDate());
105
110
  const endMs = Date.UTC(info.end.getUTCFullYear(), info.end.getUTCMonth(), info.end.getUTCDate());
111
+ console.debug('[equipment-calendar] open modal', { startMs, endMs });
106
112
  openModalWithRange(startMs, endMs);
107
113
  },
108
114
  });