@extends('layouts.master')


@section('title')
{{__('Users')}}
@endsection

@section('breadcrumb')

<div class="row page-title align-items-center">
    <div class="col-12 col-xl-12">
        <h3 class="mb-1 mt-0 text-left">{{__('User list')}}
            <span style="float:right;"> <a href="{{route('user-add')}}" role="button" class="btn  custom-button "><i
                    class="uil-plus mr-1"></i> 
                {{__('Add user')}}</a></span>
        </h3>
        <nav aria-label="breadcrumb" class="float-left mt-1">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{{ route('dashboard')}}">{{__('Home')}}</a></li>
                <li class="breadcrumb-item active" aria-current="page">{{__('User list')}}</li>
            </ol>
        </nav>
    </div>
</div>
@endsection

@section('content')
<!-- filters --> 
<div class="card">
    <div class="card-body px-3">
        <div class="row">
            <div class="col-4 col-lg-4 mb-1"><input type="search" class="custom-search form-control "
                    placeholder="{{__('Search by name')}}...">
            </div>
            <div class="col-4 col-lg-2 mb-1">
                <select name="" id="" required class="form-control SlectBox">
                    <option value="" selected disabled>{{__('Select Role')}}</option>
                    <option value="">All </option>
                    <option value="">Admin </option>
                    <option value="">Customer </option>
                    <option value="">Contractor </option>
                    <option value="">Sub-Contractor </option>
                </select>
            </div>
            <div class="col-4 col-lg-2 mb-1">
                <select name="" id="" required class="form-control SlectBox">
                    <option value="" selected disabled>{{__('Select Status')}}</option>
                    <option value="">Active </option>
                    <option value="">Decline </option>
                </select>
            </div>
            <div class="col-6 col-lg-2 mb-1">
                <button class="btn custom-button-outline btn-block "><i class="fe fe-search"></i>
                    {{__('Filter')}}</button>
            </div>
            <div class="col-6 col-lg-2 mb-1">
                <button class="btn custom-button btn-block">
                    {{__('Reset')}}</button>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-lg-12">
        <div class="row">
            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-danger float-right">Admin</div>
                        <p class="text-danger text-uppercase font-size-12 mb-2">#122</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">John Botham </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row"></th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item "> 
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->

            </div>

            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-warning float-right">Contractor</div>
                        <p class="text-warning text-uppercase font-size-12 mb-2">#12</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">Core Anderson </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row">{{__('Phone')}}</th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->
            </div>

            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-success float-right">Customer</div>
                        <p class="text-success text-uppercase font-size-12 mb-2">#233</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">Ross Taylor </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row">{{__('Phone')}}</th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->
            </div>

            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-info float-right">Sub contractor</div>
                        <p class="text-info text-uppercase font-size-12 mb-2">#302</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">Kane William </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row">{{__('Phone')}}</th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->
            </div>

            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-success float-right">Customer</div>
                        <p class="text-success text-uppercase font-size-12 mb-2">#222</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">Shane Warne </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row">{{__('Phone')}}</th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->
            </div>

            <div class="col-lg-4">
                <div class="card">
                    <div class="card-body">
                        <div class="badge badge-info float-right">sub-contractor</div>
                        <p class="text-info text-uppercase font-size-12 mb-2">#402</p>
                        <div class="text-center ">
                            <img src="/assets/images/users/avatar-7.jpg" alt="" class="avatar-lg rounded-circle" />
                            <h5 class="mt-2 mb-0">Trump </h5>
                        </div>

                        <!-- profile  -->
                        <div class="mt-3 pt-2 border-top">
                            <div class="table-responsive">
                                <table class="table table-borderless mb-0 text-muted">
                                    <tbody>
                                        <tr>
                                            <th scope="row">{{__('Email')}}</th>
                                            <td>xyz123@gmail.com</td>
                                        </tr>
                                        <tr>
                                            <th scope="row">{{__('Phone')}}</th>
                                            <td>(123) 123 1234</td>
                                        </tr>

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="card-body border-top">
                        <div class="row align-items-center">
                            <div class="col-sm-auto">
                                <p class="m-0"> <b>{{__('Since')}}</b> : Jan 12, 2022</p>
                            </div>
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('user-edit')}}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit user')}}">
                                            <i class="uil uil-edit "></i>
                                        </a>
                                    </li>
                                    <li class="list-inline-item">
                                        <a href="#" class="text-muted d-inline-block btnDelete" data-toggle="tooltip"
                                            data-placement="top" title="" data-original-title="{{__('Delete user')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end card -->
            </div>
        </div>

    </div>
</div>

<!-- pagination -->
<div class="row">
    <div class="col-4"></div>
    <div class="col-4">
        <ul class="pagination  mb-3 flex-wrap">
            <li class="page-item page-prev disabled">
                <a class="page-link" href="#" tabindex="-1">{{__('Prev')}}</a>
            </li>
            <li class="page-item active"><a class="page-link" href="#">1</a></li>
            <li class="page-item"><a class="page-link" href="#">2</a></li>
            <li class="page-item"><a class="page-link" href="#">3</a></li>
            <li class="page-item"><a class="page-link" href="#">4</a></li>
            <li class="page-item"><a class="page-link" href="#">5</a></li>
            <li class="page-item"><a class="page-link" href="#">6</a></li>
            <li class="page-item page-next">
                <a class="page-link" href="#">{{__('Next')}}</a>
            </li>
        </ul>
    </div>
    <div class="col-4"></div>
</div>
<!-- end row -->


@endsection

@section('script-bottom')
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.1.10/dist/sweetalert2.all.min.js"></script>

<script type="text/javascript">
    // Delete

    $(document).on('click', '.btnDelete', function (e) {
        var member = $(this).attr('id');
        Swal.fire({
                title: "Are you sure?",
                text: "You will not be able to recover this User!",
                type: "warning",
                buttons: true,
                confirmButtonColor: "#ff5e5e",
                confirmButtonText: "Yes, delete it!",
                closeOnConfirm: false,
                dangerMode: true,
                showCancelButton: true
            })
            .then((deleteThis) => {
                if (deleteThis.isConfirmed) {
                    $.ajax({
                        url: '',
                        type: "GET",
                        dataType: "JSON",
                        data: {
                            member: member

                        },
                        success: function (response) {

                            if (response["status"] == "fail") {
                                Swal.fire("Failed!", "Failed to delete role.", "error");
                            } else if (response["status"] == "success") {
                                Swal.fire("Deleted!", "Role has been deleted.",
                                    "success");

                                // Using .reload() method.
                                location.reload();
                            }
                        },
                        error: function (error) {
                            console.log(error);
                        },
                        async: false
                    });
                } else {
                    Swal.close();
                }
            });
    });

</script>
@endsection
