nodebb-plugin-onekite-calendar 2.0.0 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog – calendar-onekite
2
2
 
3
+ ## 1.2.9
4
+ - Modale réservation : retour du grisé des matériels indisponibles (API events expose à nouveau itemIds)
5
+
6
+ ## 1.2.8
7
+ - Popup réservation : correction « Durée rapide » (la période envoyée correspond bien à la durée sélectionnée)
8
+
9
+ ## 1.2.7
10
+ - UI : suppression du bouton flottant mobile « + Réserver »
11
+ - Client : nettoyage du code associé (suppression du bloc FAB)
12
+
3
13
  ## 1.2.6
4
14
  - ACP : anti double action (verrou UI + boutons désactivés/spinner) sur valider/refuser (unitaire + batch)
5
15
 
package/lib/api.js CHANGED
@@ -468,6 +468,10 @@ api.getEvents = async function (req, res) {
468
468
  rid: p.rid,
469
469
  status: p.status,
470
470
  uid: p.uid,
471
+ // Needed client-side to gray out unavailable items in the reservation modal.
472
+ // Not sensitive: it is already visible in event titles and prevents double booking.
473
+ itemIds: Array.isArray(p.itemIds) ? p.itemIds.map(String) : [],
474
+ itemIdLine: p.itemIdLine ? String(p.itemIdLine) : '',
471
475
  canModerate: canMod,
472
476
  ...(widgetMode ? { reservedByUsername: String(r.username || '') } : {}),
473
477
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "FullCalendar-based equipment reservation workflow with admin approval & HelloAsso payment for NodeBB",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "acpScripts": [
40
40
  "public/admin.js"
41
41
  ],
42
- "version": "2.0.0"
42
+ "version": "2.0.2"
43
43
  }
package/public/client.js CHANGED
@@ -923,7 +923,9 @@ function toDatetimeLocalValue(date) {
923
923
  const itemNames = cbs.map(cb => cb.getAttribute('data-name'));
924
924
  const sum = cbs.reduce((acc, cb) => acc + (parseFloat(cb.getAttribute('data-price') || '0') || 0), 0);
925
925
  const total = (sum / 100) * days;
926
- resolve({ itemIds, itemNames, total, days });
926
+ // Return the effective end date (exclusive) because duration shortcuts can
927
+ // change the range without updating the original FullCalendar selection.
928
+ resolve({ itemIds, itemNames, total, days, endDate: toLocalYmd(end) });
927
929
  },
928
930
  },
929
931
  },
@@ -1258,7 +1260,10 @@ function toDatetimeLocalValue(date) {
1258
1260
  }
1259
1261
  // Send date strings (no hours) so reservations are day-based.
1260
1262
  const startDate = toLocalYmd(info.start);
1261
- const endDate = toLocalYmd(info.end);
1263
+ // NOTE: FullCalendar's `info.end` reflects the original selection.
1264
+ // If the user used "Durée rapide", the effective end date is held
1265
+ // inside the dialog (returned as `chosen.endDate`).
1266
+ const endDate = (chosen && chosen.endDate) ? String(chosen.endDate) : toLocalYmd(info.end);
1262
1267
  await requestReservation({
1263
1268
  start: startDate,
1264
1269
  end: endDate,
@@ -1826,40 +1831,6 @@ function toDatetimeLocalValue(date) {
1826
1831
 
1827
1832
  refreshDesktopModeButton();
1828
1833
 
1829
- // Mobile: floating action button to create a reservation quickly
1830
- try {
1831
- const fabId = 'onekite-fab-create';
1832
- const existing = document.getElementById(fabId);
1833
- if (existing) existing.remove();
1834
- if (isMobileNow()) {
1835
- const fab = document.createElement('button');
1836
- fab.id = fabId;
1837
- fab.type = 'button';
1838
- fab.className = 'btn btn-primary shadow';
1839
- fab.textContent = '+ Réserver';
1840
- fab.style.position = 'fixed';
1841
- fab.style.right = '14px';
1842
- fab.style.bottom = '14px';
1843
- fab.style.zIndex = '1050';
1844
- fab.style.borderRadius = '999px';
1845
- fab.style.padding = '12px 16px';
1846
- fab.addEventListener('click', async () => {
1847
- try {
1848
- if (isDialogOpen) return;
1849
- if (!lockAction('fab', 900)) return;
1850
- const start = new Date();
1851
- start.setHours(0, 0, 0, 0);
1852
- start.setDate(start.getDate() + 1);
1853
- const end = new Date(start);
1854
- end.setDate(end.getDate() + 1);
1855
- await handleCreateFromSelection({ start, end, allDay: true });
1856
- } catch (e) {}
1857
- });
1858
- document.body.appendChild(fab);
1859
- }
1860
- } catch (e) {}
1861
-
1862
-
1863
1834
  // Mobile controls: view (month/week) + mode (reservation/event) without bloating the header.
1864
1835
  try {
1865
1836
  const controlsId = 'onekite-mobile-controls';