Ajoute le support des statuts d'évènements

This commit is contained in:
Tom Hubrecht 2022-03-12 16:39:58 +01:00
parent 0673b3e455
commit 22f055decc
3 changed files with 36 additions and 11 deletions

View file

@ -23,6 +23,11 @@
const toggle = () => (openModal = !openModal); const toggle = () => (openModal = !openModal);
const mobile = window.innerWidth < 765; const mobile = window.innerWidth < 765;
const now = new Date(); const now = new Date();
const scrollTo = (() => {
const time = new Date();
time.setHours(Math.max(0, time.getHours() - 2));
return time.toLocaleTimeString();
})();
let calendar; let calendar;
@ -49,7 +54,7 @@
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
nowIndicator: true, nowIndicator: true,
now: now, now: now,
scrollTime: now.toLocaleTimeString(), scrollTime: scrollTo,
eventClick: info => { eventClick: info => {
openModal = true; openModal = true;
event.set(info.event); event.set(info.event);
@ -82,17 +87,19 @@
<FilterBar {calendarTree} bind:selected={selectedCalendars} /> <FilterBar {calendarTree} bind:selected={selectedCalendars} />
<div class="h-100 d-flex">
<div class="flex-grow-1">
<FullCalendar bind:this={calendar} options={$options} /> <FullCalendar bind:this={calendar} options={$options} />
</div>
</div>
<EventModal event={$event} open={openModal} {toggle} /> <EventModal event={$event} open={openModal} {toggle} />
</div> </div>
<div class="fc-toolbar-title" />
<style> <style>
:global(.st-tentative) {
opacity: 40%;
}
:global(.st-cancelled) {
background: repeating-linear-gradient(45deg, #333, #333 10px, #950 10px, #950 20px);
}
:global(.modal-open) { :global(.modal-open) {
padding-right: 8px !important; padding-right: 8px !important;
} }
@ -101,7 +108,7 @@
cursor: pointer; cursor: pointer;
} }
:global(.modal-body p, ul) { :global(.modal-body p:last-child, ul:last-child) {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }

View file

@ -25,6 +25,18 @@
<b>{event.extendedProps.short_name}</b> <b>{event.extendedProps.short_name}</b>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
{#if event.extendedProps.status === 'CANCELLED'}
<p class="w-100 text-center text-danger">
<Icon name="exclamation-triangle" />
<b class="ms-1">Évènement annulé</b>
</p>
{:else if event.extendedProps.status == 'TENTATIVE'}
<p class="w-100 text-primary text-center">
<Icon name="info-circle" />
<b class="ms-1">Évènement provisoire</b>
</p>
{/if}
{#if event.extendedProps.description} {#if event.extendedProps.description}
{@html md.render(event.extendedProps.description)} {@html md.render(event.extendedProps.description)}
{:else} {:else}

View file

@ -8,7 +8,7 @@ const calendars = {
cloud: clouds.KLUB_RESEAU, cloud: clouds.KLUB_RESEAU,
name: 'Club réseau', name: 'Club réseau',
color: null, color: null,
default_location: "Cave d'hackENS", default_location: "Cave d'hackENS"
}, },
TFEAKjAgNFQZpNjo: { TFEAKjAgNFQZpNjo: {
cloud: clouds.KLUB_RESEAU, cloud: clouds.KLUB_RESEAU,
@ -49,9 +49,9 @@ export const calendarTree = {
'Club réseau': {}, 'Club réseau': {},
hackENS: {}, hackENS: {},
"Écriv'ENS": {}, "Écriv'ENS": {},
"CinéClub": {}, CinéClub: {},
Ernestophone: {}, Ernestophone: {},
'Club inutile': {}, 'Club inutile': {}
}, },
COF: { COF: {
BDA: {}, BDA: {},
@ -120,6 +120,12 @@ function fcEventFromjCalEvent(cal) {
fcEvent.description = evt.description fcEvent.description = evt.description
fcEvent.location = evt.location || cal.default_location fcEvent.location = evt.location || cal.default_location
if (evt.status) {
fcEvent.status = evt.status
fcEvent.classNames = [`st-${evt.status.toLowerCase()}`]
console.log(evt.status, evt.summary)
}
if (evt.rrule) { if (evt.rrule) {
const { freq, byday, interval } = evt.rrule const { freq, byday, interval } = evt.rrule
fcEvent.rrule = { fcEvent.rrule = {