<div class="container mt-5">
    
<?php
                    if ($this->session->flashdata('alert_success')) {
                    ?>
                        <div class="alert alert-success alert-dismissible fade show" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">×</span>
                            </button>
                            <?php echo $this->session->flashdata('alert_success'); ?>
                        </div>
                    <?php
                    }

                    if ($this->session->flashdata('alert_danger')) {
                    ?>
                        <div class="alert alert-danger alert-dismissible fade show" role="alert">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">×</span>
                            </button>
                            <?php echo $this->session->flashdata('alert_danger'); ?>
                        </div>
                    <?php
                    }
                    ?>
    <div class="card">
        <div class="card-body">
            <div class="d-flex justify-content-between">
            <h4 class="header-title mb-3"> Application Form</h4>
            <h5>Reference No. <?= $userDetails['reference_no'] ?></h5>
            </div>
            <!-- data-bs-toggle="tab" data-toggle="tab" -->
            <div id="rootwizard">
                <ul class="nav nav-pills bg-light nav-justified form-wizard-header mb-3">
                    <li class="nav-item" data-target-form="#accountForm">
                        <a href="#first" id="firstHeader"  class="nav-link rounded-0 pt-2 pb-2 active">
                            <i class="ti-user me-1"></i>
                            <span class="d-none d-sm-inline">Personal Info</span>
                        </a>
                    </li>
                    <li class="nav-item"  data-target-form="#profileForm">
                        <a href="#second"  id="secondHeader" class="nav-link rounded-0 pt-2 pb-2 ">
                            <i class="ti-id-badge me-1"></i>
                            <span class="d-none d-sm-inline">Parent/ Guardian Info</span>
                        </a>
                    </li>
                    <li class="nav-item" data-target-form="#otherForm">
                        <a href="#third" id="thirdHeader"  class="nav-link rounded-0 pt-2 pb-2">
                            <i class="ti-degre me-1"></i>
                            <span class="d-none d-sm-inline">Education / Work.exp</span>
                        </a>
                    </li>
                    <li class="nav-item" data-target-form="#otherForm">
                        <a href="#fourth" id="fourthHeader" class="nav-link rounded-0 pt-2 pb-2">
                            <i class="ti-degre me-1"></i>
                            <span class="d-none d-sm-inline">Other Info</span>
                        </a>
                    </li>
                    <li class="nav-item" data-target-form="#otherForm">
                        <a href="#fifth" id="fifthHeader"  class="nav-link rounded-0 pt-2 pb-2">
                            <i class="ti-degre me-1"></i>
                            <span class="d-none d-sm-inline">Accommodation Info</span>
                        </a>
                    </li>
                </ul>
  <div class="tab-content mb-0 b-0 pt-0"> 
                    <div class="tab-pane  active show" id="first">
                        <form id="applicationForm1" method="POST" action="<?php echo base_url(); ?>ApplicationController/addApplication" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-8">
                                    <input type="hidden" name="applicationId" value="<?= isset($personalInfo) ?   $personalInfo['id']  : '' ?>">
                                    <input type="hidden" name="academicYear" value="<?= isset($academicYear) ?   $academicYear['year']  : '' ?>">
                                    <input type="hidden" name="draft" class="draftVal1" value="0"> 
                                    <input type="hidden" name="tab_status" class="tab_statusVal1" value="0"> 
                                    <!-- if draft = 1 then it is active, not draft -->
                                    
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Choose Course <span class="text-danger">*</span></b> <br>
                                        <select class="form-control select2-with-search" name="course_id" onchange="getCourse(event)">
                                            <option value="">--select--</option>
                                          <?php foreach ($courses as $item) {?>
                                        <option value="<?= $item->id  ?>" <?= isset($personalInfo) && $personalInfo['course_id'] == $item->id ?   'selected'  : '' ?>><?= $item->course_name ?> </option>
                                        <?php  }  ?>
                                        </select>


                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Application Fees<span class="text-danger">*</span></b>
                                        <input type="text" id="applicationfee" readonly name="application_fee" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['application_fees']  : '' ?>" placeholder="">
                                    </div>
                                </div>


                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">First Name<span class="text-danger">*</span></b>
                                        <input type="text" name="first_name" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['first_name']  : '' ?>" placeholder="First Name">
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Middle Name</b>
                                        <input type="text" name="middle_name" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['middle_name']  : '' ?>" placeholder="Middle Name">
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Last Name</b>
                                        <input type="text" name="last_name" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['last_name']  : '' ?>" placeholder="Last Name">
                                    </div>
                                </div>


                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Gender <span class="text-danger">*</span></b> <br>
                                        <select class="form-control select2 select2-with-search" name="gender">
                                            <option value="">--select--</option>
                                            <option value="Male" <?= isset($personalInfo) && $personalInfo['gender'] == 'Male' ?   'selected'  : '' ?>>Male</option>
                                            <option value="Female" <?= isset($personalInfo) && $personalInfo['gender'] == 'Female' ?   'selected'  : '' ?>>Female</option>
                                            <option value="Third Gender" <?= isset($personalInfo) && $personalInfo['gender'] == 'Third Gender' ?   'selected'  : '' ?>>Third Gender</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Date Of Birth<span class="text-danger">*</span></b>
                                        <input type="date" name="dob" id="dob" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['dob']  : '' ?>" placeholder="dd/mm/yyyy">
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Photo<span class="text-danger">*</span></b>
                                        <?= $personalInfo['image_url'] ? '<a class="ti-eye ml-2 text-info" target="_blank" href="' . $personalInfo['image_url'] . '" style="font-size: 22px;"></a>' : '' ?>
                                        <input type="file" name="photo" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['image_url']  : '' ?>" placeholder=" Landline Number">
                                        <input type="hidden" name="oldPhoto" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['image_url']  : '' ?>" placeholder=" Landline Number">
                                    </div>
                                </div>

                                <div class="col-md-12 ">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Residential Address<span class="text-danger">*</span></b>
                                        <textarea name="communication_address" id="communication_address" autocomplete="off" class="form-control" placeholder=""><?= isset($personalInfo) ?   $personalInfo['communication_address']  : '' ?></textarea>
                                    </div>
                                </div>

                                <div class="col-md-3 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Country  <span class="text-danger">*</span></b> <br>
                                        <select class="form-control select2-with-search" name="country_code">
                                            <option value="">--select--</option>
                                            <?php foreach ($countries as $item) {?>
                                        <option value="<?= $item->name  ?>" <?= isset($personalInfo) && $personalInfo['name'] == $item->name ?   'selected'  : '' ?>><?= $item->name ?> </option>
                                        <?php  }  ?>
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-3 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">State  <span class="text-danger">*</span></b> <br>
                                        <select class="form-control select2-with-search" name="country_code">
                                            <option value="">--select--</option>
                                            <?php foreach ($states as $item) {?>
                                        <option value="<?= $item->name  ?>" <?= isset($personalInfo) && $personalInfo['name'] == $item->name ?   'selected'  : '' ?>><?= $item->name ?> </option>
                                        <?php  }  ?>
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-3 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">City  <span class="text-danger">*</span></b> <br>
                                        <select class="form-control select2-with-search" name="country_code">
                                            <option value="">--select--</option>
                                            <?php foreach ($cities as $item) {?>
                                        <option value="<?= $item->name  ?>" <?= isset($personalInfo) && $personalInfo['name'] == $item->name ?   'selected'  : '' ?>><?= $item->name ?> </option>
                                        <?php  }  ?>
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-3 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Pincode <span class="text-danger">*</span></b> <br>
                                        <input type="number" name="pincode" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['pincode']  : $userDetails['pincode'] ?>"  placeholder="Enter Pincode">
                                    </div>
                                </div>

                                <div class="col-md-4 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Landline (optional)<span class="text-danger"></span></b>
                                        <input type="number" name="landline" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['landline']  :'' ?>" placeholder=" Landline Number">
                                    </div>
                                </div>

                                <div class="col-md-4 mt-3">
                                    <div class="form-group mobile">Mobile Number (Country Code)<span class="text-danger">*</span></b>
                                        <input type="number" name="mobile" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['mobile']  : $userDetails['mobile'] ?>"  placeholder="Enter Mobile">
                                        <span class="text-danger mobile_error"></span>
                                    </div>
                                </div>

                                <div class="col-md-4 mt-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Email<span class="text-danger">*</span></b>
                                        <input type="email" name="email" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['email']  : $userDetails['email'] ?>" placeholder="Enter Email Id">
                                        <span class="text-danger email_error"></span>
                                    </div>
                                </div>
                            </div>

                            <div class="col mt-3 mb-3 d-flex justify-content-between" >
                                <div></div>
                                <div>
                                    <!-- <button type="button" class="btn btn-primary next-button" onclick="draftFunction('applicationForm1','draftVal1')">Save Draft</button> -->
                                    <button type="button" id="nextBtn1" class="btn btn-secondary next-button save1" onclick="submitForm1()" >Save & Next </button>
                                </div>
                            </div>
                        </form>
                       
                    </div>

                    <div class="tab-pane  fade" id="second">
                        <form id="applicationForm2" method="POST" action="<?php echo base_url(); ?>ApplicationController/addApplication2" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <input type="hidden" name="applicationId" value="<?= isset($personalInfo) ?   $personalInfo['id']  : '' ?>">
                                        <input type="hidden" name="parentId" value="<?= isset($parentInfo) ?   $parentInfo['id']  : '' ?>">
                                        <input type="hidden" name="draft" class="draftVal2" value="1"> 
                                        <input type="hidden" name="tab_status" class="tab_statusVal2" value="0"> 

                                        <b><span class="mg-b-10">Father Name / Guardian<span class="text-danger"></span></b>
                                        <input type="text" name="father_name" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_name']  : '' ?>" placeholder=" Father Name">

                                    </div>
                                </div>


                                <div class="col-md-6 pb-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Occupation<span class="text-danger"></span></b>
                                        <input type="text" name="father_occupation" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_occupation']  : '' ?>" placeholder="Father's Occupation">

                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <h4>Father's Home Information</h4>
                                </div>


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Address<span class="text-danger"></span></b>

                                        <!-- <textarea name="communication_address" id="communication_address" autocomplete="off" class="form-control" placeholder=""></textarea> -->

                                        <textarea name="father_home_address" id="father_home_address" autocomplete="off" class="form-control" placeholder=""><?= isset($parentInfo) ?   $parentInfo['father_home_address']  : '' ?></textarea>
                               

                                </div>
                            </div>
                            </div>
                            <div class="row mt-3">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Landline (optional)<span class="text-danger"></span></b>
                                        <input type="number" name="father_home_landline" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_home_landline']  : '' ?>" placeholder=" Landline Number">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">Mobile Number (Country Code)<span class="text-danger"></span></b>
                                        <input type="number" name="father_home_mobile" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_home_mobile']  : '' ?>" placeholder=" Mobile">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Email<span class="text-danger"></span></b>
                                        <input type="email" name="father_home_email" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_home_email']  : '' ?>" placeholder=" Email Id">

                                    </div>
                                </div>
                            </div>


                            <div class="row mt-3 ">
                                <div class="col-md-12">
                                    <h4>Office Information</h4>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Address<span class="text-danger"></span></b>
                                        <textarea name="father_office_address" autocomplete="off" class="form-control" placeholder=""><?= isset($parentInfo) ?   $parentInfo['father_office_address']  : '' ?></textarea>

                                    </div>
                                </div>

                                <!-- <div class="col-md-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Country Code <span class="text-danger"></span></b> <br>
                                        <select class="form-control select2-with-search" name="father_office_country_code">
                                            <option value="">--select--</option>
                                            <option value="101">101</option>

                                        </select>

                                    </div>

                                </div> -->
                            </div>
                                          

                            <div class="row mt-3">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Landline (optional)<span class="text-danger"></span></b>
                                        <input type="number" name="father_office_landline" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_office_landline']  : '' ?>" placeholder=" Landline Number">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">Mobile Number (Country Code)<span class="text-danger"></span></b>
                                        <input type="number" name="father_office_mobile" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_office_mobile']  : '' ?>" placeholder=" Mobile">

                                    </div>
                                </div>
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Email<span class="text-danger"></span></b>
                                        <input type="email" name="father_office_email" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['father_office_email']  : '' ?>" placeholder=" Email Id"></input>

                                    </div>
                                </div>
                            </div>
                            <hr>
                            <h4>Mother Information</h4>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Mother's Name <span class="text-danger"></span></b>
                                        <input type="text" name="mother_name" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_name']  : '' ?>" placeholder=" Mother's Name">

                                    </div>
                                </div>


                                <div class="col-md-6 pb-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Occupation<span class="text-danger"></span></b>
                                        <input type="text" name="mother_occupation" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_occupation']  : '' ?>" placeholder="Mother's Occupation">

                                    </div>
                                </div><br>
                            </div>
                            <div class="row">
                                <div class="col-12">
                                    <h4 class="">Mother's Home Information</h4>
                                </div>
                                <div class="col ps-2">
                                    <input type="checkbox" id="addressCheckbox" name="addressCheckbox" <?= isset($parentInfo) && $parentInfo['addressCheckbox'] == 1 ? 'checked' : '' ?>> <label class="ml-3 pl-3"> Home Address same as father's Home Information </label>
                                </div>
                            </div>

                            <div class="">
                                <div class="row">
                                    <div class="col-md-12 ">
                                    <b><span class="mg-b-10">Address<span class="text-danger"></span></b>

                                        <div class="form-group hiddenDiv">
                                            <textarea name="mother_home_addressss" autocomplete="off" class="form-control " placeholder=""><?= isset($parentInfo) ?   $parentInfo['mother_home_addressss']  : '' ?></textarea>
                                        </div>

                                        <div class="card-body border ps-2 hiddenDiv2 d-none">
                                                
                                        </div>
                                    </div>


                                    <!-- <div class="col-md-3">
                                        <div class="form-groHome Informationup">
                                            <b><span class="mg-b-10">Country Code <span class="text-danger"></span></b> <br>
                                            <select class="form-control select2-with-search" name="mother_home_country_code">
                                                <option value="">--select--</option>
                                                <option value="101">101</option>
                                            </select>
                                        </div>
                                    </div> -->
                                </div>
                            </div>


                            <div class="row mt-3">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Landline (optional)<span class="text-danger"></span></b>
                                        <input type="number" name="mother_home_land_line" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_home_land_line']  : '' ?>" placeholder=" Landline Number">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">Mobile Number (Country Code)<span class="text-danger"></span></b>
                                        <input type="number" name="mother_home_mobile" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_home_mobile']  : '' ?>" placeholder=" Mobile">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Email<span class="text-danger"></span></b>
                                        <input type="email" name="mother_home_email" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_home_email']  : '' ?>" placeholder=" Email Id">

                                    </div>
                                </div>
                            </div>

                          


                            <div class="row mt-3">
                                <div class="col-12">
                                    <h4>Office Information</h4>
                                </div>


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Address<span class="text-danger"></span></b>
                                        <textarea name="mother_office_address" autocomplete="off" class="form-control" placeholder=""><?= isset($parentInfo) ?   $parentInfo['mother_office_address']  : '' ?><?= isset($parentInfo) ?   $parentInfo['first_name']  : '' ?></textarea>

                                    </div>
                                </div>


                                <!-- <div class="col-md-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Country Code <span class="text-danger"></span></b> <br>
                                        <select class="form-control select2-with-search" name="mother_office_country_code">
                                            <option value="">--select--</option>
                                            <option value="101">101</option>

                                        </select>

                                    </div>

                                </div> -->

                            </div>

                            <div class="row mt-3">



                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Landline (optional)<span class="text-danger"></span></b>
                                        <input type="number" name="mother_office_land_line" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_office_land_line']  : '' ?>" placeholder=" Landline Number">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">Mobile Number (Country Code)<span class="text-danger"></span></b>
                                        <input type="number" name="mother_office_mobile" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_office_mobile']  : '' ?>" placeholder=" Mobile">

                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Email<span class="text-danger"></span></b>
                                        <input type="email" name="mother_office_email" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['mother_office_email']  : '' ?>" placeholder=" Email Id"></input>

                                    </div>
                                </div>
                            </div>
                            <hr>
                            <b class="mb-2">Annual family income from all sources</b>

                            <div class="row mb-2">
                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">In INR<span class="text-danger">*</span></b>
                                        <input type="number" name="annual_income_rs" autocomplete="off" class="form-control" onkeyup="convertNumberToWords(event)" value="<?= isset($parentInfo) ?   $parentInfo['annual_income_rs']  : '' ?>" placeholder="Annual family income In INR">
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Amount in words<span class="text-danger"></span></b>
                                        <input type="text" id="annual_income_words" readonly name="annual_income_words" autocomplete="off" class="form-control" value="<?= isset($parentInfo) ?   $parentInfo['annual_income_words']  : '' ?>" placeholder=" Amount in words">
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Do you intend to apply scholarship?<span class="text-danger"></span></b>
                                        <select class="form-control select2-with-search" name="apply_scholarship" id="scholarship">
                                            {{-- <option value="">--select--</option> --}}
                                            <option value="0" <?= $personalInfo['apply_scholarship'] == 0 ? 'selected'  : '' ?>>No</option>
                                            <option value="1" <?= $personalInfo['apply_scholarship'] == 1 ? 'selected'  : '' ?>>Yes</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="row mt-3 mb-2" style="display:none" id="s_file">
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Community Certificate<span class="text-danger"></span></b>
                                        <?= $personalInfo['community_certificate'] ? '<a class="ti-eye ml-2 text-info" target="_blank" href="' . $personalInfo['community_certificate'] . '" style="font-size: 22px;"></a>' : '' ?>
                                        <input type="file" name="community_certificate" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['community_certificate']  : '' ?>">
                                        <input type="hidden" name="oldCommunity" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['community_certificate']  : '' ?>" placeholder=" Landline Number">

                                    </div>
                                </div>



                                <div class="col-md-3">
                                    <div class="form-group">
                                        <b><span class="mg-b-10">Income Certificate<span class="text-danger"></span></b>
                                        <?= $personalInfo['income_certificate'] ? '<a class="ti-eye ml-2 text-info" target="_blank" href="' . $personalInfo['income_certificate'] . '" style="font-size: 22px;"></a>' : '' ?>
                                        <input type="file" name="income_certificate" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['income_certificate']  : '' ?>">
                                        <input type="hidden" name="oldIncome" autocomplete="off" class="form-control" value="<?= isset($personalInfo) ?   $personalInfo['income_certificate']  : '' ?>" placeholder=" Landline Number">
                                    </div>

                                </div>

                            </div>

                            <div class="row d-flex justify-content-end">

                                <!-- <ul class="list-inline wizard mb-0 d-flex justify-content-between gap-2"> -->
                                <ul class="list-inline wizard mb-0 ">
                                    
                                    <div>
                                        <!-- <li class="next list-inline-item float-end">
                                            <a href="#" id="draft_button" class="btn btn-primary mr-2" onclick="draftFunction('applicationForm2','draftVal2')">Save as Draft</a>
                                        </li> -->
                                        <li class="next list-inline-item float-end mr-2">
                                            <button type="button" href="#" class="btn btn-secondary" id="nextBtn" onclick="submitFormCommon('applicationForm2','tab_statusVal2')">Save & Next</a>
                                        </li>
                                    </div>
                                </ul>
                            </div>
                        </form>
                    </div>

                    <div class="tab-pane fade" id="third">
                        <!-- <form id="otherForm" method="post" action="#" class="form-horizontal"> -->
                            <div class="row">
                                <div class="col-12">


                                    <div class="tab-pane" id="basictab3">

                                        <h3>Education</h3><b>(Start with last College/University attended)</b>
                                        <form id="applicationForm3" method="POST" action="<?php echo base_url(); ?>ApplicationController/addApplication3" enctype="multipart/form-data">
                                            
                                        <input type="hidden" name="applicationId" value="<?= $personalInfo['id'] ?>">

                                        <input type="hidden" name="draft" class="draftVal3" value="1"> 
                                        <input type="hidden" name="tab_status" class="tab_statusVal3" value="0"> 

                                        <!-- <div class="row">
                                                            <div class="col-md-1"></div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Institution<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Year<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Subjects<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Degree<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Marks / Grade<span class="text-danger"></span></b> </div>
                                                        </div> -->

                                        <?php if(empty($educationInfo)) { ?>
                                            <div class="row mt-3">
                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10">Institution<span class="text-danger"></span></b>
                                                        <input type="text" name="education_institution[]" autocomplete="off" class="form-control" placeholder="Insititute 1">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10">Year<span class="text-danger"></span></b>
                                                        <input type="text" name="education_year[]" autocomplete="off" class="form-control" placeholder=" Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10">Subjects<span class="text-danger"></span></b>
                                                        <input type="text" name="education_subject[]" autocomplete="off" class="form-control" placeholder=" Subject">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10">Degree<span class="text-danger"></span></b>
                                                        <input type="text" name="education_degree[]" autocomplete="off" class="form-control" placeholder=" Degree">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10">Marks / Grade<span class="text-danger"></span></b>
                                                        <input type="text" name="education_marks[]" autocomplete="off" class="form-control" placeholder=" Mark/Grade">

                                                    </div>

                                                </div>
                                            </div>




                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_institution[]" autocomplete="off" class="form-control" placeholder="Insititute 2">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_year[]" autocomplete="off" class="form-control" placeholder=" Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_subject[]" autocomplete="off" class="form-control" placeholder=" Subject">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_degree[]" autocomplete="off" class="form-control" placeholder=" Degree">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_marks[]" autocomplete="off" class="form-control" placeholder=" Mark/Grade">

                                                    </div>

                                                </div>

                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_institution[]" autocomplete="off" class="form-control" placeholder="Insititute 3">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_year[]" autocomplete="off" class="form-control" placeholder=" Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_subject[]" autocomplete="off" class="form-control" placeholder=" Subject">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_degree[]" autocomplete="off" class="form-control" placeholder=" Degree">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="education_marks[]" autocomplete="off" class="form-control" placeholder=" Mark/Grade">

                                                    </div>

                                                </div>


                                            </div>

                                            <?php }else{
                                                foreach($educationInfo as $info){
                                                    if($info->education_institution){
                                                    ?>

                                                    <div class="row mt-3">
                                                    <input type="hidden" name="educationInstitutionChildId[]" value="<?= $info->id?>" id="childId">

                                                    <div class="col-md-1">
                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">

                                                            <input type="text" name="education_institution[]" value="<?=  $info->education_institution ? $info->education_institution : ''?>" autocomplete="off" class="form-control" placeholder="Insititute 1">
                                                          
                                                            
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">

                                                            <input type="text" name="education_year[]" value="<?=  $info->education_year ? $info->education_year : ''?>" autocomplete="off" class="form-control" placeholder=" Year">
                                                           
                                                            
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">

                                                            <input type="text" name="education_subject[]" value="<?=  $info->education_subject ? $info->education_subject : ''?>" autocomplete="off" class="form-control" placeholder=" Subject">
                                                          
                                                            
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">

                                                            <input type="text" name="education_degree[]" value="<?=  $info->education_degree ? $info->education_degree : ''?>" autocomplete="off" class="form-control" placeholder=" Degree">
                                                        
                                                            
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">

                                                            <input type="text" name="education_marks[]" value="<?=  $info->education_marks ? $info->education_marks : ''?>" autocomplete="off" class="form-control" placeholder=" Mark/Grade">
                                                          
                                                            
                                                        </div>

                                                    </div>

                                                </div>

                                            <?php
                                                      }
                                                    }
                                                }
                                            
                                            ?>
                                            <HR>


                                            <h3>High School</h3>

                                            <!-- <div class="row mt-2">
                                                            <div class="col-md-1"></div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">School Name <span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b> <span class="mg-b-10">Year of Passing  <span class="text-danger"></span></b></div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Board<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Marks / Grades<span class="text-danger"></span></b> </div>
                                                        </div> -->

                                            <?php if(empty($educationInfo)) { ?>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_name[]" autocomplete="off" class="form-control" placeholder=" School Name">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_year[]" autocomplete="off" class="form-control" placeholder=" Year of Passing ">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="educational_boards[]" autocomplete="off" class="form-control" placeholder="Board (ex:CBSE)">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_marks[]" autocomplete="off" class="form-control" placeholder=" Marks/Grades">

                                                    </div>

                                                </div>

                                            </div>

                                            
                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_name[]" autocomplete="off" class="form-control" placeholder=" School Name">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_year[]" autocomplete="off" class="form-control" placeholder=" Year of Passing ">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="educational_boards[]" autocomplete="off" class="form-control" placeholder=" Board (ex:CBSE)">

                                                    </div>

                                                </div>

                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_marks[]" autocomplete="off" class="form-control" placeholder=" Marks/Grades">

                                                    </div>

                                                </div>

                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_name[]" autocomplete="off" class="form-control" placeholder=" School Name">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_year[]" autocomplete="off" class="form-control" placeholder=" Year of Passing ">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="educational_boards[]" autocomplete="off" class="form-control" placeholder="Board (ex:CBSE)">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="high_school_marks[]" autocomplete="off" class="form-control" placeholder=" Marks/Grades">

                                                    </div>

                                                </div>

                                            </div>

                                            <?php }else{
                                                foreach($educationInfo as $info){
                                                    if($info->high_school_name){
                                            ?>


<div class="row mt-2">
                                                            <input type="hidden" name="highSchoolChild[]" value="<?=$info->id ?>">
                                                            <div class="col-md-1">

                                                            </div>
                                                            <div class="col-md-3">
                                                                <div class="form-group">
                                                                    <input type="text" name="high_school_name[]" value="<?= $info->high_school_name ? $info->high_school_name : '' ?>" autocomplete="off" class="form-control" placeholder=" School Name">
                                                                  
                                                                </div>

                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">

                                                                    <input type="text" name="high_school_year[]" value="<?= $info->high_school_year ? $info->high_school_year : '' ?>" autocomplete="off" class="form-control" placeholder=" Year of Passing ">
                                                                    
                                                                </div>

                                                            </div>
                                                            <div class="col-md-3">
                                                                <div class="form-group">
                                                                    <input type="text" name="educational_boards[]" value="<?= $info->educational_boards ? $info->educational_boards : '' ?>" autocomplete="off" class="form-control" placeholder="Board (ex:CBSE)">
                                                                   
                                                                </div>

                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <input type="text" name="high_school_marks[]" value="<?= $info->high_school_marks ? $info->high_school_marks : '' ?>" autocomplete="off" class="form-control" placeholder=" Marks/Grades">
                                                                  
                                                                </div>

                                                            </div>
                                                            <div class="col-md-1">
                                                            </div>
                                                        </div>
                                            <?php
                                                      }
                                                    }
                                                }
                                            
                                            ?>
                                            <hr>




                                            <h3>Other Educational Qualifications</h3><b>(computers, languages, cultural, music education etc)</b>


                                            <!-- <div class="row">
                                                            <div class="col-md-1"></div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Institution <span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b> <span class="mg-b-10">Year <span class="text-danger"></span></b></div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Subject<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Certificate<span class="text-danger"></span></b> </div>
                                                            <div class="col-md-2"><b><span class="mg-b-10">Award<span class="text-danger"></span></b> </div>
                                                        </div> -->

                                             <?php if(empty($educationInfo)) { ?>
                                                        
                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Institution<span class="text-danger"></span></b>
                                                        <input type="text" name="other_education_institution[]" autocomplete="off" class="form-control" placeholder="Institution 1">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Year<span class="text-danger"></span></b>
                                                        <input type="text" name="other_education_year[]" autocomplete="off" class="form-control" placeholder="  Year of Passing ">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Subject<span class="text-danger"></span></b>
                                                        <input type="text" name="other_education_subject[]" autocomplete="off" class="form-control" placeholder="  Subject">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Certificate<span class="text-danger"></span></b>
                                                        <input type="text" name="other_education_certificate[]" autocomplete="off" class="form-control" placeholder="  Certificate">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Award<span class="text-danger"></span></b>
                                                        <input type="text" name="other_education_award[]" autocomplete="off" class="form-control" placeholder="  Award">

                                                    </div>

                                                </div>

                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_institution[]" autocomplete="off" class="form-control" placeholder="Institution 2">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_year[]" autocomplete="off" class="form-control" placeholder="  Year of Passing ">
                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_subject[]" autocomplete="off" class="form-control" placeholder="  Subject">
                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_certificate[]" autocomplete="off" class="form-control" placeholder="  Certificate">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_award[]" autocomplete="off" class="form-control" placeholder="  Award">

                                                    </div>

                                                </div>

                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_institution[]" autocomplete="off" class="form-control" placeholder="Institution 3">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_year[]" autocomplete="off" class="form-control" placeholder="  Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_subject[]" autocomplete="off" class="form-control" placeholder="  Subject">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_certificate[]" autocomplete="off" class="form-control" placeholder="  Certificate">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="other_education_award[]" autocomplete="off" class="form-control" placeholder="  Award">

                                                    </div>

                                                </div>


                                            </div>






                                            <?php }else{
                                                foreach($educationInfo as $info){
                                                    if($info->other_education_institution){
                                            ?>




                                                        <div class="row mt-3">
                                                            <input type="hidden" name="otherEducationChild[]" value="<?=$info->id ?>">
                                                            <div class="col-md-1">
                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <input type="text" name="other_education_institution[]" value="<?= $info->other_education_institution ? $info->other_education_institution : '' ?>" autocomplete="off" class="form-control" placeholder="Institution 1">
                                                                </div>
                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <input type="text" name="other_education_year[]" value="<?= $info->other_education_year ? $info->other_education_year : '' ?>" autocomplete="off" class="form-control" placeholder="  Year">
                                                                </div>
                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <input type="text" name="other_education_subject[]" value="<?= $info->other_education_subject ? $info->other_education_subject : '' ?>" autocomplete="off" class="form-control" placeholder="  Subject">
                                                                </div>

                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <b><span class="mg-b-10"> <span class="text-danger"></span></b>
                                                                    <input type="text" name="other_education_certificate[]" value="<?= $info->other_education_certificate ? $info->other_education_certificate : '' ?>" autocomplete="off" class="form-control" placeholder="  Certificate">
                                                                </div>

                                                            </div>
                                                            <div class="col-md-2">
                                                                <div class="form-group">
                                                                    <input type="text" name="other_education_award[]" value="<?= $info->other_education_award ? $info->other_education_award : '' ?>" autocomplete="off" class="form-control" placeholder="  Award">
                                                                </div>
                                                            </div>
                                                        </div>
                                            <?php 
                                                    }
                                                }
                                            } 
                                            ?>

