nodebb-plugin-onekite-calendar 2.0.75 → 2.0.76

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/lib/admin.js CHANGED
@@ -89,6 +89,7 @@ admin.approveReservation = async function (req, res) {
89
89
  r.pickupLat = String((req.body && req.body.pickupLat) || '').trim();
90
90
  r.pickupLon = String((req.body && req.body.pickupLon) || '').trim();
91
91
  r.approvedAt = Date.now();
92
+ r.paymentDeferred = !!(req.body && req.body.paymentDeferred);
92
93
 
93
94
  try {
94
95
  const approver = await user.getUserFields(req.uid, ['username']);
package/lib/scheduler.js CHANGED
@@ -224,6 +224,7 @@ async function processAwaitingPayment(preIds, preReservations) {
224
224
  const rid = ids[i];
225
225
  const r = reservations[i];
226
226
  if (!r || r.status !== 'awaiting_payment') continue;
227
+ if (r.paymentDeferred) continue;
227
228
 
228
229
  const approvedAt = parseInt(r.approvedAt || r.validatedAt || 0, 10) || 0;
229
230
  if (!approvedAt) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.75",
3
+ "version": "2.0.76",
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/public/admin.js CHANGED
@@ -838,6 +838,10 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
838
838
  <label class="form-label">Heure de récupération</label>
839
839
  <select class="form-select" id="onekite-pickup-time">${opts}</select>
840
840
  </div>
841
+ <div class="form-check mb-2">
842
+ <input class="form-check-input" type="checkbox" id="onekite-payment-deferred" />
843
+ <label class="form-check-label" for="onekite-payment-deferred">Paiement différé <span class="text-muted" style="font-size:12px;">(pas d'annulation automatique)</span></label>
844
+ </div>
841
845
  <div class="text-muted" style="font-size:12px;">Ces infos seront appliquées aux ${rids.length} demandes sélectionnées.</div>
842
846
  `;
843
847
  const dlg = bootbox.dialog({
@@ -856,8 +860,9 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
856
860
  const pickupTime = (document.getElementById('onekite-pickup-time')?.value || '').trim();
857
861
  const pickupLat = (document.getElementById('onekite-pickup-lat')?.value || '').trim();
858
862
  const pickupLon = (document.getElementById('onekite-pickup-lon')?.value || '').trim();
863
+ const paymentDeferred = !!(document.getElementById('onekite-payment-deferred')?.checked);
859
864
  for (const rr of rids) {
860
- await approve(rr, { pickupAddress, notes, pickupTime, pickupLat, pickupLon });
865
+ await approve(rr, { pickupAddress, notes, pickupTime, pickupLat, pickupLon, paymentDeferred });
861
866
  }
862
867
  showAlert('success', `${rids.length} demande(s) validée(s).`);
863
868
  await refreshPending();
@@ -1010,6 +1015,10 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
1010
1015
  <label class="form-label">Heure de récupération</label>
1011
1016
  <select class="form-select" id="onekite-pickup-time">${opts}</select>
1012
1017
  </div>
1018
+ <div class="form-check mb-2">
1019
+ <input class="form-check-input" type="checkbox" id="onekite-payment-deferred" />
1020
+ <label class="form-check-label" for="onekite-payment-deferred">Paiement différé <span class="text-muted" style="font-size:12px;">(pas d'annulation automatique)</span></label>
1021
+ </div>
1013
1022
  `;
1014
1023
 
1015
1024
  const dlg = bootbox.dialog({
@@ -1028,7 +1037,8 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
1028
1037
  const pickupTime = (document.getElementById('onekite-pickup-time')?.value || '').trim();
1029
1038
  const pickupLat = (document.getElementById('onekite-pickup-lat')?.value || '').trim();
1030
1039
  const pickupLon = (document.getElementById('onekite-pickup-lon')?.value || '').trim();
1031
- await approve(rid, { pickupAddress, notes, pickupTime, pickupLat, pickupLon });
1040
+ const paymentDeferred = !!(document.getElementById('onekite-payment-deferred')?.checked);
1041
+ await approve(rid, { pickupAddress, notes, pickupTime, pickupLat, pickupLon, paymentDeferred });
1032
1042
  if (rowEl && rowEl.parentNode) rowEl.parentNode.removeChild(rowEl);
1033
1043
  showAlert('success', 'Demande validée.');
1034
1044
  await refreshPending();