@extends('layout.loggedin')

@section('page-css')
<style media="screen">

</style>
<link type="text/css" rel="stylesheet" href="{!! asset('css/jsgrid.min.css') !!}" />
<link type="text/css" rel="stylesheet" href="{!! asset('css/jsgrid-theme.min.css') !!}" />
    <link type="text/css" rel="stylesheet"  href="{{ asset('css/select2.min.css') }}">
@endsection

@section('content')
<section class="hero-wrap" style="background-image: url('{{ asset('images/agent.jpeg')}}'); background-attachment:fixed">
    <div class="overlay"></div>
    <div class="container">
        <div class="row description align-items-center justify-content-center">
            <div class="col-md-12 text-center">
                <div class="col-md-12 mx-auto text-center">
                    <div class="text">
                      <h2 class="mb-5 text-center">Fidelity Young Enterprenuer  <br> Initiative </h2>
                    <div class="designed d-inline-block">
                        <d class="d-flex align-items-center">
                            <div class="ml-3">
                                <h3 class=" text-white mb-0">FYEI Application Form </h3> <br>
                                    @include('layout.alert')
                            </div>
                            </d>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<section class="ftco-section bg-light pb-4 goto-here pb-0">
    <div class="container">
        @include('layout.alert')
        <form class="" id="SaveLater" action="{!! route('submit.form',$id) !!}" method="post" enctype="multipart/form-data">
            @csrf
            <div >
                <section class="ftco-section ftco-section-2 bg-light" id="navigationTabs">
                    <div class="container-fluid">

                        <div class="row">

                            <div class="col-lg-12" id="rootwizard">
                                <div class="tabulation-2">
                                    <ul class="nav nav-pills nav-fill d-md-flex d-block">
                                        <li class="nav-item">
                                            <a class="nav-link active py-3" data-toggle="tab" href="#sectionA"><span class="ion-io"></span>1</a>
                                        </li>
                                        <li class="nav-item px-lg-2">
                                            <a class="nav-link  py-3" data-toggle="tab" href="#sectionB"><span class="ion-ios-"></span> 2</a>
                                        </li>
                                        <li class="nav-item px-lg-2">
                                            <a class="nav-link py-3" data-toggle="tab" href="#sectionC"><span class="ion-io"></span> 3</a>
                                        </li>
                                        <li class="nav-item px-lg-2">
                                            <a class="nav-link py-3" data-toggle="tab" href="#sectionD"><span class="ion-io"></span> 4</a>
                                        </li>
                                        <li class="nav-item px-lg-2">
                                            <a class="nav-link py-3" data-toggle="tab" href="#sectionE"><span class="ion-io"></span> 5</a>
                                        </li>
                                        <li class="nav-item px-lg-2">
                                            <a class="nav-link py-3" data-toggle="tab" href="#sectionF"><span class="ion-io"></span> 6</a>
                                        </li>
                                        {{--                                            <li class="nav-item px-lg-2">--}}
                                            {{--                                                <a class="nav-link py-3" data-toggle="tab" href="#sectionG"><span class="ion-io"></span> 7</a>--}}
                                        {{--                                            </li>--}}

                                        {{--                                            <li class="nav-item px-lg-2">--}}
                                            {{--                                                <a class="nav-link py-3" data-toggle="tab" href="#sectionI"><span class="ion-io"></span> 8</a>--}}
                                        {{--                                            </li>--}}
                                        {{--                                            <li class="nav-item px-lg-2">--}}
                                            {{--                                                <a class="nav-link py-3" data-toggle="tab" href="#sectionH"><span class="ion-io"></span> 9</a>--}}
                                        {{--                                            </li>--}}
                                    </ul>
                                    <div class="tab-content rounded mt-2">


                                        <div class="tab-pane container p-4 active" id="sectionA">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section A: Grant Application</h3> --}}

                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Name of Business <span class="text-danger">*</span></strong></label>
                                                        <input type="text" id="company_name" class="kk form-control" name="company_name" min="1"
                                                         value="{{ $company_name ?? $form_data['company_name'] ?? old('company_name') }}" readonly>
{{--                                                        {{ $form_data['company_name'] ?? $company_name ?? old('company_name') }}--}}
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Physical Address of Business <span class="text-danger">*</span></strong></label>
                                                        <input type="text" id="physical_address" class="kk form-control" name="physical_address" min="1"
                                                         value="{{ old('physical_address',$form_data['physical_address']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Postal Address <span class="text-danger">*</span></strong></label>
                                                        <input type="text" id="postal_address" class="kk form-control" name="postal_address" min="1"
                                                        value="{{ old('postal_address',$form_data['postal_address']) }}">
                                                    </div>
                                                </div>
                                                {{-- <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label><strong>Which of the following application funds do you belong to?<span class="text-danger">*</span></strong></label>
                                                        <select class="form-control  "  name="application_funds" id="application_funds">
                                                          <option {{ $application_funds == 'OCIF Applicant' ? 'selected': null }} value="OCIF Applicant">OCIF Applicant</option>
                                                          <option {{ $application_funds == 'FYEF Applicant' ? 'selected': null }} value="FYEF Applicant">FYEF Applicant</option>

                                                        </select>
                                                    </div>
                                                </div> --}}
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong> Business Email Address <span class="text-danger">*</span></strong></label>
                                                        <input type="text" id="email_address" class="kk form-control" name="email" min="1"
                                                        value="{{ old('email',$form_data['email']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Digital Address <span class="text-danger">*</span></strong></label>
                                                        <input type="text" id="digital_address" class="kk form-control" name="digital_address" min="1"
                                                        value="{{ old('digital_address',$form_data['digital_address']) }}">
                                                    </div>
                                                </div>

                                            </div>
                                            {{--  --}}
                                        </div>
                                        <div class="tab-pane container p-4 fade" id="sectionB">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section B: Company Details</h3> --}}
                                            <div class="row">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Name of Applicant(s) <span class="text-danger">*</span></strong></label>
                                                        <input id="applicant_name" type="text"  class="form-control" name="applicant_name"
                                                        value="{{ old('applicant_name',$form_data['applicant_name']) }}" readonly>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Address of Applicant(s) <span class="text-danger">*</span></strong></label>
                                                        <input id="applicant_address" type="text"  class="form-control" name="applicant_address"
                                                        value="{{ old('applicant_address',$form_data['applicant_address']) }}" >
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Business Phone Number <span class="text-danger">*</span></strong></label>
                                                        <input id="business_phone" type="text"  class="form-control" name="business_phone"
                                                        value="{{ old('business_phone',$form_data['business_phone']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Primary Contact Person <span class="text-danger">*</span></strong></label>
                                                        <input id="primary_contact" type="text"  class="form-control" name="primary_contact"
                                                        value="{{ old('primary_contact',$form_data['primary_contact']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Primary Contact Person Phone Number <span class="text-danger">*</span></strong></label>
                                                        <input id="primary_contact_phone" type="text"  class="form-control" name="primary_contact_phone"
                                                        value="{{ old('primary_contact_phone',$form_data['primary_contact_phone']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Current Bankers <span class="text-danger">*</span></strong></label>
                                                        <input id="current_bankers" type="text"  class="form-control" name="current_bankers"
                                                        value="{{ old('current_bankers',$form_data['current_bankers']) }}">
                                                    </div>
                                                </div>

                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Structure of Business <span class="text-danger">*</span></strong></label>
                                                        <select class="form-control" id="business_structure" name="business_structure">
                                                            <option {{$form_data->business_structure =="Sole Proprietorship"?'selected':''}} value="Sole Proprietorship">Sole Proprietorship</option>
                                                            <option {{$form_data->business_structure =='Partnership'?'selected':''}} value="Partnership">Partnership</option>
                                                            <option {{$form_data->business_structure ==='Limited Liability Company (LLC)'?'selected':''}} value="Limited Liability Company (LLC)">Limited Liability Company (LLC)</option>
                                                            <option value="Others">Others</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Branch <span class="text-danger">*</span></strong></label>
                                                        <input id="branch" type="text"  class="form-control" name="branch"
                                                        value="{{ old('branch',$form_data['branch']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6 business_structure_toggle">
                                                    <div class="form-group">
                                                        <label for=""><strong>State Business Structure<span class="text-danger">*</span></strong></label>
                                                        <input id="business_structure_state" type="text"  class="form-control" name="business_structure_state" value="{{ old('business_structure_state',$form_data['business_structure_state']) }}">
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                        <div class="tab-pane container-fluid p-4 fade" id="sectionC">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section C: Production/Operations</h3> --}}
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>Ownership of Applicant Company (List of shareholders with 20% or more ownership)</strong>
                                                        </div>
                                                        <div class="card-body">
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="d2"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="d2"></table>
                                                            </div>
                                                            <input type="hidden" id="ownership_applicant" name="ownership_applicant" value=""/>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="card">
                                                <div class="card-header">
                                                    <strong>Provide a list of Key Management Personnel</strong>
                                                </div>
                                                <div class="card-body">
                                                    <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                    {{-- <div id="c1"></div> --}}
                                                    <div class="table-responsive">
                                                      <table  id="c1"></table>
                                                    </div>
                                                    <input type="hidden" id="key_management_personnel" name="key_management_personnel" value=""/>
                                                </div>
                                            </div>
                                            <div class="row mt-4">
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Date Business was Established<span class="text-danger">*</span></strong></label>
                                                        <input id="business_established_date" type="date"  class="form-control" name="business_established_date" value="{{ old('business_established_date',$form_data['business_established_date']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Tax Identification Number (TIN)<span class="text-danger">*</span></strong></label>
                                                        <input id="tin" type="text"  class="form-control" name="tin"
                                                        value="{{ old('tin',$form_data['tin']) }}">
                                                    </div>
                                                </div>
                                                {{-- <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Nature of Business<span class="text-danger">*</span></strong></label>
                                                        <input id="nature_of_business" type="text"  class="form-control" name="nature_of_business"
                                                        value="{{ old('nature_of_business',$form_data['nature_of_business']) }}">
                                                    </div>
                                                </div> --}}
                                            </div>
                                        </div>
                                        <div class="tab-pane container-fluid p-4 fade" id="sectionD">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section D: Human Resource Management</h3> --}}
                                            <div class="row">


                                              <div class="col-md-6">
                                                  <div class="form-group">
                                                      <label><strong>Business Type <span class="text-danger">*</span></strong></label>
                                                      <select class="form-control select2" name="business_type" id="business_type">
                                                          <option></option>
                                                          @foreach($business_types as $business_type)
                                                              <option {{ $form_data->business_type == $business_type->id ? 'selected':'' }} value="{{ $business_type->id }}">{{ $business_type->name }}</option>
                                                          @endforeach
                                                      </select>
                                                  </div>
                                              </div>
                                                <div class="col-lg">
                                                  <div class="form-group">
                                                    <label for=""><strong>Description of what exactly you do<span class="text-danger">*</span></strong></label>
                                                    <textarea name="industry_desc" class="form-control" rows="4" cols="80" id="industrysectoplace">{{ old('industry_desc',$form_data['industry_desc']) }}</textarea>
                                                    {{-- <input type="text" name=""  class="form-control"  > --}}
                                                  </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Type of Business Premises <span class="text-danger">*</span></strong></label>
                                                        <select class="form-control select2" name="business_premises" id="business_premises">
                                                            <option></option>
                                                            <option {{ $form_data->business_premises == 'Owned'?'selected':'' }} value="Owned">Owned</option>
                                                            <option {{ $form_data->business_premises == 'Rented'?'selected':'' }} value="Rented">Rented</option>
                                                            <option {{ $form_data->business_premises == 'Mortgaged'?'selected':'' }} value="Mortgaged">Mortgaged</option>
                                                            <option {{ $form_data->business_premises == 'Others'?'selected':'' }} value="Others">Others</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-6 business_premise_toggle">
                                                    <div class="form-group">
                                                        <label for=""><strong>State Business Premise<span class="text-danger">*</span></strong></label>
                                                        <input id="business_premise" type="text"  class="form-control" name="business_premise"
                                                        value="{{ old('branch',$form_data['branch']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6 outstanding_years_toggle">
                                                    <div class="form-group">
                                                        <label for=""><strong>If Rented, Number of Years outstanding</strong></label>
                                                        <input type="number" class="form-control" id="outstanding_years" name="outstanding_years"
                                                        value="{{ old('outstanding_years',$form_data['outstanding_years']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Business Commencement Date <span class="text-danger">*</span></strong></label>
                                                        <input type="date" class="form-control" name="business_commencement_date" id="business_commencement_date" value="{{ old('business_commencement_date',$form_data['business_commencement_date']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Incorporation Date (For LLCs) </strong></label>
                                                        <input type="date" class="form-control" name="incorporation_date" id="incorporation_date"
                                                        value="{{ old('incorporation_date',$form_data['incorporation_date']) }}">
                                                    </div>
                                                </div>

                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Full Time Employees <span class="text-danger">*</span></strong></label>
                                                        <div class="row">
                                                          <div class="col-lg">
                                                            <div class="form-group">
                                                              <label for="">Male</label>
                                                              <input type="number" id="full_time_male" name="full_time_male" class="form-control" value="{{ old('full_time_male',$form_data['full_time_male']) }}">
                                                            </div>
                                                          </div>
                                                          <div class="col-lg">
                                                            <div class="form-group">
                                                              <label for="">Female</label>
                                                              <input type="number" id="full_time_female" name="full_time_female" class="form-control" value="{{ old('full_time_female',$form_data['full_time_female']) }}">
                                                            </div>
                                                          </div>
                                                        </div>
                                                        <input type="number" readonly class="form-control" id="full_time_employees" name="full_time_employees"
                                                        value="{{ old('full_time_employees',$form_data['full_time_employees']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Part Time Employees <span class="text-danger">*</span></strong></label>
                                                        <div class="row">
                                                          <div class="col-lg">
                                                            <div class="form-group">
                                                              <label for="">Male</label>
                                                              <input type="number" id="part_time_male" name="part_time_male" class="form-control" value="{{ old('part_time_male',$form_data['part_time_male']) }}">
                                                            </div>
                                                          </div>
                                                          <div class="col-lg">
                                                            <div class="form-group">
                                                              <label for="">Female</label>
                                                              <input type="number" id="part_time_female" name="part_time_female" class="form-control" value="{{ old('part_time_female',$form_data['part_time_female']) }}">
                                                            </div>
                                                          </div>
                                                        </div>
                                                        <input type="number" class="form-control" id="part_time_employees" name="part_time_employees"
                                                        value="{{ old('part_time_employees',$form_data['part_time_employees']) }}">
                                                    </div>
                                                </div>
                                                {{-- <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Full Time Employees <span class="text-danger">*</span></strong></label>
                                                        <input type="number" class="form-control" id="full_time_employees" name="full_time_employees"
                                                        value="{{ old('full_time_employees',$form_data['full_time_employees']) }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Part Time Employees <span class="text-danger">*</span></strong></label>
                                                        <input type="number" class="form-control" id="part_time_employees" name="part_time_employees"
                                                        value="{{ old('part_time_employees',$form_data->part_time_employees) }}">
                                                    </div>
                                                </div> --}}
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label>Does your business have the required licenses from the regulator governing business operations? <span class="text-danger">*</span></label>
                                                        <select name="required_licenses" id="required_licenses" class="form-control select2">
                                                            <option></option>
                                                            <option {{ $form_data->required_licenses == 'Yes'?'selected':'' }} >Yes</option>
                                                            <option  {{ $form_data->required_licenses == 'No'?'selected':'' }}>No</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label>Does your business have at least 2 years historic audited financials/ 2 years historic management accounts? <span class="text-danger">*</span></label>
                                                        <select name="audited_financials" id="audited_financials" class="form-control select2">
                                                            <option></option>
                                                            <option  {{ $form_data->audited_financials == 'Yes'?'selected':'' }}>Yes</option>
                                                            <option  {{ $form_data->audited_financials == 'No'?'selected':'' }}>No</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label>Does your business have a bank account/business momo statement? <span class="text-danger">*</span></label>
                                                        <select name="has_bank_account" id="has_bank_account" class="form-control select2">
                                                            <option></option>
                                                            <option {{ $form_data->has_bank_account == 'Yes'?'selected':'' }}>Yes</option>
                                                            <option {{ $form_data->has_bank_account == 'No'?'selected':'' }}>No</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="tab-pane container-fluid p-4 fade" id="sectionE">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section E: Market Information</h3> --}}


                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Expected jobs to be created (Next two years) <span class="text-danger">*</span></strong></label>
                                                        <input type="number" name="expected_jobs" class="form-control" id="expected_jobs" value="{{ old('expected_jobs') ?? $form_data['expected_jobs'] }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Full Time Employees (Expected to be Created in the Next Two Years) <span class="text-danger">*</span></strong></label>
                                                        <input type="number" name="expected_full_time_employees" class="form-control" id="expected_full_time_employees" value="{{ old('expected_full_time_employees') ?? $form_data['expected_full_time_employees'] }}">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Number of Part Time Employees (Expected to be Created in the Next Two Years) <span class="text-danger">*</span></strong></label>
                                                        <input type="number" name="expected_part_time_employees" class="form-control" id="expected_part_time_employees" value="{{ old('expected_part_time_employees') ?? $form_data['expected_part_time_employees'] }}">
                                                    </div>
                                                </div>
                                                <div class="col-md-12">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>Provide list of Major Product/Service Lines </strong>
                                                        </div>
                                                        <div class="card-body">
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="c2"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="c2"></table>
                                                            </div>
                                                            <input type="hidden" id="major_product_line" name="major_product_line" value=""/>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-12">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>Kindly provide details of your facility request</strong>
                                                        </div>
                                                        <div class="card-body">
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="facility_request_grid"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="facility_request_grid"></table>
                                                            </div>
                                                            <input type="hidden" id="facility_request" name="facility_request" value=""/>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-6">
                                                    <div class="form-group">
                                                        <label for=""><strong>Kindly indicate Tenure of Proposed Facility <span class="text-danger">*</span></strong></label>
                                                        <select class="form-control select2" id="proposed_facility_tenure" name="proposed_facility_tenure">
                                                            <option></option>
                                                            <option {{ $form_data->proposed_facility_tenure == '12 Months'?'selected':'' }}>12 Months</option>
                                                            <option {{ $form_data->proposed_facility_tenure == '24 Months'?'selected':'' }}>24 Months</option>
                                                            <option {{ $form_data->proposed_facility_tenure == '36 Months'?'selected':'' }}>36 Months</option>
                                                        </select>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                        <div class="tab-pane container-fluid p-4 fade" id="sectionF">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section F: Business Strategy</h3> --}}
                                            {{-- <p><strong>Does your company have a business strategy or plan?</strong></p> --}}
                                            {{--  --}}
                                            <div class="row">
                                              @if ($user->position !=='OCIF Applicant')
                                                <div class="col-md-12">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>Kindly provide details of Cash Assets to support your Request</strong>
                                                        </div>
                                                        <div class="card-body">
                                                          <div class="table-responsive jumbotron p-2">
                                                            <h6 class="text-center text-danger ">This is An Example</h6>
                                                            <table class="table table-bordered">
                                                              <thead>
                                                                <tr>
                                                                  <th>Instrument Type</th>
                                                                  <th>Account Name</th>
                                                                  <th>Amount</th>
                                                                </tr>
                                                              </thead>
                                                              <tbody>
                                                                <tr>
                                                                  <td>91 Day Treasury Bill</td>
                                                                  <td>Databank </td>
                                                                  <td>GHS 30,000</td>
                                                                </tr>
                                                              </tbody>
                                                            </table>
                                                          </div>
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="cash_collaterals_grid"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="cash_collaterals_grid"></table>
                                                            </div>
                                                            <input type="hidden" id="cash_collaterals" name="cash_collaterals" value=""/>
                                                        </div>
                                                    </div>
                                                </div>


                                                <div class="col-md-12 mt-5">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>Kindly provide details of Non-cash Assets to support your Request</strong>
                                                        </div>
                                                        <div class="card-body">
                                                          <div class="table-responsive jumbotron p-2">
                                                            <h6 class="text-center text-danger ">This is An Example</h6>
                                                            <table class="table table-bordered">
                                                              <thead>
                                                                <tr>
                                                                  <th>Product</th>
                                                                  <th>Amount</th>
                                                                </tr>
                                                              </thead>
                                                              <tbody>
                                                                <tr>
                                                                  <td>100*70 land at Trasacco Valley </td>
                                                                  <td>GHS 1,200,000</td>
                                                                </tr>
                                                              </tbody>
                                                            </table>
                                                          </div>
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="non_cash_collaterals_grid"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="non_cash_collaterals_grid"></table>
                                                            </div>
                                                            <input type="hidden" id="non_cash_collaterals" name="non_cash_collaterals" value=""/>
                                                        </div>
                                                    </div>
                                                </div>
                                              @endif

                                                <div class="col-md-6 mt-5">
                                                    <div class="form-group">
                                                        <label for=""><strong>Does your business have any outstanding credit facilities with Fidelity Bank? <span class="text-danger">*</span></strong></label>
                                                        <select class="form-control" id="credit_facilities" name="credit_facilities">
                                                            <option></option>
                                                            <option {{ $form_data->credit_facilities == 'Yes'?'selected':'' }}>Yes</option>
                                                            <option {{ $form_data->credit_facilities == 'No'?'selected':'' }}>No</option>
                                                            {{-- <option {{ $form_data->credit_facilities == 'Others'?'selected':'' }}>Others</option> --}}
                                                        </select>
                                                        <input type="text" id="credit_facilities_others_fidelity" name="credit_facilities_others_fidelity" class="form-control mt-5" placeholder="If other, type">
                                                    </div>
                                                </div>
                                                <div class="col-md-12 mt-5">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>If yes, kindly provide the following details</strong>
                                                        </div>
                                                        <div class="card-body">
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="credit_facility_details_grid"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="credit_facility_details_grid"></table>
                                                            </div>
                                                            <input type="hidden" id="credit_facility_details" name="credit_facility_details" value=""/>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-6 mt-5">
                                                    <div class="form-group">
                                                        <label for=""><strong>Does your business have any outstanding credit facilities with Other Banks? <span class="text-danger">*</span></strong></label>
                                                        <select class="form-control " id="credit_facilities_others" name="credit_facilities_others">
                                                            <option></option>
                                                            <option {{ $form_data->credit_facilities_others == 'Yes'?'selected':'' }}>Yes</option>
                                                            <option {{ $form_data->credit_facilities_others == 'No'?'selected':'' }}>No</option>
                                                            {{-- <option {{ $form_data->credit_facilities_others == 'Others'?'selected':'' }}>Others</option> --}}
                                                        </select>
                                                        <input type="text" class="form-control mt-5" placeholder="If yes, type" id="credit_facilities_other_banks_others" name="credit_facilities_other_banks_others">
                                                    </div>
                                                </div>
                                                <div class="col-md-12 mt-5">
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <strong>If yes, kindly provide the following details</strong>
                                                        </div>
                                                        <div class="card-body">
                                                            <span class="text-primary">NB: Please press the <strong>+</strong> button beside your entry to save it </span>
                                                            {{-- <div id="credit_facility_other_banks_details_grid"></div> --}}
                                                            <div class="table-responsive">
                                                              <table  id="credit_facility_other_banks_details_grid"></table>
                                                            </div>
                                                            <input type="hidden" id="credit_facility_other_banks_details" name="credit_facility_others_details" value=""/>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-12">
                                                    <div class="form-group">
                                                        <label for=""><strong>Kindly explain how the loan will affect your business goals regarding production, sales, profit, job creation etc. (Min: 50 Max: 200) <span class="text-danger">*</span></strong></label>
                                                        <textarea class="form-control" onkeyup="countChar(this)" id="comment" name="comment" rows="10">{{ $form_data->comment }}</textarea>
                                                        <br> <small id="charNum"></small>
                                                    </div>

                                                    <h4 class="text-primary">Declaration</h4>
                                                    <p>I declare that I am the owner of the company and all information provided here are true as at the time of application. If it should later transpire that information is false, I am willing to refund all costs including loan amount and related costs to the project</p>
                                                    Name:{{ $name }} <br>
                                                    Date: @php
                                                    echo date('d M, Y')
                                                    @endphp
                                                    <p class="fid">Should be Shareholder/Director </p>
                                                </div>
                                            </div>

                                        </div>

                                        <div class="tab-pane container-fluid p-4 fade" id="sectionG">
                                            {{--  --}}
                                            {{-- <h3 class="fid">Section G: FINANCIAL PER`FORM`ANCE(Financial Ratios)</h3> --}}
                                        </div>
                                        <div class="tab-pane container-fluid p-4 fade" id="sectionI">
                                            <h3 class="fid">Section I: CONDITION PRECENT</h3>
                                            <p class="fid">Please upload clear images in this section(jpg,jpeg,png,webp)</p>

                                        </div>
                                        <div class="tab-pane container-fluid p-4 fade" id="sectionH">
                                            {{--  --}}
                                            <h3 class="fid">Section H: MONITORING & EVALUATION AND KEY PERFORMANCE INDICATORS</h3>

                                            {{--                                                <h5 class="fid">Supporting Documents</h5>--}}
                                            {{--                                                <p class="text-success">NB: Please upload pdf,jpg,jpeg,png,webp files only.</p>--}}


                                            {{--  --}}

                                            {{--                                                <h4 class="text-primary">Declaration</h4>--}}
                                            {{--                                                <p>I declare that I am the owner of the company and all information provided here are true as at the time of application. If it should later transpire that information is false, I am willing to refund all costs including grant amount and related costs to the project</p>--}}
                                            {{--                                                Name:{{ $name }} <br>--}}
                                            {{--                                                Date: @php--}}
                                            {{--                                                    echo date('d M, Y')--}}
                                            {{--                                                @endphp--}}
                                            {{--                                                <p class="fid">Should be Shareholder/Director </p>--}}

                                        </div>

                                        <div class="row pagination wizard  pb-4">

                                            <div class="col-lg  text-center">
                                                <li class=" text-white previous disabled"><button type="button" class="text-white mb-3 btn fidbtn"><span class="text-white ion-ios-arrow-back" style="font-size:15px ;"> Previous</span></button></li>

                                                {{-- <button type="button" class="btn btn-secondary" name="button">Save for later</button> --}}
                                            </div>
                                            <div class="col-lg  text-center">
                                                <li class=" text-white  "><button type="submit"  name="saveforlater" value="saveforlater" class="text-white mb-3 btn btn-success" style=""><span class="text-white " style="font-size:15px">  Save For Later</span></button></li>
                                            </div>
                                            <input type="hidden" name="saveType" id="saveType">

                                            <div class="col-lg  text-center">
                                                <li class=" text-white  "><button type="submit" style="width:150px !important;" name="complete" value="complete" class=" mb-3  text-white btn btn-success"><span class="text-white" style="font-size:15px">Submit</span></button></li>

                                            </div>

                                            <div class="col-lg  text-center">
                                                <li class=" text-white next "><button type="button" style="width:150px !important;" class="text-white hh mb-3 btn fidbtn">Next <span class="text-white ion-ios-arrow-forward" style="font-size:15px"> </span></button></li>
                                            </div>

                                        </div>
                                    </form>


                                </div>
                            </section>

                            <div class="modal modal-fluid fade" id="myModals" tabindex="-1" role="dialog" aria-labelledby="modal_1" aria-hidden="true">
                                <div class="modal-dialog modal-md" role="document">
                                    <div class="modal-content">
                                        <div class="modal-body">
                                            <div class="row justify-content-center">
                                                <div class="col-lg-12 text-center py-4">
                                                    <h5 class="heading h5">Cash & Non Cash Collateral Fields Required!</h5>
                                                    <p class="lead text-muted">
                                                        Please fill the Cash & Non Cash Collateral Fields on section 6<br>
                                                        {{--                                <small>Sections 1,2 and 7 are required</small>--}}
                                                    </p>

                                                    <button type="button" class="btn btn-primary" data-dismiss="modal">Okay</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal modal-fluid fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modal_1" aria-hidden="true">
                                <div class="modal-dialog modal-md" role="document">
                                    <div class="modal-content">
                                        <div class="modal-body">
                                            <div class="row justify-content-center">
                                                <div class="col-lg-12 text-center py-4">
                                                    <h5 class="heading h5">Required Fields Cannot be left Blank</h5>
                                                    <p class="lead text-muted">
                                                        Please fill all fields with the <span class="text-danger">*</span> mark <br>
                                                        <div id="modalalert">

                                                        </div>
                                                        {{--                                <small>Sections 1,2 and 7 are required</small>--}}
                                                    </p>

                                                    <button type="button" class="btn btn-primary" data-dismiss="modal">Okay</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            {{-- <section class="ftco-section bg- goto-here pb-0">
                              <div class="container">
                                <div class="row">
                                  <div class="col-lg">
                                    <img src="{!! asset('images/team.png') !!}" class="img-fluid" alt="">
                                </div>
                            </div>

                        </section> --}}
                        @endsection

                        @section('page-js')
                        <script src="{!! asset('js/jquery.bootstrap.wizard.min.js') !!}" charset="utf-8"></script>
                        <script src="{{ asset('js/select2.full.min.js') }}"></script>
                        <script type="text/javascript">
                            $(document).ready(function() {

                                $('.select2').select2();

                                $('#rootwizard').bootstrapWizard({
                                    'tabClass': 'nav nav-pills',
                                    'onNext': function(tab, navigation, index) {

                                        if (index ==1) {

                                            if($('#company_name').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Company Name left blank(Section 1)</small>')
                                                return false;
                                            }
                                            else if($('#physical_address').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Physical Address of Business left blank(Section 1)</small>')
                                                return false;
                                            }else if($('#postal_address').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Postal Address left blank(Section 1)</small>')
                                                return false;
                                            }else if($('#email_address').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business Email Address left blank(Section 1)</small>')
                                                return false
                                            }else if($('#digital_address').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Digital Address left blank(Section 1)</small>')
                                                return false
                                            }
                                        } else if(index ==2){

                                            if($('#applicant_name').val() === '') {
                                                $('#myModal').modal('show')

                                                return false;
                                            }else if ($('#applicant_address').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Address of Applicant left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#business_phone').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business Phone Number left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#primary_contact').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Primary Contact Person left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#primary_contact_phone').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Primary Contact Person Phone Number left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#current_bankers').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Current Bankers Phone Number left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#branch').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Branch Number left blank(Section 2)</small>')
                                                return false;
                                            }
                                            else if ($('#business_structure').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Structure of Business left blank(Section 2)</small>')
                                                return false;
                                            }
                                        }else if(index == 3){
                                            if($('#business_established_date').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Date Business was Established left blank(Section 3)</small>')
                                                return false;
                                            }else if($('#tin').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Tax Identification Number left blank(Section 3)</small>')
                                                return false;
                                            }
                                        }else if(index == 4){
                                            if($('#business_type').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business Type left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#business_premises').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business Premises left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#business_commencement_date').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business Commencement Date left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#full_time_employees').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Full Time Employees left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#part_time_employees').val() === '') {
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Part Time Employees left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#required_licenses').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Required licenses from the regulator left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#audited_financials').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Historic audited financials left blank(Section 4)</small>')
                                                return false;
                                            }else if($('#has_bank_account').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Business have a bank account left blank(Section 4)</small>')
                                                return false;
                                            }

                                        }else if(index == 5){
                                          $('.hh').hide();
                                            if($('#expected_jobs').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Expected jobs left blank(Section 5)</small>')
                                                return false;
                                            }
                                            else if($('#expected_full_time_employees').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Expected Number of Full Time Employees  left blank(Section 5)</small>')
                                                return false;
                                            }
                                            else if($('#expected_part_time_employees').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small>Expected Number of part Time Employees  left blank(Section 5)</small>')
                                                return false;
                                            }else if($('#proposed_facility_tenure').val() === ''){
                                                $('#myModal').modal('show')
                                                $('#modalalert').append('<small> Tenure of Proposed Facility  left blank(Section 5)</small>')
                                                return false;
                                            }
                                        }else if(index == 6){
// $('.hh').attr('disable',true);
                                            // if($('#credit_facilities').val() === ''){
                                            //     $('#myModal').modal('show')
                                            //     $('#modalalert').append('<small>Outstanding credit facilities with Fidelity Bank left blank(Section 6)</small>')
                                            //     return false;
                                            // }
                                            // else if($('#credit_facilities_others_fidelity').val() === ''){
                                            //     $('#myModal').modal('show')
                                            //     $('#modalalert').append('<small>Outstanding credit facilities with Other Banks left blank(Section 6)</small>')
                                            //     return false;
                                            // }else if($('#credit_facilities_other_banks_others').val() === ''){
                                            //     $('#myModal').modal('show')
                                            //     $('#modalalert').append('<small>Outstanding credit facilities with Other Banks left blank(Section 6)</small>')
                                            //     return false;
                                            // }
                                        }

                                    },

                                    'onTabClick': function(tab, navigation, index) {


                                        console.log(index);
                                        if (index ==0) {
                                          if($('#company_name').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Company Name left blank(Section 1)</small>')
                                              return false;
                                          }
                                          else if($('#physical_address').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Physical Address of Business left blank(Section 1)</small>')
                                              return false;
                                          }else if($('#postal_address').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Postal Address left blank(Section 1)</small>')
                                              return false;
                                          }else if($('#email_address').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business Email Address left blank(Section 1)</small>')
                                              return false
                                          }else if($('#digital_address').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Digital Address left blank(Section 1)</small>')
                                              return false
                                          }
                                        }else if(index == 1){
                                          if($('#applicant_name').val() === '') {
                                              $('#myModal').modal('show')

                                              return false;
                                          }else if ($('#applicant_address').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Address of Applicant left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#business_phone').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business Phone Number left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#primary_contact').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Primary Contact Person left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#primary_contact_phone').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Primary Contact Person Phone Number left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#current_bankers').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Current Bankers Phone Number left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#branch').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Branch Number left blank(Section 2)</small>')
                                              return false;
                                          }
                                          else if ($('#business_structure').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Structure of Business left blank(Section 2)</small>')
                                              return false;
                                          }
                                        }else if(index == 2){

                                          if($('#business_established_date').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Date Business was Established left blank(Section 3)</small>')
                                              return false;
                                          }else if($('#tin').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Tax Identification Number left blank(Section 3)</small>')
                                              return false;
                                          }

                                        }else if(index == 3){
                                          if($('#business_type').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business Type left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#business_premises').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business Premises left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#business_commencement_date').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business Commencement Date left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#full_time_employees').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Full Time Employees left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#part_time_employees').val() === '') {
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Part Time Employees left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#required_licenses').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Required licenses from the regulator left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#audited_financials').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Historic audited financials left blank(Section 4)</small>')
                                              return false;
                                          }else if($('#has_bank_account').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Business have a bank account left blank(Section 4)</small>')
                                              return false;
                                          }
                                        }else if(index == 4){
                                          $('.hh').hide();
                                          if($('#expected_jobs').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Expected jobs left blank(Section 5)</small>')
                                              return false;
                                          }
                                          else if($('#expected_full_time_employees').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Expected Number of Full Time Employees  left blank(Section 5)</small>')
                                              return false;
                                          }
                                          else if($('#expected_part_time_employees').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small>Expected Number of part Time Employees  left blank(Section 5)</small>')
                                              return false;
                                          }else if($('#proposed_facility_tenure').val() === ''){
                                              $('#myModal').modal('show')
                                              $('#modalalert').append('<small> Tenure of Proposed Facility  left blank(Section 5)</small>')
                                              return false;
                                          }
                                        }


                                    }

                                });

});
</script>
<script type="text/javascript">

