@extends('layouts.AdminLTE.index')

@section('icon_page', 'user')

@section('title', 'Users')

@section('menu_pagina')

    <li role="presentation">
        <a href="{{ route('lead.create') }}" class="link_menu_page">
            <i class="fa fa-plus"></i> Add
        </a>
    </li>
    <li role="presentation">
        <a href="{{ route('role') }}" class="link_menu_page">
            <i class="fa fa-unlock-alt"></i> Permissions
        </a>
    </li>

@endsection

@section('content')

    <div class="box box-primary">
        <div class="box-body">
            <div class="row">
                <div class="col-md-12">
                    <div class="table-responsive">

                        <table id="example" class="table table-condensed table-bordered table-hover" data-filtering="true">
                            <thead>
                                <tr>
                                    <th>Name</th>
                                    <th>Address</th>
                                    <th>City</th>
                                    <th>Phone Number</th>
                                    <th>Seller Type</th>
                                    <th class="text-center">Status</th>
                                    <th class="text-center">Created</th>
                                    <th class="text-center">Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach ($leads as $lead)
                                    <tr>
                                        <td>
                                            {{ $lead->owner }}
                                        </td>
                                        <td>{{ $lead->street.' '.$lead->city.' '.$lead->zipcode }}</td>
                                        <td>{{ $lead->city }}</td>
                                        <td class="">{{ $lead->cell_phone }}</td>
                                        <td>{{ $lead->sellertype }}</td>
                                        <td>{{ $lead->status }}</td>

                                        <td class="">{{ $lead->created_at->format('d/m/Y H:i') }}</td>
                                        <td class="text-left">
                                            <a class="btn btn-default  btn-xs" href="{{ route('lead.show', $lead->id) }}"
                                                title="See {{ $lead->leadsource }}"><i class="fa fa-eye"> </i></a>
                                            <a class="btn btn-primary  btn-xs" href="{{ route('lead.edit', $lead->id) }}"
                                                title="Change Password {{ $lead->leadsource }}"><i
                                                    class="fa fa-key"></i></a>
                                            <a class="btn btn-warning  btn-xs" href="{{ route('lead.edit', $lead->id) }}"
                                                title="Edit {{ $lead->leadsource }}"><i class="fa fa-pencil"></i></a>
                                            <a class="btn btn-danger  btn-xs" href="#"
                                                title="Delete {{ $lead->leadsource }}" data-toggle="modal"
                                                data-target="#modal-delete-{{ $lead->id }}"><i
                                                    class="fa fa-trash"></i></a>
                                        </td>
                                    </tr>
                                    <div class="modal fade" id="modal-delete-{{ $lead->id }}">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                        aria-label="Close">
                                                        <span aria-hidden="true">×</span>
                                                    </button>
                                                    <h4 class="modal-title"><i class="fa fa-warning"></i> Caution!!</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <p>Do you really want to delete ({{ $lead->leadsource }}) ?</p>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default pull-left"
                                                        data-dismiss="modal">Cancel</button>
                                                    <a href="{{ route('lead.destroy', $lead->id) }}"><button type="button"
                                                            class="btn btn-danger"><i class="fa fa-trash"></i>
                                                            Delete</button></a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                @endforeach
                            </tbody>
                            {{-- <tfoot>
                                <tr>
                                    <th>Name</th>
                                    <th>E-mail</th>
                                    <th class="text-center">Status</th>
                                    <th class="text-center">Created</th>
                                    <th class="text-center">Actions</th>
                                </tr>
                            </tfoot> --}}
                        </table>
                    </div>
                </div>
                <div class="col-md-12 text-center">
                </div>
            </div>
        </div>
    </div>
    <link rel="stylesheet" type="text/css" href="assets/css/footable.bootstrap.min.css">
    <script type="text/javascript" src="assets/js/footable.min.js"></script>
    <script>
        jQuery(function($){
    $('.table').footable();
});
    </script>
@endsection