<div class="row">
                                                <div class="col-md-1 mt-3">

                                                </div>
                                                <div class="col-md-10 mt-3">
                                                    <label for="mediaProfessional1">Academic distinctions/awards, if any</label>
                                                    <textarea class="form-control" name="academic_awards" id="academic_awards" cols="35">aa<?= isset($personalInfo) ?   $personalInfo['academic_awards']  : '' ?></textarea>
                                                </div>

                                            </div>
                                            <div class="row">

                                                <div class="col-md-1 mt-3">

                                                </div>
                                                <div class="col-md-10 mt-3">
                                                    <label for="mediaProfessional2">Extracurricular interests, hobbies, sports, etc</label>
                                                    <textarea class="form-control" name="extracurricular" id="extracurricular" cols="35"><?= isset($personalInfo) ?   $personalInfo['extracurricular']  : '' ?></textarea>
                                                </div>
                                            </div>

                                            <hr>

                                            <h3>Work experience, if any</h3><b>(including part-time)</b>

                                            <!-- <div class="row">
                                                <div class="col-md-1"></div>
                                                <div class="col-md-3"><b><span class="mg-b-10">Organisation<span class="text-danger"></span></b> </div>
                                                <div class="col-md-2"><b> <span class="mg-b-10">Year <span class="text-danger"></span></b></div>
                                                <div class="col-md-2"><b><span class="mg-b-10">Title<span class="text-danger"></span></b> </div>
                                                <div class="col-md-2"><b><span class="mg-b-10">Responsbilities<span class="text-danger"></span></b> </div>
                                            </div> -->
                                            <?php if(empty($educationInfo)) { ?>
                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>

                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Organisation<span class="text-danger"></span></b>
                                                        <input type="text" name="worked_organisation[]" autocomplete="off" class="form-control" placeholder="  Organisation">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Year<span class="text-danger"></span></b>
                                                        <input type="text" name="worked_year[]" autocomplete="off" class="form-control" placeholder="  Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Title<span class="text-danger"></span></b>
                                                        <input type="text" name="worked_title[]" autocomplete="off" class="form-control" placeholder="  Title">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <b><span class="mg-b-10"> Responsbilities<span class="text-danger"></span></b>
                                                        <input type="text" name="worked_responsibilities[]" autocomplete="off" class="form-control" placeholder="  Responsbilities">

                                                    </div>

                                                </div>


                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>

                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_organisation[]" autocomplete="off" class="form-control" placeholder="  Organisation">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_year[]" autocomplete="off" class="form-control" placeholder="  Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_title[]" autocomplete="off" class="form-control" placeholder="  Title">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_responsibilities[]" autocomplete="off" class="form-control" placeholder="  Responsbilities">

                                                    </div>

                                                </div>


                                            </div>

                                            <div class="row mt-3">

                                                <div class="col-md-1">
                                                </div>

                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_organisation[]" autocomplete="off" class="form-control" placeholder="  Organisation">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_year[]" autocomplete="off" class="form-control" placeholder="  Year">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_title[]" autocomplete="off" class="form-control" placeholder="  Title">

                                                    </div>

                                                </div>
                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <input type="text" name="worked_responsibilities[]" autocomplete="off" class="form-control" placeholder="  Responsbilities">
                                                    </div>
                                                </div>
                                            </div>

                                            <?php }else{
                                                $workedCount = 0;
                                                foreach($educationInfo as $info){
                                                    if($info->worked_organisation){
                                            ?>


                                                <div class="row mt-3">

                                                    <input type="hidden" name="workedChild[]" value="<?=$info->id?>">

                                                    <div class="col-md-1">
                                                    </div>

                                                    <div class="col-md-3">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_organisation[]" value="<?= $info->worked_organisation ? $info->worked_organisation : ''?>" autocomplete="off" class="form-control" placeholder="  Organisation">
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_year[]" value="<?= $info->worked_year ? $info->worked_year : ''?>" autocomplete="off" class="form-control" placeholder="  Year">
                                                        </div>

                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_title[]" value="<?= $info->worked_title ? $info->worked_title : ''?>" autocomplete="off" class="form-control" placeholder="  Title">
                                                        </div>

                                                    </div>
                                                    <div class="col-md-3">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_responsibilities[]" value="<?= $info->worked_responsibilities ? $info->worked_responsibilities : ''?>" autocomplete="off" class="form-control" placeholder="  Responsbilities">
                                                        </div>
                                                    </div>
                                                    </div>




                                            <?php 
                                            $workedCount++;
                                                    }
                                                }

                                                for($i=$workedCount; $i<3;$i++){
                                                    ?>
                                                    <div class="row mt-3">

                                                    <div class="col-md-1">
                                                    </div>
    
                                                    <div class="col-md-3">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_organisation[]" autocomplete="off" class="form-control" placeholder="  Organisation">
    
                                                        </div>
    
                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_year[]" autocomplete="off" class="form-control" placeholder="  Year">
    
                                                        </div>
    
                                                    </div>
                                                    <div class="col-md-2">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_title[]" autocomplete="off" class="form-control" placeholder="  Title">
    
                                                        </div>
    
                                                    </div>
                                                    <div class="col-md-3">
                                                        <div class="form-group">
                                                            <input type="text" name="worked_responsibilities[]" autocomplete="off" class="form-control" placeholder="  Responsbilities">
                                                        </div>
                                                    </div>
                                                </div>
                                                <?php
                                                }
                                            } 
                                            ?>



                                            <div class="row d-flex justify-content-end">

                                                <ul class="list-inline wizard mb-0">                                                   
                                                    <!-- <li class="next list-inline-item float-end">
                                                        <a href="#" id="draft_button" class="btn btn-primary mr-2" onclick="draftFunction('applicationForm3','draftVal3')">Save as Draft</a>
                                                    </li> -->
                                                    <li class="next list-inline-item float-end mr-2">
                                                        <button type="button" href="#" class="btn btn-secondary" id="nextBtn" onclick="submitFormCommon('applicationForm3','tab_statusVal3')">Save & Next</button>
                                                    </li>
                                                </ul>

                                            </div>


                                        </form>

                                    </div>
                                </div>
                                <!-- end col -->
                            </div>
                            <!-- end row -->
                        <!-- </form> -->
                    </div>


                    <div class="tab-pane fade" id="fourth">
                        <!-- <form id="otherForm" method="post" action="#" class="form-horizontal"> -->
                            <div class="row">
                                <div class="col-12">
                                    <div class="tab-pane" id="basictab4">
                                        <form id="applicationForm4" method="POST" action="<?php echo base_url(); ?>ApplicationController/addApplication4" enctype="multipart/form-data">
                                           
                                            <div class="row">
                                                <div class="col-md-12 mt-3">
                                                    <input type="hidden" name="applicationId" value="<?= (isset($personalInfo) ? $personalInfo['id'] : '') ?>">
                                                    <input type="hidden" name="otherId" value="<?= (isset($otherInfo) ? $otherInfo['id'] : '') ?>">

                                                    <input type="hidden" name="draft" class="draftVal4" value="1"> 
                                                    <input type="hidden" name="tab_status" class="tab_statusVal4" value="0"> 

                                                    <label for="mediaProfessional1">Name three leading media professionals and explain in a sentence or two, why they have impressed you:</label>
                                                    <textarea class="form-control" name="media_professionals" id="media_professionals" cols="35"><?= (isset($otherInfo) ? $otherInfo['media_professionals'] : '') ?> </textarea>
                                                </div>
                                                <div class="col-md-12 mt-4">
                                                    <label for="mediaProfessional2">Has any of your work been published/broadcast/podcast? If yes, specify:</label>
                                                    <textarea class="form-control" name="broadcast_podcast" id="broadcast_podcast"><?= (isset($otherInfo) ? $otherInfo['broadcast_podcast'] : '') ?></textarea>
                                                </div>
                                                <div class="col-md-12 mt-4 mb-3">
                                                    <label for="mediaProfessional3">Tell us in 100 words why you wish to be a journalist and why you think you will be good at it :</label>
                                                    <textarea class="form-control" name="journalist_reason" id="journalist_reason"><?= (isset($otherInfo) ? $otherInfo['journalist_reason'] : '') ?></textarea>
                                                </div>
                                            </div>

                                            <div class="row d-flex justify-content-end">

                                                <ul class="list-inline wizard mb-0">
                                                <!-- <li class="next list-inline-item float-end">
                                                        <a href="#" id="draft_button" class="btn btn-primary mr-2"  onclick="draftFunction('applicationForm4','draftVal4')">Save as Draft</a>
                                                    </li> -->
                                                    <li class="next list-inline-item float-end mr-2">
                                                    <button type="button" id="nextBtn" class="btn btn-secondary next-button"  onclick="submitFormCommon('applicationForm4','tab_statusVal4')">Save & Next </button>

                                                        <!-- <button type="submit" class="btn btn-secondary">Save & Next</button> -->
                                                    </li>
                                                   

                                                </ul>

                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <!-- end col -->
                            </div>
                            <!-- end row -->
                        <!-- </form> -->
                    </div>

                    <div class="tab-pane fade" id="fifth">
                        <!-- <form id="otherForm" method="post" action="#" class="form-horizontal"> -->
                            <div class="row">
                                <div class="col-12">
                                    <div class="tab-pane" id="basictab5">
                                        <form id="applicationForm5" method="POST" action="<?php echo base_url(); ?>ApplicationController/addApplication5" enctype="multipart/form-data">
                                         
                                            <div class="row">

                                                <input type="hidden" name="applicationId" value="<?= (isset($personalInfo) ? $personalInfo['id'] : '') ?>">
                                                <input type="hidden" name="accomodationId" value="<?= (isset($accomodation_info) ? $accomodation_info['id'] : '') ?>">

                                                <input type="hidden" name="draft" class="draftVal5" value="1"> 
                                                <input type="hidden" name="tab_status" class="tab_statusVal5" value="0"> 

                                                <div class="col-md-12"> <b>Will you need residential accommodation?</b> </div>
                                                <div class="col-md-12">(Residential accommodation for students in the programme on room sharing basis and food is available on the college campus or in the Residential Annexe.)</div>
                                                <div class="col-md-12 mb-3">
                                                    <div class="form-group col-5 mt-2">
                                                        <select class="form-control select2-with-search" name="residential_accommodation">
                                                            <option value="">--select--</option>
                                                            <option value="1" <?= (isset($accomodation_info) && $accomodation_info['residential_accommodation'] == 1 ? 'selected' : '') ?>>YES</option>
                                                            <option value="0" <?= (isset($accomodation_info) && $accomodation_info['residential_accommodation'] == 0 ? 'selected' : '') ?>>NO</option>
                                                        </select>

                                                        <span class="text-danger mt-1"></span>

                                                    </div>
                                                </div>
                                                
                                                <div class="my-2 p-3"><b>APPLICATION FEE</b></div>
                                                <div class="mb-3 p-3">The prescribed application fee of Rs 2360/- (inclusive of GST @ 18%) can be paid either as an online transfer or in the form of Demand Draft. Candidates applying for both programmes need to pay only one application fee.</div>
                                                <div class="row">
                                                    <div class="col-12 ps-3">
                                                        <div class="card p-3">
                                                            <div class="card-body border ps-4">
                                                                <div>SC/ST applicants are exempt from the application fee on production of their community certificates. If yes please upload the community certificate.</div>
                                                                <div class="p-3"><input type="radio" class="form-check-input p-2" name="application_fee_checked" value="1" <?= (isset($accomodation_info) && $accomodation_info['application_fee_checked'] == 1 ? 'checked' : '') ?>  onclick="toggleCardVisibility(event)" id="yes"> <label for="yes">Yes</label></div>
                                                                <div class="p-3"><input type="radio" class="form-check-input p-2" name="application_fee_checked" value="0" <?= (isset($accomodation_info) && $accomodation_info['application_fee_checked'] == 0 ? 'checked' : '') ?> onclick="toggleCardVisibility(event)" id="no"> <label for="no">No</label></div>
                                                            </div>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-12">
                                                        <div class="card1">
                                                            <div class="card-body border" id="myCard">
                                                                <div>Upload community certificate, if not uploaded already.</div>
                                                                <div class="my-2"><input name="community_certificate" value="" class="form-control" type="file"></div>

                                                                <span class="text-danger mt-1"></span>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="my-2"><b>PAYMENT MODE</b></div>

                                            <div class="row mb-3">
                                                <div class="col-6">
                                                    <div class="card-body border">
                                                        <div class="p-3">
                                                            <input type="radio" class="form-check-input mr-5 pr-5" name="payment_mode" <?= (isset($accomodation_info) && $accomodation_info['payment_mode'] == 1 ? 'checked' : '') ?> value=1 onclick="togglePaymentDiv(event)">
                                                            <label>Online</label>
                                                        </div>
                                                        <div class="p-3">
                                                            <input type="radio" class="form-check-input" name="payment_mode" <?= (isset($accomodation_info) && $accomodation_info['payment_mode'] == 0 ? 'checked' : '') ?> value=0 onclick="togglePaymentDiv(event)">
                                                            <label>Demand Draft</label>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-md-6">
                                                    <div class="card-body border" id="paymentDiv">
                                                        Payment should be made in the form of Demand Draft in favour of "Media Development Foundation", payable at Chennai with your reference number, full name and address written on the back of the DD. </div>

                                                </div>
                                            </div>
                                            <hr>
                                            <div class=" d-flex justify-content-between">
                                                <div class="">
                                                    <a href="<?php echo base_url(); ?>applicationController/preview" class="preview btn btn-sm btn-secondary border p-2" >Preview</a>
                                                </div>
                                                <div class=" border preview mb-3 ps-5">
                                                    <div class="mt-1 p-2 ">On submitting the application form you will receive an acknowledgement email.</div>
                                                </div>
                                            </div>

                                            <div class="row p-3">
                                                <input type="checkbox" id="self_certificationCheckbox" name="self_certification" <?= ($accomodation_info['self_certification'] == 1 ? 'checked' : '') ?>> <label class="ml-3 pl-3 mt-2"> &nbsp; I certify that the particulars given in the application.</label>

                                            </div>



                                            <input type="hidden" id="draft" name="draft" value="">

                                            <ul class="list-inline wizard mb-0">
                                                <!-- <li class="previous list-inline-item">
                                                        <a href="#" class="btn btn-secondary" id="prevBtn">Previous</a>
                                                    </li> -->



                                            </ul>
                                            <div class="form-group d-flex justify-content-end mt-5 ">
                                                <button type="submit" href="javascript:void(0)" class="btn btn-danger">Submit</button>
                                            </div>

                                        </form>
                                    </div>

                                </div>
                                <!-- end col -->
                            </div>
                            <!-- end row -->
                        <!-- </form> -->
                    </div>



                    <!-- <ul class="list-inline wizard mb-0">
                        <li class="previous list-inline-item disabled"><a href="javascript: void(0);" class="btn btn-secondary">Previous</a>
                        </li>
                        <li class="next list-inline-item float-end"><a href="javascript: void(0);" class="btn btn-secondary">Next</a></li>
                    </ul> -->

                </div> <!-- tab-content -->
            </div> <!-- end #rootwizard-->

        </div> <!-- end card-body -->
    </div>
