diff --git a/assets/css/src/collapsable-section.css b/assets/css/src/collapsable-section.css index 40b5b14..0946ae5 100644 --- a/assets/css/src/collapsable-section.css +++ b/assets/css/src/collapsable-section.css @@ -50,7 +50,7 @@ } .sessions--detailed .session { - grid-template-columns: 1.5fr 2fr 1fr 1fr 1.5fr !important; + grid-template-columns: 1.5fr 2fr 1fr 1fr 2.5fr !important; } .collapsable__content .production p:not(:last-child) { diff --git a/assets/css/src/generic.css b/assets/css/src/generic.css index de3dc0e..841048d 100644 --- a/assets/css/src/generic.css +++ b/assets/css/src/generic.css @@ -137,7 +137,7 @@ .session__event-link { display: grid; - grid-template-columns: repeat(5, 1fr); + grid-template-columns: 1fr 1fr 1fr 1fr 1.5fr; padding: var(--padding-vertical) var(--space-m); } diff --git a/site/blueprints/pages/event.yml b/site/blueprints/pages/event.yml index a3a1c2c..a49716a 100644 --- a/site/blueprints/pages/event.yml +++ b/site/blueprints/pages/event.yml @@ -5,6 +5,25 @@ tabs: label: Contenu icon: false columns: + - width: 1/1 + fields: + totalStock: + label: Nombre total de places + type: number + disabled: true + when: + isMapadoEvent: true + width: 1/4 + category: + label: Catégorie + type: select + width: 1/4 + options: + type: query + query: page.parent.parent.categories.split + color: + extends: fields/color + width: 2/4 - width: 1/2 fields: mapadoKeyInfos: @@ -12,7 +31,7 @@ tabs: type: info width: 1/2 text: | - [Gérer l'événement Mapado](https://desk.mapado.com/mass-action/ticketing/{{page.mapadoId}}). + Les données verrouillées proviennent de [l'événement Mapado](https://desk.mapado.com/mass-action/ticketing/{{page.mapadoId}}). **Infos erronées ?** Enregistrez (touches ⌘ / ctrl + s) et rechargez la page. @@ -164,16 +183,6 @@ tabs: label: Réglages icon: cog fields: - category: - label: Catégorie - type: select - width: 1/4 - options: - type: query - query: page.parent.parent.categories.split - color: - extends: fields/color - width: 3/4 mapadoLine: type: line isMapadoEvent: diff --git a/site/config/config.php b/site/config/config.php index a2f026f..7b49b56 100644 --- a/site/config/config.php +++ b/site/config/config.php @@ -46,5 +46,4 @@ return [ ], 'locale' => 'fr_FR.UTF-8', 'ticketingUrl' => 'https://cdn-besancon.mapado.com/', - 'stockThreshold' => 15, ]; \ No newline at end of file diff --git a/site/config/routes/month-dates.php b/site/config/routes/month-dates.php index c844038..8b37b90 100644 --- a/site/config/routes/month-dates.php +++ b/site/config/routes/month-dates.php @@ -87,7 +87,8 @@ return [ "place" => $event->place()->value(), "eventUrl" => $event->url(), "ticketingUrl" => $ticketingUrl, - "bookableStock" => $bookableStock + "bookableStock" => $bookableStock, + "totalStock" => (int) $event->totalStock()->value(), ]); } } diff --git a/site/controllers/program.php b/site/controllers/program.php index 1739eae..6167cc0 100644 --- a/site/controllers/program.php +++ b/site/controllers/program.php @@ -37,6 +37,7 @@ function createArraySession($event, $session) { $arraySession['duration'] = $isMapadoEvent ? $event->remoteDuration() : $event->duration(); $arraySession['ticketingUrl'] = $isMapadoEvent ? $session->ticketingUrl() : false; $arraySession['bookableStock'] = $isMapadoEvent ? $session->bookableStock()->value() : 'free'; + $arraySession['totalStock'] = $isMapadoEvent ? (int) $event->totalStock()->value() : 'free'; $arraySession['color'] = $event->color(); $arraySession['category'] = $event->category(); diff --git a/site/plugins/helpers/index.php b/site/plugins/helpers/index.php index d26ef0c..fb94ee8 100644 --- a/site/plugins/helpers/index.php +++ b/site/plugins/helpers/index.php @@ -102,7 +102,8 @@ function createMapadoEventRequest($page) { "subfields" => [ ["name" => "startDate"], ["name" => "endDate"], - ["name" => "notInStockContingentBookableStock"] + ["name" => "notInStockContingentBookableStock"], + ["name" => "totalStock"] ] ], ] @@ -116,6 +117,7 @@ function saveMapadoEvent($mapadoEvent, $page) { $kirby->impersonate('kirby'); $duration = ''; + $totalStock = null; $sessionsToSave = []; if ($mapadoEvent->{"@type"} === 'hydra:Error') { @@ -132,6 +134,9 @@ function saveMapadoEvent($mapadoEvent, $page) { foreach ($mapadoEvent->eventDateList as $session) { + if (!$totalStock) { + $totalStock = $session->totalStock; + } $sessionMonth = substr($session->startDate, 0, 7); @@ -158,7 +163,8 @@ function saveMapadoEvent($mapadoEvent, $page) { "mapadoSlug" => $mapadoEvent->slug, "remoteDuration" => $duration, "remoteSessions" => $sessionsToSave, - "eventDateId" => $eventDateId + "eventDateId" => $eventDateId, + "totalStock" => $totalStock ]; $page->update($dataToSave); diff --git a/site/snippets/calendar-strip.php b/site/snippets/calendar-strip.php index e654a8a..3f0a734 100644 --- a/site/snippets/calendar-strip.php +++ b/site/snippets/calendar-strip.php @@ -9,7 +9,6 @@ targetSessions: [], open: false, today: dayjs().format('DD-MM-YYYY'), - stockThreshold: = option('stockThreshold') ?>, get monthName() { return dayjs().month(this.monthNumb).format('MMMM'); @@ -65,7 +64,13 @@
= $page->place() ?>
diff --git a/site/templates/program.php b/site/templates/program.php index 6edf286..25b112a 100644 --- a/site/templates/program.php +++ b/site/templates/program.php @@ -114,7 +114,7 @@ Entrée libre Complet - + Plus que quelques places ! Billetterie