$('#business_type').change(function(){
  var indust_id = $(this).val();
  console.log('ll');
  if (indust_id == '1') {
    console.log('ppp');
    $('#industrysectoplace').attr('placeholder','Eg. Crop Production(Vegetables/Root and Tubers),Animal Husbandry(Piggery,Poultry, Rabbitry)')
  }else if (indust_id == '2') {
      $('#industrysectoplace').attr('placeholder','Eg. Fashion,Bead making,Millery')
  }
  else if (indust_id == '3') {
      $('#industrysectoplace').attr('placeholder','Eg. Waste Recycling,Energy Efficiency, Solar etc.')
  }
  else if (indust_id == '4') {
      $('#industrysectoplace').attr('placeholder','Eg. Any Process that involves the conversion of raw materials into finished goods eg, shea butter to lotions,leather to make shoes')
  }
  else if (indust_id == '5') {
      $('#industrysectoplace').attr('placeholder','Eg. Health Tech,Edu tech,Fintech(where Technology is the key enabler driving the business)')
  }
});


function countChar(val) {
  var len = val.value.length;
  if (len >= 200) {
    val.value = val.value.substring(0, 200);
    $('#charNum').text(0);
  } else {
    $('#charNum').text(200 - len);
  }
};


// Fulltime employee
$('#full_time_male').on('change',function(){
  var male = $(this).val();
  var female=$('#full_time_female').val();
  var tt = parseInt(male)+parseInt(female);

  $('#full_time_employees').val(tt);
});
$('#full_time_female').on('change',function(){
  var female = $(this).val();
  var male=$('#full_time_male').val();
  var tt = parseInt(male)+parseInt(female);

  $('#full_time_employees').val(tt);
});


