<!DOCTYPE html>
<html>
<body>
<head>
    <title>
        {{$propertyData['name']}} -  <?php
        $date=date_create(key($data[0]['monthly_room_availability'][1]));
        echo date_format($date,"M Y");
        ?>
        -
        <?php
        $date=date_create(key($data[0]['monthly_room_availability'][6]));
        echo date_format($date,"M Y");
        ?>
        Inventory Data</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600&family=Merriweather:wght@300;400;700&display=swap" rel="stylesheet">
    <style>
        * {
            font-family: 'Heebo', sans-serif;
        }
        td {
            border-collapse:collapse;
            border: 1px black solid;
        }
        .main-div {
            position: relative;
            display: block;
            max-width: 1140px;
            margin: auto;
        }
        .section {
            position: relative;
            page-break-inside: auto;
            page-break-after: always;
            margin: 80px auto;
        }
        .section:last-child {
            page-break-after: auto;
        }
        .rate-name {
            font-size: 12px;
            width: 11%;
        }
        .price-area > span {
            position: relative;
            font-size: 11px;
            display: inline-grid;
            text-align: center;
            width: 2.80%;
        }
        .price-area {
            position: relative;
        }
        .availability-area > span {
            position: relative;
            font-size: 12px;
            font-weight: bold;
            display: inline-grid;
            text-align: center;
            width: 2.80%;
        }
        .currency-code {
            font-size: 11px !important;
            font-weight: bold;
            position: absolute !important;
            right: -23px !important;
            top: 7px !important;
            width: auto !important;
        }
        .date-area > span {
            text-align: center;
            font-weight: bold;
            font-size: 16px;
            display: inline-grid;
            width: 2.79%;
        }

        .date-area {
            margin-left: 11.3%;
        }
        h2 {
            display: none;
        }
        .stop-sell {
            color: red;
            border: 1px solid red !important;
            padding: 0 5px;
        }
        .stop-sell-availability {
            color: red;
            border: 1.5px solid red !important;
            padding: 0 5px;
            font-weight: bold;
        }
        footer {
            font-size: 12px;
            position: absolute;
            bottom: -30px;
            width: 100%;
        }
        .main-page {
            padding-top: 65px;
        }
        .main-page div {
            text-align: center;
        }
        .mb-0 {
            font-size: 14px;
            margin-top: 10px;
            margin-bottom: 0;
        }
        .month {
            font-weight: 600;
            text-align: center;
            text-transform: uppercase;
            width: 10.8%;
            border: 1px dashed;
            left: 2px;
            position: absolute;
        }
        .left-date {
            margin-left: 71%
        }
        @media print {
            @page {
                size: landscape
            }
            .noPrint{
                display:none;
            }
            .section {
                width: 297mm;
                margin: 40px 0;
            }
            .main-div {
                margin: 0;
            }
            .month {
                width: 120px;
            }
        }
        button.print-button {
            width: 100px;
            height: 100px;
        }
        span.print-icon, span.print-icon::before, span.print-icon::after, button.print-button:hover .print-icon::after {
            border: solid 4px #333;
        }
        span.print-icon::after {
            border-width: 2px;
        }

        button.print-button {
            position: fixed;
            padding: 0;
            border: 0;
            border: none;
            background: transparent;
            right: 0;
        }

        span.print-icon, span.print-icon::before, span.print-icon::after, button.print-button:hover .print-icon::after {
            box-sizing: border-box;
            background-color: #fff;
        }

        span.print-icon {
            position: relative;
            display: inline-block;
            padding: 0;
            margin-top: 20%;
            width: 60%;
            height: 35%;
            background: #fff;
            border-radius: 20% 20% 0 0;
        }

        span.print-icon::before {
            content: " ";
            position: absolute;
            bottom: 100%;
            left: 12%;
            right: 12%;
            height: 110%;
            transition: height .2s .15s;
        }

        span.print-icon::after {
            content: " ";
            position: absolute;
            top: 55%;
            left: 12%;
            right: 12%;
            height: 0%;
            background: #fff;
            background-repeat: no-repeat;
            background-size: 70% 90%;
            background-position: center;
            background-image: linear-gradient(
                to top,
                #fff 0, #fff 14%,
                #333 14%, #333 28%,
                #fff 28%, #fff 42%,
                #333 42%, #333 56%,
                #fff 56%, #fff 70%,
                #333 70%, #333 84%,
                #fff 84%, #fff 100%
            );

            transition: height .2s, border-width 0s .2s, width 0s .2s;
        }

        button.print-button:hover {
            cursor: pointer;
        }

        button.print-button:hover .print-icon::before {
            height:0;
            transition: height .2s;
        }
        button.print-button:hover .print-icon::after {
            height:120%;
            transition: height .2s .15s, border-width 0s .16s;
        }

        .room-name, .rate-name {
            padding-left: 5px;
        }
        .availability-area {
            background: #f6f6f6;
        }
        .print-text {
            display: block;
            font-size: 14px;
            font-weight: 600;
            margin-top: 8px;
        }
    </style>
