nodebb-plugin-calendar-onekite 1.3.3 → 1.3.5
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/helloasso.js
CHANGED
|
@@ -33,7 +33,7 @@ async function getHelloAssoAccessToken() {
|
|
|
33
33
|
|
|
34
34
|
async function createHelloAssoCheckoutIntent({ eid, rid, uid, itemId, quantity, amount }) {
|
|
35
35
|
if (!HELLOASSO_ORG_SLUG || !HELLOASSO_FORM_SLUG) {
|
|
36
|
-
console.warn('[calendar-
|
|
36
|
+
console.warn('[calendar-onekite] HelloAsso non configuré, retournera une URL générique.');
|
|
37
37
|
return 'https://www.helloasso.com/';
|
|
38
38
|
}
|
|
39
39
|
|
package/library.js
CHANGED
|
@@ -140,7 +140,7 @@ async function getUpcomingEvents(limit = 5) {
|
|
|
140
140
|
|
|
141
141
|
async function userCanCreate(uid) {
|
|
142
142
|
if (!uid || uid === 0) return false;
|
|
143
|
-
const settings = await Settings.get('calendar-
|
|
143
|
+
const settings = await Settings.get('calendar-onekite');
|
|
144
144
|
if (!settings || !settings.allowedGroups) return false;
|
|
145
145
|
|
|
146
146
|
const allowedSet = new Set(
|
|
@@ -159,7 +159,7 @@ async function userCanCreate(uid) {
|
|
|
159
159
|
async function userCanBook(uid) {
|
|
160
160
|
if (!uid || uid === 0) return false;
|
|
161
161
|
|
|
162
|
-
const settings = await Settings.get('calendar-
|
|
162
|
+
const settings = await Settings.get('calendar-onekite');
|
|
163
163
|
// Si pas configuré, on permet à tout le monde connecté
|
|
164
164
|
if (!settings || !settings.allowedBookingGroups) return true;
|
|
165
165
|
|
|
@@ -412,7 +412,7 @@ Plugin.init = async function (params) {
|
|
|
412
412
|
pickupLocation: reservation.pickupLocation || 'Non précisé',
|
|
413
413
|
});
|
|
414
414
|
} catch (e) {
|
|
415
|
-
console.warn('[calendar-
|
|
415
|
+
console.warn('[calendar-onekite] email reservation-created error:', e.message);
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
res.json({
|
|
@@ -499,7 +499,7 @@ Plugin.init = async function (params) {
|
|
|
499
499
|
days: reservation.days || 1,
|
|
500
500
|
});
|
|
501
501
|
} catch (e) {
|
|
502
|
-
console.warn('[calendar-
|
|
502
|
+
console.warn('[calendar-onekite] email reservation-approved error:', e.message);
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
res.json({ success: true, checkoutUrl });
|
|
@@ -592,12 +592,12 @@ Plugin.init = async function (params) {
|
|
|
592
592
|
days: reservation.days || 1,
|
|
593
593
|
});
|
|
594
594
|
} catch (e) {
|
|
595
|
-
console.warn('[calendar-
|
|
595
|
+
console.warn('[calendar-onekite] email payment-confirmed error:', e.message);
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
res.json({ ok: true });
|
|
599
599
|
} catch (err) {
|
|
600
|
-
console.error('[calendar-
|
|
600
|
+
console.error('[calendar-onekite] HelloAsso webhook error:', err);
|
|
601
601
|
res.status(500).json({ error: err.message });
|
|
602
602
|
}
|
|
603
603
|
});
|
|
@@ -609,7 +609,7 @@ Plugin.init = async function (params) {
|
|
|
609
609
|
|
|
610
610
|
router.put('/api/admin/plugins/nodebb-plugin-calendar-onekite', middleware.admin.checkPrivileges, async (req, res) => {
|
|
611
611
|
try {
|
|
612
|
-
await Settings.set('calendar-
|
|
612
|
+
await Settings.set('calendar-onekite', req.body);
|
|
613
613
|
res.json({ status: 'ok' });
|
|
614
614
|
} catch (err) {
|
|
615
615
|
res.status(500).json({ error: err.message });
|
|
@@ -708,7 +708,7 @@ function renderPlanningPage(req, res) {
|
|
|
708
708
|
|
|
709
709
|
Plugin.addAdminNavigation = function (header) {
|
|
710
710
|
header.plugins.push({
|
|
711
|
-
route: '/plugins/calendar-
|
|
711
|
+
route: '/plugins/calendar-onekite',
|
|
712
712
|
icon: 'fa fa-calendar',
|
|
713
713
|
name: 'Calendar Lite',
|
|
714
714
|
});
|
|
@@ -727,7 +727,7 @@ Plugin.defineWidgets = async function (widgets) {
|
|
|
727
727
|
|
|
728
728
|
Plugin.renderUpcomingWidget = async function (widget, callback) {
|
|
729
729
|
try {
|
|
730
|
-
const settings = await Settings.get('calendar-
|
|
730
|
+
const settings = await Settings.get('calendar-onekite') || {};
|
|
731
731
|
const limit = Number(widget.data.limit || settings.limit || 5);
|
|
732
732
|
const events = await getUpcomingEvents(limit);
|
|
733
733
|
const html = await appRef.renderAsync('widgets/calendar-upcoming', { events });
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "nodebb-plugin-calendar-
|
|
2
|
+
"id": "nodebb-plugin-calendar-onekite",
|
|
3
3
|
"name": "Calendar Onekite",
|
|
4
4
|
"description": "Calendrier + réservation de matériel + validation admin + paiement HelloAsso pour NodeBB v4",
|
|
5
5
|
"url": "",
|
|
6
|
-
"version": "1.3.
|
|
6
|
+
"version": "1.3.5",
|
|
7
7
|
"library": "./library.js",
|
|
8
8
|
"staticDirs": {
|
|
9
9
|
"static": "static"
|
package/static/js/admin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
$(document).ready(function () {
|
|
4
|
-
if (!$('#calendar-
|
|
4
|
+
if (!$('#calendar-onekite-admin').length && !$('#calendar-planning').length) return;
|
|
5
5
|
|
|
6
6
|
const AdminCalendar = {
|
|
7
7
|
|
|
8
8
|
initSettings: function () {
|
|
9
|
-
if (!$('#calendar-
|
|
9
|
+
if (!$('#calendar-onekite-admin').length) return;
|
|
10
10
|
AdminCalendar.bindSettingsSave();
|
|
11
11
|
AdminCalendar.loadPending();
|
|
12
12
|
},
|
|
@@ -17,15 +17,15 @@ $(document).ready(function () {
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
bindSettingsSave: function () {
|
|
20
|
-
$('#calendar-
|
|
20
|
+
$('#calendar-onekite-save').on('click', () => {
|
|
21
21
|
const settings = {
|
|
22
|
-
allowedGroups: $('#calendar-
|
|
23
|
-
allowedBookingGroups: $('#calendar-
|
|
24
|
-
limit: $('#calendar-
|
|
22
|
+
allowedGroups: $('#calendar-onekite-groups').val(),
|
|
23
|
+
allowedBookingGroups: $('#calendar-onekite-book-groups').val(),
|
|
24
|
+
limit: $('#calendar-onekite-widget-limit').val()
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
$.ajax({
|
|
28
|
-
url: '/api/admin/plugins/calendar-
|
|
28
|
+
url: '/api/admin/plugins/nodebb-plugin-calendar-onekite',
|
|
29
29
|
method: 'PUT',
|
|
30
30
|
contentType: 'application/json',
|
|
31
31
|
data: JSON.stringify(settings)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div id="calendar-
|
|
1
|
+
<div id="calendar-onekite-admin">
|
|
2
2
|
<h2>Calendar Lite – Administration</h2>
|
|
3
3
|
|
|
4
4
|
<h3>Réservations en attente</h3>
|
|
@@ -10,19 +10,20 @@
|
|
|
10
10
|
|
|
11
11
|
<div class="form-group">
|
|
12
12
|
<label>Groupes autorisés à créer / modifier des événements</label>
|
|
13
|
-
<input id="calendar-
|
|
13
|
+
<input id="calendar-onekite-groups" class="form-control" value="{settings.allowedGroups}">
|
|
14
14
|
<small>Ex : administrators, moderators</small>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
<div class="form-group">
|
|
18
19
|
<label>Nombre d’événements dans le widget</label>
|
|
19
|
-
<input id="calendar-
|
|
20
|
+
<input id="calendar-onekite-widget-limit" type="number" class="form-control" value="{settings.limit}">
|
|
20
21
|
<label>Groupes autorisés à réserver</label>
|
|
21
|
-
<input id="calendar-
|
|
22
|
+
<input id="calendar-onekite-book-groups" class="form-control" value="{settings.allowedBookingGroups}">
|
|
22
23
|
<small>Ex : registered-users, membres, vip</small>
|
|
23
24
|
</div>
|
|
24
25
|
|
|
25
|
-
<button id="calendar-
|
|
26
|
+
<button id="calendar-onekite-save" class="btn btn-primary">Enregistrer</button>
|
|
26
27
|
</div>
|
|
27
28
|
|
|
28
|
-
<script src="/plugins/nodebb-plugin-calendar-
|
|
29
|
+
<script src="/plugins/nodebb-plugin-calendar-onekite/static/js/admin.js"></script>
|