</div>


<div class="modal fade" id="self_certificationModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title text-danger" id="exampleModalLongTitle">Alert</h3>

                </div>
                <div class="modal-body d-flex justify-content-center">
                <strong>Agree to</strong> 
                    "I certify that the particulars given in the application."
                                        </p>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal" onclick="closeModal('self_certificationModal')">Close</button>
                </div>
            </div>
        </div>
    </div>

<script>

    function draftFunction(formId, draftInputClass){

        $('.'+draftInputClass).val('0');
        
        if($('#'+formId).valid()){
            $('#' + formId).submit();

       }else{
        $('#' + formId).submit();
       }

    }


    document.addEventListener("DOMContentLoaded", function() {
            const applicationForm = document.querySelector('#applicationForm5');

            applicationForm.addEventListener('submit', function(event) {


                event.preventDefault();

                if ($('#self_certificationCheckbox').is(':checked')) {

                    $('.tab_statusVal5').val('1');

                    $('#applicationForm5').submit();

                } else {

                    $('#self_certificationModal').modal('show')

                }

            });
        });


        var form1Val = 0;


    function submitForm1(){
        
        $('.tab_statusVal1').val('1');

            if($('#applicationForm1').valid()){
                    $('#applicationForm1').submit();
            }

        }

        function submitFormCommon(formId,tabStatusClass){

            $('.'+tabStatusClass).val('1');
            $('#'+formId).submit();
        }





    