</head>
<div class="main-div">
    <button class="print-button noPrint" onclick="window.print();"><span class="print-icon"></span><span class="print-text">Print</span></button>
    <div class="section main-page">

        <div>
            <img src="{{$logoBase64}}" style="max-width: 300px" />
        </div>
        @if(isset($propertyData['name']))
            <div>
                <h1> {{$propertyData['name']}} </h1>
            </div>
        @endif

        <div>
            <h3 style="font-size:24px; font-style: italic; margin-bottom: 0"> <span style="font-size: 18px">Booking Engine </span> <br /> Inventory Data</h3>
            <h5 style="font-size:16px; margin-top: 10px; margin-bottom: 30px">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][1]));
                echo date_format($date,"M Y");
                ?>
                -
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][6]));
                echo date_format($date,"M Y");
                ?>
            </h5>

            @if(isset($propertyData['property_contact']['view_full_phone']))<h6 class="mb-0">{{$propertyData['property_contact']['view_full_phone']}}</h6>@endif
            @if(isset($propertyData['property_contact']['view_full_mobile']))<h6 class="mb-0">{{$propertyData['property_contact']['view_full_mobile']}}</h6>@endif
            @if(isset($propertyData['property_contact']['address']))<h6 class="mb-0">{{$propertyData['property_contact']['address']}}</h6>@endif
        </div>
    </div>

    {{--first date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][1]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][1] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
        <table style="word-wrap: break-word; width: 100%;">
            <tr>
                <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                <td class="availability-area">
                    @foreach($room['monthly_room_availability'][1] as $key => $availability)
                        <span>
                             @if($availability['stop_sell'] == 1)
                                <span class="stop-sell-availability">X</span>
                            @elseif($availability['value'] !== null)
                                {{$availability['value']}}
                            @else
                                -
                            @endif
                        </span>
                    @endforeach
                </td>
            </tr>
            @foreach($room['property_room_rate_mapping'] as $rate )
                @foreach($rate['prices'] as $prices)
                    <tr>
                        <td class="rate-name">{{$rate['name']}}</td>
                        <td class="price-area">
                            @foreach ($prices['monthly_price'][1] as $price)
                                <span>
                                    @if($price['stop_sell'] == 1)
                                        <span class="stop-sell">X</span>
                                    @elseif($price['value'] !== null)
                                        {{$price['value']}}
                                    @else
                                        -
                                    @endif
                                </span>
                            @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                        </td>
                    </tr>
                @endforeach
            @endforeach
        </table>
    @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
            $date=date_create(key($data[0]['monthly_room_availability'][1]));
            echo date_format($date,"M-Y");
            ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>

    {{--second date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][2]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][2] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
            <table style="word-wrap: break-word; width: 100%;">
                <tr>
                    <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                    <td class="availability-area">
                        @foreach($room['monthly_room_availability'][2] as $key => $availability)
                            <span>
                             @if($availability['stop_sell'] == 1)
                                    <span class="stop-sell-availability">X</span>
                                @elseif($availability['value'] !== null)
                                    {{$availability['value']}}
                                @else
                                    -
                                @endif
                        </span>
                        @endforeach
                    </td>
                </tr>
                @foreach($room['property_room_rate_mapping'] as $rate )
                    @foreach($rate['prices'] as $prices)
                        <tr>
                            <td class="rate-name">{{$rate['name']}}</td>
                            <td class="price-area">
                                @foreach ($prices['monthly_price'][2] as $price)
                                    <span>
                                    @if($price['stop_sell'] == 1)
                                            <span class="stop-sell">X</span>
                                        @elseif($price['value'] !== null)
                                            {{$price['value']}}
                                        @else
                                            -
                                        @endif
                                </span>
                                @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                            </td>
                        </tr>
                    @endforeach
                @endforeach
            </table>
        @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
                $date=date_create(key($data[0]['monthly_room_availability'][2]));
                echo date_format($date,"M-Y");
                ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>

    {{--thirth date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][3]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][3] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
            <table style="word-wrap: break-word; width: 100%;">
                <tr>
                    <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                    <td class="availability-area">
                        @foreach($room['monthly_room_availability'][3] as $key => $availability)
                            <span>
                             @if($availability['stop_sell'] == 1)
                                    <span class="stop-sell-availability">X</span>
                                @elseif($availability['value'] !== null)
                                    {{$availability['value']}}
                                @else
                                    -
                                @endif
                        </span>
                        @endforeach
                    </td>
                </tr>
                @foreach($room['property_room_rate_mapping'] as $rate )
                    @foreach($rate['prices'] as $prices)
                        <tr>
                            <td class="rate-name">{{$rate['name']}}</td>
                            <td class="price-area">
                                @foreach ($prices['monthly_price'][3] as $price)
                                    <span>
                                    @if($price['stop_sell'] == 1)
                                            <span class="stop-sell">X</span>
                                        @elseif($price['value'] !== null)
                                            {{$price['value']}}
                                        @else
                                            -
                                        @endif
                                </span>
                                @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                            </td>
                        </tr>
                    @endforeach
                @endforeach
            </table>
        @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
                $date=date_create(key($data[0]['monthly_room_availability'][3]));
                echo date_format($date,"M-Y");
                ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>

    {{--fourth date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][4]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][4] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
            <table style="word-wrap: break-word; width: 100%;">
                <tr>
                    <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                    <td class="availability-area">
                        @foreach($room['monthly_room_availability'][4] as $key => $availability)
                            <span>
                             @if($availability['stop_sell'] == 1)
                                    <span class="stop-sell-availability">X</span>
                                @elseif($availability['value'] !== null)
                                    {{$availability['value']}}
                                @else
                                    -
                                @endif
                        </span>
                        @endforeach
                    </td>
                </tr>
                @foreach($room['property_room_rate_mapping'] as $rate )
                    @foreach($rate['prices'] as $prices)
                        <tr>
                            <td class="rate-name">{{$rate['name']}}</td>
                            <td class="price-area">
                                @foreach ($prices['monthly_price'][4] as $price)
                                    <span>
                                    @if($price['stop_sell'] == 1)
                                            <span class="stop-sell">X</span>
                                        @elseif($price['value'] !== null)
                                            {{$price['value']}}
                                        @else
                                            -
                                        @endif
                                </span>
                                @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                            </td>
                        </tr>
                    @endforeach
                @endforeach
            </table>
        @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
                $date=date_create(key($data[0]['monthly_room_availability'][4]));
                echo date_format($date,"M-Y");
                ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>

    {{--fifth date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][5]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][5] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
            <table style="word-wrap: break-word; width: 100%;">
                <tr>
                    <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                    <td class="availability-area">
                        @foreach($room['monthly_room_availability'][5] as $key => $availability)
                            <span>
                             @if($availability['stop_sell'] == 1)
                                    <span class="stop-sell-availability">X</span>
                                @elseif($availability['value'] !== null)
                                    {{$availability['value']}}
                                @else
                                    -
                                @endif
                        </span>
                        @endforeach
                    </td>
                </tr>
                @foreach($room['property_room_rate_mapping'] as $rate )
                    @foreach($rate['prices'] as $prices)
                        <tr>
                            <td class="rate-name">{{$rate['name']}}</td>
                            <td class="price-area">
                                @foreach ($prices['monthly_price'][5] as $price)
                                    <span>
                                    @if($price['stop_sell'] == 1)
                                            <span class="stop-sell">X</span>
                                        @elseif($price['value'] !== null)
                                            {{$price['value']}}
                                        @else
                                            -
                                        @endif
                                </span>
                                @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                            </td>
                        </tr>
                    @endforeach
                @endforeach
            </table>
        @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
                $date=date_create(key($data[0]['monthly_room_availability'][5]));
                echo date_format($date,"M-Y");
                ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>

    {{--sixth date--}}
    <div class="section">
        <div>
            <span class="month">
                <?php
                $date=date_create(key($data[0]['monthly_room_availability'][6]));
                echo date_format($date,"M");
                ?>
            </span>
            <div class="date-area">
                @foreach ($data[0]['monthly_room_availability'][6] as $key => $price)
                    <span>
                                <?php
                        $date=date_create($key);
                        echo date_format($date,"d");
                        ?>
                </span>
                @endforeach
            </div>
        </div>
        @foreach($data as $room)
            <table style="word-wrap: break-word; width: 100%;">
                <tr>
                    <td class="room-name" style="font-weight: bold; font-size: 12px">@if(isset($room['name'])) {{$room['name']}} @endif</td>
                    <td class="availability-area">
                        @foreach($room['monthly_room_availability'][6] as $key => $availability)
                            <span>
                             @if($availability['stop_sell'] == 1)
                                    <span class="stop-sell-availability">X</span>
                                @elseif($availability['value'] !== null)
                                    {{$availability['value']}}
                                @else
                                    -
                                @endif
                        </span>
                        @endforeach
                    </td>
                </tr>
                @foreach($room['property_room_rate_mapping'] as $rate )
                    @foreach($rate['prices'] as $prices)
                        <tr>
                            <td class="rate-name">{{$rate['name']}}</td>
                            <td class="price-area">
                                @foreach ($prices['monthly_price'][6] as $price)
                                    <span>
                                    @if($price['stop_sell'] == 1)
                                            <span class="stop-sell">X</span>
                                        @elseif($price['value'] !== null)
                                            {{$price['value']}}
                                        @else
                                            -
                                        @endif
                                </span>
                                @endforeach
                                <span class="currency-code">{{$rate['currency_code']}}</span>
                            </td>
                        </tr>
                    @endforeach
                @endforeach
            </table>
        @endforeach
        <footer>
            <span>
              Inventory Date:  <?php
                $date=date_create(key($data[0]['monthly_room_availability'][6]));
                echo date_format($date,"M-Y");
                ?>

            </span>
            <span class="left-date">

                Create Date:
                {{ date('d-m-Y H:i:s') }}

            </span>
        </footer>
    </div>
</div>
</body>
</html>
