<div x-data="{
    ordered_months: [],
    renderScenes: false,
    initcap(string) {
        return string.charAt(0).toUpperCase() + string.slice(1);
    },
    init() {
        data = data.filter(el => el.cancelled !== '1')
        data = data.filter(el => el.kicket_id !== '278800')
        this.compute_months()
    },
    banner(data) {},
    compute_months() {
        const MonthYearMap = new Map()
        for(const entry of data) {
            const date = new Date(entry.show_date)
            if (isNaN(date.valueOf()) || date < new Date()) {
                continue;
            }
            const year = date.getFullYear()
            const month = date.getMonth()+1
            const key = `${year}-${month}`
            if (MonthYearMap.has(key)) {
                MonthYearMap.get(key).push(entry)
            } else {
                MonthYearMap.set(key, [entry])
            }
        }

        const sortKey= str => Number(str.split('-').map(x=>x.padStart(2, '0')).join(''));
        this.ordered_months = [... MonthYearMap.entries()].sort((a, b) => sortKey(a[0])-sortKey(b[0]))
        for(const [month, events] of this.ordered_months) {
			events.sort((a, b) => {
				const aDate = new Date(a.show_date)
				const bDate = new Date(b.show_date)
				if (aDate < bDate) return -1;
				if (aDate > bDate) return 1;
				return 0;
			})
		}
    }
}">
    <style>
        .improkicket_offer-element {
            position: relative;
            text-align: center; 
            padding: 0px 20px 50px;
            display: grid;
            grid-template: 
                "flag flag" auto
                "date date" auto
                "location location" auto
                "title title" auto
                "picture picture" auto
                "description description" auto
                "buttons buttons" auto 
                / 1fr 2fr;
            gap: 5px;
            background-color: #ededed;
            margin: 20px 0;
            align-items: center;
            overflow: hidden;
        }
        .improkicket_offer-element.has-big-picture {
            grid-template: 
                "flag flag" auto
                "date date" auto
                "location location" auto
                "title title" auto
                "picture picture" auto
                "description description" auto
                "buttons buttons" auto 
                / 1fr 2fr;
        }
        @media only screen and (max-width: 600px) { 
            .improkicket_offer-element {
                grid-template:
                    "flag" auto
                    "date" auto
                    "location" auto
                    "picture" auto 
                    "title" auto
                    "description" auto
                    "buttons" auto 
                    / 1fr !important;
                padding: 5px 0 20px;
                position: relative;
            }
            .improkicket_offer-element > .date {
                font-size: 1.3em;
                font-weight: bold;
            }
            .improkicket_offer-element > .big-img {
                display: none;
            }
            .improkicket_offer-element > .small-img {
                display: block !important;
            }
            .improkicket_offer-element > .description {
                padding: 0 20px;
            }
            .improkicket_offer-element > .img-wrapper {
                padding: 0;
            }
        }

        @media only screen and (min-width: 601px) {
            .improkicket_offer-element > .date {
                font-weight: bold;
                font-size: 1.6em;
            }
        }

        .improkicket_offer-element > .img-wrapper {
            grid-area: picture;
            width: 100%;
            max-width: 
            padding: 20px;
            box-sizing: border-box;
            display: grid;
            justify-items: center;
         }
        .improkicket_offer-element > .img-wrapper > img {
            max-height: 256px;
            border: 1px solid gray;
        }
        .improkicket_offer-element > .buttons {
            grid-area: buttons;
        }
        .improkicket_offer-element > .buttons > button {
            padding:  8px 16px;
            font-size: 1.1em;
        }
        .improkicket_offer-element > .buttons > button:disabled {
            background-color: lightgray;
            color: hsl(0, 0%, 25%);
        }
        .improkicket_offer-element > .title {
            grid-area: title;
            margin: 0 0 10px;
        }
        .improkicket_offer-element > .description {
            grid-area: description;
        }
        
        .improkicket_offer-element > .date {
            grid-area: date;
            margin-top: 10px;
        }
        .improkicket_offer-element > .location {
            grid-area: location;
        }
        .improkicket_offer-element > .flag {
            grid-area: flag;
            background-color: var(--color);
            color: var(--text, white);
            padding: 5px 20px;
            min-width: 100px;
            font-weight: bold;
            filter: drop-shadow(-100px 0px 0px var(--color)) drop-shadow(100px 0px 0px var(--color));
        }

        .improkicket_month-header {
            display: grid;
            grid-template-columns: 1fr max-content 1fr;
            align-items: center;
            gap: 10px;
            margin: 50px 0 10px;
        }
        .improkicket_month-header h1 {
            text-transform: capitalize;
            width: 100%;
            text-align: center;
            margin: 0;
        }
        .improkicket_month-header .start,
        .improkicket_month-header .end {
            border-bottom: 1px solid black;
            width: 100%;
        }
    </style>
    <template x-for="month in ordered_months">
        <div class="improkicket_month">
            <div class="improkicket_month-header">
                <div class="start"></div>
                <h1 x-text="new Intl.DateTimeFormat('pl-PL', {month: 'long'}).formatToParts(new Date(month[0]+'-01'))[0].value"></h1>
                <div class="end"></div>
            </div>
            <template x-for="(term, idx) in month[1]">
                <div x-bind:class="'improkicket_offer-element ' + (term.big_image ? 'has-big-picture' : '')">
                    <template x-if="banner(term)">
                        <div class="flag" x-text="banner(term)[0]" x-bind:style="banner(term)[1]"></div>
                    </template>
                    <div class="img-wrapper small-img">
                        <img class="small-img" x-bind:src="term.picture_url">
                    </div>
                    <h3 class="title" x-text="term.title"></h3>
                    <div class="location" x-show="renderScenes" x-text="term.scene"></div>
                    <div class="date">
                        <span x-text="initcap(new Date(term.show_date).toLocaleDateString('pl-PL', {weekday: 'long', day: 'numeric', month: 'long'}))"></span>,
                        <span x-text="new Date(term.show_date).toLocaleTimeString('pl-PL', {timeStyle: 'short'})"></span>
                    </div>
                    <p class="description" x-html="term.show_description"></p>
                    <div class="buttons">
<template x-if="term.cancelled !== '0'">
                            <button disabled>Sprzedaż anulowano<button>
                        </template>
                        <template x-if="term.sales_start_date > new Date()">
                            <button disabled>Sprzedaż nie rozpoczęta</button>
                        </template>
                        <template x-if="new Date(term.date) < new Date()">
                            <button disabled>Sprzedaż zakończona</button>
                        </template>
                        <template x-if="term.cancelled === '0' && !(term.sales_start_date > new Date()) && !(new Date(term.date) < new Date())">
                            <button x-bind:href="term.reservation_form">Kup bilet</button>
                        </template>
                    </div>
                </div>
            </div>
        </template>
    </template>
</div>