// Part Time
$('#part_time_male').on('change',function(){
  var male = $(this).val();
  var female=$('#part_time_female').val();
  var tt = parseInt(male)+parseInt(female);

  $('#part_time_employees').val(tt);
});
$('#part_time_female').on('change',function(){
  var female = $(this).val();
  var male=$('#part_time_male').val();
  var tt = parseInt(male)+parseInt(female);

  $('#part_time_employees').val(tt);
});



        $('.business_structure_toggle').hide();


        $('#business_structure').on('change', function (){
            if ($(this).val() === 'Others'){
                $('.business_structure_toggle').show(400)
                // switchRequirement('id', 'business_structure_state', true)
            }else{
                $('.business_structure_toggle').hide(400)
                // switchRequirement('id', 'business_structure_state', false)
            }
        })

        // business_premises
        // outstanding_years
        $('.business_premise_toggle').hide();
        $('.outstanding_years_toggle').hide();

        $('#business_premises').on('change', function (){
            if ($(this).val() === 'Others'){
                $('.business_premise_toggle').show(400)
                // switchRequirement('id', 'business_premise', true)
            }else{
                $('.business_premise_toggle').hide(400)
                // switchRequirement('id', 'business_premise', false)
            }

            if ($(this).val() === 'Rented'){
                $('.outstanding_years_toggle').show(400)
                // switchRequirement('id', 'outstanding_years', true)
            }else{
                $('.outstanding_years_toggle').hide(400)
                // switchRequirement('id', 'outstanding_years', false)
            }

        })


        // $('#business_premises').change(function (){
        //
        // })


        $('#credit_facilities_others_fidelity').hide();

        $('#credit_facilities').on('change', function (){
            if ($(this).val() === 'Others'){
                $('.business_structure_toggle').show(400)
                // switchRequirement('id', 'credit_facilities_others_fidelity', true)
            }else{
                $('.business_structure_toggle').hide(400)
                // switchRequirement('id', 'credit_facilities_others_fidelity', false)
            }
        })

        $('#credit_facilities_other_banks_others').hide();
        // $('#credit_facilities_others').hide();


        $('#credit_facilities_others').on('change', function () {
            if ($(this).val() === 'Others'){
                $('#credit_facilities_other_banks_others').show(400)
                // switchRequirement('id', 'credit_facilities_other_banks_others', true)
            }else{
                $('#credit_facilities_other_banks_others').hide(400)
                // switchRequirement('id', 'credit_facilities_other_banks_others', false)
            }
        })





        function switchRequirement(type, dom, bool){
            if(type === 'class'){
                if (bool === true){
                    $('.' + dom).prop('required', true)
                }else{
                    $('.' + dom).prop('required', false)
                }
            }

            if (type === 'id'){
                if (bool === true){
                    $('#' + dom).prop('required', true)
                }else{
                    $('#' + dom).prop('required', false)
                }
            }

        }






    </script>

    <script type="text/javascript" src="{!! asset('css/jsgrid.min.js') !!}"></script>
    <script type="text/javascript">
        var token = $('input[name=_token]');


        $("#c1").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.c1',$id) !!}",
                        // data: filter
                        success: function (data) {
          session = data;
          // console.log(fliter + 'ppppp');
       },
     });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "name",title:"Name", type: "text",validate: "required"},
            { name: "title",title:"Title", type: "text",validate: "required" },
            { name: "years_with_company",title:"Years with Company", type: "number",  validate: "required"},
            { name: "date_of_birth",title:"Date of Birth(dd/mm/yyyy)", type: "text", placeholder:"dd/mm/yyyy", sorting: false ,validate: "required"},
            { type: "control" }
            ]
        });




        $("#credit_facility_details_grid").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                        return $.ajax({
                            type: "GET",
                            url: "{!! route('get.credit.facility',$id) !!}",
                            // data: filter
                            success: function (data) {
              session = data;
              // console.log(fliter + 'ppppp');
           },
                        });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "facility_type",title:"Facility Type", type: "text",validate: "required"},
            { name: "amount",title:"Amount", type: "text",validate: "required" },
            { name: "outstanding_amount",title:"Outstanding Amount", type: "number",  validate: "required"},
            { name: "monthly_repayment",title:"Monthly Repayment", type: "number",  validate: "required"},
            { name: "expiry_date",title:"Expiry Date(dd/mm/yyyy)", type: "text",  validate: "required"},
            { type: "control" }
            ]
        });


        $("#credit_facility_others_details_grid").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                        return '';}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "bank",title:"Bank", type: "text",validate: "required"},
            { name: "facility_type",title:"Facility Type", type: "text",validate: "required"},
            { name: "amount",title:"Amount", type: "text",validate: "required" },
            { name: "outstanding_amount",title:"Outstanding Amount", type: "number",  validate: "required"},
            { name: "monthly_repayment",title:"Monthly Repayment", type: "number",  validate: "required"},
            { name: "expiry_date",title:"Expiry Date(dd/mm/yyyy)", type: "text",  validate: "required"},
            { type: "control" }
            ]
        });





        $("#credit_facility_other_banks_details_grid").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                        return $.ajax({
                            type: "GET",
                            url: "{!! route('get.credit.details',$id) !!}",
                            // data: filter
                            success: function (data) {
              session = data;
              // console.log(fliter + 'ppppp');
           },
         });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "instrument_type",title:"Assets Type", type: "text",validate: "required"},
            { name: "amount",title:"Amount", type: "text",validate: "required" },
            { name: "outstanding_amount",title:"Outstanding Amount", type: "number",  validate: "required"},
            { name: "monthly_repayment",title:"Monthly Repayment", type: "number",  validate: "required"},
            { name: "expiry_date",title:"Expiry Date(dd/mm/yyyy)", type: "text",  validate: "required"},
            { type: "control" }
            ]
        });





        $("#cash_collaterals_grid").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.cash_collaterals_grid',$id) !!}",
                        // data: filter
                        success: function (data) {
          session = data;
          // console.log(fliter + 'ppppp');
       },
     });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "instrument_type",title:"Assets Type", type: "text",validate: "required"},
            { name: "account_name",title:"Account Name", type: "text",validate: "required" },
            { name: "amount",title:"Amount", type: "number",  validate: "required"},
            { type: "control" }
            ]
        });



        $("#non_cash_collaterals_grid").jsGrid({
            width: "100%",
            height: "auto",
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.non_cash_collaterals_grid',$id) !!}",
                        // data: filter
                        success: function (data) {
          session = data;
          // console.log(fliter + 'ppppp');
       },
     });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            fields: [
            { name: "product",title:"Product", type: "text",validate: "required"},
            { name: "market_value",title:"Market Value", type: "number",validate: "required" },
            { type: "control" }
            ]
        });


        $("#c2").jsGrid({
            width: "100%",
            height: "auto",
            autoload:true,
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.c2',$id) !!}",
                        // data: filter
                        success: function (data) {
          session = data;
          // console.log(fliter + 'ppppp');
       },
     });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            fields: [
            { name: "product",title:"Product/Service", type: "text",validate: "required"},
            { name: "percentage_of_sales",title:"Percentage of Sales", type: "number" ,validate: "required"},
            { type: "control" }
            ]
        });



        $("#facility_request_grid").jsGrid({
            width: "100%",
            height: "auto",
            autoload:true,
            controller: {
                loadData: function () {
                    var session ;
                    if (jQuery.isEmptyObject(session)){
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.request',$id) !!}",
                        // data: filter
                        success: function (data) {
          session = data;
          // console.log(fliter + 'ppppp');
       },
     });}
                    else{
                        return session;}
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            fields: [
            { name: "request",title:"Request", type: "text",validate: "required"},
            { name: "amount",title:"Amount", type: "number" ,validate: "required"},
            { type: "control" }
            ]
        });




        $("#c3").jsGrid({
            width: "100%",
            height: "auto",
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            autoload:true,
            controller: {
                loadData: function (filter) {
                    var session = {!! !empty(session('productionlevels')) ? json_encode(session('productionlevels')) : ($items ?? json_encode([])) !!};
                    if (jQuery.isEmptyObject(session))
                        return '';
                    else
                        return session;
                }
            },
            fields: [
            { name: "product",title:"Product/Service", type: "text", validate: "required" },
            { name: "annual_capacity",title:"Annual Feasible Capacity (Units)", type: "text", validate: "required"},
            { name: "past",title:"Past (2021)", type: "text" , validate: "required"},
            { name: "current",title:"Current (2022)", type: "text", validate: "required" },
            { name: "year_1",title:"Projected Year 1", type: "text", sorting: false , validate: "required"},
            { name: "year_2",title:"Projected Year 2", type: "text", sorting: false , validate: "required"},
            { type: "control" }
            ]
        });

        $("#d1").jsGrid({
            width: "100%",
            height: "auto",
            autoload:true,
            controller: {
                loadData: function (filter) {
                    var session = {!! !empty(session('directors')) ? json_encode(session('directors')) : ($items ?? json_encode([])) !!};
                    if (jQuery.isEmptyObject(session))
                        return '';
                    else
                        return session;
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            fields: [

            { name: "name",title:"Name", type: "text", validate: "required" },
            { name: "academic_qua",title:"Academic/Professional Qualifications", type: "text", validate: "required"},
            { name: "working_exp",title:"Post Qualification Working Experience", type: "text" , validate: "required"},
            { name: "years_as_board",title:"No of Years as a Board Member", type: "text", validate: "required" },

            { type: "control" }
            ]
        });

        $("#d2").jsGrid({
            width: "100%",
            height: "auto",
            autoload:true,
            controller: {
                loadData: function (filt) {
                    var session = {!! !empty(session('ownership_applicant')) ? json_encode(session('ownership_applicant')) : ($items ?? json_encode([])) !!};
                    if (jQuery.isEmptyObject(session))
                    return $.ajax({
                        type: "GET",
                        url: "{!! route('get.owner',$id) !!}",
                        data: filt
                    });
                    else
                        return session;
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            fields: [
            'name',
            'tin',
            'date',
            'percentage_owned',
            { name: "name",title:"Full Name", type: "text", validate: "required" },
            { name: "tin",title:"TIN Number", type: "text", validate: "required"},
            { name: "date",title:"Date (mm/dd/yyyy)", type: "text", validate: "required" },
            { name: "percentage_owned", title:"Percentage Owned", type: "number", validate: "required"},

            { type: "control" }
            ]
        });


        $("#e1").jsGrid({
            width: "100%",
            height: "auto",
            autoload:true,
            controller: {
                loadData: function (filter) {
                    var session = {!! !empty(session('product_packaging')) ? json_encode(session('product_packaging')) : ($items ?? json_encode([])) !!};
                    if (jQuery.isEmptyObject(session))
                        return '';
                    else
                        return session;
                }
            },
            inserting: true,
            editing: true,
            sorting: false,
            paging: true,
            fields: [

            { name: "product",title:"Product/Service", type: "text", validate: "required" },
            { name: "packaging",title:"Packaging Information", type: "text", validate: "required"},
            { type: "control" }
            ]
        });

        $("#f1").jsGrid({
            width: "100%",
            height: "auto",
            inserting: true,
            autoload:true,
            editing: true,
            sorting: false,
            paging: true,
            controller: {
                loadData: function (filter) {
                    var session = {!! !empty(session('credit_history')) ? json_encode(session('credit_history')) : ($items ?? json_encode([])) !!};
                    if (jQuery.isEmptyObject(session))
                        return '';
                    else
                        return session;
                }
            },
            fields: [

            { name: "bank",title:"Name of Bank", type: "text", validate: "required" },
            { name: "loan_date",title:"Date of Loan(dd/mm/yyyy)", type: "text", validate: "required"},
            { name: "amt",title:"Amount", type: "text", validate: "required"},
            { name: "payment_history",title:"Payment History", type: "text", validate: "required"},
            { type: "control" }
            ]
        });
        $('#SaveLater').on('submit', function (e) {
            e.preventDefault();
            key_management_personnel = $("#c1").jsGrid("option", "data");
            $('#key_management_personnel').val(JSON.stringify(key_management_personnel));

            major_product_line = $("#c2").jsGrid("option", "data");
            $('#major_product_line').val(JSON.stringify(major_product_line));

            credit_facility_details = $("#credit_facility_details_grid").jsGrid("option", "data");
            $('#credit_facility_details').val(JSON.stringify(credit_facility_details));

            facility_request = $("#facility_request_grid").jsGrid("option", "data");
            $('#facility_request').val(JSON.stringify(facility_request));

            ownership_applicant = $("#d2").jsGrid("option", "data");
            $('#ownership_applicant').val(JSON.stringify(ownership_applicant));

            cash_collaterals = $("#cash_collaterals_grid").jsGrid("option", "data");
            $('#cash_collaterals').val(JSON.stringify(cash_collaterals));


            non_cash_collaterals = $("#non_cash_collaterals_grid").jsGrid("option", "data");
            $('#non_cash_collaterals').val(JSON.stringify(non_cash_collaterals));

            credit_facility_other_banks_details_grid = $("#credit_facility_other_banks_details_grid").jsGrid("option", "data");
            $('#credit_facility_other_banks_details').val(JSON.stringify(credit_facility_other_banks_details_grid));


            changeBtnLook('disable')
  var gg =$('#application_funds').val();
            let saveType = $('#saveType').val($(this).find("button:focus").attr('value'));
            var re = $('#saveType').val();
                        if (JSON.stringify(cash_collaterals) ==='[]' && JSON.stringify(non_cash_collaterals) ==='[]' &&  gg == 'FYEF Applicant' && re ==="complete") {
                          console.log('yes null');
                          // console.log();
                            $('#myModals').modal('show')
                          save.prop('disabled', false)
                          save.html('Submit')

                          saveForLater.prop('disabled', false)
                          saveForLater.html('Save For Later')

                        }
            $.ajax({
                url: $(this).attr('action'),
                data: $(this).serialize(),
                method: 'POST',
            }).done((response) => {
                console.log(response)
                if (response.msg == 'redirect'){
                    window.location.href = response.route;
                }else if(response.code == '402'){
                    runToast(response.msg, response.code)
                    changeBtnLook('enable')
                } else{
                    runToast(response.msg, response.code)
                    changeBtnLook('enable')
                }
            }).fail((response) => {
                    runToast(response.msg, response.code)
                    changeBtnLook('enable')
            })
        });

        function changeBtnLook(status){
            let saveForLater = $('#saveForLater'),
                save = $('#save');


            if (status ==='disable') {
                $(this).find("button:focus").text('Processing, please be patient....');
                $(this).find("button:focus").prop('disabled', true);

            }
            if(status == 'enable'){
                save.prop('disabled', false)
                save.html('Submit')

                saveForLater.prop('disabled', false)
                saveForLater.html('Save For Later')
            }

        }
    </script>
    @endsection