$(document).ready(function() {


    var form = $('form[id="applicationForm1"]');


    form.validate({
        rules: {
            mobile: {
                required: true,
                maxlength: 10
            },
            email:'required',
            country_code:'required',
            communication_address:'required',
            dob:'required',
            photo:{
                required: function() {
                    // Check if oldPhoto is empty and photo is empty
                    return $('#oldPhoto').val() == '' && $('#photo').val() == '';
                }
            },
            gender:'required',
            first_name:'required',
            application_fee:'required',
            course_id:'required',
        },
        messages: {
            mobile: {
                required: 'Mobile number is required',
                maxlength: 'Maximum 10 digits'
            },
            email:'Enter a valid email',
            country_code:'Country Code is required',
            communication_address:'Address is required',
            dob:'Date of Birth is required',
            gender:'Gender is required',
            first_name:'First Name is required',
            application_fee:'Application Fees is required',
            course_id:'Course Name is required',
        },
        errorPlacement: function(label, element) {
            label.addClass('mt-2 text-danger');
            if (element.hasClass('form-select') && element.next('.select2-container').length) {
                label.insertAfter(element.next('.select2-container'));
            } else {
                // Use append to insert the error message after the select element
                label.appendTo(element.parent());
            }
        },
        highlight: function(element, errorClass) {
            $(element).parent().addClass('has-danger small')
            $(element).addClass('form-control form-control-sm-danger')
        },
        unhighlight: function(element) {
            $(element).parent().removeClass('has-danger small')
            $(element).parent().removeClass('form-control form-control-sm-danger')
        },
        submitHandler: function(form) {
                form.submit();
        
        }
    });





    var form2 = $('form[id="applicationForm2"]');


    form2.validate({
        rules: {
            annual_income_rs:'required',
        },
        messages: {
            annual_income_rs:'Annual Income is required',
        },
        errorPlacement: function(label, element) {
            label.addClass('mt-2 text-danger');
            if (element.hasClass('form-select') && element.next('.select2-container').length) {
                label.insertAfter(element.next('.select2-container'));
            } else {
                // Use append to insert the error message after the select element
                label.appendTo(element.parent());
            }
        },
        highlight: function(element, errorClass) {
            $(element).parent().addClass('has-danger small')
            $(element).addClass('form-control form-control-sm-danger')
        },
        unhighlight: function(element) {
            $(element).parent().removeClass('has-danger small')
            $(element).parent().removeClass('form-control form-control-sm-danger')
        },
        submitHandler: function(form) {
                form.submit();
        
        }
    });

    
        });






  

