@extends('master_header')

@section('content')

    @include('includes.header-topbar')

    <!-- ========== App Menu ========== -->
    @include('md.sidebar-menu')
    <!-- Left Sidebar End -->
    <!-- Vertical Overlay-->
    <div class="vertical-overlay"></div>

    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class="page-content">
            <div class="container-fluid">

                <!-- start page title -->
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                            <h4 class="mb-sm-0">Transfer of Refund Requests</h4>

                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="javascript: void(0);">Dashboard</a></li>
                                    <li class="breadcrumb-item active">Transfer of Refund Requests</li>
                                </ol>
                            </div>

                        </div>
                    </div>
                </div>
                <!-- end page title -->

                <!--end row-->

                <div class="card" id="contactList">
                    <div class="card-header">
                        <div class="row align-items-center g-3">
                            <div class="col-md-3">
                                <h5 class="card-title mb-0">Sales Overview</h5>
                            </div>
                            <!--end col-->
                            <div class="col-md-auto ms-auto">
                                <div class="d-flex gap-2">
                                    <div class="search-box">
                                        <input type="text" class="form-control" placeholder="Search for transactions..." id="myInput">
                                        <i class="ri-search-line search-icon"></i>
                                    </div>
                                </div>
                            </div>
                            <!--end col-->
                        </div>
                        <!--end row-->
                    </div>
                    <!--end card-header-->
                    <div class="card-body">
                        <div class="table-responsive table-card">
                            <table class="table align-middle table-nowrap" id="myTable">
                                <thead class="table-light text-muted">
                                <tr>
                                    <th class="sort" data-sort="date" scope="col">To</th>
                                    <th class="sort" data-sort="date" scope="col">Through</th>
                                    <th class="sort" data-sort="currency_name" scope="col">Ref</th>
                                    <th class="sort" data-sort="to_name" scope="col">From</th>
                                    <th class="sort" data-sort="amount" scope="col">Date</th>
                                    <th class="sort" data-sort="status" scope="col">Project</th>
                                    <th class="sort" data-sort="status" scope="col">House Type</th>
                                    <th class="sort" data-sort="status" scope="col">Status</th>
                                    <th class="sort" data-sort="status" scope="col">Action</th>
                                </tr>
                                <!--end tr-->
                                </thead>
                                <tbody class="list form-check-all">

                                @foreach($transfers as $transfer)
                                    <tr>
                                        <td class="id" style="display:none;"><a href="javascript:void(0);" class="fw-medium link-primary">#VZ001</a></td>

                                        <td class="form_name">{{$transfer->to ?? ''}}</td>
                                        <td class="form_name">{{$transfer->through ?? ''}}</td>
                                        <td class="form_name">{{$transfer->ref ?? ''}}</td>
                                        <td class="type">{{$transfer->from ?? ''}}</td>
                                        <td class="type"> {{ \Carbon\Carbon::parse($transfer->date)->format('d-m-Y') ?? '' }}</td>
                                        <td>
                                            <p class="text-muted mb-0"> {{$transfer->new_house_project ?? 0}}</p>
                                        </td>
                                        <td>
                                            <p class="text-muted mb-0"> {{$transfer->new_house_type ?? ''}}</p>
                                        </td>

                                        <td class="status">
                                            @if($transfer->status == 'refunded' )
                                                <span class="badge bg-warning-subtle text-success fs-11"><i class="ri-time-line align-bottom"></i> Refunded</span>
                                            @else
                                                <span class="badge bg-warning-subtle text-danger fs-11"><i class="ri-time-line align-bottom"></i> Pending</span>
                                            @endif
                                        </td>
                                        <td>
                                            <div class="dropdown">
                                                <a href="javascript:void(0);" class="btn btn-light btn-icon" id="dropdownMenuLink15" data-bs-toggle="dropdown" aria-expanded="false">
                                                    <i class="ri-equalizer-fill"></i>
                                                </a>
                                                <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="dropdownMenuLink15" style="">
                                                    <form id="initiateOfferForm" action="{{ route('view-transfer-request') }}">
                                                        @csrf
                                                        <input type="hidden" name="id" value="{{$transfer->id}}">
                                                        <li>
                                                            <button type="submit" class="dropdown-item">
                                                                <i class="me-2 align-middle text-muted"></i>
                                                                View
                                                            </button>
                                                        </li>
                                                    </form>


                                                    <li class="dropdown-divider"></li>
                                                    <li><a class="dropdown-item" href="javascript:void(0);"><i class="ri-delete-bin-5-line me-2 align-middle text-muted"></i>Delete</a></li>
                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                                <!--end tr-->
                                </tbody>
                            </table>

                            <script>
                                $(document).ready(function(){
                                    $("#myInput").on("keyup", function() {
                                        var value = $(this).val().toLowerCase();
                                        $("#myTable tr").filter(function() {
                                            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
                                        });
                                    });
                                });
                            </script>
                            <!--end table-->
                            <div class="noresult" style="display: none">
                                <div class="text-center">
                                    <lord-icon src="https://cdn.lordicon.com/msoeawqm.json" trigger="loop" colors="primary:#405189,secondary:#0ab39c" style="width:75px;height:75px"></lord-icon>
                                    <h5 class="mt-2">Sorry! No Result Found</h5>
                                    <p class="text-muted mb-0">We've searched more than 150+ transactions We did not find any transactions for you search.</p>
                                </div>
                            </div>
                        </div>
                        <div class="d-flex justify-content-end mt-3">
                            <div class="pagination-wrap hstack gap-2">
                                <a class="page-item pagination-prev disabled" href="#">
                                    Previous
                                </a>
                                <ul class="pagination listjs-pagination mb-0"></ul>
                                <a class="page-item pagination-next" href="#">
                                    Next
                                </a>
                            </div>
                        </div>
                    </div>

                    <!--end card-body-->
                </div>
                <!--end card-->

            </div>
            <!-- container-fluid -->
        </div>
        <!-- End Page-content -->


        @include('includes.footer')
    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->

@endsection
