nodebb-plugin-calendar-onekite 2.0.0 → 2.1.1
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/README.md +7 -0
- package/library.js +230 -148
- package/package.json +1 -1
- package/plugin.json +2 -2
- package/static/js/admin-planning.js +133 -0
- package/static/js/admin.bundle.js +248 -0
- package/static/js/admin.js +9 -0
- package/static/js/calendar.bundle.js +269 -0
- package/static/js/calendar.js +130 -105
- package/static/js/my-reservations.bundle.js +42 -0
- package/templates/admin/calendar-planning.tpl +32 -20
- package/templates/admin/plugins/calendar-onekite.tpl +20 -0
- package/templates/calendar-my-reservations.tpl +2 -0
- package/templates/calendar.tpl +11 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
(function(){
|
|
2
|
+
'use strict';
|
|
3
|
+
if (window.__onekiteMyResLoaded) return;
|
|
4
|
+
window.__onekiteMyResLoaded=true;
|
|
5
|
+
|
|
6
|
+
function qs(sel, root){ return (root||document).querySelector(sel); }
|
|
7
|
+
function escapeHtml(s){
|
|
8
|
+
return String(s ?? '').replaceAll('&','&').replaceAll('<','<').replaceAll('>','>')
|
|
9
|
+
.replaceAll('"','"').replaceAll("'","'");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function boot(api, alerts){
|
|
13
|
+
async function load(){
|
|
14
|
+
const tbody=qs('#my-reservations-body');
|
|
15
|
+
if (!tbody) return;
|
|
16
|
+
try{
|
|
17
|
+
const rows=await api.get('/calendar/my-reservations');
|
|
18
|
+
if (!rows || !rows.length){
|
|
19
|
+
tbody.innerHTML='<tr><td colspan="7">Aucune réservation.</td></tr>'; return;
|
|
20
|
+
}
|
|
21
|
+
tbody.innerHTML = rows.map(r=>`
|
|
22
|
+
<tr>
|
|
23
|
+
<td>${escapeHtml(r.eventTitle)}</td>
|
|
24
|
+
<td>${escapeHtml(r.itemName)}</td>
|
|
25
|
+
<td>${escapeHtml(r.pickupLocation || '')}</td>
|
|
26
|
+
<td>${escapeHtml(r.dateStart)}</td>
|
|
27
|
+
<td>${escapeHtml(r.dateEnd)}</td>
|
|
28
|
+
<td>${escapeHtml(r.days || '')}</td>
|
|
29
|
+
<td>${escapeHtml(r.status)}</td>
|
|
30
|
+
</tr>
|
|
31
|
+
`).join('');
|
|
32
|
+
} catch(e){ console.error(e); alerts.error(e?.message||e); }
|
|
33
|
+
}
|
|
34
|
+
async function init(){ if (!qs('#calendar-my-reservations')) return; await load(); }
|
|
35
|
+
document.addEventListener('action:ajaxify.end', init);
|
|
36
|
+
init();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof require === 'function'){
|
|
40
|
+
require(['api','alerts'], function(api, alerts){ boot(api, alerts); });
|
|
41
|
+
}
|
|
42
|
+
})();
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/index.global.min.css">
|
|
2
|
+
<link rel="stylesheet" href="/plugins/nodebb-plugin-calendar-onekite/static/css/calendar-onekite.css">
|
|
3
|
+
|
|
1
4
|
<div id="calendar-planning">
|
|
2
|
-
<h2>Planning
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
<h2>Planning (graphique)</h2>
|
|
6
|
+
|
|
7
|
+
<div class="row mb-3">
|
|
8
|
+
<div class="col-md-4">
|
|
9
|
+
<label>Lieu</label>
|
|
10
|
+
<select id="planning-filter-location" class="form-control"></select>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="col-md-4">
|
|
13
|
+
<label>Matériel</label>
|
|
14
|
+
<select id="planning-filter-item" class="form-control"></select>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="col-md-4">
|
|
17
|
+
<label>Statut</label>
|
|
18
|
+
<select id="planning-filter-status" class="form-control">
|
|
19
|
+
<option value="">Tous</option>
|
|
20
|
+
<option value="pending_admin">pending_admin</option>
|
|
21
|
+
<option value="awaiting_payment">awaiting_payment</option>
|
|
22
|
+
<option value="paid">paid</option>
|
|
23
|
+
</select>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div id="planning-calendar"></div>
|
|
21
28
|
</div>
|
|
22
29
|
|
|
30
|
+
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.15/index.global.min.js"></script>
|
|
23
31
|
<script>
|
|
24
|
-
require(['plugins/nodebb-plugin-calendar-onekite/static/js/admin'], function () {
|
|
32
|
+
require(['plugins/nodebb-plugin-calendar-onekite/static/js/admin-planning'], function (Mod) {
|
|
33
|
+
Mod.init && Mod.init();
|
|
34
|
+
});
|
|
25
35
|
</script>
|
|
36
|
+
|
|
37
|
+
<script src="/plugins/nodebb-plugin-calendar-onekite/static/js/admin.bundle.js"></script>
|
|
@@ -25,6 +25,24 @@
|
|
|
25
25
|
<input id="calendar-onekite-widget-limit" type="number" class="form-control" value="{settings.limit}">
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
|
+
<hr>
|
|
29
|
+
<h3>Lieux & Inventaire (global)</h3>
|
|
30
|
+
<p class="text-muted">
|
|
31
|
+
Les stocks sont globaux et séparés par lieu. Format JSON.
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<div class="form-group">
|
|
35
|
+
<label>Lieux (locations)</label>
|
|
36
|
+
<textarea id="calendar-onekite-locations" class="form-control" rows="4">{settings.locationsJson}</textarea>
|
|
37
|
+
<small>Ex: [{"id":"arnaud","name":"Chez Arnaud"},{"id":"siege","name":"Siège Onekite"}]</small>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="form-group">
|
|
41
|
+
<label>Inventaire (inventory)</label>
|
|
42
|
+
<textarea id="calendar-onekite-inventory" class="form-control" rows="6">{settings.inventoryJson}</textarea>
|
|
43
|
+
<small>Ex: [{"id":"wing","name":"Aile Wing","price":5,"stockByLocation":{"arnaud":1,"siege":0}}]</small>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
28
46
|
<hr>
|
|
29
47
|
<h3>HelloAsso</h3>
|
|
30
48
|
<div class="form-group">
|
|
@@ -59,3 +77,5 @@
|
|
|
59
77
|
<script>
|
|
60
78
|
require(['plugins/nodebb-plugin-calendar-onekite/static/js/admin'], function () {});
|
|
61
79
|
</script>
|
|
80
|
+
|
|
81
|
+
<script src="/plugins/nodebb-plugin-calendar-onekite/static/js/admin.bundle.js"></script>
|
package/templates/calendar.tpl
CHANGED
|
@@ -52,8 +52,11 @@
|
|
|
52
52
|
<label><input type="checkbox" id="event-bookingEnabled"> Activer les réservations</label>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
|
-
<div
|
|
56
|
-
|
|
55
|
+
<div class="form-group">
|
|
56
|
+
<label>Matériel autorisé pour cet événement</label>
|
|
57
|
+
<div id="booking-items"></div>
|
|
58
|
+
<small class="text-muted">Le stock est global par lieu (configuré dans l’admin du plugin).</small>
|
|
59
|
+
</div>
|
|
57
60
|
|
|
58
61
|
<div style="margin-top: 20px;">
|
|
59
62
|
<button id="event-save" class="btn btn-primary">Enregistrer</button>
|
|
@@ -70,6 +73,11 @@
|
|
|
70
73
|
<h3 id="reserve-title"></h3>
|
|
71
74
|
<div id="reserve-items"></div>
|
|
72
75
|
|
|
76
|
+
<div class="form-group">
|
|
77
|
+
<label>Lieu de retrait</label>
|
|
78
|
+
<select id="reserve-location" class="form-control"></select>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
73
81
|
<div class="form-group">
|
|
74
82
|
<label>Date de début</label>
|
|
75
83
|
<input type="date" id="reserve-start" class="form-control">
|
|
@@ -96,5 +104,6 @@ require(['plugins/nodebb-plugin-calendar-onekite/static/js/calendar'], function
|
|
|
96
104
|
Calendar.init && Calendar.init();
|
|
97
105
|
});
|
|
98
106
|
</script>
|
|
107
|
+
<script src="/plugins/nodebb-plugin-calendar-onekite/static/js/calendar.bundle.js"></script>
|
|
99
108
|
|
|
100
109
|
<!-- IMPORT partials/footer.tpl -->
|