nodebb-plugin-equipment-calendar 0.2.5 → 0.2.6
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 +2 -1
- package/package.json +1 -1
- package/public/templates/admin/plugins/equipment-calendar.tpl +14 -14
- package/public/templates/equipment-calendar/approvals.tpl +18 -18
- package/public/templates/equipment-calendar/calendar.tpl +17 -20
- package/public/templates/equipment-calendar/payment-return.tpl +5 -5
package/library.js
CHANGED
|
@@ -466,8 +466,9 @@ async function renderCalendarPage(req, res) {
|
|
|
466
466
|
startISO: start.toISO(),
|
|
467
467
|
endISO: end.toISO(),
|
|
468
468
|
initialDateISO: start.toISODate(),
|
|
469
|
-
|
|
469
|
+
eventsB64: Buffer.from(JSON.stringify(events), 'utf8').toString('base64'),
|
|
470
470
|
canCreate: canUserCreate,
|
|
471
|
+
canCreateJs: canUserCreate ? 'true' : 'false',
|
|
471
472
|
isApprover,
|
|
472
473
|
csrf: req.csrfToken,
|
|
473
474
|
forumUrl: nconf.get('url'),
|
package/package.json
CHANGED
|
@@ -15,46 +15,46 @@
|
|
|
15
15
|
<h5>Permissions</h5>
|
|
16
16
|
<div class="mb-3">
|
|
17
17
|
<label class="form-label">Groupes autorisés à créer (CSV)</label>
|
|
18
|
-
<input id="creatorGroups" class="form-control" value="{
|
|
18
|
+
<input id="creatorGroups" class="form-control" value="{settings.creatorGroups}">
|
|
19
19
|
</div>
|
|
20
20
|
<div class="mb-3">
|
|
21
21
|
<label class="form-label">Groupe validateur</label>
|
|
22
|
-
<input id="approverGroup" class="form-control" value="{
|
|
22
|
+
<input id="approverGroup" class="form-control" value="{settings.approverGroup}">
|
|
23
23
|
</div>
|
|
24
24
|
<div class="mb-3">
|
|
25
25
|
<label class="form-label">Groupe notifié (emails/notifs)</label>
|
|
26
|
-
<input id="notifyGroup" class="form-control" value="{
|
|
26
|
+
<input id="notifyGroup" class="form-control" value="{settings.notifyGroup}">
|
|
27
27
|
</div>
|
|
28
28
|
<div class="form-check">
|
|
29
|
-
<input class="form-check-input" type="checkbox" id="showRequesterToAll" {{
|
|
29
|
+
<input class="form-check-input" type="checkbox" id="showRequesterToAll" {{{ if view_showRequesterToAll }}}checked{{{ end }}}>
|
|
30
30
|
<label class="form-check-label" for="showRequesterToAll">Afficher le demandeur à tout le monde</label>
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
34
|
<div class="card card-body mb-3">
|
|
35
35
|
<h5>Matériel</h5>
|
|
36
|
-
<textarea id="itemsJson" class="form-control" rows="10">{
|
|
36
|
+
<textarea id="itemsJson" class="form-control" rows="10">{settings.itemsJson}</textarea>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
39
|
<div class="card card-body mb-3">
|
|
40
40
|
<h5>HelloAsso</h5>
|
|
41
|
-
<div class="mb-3"><label class="form-label">Client ID</label><input id="ha_clientId" class="form-control" value="{
|
|
42
|
-
<div class="mb-3"><label class="form-label">Client Secret</label><input id="ha_clientSecret" class="form-control" value="{
|
|
43
|
-
<div class="mb-3"><label class="form-label">Organization Slug</label><input id="ha_organizationSlug" class="form-control" value="{
|
|
44
|
-
<div class="mb-3"><label class="form-label">Return URL</label><input id="ha_returnUrl" class="form-control" value="{
|
|
45
|
-
<div class="mb-3"><label class="form-label">Webhook Secret (HMAC SHA256)</label><input id="ha_webhookSecret" class="form-control" value="{
|
|
41
|
+
<div class="mb-3"><label class="form-label">Client ID</label><input id="ha_clientId" class="form-control" value="{settings.ha_clientId}"></div>
|
|
42
|
+
<div class="mb-3"><label class="form-label">Client Secret</label><input id="ha_clientSecret" class="form-control" value="{settings.ha_clientSecret}"></div>
|
|
43
|
+
<div class="mb-3"><label class="form-label">Organization Slug</label><input id="ha_organizationSlug" class="form-control" value="{settings.ha_organizationSlug}"></div>
|
|
44
|
+
<div class="mb-3"><label class="form-label">Return URL</label><input id="ha_returnUrl" class="form-control" value="{settings.ha_returnUrl}"></div>
|
|
45
|
+
<div class="mb-3"><label class="form-label">Webhook Secret (HMAC SHA256)</label><input id="ha_webhookSecret" class="form-control" value="{settings.ha_webhookSecret}"></div>
|
|
46
46
|
</div>
|
|
47
47
|
|
|
48
48
|
<div class="card card-body mb-3">
|
|
49
49
|
<h5>Calendrier</h5>
|
|
50
50
|
<div class="mb-3"><label class="form-label">Vue par défaut</label>
|
|
51
51
|
<select id="defaultView" class="form-select">
|
|
52
|
-
<option value="dayGridMonth" {{
|
|
53
|
-
<option value="timeGridWeek" {{
|
|
54
|
-
<option value="timeGridDay" {{
|
|
52
|
+
<option value="dayGridMonth" {{{ if view_dayGridMonth }}}selected{{{ end }}}>Mois</option>
|
|
53
|
+
<option value="timeGridWeek" {{{ if view_timeGridWeek }}}selected{{{ end }}}>Semaine</option>
|
|
54
|
+
<option value="timeGridDay" {{{ if view_timeGridDay }}}selected{{{ end }}}>Jour</option>
|
|
55
55
|
</select>
|
|
56
56
|
</div>
|
|
57
|
-
<div class="mb-3"><label class="form-label">Timezone</label><input id="timezone" class="form-control" value="{
|
|
57
|
+
<div class="mb-3"><label class="form-label">Timezone</label><input id="timezone" class="form-control" value="{settings.timezone}"></div>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
60
60
|
<button id="save" class="btn btn-primary">Sauvegarder</button>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div class="equipment-approvals-page">
|
|
2
2
|
<h1>Validation des réservations</h1>
|
|
3
3
|
|
|
4
|
-
{{
|
|
4
|
+
{{{ if hasRows }}}
|
|
5
5
|
<div class="table-responsive">
|
|
6
6
|
<table class="table table-striped align-middle">
|
|
7
7
|
<thead>
|
|
@@ -16,36 +16,36 @@
|
|
|
16
16
|
</tr>
|
|
17
17
|
</thead>
|
|
18
18
|
<tbody>
|
|
19
|
-
{{
|
|
19
|
+
{{{ each rows }}}
|
|
20
20
|
<tr>
|
|
21
|
-
<td>{
|
|
22
|
-
<td>{
|
|
23
|
-
<td>{
|
|
24
|
-
<td>{
|
|
25
|
-
<td><code>{
|
|
21
|
+
<td>{rows.itemName}</td>
|
|
22
|
+
<td>{rows.requester}</td>
|
|
23
|
+
<td>{rows.start}</td>
|
|
24
|
+
<td>{rows.end}</td>
|
|
25
|
+
<td><code>{rows.status}</code></td>
|
|
26
26
|
<td>
|
|
27
|
-
{{
|
|
28
|
-
<a href="{
|
|
29
|
-
{{else}}
|
|
27
|
+
{{{ if rows.paymentUrl }}}
|
|
28
|
+
<a href="{rows.paymentUrl}" target="_blank" rel="noreferrer">Lien</a>
|
|
29
|
+
{{{ else }}}
|
|
30
30
|
-
|
|
31
|
-
{{
|
|
31
|
+
{{{ end }}}
|
|
32
32
|
</td>
|
|
33
33
|
<td>
|
|
34
|
-
<form method="post" action="/equipment/reservations/{
|
|
35
|
-
<input type="hidden" name="_csrf" value="{
|
|
34
|
+
<form method="post" action="/equipment/reservations/{rows.id}/approve" class="d-inline">
|
|
35
|
+
<input type="hidden" name="_csrf" value="{rows.csrf}">
|
|
36
36
|
<button class="btn btn-sm btn-success" type="submit">Approuver</button>
|
|
37
37
|
</form>
|
|
38
|
-
<form method="post" action="/equipment/reservations/{
|
|
39
|
-
<input type="hidden" name="_csrf" value="{
|
|
38
|
+
<form method="post" action="/equipment/reservations/{rows.id}/reject" class="d-inline ms-1">
|
|
39
|
+
<input type="hidden" name="_csrf" value="{rows.csrf}">
|
|
40
40
|
<button class="btn btn-sm btn-danger" type="submit">Refuser</button>
|
|
41
41
|
</form>
|
|
42
42
|
</td>
|
|
43
43
|
</tr>
|
|
44
|
-
{{
|
|
44
|
+
{{{ end }}}
|
|
45
45
|
</tbody>
|
|
46
46
|
</table>
|
|
47
47
|
</div>
|
|
48
|
-
{{else}}
|
|
48
|
+
{{{ else }}}
|
|
49
49
|
<div class="alert alert-success">Aucune demande en attente 🎉</div>
|
|
50
|
-
{{
|
|
50
|
+
{{{ end }}}
|
|
51
51
|
</div>
|
|
@@ -6,22 +6,22 @@
|
|
|
6
6
|
<div>
|
|
7
7
|
<label class="form-label">Matériel</label>
|
|
8
8
|
<select name="itemId" class="form-select" onchange="this.form.submit()">
|
|
9
|
-
{{
|
|
10
|
-
<option value="{
|
|
11
|
-
{{
|
|
9
|
+
{{{ each items }}}
|
|
10
|
+
<option value="{items.id}" {{{ if items.selected }}}selected{{{ end }}}>{items.name} — {items.location}</option>
|
|
11
|
+
{{{ end }}}
|
|
12
12
|
</select>
|
|
13
13
|
</div>
|
|
14
14
|
<div class="text-muted small">
|
|
15
|
-
<div><strong>Lieu:</strong> {
|
|
16
|
-
<div><strong>Prix:</strong> {
|
|
15
|
+
<div><strong>Lieu:</strong> {chosenItemLocation}</div>
|
|
16
|
+
<div><strong>Prix:</strong> {chosenItemPriceCents} cts</div>
|
|
17
17
|
</div>
|
|
18
18
|
</form>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
{{
|
|
21
|
+
{{{ if canCreate }}}
|
|
22
22
|
<form id="ec-create-form" method="post" action="/equipment/reservations/create" class="card card-body mb-3">
|
|
23
|
-
<input type="hidden" name="_csrf" value="{
|
|
24
|
-
<input type="hidden" name="itemId" value="{
|
|
23
|
+
<input type="hidden" name="_csrf" value="{csrf}">
|
|
24
|
+
<input type="hidden" name="itemId" value="{chosenItemId}">
|
|
25
25
|
<input type="hidden" name="start" value="">
|
|
26
26
|
<input type="hidden" name="end" value="">
|
|
27
27
|
<div class="row g-2 align-items-end">
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
<div class="form-text">Clique sur une date ou sélectionne une plage sur le calendrier pour soumettre une demande.</div>
|
|
37
37
|
</form>
|
|
38
|
-
{{else}}
|
|
38
|
+
{{{ else }}}
|
|
39
39
|
<div class="alert alert-info">Tu peux consulter le calendrier, mais tu n’as pas les droits pour créer une demande.</div>
|
|
40
|
-
{{
|
|
40
|
+
{{{ end }}}
|
|
41
41
|
|
|
42
42
|
<div class="card card-body">
|
|
43
43
|
<div id="equipment-calendar"></div>
|
|
44
44
|
</div>
|
|
45
45
|
|
|
46
|
-
{{
|
|
46
|
+
{{{ if isApprover }}}
|
|
47
47
|
<div class="mt-3">
|
|
48
48
|
<a class="btn btn-outline-secondary" href="/equipment/approvals">Aller à la validation</a>
|
|
49
49
|
</div>
|
|
50
|
-
{{
|
|
50
|
+
{{{ end }}}
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
53
|
<link rel="stylesheet" href="/plugins/nodebb-plugin-equipment-calendar/vendor/index.global.min.css">
|
|
@@ -55,16 +55,13 @@
|
|
|
55
55
|
<script src="/plugins/nodebb-plugin-equipment-calendar/js/client.js"></script>
|
|
56
56
|
|
|
57
57
|
<script>
|
|
58
|
-
|
|
59
|
-
window.
|
|
60
|
-
window.
|
|
61
|
-
window.
|
|
62
|
-
window.
|
|
63
|
-
window.EC_CAN_CREATE = {{#if canCreate}}true{{else}}false{{/if}};
|
|
58
|
+
window.EC_EVENTS = JSON.parse(atob('{eventsB64}'));
|
|
59
|
+
window.EC_INITIAL_DATE = "{initialDateISO}";
|
|
60
|
+
window.EC_INITIAL_VIEW = "{view}";
|
|
61
|
+
window.EC_TZ = "{tz}";
|
|
62
|
+
window.EC_CAN_CREATE = {canCreateJs};
|
|
64
63
|
</script>
|
|
65
64
|
|
|
66
|
-
<script type="application/json" id="ec-events-json">{{{eventsJson}}}</script>
|
|
67
|
-
|
|
68
65
|
<style>
|
|
69
66
|
.ec-status-pending .fc-event-title { font-weight: 600; }
|
|
70
67
|
.ec-status-valid .fc-event-title { font-weight: 700; }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<div class="equipment-payment-return">
|
|
2
2
|
<h1>Paiement</h1>
|
|
3
|
-
{{
|
|
4
|
-
<div class="alert alert-danger">Le paiement semble avoir échoué. Référence réservation: <code>{
|
|
5
|
-
{{else}}
|
|
6
|
-
<div class="alert alert-info">Merci. Si le paiement est confirmé, la réservation passera en "validée". Référence: <code>{
|
|
7
|
-
{{
|
|
3
|
+
{{{ if statusError }}}
|
|
4
|
+
<div class="alert alert-danger">Le paiement semble avoir échoué. Référence réservation: <code>{rid}</code></div>
|
|
5
|
+
{{{ else }}}
|
|
6
|
+
<div class="alert alert-info">Merci. Si le paiement est confirmé, la réservation passera en "validée". Référence: <code>{rid}</code></div>
|
|
7
|
+
{{{ end }}}
|
|
8
8
|
<a class="btn btn-primary" href="/equipment/calendar">Retour au calendrier</a>
|
|
9
9
|
</div>
|