nodebb-plugin-equipment-calendar 2.0.5 → 2.2.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/library.js
CHANGED
|
@@ -16,6 +16,17 @@ const helpers = require.main.require('./src/controllers/helpers');
|
|
|
16
16
|
const nconf = require.main.require('nconf');
|
|
17
17
|
|
|
18
18
|
const winston = require.main.require('winston');
|
|
19
|
+
|
|
20
|
+
function generateId() {
|
|
21
|
+
try {
|
|
22
|
+
// Node 14+ / modern: crypto.randomUUID
|
|
23
|
+
const crypto = require('crypto');
|
|
24
|
+
if (crypto.randomUUID) return crypto.randomUUID();
|
|
25
|
+
return crypto.randomBytes(16).toString('hex');
|
|
26
|
+
} catch (e) {
|
|
27
|
+
return String(Date.now()) + '-' + Math.random().toString(16).slice(2);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
19
30
|
const axios = require('axios');
|
|
20
31
|
const { DateTime } = require('luxon');
|
|
21
32
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -287,7 +298,7 @@ async function getActiveItems() {
|
|
|
287
298
|
const items = (Array.isArray(rawItems) ? rawItems : []).map((it) => ({
|
|
288
299
|
id: String(it.id || '').trim(),
|
|
289
300
|
name: String(it.name || '').trim(),
|
|
290
|
-
price:
|
|
301
|
+
price: Number(it.price || 0) || 0,
|
|
291
302
|
active: true,
|
|
292
303
|
})).filter(it => it.id && it.name);
|
|
293
304
|
return items;
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
<div class="mb-3">
|
|
43
43
|
<label class="form-label">Matériel</label>
|
|
44
44
|
<select class="form-select" id="ec-item-ids" name="itemIds" multiple required>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
<!-- BEGIN items -->
|
|
46
|
+
<option value="{items.id}" data-price="{items.price}">{items.name} — {items.price} €</option>
|
|
47
|
+
<!-- END items -->
|
|
48
|
+
</select>
|
|
49
49
|
<div class="form-text">Tu peux sélectionner plusieurs matériels.</div>
|
|
50
50
|
</div>
|
|
51
51
|
|