<!-- Original Author / Coder: Danny Johansson (dann4624) | Contact by Discord: Semeicardia#5561 | Contact by Email: semeicardia@gmail.com (Primary), dann4624@edu.sde.dk (secondary) -->
<style>
    /* CSS Variables not supported */
    h1,h2,h3,h4,h5,table{
        text-align:center;
        margin-left:auto;
        margin-right:auto;
    }

    #logo{
        width:300px;
        height:80px;
    }

    #dates{
        text-align:left;
        font-size:1.2em;
    }

    .date_label,.user_label,.label{
        font-weight:bold;
    }

    #product_table table{
        border-collapse: collapse;
        font-size:0.8em;
    }

    #product_table th{
        background:black;
        color:white;
    }

    #product_table td, #product_table th{
        padding:1.0em;
        padding-right:2.5em;
        text-align:left;
    }

    #product_table td:last-of-type,#product_table th:last-of-type{
        padding-right:1em;
    }

    #product_table tr:nth-of-type(even) td{
        background:darkgrey;
        color:white;
    }

    #product_table tr:nth-of-type(odd) td{
        background:dimgrey;
        color:white;
    }

    #cable_table table{
        border-collapse: collapse;
        font-size:0.8em;
    }

    #cable_table th{
        background:black;
        color:white;
    }

    #cable_table td, #cable_table th{
        padding:1.0em;
        padding-right:2.5em;
        text-align:left;
    }

    #cable_table td:last-of-type,#cable_table th:last-of-type{
        padding-right:1em;
    }

    #cable_table tr:nth-of-type(even) td{
        background:darkgrey;
        color:white;
    }

    #cable_table tr:nth-of-type(odd) td{
        background:dimgrey;
        color:white;
    }

    #signature_table{
        text-align:center;
    }

    #signature_table img{
        margin:1em;
        max-width:300px;
        max-height:100px;
    }
    .signature_label{
        font-weight:bold;
        font-size:1.5em;
    }
    .signature_name{
        font-size:1.5em;
    }
    .amount{
        text-align:center;
    }
</style>
<h1 id="school">@lang('school')</h1>
<table>
    <tr>
        <td>
            <img src='{{asset('SDELogo.PNG')}}' id="logo" alt="School Logo">
        </td>
    </tr>
</table>


<h2 id="division">@lang('division')</h2>
<h2 id="type">@lang('reservation')</h2>
<table id='dates'>
    <tr>
        <td id="user_label" class="label user_label">
            @lang('user') :
        </td>

        <td id="user">
            {{ $user->username }} - {{ $user->name }}
        </td>
    </tr>

    <tr>
        <td id="room_label" class="label room_label">
            @lang('room') :
        </td>

        <td id="room">
            {{ $room->building->name }} - {{ $room->name }}
        </td>
    </tr>

    <tr>
        <td id="date_start_label" class="user_label">
            @lang('date_start') :
        </td>

        <td id="date_start">
            {{ date('d.m.Y', strtotime($date_start)) }}
        </td>
    </tr>
    <tr>
        <td id="date_end_label" class="date_label">
            @lang('date_end') :
        </td>

        <td  id="date_end">
            @if(!empty($date_end))
                {{ date('d.m.Y', strtotime($date_end)) }}
            @else
                @lang('permanent')
            @endif
        </td>

    </tr>
</table>

@if($products_total_amount >= 1)
    <br>

    <h2>@lang('products')</h2>

    <table id='product_table' cellspacing="0">
        <thead>
        <th id="category">
            @lang('category')
        </th>

        <th id="subcategory">
            @lang('subcategory')
        </th>

        <th id="brand">
            @lang('brand')
        </th>

        <th id="model">
            @lang('model')
        </th>

        <th id="name">
            @lang('name')
        </th>
        <th id="name" class="amount">
            @lang('amount')
        </th>
        </thead>
        <tbody>
        @foreach($products as $loan)
            <tr>
                <td class="category">
                    {{ $loan->loanable->category->name }}
                </td>
                <td class="subcategory">
                    @if(!empty($loan->loanable->subcategory))
                        {{ $loan->loanable->subcategory->name }}
                    @endif
                </td>
                <td class="brand">
                    {{ $loan->loanable->brand->name }}
                </td>
                <td class="model">
                    {{ $loan->loanable->model->name }}
                </td>
                <td class="name">
                    @if(!empty($loan->loanable->name))
                        {{ $loan->loanable->name }}
                    @endif
                </td>
                <td style="text-align:center">
                    {{ $loan->amount}}
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>

    <br>

    <h3>Total @lang('amount') : {{$products_total_amount}}</h3>

@endif

@if($cabels_total_amount >= 1)
    <br>

    <h2>Kabler</h2>

    <table id="cable_table" cellspacing="0">
        <thead>
        <th>@lang('category')</th>
        <th>@lang('type')</th>
        <th class="amount">@lang('amount')</th>
        </thead>
        <tbody>
        @foreach($cabels as $loan)
            <tr>
                <td class="category">
                    {{ $loan->loanable->category->name }}
                </td>
                <td class="name">
                    {{ $loan->loanable->name }}
                </td>
                <td style="text-align:center">
                    {{ $loan->amount }}
                </td>
            </tr>
        @endforeach
        </tbody>
    </table>

    <br>

    <h3>Total @lang('amount') : {{$cabels_total_amount}}</h3>
@endif

<br><br>

<table id='signature_table'>
    <tr>
        <td id="loaner_signature_label" class="signature_label">
            @lang('loaner')
        </td>

        <td id="loaner_signature_label" class="signature_label">
            @lang('lender')
        </td>
    </tr>
    <tr>
        <td id="loaner_signature_image" class="signature_image">
            <img src='data:image/jpg;base64, {{ $loaner }}'>
        </td>

        <td id="lender_signature_image" class="signature_image">
            <img src='data:image/jpg;base64,{{ $lender }}'>
        </td>
    </tr>
    <tr>
        <td id="loaner_signature_name" class="signature_name">
            {{ $user->name }}
        </td>

        <td id="lender_signature_name" class="signature_name">
            {{ Auth::user()->name }}
        </td>
    </tr>
</table>