@extends('layout.app')
@section('head')
<style>
    .expired {
        background-color: #ffccbb !important;
    }
</style>
@endsection
@section('content')
@include('includes.delete_modal')
<section class="content-header">
    <h1>
        {{__("Users List")}}
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <!-- Custom Tabs -->
            <div class="nav-tabs-custom">
                <div class="tab-content">
                    <div class="flex-row justify-end">
                        <form action="" method="GET" class="flex-row">
                            <input type="text" value="{{request()->search_query}}" name="search_query" class="form-control" placeholder="{{__('Search')}}...">
                            &nbsp;
                            <button type="submit" class="btn btn-success">{{__("Show Data")}}</button>
                        </form>
                        &nbsp;
                        &nbsp;
                        &nbsp;
                        <a href="{{route('user.create')}}" class="btn btn-success">{{__("Add New")}}</a>


                    </div>
                    <br>
                    <div class="tab-pane active table-responsive" id="tab_1">
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>{{__("Sr.No.")}}</th>
                                    <th>{{__("Name")}}</th>
                                    <th>{{__("Mobile Number")}}</th>
                                    <th>{{__("Email")}}</th>
                                    <th>{{__("Action")}}</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach($users as $user)

                                <tr >
                                    <td>{{$serial++}}</td>
                                    <td>{{$user->name}}</td>
                                    <td>{{$user->mobile}}</td>
                                    <td>{{$user->email}}</td>
                                    
                                    <td>
                                        <div>

                                            <a href="{{route('user.edit',$user->id)}}" class="btn btn-success btn-sm">
                                                <i class="fa fa-edit"></i>
                                            </a>
                                            <button onclick="$('#deleteForm').attr('action',`{{ route('user.destroy',$user->id)}}`)" id="" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#deleteModal">
                                                <i class="fa fa-trash"></i>
                                            </button>
                                        </div>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                        {{$users->links()}}
                    </div>


                    <!-- /.tab-pane -->
                </div>
                <!-- /.tab-content -->
            </div>
            <!-- nav-tabs-custom -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->

</section>
@endsection