@extends('layouts.master')

@section('title')
{{__('Services')}}
@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">{{__('Services list')}}
            <span style="float:right;"> <a href="{{route('service-add')}}" role="button" class="btn  custom-button "><i
                    class="uil-plus mr-1"></i> 
               {{__('Add service')}}</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">{{__('Services 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-6 col-lg-4 mb-1"><input type="search" class="custom-search form-control "
                    placeholder="{{__('Search by name')}}...">
            </div>
            <div class="col-6 col-lg-4 mb-1">
                <select name="" id="" required class="form-control SlectBox">
                    <option value="" selected disabled>{{__('Select status')}}</option>
                    <option value="">All </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>
<!-- service -->
<div class="row">
    <div class="col-lg-4">
        <div class="card ">
            <div class="card-body pb-2">
                <div class="badge badge-success float-right">Active</div>
                <p class="text-success text-uppercase font-size-12 mb-2">#E101</p>
                <div class="media-body">

                    <h3 class="mb-0">Architectural</h3>
                    <span class=" font-size-12 ">Parent Service :
                    </span>
                    <span class="text-muted  font-size-12 "> None
                    </span>
                    <div class="card-body p-0  ">
                        <div class="row align-items-center">
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('service-edit') }}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit service')}}">
                                            <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 service')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end card -->
    </div>
    <div class="col-lg-4">
        <div class="card ">
            <div class="card-body pb-2">
                <div class="badge badge-success float-right">Active</div>
                <p class="text-success text-uppercase font-size-12 mb-2">#E102</p>
                <div class="media-body">

                    <h3 class="mb-0">Plumbing</h3>
                    <span class=" font-size-12 ">Parent Service :
                    </span>
                    <span class="text-muted  font-size-12 "> None
                    </span>
                    <div class="card-body p-0  ">
                        <div class="row align-items-center">
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('service-edit') }}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit service')}}">
                                            <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 service')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end card -->
    </div>
    <div class="col-lg-4">
        <div class="card ">
            <div class="card-body pb-2">
                <div class="badge badge-danger float-right">Deactive</div>
                <p class="text-danger text-uppercase font-size-12 mb-2">#E103</p>
                <div class="media-body">

                    <h3 class="mb-0">Exhaust Ventilation</h3>
                    <span class=" font-size-12 ">Parent Service :
                    </span>
                    <span class="text-muted  font-size-12 "> Ventilation
                    </span>
                    <div class="card-body p-0  ">
                        <div class="row align-items-center">
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('service-edit') }}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit service')}}">
                                            <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 service')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end card -->
    </div>
    <div class="col-lg-4">
        <div class="card  ">
            <div class="card-body pb-2">
                <div class="badge badge-success float-right">Active</div>
                <p class="text-success text-uppercase font-size-12 mb-2">#E104</p>
                <div class="media-body">

                    <h3 class="mb-0">Electricity</h3>
                    <span class=" font-size-12 ">Parent Service :
                    </span>
                    <span class="text-muted  font-size-12 "> None
                    </span>
                    <div class="card-body p-0  ">
                        <div class="row align-items-center">
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('service-edit') }}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit service')}}">
                                            <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 service')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end card -->
    </div>
    <div class="col-lg-4">
        <div class="card ">
            <div class="card-body pb-2">
                <div class="badge badge-danger float-right">Deactive</div>
                <p class="text-danger text-uppercase font-size-12 mb-2">#E105</p>
                <div class="media-body">

                    <h3 class="mb-0">Architectural</h3>
                    <span class=" font-size-12 ">Parent Service :
                    </span>
                    <span class="text-muted  font-size-12 "> None
                    </span>
                    <div class="card-body p-0  ">
                        <div class="row align-items-center">
                            <div class="col offset-sm-1 text-right">
                                <ul class="list-inline mb-0 ">
                                    <li class="list-inline-item ">
                                        <a href="{{route('service-edit') }}" class="text-muted d-inline-block"
                                            data-toggle="tooltip" data-placement="top" title=""
                                            data-original-title="{{__('Edit service')}}">
                                            <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 service')}}">
                                            <i class="uil uil-trash "></i>
                                        </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- end card -->
    </div>
</div>
<!-- end row -->

<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 Service!",
                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 service')}}.", "error");
                            } else if (response["status"] == "success") {
                                Swal.fire("Deleted!", "Service has been deleted.",
                                    "success");

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

</script>
@endsection
