nodebb-plugin-equipment-calendar 8.1.2 → 8.1.7
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
|
@@ -72,6 +72,28 @@ function parseDateInput(v) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
function formatDateTimeFR(ms) {
|
|
76
|
+
const n = Number(ms || 0);
|
|
77
|
+
if (!n) return '';
|
|
78
|
+
try {
|
|
79
|
+
return new Date(n).toLocaleString('fr-FR', {
|
|
80
|
+
timeZone: 'Europe/Paris',
|
|
81
|
+
year: 'numeric',
|
|
82
|
+
month: '2-digit',
|
|
83
|
+
day: '2-digit',
|
|
84
|
+
hour: '2-digit',
|
|
85
|
+
minute: '2-digit',
|
|
86
|
+
hour12: false,
|
|
87
|
+
}).replace(',', ' :');
|
|
88
|
+
} catch (e) {
|
|
89
|
+
const d = new Date(n);
|
|
90
|
+
const pad = (x) => String(x).padStart(2,'0');
|
|
91
|
+
return `${pad(d.getDate())}/${pad(d.getMonth()+1)}/${d.getFullYear()} : ${pad(d.getHours())}:${pad(d.getMinutes())}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
75
97
|
const axios = require('axios');
|
|
76
98
|
const { DateTime } = require('luxon');
|
|
77
99
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -607,7 +629,7 @@ function toEvent(res, item, requesterName, canSeeRequester) {
|
|
|
607
629
|
title: titleParts.join(' '),
|
|
608
630
|
start,
|
|
609
631
|
end,
|
|
610
|
-
allDay:
|
|
632
|
+
allDay: true,
|
|
611
633
|
className,
|
|
612
634
|
extendedProps: {
|
|
613
635
|
status: res.status,
|
|
@@ -1236,6 +1258,9 @@ async function handleCreateReservation(req, res) {
|
|
|
1236
1258
|
let endMs = Date.UTC(end.getUTCFullYear(), end.getUTCMonth(), end.getUTCDate());
|
|
1237
1259
|
if (endMs <= startMs) endMs = startMs + 24 * 60 * 60 * 1000;
|
|
1238
1260
|
|
|
1261
|
+
const endMsInclusive = endMs;
|
|
1262
|
+
const endMsExclusive = endMsInclusive + 24 * 60 * 60 * 1000;
|
|
1263
|
+
endMs = endMsExclusive;
|
|
1239
1264
|
const days = Math.max(1, Math.round((endMs - startMs) / (24 * 60 * 60 * 1000)));
|
|
1240
1265
|
|
|
1241
1266
|
const items = await getActiveItems(settings);
|
|
@@ -1260,7 +1285,7 @@ async function handleCreateReservation(req, res) {
|
|
|
1260
1285
|
startMs,
|
|
1261
1286
|
endMs,
|
|
1262
1287
|
startIso: new Date(startMs).toISOString().slice(0, 10),
|
|
1263
|
-
endIso: new Date(endMs).toISOString().slice(0, 10),
|
|
1288
|
+
endIso: new Date(endMs - 24*60*60*1000).toISOString().slice(0, 10),
|
|
1264
1289
|
days,
|
|
1265
1290
|
unitPrice,
|
|
1266
1291
|
total,
|
package/package.json
CHANGED
package/plugin.json
CHANGED
package/public/js/client.js
CHANGED
|
@@ -28,7 +28,17 @@ require(['jquery', 'bootstrap'], function ($, bootstrap) {
|
|
|
28
28
|
return days > 0 ? days : 1;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
|
|
32
|
+
function ecSubtractOneDay(iso) {
|
|
33
|
+
try {
|
|
34
|
+
if (!iso) return iso;
|
|
35
|
+
const d = new Date(iso + 'T00:00:00Z');
|
|
36
|
+
d.setUTCDate(d.getUTCDate() - 1);
|
|
37
|
+
return d.toISOString().slice(0,10);
|
|
38
|
+
} catch (e) { return iso; }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function updateTotalPrice() {
|
|
32
42
|
try {
|
|
33
43
|
const sel = document.getElementById('ec-item-ids');
|
|
34
44
|
const out = document.getElementById('ec-total');
|
|
@@ -41,7 +51,7 @@ require(['jquery', 'bootstrap'], function ($, bootstrap) {
|
|
|
41
51
|
let days = 1;
|
|
42
52
|
if (start && end) {
|
|
43
53
|
const ms = end.getTime() - start.getTime();
|
|
44
|
-
days = Math.max(1, Math.round(ms / (24 * 60 * 60 * 1000)));
|
|
54
|
+
days = Math.max(1, Math.round(ms / (24 * 60 * 60 * 1000)) + 1);
|
|
45
55
|
}
|
|
46
56
|
|
|
47
57
|
let sum = 0;
|
|
@@ -42,19 +42,14 @@
|
|
|
42
42
|
{{{ if hasRows }}}
|
|
43
43
|
<div class="table-responsive">
|
|
44
44
|
<table class="table table-striped align-middle">
|
|
45
|
-
<thead>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<th>Créé</th>
|
|
54
|
-
<th>Note</th>
|
|
55
|
-
<th>Actions</th>
|
|
56
|
-
</tr>
|
|
57
|
-
</thead>
|
|
45
|
+
<thead><tr>
|
|
46
|
+
<th>Matériel</th>
|
|
47
|
+
<th>Période</th>
|
|
48
|
+
<th>Créée le</th>
|
|
49
|
+
<th>Statut</th>
|
|
50
|
+
<th>Total</th>
|
|
51
|
+
<th class="text-end">Actions</th>
|
|
52
|
+
</tr></thead>
|
|
58
53
|
<tbody>
|
|
59
54
|
{{{ each rows }}}
|
|
60
55
|
<tr>
|