nodebb-plugin-onekite-calendar 2.0.1 → 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,11 @@
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
+
3
9
  ## 1.2.7
4
10
  - UI : suppression du bouton flottant mobile « + Réserver »
5
11
  - Client : nettoyage du code associé (suppression du bloc FAB)
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.1",
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.1"
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,