@extends('layouts.members')

@section('page_category') Checkin @endsection
@section('page_title') All Checkins @endsection

@section('content')
    <div class="container-fluid">
        {{--<div class="row">--}}
        <div class="row">
            <div class="col-12">
                <!-- Goals -->
                <div class="card">
                    <div class="card-header">
                        <div class="row align-items-center">
                            <div class="col">
                                <!-- Title -->
                                <h4 class="card-header-title">
                                    Checkins
                                </h4>

                            </div>
                            <div class="col-auto">
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Today
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Last 7 Days
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    All
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Export
                                </a>
                            </div>
                        </div> <!-- / .row -->
                    </div>
                    <div class="table-responsive mb-0"
                         data-list="{&quot;valueNames&quot;: [&quot;goal-project&quot;, &quot;goal-status&quot;, &quot;goal-progress&quot;, &quot;goal-date&quot;]}">
                        <table class="table table-sm table-nowrap card-table">
                            <thead>
                            <tr>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        SN
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        Customer
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        Gender
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-status">
                                        Phone
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-status">
                                        Room
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-status">
                                        Channel
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-progress">
                                        Checkin Date
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-date">
                                        CheckOut Date
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-date">
                                        Amount
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-date">
                                        Discount
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-date">
                                        Review
                                    </a>
                                </th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody class="list">
                            <?php $n=0; ?>
                            @forelse($checkins as $checkin)
                                <tr>
                                    <td class="goal-project">
                                        {{$n++}}
                                    </td>
                                    <td class="goal-project">
                                        {{$checkin->customer_firstname . ' '. $checkin->customer_lastname}}
                                    </td>
                                    <td class="goal-project">
                                        {{$checkin->customer_gender}}
                                    </td>
                                    <td class="goal-project">
                                        {{$checkin->phone}}
                                    </td>
                                    <td class="goal-project">
                                    <td class="goal-project">
                                        <?php $room = $rooms->where('id', $checkin->room_id)->first(); ?>
                                        {{ $room['room_name']}}
                                    </td>
                                    </td>
                                    <td class="goal-project">
                                        {{$checkin->pay_channel}}
                                    </td>
                                    <td class="goal-project">
                                        {{$checkin->checkin_date}}
                                    </td>
                                    <td class="goal-project">
                                        {{ \Carbon\Carbon::parse($checkin->checkin_date)->addDays($checkin->number_of_days)}}
                                    </td>
                                    <td class="goal-project">
                                        {{ number_format($checkin->amount, 2) }}
                                    </td>
                                    <td class="goal-project">
                                        {{ $checkin->discount}}
                                    </td>
                                    <td class="goal-project">
                                        -
                                    </td>

                                    <td class="text-right">
                                        <div class="dropdown">
                                            <a href="#" class="dropdown-ellipses dropdown-toggle" role="button"
                                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                <i class="fe fe-more-vertical"></i>
                                            </a>
                                            <div class="dropdown-menu dropdown-menu-right">
                                                <a href="#!" class="dropdown-item">
                                                    Checkout
                                                </a>
                                                <a href="#!" class="dropdown-item">
                                                    Change
                                                </a>
                                                <a href="#!" class="dropdown-item">
                                                    Cancel
                                                </a>
                                            </div>
                                        </div>
                                    </td>

                                </tr>
                            @empty
                                <h6>No Checkins Available</h6>
                            @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>
        </div> <!-- / .row -->
    </div>s

@endsection