nodebb-plugin-equipment-calendar 8.9.2 → 8.9.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/library.js
CHANGED
|
@@ -1328,15 +1328,26 @@ async function handleCreateReservation(req, res) {
|
|
|
1328
1328
|
const itemIds = normalizeItemIds(itemIdsRaw);
|
|
1329
1329
|
if (!itemIds.length) return res.status(400).send('itemIds required');
|
|
1330
1330
|
|
|
1331
|
-
// Dates
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1331
|
+
// Dates: accept YYYY-MM-DD or ISO-with-time; take first 10 chars
|
|
1332
|
+
let _startIso = String(req.body.start || req.body.startDate || req.body.startIso || req.body.startStr || '').trim().slice(0, 10);
|
|
1333
|
+
let _endIso = String(req.body.end || req.body.endDate || req.body.endIso || req.body.endStr || '').trim().slice(0, 10);
|
|
1334
|
+
|
|
1335
|
+
// Fallback: timestamps
|
|
1336
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso)) {
|
|
1337
|
+
const ms = Number(req.body.startMs || req.body.startTime || 0);
|
|
1338
|
+
if (ms) _startIso = new Date(ms).toISOString().slice(0, 10);
|
|
1339
|
+
}
|
|
1340
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
|
|
1341
|
+
const ms = Number(req.body.endMs || req.body.endTime || 0);
|
|
1342
|
+
if (ms) _endIso = new Date(ms).toISOString().slice(0, 10);
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(_startIso) || !/^\d{4}-\d{2}-\d{2}$/.test(_endIso)) {
|
|
1335
1346
|
return res.status(400).send('dates required');
|
|
1336
1347
|
}
|
|
1337
1348
|
|
|
1338
|
-
const startMs = Date.parse(
|
|
1339
|
-
const endMs = Date.parse(addDaysIso(
|
|
1349
|
+
const startMs = Date.parse(_startIso + 'T00:00:00Z');
|
|
1350
|
+
const endMs = Date.parse(addDaysIso(_endIso, 1) + 'T00:00:00Z'); // exclusive end
|
|
1340
1351
|
if (!startMs || !endMs || endMs <= startMs) {
|
|
1341
1352
|
return res.status(400).send('dates required');
|
|
1342
1353
|
}
|
|
@@ -1364,8 +1375,8 @@ async function handleCreateReservation(req, res) {
|
|
|
1364
1375
|
itemId,
|
|
1365
1376
|
startMs,
|
|
1366
1377
|
endMs,
|
|
1367
|
-
startIso,
|
|
1368
|
-
endIso,
|
|
1378
|
+
startIso: _startIso,
|
|
1379
|
+
endIso: _endIso,
|
|
1369
1380
|
days,
|
|
1370
1381
|
unitPrice,
|
|
1371
1382
|
total,
|
|
@@ -1385,6 +1396,7 @@ async function handleCreateReservation(req, res) {
|
|
|
1385
1396
|
}
|
|
1386
1397
|
|
|
1387
1398
|
|
|
1399
|
+
|
|
1388
1400
|
async function handleApproveReservation(req, res) {
|
|
1389
1401
|
try {
|
|
1390
1402
|
const settings = await getSettings();
|
package/package.json
CHANGED
package/plugin.json
CHANGED
package/public/js/client.js
CHANGED
|
@@ -139,34 +139,7 @@ function updateTotalPrice() {
|
|
|
139
139
|
selectMirror: true,
|
|
140
140
|
dayMaxEventRows: true,
|
|
141
141
|
displayEventTime: false,
|
|
142
|
-
|
|
143
|
-
eventContent: function(arg) {
|
|
144
|
-
try {
|
|
145
|
-
var status = (arg.event.extendedProps && arg.event.extendedProps.status) ? arg.event.extendedProps.status : '';
|
|
146
|
-
var iconClass = '';
|
|
147
|
-
if (status === 'pending') iconClass = 'fa fa-hourglass-half text-warning';
|
|
148
|
-
else if (status === 'paid') iconClass = 'fa fa-check-circle text-success';
|
|
149
|
-
else if (status === 'approved') iconClass = 'fa fa-check text-success';
|
|
150
|
-
else if (status === 'rejected' || status === 'cancelled') iconClass = 'fa fa-times text-danger';
|
|
151
|
-
|
|
152
|
-
var wrap = document.createElement('div');
|
|
153
|
-
wrap.className = 'ec-event';
|
|
154
|
-
if (iconClass) {
|
|
155
|
-
var icon = document.createElement('span');
|
|
156
|
-
icon.className = 'ec-icon';
|
|
157
|
-
icon.innerHTML = '<i class="' + iconClass + '"></i>';
|
|
158
|
-
wrap.appendChild(icon);
|
|
159
|
-
}
|
|
160
|
-
var t = document.createElement('span');
|
|
161
|
-
t.className = 'ec-title';
|
|
162
|
-
t.textContent = arg.event.title || '';
|
|
163
|
-
wrap.appendChild(t);
|
|
164
|
-
return { domNodes: [wrap] };
|
|
165
|
-
} catch (e) {
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
timeZone: 'local',
|
|
142
|
+
timeZone: 'local',
|
|
170
143
|
events: events,
|
|
171
144
|
select: function (info) {
|
|
172
145
|
if (!window.EC_CAN_CREATE) return;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</form>
|
|
37
37
|
|
|
38
38
|
<div class="text-muted small mb-2">
|
|
39
|
-
Total (filtré) : <strong>{total}</strong>
|
|
39
|
+
Total (filtré) : <strong>{total}</strong> - Total (global) : <strong>{totalAll}</strong>
|
|
40
40
|
</div>
|
|
41
41
|
|
|
42
42
|
{{{ if hasRows }}}
|