@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> Requirements (<span
                            id="module_total_count"></span>)
                    </div>
                    <div class="pull-right">
                        <button type="button" data-toggle="modal" data-target="#addLeadModal"
                                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 Leads--}}
                        {{--                            </button>--}}
                    </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="leadSearchFrom">
                        <div class="row">
                            <div class="col-md-3 form-group">
                                <label class="control-label">Community</label>
                                <select data-live-search="true" name="district_search" id="district_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Community</option>
                                    @foreach (App\Models\Attribute::whereType('district')->orderBy('name')->get() as $attr)
                                        <option value="{{ $attr->id }}">{{ $attr->name }}</option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Project</label>
                                <select data-live-search="true" name="project_search" id="project_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Project</option>
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Purpose</label>
                                <select data-live-search="true" name="purpose_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Purpose</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->where('type', 'purpose')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Property Type</label>
                                <select data-live-search="true" name="property_type_search" id="property_type_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Property Type</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->with('parent')->where('type', 'propertyType')->whereNotNull('parent_id')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->parent ? $attr->name . ' (' . $attr->parent->name . ')' : $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Status</label>
                                <select data-live-search="true" name="lead_status_search" id="lead_status_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Lead Status</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->where('type', 'leadStatus')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-3 form-group">
                                <label class="control-label">Source</label>
                                <select data-live-search="true" name="lead_source_search" id="lead_source_search"
                                        class="form-control selectpicker show-tick">
                                    <option value="">Select Source</option>
                                    @foreach (App\Models\Attribute::orderBy('name')->where('type', 'leadSource')->get() as $attr)
                                        <option value="{{ $attr->id }}">
                                            {{ $attr->name }}
                                        </option>
                                    @endforeach
                                </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="leadSearchFormReset" class="btn btn-primary">Reset</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="leadsListTable" class="table table-bordered" style="width: 100%"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop

@section('pageSpecificScripts')
    @include('admin.requirements.requirementsListTemplate')
    @include('admin.requirements.requirementListingsListTemplate')
    @include('admin.requirements.modals.addRequirementModal')
    @include('admin.requirements.modals.editRequirementModal')
    @include('admin.requirements.modals.requirementListingsModal')
    <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/requirementsScript.js')}}?{{ app_version() }}"></script>
@stop