function getCourse(event) {
            var id = event.target.value;

            if(id){
            var url = "<?php echo base_url(); ?>ApplicationController/getFees/" + id;
            $.ajax({
                type: 'GET',
                url: url,
                contentType: false,
                processData: false,
                success: function(data) {
                    $('#applicationfee').val(data)
                },
                error: function(data) {
                    console.log(data);
                }
            });
        }else{
            $('#applicationfee').val('')

        }
        }
    document.addEventListener('DOMContentLoaded', function() {
        const form = document.getElementById('stepForm');
        const steps = form.querySelectorAll('.step');
        const prevButtons = form.querySelectorAll('.prev');
        const nextButtons = form.querySelectorAll('.next');
        const submitButton = form.querySelector('.submit');
        const reviewName = document.getElementById('reviewName');
        const reviewEmail = document.getElementById('reviewEmail');

        let currentStep = 1;

        function showStep(step) {
            steps.forEach((stepElement) => {
                stepElement.style.display = 'none';
            });

            steps[step - 1].style.display = 'block';
        }

        function updateReview() {
            const name = form.querySelector('[name="name"]').value;
            const email = form.querySelector('[name="email"]').value;

            reviewName.textContent = name;
            reviewEmail.textContent = email;
        }

        function validateStep(step) {
            // Add your validation logic here
            if (step === 1) {
                const name = form.querySelector('[name="name"]').value;
                return name.trim() !== '';
            } else if (step === 2) {
                const email = form.querySelector('[name="email"]').value;
                return email.trim() !== '';
            }
            return true; // Default to true if no specific validation is needed
        }

        nextButtons.forEach((button) => {
            button.addEventListener('click', function() {
                if (validateStep(currentStep)) {
                    currentStep++;
                    showStep(currentStep);
                    if (currentStep === 3) {
                        updateReview();
                    }
                } else {
                    alert('Please fill in all required fields.');
                }
            });
        });

        prevButtons.forEach((button) => {
            button.addEventListener('click', function() {
                currentStep--;
                showStep(currentStep);
            });
        });

        submitButton.addEventListener('click', function() {
            // Add your final submission logic here
            alert('Form submitted successfully!');
        });

        showStep(currentStep);
    });


    $(document).ready(function() {


        //START OF EDIT HIDE AND SHOW 

        // mother address checkbox
        var addressCheck = '<?= $parentInfo['addressCheckbox'] ?>';
        if(addressCheck == 1){
            var fatherAddress =  '<?= $parentInfo['father_home_address'] ?>';

            $('.hiddenDiv').hide();
            $('.hiddenDiv2').removeClass('d-none');
            $('.hiddenDiv2').html(fatherAddress);
        }

  


        // apply scholorship div hide and show
        var certificateDiv = '<?= $personalInfo['apply_scholarship'] ?>';

        if(certificateDiv == 1){
            $('#s_file').show();
        }


                // application fee div hide and show
        var application_fee_checked = '<?= $personalInfo['application_fee_checked'] ?>';

        // alert(application_fee_checked)
        // if(application_fee_checked === 0 || application_fee_checked === '' ){
        //     $('#myCard').hide();
        // }


        // payment mode html change
        var payment = '<?= $accomodation_info['payment_mode'] ?> ';

        if(payment == 1){
            $('#paymentDiv').html("Online payment can be made using Internet Banking, Credit or Debit Cards.");
        }


        


        //END OF EDIT HIDE AND SHOW 





        $('#addressCheckbox').change(function() {
            // $('.hiddenDiv').toggle(!this.checked);
            if(this.checked){

                var fatherAddress = $('#father_home_address').val();
                // alert(fatherAddress)
                $('.hiddenDiv').hide();
                $('.hiddenDiv2').removeClass('d-none');
                $('.hiddenDiv2').html(fatherAddress);
            }else{
                $('.hiddenDiv').show();
                $('.hiddenDiv2').addClass('d-none');

            }
        });

        $('#scholarship').change(function() {

            if(this.value == 0){
                $('#s_file').hide();
            }else{
                $('#s_file').show();
            }
        });
    });






    function toggleCardVisibility(event) {
            // alert(event.target.value);
            var card1 = document.querySelector('#myCard');
            card1.style.display = event.target.value == '1' ? 'block' : 'none';
        }
