nodebb-plugin-onekite-calendar 1.0.11 → 1.0.13
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/lib/widgets.js +29 -5
- package/package.json +1 -1
- package/plugin.json +1 -1
package/lib/widgets.js
CHANGED
|
@@ -169,19 +169,23 @@ widgets.renderTwoWeeksWidget = async function (data) {
|
|
|
169
169
|
height: 'auto',
|
|
170
170
|
headerToolbar: {
|
|
171
171
|
left: 'prev,next',
|
|
172
|
-
|
|
172
|
+
// No range/title in the widget: it becomes redundant and, when the
|
|
173
|
+
// view crosses months, FullCalendar displays a start/end range.
|
|
174
|
+
center: '',
|
|
173
175
|
right: '',
|
|
174
176
|
},
|
|
175
177
|
navLinks: false,
|
|
176
178
|
eventTimeFormat: { hour: '2-digit', minute: '2-digit', hour12: false },
|
|
179
|
+
// Hide date numbers in column headers (keep only weekday)
|
|
180
|
+
dayHeaderFormat: { weekday: 'short' },
|
|
177
181
|
// Force day number to be numeric only (avoid '1 janvier' style labels)
|
|
178
182
|
dayCellContent: function(arg) {
|
|
179
183
|
try {
|
|
180
184
|
const t = String(arg.dayNumberText || '');
|
|
181
185
|
const m = t.match(/^\d+/);
|
|
182
|
-
return { html: m ? m[0] : t };
|
|
186
|
+
return { html: '<span class="fc-daygrid-day-number">' + (m ? m[0] : t) + '</span>' };
|
|
183
187
|
} catch (e) {
|
|
184
|
-
return { html: String(arg.dayNumberText || '') };
|
|
188
|
+
return { html: '<span class="fc-daygrid-day-number">' + String(arg.dayNumberText || '') + '</span>' };
|
|
185
189
|
}
|
|
186
190
|
},
|
|
187
191
|
eventClassNames: function(arg) {
|
|
@@ -235,7 +239,16 @@ widgets.renderTwoWeeksWidget = async function (data) {
|
|
|
235
239
|
.then((json) => successCallback(json || []))
|
|
236
240
|
.catch((e) => failureCallback(e));
|
|
237
241
|
},
|
|
238
|
-
|
|
242
|
+
eventDataTransform: function(ev) {
|
|
243
|
+
try {
|
|
244
|
+
if (ev && ev.extendedProps && String(ev.extendedProps.type) === 'special') {
|
|
245
|
+
// Unify rendering with rentals in the widget: use allDay layout
|
|
246
|
+
ev.allDay = true;
|
|
247
|
+
}
|
|
248
|
+
} catch (e) {}
|
|
249
|
+
return ev;
|
|
250
|
+
},
|
|
251
|
+
dateClick: function() { window.location.href = calUrl; },
|
|
239
252
|
eventDidMount: function(info) {
|
|
240
253
|
try {
|
|
241
254
|
const ev = info.event;
|
|
@@ -256,7 +269,18 @@ widgets.renderTwoWeeksWidget = async function (data) {
|
|
|
256
269
|
|
|
257
270
|
const ep = ev.extendedProps || {};
|
|
258
271
|
const title = (ep.itemNameLine || ep.title || ev.title || '').toString();
|
|
259
|
-
const
|
|
272
|
+
const statusLabel = (function(s){
|
|
273
|
+
const map = {
|
|
274
|
+
pending: 'En attente',
|
|
275
|
+
awaiting_payment: 'Validée – paiement en attente',
|
|
276
|
+
paid: 'Payée',
|
|
277
|
+
rejected: 'Rejetée',
|
|
278
|
+
expired: 'Expirée',
|
|
279
|
+
};
|
|
280
|
+
const k = String(s || '');
|
|
281
|
+
return map[k] || '';
|
|
282
|
+
});
|
|
283
|
+
const status = (String(ep.type || '') === 'reservation') ? statusLabel(ep.status) : '';
|
|
260
284
|
const start = ev.start ? new Date(ev.start) : null;
|
|
261
285
|
const end = ev.end ? new Date(ev.end) : null;
|
|
262
286
|
const pad2 = (n) => String(n).padStart(2, '0');
|
package/package.json
CHANGED
package/plugin.json
CHANGED