@extends('Admin.layouts.master')

@section('content')
    @php
        $currentPage = 'manage-customer';

        $requestValue = request('id');

    @endphp


    <div class="layout-px-spacing">
        <div class="middle-content container-xxl p-0">
            <div class="row layout-top-spacing ">
                <div class="top-tabel">
                    <div class="row">
                        <div class="col-md-4">
                            <a class="d-flex align-items-center justify-content-center pl-2"
                                href="{{ route('manage.customer') }}">
                                <img class="back-btn" src="{{ asset('public/assets/img/left-arrow.svg') }}">
                                <h6 class="card-title p-0">Restaurant</h6>
                            </a>
                        </div>
                    </div>
                </div>
                <div class="col-xl-12 col-lg-12 col-sm-12 layout-spacing">
                    <div class="widget-content widget-content-area br-8 position-btn" style="overflow: auto;">
                        <table id="zero-config" class="table dt-table-hover cust_passport_table" style="width:100%">
                            <thead class="text-center">
                                <tr>
                                    <th class="text-start">Sr No</th>
                                    <th class="text-start">Restaurant Name</th>
                                    <th class="text-start">Restaurant Image</th>
                                    <th class="text-start">Redemption Date and Time</th>
                                    <th class="text-start">Voucher Count</th>
                                    <th class="text-start">Voucher Status</th>

                                </tr>
                            </thead>
                            <tbody class="text-center">
                                @if ($redeemDetails->isEmpty())
                                    <tr>
                                        <td colspan="4">No data found</td>
                                    </tr>
                                @else
                                    @foreach ($redeemDetails as $redeemDetail)
                                        <tr>
                                            <td class="text-start">{{ $loop->iteration }}</td>
                                            <td class="text-start">{{ $redeemDetail->restaurant->name }}</td>
                                            <td><img src="{{ ListingImageUrl('restaurant_images', $redeemDetail->restaurant->image) }}"
                                                    height="50px" width="80px"></td>
                                            <td>
                                                @if (!is_null($redeemDetail->redeem_date))
                                                    {{ \Carbon\Carbon::parse($redeemDetail->redeem_date)->format('d/m/y H:i:s') }}
                                                @else
                                                    <span>No date</span>
                                                @endif
                                            </td>
                                            <td class="text-start">{{ $redeemDetail->count }}</td>
                                            <td class="text-center">
                                                <div class="switch-btn" id="status-change">
                                                    <input type="checkbox" id="switch{{ $redeemDetail['id'] }}"
                                                        switch="bool" data-id="{{ $redeemDetail['id'] }}" name="status"
                                                        value="1"
                                                        {{ $redeemDetail['redeem_date'] ? 'checked' : '' }} />
                                                    <label for="switch{{ $redeemDetail['id'] }}" data-on-label="Active"
                                                        data-off-label="Inactive"></label>
                                                </div>
                                            </td>
                                        </tr>
                                    @endforeach
                                @endif
                            </tbody>

                        </table>
                    </div>
                </div>


            </div>
        </div>
    </div>

    <div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
        aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
                        x
                    </button>
                </div>
                <div class="modal-body">
                    <input type="hidden" id="delete_cust_passport_id" name="passport_id">
                    <p class="modal-text">Are you sure you want to<br>Delete </p>
                    <div class="modal-btn d-flex ">
                        <a type="button" class="extra-btn" href="#" data-dismiss="modal">No</a>
                        <a type="button" class="download-btn-custom delete_cust_passport_btn" href="#"
                            data-dismiss="modal">Yes</a>
                    </div>

                </div>
            </div>
        </div>
    </div>
@endsection

@section('section_script')
@endsection