function togglePaymentDiv(event) {
            var paymentDiv = document.getElementById("paymentDiv");
            if (event.target.value == 1) {
                $('#paymentDiv').html("Online payment can be made using Internet Banking, Credit or Debit Cards.");
            } else if (event.target.value == 0) {
                $('#paymentDiv').html("Payment should be made in the form of Demand Draft in favour of 'Media Development Foundation', payable at Chennai with your reference number, full name, and address written on the back of the DD.");
            }
        }





        function convertNumberToWords(event) {
            // alert(event.target.value)

            var amount = event.target.value;
    var words = new Array();
    words[0] = '';
    words[1] = 'One';
    words[2] = 'Two';
    words[3] = 'Three';
    words[4] = 'Four';
    words[5] = 'Five';
    words[6] = 'Six';
    words[7] = 'Seven';
    words[8] = 'Eight';
    words[9] = 'Nine';
    words[10] = 'Ten';
    words[11] = 'Eleven';
    words[12] = 'Twelve';
    words[13] = 'Thirteen';
    words[14] = 'Fourteen';
    words[15] = 'Fifteen';
    words[16] = 'Sixteen';
    words[17] = 'Seventeen';
    words[18] = 'Eighteen';
    words[19] = 'Nineteen';
    words[20] = 'Twenty';
    words[30] = 'Thirty';
    words[40] = 'Forty';
    words[50] = 'Fifty';
    words[60] = 'Sixty';
    words[70] = 'Seventy';
    words[80] = 'Eighty';
    words[90] = 'Ninety';
    amount = amount.toString();
    var atemp = amount.split(".");
    var number = atemp[0].split(",").join("");
    var n_length = number.length;
    var words_string = "";
    if (n_length <= 9) {
        var n_array = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
        var received_n_array = new Array();
        for (var i = 0; i < n_length; i++) {
            received_n_array[i] = number.substr(i, 1);
        }
        for (var i = 9 - n_length, j = 0; i < 9; i++, j++) {
            n_array[i] = received_n_array[j];
        }
        for (var i = 0, j = 1; i < 9; i++, j++) {
            if (i == 0 || i == 2 || i == 4 || i == 7) {
                if (n_array[i] == 1) {
                    n_array[j] = 10 + parseInt(n_array[j]);
                    n_array[i] = 0;
                }
            }
        }
        value = "";
        for (var i = 0; i < 9; i++) {
            if (i == 0 || i == 2 || i == 4 || i == 7) {
                value = n_array[i] * 10;
            } else {
                value = n_array[i];
            }
            if (value != 0) {
                words_string += words[value] + " ";
            }
            if ((i == 1 && value != 0) || (i == 0 && value != 0 && n_array[i + 1] == 0)) {
                words_string += "Crores ";
            }
            if ((i == 3 && value != 0) || (i == 2 && value != 0 && n_array[i + 1] == 0)) {
                words_string += "Lakhs ";
            }
            if ((i == 5 && value != 0) || (i == 4 && value != 0 && n_array[i + 1] == 0)) {
                words_string += "Thousand ";
            }
            if (i == 6 && value != 0 && (n_array[i + 1] != 0 && n_array[i + 2] != 0)) {
                words_string += "Hundred and ";
            } else if (i == 6 && value != 0) {
                words_string += "Hundred ";
            }
        }
        words_string = words_string.split("  ").join(" ");
    }
    $("#annual_income_words").val(words_string);
}





            $(document).ready(function() {

                <?php foreach($educationInfo as $info){
                    $educationTabStatus = $info->tab_status;
                } ?>

                var applicationTabStatus    = '<?= $personalInfo['tab_status'] ?>';
                var parentTabStatus         = '<?= $parentInfo['tab_status'] ?>';

                var educationTabStatus      = '<?= $educationTabStatus ?>';

                var otherTabStatus          = '<?= $otherInfo['tab_status'] ?>';
                var accomodationTabStatus   = '<?= $accomodation_info['tab_status'] ?>';

                if(applicationTabStatus == 0){

                }else if(parentTabStatus == 0){
                    $('#firstHeader').removeClass('active');
                    $('#secondHeader').addClass('active');

                    $('#first').removeClass('active show');
                    $('#second').addClass('active show');
                }else if(educationTabStatus == 0){
                    $('#firstHeader').removeClass('active');
                    $('#thirdHeader').addClass('active');

                    $('#first').removeClass('active show');
                    $('#third').addClass('active show');
                }else if(otherTabStatus == 0){
                    $('#firstHeader').removeClass('active');
                    $('#fourthHeader').addClass('active');

                    $('#first').removeClass('active show');
                    $('#fourth').addClass('active show');
                }else if(accomodationTabStatus == 0 || accomodationTabStatus == 1){
                    $('#firstHeader').removeClass('active');
                    $('#fifthHeader').addClass('active');

                    $('#first').removeClass('active show');
                    $('#fifth').addClass('active show');

                    $('#firstHeader').attr({
                        'data-bs-toggle': 'tab',
                        'data-toggle': 'tab'
                    });

                    $('#secondHeader').attr({
                        'data-bs-toggle': 'tab',
                        'data-toggle': 'tab'
                    });

                    $('#thirdHeader').attr({
                        'data-bs-toggle': 'tab',
                        'data-toggle': 'tab'
                    });

                    $('#fourthHeader').attr({
                        'data-bs-toggle': 'tab',
                        'data-toggle': 'tab'
                    });

                    $('#fifthHeader').attr({
                        'data-bs-toggle': 'tab',
                        'data-toggle': 'tab'
                    });
                }
            });
       







</script>