@extends('admin.layouts.app')
@section('contentSection')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <div class="pull-left"><i class="fa fa-table"></i> Contacts (<span
                            id="module_total_count"></span>)
                    </div>
                    <div class="pull-right">
                        <form action="{{route('export-contacts')}}" method="get">
                            <button style="display: none" id="deleteAllBtn" type="button" class="btn btn-danger"><i
                                    class="fa fa-trash"></i> Delete Selected
                            </button>
                            <button type="button" data-toggle="modal" data-target="#addContactModal"
                                    class="btn btn-primary"><i
                                    class="fa fa-plus"></i> Add New
                            </button>
                            <button type="submit"
                                    class="btn btn-primary"><i
                                    class="fa fa-download"></i> Export Contacts
                            </button>
                        </form>
                    </div>
                </div>
                <div class="card-header">
                    <div class="row">
                        <div class="col-md-3 form-group">
                            <i class="fa fa-filter"></i> Filters
                        </div>
                    </div>
                    <form id="contactSearchFrom">
                        <div class="row">
                            <div class="col-md-4 form-group">
                                <label class="control-label">Type of contact</label>
                                <select name="type_search"
                                        class="form-control">
                                    <option value="">Select type of contact</option>
                                    <option value="1">Individual</option>
                                    <option value="2">Company</option>
                                </select>
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Title</label>
                                <select name="title_search"
                                        class="form-control">
                                    <option value="">Select Title</option>
                                    <option value="Mr">Mr</option>
                                    <option value="Ms">Ms</option>
                                    <option value="M/S">M/S</option>
                                </select>
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Name</label>
                                <input type="text" maxlength="50" name="name_search" class="form-control">
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Address</label>
                                <input type="text" maxlength="100" name="address_search" class="form-control">
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Gender</label>
                                <select name="gender_search"
                                        class="form-control">
                                    <option value="">Select Gender</option>
                                    <option value="1">Male</option>
                                    <option value="2">Female</option>
                                </select>
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Lead Source</label>
                                <select data-live-search="true" name="lead_source_search" id="lead_source_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Lead Source</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->where('type', 'leadSource')->whereNull('is_primary')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">Role</label>
                                <select data-live-search="true" name="cr_search" id="cr_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Contact Role</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->where('type', 'contactRole')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-4 form-group">
                                <label class="control-label">AML Status</label>
                                <select name="aml_search"
                                        class="form-control">
                                    <option value="">Select AML Status</option>
                                    <option value="1">Complete</option>
                                    <option value="2">Incomplete</option>
                                </select>
                            </div>
                        </div>
                        <br>
                        <div class="row">
                            <div class="col-md-12 text-right">
                                <button class="btn btn-primary">Search</button>
                                <button type="reset" id="contactSearchFormReset" class="btn btn-primary">Reset</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="contactsListTable" class="table table-bordered" style="width: 100%"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop

@section('pageSpecificScripts')
    @include('admin.contacts.contactsListTemplate')
    @include('admin.contacts.contactListingsListTemplate')
    @include('admin.contacts.modals.addContactModal')
    @include('admin.contacts.modals.contactListingsModal')
    <script src="{{asset('back_assets/assets/plugins/summernote/dist/summernote-bs4.min.js')}}"></script>
    <script src="{{asset('back_assets/assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js')}}"></script>
    <script src="{{asset('back_assets/assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js')}}"></script>
    <script src="{{ asset('back_assets/assets/plugins/bootstrap-select/js/bootstrap-select.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('assets/js/ajax-bs.js') }}"></script>
    <script src="{{asset('back_assets/assets/js/app/contactsScript.js')}}?{{ app_version() }}"></script>
@stop
