@extends('admin.layouts.leadManagement')
@section('title')
    Lead Management
@endsection
@section('content')
    <?php
    $education_boards = [
        'Andhra Pradesh Board of Secondary Education',
        'Arunachal Pradesh State Board of School Education',
        'Assam Higher Secondary Education Council',
        'Bihar School Examination Board',
        'Central Board of Secondary Education (CBSE)',
        'Chhattisgarh Board of Secondary Education',
        'Council for the Indian School Certificate Examinations (CISCE)',
        'Goa Board of Secondary & Higher Secondary Education',
        'Gujarat Secondary and Higher Secondary Education Board',
        'Haryana Board of School Education',
        'Himachal Pradesh Board of School Education',
        'Indian Certificate of Secondary Education (ICSE)',
        'Jammu & Kashmir State Board of School Education',
        'Jharkhand Academic Council',
        'Karnataka Secondary Education Examination Board',
        'Kerala State Board of Education',
        'Madhya Pradesh Board of Secondary Education',
        'Maharashtra State Board of Secondary & Higher Secondary Education',
        'Manipur State Board of Examination',
        'Meghalaya Board of School Education',
        'Mizoram Board of School Education',
        'Nagaland Board of School Education',
        'National Institute of Open Schooling (NIOS)',
        'Odisha Board of Secondary Education',
        'Punjab School Education Board',
        'Rajasthan Board of Secondary Education',
        'Sikkim Board of School Education',
        'Tamil Nadu State Board of Examination',
        'Telangana State Board of Intermediate Education',
        'Tripura Board of Secondary Education',
        'Uttar Pradesh Board of High School and Intermediate Education',
        'Uttarakhand Board of School Education',
        'West Bengal Board of Secondary Education',
    ];
    
    ?>

    
    @php
    // dd($candidate->destination);
        $intake_names = explode(',', @$candidate->destination[0]->intake);
        $intake_years = explode(',', @$candidate->destination[0]->intake_years);
        $intake_months = explode(',', @$candidate->destination[0]->intake_months);
        
        
        $jsonString = str_replace(['"', '[', ']'], '', @$candidate->destination[0]->preferred_country);
        $preferred_country_ids = explode(',', $jsonString);
        $last_names = array_column($candidate->educations->toArray(), 'qualification');
        $index_10th = array_search('10th', $last_names);
        $index_12th = array_search('12th', $last_names);
        $index_Bachelor = array_search('Bachelors', $last_names);
        $index_Master = array_search('Masters', $last_names);
        $index_Diploma = array_search('Diploma', $last_names);
        $education_index = 5;
        $educations = @$candidate->educations ?? [];
        $can_educations_count = count($educations) + 1;
        $counter = 0;
        $education_boards = [
            'Andhra Pradesh Board of Secondary Education',
            'Arunachal Pradesh State Board of School Education',
            'Assam Higher Secondary Education Council',
            'Bihar School Examination Board',
            'Central Board of Secondary Education (CBSE)',
            'Chhattisgarh Board of Secondary Education',
            'Council for the Indian School Certificate Examinations (CISCE)',
            'Goa Board of Secondary & Higher Secondary Education',
            'Gujarat Secondary and Higher Secondary Education Board',
            'Haryana Board of School Education',
            'Himachal Pradesh Board of School Education',
            'Indian Certificate of Secondary Education (ICSE)',
            'Jammu & Kashmir State Board of School Education',
            'Jharkhand Academic Council',
            'Karnataka Secondary Education Examination Board',
            'Kerala State Board of Education',
            'Madhya Pradesh Board of Secondary Education',
            'Maharashtra State Board of Secondary & Higher Secondary Education',
            'Manipur State Board of Examination',
            'Meghalaya Board of School Education',
            'Mizoram Board of School Education',
            'Nagaland Board of School Education',
            'National Institute of Open Schooling (NIOS)',
            'Odisha Board of Secondary Education',
            'Punjab School Education Board',
            'Rajasthan Board of Secondary Education',
            'Sikkim Board of School Education',
            'Tamil Nadu State Board of Examination',
            'Telangana State Board of Intermediate Education',
            'Tripura Board of Secondary Education',
            'Uttar Pradesh Board of High School and Intermediate Education',
            'Uttarakhand Board of School Education',
            'West Bengal Board of Secondary Education',
        ];

        

        
    @endphp
<style>
    .loader{
        display:none;
    }
    .cancel-text{
        display: none;
    }
</style>
<div class="container-fluid">
    <div class="top-section">
        <div class="first-row">
            {{-- @if(!$candidate->interested_webinar->isEmpty() && $candidate->interested_webinar->first()->webinar && 
                $candidate->interested_webinar->first()->webinar->dateTime)
            <div class="event">
                <p class="webinar">W</p>
                    <div class="tooltip">
                        <p class="t-item">
                            <span class="t-head">Webinar Date :</span><span class="t-value">{{ dateMonthFormat(@$candidate->interested_webinar[0]->webinar->dateTime) }}</span>
                        </p>

                        <p class="t-item">
                            <span class="t-head">Webinar Title :</span><span class="t-value">
                                {{ @$candidate->interested_webinar[0]->webinar->webinar_name }}
                            </span>
                        </p>
                    </div>
            </div>
            @endif --}}
           
            <div class="user-info">
                @if(!$candidate->interested_webinar->isEmpty() && $candidate->interested_webinar->first()->webinar && 
                $candidate->interested_webinar->first()->webinar->dateTime)
                <div class="tool-tip-div">
                    <span class="webinar">W</span>
                    <div class="tooltip">
                        <p class="t-item">
                            <span class="t-head">Webinar Date :</span><span class="t-value">{{ dateMonthFormat(@$candidate->interested_webinar[0]->webinar->dateTime) }}</span>
                        </p>

                        <p class="t-item">
                            <span class="t-head">Webinar Title :</span><span class="t-value">
                                {{ @$candidate->interested_webinar[0]->webinar->webinar_name }}
                            </span>
                        </p>
                    </div>
                </div>
                @endif
                <span class="name" id="candidate_name_update"> {{ ucwords($candidate->user->name) }} {{ ucwords($candidate->user->last_name) }}</span>
                <span class="c-id">(ID: <span class="id-value"> {{ $candidate->user_id }}</span> )</span>

                @if (@$candidate->student_category == 'Gold')
                    <span class="category gold"><span class="cat-text">Gold</span></span>
                @elseif(@$candidate->student_category == 'Silver')
                    <span class="category silver"><span class="cat-text">Silver</span></span>
                @elseif(@$candidate->student_category == 'Bronze')
                    <span class="category bronze"><span class="cat-text">Bronze</span></span>
                @endif

            </div>
    
            <div class="profile-progress">
                <span class="progress-value"></span>
                <div class="progress-line" id="data_progress_bar" data-progress="{{$profile_progress['available_percentage']}}">
                    <span class="filled-line"></span>
                </div>
                <span class="progress-title">Profile Completed</span>
            </div>

            <p class="contacts">
                {{-- <span class="c-value"><img src="{{ asset('backend') }}/lead-management/images/customer-detail/phone.svg"
                        alt="phone" width="100%" height="100%"><span
                        id="mobile_number_update">{{ $user->country_code }} {{ $user->phone }}</span></span>
                <span class="c-value"><img src="{{ asset('backend') }}/lead-management/images/customer-detail/email.svg"
                        alt="email" width="100%" height="100%"> <span id="email_update">
                        {{ $user->email }}</span></span> --}}
    
                <span class="rm-head">RM:<span
                        class="rm-name">{{ ucwords(adminIdToNameGet(@$candidate->user->assigned_rm)) }}
                        @if (!empty(@$candidate->user->assign_date))
                            on ({{ dateMonthFormat(@$candidate->user->assign_date) }})
                        @endif
                    </span>
                </span> 
                <span class="rm-head">Counsellor:<span class="rm-name">
                    {{adminIdToNameGet(@$candidate->user->assign_to)}}
                </span>
            </span>
            </p>

            <div class="other-links">
                @if (userCan('candidate.sendWhatsApp'))
                <a href="javascript:;" class="links wp-link box-link" aria-label="whatsapp" onclick="customWhatsApp(event, '{{$candidate->user->id }}', '{{$candidate->user->name }}', '{{$candidate->user->phone }}', '{{@$candidate->user->country_code }}','{{@$candidate->user->country }}')">
                    <img src="{{ asset('backend') }}/lead-management/images/whatsapp.svg"
                        alt="whatsapp" width="100%" height="100%">
                </a>
                @endif
                @if (userCan('candidate.sendEmail'))
                    <a href="javascript:;" class="links email-link" aria-label="mail" onclick="customSendEmailModel('{{$candidate->user->id }}', '{{$candidate->user->name }}', '{{$candidate->user->email }}')">
                        <img src="{{ asset('backend') }}/lead-management/images/mail.svg"
                            alt="email" width="100%" height="100%">
                    </a>
                @endif
                <a href="javascript:;" class="links create-link box-link" aria-label="add-icon" onclick="customFollowupModel(event,'{{$candidate->user->id }}')">
                    Create Follow Up
                </a>
               
            </div>
        </div>

        <div class="last-row">
            <div class="dropdown-list">
                <div class="single-col">
                    <p class="d-name">Lead Type:</p>
                    <div class="single-input">
                        <select name="" id="lead_type" class="select-list select2-hide-search">
                            <option value="">NA</option>
                            <option class="hot" {{ 'Hot' == old('lead_type', $candidate->user->lead_type) ? 'selected' : '' }}
                                value="Hot">{{ __('Hot') }}</option>
                            <option class="cold" {{ 'Cold' == old('lead_type', $candidate->user->lead_type) ? 'selected' : '' }}
                                value="Cold">{{ __('Cold') }}</option>
                            <option class="warm" {{ 'Warm' == old('lead_type', $candidate->user->lead_type) ? 'selected' : '' }}
                                value="Warm">{{ __('Warm') }}</option>
                        </select>
                    </div>
                </div>
                {{-- <?php 
                    dd(getStageGroup("Visa Accepted"));
                ?> --}}
                <div class="single-col">
                    <p class="d-name">Stage:</p>
                    <div class="single-input">
                        <select name="stages"
                            class="select-list select2-hide-search" id="stageshow" autofocus disabled>
                            
                        </select>
                    </div>
                </div>

                <div class="single-col">
                    <p class="d-name">Sub Stage:</p>
                    <div class="single-input">
                        <select name="stages"
                            class="select-list select2-hide-search @error('stages') is-invalid @enderror w-100-p select2bs4"
                            id="stageSelect" autofocus>
                            
                        </select>
                    </div>
                </div>

                
            </div>
    
            <a href="{{ url('/admin/lead-management/student_case/'.$candidate->user_id) }}" target="_blank" class="view-case-link">View Case</a>
        </div>
    </div>

    <div class="profile-section">
        <div class="left-section">
            <div class="acc-box">
                <p class="acc-head active"><img
                        src="{{ asset('backend') }}/lead-management/images/customer-detail/cap.svg" alt="icon"
                        width="100%" height="100%">Student Information</p>

                <div class="acc-list">
                    <a href="javascript:;" class="tab-item active" data-key="1">Personal Information @if($profile_progress['personal_info_mandatary'] == 1)  <img class="error" title="information missing" src="{{ asset('backend') }}/lead-management/images/customer-detail/error-icon.svg" alt="error-icon" width="100%" height="100%"> @endif</a>
                    <a href="javascript:;" class="tab-item" data-key="2" onclick="work_education_show()"> Education Details  </a>
                    
                    <a href="javascript:;" class="tab-item" data-key="14" onclick="work_experience_show()"> Work Experience </a>

                    <a href="javascript:;" class="tab-item" data-key="3">Study Abroad Preferences @if($profile_progress['study_abroad_info_mandatary'] == 1) <img class="error" title="information missing" src="{{ asset('backend') }}/lead-management/images/customer-detail/error-icon.svg" alt="error-icon" width="100%" height="100%"> @endif</a>

                    <a href="javascript:;" class="tab-item" data-key="4">Budget Preferences </a>

                    <a href="javascript:;" class="tab-item" data-key="5">Test Status @if($profile_progress['test_score_info_mandatary'] == 1) <img class="error" title="information missing" src="{{ asset('backend') }}/lead-management/images/customer-detail/error-icon.svg" alt="error-icon" width="100%" height="100%"> @endif</a>

                    <a href="javascript:;" class="tab-item" data-key="6" onclick="document_show()">Documents  </a>
                    <a href="javascript:;" class="tab-item" data-key="7" >Webinar</a>
                    <a href="javascript:;" class="tab-item" data-key="8">Activity </a>
                    <a href="javascript:;" class="tab-item" data-key="21" >Whatapp Log</a>
                </div>
            </div>

            {{-- <div class="acc-box">
                <p class="acc-head active"><img
                        src="{{ asset('backend') }}/lead-management/images/customer-detail/app-dots.svg" alt="app-dots"
                        width="100%" height="100%">Application Manager</p>
                <div class="acc-list">
                    <a href="javascript:;" class="tab-item" data-key="9">Watchlisted</a>
                    <a href="javascript:;" class="tab-item" data-key="10">Shortlisted</a>
                    <a href="javascript:;" class="tab-item" data-key="11">Applied</a>
                    <a href="javascript:;" class="tab-item suggest-tab" data-key="12">Suggested University</a>
                    <a href="javascript:;" class="tab-item" data-key="13">Payments</a>
                </div>
            </div> --}}
        </div>

        <div class="right-section">
            <!-- profile -->
            <div class="profile">

                <!--Personal Information-->
                <div class="view-panel 1">
                    <form action="" class="detail-form"  id="personal_info_form">
                        <p class="panel-top">
                            <span class="p-head">Personal Information</span>
                            <button type="button" class="edit-btn cancel-btn" data-form_id="personal_information" onclick="save_data('personal_info_form_cancel')" data-operation_type="cancel" id="personal_info_form_cancel">
                                <!--type=submit-->
                                <span class="cancel-text" id="personal_info_form_cancel_button">Cancel</span>
                            </button>

                            <button type="button" class="edit-btn" onclick="save_data('personal_info_form_edit')"  data-form_id="personal_information" data-operation_type="save_edit" id="personal_info_form_edit" >
                                <!--type=submit-->
                                <span class="edit-text "  id="personal_info_form_edit_button">Edit</span>
                                <!--OnClick edit-btn Change the text to Save-->
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg"
                                    alt="edit" id="personal_info_form_edit_image" class="field-icon" width="100%"
                                    height="100%">
                                <!--OnClick edit-btn Change the img to file-save.svg-->
                            </button>
                        </p>

                        <!--To Edit fields remove readonly from .input-field and disabled from Select-->
                        <div class="fields-list">
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/user.svg"
                                        alt="user" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="name" placeholder="First Name"
                                        readonly value="{{ old('name', $user->name) }}" id="name"
                                        maxlength="100" aria-label="name" autocomplete="off" required>
                                </p>
                                <label for="name" class="field-label">Name</label>
                            </div>

                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/user.svg"
                                        alt="user" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="last_name" placeholder="Last Name"
                                        readonly value="{{ old('last_name', $user->last_name) }}" id="last_name"
                                        maxlength="100" aria-label="name" autocomplete="off" >
                                </p>
                                <label for="last_name" class="field-label">Last Name</label>
                            </div>


                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-with-search" name="student_category" id="student_category"
                                        autocomplete="off" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select_student_category') }}
                                        </option>
                                        <option
                                            {{ 'Gold' == old('student_category', $candidate->student_category) ? 'selected' : '' }}
                                            value="Gold">{{ __('Gold') }}</option>
                                        <option
                                            {{ 'Silver' == old('student_category', $candidate->student_category) ? 'selected' : '' }}
                                            value="Silver">{{ __('Silver') }}</option>
                                        <option
                                            {{ 'Bronze' == old('student_category', $candidate->student_category) ? 'selected' : '' }}
                                            value="Bronze">{{ __('Bronze') }}</option>
                                        </select>
                                        @error('student_category')
                                                <span class="invalid-feedback"
                                                    role="alert">{{ __($message) }}</span>
                                        @enderror
                                   

                                </div>
                                
                                <label for="country" class="field-label">Student Category</label>
                            </div>
                            <div class="single-field">
                                <div class="field-value">
                                    <?php $flag = 0; ?> 
                                    
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-with-search" name="country" id="country"
                                        autocomplete="off" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select_country') }}
                                        </option>
                                       
                                        
                                    </select> 
                                </div>
                                
                                <label for="country" class="field-label">Residence Country</label>
                            </div>
                            {{-- <div class="single-field" id="country_name_div">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="country_name"  id="country_name" class="input-field"
                                    value="{{$user->country}}"
                                        
                                        placeholder="Enter Country Name" maxlength="30" readonly
                                        id="" autocomplete="off" aria-label="Enter Country Name" value="">
                                </div>
                                
                                <label for="country" class="field-label">Country Name</label>
                            </div> --}}




                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/phone.svg"
                                        alt="phone" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="phone"
                                        placeholder="Mobile number" readonly value="{{ old('phone', $user->phone) }}"
                                        aria-label="Mobile Number" id="phone" autocomplete="off" maxlength="15"
                                        oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1'); ">
                                </p>
                                <label for="phone" class="field-label">Number</label>
                            </div>
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/phone.svg"
                                        alt="phone" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="alternate_phone"  id="alternate_phone"  class="input-field"
                                        value="{{ old('alternate_phone', $user->alternate_phone) }}"
                                        oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1');"
                                        placeholder="Enter Alternate Mobile Number" maxlength="15" readonly
                                        autocomplete="off" aria-label="Mobile Number">
                                </p>
                                <label for="alternate_phone" class="field-label">Alternative Number</label>
                            </div>
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/email.svg"
                                        alt="email" class="field-icon" width="100%" height="100%">
                                    <input type="email" class="input-field" name="email" placeholder="Email"
                                        readonly id="email" autocomplete="off"
                                        value="{{ old('email', $user->email) }}" aria-label="email">
                                </p>
                                <label for="email" class="field-label">Email</label>
                            </div>
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/email.svg"
                                        alt="email" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="secondary_email"
                                        id="secondary_email" autocomplete="off" aria-label="alternate-email" readonly
                                        placeholder="Enter Alternate Email"
                                        value="{{ old('secondary_email', $user->secondary_email) }}" maxlength="50">
                                </p>
                                <label for="secondary_email" class="field-label">Alternative Email</label>
                            </div>
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        alt="calender" class="field-icon" width="100%" height="100%">
                                    <input type="date" class="input-field datepickerBirth" name="birth_date"  id="birth_date"
                                    value="@if($candidate->birth_date == null)@else{{date('Y-m-d', strtotime($candidate->birth_date))}}@endif" 
                                        readonly placeholder="Date of Birth" aria-label="DOB" max="{{ date('Y-m-d') }}">
                                </p>
                                <label for="birth_date" class="field-label">Date of Birth</label>
                            </div>
                            
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/gender.svg"
                                        alt="gender" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="gender" id="gender"
                                        disabled>

                                        <option value="">{{ __('select') }} {{ __('gender') }}</option>
                                        <option value="male" {{ $candidate->gender == 'male' ? 'selected' : '' }}>
                                            {{ __('male') }}</option>
                                        <option value="female" {{ $candidate->gender == 'female' ? 'selected' : '' }}>
                                            {{ __('female') }}</option>
                                        <option value="other" {{ $candidate->gender == 'other' ? 'selected' : '' }}>
                                            {{ __('other') }}</option>

                                    </select>
                                </p>
                                <label for="gender" class="field-label">Gender</label>
                            </div>
                           
                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/passport.svg"
                                        alt="passport_status" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="passport_status"
                                        id="passport_status" disabled>

                                        @if ($candidate->passport_status == "1")
                                            <option value="1" selected>Yes</option>
                                            <option value="0">No</option>
                                        
                                        @elseif($candidate->passport_status == "0")
                                            <option value="1">Yes</option>
                                            <option value="0" selected>No</option>
                                        @else
                                            <option disabled selected>Have a Passport </option>
                                            <option value="1">Yes</option>
                                            <option value="0">No</option>
                                        @endif
                                    </select>
                                </div>
                                <label for="passport_status" class="field-label">Passport Status</label>
                            </div>


                            <div class="single-field passport_submanu">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/passport.svg"
                                        alt="passport" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="passport_number" id="passport_number" readonly
                                        value="{{ old('passport_number', $candidate->passport_number) }}"
                                        placeholder="Enter Your Passport Number" maxlength="20"
                                        aria-label="Passport Number" >
                                </p>
                                <label for="passport_number" class="field-label">Passport Number</label>
                            </div>
                            <div class="single-field  passport_submanu">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/card-expire.svg"
                                        alt="card-expire" class="field-icon" width="100%" height="100%">
                                    <input type="date" class="input-field datepickerBirth" name="passport_expiry" id="passport_expiry"
                                        readonly aria-label="passport-expiry"
                                        value="@if($candidate->passport_expiry == null)@else{{date('Y-m-d', strtotime($candidate->passport_expiry))}}@endif"
                                         placeholder="Enter the Date of Expiration">
                                </p>
                                <label for="passport_expiry" class="field-label">Date of Expiration</label>
                            </div>
                           
                            
                            <div class="single-field">
                                <div class="field-value">
                                    <?php $flag = 0; ?> 
                                    
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-with-search" name="country_id" id="country_id"
                                        autocomplete="off" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select_country') }}
                                        </option>
                                        @php ($flag = 0)
                                        @foreach ($countries as $country)
                                            <option
                                                {{ $country['id'] == old('country_id',$candidate->country_id) ? 'selected' : '' }}
                                                {{ $country['id'] == old('country_id',$candidate->country_id) ? $flag = 1 : '' }}
                                                value="{{ $country['id'] }}">
                                                {{ $country['name'] }}
                                                
                                            </option>

                                            
                                        @endforeach
                                        @if ($flag == 0 && ($candidate->country_id != "" || $candidate->country_id != null)) 
                                            <option selected value="other">other</option>
                                        @else
                                            <option  value="other">other</option>
                                        @endif
                                    </select> 
                                </div>
                                
                                <label for="country" class="field-label">Passposrt Country</label>
                            </div>
                            {{-- {{dd($candidate->country_id)}} --}}
                            <div class="single-field" id="country_id_name_div">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="country_id_name"  id="country_id_name" class="input-field"
                                    value="{{$candidate->country_id}}" placeholder="Enter Country Name" maxlength="30" readonly
                                        id="" autocomplete="off" aria-label="Enter Country Name" value="">
                                </div>
                                
                                <label for="country" class="field-label">Country Name</label>
                            </div>
                            
                            
                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/state.svg"
                                        alt="state" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-with-search" name="state_id" id="state_id"
                                        disabled>

                                    </select>
                                </div>
                                <label for="state" class="field-label">State</label>
                            </div>
                           
                            <div class="single-field" id="state_id_name_div">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/state.svg"
                                        alt="state" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="state_id_name"  id="state_id_name" class="input-field"
                                    value="{{$candidate->state_id}}"placeholder="Enter State Name" maxlength="30" readonly  autocomplete="off" aria-label="Enter State Name">
                                </div>
                                
                                <label for="country" class="field-label">State Name</label>
                            </div>

                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/city.svg"
                                        alt="city" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-with-search" name="city_id" id="city_id"
                                        disabled>

                                    </select>
                                </div>
                                <label for="city" class="field-label">City</label>
                            </div>
                            
                            <div class="single-field" id="city_id_name_div">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/city.svg"
                                        alt="city" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="city_id_name"  id="city_id_name" class="input-field"
                                    value="{{$candidate->city_id}}"
                                        
                                        placeholder="Enter City Name" maxlength="30" readonly
                                        id="" autocomplete="off" aria-label="Enter City Name" value="{{$candidate->city_id}}">
                                </div>
                                
                                <label for="country" class="field-label">City Name</label>
                            </div>
                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="source"
                                        id="source" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select') }} {{ __('source') }}
                                        </option>
                                        @foreach ($sourcesData as $sd)
                                        <optgroup label="{{ $sd->name }}"> 
                                            @foreach ($sd->source as $ssd)
                                            <option
                                            {{ old('sourcesData',$user->source) == $ssd->name ? 'selected' : '' }}
                                            value="{{ $ssd->name }}"> {{ $ssd->name }}</option>
                                            @endforeach
                                        </optgroup>
                                        @endforeach
                                        </select>
                                        @error('source')
                                        <span class="invalid-feedback"
                                            role="alert">{{ __($message) }}</span>
                                        @enderror
                                    </select>
                                </div>
                                <label for="visa_refusal" class="field-label">Source</label>
                            </div>

                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="partner_id"
                                        id="partner_id" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select') }} Partners
                                        </option>
                                        @foreach ($partners as $partner)
                                            <option
                                            {{ old('partner',$user->partner_id) == $partner->id ? 'selected' : '' }}
                                            value="{{ $partner->id }}"> {{ $partner->name }}</option>
                                       
                                        @endforeach
                                    </select>
                                </div>
                                <label for="visa_refusal" class="field-label">Partner</label>
                            </div>

                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="service_id"
                                        id="service_id" disabled>
                                        <option value="" class="d-none">
                                            {{ __('select') }} Services
                                        </option>
                                        @foreach ($services as $service)
                                            <option
                                            {{ old('service',$user->service_id) == $service->id ? 'selected' : '' }}
                                            value="{{ $service->id }}"> {{ $service->name }}</option>
                                       
                                        @endforeach
                                    </select>
                                </div>
                                <label for="visa_refusal" class="field-label">Services</label>
                            </div>

                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="whatsapp_marketing_status"
                                        id="whatsapp_marketing_status" disabled>
                                        <option value="" class="d-none">
                                            Select Whatsapp Marketing Status
                                        </option>
                                        <option
                                            {{ '1' == old('whatsapp_marketing_status', $candidate->user->whatsapp_marketing_status) ? 'selected' : '' }}
                                            value="1">YES</option>
                                        <option
                                            {{ '0' == old('whatsapp_marketing_status', $candidate->user->whatsapp_marketing_status) ? 'selected' : '' }}
                                            value="0">NO</option>
                                    </select>
                                    @error('whatsapp_marketing_status')
                                        <span class="invalid-feedback"
                                            role="alert">{{ __($message) }}</span>
                                    @enderror
                                </div>
                                <label for="visa_refusal" class="field-label">Whatsapp Marketing Status</label>
                            </div>

                            
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/clock.svg"
                                        alt="clock" class="field-icon" width="100%" height="100%">
                                    <input type="time" name="prefferd_time" id="prefferd_time" class="input-field"
                                    value="@if($user->prefferd_time == null)@else{{date('H:i:s', strtotime($user->prefferd_time))}}@endif"
                                        
                                        placeholder="" maxlength="30" readonly
                                         autocomplete="off" aria-label="prefferd_time">
                                </p>
                                <label for="prefferd_time" class="field-label">Prefferd Time</label>
                            </div>
                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="visa_refusal"
                                        id="visa_refusal" disabled>
                                        @if ($candidate->visa_refusal == 1)
                                            <option value="1" selected>Yes</option>
                                            <option value="0">No</option>
                                        @elseif($candidate->visa_refusal == 0)
                                            <option value="1">Yes</option>
                                            <option value="0" selected>No</option>
                                        @else
                                            <option disabled selected>Have You Faced Visa Refusal</option>
                                            <option value="1">Yes</option>
                                            <option value="0">No</option>
                                        @endif
                                    </select>
                                </div>
                                <label for="visa_refusal" class="field-label">Visa Refusal</label>
                            </div>
                            
                            <div class="single-field vias_submanu">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/card-expire.svg"
                                        alt="card-expire" class="field-icon" width="100%" height="100%"> 
                                    <input type="date" class="input-field" name="date_of_visa_expiration"
                                         aria-label="visa_expiry" value="@if($candidate->date_of_visa_expiration == null)@else{{date('Y-m-d', strtotime($candidate->date_of_visa_expiration))}}@endif"
                                        id="visa_expiry" placeholder="Enter the Date of Expiration">
                                </p>
                                <label for="visa_expiry" class="field-label">Date of Visa Expiration</label>
                            </div>

                            <div class="single-field vias_submanu">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/visa.svg"
                                        alt="visa" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="visa_refusal_reason" id="visa_refusal_reason" placeholder="Visa Refusal Reason"
                                        readonly  value="{{$candidate->visa_refusal_reason}}" aria-label="reason">
                                </p>
                                <label for="reason" class="field-label">Reason</label>
                            </div>
                            <div class="single-field vias_submanu">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/category-icon.svg"
                                        alt="category-icon" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="visa_categories" id="visa_categories" placeholder="Visa Category"
                                        readonly value="{{$candidate->visa_categories}}" aria-label="visa_categories">
                                </p>
                                <label for="visa_categories" class="field-label">Category Visa</label>
                            </div>

                            <div class="single-field m-ques">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/rings.svg"
                                        alt="rings" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="marital_status"
                                        id="marital_status">
                                            <option>Select Marital Status</option>
                                            <option value="Married" @if($candidate->marital_status == "Married") Selected @endif>Married</option>
                                            <option value="Singles" @if($candidate->marital_status == "Single") Selected @endif>Single</option>
                                            <option value="Divorce" @if($candidate->marital_status == "Divorce") Selected @endif>Divorce</option>
                                        </select>
                                </div>
                                <label for="marital_status" class="field-label">Marital Status</label>
                            </div>

                            <div class="single-field spouse-ques" @if($candidate->marital_status == "Married") style="display:inline" @endif>
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/gender.svg"
                                        alt="spouse" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="spouse_comming"
                                        id="spouse_comming">
                                        <option >Select Status</option>
                                        <option value="Yes" @if($candidate->spouse_comming == "Yes") Selected @endif>Yes</option>
                                        <option value="No" @if($candidate->spouse_comming == "No") Selected @endif>No</option>
                                    </select>
                                </div>
                                <label for="" class="field-label">Are you taking them with you?</label>
                            </div>

                            
                            <div class="single-field family-details">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/cap-icon.svg"
                                        alt="cap-icon" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="spouse_qualification" id="spouse_qualification"
                                    value="{{$candidate->spouse_qualification}}"  placeholder="Enter Your Enter qualification of spouse" >
                                </div>
                                <label for="spouse_qualification" class="field-label">Enter qualification of spouse</label>
                            </div>

                            <div class="single-field family-details">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/bag.svg"
                                        alt="bag" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="spouse_employment_status"
                                        id="spouse_employment_status">
                                        <option value="Employed" @if($candidate->spouse_employment_status == "Employed") Selected @endif>Employed</option>
                                        <option value="Unemployed" @if($candidate->spouse_employment_status == "Unemployed") Selected @endif>Unemployed</option>
                                    </select>
                                </div>
                                <label for="" class="field-label">Employment status of Spouse</label>
                            </div>

                            <div class="single-field family-details">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/money.svg"
                                        alt="money" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="spouse_income"
                                    id="spouse_income" value="{{$candidate->spouse_income}}" placeholder="Income of Spouse"
                                    autocomplete="off"  value="{{$candidate->spouse_income}}"  oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');">
                                </div>
                                <label for="spouse_income" class="field-label">Income of Spouse</label>
                            </div>
                            
                            <div class="single-field family-details">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/kids.svg"
                                        alt="kids" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="kids_count"
                                    id="kids_count" value="{{$candidate->kids_count}}" placeholder="No. of Kids"
                                    autocomplete="off" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');">
                                </div>
                                <label for="kids_num" class="field-label">No. of Kids</label>
                            </div>

                            <div class="single-field family-details">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/people.svg"
                                        alt="people" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="accompanying_applicant"
                                    id="accompanying_applicant" value="{{$candidate->accompanying_applicant}}" placeholder="No. of dependents accompanying applicant"
                                    autocomplete="off" oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');">
                                </div>
                                <label for="accompanying_applicant" class="field-label">No. of dependents accompanying applicant</label>
                            </div>

                            


                            <div class="single-field textarea-single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/message.svg"
                                        alt="message" class="field-icon" width="100%" height="100%">
                                        <textarea type="text" rows="4" class="textarea-input-field input-field" name="address" id="address" placeholder="Enter Address">{{ $candidate->address }}</textarea>
                                </div>
                                <label for="address" class="field-label">Address</label>
                            </div>

                            <div class="single-field textarea-single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/message.svg"
                                        alt="message" class="field-icon" width="100%" height="100%">
                                        <textarea rows="4" type="text" class="textarea-input-field input-field" name="notes" id="notes"  spellcheck="true"
                                        placeholder="{{ __('enter') }}  {{ __('notes') }}">{!! strip_tags(old('notes', @$candidate->notes)) !!}</textarea>
                                    @error('notes')
                                        <span
                                            class="text-danger font-size-13"><strong>{{ $message }}</strong></span>
                                    @enderror
                                </div>
                                <label for="notes" class="field-label">Notes</label>
                            </div>
                            
                           
                        </div>   
                    </form>
                </div>

                <!--Education Details-->
                <div class="view-panel view-ed 2">
                    <div class="view-ed-detail">
                        <p class="ed-top-head">
                            <span class="p-head">Education Details</span>
                            <a href="javascript:;" id="add_more_btn" class="add-more">+ Add</a>
                        </p>
                        <div class="education-cards" id="education-cards">

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

                <!--Work Experience-->
                <div class="view-panel 14">
                    <div class="work-exp">
                        <p class="w-top">
                            <span class="p-head">Work Experience</span>
                            <a href="javascript:;" class="add-exp-btn">+ ADD</a>
                        </p>

                        <span class="small-head">Give details of the applicant’s employment and unemployment history since
                            leaving school/college/university</span>
                        <ul class="work-list">
                            <li class="small-list">Employment includes all paid employment, self employment, family
                                business employment, work experience, internships, unpaid employment and volunteer work.
                            </li>
                            <li class="small-list">Unemployment includes all gaps in employment since leaving
                                school/college/university.</li>
                        </ul>
                        <div id="word_experience_null"></div>
                        <div class="view-work-exp d-table-box" id="experience_show_div" style="display: none;">
                            <table class="table">
                                <thead>
                                    <tr>

                                        <th class="t-head">Organization Name</th>
                                        <th class="t-head">Started Date</th>
                                        <th class="t-head">End Date</th>
                                        <th class="t-head">Position</th>
                                        <th class="t-head">Organization Type</th>
                                        <th class="t-head">Organization Address</th>
                                        <th class="t-head">Reference Name</th>
                                        <th class="t-head">Department</th>
                                        <th class="t-head">Experience Letter</th>
                                        <th class="t-head">Mode Of Salary</th>
                                        <th class="t-head">Contact No.</th>
                                        <th class="t-head">Document Attached</th>
                                        <th class="t-head"></th>
                                    </tr>
                                </thead>
                                <tbody id="work_exp_tbody">
                                   
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <!--Study Abroad Preferences-->
                <div class="view-panel 3">
                    <form action="" class="detail-form" id="study_abroad_form">
                        <p class="panel-top">
                            <span class="p-head">Study Abroad Preferences</span>
                            <button type="button" class="edit-btn cancel-btn" data-form_id="study_abroad"  onclick="save_data('study_abroad_form_cancel')"  data-operation_type="cancel" id="study_abroad_form_cancel">
                                <!--type=submit-->
                                <span class="cancel-text" id="study_abroad_form_cancel_button">Cancel</span>
                            </button>
                            <button type="button" class="edit-btn" data-form_id="study_abroad" onclick="save_data('study_abroad_form_edit')"  id="study_abroad_form_edit" data-operation_type="save_edit"> <!--type=submit-->
                                
                                <span class="edit-text" id="study_abroad_form_edit_button">Edit</span>
                                <!--OnClick edit-btn Change the text to Save-->
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg"
                                    id="study_abroad_form_edit_image" alt="edit" class="field-icon" width="100%"
                                    height="100%">
                                <!--OnClick edit-btn Change the img to file-save.svg-->
                            </button>
                        </p>



                        

                        <!--To Edit fields remove readonly from .input-field and disabled from Select-->
                        <div class="fields-list">
                            <div class="single-field">
                                <p class="field-value multiple-select-field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/country.svg"
                                        alt="country" class="field-icon" width="100%" height="100%">

                                    <!--Multiple Select-->

                                    <select class="input-field select2-hide-search" name="preferred_country[]"
                                        id="preferred_country" disabled multiple="multiple" autocomplete="off">
                                        {{-- <option value="" selected disabled>Country</option> --}}
                                        {{-- <option value=""  selected disabled>
                                            {{ __('select_country') }}
                                        </option> --}}
                                        @isset($countries)
                                            @foreach ($countries as $country)
                                                <option <?php
                                                        if (in_array($country['id'], $preferred_country_ids)) {
                                                            ?> selected value="{{ $country['id'] }}">
                                                    {{ $country['name'] }}
                                                    <?php
                                                        }else{
                                                            ?>
                                                    value="{{ $country['id'] }}" > {{ $country['name'] }}
                                                    <?php
                                                        }
                                                    ?>
                                                </option>
                                            @endforeach
                                        @endisset
                                    </select>
                                </p>
                                <label for="country_select" class="field-label">Country</label>
                            </div>
                        
                            
                            <div class="single-field">
                                <p class="field-value multiple-select-field-value ">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        alt="calender" class="field-icon" width="100%" height="100%">
                                    <!--Multiple Select-->
                                    <select class="input-field select2-hide-search" name="intake_years[]" 
                                        disabled multiple="multiple" id="intake_years">
                                      
                                        {{-- <option value=""selected disabled >
                                            Plan Year
                                        </option> --}}

                                        @for ($i = 2022; $i <=  date('Y')+3; $i++)
                                            <option {{ in_array($i, $intake_years) ? 'selected' : '' }} value="{{ $i }}">{{ $i }}</option>
                                        @endfor
                                    </select>
                                </p>
                                <label for="intake_years" class="field-label">Plan Year</label>
                            </div>


                            
                                              
                            <div class="single-field">
                                <p class="field-value multiple-select-field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        alt="calender" class="field-icon" width="100%" height="100%">
                                    <!--Multiple Select-->
                                    <select class="input-field select2-hide-search" name="intake_months[]"
                                        id="intake_months" disabled multiple="multiple">
                                       
                                        {{-- <option value="" selected disabled>
                                            Intake Season
                                        </option> --}}
                                        <option {{ in_array("Jan", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Jan"; ?>"><?php echo "Jan"; ?></option>
                                        <option {{ in_array("Feb", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Feb"; ?>"><?php echo "Feb"; ?></option>
                                        <option {{ in_array("Mar", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Mar"; ?>"><?php echo "Mar"; ?></option>
                                        <option {{ in_array("Apr", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Apr"; ?>"><?php echo "Apr"; ?></option>
                                        <option {{ in_array("May", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "May"; ?>"><?php echo "May"; ?></option>
                                        <option {{ in_array("Jun", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Jun"; ?>"><?php echo "Jun"; ?></option>
                                        <option {{ in_array("July", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "July"; ?>"><?php echo "July"; ?></option>
                                        <option {{ in_array("Aug", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Aug"; ?>"><?php echo "Aug"; ?></option>
                                        <option {{ in_array("Sept", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Sept"; ?>"><?php echo "Sept"; ?></option>
                                        <option {{ in_array("Oct", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Oct"; ?>"><?php echo "Oct"; ?></option>
                                        <option {{ in_array("Nov", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Nov"; ?>"><?php echo "Nov"; ?></option>
                                        <option {{ in_array("Dec", $intake_months) ? 'selected' : '' }}
                                        value="<?php echo "Dec"; ?>"><?php echo "Dec"; ?></option>
                                        

                                    </select>
                                </p>
                                <label for="season_select" class="field-label">Intake Season</label>
                            </div>
                            <?php
                           //dd($intake_months);
                           ?>
                           <div class="single-field">
                            <p class="field-value">
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/courses.svg"
                                    alt="calender" class="field-icon" width="100%" height="100%">
                                <!--Multiple Select-->
                                <select class="input-field select2-hide-search" name="preferred_program"
                                    id="preferred_program" disabled >
                                    <option value="" class="d-none">
                                        {{ __('select_preferred_program') }}
                                    </option>
                                    <option
                                        {{ 'Bachelors' == old('preferred_program', @$candidate->destination[0]->preferred_program) ? 'selected' : '' }}
                                        value="Bachelors">{{ __('Bachelors') }}</option>
                                    <option
                                        {{ 'Masters' == old('preferred_program', @$candidate->destination[0]->preferred_program) ? 'selected' : '' }}
                                        value="Masters">{{ __('Masters') }}</option>
                                    <option
                                        {{ 'PhD' == old('preferred_program', @$candidate->destination[0]->preferred_program) ? 'selected' : '' }}
                                        value="PhD">{{ __('PhD') }}</option>
                                </select>
                                @error('preferred_program')
                                    <span class="invalid-feedback"
                                        role="alert">{{ __($message) }}</span>
                                @enderror
                                
                            </p>
                            <label for="season_select" class="field-label">Preferred Program</label>
                        </div>  
                            <div class="single-field">
                                <p class="field-value p-course">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/courses.svg"
                                        alt="courses" class="field-icon" width="100%" height="100%">
                              

                                    <input type="text" class="input-field" name="preferred_course"
                                        placeholder="Preferred Courses" maxlength="200"
                                        value="{{ @$candidate->destination[0]->preferred_course}}" maxlength="200"
                                        id="preferred_courses">

                                </p>
                                <label for="preferred_courses" class="field-label">Preferred Courses</label>
                            </div>

                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/university.svg"
                                        alt="university" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="applied_university" id="applied_university" disabled>
                                        <option disabled>Applied University</option>
                                        @if (@$candidate->destination[0]->applied_university_name != null)
                                            <option selected value="Yes">Yes</option>
                                            <option value="No">No</option>
                                        @else
                                            <option value="Yes">Yes</option>
                                            <option selected value="No">No</option>
                                        @endif

                                    </select>
                                </p>
                                <label for="applied_uni" class="field-label">Applied University</label>
                            </div>

                            <!--Hide this when Applied University is Selected No-->
                            <div class="single-field" id="applied_university_name_box"
                                style=" @if (@$candidate->destination[0]->applied_university_name == null) display:none; @endif">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/passport.svg"
                                        alt="passport" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="applied_university_name"
                                        placeholder="Name of the University"
                                        value="{{ @$candidate->destination[0]->applied_university_name }}" maxlength="50"
                                        id="applied_university_name">
                                </p>
                                <label for="university_name" class="field-label">Name of University</label>
                            </div>

                            <div class="single-field consultant">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/headphone.svg"
                                        alt="headphone" class="field-icon" width="100%" height="100%">
                                    <select class="input-field select2-hide-search" name="consultant"
                                        id="consultant" disabled>
                                        <option disabled>Connected Consultant</option>
                                        @if (@$candidate->destination[0]->consultant_name != null)
                                            <option selected value="Yes">Yes</option>
                                            <option value="No">No</option>
                                        @else
                                            <option value="Yes">Yes</option>
                                            <option selected value="No">No</option>
                                        @endif
                                    </select>
                                </p>
                                <label for="consultant" class="field-label">Connected Consultant</label>
                            </div>

                            <!--Hide this when Connected Consultant is Selected No-->
                            <div class="single-field" id="consultant_name_box"
                                style=" @if (@$candidate->destination[0]->consultant_name == null) display:none; @endif">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/passport.svg"
                                        alt="passport" class="field-icon" width="100%" height="100%">
                                    <input type="text" class="input-field" name="consultant_name"
                                        id="consultant_name" placeholder="Name of the Consultant"
                                        value="{{ @$candidate->destination[0]->consultant_name }}" maxlength="20" val>
                                </p>
                                <label for="consultant_name" class="field-label">Name of Consultant</label>
                            </div>

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

                <!--Budget Preferences-->
                <div class="view-panel 4">
                    <form action="" class="detail-form budget-form" id="budget_preference_form">
                        <p class="panel-top">
                            <span class="p-head">Budget Preferences</span>

                            <button type="button" onclick="save_data('budget_preference_form_cancel')" class="edit-btn cancel-btn" data-form_id="budget_preference_form"  data-operation_type="cancel" id="budget_preference_form_cancel">
                                <!--type=submit-->
                                <span class="cancel-text" id="budget_preference_form_cancel_button">Cancel</span>
                            </button>
                            
                            <button type="button" onclick="save_data('budget_preference_form_edit')" class="edit-btn" data-form_id="budget_preference_form"  id="budget_preference_form_edit" data-operation_type="save_edit"> <!--type=submit-->
                               
                                <span class="edit-text" id="budget_preference_form_edit_button">Edit</span>
                                <!--OnClick edit-btn Change the text to Save-->
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg"
                                    id="budget_preference_form_edit_image" alt="edit" class="field-icon" width="100%"
                                    height="100%">
                                <!--OnClick edit-btn Change the img to file-save.svg-->
                            </button>
                        </p>
                        
                        
                        <!--To Edit fields remove readonly from .input-field and disabled from Select-->
                        <div class="fields-list">
                            <!-- Show when Form Will Edit -->
                            <div class="budget-list" style="display: none;">
                                <span class="min-value">3L</span>
                                <input type="range" class="range-slider" name="budget-range" id="range"
                                    min="3" max="5000" aria-label="range" value="{{ $candidate->budget }}">
                                <span class="max-value">5000L +</span>
                            </div>

                            <!--readonly will not remove for this field-->
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/money.svg"
                                        alt="money" class="field-icon" width="100%" height="100%">
                                    <input type="text" name="budget" id="budget" class="input-field"
                                        value="{{ $candidate->budget }}" placeholder="Your budget (lacs) Ex. 12.2"
                                        aria-label="budget" readonly>
                                </p>
                                <label for="budget" class="field-label">Your Budget(lacs)</label>
                            </div>

                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/loan.svg"
                                        alt="loan" class="field-icon" width="100%" height="100%">

                                    <!-- multiple Select -->
                                    
                                    <input type="text" name="fund_source" id="fund_source" class="input-field"
                                        value="{{ $candidate->fund_source }}" placeholder="Plan Fund"
                                        aria-label="budget" readonly>
                                </p>
                                <label for="plan_fund" class="field-label">Plan Fund</label>
                            </div>

                            <!-- Show When Education Loan is Selected -->
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/loan.svg"
                                        alt="loan" class="field-icon" width="100%" height="100%">
                                    
                                        <select class="input-field select2-hide-search " name="loan_type" id="loan_type"
                                        disabled>
                                        <option value="" disabled>Loan Type</option>
                                        <option value="Self Funded" @if($candidate->loan_type == "Self Funded") selected @endif>Self Funded</option>
                                        <option value="Sponsered" @if($candidate->loan_type == "Sponsered") selected @endif>Sponsered</option>
                                        <option value="Full Loan" @if($candidate->loan_type == "Full Loan") selected @endif>Full Loan</option>
                                        <option value="Partial Loan" @if($candidate->loan_type == "Partial Loan") selected @endif>Partial Loan</option>
                                        
                                        
                                    </select>
                                </p>
                                <label for="loan_type" class="field-label">Loan Type</label>
                            </div>
                        </div>
                    </form>
                </div>
                    <?php
                        $english_test = [
                            'test_name' => '',
                            'test_taken_date' => '',
                            'test_result_date' => '',
                            'test_scores' => '',
                            'speaking_scores' => '',
                            'reading_scores' => '',
                            'listening_scores' => '',
                            'writing_scores' => '',
                        ];
                        $abroad_test = [
                            'test_name' => '',
                            'test_taken_date' => '',
                            'test_result_date' => '',
                            'test_scores' => '',
                        ];
                        ?>

                        @foreach ($candidate->candidate_exam as $index => $exam)

                            @if ($exam->test_type == 'Study Abroad Test')
                                <?php
                                $abroad_test = [
                                    'test_name' => $exam->test_name,
                                    'test_taken_date' => $exam->test_taken_date,
                                    'test_result_date' => $exam->test_result_date,
                                    'test_scores' => $exam->test_scores,
                                    
                                ];
                                ?>
                            @elseif($exam->test_type == 'English Proficiency')
                                <?php
                                $english_test = [
                                    'test_name' => $exam->test_name,
                                    'test_taken_date' => $exam->test_taken_date,
                                    'test_result_date' => $exam->test_result_date,
                                    'test_scores' => $exam->test_scores,
                                    'speaking_scores' => $exam->speaking_scores,
                                    'reading_scores' => $exam->reading_scores,
                                    'listening_scores' => $exam->listening_scores,
                                    'writing_scores' => $exam->writing_scores,
                                ];
                                ?>
                            @endif
                        @endforeach


                
                        <!--Test Status-->
                <div class="view-panel 5">
                    <form class="detail-form test-form" id="test_status_form">
                        <p class="panel-top">
                            <span class="p-head">Test Status</span>
                            <button type="button" class="edit-btn cancel-btn" data-form_id="test_status_form" onclick="save_data('test_status_form_cancel')"   data-operation_type="cancel" id="test_status_form_cancel">
                                <!--type=submit-->
                                <span class="cancel-text" id="test_status_form_cancel_button">Cancel</span>
                            </button>
                            <button type="button" onclick="save_data('test_status_form_edit')"  data-operation_type="save_edit" class="edit-btn" id="test_status_form_edit"> <!--type=submit-->
                                
                                <span class="edit-text" id="test_status_form_edit_button">Edit</span>
                                <!--OnClick edit-btn Change the text to Save-->
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg"
                                    id="test_status_form_edit_image" alt="edit" class="field-icon" width="100%"
                                    height="100%">
                                <!--OnClick edit-btn Change the img to file-save.svg-->
                            </button>
                        </p>


                       

                        <div class="fields-list">
                            <p class="small-head">English Proficiency Test</p>
                            <div class="single-field">
                                <div class="field-value">
                                    
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/certificate.svg"
                                        class="field-icon" alt="certificate" width="100%" height="100%">
                                    <select class="input-field select2-hide-search eng-other" name="english_test" id="english_test" disabled>
                                        <option value="" disabled>Select your English Proficiency Exam</option>
                                        @php($flag = 0)
                                        <option value="">Select Test</option>
                                        @foreach ($exam_list as $exam_use)
                                            
                                            @if ($exam_use->type == 'English Proficiency')
                                                {


                                                @if ($exam_use->name == $english_test['test_name'])
                                                    <option value="{{ $exam_use->name }}" selected> {{ $exam_use->name }}
                                                    </option>
                                                    @php($flag = 1)
                                                @else
                                                    <option value="{{ $exam_use->name }}"> {{ $exam_use->name }}
                                                    </option>
                                                @endif

                                                }
                                                
                                            @endif
                                                
                                        @endforeach
                                        
                                        @if ($flag == 0 && ($english_test['test_name'] != null || $english_test['test_name'] != "")) 
                                            <option value="other" selected>Other</option>
                                        @else
                                            <option value="other">Other</option>
                                        @endif

                                        
                                    </select>
                                </div>
                                <label for="english_test" class="field-label">English Proficiency Exam</label>
                            </div>

                            <div class="single-field english-other">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/certificate.svg"
                                        class="field-icon" alt="certificate" width="100%" height="100%">
                                    <input type="text" class="input-field" name="english_other" id="english_other"
                                        value="{{ $english_test['test_name'] }}" placeholder="Test Name" maxlength="20"
                                        readonly>
                                </p>
                                <label for="english_other" class="field-label">English Proficiency Exam</label>
                            </div>

                            <div class="single-field eng-taken-date">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        class="field-icon" alt="calender" width="100%" height="100%">
                                    <input type="date" class="input-field" name="english_test_taken_date"
                                        value="@if($english_test['test_taken_date'] == null)@else{{date('Y-m-d', strtotime($english_test['test_taken_date']))}}@endif"
                                        placeholder="Test Taken Date" id="english_test_taken_date"  max="{{ date('Y-m-d') }}" readonly >
                                </p>
                                <label for="english_test_taken_date" class="field-label">Test Taken Date</label>
                            </div>

                            <div class="single-field eng-result-date">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        class="field-icon" alt="calender" width="100%" height="100%">
                                    <input type="date" class="input-field" name="english_test_result_date"
                                        value="@if($english_test['test_result_date'] == null)@else{{date('Y-m-d', strtotime($english_test['test_result_date']))}}@endif"
                                        placeholder="Result Date" id="english_test_result_date" max="{{ date('Y-m-d') }}" readonly>
                                </p>
                                <label for="english_test_result_date" class="field-label">Result Date</label>
                            </div>
                            <div class="single-field eng-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="english_test_scores" class="input-field"
                                        value="{{ $english_test['test_scores'] }}" placeholder="Overall Score Ex. 99.9"
                                        maxlength="5" id="english_test_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="english_test_scores" class="field-label">Overall Score</label>
                            </div>
                            <div class="single-field eng-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="english_speaking_scores" class="input-field"
                                        value="{{ $english_test['speaking_scores'] }}" placeholder="Speaking Score Ex. 99.9"
                                        maxlength="5" id="english_speaking_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="english_speaking_scores" class="field-label">Speaking Score</label>
                            </div>
                            <div class="single-field eng-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="english_reading_scores" class="input-field"
                                        value="{{ $english_test['reading_scores'] }}" placeholder="Reading Score Ex. 99.9"
                                        maxlength="5" id="english_reading_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="english_reading_scores" class="field-label">Reading Score</label>
                            </div>
                            <div class="single-field eng-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="english_listening_scores" class="input-field"
                                        value="{{ $english_test['listening_scores'] }}" placeholder="Listening Score Ex. 99.9"
                                        maxlength="5" id="english_listening_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="english_listening_scores" class="field-label">Listening Score</label>
                            </div>
                            <div class="single-field eng-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="english_writing_scores" class="input-field"
                                        value="{{ $english_test['writing_scores'] }}" placeholder="Writing Score Ex. 99.9"
                                        maxlength="5" id="english_writing_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="english_writing_scores" class="field-label">Writing Score</label>
                            </div>
                            
                        </div>

                        <div class="fields-list">
                            <p class="small-head">Study Abroad Test</p>
                            <div class="single-field">
                                <div class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/certificate.svg"
                                        class="field-icon" alt="certificate" width="100%" height="100%">
                                    <select class="input-field select2-hide-search apt-other" name="aptitude_test"
                                        id="aptitude_test" disabled>
                                        <option value="" >Select Test</option>

                                        @php($flag = 0)
                                        @foreach ($exam_list as $exam_use)

                                            @if ($exam_use->type == 'Study Abroad')
                                                {


                                                @if ($exam_use->name == $abroad_test['test_name'])
                                                    <option value="{{ $exam_use->name }}" selected>
                                                        {{ $exam_use->name }} </option>
                                                    @php($flag = 1)
                                                @else
                                                    <option value="{{ $exam_use->name }}"> {{ $exam_use->name }}
                                                    </option>
                                                @endif

                                                }
                                            @endif

                                        @endforeach

                                        @if ($flag == 0 && ($abroad_test['test_name'] != null || $abroad_test['test_name'] != "")) 
                                            <option value="other" selected >Other</option>
                                        @else
                                            <option value="other">Other</option>
                                        @endif
                                    </select>
                                </div>
                                <label for="aptitude_test" class="field-label">Academic Exam</label>
                            </div>

                            <div class="single-field aptitude-other">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/certificate.svg"
                                        class="field-icon" alt="certificate" width="100%" height="100%">
                                    <input type="text" class="input-field" name="aptitude_other"
                                        placeholder="Test Name" value="{{ $abroad_test['test_name'] }}" maxlength="20"
                                        id="aptitude_other" max="{{ date('Y-m-d') }}" readonly>
                                </p>
                                <label for="aptitude_other" class="field-label">Academic Exam</label>
                            </div>


                            <div class="single-field apt-taken-date">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        class="field-icon" alt="calender" width="100%" height="100%">
                                    <input type="date" class="input-field" name="aptitude_test_taken_date"
                                        value="@if($abroad_test['test_taken_date'] == null)@else{{ date('Y-m-d', strtotime($abroad_test['test_taken_date'])) }}@endif"
                                        placeholder="Test Taken Date" max="{{ date('Y-m-d') }}" id="aptitude_test_taken_date" readonly>
                                </p>
                                <label for="aptitude_test_taken_date" class="field-label">Test Taken Date</label>
                            </div>

                            <div class="single-field apt-result-date">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        class="field-icon" alt="calender" width="100%" height="100%">
                                    <input type="date" class="input-field" name="aptitude_test_result_date"
                                        value="@if($abroad_test['test_result_date'] == null)@else{{ date('Y-m-d', strtotime($abroad_test['test_result_date'])) }}@endif"
                                        placeholder="Result Date" id="aptitude_test_result_date" readonly>
                                </p>
                                <label for="aptitude_test_result_date" class="field-label">Result Date</label>
                            </div>

                            <div class="single-field apt-score">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/score.svg"
                                        class="field-icon" alt="score" width="100%" height="100%">
                                    <input type="text" name="aptitude_test_scores" class="input-field"
                                        value="{{ $abroad_test['test_scores'] }}" placeholder="Overall Score eX.99.9"
                                        maxlength="5" id="aptitude_test_scores"
                                        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');"
                                        readonly>
                                </p>
                                <label for="aptitude_test_scores" class="field-label">Overall Score</label>
                            </div>

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

                <!--Documents-->
                <div class="view-panel 6">
                    <div class="border-box update_document" id="update_document">
                        <p class="panel-top">
                            <span class="p-head">Documents</span>
                        </p>
                        <ul class="tab-list">
                            <li class="tabs active" data-key="app">Application</li>
                            <li class="tabs" data-key="visa">Visa</li>
                            <li class="tabs" data-key="financial">Financial</li>
                            <li class="tabs" data-key="add-doc">Additional Documents</li>
                        </ul>


                    </div>

                </div>

                <!--Webinar-->
                <div class="view-panel 7">
                    <form class="detail-form webinar-form" id="webinar_form">
                        <p class="panel-top">
                            <span class="p-head">Webinar</span>
                            <button type="button" class="edit-btn cancel-btn" id="webinar_form_edit" onclick="save_data('webinar_form_edit')"> <!--type=submit-->
                                <span class="edit-text" id="webinar_form_edit_button">Add</span>
                                <!--OnClick edit-btn Change the text to Save-->
                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg"
                                    id="webinar_form_edit_image" alt="edit" class="field-icon" width="100%"
                                    height="100%">
                                <!--OnClick edit-btn Change the img to file-save.svg-->
                            </button>
                        </p>
                        
                        <div class="fields-list">
                            <div class="single-field">
                                <p class="field-value">
                                    <img src="{{ asset('backend') }}/lead-management/images/customer-detail/calender.svg"
                                        alt="calender" class="field-icon" width="100%" height="100%">
                                    <select class="select2-hide-search" name="webinar_id" id="webinar_id">
                                        <option value="" selected disabled>Select Webinar</option>
                                        @foreach ($webinards as $webinar_use)
                                            
                                                <option value="{{ $webinar_use->id }}">
                                                    {{ $webinar_use->webinar_name }}</option>
                
                                        @endforeach
                                    </select>
                                </p>
                                <label for="webinar_date" class="field-label">Webinar Name</label>
                            </div>
                        </div>
                    </form>

                    <!--Desktop View-->
                    
                    <div class="d-table-box  webinar-form">
                        <p class="panel-top">
                            <span class="p-head">Webinar History</span>

                        </p>
                        <table class="table">
                            <thead> 
                                <tr>

                                    <th class="t-head">Title</th>
                                    <th class="t-head">Date</th>
                                    <th class="t-head">Webinar Link</th>
                                    <th class="t-head">Attend Webinar</th>
                                    <th class="t-head">Action</th>
                                </tr>
                            </thead>
                            <tbody id="tbody_webinar_list1">
                              
                                @foreach ($webinar_history as $webinar_history_use)
                                
                                    <tr>
                                        <td class="t-col">{{$webinar_history_use->webinar_name}}</td>
                                        <td class="t-col">{{ date('d-m-Y H:i:s', strtotime($webinar_history_use->dateTime)) }}</td>
                                        <td class="t-col">@if (@$webinar_history_use->webinar_link != null || @$webinar_history_use->webinar_link != "")
                                            
                                        <a href="{{ $webinar_history_use->webinar_link }}" style="color:blue;">Join Link</a>@else -- @endif  </td> 
                                        <td class="t-col">
                                            @if ($webinar_history_use->attended == 1)
                                                Yes
                                            @else
                                                No
                                            @endif
                                        </td> 
                                        <td class="t-col">
                                            

                                            <a href="javascript:;" data-id="{{$webinar_history_use->id}}" class="delete_webinar_btn del-detail" onclick="delete_webinar_btn({{$webinar_history_use->id}})" >
                                            <img class="delete-webinar-img" src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete-icon"></a>
                                                
                                            
                                        </td>  
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>

                    {{-- <div class="d-table-box webinar-form">
                        <table class="table">
                            <thead>
                                <tr>
    
                                    <th class="t-head">Title</th>
                                    <th class="t-head">Date</th>
    
                                    <th class="t-head">Attend Webinar</th>
                                </tr>
                            </thead>
                            <tbody id="tbody_webinar_list2">
                                @foreach ($webinards as $webinar_use)
                                    @if (in_array($webinar_use->id, $candidate_web_find->toArray()) && $webinar_use->dateTime < $today)
                                        <tr>
                                            <td class="t-col"><span
                                                    class="title">{{ $webinar_use->webinar_name }}</span>
                                            </td>
                                            <td class="t-col"><span
                                                    class="title">{{ date('d-m-Y  H:i:s', strtotime($webinar_use->dateTime)) }}
                                                </span></td>
                                            @foreach ($webinar_history as $webinar_history_use)
                                                @if ($webinar_history_use->webinar_id == $webinar_use->id)
                                                    <td class="t-col"><span class="at-wb true">
                                                            @if ($webinar_use->attended == 1)
                                                                Yes
                                                            @else
                                                                No
                                                            @endif
                                                        </span></td>
                                                    @break
                                                @endif
                                            @endforeach
                                        </tr>
                                    @else
                                    @endif
                                @endforeach
                            </tbody>
                        </table>
                    </div> --}}
                </div>


                {{-- Whatsapp Log --}}
                <div class="view-panel 21">

                    <!--Desktop View-->
                    <div class="d-table-box">


                        <p class="panel-top">
                            <span class="p-head">Whatsapp Log</span>

                        </p>
                        <table class="table">
                            <thead>
                                <tr>
                                    <th class="t-head">Message</th>
                                    <th class="t-head">Created Date</th>
                                    <th class="t-head">Status</th>
                                    <th class="t-head">Send By</th>
                                    <th class="t-head"> Template Name</th>
                                </tr>
                            </thead>
                            <tbody id="whatsapp_log">
                                {{--  --}}

                                @forelse (@$user->whatsapplogs as $whatsapplog)
                                            <tr>
                                                <td class="t-col">{{ @$whatsapplog->message }}</td>
                                                {{-- <td>{{ @$whatsapplog->phone }}</td> --}}
                                                <td class="t-col">{{ dateMonthTimeFormat(@$whatsapplog->created_at) }}</td>
                                                <td class="t-col">{{ @$whatsapplog->status }}</td>
                                                <td class="t-col">  {{ @$whatsapplog->send_by }}{{ @$whatsapplog->send_by ? ucwords(@$whatsapplog->sendBy->name) : '-NA-' }}</td>
                                                {{-- <td>{{ @$whatsapplog->conversation_id }}</td> --}}
                                                <td class="t-col">{{ @$whatsapplog->whatsappTemplates->name }}</td>
                                                
                                            </tr>
                                        @empty
                                            <tr>
                                                <td colspan="10" class="t-col text-center">
                                                    <p>{{ __('no_data_found') }}...</p>
                                                </td>
                                            </tr>
                                        @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>

                <!--Activity-->
                <div class="view-panel 8">

                    <!--Desktop View-->
                    <div class="d-table-box">



                        <table class="table">
                            <thead>
                                <tr>
                                    <th class="t-head">Event</th>
                                    <th class="t-head">Stages</th>
                                    <th class="t-head">Comment</th>
                                    <th class="t-head">Change By</th>
                                    <th class="t-head"> Date & Time</th>
                                </tr>
                            </thead>
                            <tbody id="activity_log">
                                @forelse (@$user->timeLine as $timeLine)
                                    <tr>
                                        @if (!empty($timeLine->event) == 1)
                                            <td class="t-col"><span class="date">AC</span></td>
                                        @else
                                            <td class="t-col"><span class="date">SC</span></td>
                                        @endif
                                        @if (@$timeLine->stages == 'Assign To')
                                            <td class="t-col"><span>--</td>
                                        @else
                                            <td class="t-col"><span>{{ @$timeLine->stages }}</td>
                                        @endif

                                        <td class="t-col"><span>{{ $timeLine->comment }}</td>
                                        @if (!empty($timeLine->auth_id))
                                            <td class="t-col"><span>{{ ucwords(adminIdToNameGet($timeLine->auth_id)) }}
                                            </td>
                                        @else
                                            <td class="t-col"><span>--</td>
                                        @endif

                                        @if (!empty($timeLine->created_at))
                                            <td class="t-col"><span>{{ dateMonthTimeFormat($timeLine->created_at) }}
                                            </td>
                                        @else
                                            <td class="t-col"><span>--</td>
                                        @endif
                                    </tr>
                                @empty
                                    <tr>
                                        <td class="t-col"><span>
                                                <p>{{ __('no_data_found') }}...</p>
                                        </td>
                                    </tr>
                                @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>

                <!--Watchlisted-->
                <div class="view-panel 9">
                    <div class="border-box watchlist">
                        <p class="panel-top">
                            <span class="p-head">Watchlisted</span>
                        </p>
                        <!--Desktop View-->
                        <div class="d-table-box">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th class="t-head">Country</th>
                                        <th class="t-head">University Name</th>
                                        <th class="t-head">Course Name</th>
                                        <th class="t-head">Tuition Fees/yr</th>
                                        <th class="t-head">Intake Month</th>
                                        <th class="t-head">Intake Year</th>
                                        <th class="t-head">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="t-col"><span>Australia </span></td>
                                        <td class="t-col"><span class="uni-name">International College of
                                                Management
                                                Sydney</span></td>
                                        <td class="t-col"><span>Bachelor of Sports Management</span></td>
                                        <td class="t-col"><span>14000.0 GBP</span></td>
                                        <td class="t-col"><span>Nov</span></td>
                                        <td class="t-col"><span>2024</span></td>
                                        <td class="t-col">
                                            <p class="check"><input class="select" type="checkbox" name=""
                                                    id="">
                                                <span class="checkmark"></span>
                                            </p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="t-col"><span>Australia </span></td>
                                        <td class="t-col"><span class="uni-name">International College of
                                                Management
                                                Sydney</span></td>
                                        <td class="t-col"><span>Bachelor of Sports Management</span></td>
                                        <td class="t-col"><span>14000.0 GBP</span></td>
                                        <td class="t-col"><span>Nov</span></td>
                                        <td class="t-col"><span>2024</span></td>
                                        <td class="t-col">
                                            <p class="check"><input class="select" type="checkbox" name=""
                                                    id="">
                                                <span class="checkmark"></span>
                                            </p>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="t-col"><span>Australia </span></td>
                                        <td class="t-col"><span class="uni-name">International College of
                                                Management
                                                Sydney</span></td>
                                        <td class="t-col"><span>Bachelor of Sports Management</span></td>
                                        <td class="t-col"><span>14000.0 GBP</span></td>
                                        <td class="t-col"><span>Nov</span></td>
                                        <td class="t-col"><span>2024</span></td>
                                        <td class="t-col">
                                            <p class="check"><input class="select" type="checkbox" name=""
                                                    id="">
                                                <span class="checkmark"></span>
                                            </p>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        <!--Mobile View-->
                        <div class="m-list">
                            <ul class="list">
                                <li class="list-item">
                                    <p class="check"><input class="select" type="checkbox" name=""
                                            id="">
                                        <span class="checkmark"></span>
                                    </p>
                                </li>

                                <li class="list-item">
                                    <span class="li-head">Country :</span>
                                    <p class="li-value">Australia</p>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">University Name :</span>
                                    <span class="li-value">International College of Management Sydney</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Course Name :</span>
                                    <span class="li-value">Bachelor of Sports Management</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Tuition Fees/yr :</span>
                                    <span class="li-value">14000.0 GBP</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Intake Month :</span>
                                    <span class="li-value">Nov</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Intake Year :</span>
                                    <span class="li-value">2024</span>
                                </li>
                            </ul>
                        </div>
                    </div>

                    <div class="btn-drp">
                        <a href="javascript:;" class="common-btn compare-btn">Compare Universities</a>
                        <a href="jabvascript:;" class="common-btn move-btn">Move to Shortlist</a>
                    </div>
                </div>

                <!--Shortlisted-->
                <div class="view-panel 10">
                    <div class="border-box">
                        <p class="panel-top">
                            <span class="p-head">Shortlisted</span>
                        </p>
                        <div class="application-list">
                            <div class="app-list">
                                <div class="single-application">
                                    <div class="app-top">
                                        <div class="app-left">
                                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/uni-image1.jpg"
                                                alt="university-image" width="100%" height="100%">
                                            <p class="detail">
                                                <span class="uni-name">University of Oxford</span>
                                                <span class="course-name">MEng Engineering Science</span>
                                                <span class="date"><img
                                                        src="{{ asset('backend') }}/lead-management/images/calender.svg"
                                                        alt="calender" width="100%" height="100%">Fall (Final
                                                    Deadline)
                                                    : October 15,
                                                    2023</span>
                                            </p>
                                        </div>

                                        <div class="app-right">
                                            <a href="javascript:;" class="apply-btn">
                                                <svg width="14" height="16" viewBox="0 0 14 16" fill="none"
                                                    xmlns="http://www.w3.org/2000/svg">
                                                    <path
                                                        d="M13.9416 10.896C13.9022 10.7991 13.847 10.7098 13.7783 10.632L11.4443 8.232C11.2978 8.08136 11.0991 7.99673 10.8919 7.99673C10.6847 7.99673 10.486 8.08136 10.3395 8.232C10.193 8.38264 10.1107 8.58696 10.1107 8.8C10.1107 9.01304 10.193 9.21736 10.3395 9.368L11.3509 10.4H7.00194C6.7956 10.4 6.59772 10.4843 6.45182 10.6343C6.30591 10.7843 6.22395 10.9878 6.22395 11.2C6.22395 11.4122 6.30591 11.6157 6.45182 11.7657C6.59772 11.9157 6.7956 12 7.00194 12H11.3509L10.3395 13.032C10.2666 13.1064 10.2087 13.1949 10.1692 13.2923C10.1297 13.3898 10.1094 13.4944 10.1094 13.6C10.1094 13.7056 10.1297 13.8102 10.1692 13.9077C10.2087 14.0051 10.2666 14.0936 10.3395 14.168C10.4119 14.243 10.4979 14.3025 10.5927 14.3431C10.6875 14.3837 10.7892 14.4046 10.8919 14.4046C10.9946 14.4046 11.0963 14.3837 11.1911 14.3431C11.2859 14.3025 11.372 14.243 11.4443 14.168L13.7783 11.768C13.8503 11.6929 13.906 11.6029 13.9416 11.504C14.0195 11.3092 14.0195 11.0908 13.9416 10.896ZM8.55793 14.4H2.33398C2.12764 14.4 1.92976 14.3157 1.78386 14.1657C1.63795 14.0157 1.55599 13.8122 1.55599 13.6V2.4C1.55599 2.18783 1.63795 1.98434 1.78386 1.83431C1.92976 1.68429 2.12764 1.6 2.33398 1.6H6.22395V4C6.22395 4.63652 6.46985 5.24697 6.90755 5.69706C7.34526 6.14714 7.93892 6.4 8.55793 6.4H11.6699C11.8235 6.39921 11.9734 6.35169 12.1008 6.26342C12.2282 6.17516 12.3273 6.0501 12.3857 5.904C12.4452 5.75831 12.4615 5.59774 12.4324 5.44255C12.4034 5.28736 12.3302 5.1445 12.2223 5.032L7.55431 0.232C7.49 0.169773 7.41647 0.118465 7.33648 0.0799999H7.26646L7.04862 0H2.33398C1.71497 0 1.12131 0.252856 0.683607 0.702944C0.245901 1.15303 0 1.76348 0 2.4V13.6C0 14.2365 0.245901 14.847 0.683607 15.2971C1.12131 15.7471 1.71497 16 2.33398 16H8.55793C8.76426 16 8.96215 15.9157 9.10805 15.7657C9.25395 15.6157 9.33592 15.4122 9.33592 15.2C9.33592 14.9878 9.25395 14.7843 9.10805 14.6343C8.96215 14.4843 8.76426 14.4 8.55793 14.4ZM7.77993 2.728L9.79494 4.8H8.55793C8.35159 4.8 8.1537 4.71571 8.0078 4.56569C7.8619 4.41566 7.77993 4.21217 7.77993 4V2.728Z"
                                                        fill="#F3601E" />
                                                </svg>
                                                Move for Application
                                            </a>
                                            <p class="delete" aria-label="delete"><img
                                                    src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                                    alt="delete" width="100%" height="100%"></p>
                                        </div>
                                    </div>

                                    <div class="app-bottom">
                                        <p class="text"><img
                                                src="{{ asset('backend') }}/lead-management/images/detail-icon.svg"
                                                alt="detail-icon" width="100%" height="100%">Shortlisted by you
                                        </p>
                                    </div>
                                </div>

                                <div class="single-application">
                                    <div class="app-top">
                                        <div class="app-left">
                                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/uni-image2.jpg"
                                                alt="university-image" width="100%" height="100%">
                                            <p class="detail">
                                                <span class="uni-name">University of Cambridge</span>
                                                <span class="course-name">Bachelors Mathematics</span>
                                            </p>
                                        </div>

                                        <div class="app-right">
                                            <a href="javascript:;" class="apply-btn">
                                                <svg width="14" height="16" viewBox="0 0 14 16" fill="none"
                                                    xmlns="http://www.w3.org/2000/svg">
                                                    <path
                                                        d="M13.9416 10.896C13.9022 10.7991 13.847 10.7098 13.7783 10.632L11.4443 8.232C11.2978 8.08136 11.0991 7.99673 10.8919 7.99673C10.6847 7.99673 10.486 8.08136 10.3395 8.232C10.193 8.38264 10.1107 8.58696 10.1107 8.8C10.1107 9.01304 10.193 9.21736 10.3395 9.368L11.3509 10.4H7.00194C6.7956 10.4 6.59772 10.4843 6.45182 10.6343C6.30591 10.7843 6.22395 10.9878 6.22395 11.2C6.22395 11.4122 6.30591 11.6157 6.45182 11.7657C6.59772 11.9157 6.7956 12 7.00194 12H11.3509L10.3395 13.032C10.2666 13.1064 10.2087 13.1949 10.1692 13.2923C10.1297 13.3898 10.1094 13.4944 10.1094 13.6C10.1094 13.7056 10.1297 13.8102 10.1692 13.9077C10.2087 14.0051 10.2666 14.0936 10.3395 14.168C10.4119 14.243 10.4979 14.3025 10.5927 14.3431C10.6875 14.3837 10.7892 14.4046 10.8919 14.4046C10.9946 14.4046 11.0963 14.3837 11.1911 14.3431C11.2859 14.3025 11.372 14.243 11.4443 14.168L13.7783 11.768C13.8503 11.6929 13.906 11.6029 13.9416 11.504C14.0195 11.3092 14.0195 11.0908 13.9416 10.896ZM8.55793 14.4H2.33398C2.12764 14.4 1.92976 14.3157 1.78386 14.1657C1.63795 14.0157 1.55599 13.8122 1.55599 13.6V2.4C1.55599 2.18783 1.63795 1.98434 1.78386 1.83431C1.92976 1.68429 2.12764 1.6 2.33398 1.6H6.22395V4C6.22395 4.63652 6.46985 5.24697 6.90755 5.69706C7.34526 6.14714 7.93892 6.4 8.55793 6.4H11.6699C11.8235 6.39921 11.9734 6.35169 12.1008 6.26342C12.2282 6.17516 12.3273 6.0501 12.3857 5.904C12.4452 5.75831 12.4615 5.59774 12.4324 5.44255C12.4034 5.28736 12.3302 5.1445 12.2223 5.032L7.55431 0.232C7.49 0.169773 7.41647 0.118465 7.33648 0.0799999H7.26646L7.04862 0H2.33398C1.71497 0 1.12131 0.252856 0.683607 0.702944C0.245901 1.15303 0 1.76348 0 2.4V13.6C0 14.2365 0.245901 14.847 0.683607 15.2971C1.12131 15.7471 1.71497 16 2.33398 16H8.55793C8.76426 16 8.96215 15.9157 9.10805 15.7657C9.25395 15.6157 9.33592 15.4122 9.33592 15.2C9.33592 14.9878 9.25395 14.7843 9.10805 14.6343C8.96215 14.4843 8.76426 14.4 8.55793 14.4ZM7.77993 2.728L9.79494 4.8H8.55793C8.35159 4.8 8.1537 4.71571 8.0078 4.56569C7.8619 4.41566 7.77993 4.21217 7.77993 4V2.728Z"
                                                        fill="#F3601E" />
                                                </svg>
                                                Move for Application
                                            </a>

                                            <p class="delete" aria-label="delete"><img
                                                    src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                                    alt="delete" width="100%" height="100%"></p>
                                        </div>
                                    </div>

                                    <div class="app-bottom">
                                        <p class="text"><img
                                                src="{{ asset('backend') }}/lead-management/images/detail-icon.svg"
                                                alt="detail-icon" width="100%" height="100%">Shortlisted by
                                            Gradding</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!--Applied-->
                <div class="view-panel 11">
                    <div class="top-head">
                        <p class="head-name">Applied Application</p>
                        <a href="javascript:;" class="suggest-link">+ Suggest University</a>
                    </div>
                    <div class="status-panels">
                        <div class="p-left common">
                            <div class="acc-list">
                                <div class="course-detail active">
                                    <div class="c-name">
                                        <p>
                                            <span class="course-name">Master of Health Administration</span>
                                            <span class="uni-name">Curtin University</span>
                                        </p>
                                        <span class="priority">2nd priority</span>
                                    </div>
                                    <p class="status">Status:<span class="status-type">Case Closed - Student Not
                                            Qualified</span>
                                    </p>

                                    <span class="app-type">Applied Through KC</span>
                                </div>

                                <!--Mobile-->
                                <div class="app-info show">
                                    <div class="status-detail">
                                        <span class="date">21/09/2023</span>
                                        <span class="time">03:07PM</span>
                                        <span class="app-id">188671/23</span>
                                        <p class="subtitle">Intake: <span class="mnth-year">Feb-2024</span></p>
                                    </div>

                                    <div class="comment-section">
                                        <p class="comment-head">Comments</p>

                                        <form action="" class="cmt-form">

                                            <div class="field">
                                                <img src="{{ asset('backend') }}/lead-management/images/profile-image.jpg"
                                                    class="user-profile" alt="profile-image" width="100%"
                                                    height="100%">
                                                <div class="cmt-field">
                                                    <textarea class="comment-input" name="" id="" cols="" rows=""
                                                        placeholder="Write Comments"></textarea>
                                                    <p class="file-name">upload-file.jpg <img
                                                            src="{{ asset('backend') }}/lead-management/images/close1.svg"
                                                            class="close" alt="close" width="100%" height="100%">
                                                    </p>
                                                </div>
                                            </div>

                                            <div class="f-bottom">
                                                <p class="upload-file">
                                                    <input type="file" class="file" name="file" id="">
                                                    <img src="{{ asset('backend') }}/lead-management/images/pin.svg"
                                                        class="pin-image" alt="pin" width="100%" height="100%">
                                                </p>

                                                <button class="send-btn">Send</button>
                                            </div>
                                        </form>

                                        <div class="cmt-list">
                                            <div class="detail">
                                                <p class="u-name"><img
                                                        src="{{ asset('backend') }}/lead-management/images/profile-image.jpg"
                                                        class="user-profile" alt="profile-image" width="100%"
                                                        height="100%">Sankalp Navdhinge</p>
                                                <p><span class="date">21/09/2023</span><span class="time">04:49PM</span>
                                                </p>
                                            </div>
                                            <p class="comment">
                                                Dear Team, <br><br>

                                                We are not going to take this case forward as the applicant is from
                                                Bihar and
                                                completed
                                                a
                                                bachelor’s from Punjab, which is a GTE concern, hence we are closing
                                                this case.
                                            </p>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="acc-list">
                                <div class="course-detail">
                                    <div class="c-name">
                                        <p>
                                            <span class="course-name">Master of Pharmacy</span>
                                            <span class="uni-name">University of Western Australia</span>
                                        </p>
                                    </div>
                                    <p class="status">Status:<span class="status-type">Case Closed</span></p>
                                    <span class="app-type">Applied Through Gradding</span>
                                </div>
                            </div>

                            <div class="acc-list">
                                <div class="course-detail">
                                    <div class="c-name">
                                        <p>
                                            <span class="course-name">Master of Biotechnology Management</span>
                                            <span class="uni-name">La Trobe University, Melbourne</span>
                                        </p>
                                    </div>
                                    <p class="status">Status:<span class="status-type">Conditional Offer
                                            Received</span></p>
                                    <span class="app-type">Applied Through MSM</span>
                                </div>
                            </div>
                        </div>

                        <!--Desktop-->
                        <div class="p-right common">
                            <div class="app-info">
                                <div class="status-detail">
                                    <div class="status-head">
                                        <p>
                                            <span class="date">21/09/2023</span>
                                            <span class="time">03:07PM</span>
                                            <span class="app-type">Applied Through KC</span>
                                        </p>
                                        <p class="status-type">Case Closed - Student Not Qualified</p>
                                    </div>
                                    <span class="app-id">188671/23</span>
                                    <p class="course-name">Master of Health Administration</p>
                                    <p class="uni-name">Curtin University</p>
                                    <span class="mnth-year">Feb-2024</span>
                                </div>

                                <div class="comment-section">
                                    <p class="comment-head">Comments</p>

                                    <form action="" class="cmt-form">

                                        <div class="field">
                                            <img src="{{ asset('backend') }}/lead-management/images/profile-image.jpg"
                                                class="user-profile" alt="profile-image" width="100%" height="100%">
                                            <div class="cmt-field">
                                                <textarea class="comment-input" name="" id="" cols="" rows=""
                                                    placeholder="Write Comments"></textarea>
                                                <p class="file-name">upload-file.jpg <img
                                                        src="{{ asset('backend') }}/lead-management/images/close1.svg"
                                                        class="close" alt="close" width="100%" height="100%">
                                                </p>
                                            </div>
                                        </div>

                                        <div class="f-bottom">
                                            <p class="upload-file">
                                                <input type="file" class="file" name="file" id="">
                                                <img src="{{ asset('backend') }}/lead-management/images/pin.svg"
                                                    class="pin-image" alt="pin" width="100%" height="100%">
                                            </p>

                                            <button class="send-btn">Send</button>
                                        </div>
                                    </form>

                                    <div class="cmt-list">
                                        <div class="detail">
                                            <p class="u-name"><img
                                                    src="{{ asset('backend') }}/lead-management/images/profile-image.jpg"
                                                    class="user-profile" alt="profile-image" width="100%"
                                                    height="100%">Sankalp Navdhinge</p>
                                            <p><span class="date">21/09/2023</span><span class="time">04:49PM</span>
                                            </p>
                                        </div>
                                        <p class="comment">
                                            Dear Team, <br><br>

                                            We are not going to take this case forward as the applicant is from
                                            Bihar and completed
                                            a
                                            bachelor’s from Punjab, which is a GTE concern, hence we are closing
                                            this case.
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!--Suggested University-->
                <div class="view-panel 12">
                    <div class="add-program">

                        <div class="head">
                            <p class="title">Quick Add Program ccc</p>
                            <a href="javascript:;" class="search-btn">Search Program</a>
                        </div>

                        <form action="" class="add-form">
                            <p class="sub-head">We only show eligible courses for this student for the selected
                                intake, year
                                and university. To understand why certain courses are not eligible for this student,
                                please go
                                to Search Program.</p>
                            <?php
                            // foreach ($main_intake as $value) {
                            //     $number = '20' . preg_replace('/[^0-9]/', '', $value); // Extract the number from the string
                            //     $month = substr($value, 0, 3); // Extract the month abbreviation
                            
                            //     if (!in_array($number, $seenNumbers)) {
                            //         $modifiedArray[] = $number;
                            //         $seenNumbers[] = $number;
                            //     }
                            // }
                            // $main_intake_year = $modifiedArray;
                            
                            // $modifiedArray = [];
                            // $seenMonths = [];
                            
                            // foreach ($main_intake as $value) {
                            //     $number = '20' . preg_replace('/[^0-9]/', '', $value); // Extract the number from the string
                            //     $month = substr($value, 0, 3); // Extract the month abbreviation
                            
                            //     if (!in_array($month, $seenMonths)) {
                            //         $modifiedArray[$month] = $month;
                            //         $seenMonths[] = $month;
                            //     }
                            // }
                           
                            // $main_intake_month = array_values($modifiedArray);
                            // // dd($main_intake_month);
                            // ?>
                            <div class="drp-fields-list">
                                <div class="single-list">
                                    <select class="select2-hide-search" name="" id="">
                                        <option value="" selected disabled>Select Year</option>
                                        {{-- @foreach ($main_intake_year as $intake)
                                            <option value="<?php echo $intake; ?>"><?php echo $intake; ?></option>
                                        @endforeach --}}
                                    </select>
                                </div>

                                <div class="single-list">
                                    <select class="select2-hide-search select-list" name="" id="" multiple>
                                        <option value="" selected disabled>Select Intake</option>
                                        {{-- @foreach ($main_intake_month as $intake)
                                            <option {{ in_array($intake, $intake_names) ? 'selected' : '' }}
                                                value="<?php echo substr($intake, 0, 3); ?>"><?php echo substr($intake, 0, 3); ?></option>
                                        @endforeach --}}
                                    </select>
                                </div>

                                <div class="single-list">



                                    <select name="university_id"
                                        class="select2-with-search select-list {{ error('country_id') }}" id="uname"
                                        required>
                                        <option value="" class="d-none" disabled selected hidden>
                                            {{ __('select_university') }}
                                        </option>
                                        @foreach ($universities as $universitie)
                                            <option value="{!! @$universitie->id !!}"
                                                {{ $universitie->id == @$univrsitty->uname ? 'selected' : '' }}>
                                                {{ $universitie->name }}
                                            </option>
                                        @endforeach
                                    </select>

                                </div>


                                <div class="single-list">
                                    <input type="text" name="course_name">
                                </div>
                                <div class="single-list">
                                    <select class="select2-with-search select-list" name="" id="">
                                        <option value="" selected disabled>Search Program</option>
                                        <option value="">Master of Health Administration</option>
                                        <option value="">Master of Pharmacy</option>
                                    </select>
                                </div>

                                <button class="add-btn disabled">Add</button>
                            </div>
                        </form>

                        <div class="selected-section">
                            <p class="title">Selected Programs</p>

                            <p class="no-selected sub-head">Search for courses relevant to the student's profile
                                from more than
                                80,000+
                                courses across 700+ Universities, using our dynamic 'Search Program'
                                functionality.After searching
                                the relevant courses you can associate courses to the student's profile by clicking
                                on 'Associate
                                Shortlisted Courses'.
                            </p>

                            @foreach ($candidate->suggest_university as $univrsitty)
                                <div class="program-list">
                                    <div class="single-program">
                                        <div class="head">
                                            <p>
                                                <span class="p-name"></span>
                                            </p>
                                            <img src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                                class="delete-program" alt="delete" width="100%" height="100%">
                                        </div>

                                        <ul class="d-list">
                                            <li class="list-head">University:<span class="value">
                                                    @foreach ($universities as $universitie)
                                                        @if ($universitie->id == @$univrsitty->uname)
                                                            {{ $universitie->name }}
                                                        @endif
                                                    @endforeach
                                                </span>
                                            </li>
                                            <li class="list-head">Course Name:<span
                                                    class="value">{{ $univrsitty->name }}</span>
                                            </li>
                                            <li class="list-head">W/v<span
                                                    class="value">{{ $univrsitty->website_url }}</span>
                                            </li>
                                            <li class="list-head intake">Duration/Month:<span
                                                    class="value label">{{ $univrsitty->duration }}</span>
                                            </li>
                                            <li class="list-head">Intakes Year:<span
                                                    class="value">20<?php echo substr($univrsitty->intake, 4, 6); ?></span></li>
                                            <li class="list-head">Intakes Month:<span
                                                    class="value"><?php echo substr($univrsitty->intake, 0, 3); ?></span></li>
                                            <li class="list-head">IELTS.s:<span
                                                    class="value fee-color">{{ @$univrsitty->ielts_score }}</span></li>
                                            <li class="list-head">IELTS.no:<span
                                                    class="value">{{ @$univrsitty->ielts_no_band }}</span></li>
                                            <li class="list-head">PTE.s:<span
                                                    class="value">{{ @$univrsitty->pte_no_band }}</span></li>
                                            <li class="list-head">PTE.no:<span
                                                    class="value">{{ @$univrsitty->pte_score }}</span></li>
                                            <li class="list-head">Y/F'INR':<span
                                                    class="value">{{ @$univrsitty->yearly_tution_fee }}</span></li>
                                        </ul>

                                    </div>
                                </div>



                            @endforeach
                            <a href="javascript:;" class="pay-link">Send Payment Link</a>

                        </div>
                    </div>

                    <!-- payment-page -->
                    <div class="payment-box" style="display: none;">
                        <p class="head">Unpaid Applications</p>

                        <ul class="list-type">
                            <li class="list-item"><img src="{{ asset('backend') }}/lead-management/images/green-tick.svg"
                                    alt="green-tick" width="100%" height="100%">‘One’
                                application, ‘multiple’ courses & universities</li>
                            <li class="list-item"><img src="{{ asset('backend') }}/lead-management/images/green-tick.svg"
                                    alt="green-tick" width="100%" height="100%">700+
                                Global University Tie Ups</li>
                            <li class="list-item"><img src="{{ asset('backend') }}/lead-management/images/green-tick.svg"
                                    alt="green-tick" width="100%" height="100%">High
                                Values Scholarships & Study Loans</li>
                            <li class="list-item"><img src="{{ asset('backend') }}/lead-management/images/green-tick.svg"
                                    alt="green-tick" width="100%" height="100%">Supporting you all the way</li>
                        </ul>

                        <!--Desktop-->
                        <div class="d-payment-list">
                            <table class="payment-table">
                                <thead>
                                    <tr>
                                        <th class="t-head">Program Name</th>
                                        <th class="t-head">University</th>
                                        <th class="t-head">Intake</th>
                                        <th class="t-head">Application Fees</th>
                                        <th class="t-head">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="t-col">
                                            <p class="course-name">Pre-sessional English 9 weeks</p>
                                        </td>
                                        <td class="t-col">Middlesex University</td>
                                        <td class="t-col">Jun - 2024</td>
                                        <td class="t-col">Rs.1000</td>
                                        <td class="t-col">
                                            <a href="javascript:;" class="pay-btn">Paid</a>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td class="t-col">
                                            <p class="course-name">Pre-Master’s for Business, Hospitality</p>
                                        </td>
                                        <td class="t-col">(KAPLAN) University of Brighton</td>
                                        <td class="t-col">Jun - 2024</td>
                                        <td class="t-col">Rs.1000</td>
                                        <td class="t-col">
                                            <p class="actions">
                                                <a href="javascript:;" class="pay-btn pending">Pending</a>
                                                <img src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                                    class="delete-payment" alt="delete" width="100%" height="100%">
                                        </td>
                                        </p>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        <!--Mobile-->
                        <div class="m-payment-list">
                            <ul class="payment-detail">
                                <li class="p-item"><span class="phead">Program Name:</span><span
                                        class="pvalue">Pre-sessional
                                        English 9
                                        weeks</span></li>
                                <li class="p-item"><span class="phead">University:</span><span class="pvalue">Middlesex
                                        University</span></li>
                                <li class="p-item"><span class="phead">Intake:</span><span class="pvalue">Jun-2024</span>
                                </li>
                                <li class="p-item">
                                    <span class="phead">Application Fee:</span>
                                    <span class="pvalue fee-amt">Rs.1000</span>
                                </li>
                                <li class="p-item">
                                    <a href="javascript:;" class="pay-btn">Paid</a>
                                </li>
                            </ul>

                            <ul class="payment-detail">
                                <li class="p-item"><span class="phead">Program Name:</span><span
                                        class="pvalue">Pre-Master’s for
                                        Business, Hospitality, Tourism and Social Science (3 Terms)</span></li>
                                <li class="p-item"><span class="phead">University:</span><span class="pvalue">(KAPLAN)
                                        University of
                                        Brighton</span></li>
                                <li class="p-item"><span class="phead">Intake:</span><span class="pvalue">Jun-2024</span>
                                </li>
                                <li class="p-item">
                                    <span class="phead">Application Fee:</span>
                                    <span class="pvalue fee-amt">Rs.1000</span>
                                </li>
                                <li class="p-item">
                                    <a href="javascript:;" class="pay-btn pending">Pending</a>
                                    <img src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                        class="delete-payment" alt="delete" width="100%" height="100%">
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>

                <!--Payments-->
                <div class="view-panel 13">
                    <div class="payments">
                        <!--Desktop View-->
                        <div class="d-table-box">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th class="t-head">Transactions Date</th>
                                        <th class="t-head">Purpose</th>
                                        <th class="t-head">Package Details</th>
                                        <th class="t-head">Amount</th>
                                        <th class="t-head">Status</th>
                                        <th class="t-head">Send Invoice</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="t-col">25 March 2023</td>
                                        <td class="t-col">Application Fees</td>
                                        <td class="t-col">-</td>
                                        <td class="t-col"><span class="amount">Rs.1000</span></td>
                                        <td class="t-col"><span class="status paid">Success</span></td>
                                        <td class="t-col"><a class="invoice-btn" href="javscript:;"
                                                aria-label="invoice-icon"><img
                                                    src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                    alt="invoice" width="100%" height="100%"></a></td>
                                    </tr>

                                    <tr>
                                        <td class="t-col">22 March 2023</td>
                                        <td class="t-col">Webinar Fee</td>
                                        <td class="t-col">-</td>
                                        <td class="t-col"><span class="amount">Rs.500</span></td>
                                        <td class="t-col"><span class="status paid">Success</span></td>
                                        <td class="t-col"><a class="invoice-btn" href="javscript:;"
                                                aria-label="invoice-icon"><img
                                                    src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                    alt="invoice" width="100%" height="100%"></a></td>
                                    </tr>

                                    <tr>
                                        <td class="t-col">22 March 2023</td>
                                        <td class="t-col">Webinar Fee</td>
                                        <td class="t-col">-</td>
                                        <td class="t-col"><span class="amount">Rs.500</span></td>
                                        <td class="t-col"><span class="status unpaid">Failed</span></td>
                                        <td class="t-col"><a class="invoice-btn" href="javscript:;"
                                                aria-label="invoice-icon"><img
                                                    src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                    alt="invoice" width="100%" height="100%"></a></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>

                        <!--Mobile View-->
                        <div class="m-list">
                            <ul class="list">
                                <li class="list-item">
                                    <span class="li-head">Transactions Date :</span>
                                    <p class="li-value">25 March 2023</p>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Purpose :</span>
                                    <span class="li-value">Application Fees</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Package Details :</span>
                                    <span class="li-value">-</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Amount :</span>
                                    <span class="li-value amount">Rs.1000</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Status :</span>
                                    <span class="li-value status paid">Success</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Send Invoice :</span>
                                    <p class="li-value">
                                        <a class="invoice-btn" href="javscript:;" aria-label="invoice-icon">
                                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                alt="invoice" width="100%" height="100%">
                                        </a>
                                    </p>
                                </li>
                            </ul>

                            <ul class="list">
                                <li class="list-item">
                                    <span class="li-head">Transactions Date :</span>
                                    <p class="li-value">22 March 2023</p>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Purpose :</span>
                                    <span class="li-value">Webinar Fee</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Package Details :</span>
                                    <span class="li-value">-</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Amount :</span>
                                    <span class="li-value amount">Rs.500</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Status :</span>
                                    <span class="li-value status paid">Success</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Send Invoice :</span>
                                    <p class="li-value">
                                        <a class="invoice-btn" href="javscript:;" aria-label="invoice-icon">
                                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                alt="invoice" width="100%" height="100%">
                                        </a>
                                    </p>
                                </li>
                            </ul>

                            <ul class="list">
                                <li class="list-item">
                                    <span class="li-head">Transactions Date :</span>
                                    <p class="li-value">22 March 2023</p>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Purpose :</span>
                                    <span class="li-value">Webinar Fee</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Package Details :</span>
                                    <span class="li-value">-</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Amount :</span>
                                    <span class="li-value amount">Rs.500</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Status :</span>
                                    <span class="li-value status unpaid">Failed</span>
                                </li>
                                <li class="list-item">
                                    <span class="li-head">Send Invoice :</span>
                                    <p class="li-value">
                                        <a class="invoice-btn" href="javscript:;" aria-label="invoice-icon">
                                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/invoice.svg"
                                                alt="invoice" width="100%" height="100%">
                                        </a>
                                    </p>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <div class="followup-list">
        <p class="panel-top">
            <span class="p-head">Communication</span>
        </p>
        <div class="f-list" id="followup_list">
            {{-- @forelse (@$followups as $followup)

                <div class="single-folloup-list">
                    <div class="f-head">
                        <p class="f-col">Followup Date:<span
                                class="f-value">{{ dateMonthTimeFormat(@$followup->datetime) }}</span>
                         
                        </p>
                        <div class="head-mid">
                            <p class="f-col">Type:<span class="f-value">{{ @$followup->type }}</span></p>
                            <p class="f-col">Priority:<span class="f-value">{{ @$followup->priority }}</span></p>
                            <p class="f-col">Status:<span class="f-value">
                                    @if (@$followup->follow_up_status == 'Not Connected')
                                        <span class="badge badge-danger float-right ml-2">Not Connected</span>
                                    @else
                                        <span class="badge badge-success float-right ml-2">Connected</span>
                                    @endif
                                </span></p>
                        </div>
        
                        <div class="reminder">
                            <img src="{{ asset('backend') }}/lead-management/images/customer-detail/reminder.svg"
                                alt="reminder" width="100%" height="100%">
                            <span class="rem-head">Set Reminder</span>
                            <p class="rem-list">
                                <span class="rem-item">5 Min.</span>
                                <span class="rem-item">10 Min.</span>
                                <span class="rem-item">15 Min.</span>
                                <span class="rem-item">60 Min.</span>
                            </p>
                        </div>
                    </div>
        
                    <div class="f-body">
                        <p class="f-col">Assign To:<span
                                class="f-value">{{ ucwords(adminIdToNameGet(@$followup->assign_to)) }}</span></p>
               
                        <p class="f-col">Followup:<span class="f-value">{{ @$followup->followup_up }}</span></p>
        
                        <p class="f-col">Comment:<span class="f-value">{{ @$followup->comment }}</span></p>
                        <p class="f-col">Created By:<span class="f-value">{{ @$followup->admin->name }}</span></p>
                        <p class="f-col">Created Date:<span
                                class="f-value">{{ dateMonthTimeFormat(@$followup->created_at) }}</span></p>
        
                    </div>
                </div>
            @endforeach --}}
        </div>
    </div>
</div>

<div class="stage_popup" style="display: none;">
    <form id="stage_submit_form">
        <p class="head">Confirm the action</p>
        <div class="popup-body">
            <div class="" id="icons_stage_popup">
            </div>
            <div class="single-col" id="reason_dropdown">
                <label for="" class="field-label">Lead Type:</label>   
                <select name="dropped_reason" id="reason_dropdown_select" class="select-list">
                    <option value="" selected disabled="">Select Reason</option>
                    <option value="funds issue" {{@$user->dropped_reason == "funds issue" ? 'selected' : ''}}>funds issue</option>
                    <option value="got offer from different consultancy / universit" {{@$user->dropped_reason == "got offer from different consultancy / universit" ? 'selected' : ''}}>got offer from different consultancy / universit</option>
                    <option value="other" 
                    @if ($user->dropped_reason && !in_array($user->dropped_reason, ["funds issue", "got offer from different consultancy / universit", "other"]))
                    selected
                    @endif
                    >{{ __('other') }}</option>  
                </select>  
            </div>
            <div class="single-col" id="reason_other">
                <label for="" class="field-label">Reason:</label>
                <input type="text" class="input-field other_reason" value="{{$user->dropped_reason }}" name="dropped_reason1" placeholder="Enter Reason">
            </div>
            

            <div class="single-col" id="expire_date_div">
                <label for="" class="field-label">Expire Date:</label>
                <div class="date">
                    <input type="date" class="input-field expire_date" name="expire_date" id="expire_date" value="@if($user['expire_date'] == null)@else{{date('Y-m-d', strtotime($user['expire_date']))}}@endif">
                </div>
            </div>
            <div class="single-col">
                <button type="submit" class="common-btn close-btn">Save</button>
                <a href="javascript:;" class="common-btn close-btn" id="close_popup">Cancel</a>
            </div>
        </div>
    </form>
</div>

<!--Upload Popup-->
<div class="upload-popup" id="upload-popup">
    <div class="top">
        <a href="javascript:;" aria-label="close" class="close">
            <svg width="14" height="14" viewBox="0 0 14 14" fill="none"
                xmlns="http://www.w3.org/2000/svg">
                <path
                    d="M8.23286 6.99925L13.7414 1.4989C13.906 1.33424 13.9985 1.11091 13.9985 0.878038C13.9985 0.645168 13.906 0.421835 13.7414 0.257171C13.5767 0.0925073 13.3534 0 13.1206 0C12.8877 0 12.6644 0.0925073 12.4998 0.257171L7 5.76627L1.50024 0.257171C1.33559 0.0925073 1.11228 2.06752e-07 0.879436 2.08487e-07C0.646591 2.10222e-07 0.423282 0.0925073 0.258636 0.257171C0.0939896 0.421835 0.0014924 0.645168 0.0014924 0.878038C0.0014924 1.11091 0.0939896 1.33424 0.258636 1.4989L5.76714 6.99925L0.258636 12.4996C0.176683 12.5809 0.111635 12.6776 0.067245 12.7842C0.0228546 12.8907 0 13.005 0 13.1205C0 13.2359 0.0228546 13.3502 0.067245 13.4568C0.111635 13.5633 0.176683 13.66 0.258636 13.7413C0.33992 13.8233 0.436626 13.8884 0.543175 13.9327C0.649725 13.9771 0.764009 14 0.879436 14C0.994863 14 1.10915 13.9771 1.2157 13.9327C1.32225 13.8884 1.41895 13.8233 1.50024 13.7413L7 8.23224L12.4998 13.7413C12.581 13.8233 12.6778 13.8884 12.7843 13.9327C12.8909 13.9771 13.0051 14 13.1206 14C13.236 14 13.3503 13.9771 13.4568 13.9327C13.5634 13.8884 13.6601 13.8233 13.7414 13.7413C13.8233 13.66 13.8884 13.5633 13.9328 13.4568C13.9771 13.3502 14 13.2359 14 13.1205C14 13.005 13.9771 12.8907 13.9328 12.7842C13.8884 12.6776 13.8233 12.5809 13.7414 12.4996L8.23286 6.99925Z"
                    fill="#066AC9" />
            </svg>
        </a>
        <p class="head">Upload Document</p>
    </div>

    <div class="popup-body" id="popup-body">
        <form id="file_upload_by_ajax" class="file_upload_by_ajax" enctype="multipart/form-data">

            <input id="subcategory_name" type="hidden" name="subcategory_name" value=""
                placeholder="eg. Green Card" />
            <input id="document_subcategory_id" type="hidden" name="document_subcategory_id" value="" />



            <div id="upload_head">
                <svg id="upload_icon" class="up-icon" width="36" height="28" viewBox="0 0 36 28"
                    fill="none" xmlns="http://www.w3.org/2000/svg">
                    <!--after select file add class fill-->
                    <path
                        d="M29.5992 7.36786C28.4984 4.90883 26.5985 2.86851 24.1906 1.55956C21.7828 0.250613 18.9999 -0.25476 16.2683 0.120887C13.5368 0.496533 11.0073 1.73248 9.06743 3.63932C7.12759 5.54617 5.88442 8.01873 5.52842 10.6781C3.81065 11.078 2.30376 12.0772 1.29394 13.486C0.284109 14.8948 -0.158335 16.6151 0.0506259 18.3201C0.259587 20.0251 1.1054 21.5962 2.42744 22.7349C3.74949 23.8736 5.45569 24.5007 7.22203 24.4971C7.69987 24.4971 8.15814 24.3126 8.49603 23.9841C8.83391 23.6556 9.02373 23.2101 9.02373 22.7456C9.02373 22.2811 8.83391 21.8356 8.49603 21.5072C8.15814 21.1787 7.69987 20.9942 7.22203 20.9942C6.26634 20.9942 5.3498 20.6251 4.67403 19.9682C3.99826 19.3113 3.61861 18.4203 3.61861 17.4913C3.61861 16.5622 3.99826 15.6713 4.67403 15.0143C5.3498 14.3574 6.26634 13.9884 7.22203 13.9884C7.69987 13.9884 8.15814 13.8038 8.49603 13.4754C8.83391 13.1469 9.02373 12.7014 9.02373 12.2369C9.02834 10.1654 9.78817 8.16259 11.1683 6.58423C12.5483 5.00588 14.4593 3.95419 16.5616 3.61603C18.664 3.27786 20.8215 3.67511 22.6511 4.73719C24.4806 5.79928 25.8636 7.45743 26.5543 9.41707C26.6573 9.71804 26.8425 9.98617 27.09 10.1928C27.3375 10.3995 27.6381 10.537 27.9597 10.5905C29.1597 10.811 30.2476 11.42 31.046 12.3184C31.8445 13.2168 32.3064 14.3515 32.3566 15.5378C32.4067 16.724 32.0421 17.8918 31.3222 18.8508C30.6023 19.8098 29.5695 20.5036 28.3921 20.819C27.9286 20.9352 27.5315 21.2255 27.2882 21.6263C27.045 22.027 26.9754 22.5052 27.0949 22.9558C27.2143 23.4064 27.513 23.7924 27.9252 24.0289C28.3375 24.2654 28.8294 24.333 29.2929 24.2169C31.189 23.7298 32.8698 22.6545 34.0801 21.1544C35.2903 19.6542 35.9639 17.8111 35.9986 15.9049C36.0332 13.9987 35.4271 12.1336 34.2721 10.5929C33.1171 9.05206 31.4764 7.91975 29.5992 7.36786ZM19.3115 10.9934C19.1401 10.8339 18.9381 10.7089 18.7169 10.6256C18.2783 10.4504 17.7863 10.4504 17.3476 10.6256C17.1265 10.7089 16.9244 10.8339 16.7531 10.9934L11.3479 16.2477C11.0087 16.5775 10.8181 17.0249 10.8181 17.4913C10.8181 17.9577 11.0087 18.405 11.3479 18.7348C11.6872 19.0646 12.1473 19.2499 12.6271 19.2499C13.1069 19.2499 13.5671 19.0646 13.9064 18.7348L16.2306 16.4579V26.2485C16.2306 26.7131 16.4204 27.1586 16.7583 27.487C17.0962 27.8155 17.5544 28 18.0323 28C18.5101 28 18.9684 27.8155 19.3063 27.487C19.6442 27.1586 19.834 26.7131 19.834 26.2485V16.4579L22.1582 18.7348C22.3257 18.899 22.5249 19.0293 22.7445 19.1182C22.964 19.2071 23.1995 19.2529 23.4374 19.2529C23.6752 19.2529 23.9107 19.2071 24.1303 19.1182C24.3498 19.0293 24.5491 18.899 24.7166 18.7348C24.8855 18.572 25.0195 18.3783 25.111 18.1648C25.2024 17.9514 25.2495 17.7225 25.2495 17.4913C25.2495 17.2601 25.2024 17.0311 25.111 16.8177C25.0195 16.6043 24.8855 16.4106 24.7166 16.2477L19.3115 10.9934Z"
                        fill="#747579" />
                </svg>
                <p class="p-head">Upload file from device</p>
                <span class="subhead">Supported formats: docx, dox, xlsx, pdf, jpeg, jpg, png, txt</span>
                <span class="subhead">Size Limit: 10MB</span>
            </div>
            <div id="document_name_open" class="single-input document-name-open" style="display: none;">
            <label for="document_name" class="field-label">Document name</label>
                <input id="document_name" class="input-field" placeholder="Document name" type="text" name="document_name" value="" />



            </div>
            <div id="adding_section">
                <div class="file-list">
                    <div id="file_detail" class="files" style="display: none">
                        {{-- <img src="{{ asset('backend') }}/lead-management/images/document.svg" alt="document-icon"> --}}
                        <p class="f-name"><span id="file_title" class="">Class10Marksheet.png</span>
                            <span id="file_size" class="f-size">File size: 3.7MB</span>
                        </p>
                        <div class="f-actions">
                            {{-- <a id="replace_file" style="display: none"><img
                                    src="{{ asset('backend') }}/lead-management/images/replace.svg"
                                    class="replace" alt="icon"></a> --}}
                            <a id="remove_file"><img src="{{ asset('backend') }}/lead-management/images/cross.svg"
                                    class="remove" alt="cross"></a>
                        </div>
                    </div>
                </div>

                <a href="javascript:;" class="select-file">
                    <input type="file" id="file" class="file" name="file" id="file"
                        aria-label="file">
                    <svg width="18" height="20" viewBox="0 0 18 20" fill="none"
                        xmlns="http://www.w3.org/2000/svg">
                        <path
                            d="M17 16H16V15C16 14.7348 15.8946 14.4804 15.7071 14.2929C15.5196 14.1054 15.2652 14 15 14C14.7348 14 14.4804 14.1054 14.2929 14.2929C14.1054 14.4804 14 14.7348 14 15V16H13C12.7348 16 12.4804 16.1054 12.2929 16.2929C12.1054 16.4804 12 16.7348 12 17C12 17.2652 12.1054 17.5196 12.2929 17.7071C12.4804 17.8946 12.7348 18 13 18H14V19C14 19.2652 14.1054 19.5196 14.2929 19.7071C14.4804 19.8946 14.7348 20 15 20C15.2652 20 15.5196 19.8946 15.7071 19.7071C15.8946 19.5196 16 19.2652 16 19V18H17C17.2652 18 17.5196 17.8946 17.7071 17.7071C17.8946 17.5196 18 17.2652 18 17C18 16.7348 17.8946 16.4804 17.7071 16.2929C17.5196 16.1054 17.2652 16 17 16ZM10 18H3C2.73478 18 2.48043 17.8946 2.29289 17.7071C2.10536 17.5196 2 17.2652 2 17V3C2 2.73478 2.10536 2.48043 2.29289 2.29289C2.48043 2.10536 2.73478 2 3 2H8V5C8 5.79565 8.31607 6.55871 8.87868 7.12132C9.44129 7.68393 10.2044 8 11 8H14V11C14 11.2652 14.1054 11.5196 14.2929 11.7071C14.4804 11.8946 14.7348 12 15 12C15.2652 12 15.5196 11.8946 15.7071 11.7071C15.8946 11.5196 16 11.2652 16 11V7C16 7 16 7 16 6.94C15.9896 6.84813 15.9695 6.75763 15.94 6.67V6.58C15.8919 6.47718 15.8278 6.38267 15.75 6.3L9.75 0.3C9.66734 0.222216 9.57282 0.158081 9.47 0.11C9.43692 0.104209 9.40308 0.104209 9.37 0.11C9.27276 0.058003 9.16826 0.020922 9.06 0H3C2.20435 0 1.44129 0.316071 0.87868 0.87868C0.316071 1.44129 0 2.20435 0 3V17C0 17.7956 0.316071 18.5587 0.87868 19.1213C1.44129 19.6839 2.20435 20 3 20H10C10.2652 20 10.5196 19.8946 10.7071 19.7071C10.8946 19.5196 11 19.2652 11 19C11 18.7348 10.8946 18.4804 10.7071 18.2929C10.5196 18.1054 10.2652 18 10 18ZM10 3.41L12.59 6H11C10.7348 6 10.4804 5.89464 10.2929 5.70711C10.1054 5.51957 10 5.26522 10 5V3.41ZM5 6C4.73478 6 4.48043 6.10536 4.29289 6.29289C4.10536 6.48043 4 6.73478 4 7C4 7.26522 4.10536 7.51957 4.29289 7.70711C4.48043 7.89464 4.73478 8 5 8H6C6.26522 8 6.51957 7.89464 6.70711 7.70711C6.89464 7.51957 7 7.26522 7 7C7 6.73478 6.89464 6.48043 6.70711 6.29289C6.51957 6.10536 6.26522 6 6 6H5ZM10 14H5C4.73478 14 4.48043 14.1054 4.29289 14.2929C4.10536 14.4804 4 14.7348 4 15C4 15.2652 4.10536 15.5196 4.29289 15.7071C4.48043 15.8946 4.73478 16 5 16H10C10.2652 16 10.5196 15.8946 10.7071 15.7071C10.8946 15.5196 11 15.2652 11 15C11 14.7348 10.8946 14.4804 10.7071 14.2929C10.5196 14.1054 10.2652 14 10 14ZM11 10H5C4.73478 10 4.48043 10.1054 4.29289 10.2929C4.10536 10.4804 4 10.7348 4 11C4 11.2652 4.10536 11.5196 4.29289 11.7071C4.48043 11.8946 4.73478 12 5 12H11C11.2652 12 11.5196 11.8946 11.7071 11.7071C11.8946 11.5196 12 11.2652 12 11C12 10.7348 11.8946 10.4804 11.7071 10.2929C11.5196 10.1054 11.2652 10 11 10Z"
                            fill="#24292D" />
                    </svg>
                    <span id="file_name">
                        Select File
                    </span>
                </a>
            </div>
            <input type="submit" class="upload-btn" value="upload file">
            <div id="added_section" style="display: none;">
                <p class="p-head">Are you sure you want to upload and send this document for review?</p>
                <p class="ad-file">
                    <span id="file_subcategory" class="">Class 10 Marksheet</span>
                    <span class="subhead">1 file added</span>
                </p>
            </div>
            <input type="submit" class="upload-btn" value="upload file">
        </form>
    </div>

    <div class="popup-body" style="display: none;">
        <p class="p-head">Are you sure you want to upload and send this document for review?</p>
        <p class="ad-file">
            Class 10 Marksheet
            <span class="subhead">1 file added</span>
        </p>

        <!--View LOR Details to show-->
        <div class="view-lor">
            <p class="p-head">LOR Details</p>
            <form action="" class="lor-form">
                <div class="single-input field-not-empty">
                    <label for="Name" class="field-label">Recommender's Name</label>
                    <input type="text" class="input-field" name="name" placeholder="Recommender's Name"
                        value="xyz" required>
                </div>

                <div class="single-input field-not-empty">
                    <label for="Designation" class="field-label">Recommender's Designation</label>
                    <input type="text" class="input-field" name="designation"
                        placeholder="Recommender's Designation" value="pqrs" required>
                </div>

                <div class="single-input field-not-empty">
                    <label for="email" class="field-label">Official Email Id</label>
                    <input type="email" class="input-field" name="of-email" placeholder="Official Email Id"
                        value="xyz@gmail.com" required>
                </div>

                <div class="single-input field-not-empty">
                    <label for="Relation" class="field-label">Relation with the Student</label>
                    <input type="text" class="input-field" name="relation"
                        placeholder="Relation with the Student" value="father" required>
                </div>
            </form>
        </div>
    </div>

    {{-- /<button type="submit" class="upload-btn">Upload <i class="loader"></i></button> --}}
</div>
<div class="upload-loader"></div>

<!--LOR Popup fillable-->
<div class="lor-popup">
    <div class="top">
        <a href="javascript:;" aria-label="close" class="close">
            <svg width="14" height="14" viewBox="0 0 14 14" fill="none"
                xmlns="http://www.w3.org/2000/svg">
                <path
                    d="M8.23286 6.99925L13.7414 1.4989C13.906 1.33424 13.9985 1.11091 13.9985 0.878038C13.9985 0.645168 13.906 0.421835 13.7414 0.257171C13.5767 0.0925073 13.3534 0 13.1206 0C12.8877 0 12.6644 0.0925073 12.4998 0.257171L7 5.76627L1.50024 0.257171C1.33559 0.0925073 1.11228 2.06752e-07 0.879436 2.08487e-07C0.646591 2.10222e-07 0.423282 0.0925073 0.258636 0.257171C0.0939896 0.421835 0.0014924 0.645168 0.0014924 0.878038C0.0014924 1.11091 0.0939896 1.33424 0.258636 1.4989L5.76714 6.99925L0.258636 12.4996C0.176683 12.5809 0.111635 12.6776 0.067245 12.7842C0.0228546 12.8907 0 13.005 0 13.1205C0 13.2359 0.0228546 13.3502 0.067245 13.4568C0.111635 13.5633 0.176683 13.66 0.258636 13.7413C0.33992 13.8233 0.436626 13.8884 0.543175 13.9327C0.649725 13.9771 0.764009 14 0.879436 14C0.994863 14 1.10915 13.9771 1.2157 13.9327C1.32225 13.8884 1.41895 13.8233 1.50024 13.7413L7 8.23224L12.4998 13.7413C12.581 13.8233 12.6778 13.8884 12.7843 13.9327C12.8909 13.9771 13.0051 14 13.1206 14C13.236 14 13.3503 13.9771 13.4568 13.9327C13.5634 13.8884 13.6601 13.8233 13.7414 13.7413C13.8233 13.66 13.8884 13.5633 13.9328 13.4568C13.9771 13.3502 14 13.2359 14 13.1205C14 13.005 13.9771 12.8907 13.9328 12.7842C13.8884 12.6776 13.8233 12.5809 13.7414 12.4996L8.23286 6.99925Z"
                    fill="#066AC9" />
            </svg>
        </a>
        <p class="head">LOR Details</p>
    </div>
    <div class="popup-body">
        <form action="" class="lor-form">
            <div class="single-input">
                <label for="Name" class="field-label">Recommender's Name</label>
                <input type="text" class="input-field" name="name" placeholder="Recommender's Name"
                    value="" required>
            </div>

            <div class="single-input">
                <label for="Designation" class="field-label">Recommender's Designation</label>
                <input type="text" class="input-field" name="designation"
                    placeholder="Recommender's Designation" value="" required>
            </div>

            <div class="single-input">
                <label for="email" class="field-label">Official Email Id</label>
                <input type="email" class="input-field" name="of-email" placeholder="Official Email Id"
                    value="" required>
            </div>

            <div class="single-input">
                <label for="Relation" class="field-label">Relation with the Student</label>
                <input type="text" class="input-field" name="relation"
                    placeholder="Relation with the Student" value="" required>
            </div>
            <button type="submit" class="upload-btn up-link">Next <i class="loader"></i></button>
        </form>
    </div>

</div>

<!--Delete Popup  (Document)-->
<div class="delete-doc-popup">
    <div class="top">
        <a href="javascript:;" aria-label="close" class="close-del">
            <svg width="14" height="14" viewBox="0 0 14 14" fill="none"
                xmlns="http://www.w3.org/2000/svg">
                <path
                    d="M8.23286 6.99925L13.7414 1.4989C13.906 1.33424 13.9985 1.11091 13.9985 0.878038C13.9985 0.645168 13.906 0.421835 13.7414 0.257171C13.5767 0.0925073 13.3534 0 13.1206 0C12.8877 0 12.6644 0.0925073 12.4998 0.257171L7 5.76627L1.50024 0.257171C1.33559 0.0925073 1.11228 2.06752e-07 0.879436 2.08487e-07C0.646591 2.10222e-07 0.423282 0.0925073 0.258636 0.257171C0.0939896 0.421835 0.0014924 0.645168 0.0014924 0.878038C0.0014924 1.11091 0.0939896 1.33424 0.258636 1.4989L5.76714 6.99925L0.258636 12.4996C0.176683 12.5809 0.111635 12.6776 0.067245 12.7842C0.0228546 12.8907 0 13.005 0 13.1205C0 13.2359 0.0228546 13.3502 0.067245 13.4568C0.111635 13.5633 0.176683 13.66 0.258636 13.7413C0.33992 13.8233 0.436626 13.8884 0.543175 13.9327C0.649725 13.9771 0.764009 14 0.879436 14C0.994863 14 1.10915 13.9771 1.2157 13.9327C1.32225 13.8884 1.41895 13.8233 1.50024 13.7413L7 8.23224L12.4998 13.7413C12.581 13.8233 12.6778 13.8884 12.7843 13.9327C12.8909 13.9771 13.0051 14 13.1206 14C13.236 14 13.3503 13.9771 13.4568 13.9327C13.5634 13.8884 13.6601 13.8233 13.7414 13.7413C13.8233 13.66 13.8884 13.5633 13.9328 13.4568C13.9771 13.3502 14 13.2359 14 13.1205C14 13.005 13.9771 12.8907 13.9328 12.7842C13.8884 12.6776 13.8233 12.5809 13.7414 12.4996L8.23286 6.99925Z"
                    fill="#066AC9" />
            </svg></a>
        <p class="head">Delete Document</p>
    </div>

    <div class="popup-body">
        <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="icon">
        <p class="p-head">Are you sure you want to delete “<span>Class 10 Marksheet</span>”</p>
        <span class="subhead">All of your data will be permanently removed.This action can not be
            undone.</span>
    </div>

    <button type="submit" class="btn delete-btn">Delete</button>
</div>
<!--Success Message-->
<p class="success-msg" style="display: none;">
    <img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick">
    Perfect! Your Class 10 Marksheet is Uploaded
</p>

<!--Add / Edit Popup For Education Details-->
<div class="ed-popup" id="edit_form_open">
    <div class="popup-head">
        <p class="head-name">Education Details</p>
        <svg class="close" width="12" height="12" viewBox="0 0 12 12" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M7.05673 5.99936L11.7783 1.28477C11.9194 1.14363 11.9987 0.952206 11.9987 0.752604C11.9987 0.553001 11.9194 0.361573 11.7783 0.220433C11.6372 0.079292 11.4458 0 11.2462 0C11.0466 0 10.8552 0.079292 10.7141 0.220433L6 4.94251L1.28592 0.220433C1.14479 0.079292 0.953384 1.77216e-07 0.753802 1.78703e-07C0.554221 1.80191e-07 0.362814 0.079292 0.221688 0.220433C0.0805626 0.361573 0.0012792 0.553001 0.0012792 0.752604C0.0012792 0.952206 0.0805626 1.14363 0.221688 1.28477L4.94327 5.99936L0.221688 10.7139C0.151443 10.7836 0.0956875 10.8665 0.0576386 10.9579C0.0195897 11.0492 0 11.1472 0 11.2461C0 11.3451 0.0195897 11.443 0.0576386 11.5344C0.0956875 11.6257 0.151443 11.7086 0.221688 11.7783C0.29136 11.8485 0.37425 11.9043 0.465579 11.9424C0.556907 11.9804 0.654865 12 0.753802 12C0.85274 12 0.950698 11.9804 1.04203 11.9424C1.13335 11.9043 1.21625 11.8485 1.28592 11.7783L6 7.05621L10.7141 11.7783C10.7838 11.8485 10.8666 11.9043 10.958 11.9424C11.0493 11.9804 11.1473 12 11.2462 12C11.3451 12 11.4431 11.9804 11.5344 11.9424C11.6258 11.9043 11.7086 11.8485 11.7783 11.7783C11.8486 11.7086 11.9043 11.6257 11.9424 11.5344C11.9804 11.443 12 11.3451 12 11.2461C12 11.1472 11.9804 11.0492 11.9424 10.9579C11.9043 10.8665 11.8486 10.7836 11.7783 10.7139L7.05673 5.99936Z"
                fill="#24292D" />
        </svg>
    </div>

    <form id="education_form" class="ed-form">
        <div class="fields">
            <div class="single-input select-list">
                <label for="qualification" class="field-label">Select Your Qualification</label>
                <select class="input-field select2-hide-search" name="qualification" id="qualification" required>
                    <option value="" selected disabled>Select Your Qualification</option>
                    <option value="10th">Class 10th</option>
                    <option value="12th">Class 12th</option>
                    <option value="Diploma">Diploma</option>
                    <option value="Bachelors">Bachelors</option>
                    <option value="Masters">Masters</option>
                    {{-- <option value="PhD" >PhD</option> --}}
                </select>
            </div>

            <div class="single-input select-list year"  id="starting_year">
                <label for="admission_year" class="field-label">Start year (yyyy)</label>
                <select name="admission_year" class="input-field select2-hide-search" id="admission_year"
                    >
                    <option value="" class="input-field" disabled selected>Start year (yyyy)</option>

                </select>
            </div>

            <div class="single-input select-list year" id="ending_year_div">
                <label for="passing_year" class="field-label">Passing Year (yyyy)</label>
                <label for="passing_year" class="field-label">Passing Year (yyyy)</label>
                <select name="passing_year" id="passing_year" class="input-field select2-hide-search" required>
                    <option value="" class="input-field" disabled selected>End year (yyyy)</option>

                </select>
            </div>

            <div id="stream_input" class="single-input select-list" style="display: none;">
                <label for="stream" id="stream_label" class="field-label">Stream in 12th</label>
                <select class="input-field select2-hide-search" id="stream" name="stream">
                    <option value="" selected disabled id="default_stream">Stream in 12th</option>
                    <option value="Science">Science</option>
                    <option value="Commerce">Commerce</option>
                    <option value="Arts">Arts</option>
                    <option value="Vocational">Vocational</option>
                </select>
            </div>

            <div id="board_input" class="single-input select-list">
                <label for="education_board" id="board_label" class="field-label">Select Your Board</label>
                <select class="input-field select2-with-search" name="education_board" id="education_board">
                    <option value="" selected disabled>Select Your Board</option>

                    @foreach ($education_boards as $education_board)
                        <option value="{{ $education_board }}">{{ $education_board }}</option>
                    @endforeach
                    <option value="other">Other</option>

                </select>
            </div>

            <div id="board_other_input" class="single-input" style="display: none">
                <label for="board_other" class="field-label">Board Name</label>
                <input type="text" class="input-field" name="board_other" id="board_other"
                    placeholder="Board Name" value="" maxlength="20">
            </div>

            <div id="degree_input" class="single-input" style="display: none;">
                <label for="degree" id="degree_label" class="field-label">Degree</label>
                <input type="text" class="input-field" name="degree" id="degree"
                    placeholder="Enter Your Degree" value="" maxlength="50">
            </div>

            <div id="institute_input" class="single-input">
                <label for="institute_name" class="field-label">Institution Name</label>
                <input type="text" class="input-field" name="institute_name" id="institute_name"
                    placeholder="Enter Your Institution Name" value="" maxlength="50" required>
            </div>

            <div id="uni_board_input" class="single-input select-list">
                <label for="uni_board" class="field-label">Select Your University</label>
                <select class="input-field select2-with-search" name="uni_board" id="uni_board">
                    <option value="">Select Your University</option>
                    @foreach ($ind_universities as $education_board)
                        <option value="{{ $education_board->name }}">{{ @$education_board->name }}</option>
                    @endforeach
                    <option value="other">Other</option>
                </select>
            </div>

            <div id="uni_other_input" class="single-input" style="display: none">
                <label for="uni_other" class="field-label">University Name</label>
                <input type="text" class="input-field" name="uni_other" id="uni_other"
                    placeholder="University Name" value="" maxlength="20">
            </div>

            <div id="grade_input" class="marks-type">
                <div class="select-type single-input">
                    <select class="input-field select2-hide-search" name="grade_type" id="grade_type" required>
                        <option value="Percentage">Percentage</option>
                        <option value="CGPA (10)">CGPA (10)</option>
                        <option value="CGPA (4)">CGPA (4)</option>
                    </select>
                </div>
                <div class="single-input">
                    <label for="grade_percentage" id="mark_label" class="field-label">Marks Obtained</label>
                    <input type="text" name="grade_percentage" id="grade_percentage" class="input-field"
                        value="" placeholder="Marks Obtained Ex 99.10" maxlength="5" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1'); " required>
                </div>
            </div>

            <div id="medium_input" class="single-input select-list">
                <label for="medium" class="field-label">Medium of instruction</label>
                <select class="input-field select2-hide-search" name="medium" id="medium" required>
                    <option value="" selected disabled>Medium of instruction</option>
                    <option value="English">English</option>
                    <option value="Hindi">Hindi</option>
                    <option value="other">Other</option>
                </select>
            </div>

            <div id="medium_other_input" class="single-input" style="display: none">
                <label for="medium_other" class="field-label">Medium Name</label>
                <input type="text" class="input-field" name="medium_other" id="medium_other"
                    placeholder="Medium Name" value="" maxlength="20">
            </div>

            <div class="single-input" id="backlogs">
                <label for="backlog" class="field-label">Backlog</label>
                <input type="text" class="input-field" name="backlog" id="backlog"
                    placeholder="Enter Backlog" value="" maxlength="4" oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1');" >
            </div>

            <div class="single-input" id="gaps">
                <label for="gap" class="field-label">Gap</label>
                <input type="text" class="input-field" maxlength="4" name="gap" id="gap"
                    placeholder="Enter Gap" value="" oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1');" >
            </div>

            <div id="institute_input" class="single-input">
                <label for="remark" class="field-label">Remark</label>
                <input type="text" class="input-field" name="remark" id="remark"
                    placeholder="Enter Remark" value="" maxlength="50" >
            </div>
        </div>
        <div class="form-btns">
            <button value="2" id="skip_education_btn" class="cancel-btn" type="button">Cancel</button>
            <button type="submit" class="add-btn">
                <i id="add_new_btn" class="proceed_spin">Add</i>
            </button>
        </div>
        <input type="text" hidden name= "doc_id" id= "doc_id" value="null">
    </form>

</div>

<!--Work Experience Popup-->
<div class="work-exp-popup">
    <div class="popup-head">
        <p class="head-name">Work Experience</p>
        <svg class="close" width="12" height="12" viewBox="0 0 12 12" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M7.05673 5.99936L11.7783 1.28477C11.9194 1.14363 11.9987 0.952206 11.9987 0.752604C11.9987 0.553001 11.9194 0.361573 11.7783 0.220433C11.6372 0.079292 11.4458 0 11.2462 0C11.0466 0 10.8552 0.079292 10.7141 0.220433L6 4.94251L1.28592 0.220433C1.14479 0.079292 0.953384 1.77216e-07 0.753802 1.78703e-07C0.554221 1.80191e-07 0.362814 0.079292 0.221688 0.220433C0.0805626 0.361573 0.0012792 0.553001 0.0012792 0.752604C0.0012792 0.952206 0.0805626 1.14363 0.221688 1.28477L4.94327 5.99936L0.221688 10.7139C0.151443 10.7836 0.0956875 10.8665 0.0576386 10.9579C0.0195897 11.0492 0 11.1472 0 11.2461C0 11.3451 0.0195897 11.443 0.0576386 11.5344C0.0956875 11.6257 0.151443 11.7086 0.221688 11.7783C0.29136 11.8485 0.37425 11.9043 0.465579 11.9424C0.556907 11.9804 0.654865 12 0.753802 12C0.85274 12 0.950698 11.9804 1.04203 11.9424C1.13335 11.9043 1.21625 11.8485 1.28592 11.7783L6 7.05621L10.7141 11.7783C10.7838 11.8485 10.8666 11.9043 10.958 11.9424C11.0493 11.9804 11.1473 12 11.2462 12C11.3451 12 11.4431 11.9804 11.5344 11.9424C11.6258 11.9043 11.7086 11.8485 11.7783 11.7783C11.8486 11.7086 11.9043 11.6257 11.9424 11.5344C11.9804 11.443 12 11.3451 12 11.2461C12 11.1472 11.9804 11.0492 11.9424 10.9579C11.9043 10.8665 11.8486 10.7836 11.7783 10.7139L7.05673 5.99936Z"
                fill="#24292D" />
        </svg>
    </div>

    <form class="exp-form" id="form_work_experience">
        <div class="fields">
            <div class="single-input">
                <label for="organization_name" class="field-label">Organization Name</label>
                <input type="text" class="input-field" name="organization_name" id="organization_name"
                    placeholder="Organization Name" value="" required>
            </div>

            <div class="single-input">
                <label for="organization_type" class="field-label">Organization Type</label>
                <input type="text" class="input-field" name="organization_type" id="organization_type"
                    placeholder="Organization Type" value="" required>
            </div>

            <div class="single-input">
                <label for="organization_address" class="field-label">Organization Address</label>
                <input type="text" class="input-field" name="organization_address" id="organization_address"
                    placeholder="Organization Address" value="" required>
            </div>

            <div class="single-input">
                <label for="position_name" class="field-label">Position</label>
                <input type="text" class="input-field" name="position" id="position_name"
                    placeholder="Position" value="" required>
            </div>
            
            <div class="single-input">
                <label for="position_name" class="field-label">Experience Letter</label>
                <select class="input-field select2-hide-search" name="experience_letter" id="experience_letter" required>
                    <option value="" selected disabled>Experience Letter</option>
                    <option value="Yes">Yes</option>
                    <option value="No">No</option>
                </select>
            </div>

            <div class="single-input">
                <label for="position_name" class="field-label">Mode Of salary</label>
                <select class="input-field select2-hide-search" name="mode_of_salery" id="mode_of_salery" required>
                    <option value="" selected disabled>Mode Of salary</option>
                    <option value="In Bank Account">In Bank Account</option>
                    <option value="In Cash">In Cash</option>
                </select>
            </div>

            <div class="single-input date">
                <label for="start_date" class="field-label">Started Date</label>
                
                    

                    <input type="date"  class="input-field" name="start_date"
                    id="start_date" placeholder="End Date" value=""  max="{{ date('Y-m-d') }}" required>

            </div>

            <div class="single-input date">
                <label for="end_date" class="field-label">End Date</label>
                <input type="date" class="input-field" name="end_date"
                    id="end_date" placeholder="End Date" value=""  max="{{ date('Y-m-d') }}" required>
            </div>

            <p class="small-head">Reference <span class="small-text">(Contact Person from this Organization)</span>
            </p>

            <div class="single-input">
                <label for="name" class="field-label">Name</label>
                <input type="text" class="input-field" name="name" id="name" placeholder="Name"
                    value="" >
            </div>
            <div class="single-input">
                <label for="dpt_name" class="field-label">Department</label>
                <input type="text" class="input-field" name="department_name" id="dpt_name"
                    placeholder="Department" value="" >
            </div>

            <div class="single-input number">
                <label for="Mobile number" class="field-label">Mobile Number</label>
                <input type="text" class="input-field" name="mobile_number" id="mobile_number"
                    placeholder="Mobile number"  maxlength="15" value=""
                    oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1');">
            </div>
        </div>
        <div class="form-btns">
            <input type="text" value="" name="id" id="exp_id" hidden >
            <button class="cancel-btn" type="button">Cancel</button>
            <button type="submit" class="add-btn">
                <i class="proceed_spin">Add</i>
            </button>
        </div>
    </form>

</div>

<!--Delete Popup (Education Details)-->
<form id="delete_certificate">
    <div class="delete-ed-popup">
        <p class="head-name">Delete
            <svg class="close_delete_popup" width="14" height="14" viewBox="0 0 14 14" fill="none"
                xmlns="http://www.w3.org/2000/svg">
                <path
                    d="M8.23286 6.99925L13.7414 1.4989C13.906 1.33424 13.9985 1.11091 13.9985 0.878038C13.9985 0.645168 13.906 0.421835 13.7414 0.257171C13.5767 0.0925073 13.3534 0 13.1206 0C12.8877 0 12.6644 0.0925073 12.4998 0.257171L7 5.76627L1.50024 0.257171C1.33559 0.0925073 1.11228 2.06752e-07 0.879436 2.08487e-07C0.646591 2.10222e-07 0.423282 0.0925073 0.258636 0.257171C0.0939896 0.421835 0.0014924 0.645168 0.0014924 0.878038C0.0014924 1.11091 0.0939896 1.33424 0.258636 1.4989L5.76714 6.99925L0.258636 12.4996C0.176683 12.5809 0.111635 12.6776 0.067245 12.7842C0.0228546 12.8907 0 13.005 0 13.1205C0 13.2359 0.0228546 13.3502 0.067245 13.4568C0.111635 13.5633 0.176683 13.66 0.258636 13.7413C0.33992 13.8233 0.436626 13.8884 0.543175 13.9327C0.649725 13.9771 0.764009 14 0.879436 14C0.994863 14 1.10915 13.9771 1.2157 13.9327C1.32225 13.8884 1.41895 13.8233 1.50024 13.7413L7 8.23224L12.4998 13.7413C12.581 13.8233 12.6778 13.8884 12.7843 13.9327C12.8909 13.9771 13.0051 14 13.1206 14C13.236 14 13.3503 13.9771 13.4568 13.9327C13.5634 13.8884 13.6601 13.8233 13.7414 13.7413C13.8233 13.66 13.8884 13.5633 13.9328 13.4568C13.9771 13.3502 14 13.2359 14 13.1205C14 13.005 13.9771 12.8907 13.9328 12.7842C13.8884 12.6776 13.8233 12.5809 13.7414 12.4996L8.23286 6.99925Z"
                    fill="#24292D" />
            </svg>
        </p>
        <input type="text" hidden name="doc_delete_id" id="doc_delete_id">
        <input type="text" hidden name="doc_type" id="doc_type">
        <div class="popup-body">
            <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="icon">
            <p class="p-head">Are you sure
                you want to delete this details</p>
            <span class="sub-head">All of your data will be permanently removed. This action can not be undone.</span>
        </div>

        <button type="submit" class="delete-btn">Delete</button>
    </div>
</form>

<!--Compare Popup-->
<div class="compare-popup">
    <div class="popup-head">
        <p class="head-name">Course Comparison</p>
        <svg class="close" width="12" height="12" viewBox="0 0 12 12" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M7.05673 5.99936L11.7783 1.28477C11.9194 1.14363 11.9987 0.952206 11.9987 0.752604C11.9987 0.553001 11.9194 0.361573 11.7783 0.220433C11.6372 0.079292 11.4458 0 11.2462 0C11.0466 0 10.8552 0.079292 10.7141 0.220433L6 4.94251L1.28592 0.220433C1.14479 0.079292 0.953384 1.77216e-07 0.753802 1.78703e-07C0.554221 1.80191e-07 0.362814 0.079292 0.221688 0.220433C0.0805626 0.361573 0.0012792 0.553001 0.0012792 0.752604C0.0012792 0.952206 0.0805626 1.14363 0.221688 1.28477L4.94327 5.99936L0.221688 10.7139C0.151443 10.7836 0.0956875 10.8665 0.0576386 10.9579C0.0195897 11.0492 0 11.1472 0 11.2461C0 11.3451 0.0195897 11.443 0.0576386 11.5344C0.0956875 11.6257 0.151443 11.7086 0.221688 11.7783C0.29136 11.8485 0.37425 11.9043 0.465579 11.9424C0.556907 11.9804 0.654865 12 0.753802 12C0.85274 12 0.950698 11.9804 1.04203 11.9424C1.13335 11.9043 1.21625 11.8485 1.28592 11.7783L6 7.05621L10.7141 11.7783C10.7838 11.8485 10.8666 11.9043 10.958 11.9424C11.0493 11.9804 11.1473 12 11.2462 12C11.3451 12 11.4431 11.9804 11.5344 11.9424C11.6258 11.9043 11.7086 11.8485 11.7783 11.7783C11.8486 11.7086 11.9043 11.6257 11.9424 11.5344C11.9804 11.443 12 11.3451 12 11.2461C12 11.1472 11.9804 11.0492 11.9424 10.9579C11.9043 10.8665 11.8486 10.7836 11.7783 10.7139L7.05673 5.99936Z"
                fill="#24292D" />
        </svg>
    </div>

    <div class="popup-body">
        <ul class="popup-list">
            <li class="list-item">
                <span class="list-head">Program Name</span>
                <p class="value-list">
                    <span class="list-value">M.S. in Systems Engineering</span>
                    <span class="list-value">BA (Hons) Business Management and the Human Resource (International
                        Foundation Year)</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">University Name</span>
                <p class="value-list">
                    <span class="list-value">Johns Hopkins University</span>
                    <span class="list-value">University of Leeds, Leeds</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Location</span>
                <p class="value-list">
                    <span class="list-value">Baltimore, United States of America</span>
                    <span class="list-value">Leeds, United Kingdom</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Program level</span>
                <p class="value-list">
                    <span class="list-value">Postgraduate</span>
                    <span class="list-value">Foundation</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Duration</span>
                <p class="value-list">
                    <span class="list-value">24 Months</span>
                    <span class="list-value">12 Months</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Intake</span>
                <p class="value-list">
                    <span class="list-value">Fall, Spring, Summer, Aug, Jan, Jun</span>
                    <span class="list-value">Sep, Jan</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Standardized Requirements</span>
                <div class="value-list">
                    <ul class="list-value sub-list">
                        <li class="sub-li-item">IELTS Overall: 7</li>
                        <li class="sub-li-item">IELTS Overall: 5</li>
                        <li class="sub-li-item">TOEFL iBT Overall: 100</li>
                    </ul>
                    <ul class="list-value sub-list">work-exp-popup
                        <li class="sub-li-item">IELTS no Band Less Than: 5</li>
                        <li class="sub-li-item">GRE Score: 300</li>
                    </ul>work-exp-popup
                </div>
            </li>
            <li class="list-item">
                <span class="list-head">Application Deadline</span>
                <p class="value-list">
                    <span class="list-value">1 Mar, 15 Nov, 31 Dec, 1 Mar, 15 Nov, 31 Dec</span>
                    <span class="list-value"></span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Application Fee</span>
                <p class="value-list">
                    <span class="list-value">$75</span>
                    <span class="list-value">0</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Program Tuition Fees</span>
                <p class="value-list">
                    <span class="list-value">$58,720</span>
                    <span class="list-value">£19,800</span>
                </p>
            </li>
            <li class="list-item">
                <span class="list-head">Application Fee</span>
                <p class="value-list">
                    <span class="list-value">No</span>
                    <span class="list-value">No</span>
                </p>
            </li>
        </ul>

        <div class="btns">
            <a href="javascript:;" class="download-btn">Download Excel</a>
        </div>
    </div>
</div>

<!--create-followup-popup-->
{{-- <div class="create-followup-popup">
    <div class="popup-head">
        <svg class="close-popup" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Create Follow Up</p>
    </div>

    <div class="popup-body">
        <form action="" class="form">
            <div class="single-input">
                <label for="follow-up" class="field-label">Follow Up Subject</label>
                <select class="select-list select2-hide-search" name="follow-up" id="follow-up">
                    <option value="" selected disabled>Follow Up Subject</option>
                    <option value="Documents">Documents</option>
                    <option value="Documents">Documents</option>
                </select>
            </div>

            <div class="single-row">
                <div class="single-input date-select">
                    <label for="date" class="field-label">Date</label>
                    <input type="text" onfocus="this.type='date'" class="input-field" id="date"
                        name="date" placeholder="Date">
                </div>

                <div class="single-input time-select">
                    <label for="time" class="field-label">Time</label>
                    <input type="text" onfocus="this.type='time'" class="input-field" id="time"
                        name="time" placeholder="Time">
                </div>
            </div>

            <div class="single-row">
                <div class="single-input">
                    <label for="follow-up-type" class="field-label">Follow Up Type</label>
                    <select class="select-list select2-hide-search" name="follow-up-type" id="follow-up-type">
                        <option value="" selected disabled>Follow Up Type</option>
                        <option value="Inbound call">Inbound call</option>
                        <option value="Inbound call">Inbound call</option>
                    </select>
                </div>

                <div class="single-input">
                    <label for="follow-up-status" class="field-label">Follow Up Status</label>
                    <select class="select-list select2-hide-search" name="follow-up-status" id="follow-up-status">
                        <option value="" selected disabled>Follow Up Status</option>
                        <option value="Not Connected">Not Connected</option>
                        <option value="Connected">Connected</option>
                    </select>
                </div>
            </div>

            <div class="single-row">
                <div class="single-input">
                    <label for="priority" class="field-label">Priority</label>
                    <select class="select-list select2-hide-search" name="priority" id="priority">
                        <option value="" selected disabled>Priority</option>
                        <option value="High">High</option>
                        <option value="Medium">Medium</option>
                        <option value="Low">Low</option>
                    </select>
                </div>

                <div class="single-input">
                    <label for="assignee_name" class="field-label">Assign To</label>
                    <select class="select-list select2-hide-search" name="assignee_name" id="assignee_name">
                        <option value="" selected disabled>Assign To</option>
                        <option value="Documents">Documents</option>
                        <option value="Documents">Documents</option>
                    </select>
                </div>
            </div>

            <div class="msg-section">
                <div class="single-input">
                    <label for="comment" class="field-label">Comment</label>
                    <select class="select-list select2-hide-search" name="comment" id="comment">
                        <option value="" selected disabled>Comment</option>
                        <option value="Comment">Comment</option>
                        <option value="Comment">Comment</option>
                    </select>
                </div>
                <textarea class="input-field" name="" id="" placeholder="Write description"></textarea>
            </div>

            <div class="btns"><button class="common-btn">Save</button></div>
        </form>
    </div>
</div> --}}

<!--create-followup-popup-->
<input type="hidden" value="close" id="manage_followup_popup"> 
<div class="create-followup-popup">
    <div class="popup-head">
        <svg class="close-popup" backBtnFollows width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Complete Follow Up</p>
        <svg  class="back-btn"  onclick="backBtnFollows()" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
                d="M10.2915 7C10.2915 7.3 10.1886 7.5 9.98274 7.7L4.83696 12.7C4.4253 13.1 3.80781 13.1 3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3L8.54192 6.3C8.95358 5.9 9.57108 5.9 9.98274 6.3C10.1886 6.5 10.2915 6.7 10.2915 7Z"
                fill="#747579" />
            <path
                d="M10.2915 17C10.2915 17.3 10.1886 17.5 9.98274 17.7C9.57108 18.1 8.95358 18.1 8.54192 17.7L3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3C3.80781 10.9 4.4253 10.9 4.83696 11.3L9.98274 16.3C10.1886 16.5 10.2915 16.7 10.2915 17Z"
                fill="#747579" />
            <path
                d="M21.6122 12C21.6122 12.6 21.2005 13 20.583 13H4.11656C3.49906 13 3.0874 12.6 3.0874 12C3.0874 11.4 3.49906 11 4.11656 11H20.583C21.2005 11 21.6122 11.4 21.6122 12Z"
                fill="#747579" />
        </svg>
            
    </div>

    <div class="popup-body">
        <form class="form" id="FollowUpsForm">

            <input type="hidden" id="follow-up-id">
            <div id="customFollowUpShow">
                <div class="single-row">
                    <div class="single-input">
                        <label for="follow-up-type" class="field-label">Follow Up Type</label>
                        <select class="select-list select2-hide-search follow-up-type" name="follow-up-type"
                            id="follow-up-type">
                            <option value="">Follow Up Type</option>
                            <option value="Inbound Call">Inbound Call
                            </option>
                            <option value="Outbound Call">Outbound
                                Call</option>
                            <option value="Chat">
                                Chat</option>
                            <option value="Email">
                                Email</option>
                        </select>
                        <span class="text-danger follow-up-type-msg"></span>
                    </div>

                    <div class="single-input">
                        <label for="follow_up_status" class="field-label">Follow Up Status</label>
                        <select class="select-list select2-hide-search follow_up_status" name="follow_up_status"
                            id="follow_up_status">
                            <option value="">Follow Up Status</option>
                            <option value="Connected">{{ __('Connected') }}</option>
                            <option value="Not Connected">{{ __('Not Connected') }}</option>
                        </select>
                        <span class="text-danger follow_up_status_msg"></span>
                    </div>
                </div>

                <div class="msg-section">
                    <div class="single-input comment_connected">
                        <label for="comment" class="field-label">Comment</label>
                        <select class="select-list select2-hide-search comment_connected" name="comment_connected"
                            id="comment_connected">
                            <option value="">Select Connected</option>
                            @foreach (config('constants.follow_up_connected') as $option)
                                @if (!@empty($option))
                                    <option value="{{ $option }}">
                                        {{ $option }}
                                    </option>
                                @endif
                            @endforeach
                        </select>
                        <span class="text-danger comment_connected_msg"></span>
                    </div>
                    <div class="single-input comment_not_connected">
                        <label for="comment" class="field-label">Comment</label>
                        <select class="select-list select2-hide-search comment_not_connected" name="comment_not_connected"
                            id="comment_not_connected">
                            <option value="">Select Not Connected</option>
                            @foreach (config('constants.follow_up_not_connected') as $option)
                                @if (!@empty($option))
                                    <option value="{{ $option }}">
                                        {{ $option }}
                                    </option>
                                @endif
                            @endforeach
                        </select>
                        <span class="text-danger comment_not_connected_msg"></span>
                    </div>
                    <span class="hide_comment">
                        <textarea type="text" id="comment" class="input-field comment" rows="4" name="comment"
                            placeholder="Write Comment Description">{{ old('comment') }}</textarea>
                        <span class="text-danger comment_msg"></span>
                    </span>

                </div>
                {{-- <div class="single-input">
                    <label for="follow-up" class="field-label">Follow Up Subject</label>
                    <select class="select-list select2-hide-search follow-up" name="follow-up" id="follow-up">
                        <option value="">Follow Up Subject</option>
                        <option value="Documents">Documents</option>
                        <option value="no">No</option>
                        <option value="close">Close</option>
                    </select>
                    <span class="text-danger follow-up-msg"></span>
                </div> --}}
                <div class="single-row">
                    <div class="single-btn">
                    <div class="btns"><button class="common-btn" onclick="customFollowupSave(event,'close')">Complete/Close
                        {{-- <i
                        class="proceed_spin loader4" id="loader4" style="display: none;"></i> --}}
                    </button></div>
                    </div>
                    <div class="single-btn">
                        <div class="btns"><button class="common-btn save" onclick="customFollowupSave(event,'closenext')">Next Follow Up
                            {{-- <i class="proceed_spin" id="loader4" style="display: none;"></i> --}}
                        </button></div>
                    </div>

                </div>
            </div>
     
   
            <div id="followClose" class="cal-followup" style="display: none">
                <div class="single-row followDatetimehide">
                    <div class="single-input date-select">
                        <label for="date" class="field-label">Date</label>
                        <input type="date" class="input-field follow-up-date"
                            id="follow-up-date" name="date" placeholder="Date">
                    </div>

                    <div class="single-input time-select">
                        <label for="time" class="field-label">Time</label>
                        <input type="text" onfocus="this.type='time'" class="input-field follow-up-time"
                            id="follow-up-time" name="time" placeholder="Time">
                    </div>
                    <span class="text-danger follow-up-date-time-msg"></span>
                </div>
            
            


                <div class="single-row">
                    <div class="single-input">
                        <label for="priority" class="field-label">Priority</label>
                        <select class="select-list select2-hide-search priority" name="priority" id="priority">
                            <option value="">Priority</option>
                            <option value="High">High
                            </option>
                            <option value="Medium">Medium
                            </option>
                            <option value="Low">Low</option>
                        </select>
                        <span class="text-danger priority_msg"></span>
                    </div>
                    @if (userCan('admin.assign'))
                        <div class="single-input">
                            <label for="assignee_name" class="field-label">Assign To</label>
                            <select class="select-list select2-hide-search assignee_name" name="assignee_name"
                                id="assignee_name">
                                <option value="">Assign To</option>
                                @foreach (array_filter($admin_list, function ($item) {
                                        return $item['status'] == 1;
                                    }) as $option)
                                    @if (!@empty($option))
                                        <option value="{{ $option['id'] }}"
                                            {{ old('assign_to', Auth::user()->id) === $option['id'] ? 'selected' : '' }}>
                                            {{ $option['name'] }}
                                        </option>
                                    @endif
                                @endforeach
                            </select>
                            <span class="text-danger assignee_name_msg"></span>
                        </div>
                    @endif
                </div>
                <div class="btns"><button class="common-btn" onclick="customFollowupSave(event ,'next')">Save<i
                    class="proceed_spin loader4" id="loader4" style="display: none;"></i></button></div>
            </div>

            <div id="followCloseShow" class="cal-followup" style="display: none">
                <div class="single-row">
                    <div class="single-input date-select">
                        <label for="date" class="field-label">Stages</label>
                        <select class="select-list select2-hide-search follow_up_stage" name="follow_up_stage" id="follow_up_stage">
                            <option value="">Stages</option>
                            <option value="Student backed out / Dropped">Student backed out / Dropped
                            </option>
                            <option value="Admitted">Admitted
                            </option>
                        </select>
                        <span class="text-danger follow_up_stage_msg"></span>
                    </div>

                    <div class="single-input time-select stageSelect_hide_show">
                        <label for="time" class="field-label">Reason</label>
                        <select class="select-list select2-hide-search stageTypeSelect_show" name="follow_up_dropped_reason" id="stageSelect_hide_show">
                            <option value="" selected disabled="">Select Reason</option>
                            <option value="funds issue" >funds issue</option>
                            <option value="got offer from different consultancy / universit">got offer from different consultancy / universit</option>
                            <option value="other">{{ __('other') }}</option>                                           
                        </select>     
                        <span class="text-danger follow_up_dropped_reason_msg"></span>
                    </div>

                </div>
                {{-- <div class="single-row"> --}}
                    <div class="stageSelect_hide_show">
                        <div class="single-input  stageType_hide_show">
                            <label for="time" class="field-label">Reason</label>
                            {{-- <textarea type="text" id="follow_up_dropped_reason_comment" class="input-field follow_up_dropped_reason_comment" rows="4" name="follow_up_dropped_reason_comment"
                            placeholder="Write follow_up_dropped_reason_comment Description">{{ old('follow_up_dropped_reason_comment') }}</textarea> --}}
                            <input type="text" class="input-field" name="follow_up_dropped_reason_comment" id="follow_up_dropped_reason_comment"
                            value="{{ old('follow_up_dropped_reason_comment',@$user->dropped_reason)}}"
                            placeholder="Reason Comment" />  
                            <span class="text-danger follow_up_dropped_reason_comment_msg"></span>
                        </div>
                    </div>
                 

                    <span class="text-danger follow-up-date-time-msg"></span>
                {{-- </div> --}}
                <div class="btns"><button class="common-btn" onclick="customFollowupSave(event ,'closeSave')">Close/Save<i
                    class="proceed_spin loader4" id="loader5" style="display: none;"></i></button></div>
                    <p><span style="font-size: 0.75rem;line-height: 14px;color: #E33E3E;bottom: -17px;display: block;">*** To close the comment, you need to select one of the available stages or mark it for the next follow-up. ***</span></p>
                    
            </div>
        </form>
    </div>
</div>

<!--whatsapp-popup-->
<input type="hidden" value="close" id="manage_whatsapp_popup"> 
<div class="whatsapp-popup">
    <div class="popup-head">
        <svg class="close-popup" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Whatsapp Message</p>

        <svg  class="back-btn back_btn_whatsapp" onclick="backBtnWhatsapp()"  id="back_btn_whatsapp" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
                d="M10.2915 7C10.2915 7.3 10.1886 7.5 9.98274 7.7L4.83696 12.7C4.4253 13.1 3.80781 13.1 3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3L8.54192 6.3C8.95358 5.9 9.57108 5.9 9.98274 6.3C10.1886 6.5 10.2915 6.7 10.2915 7Z"
                fill="#747579" />
            <path
                d="M10.2915 17C10.2915 17.3 10.1886 17.5 9.98274 17.7C9.57108 18.1 8.95358 18.1 8.54192 17.7L3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3C3.80781 10.9 4.4253 10.9 4.83696 11.3L9.98274 16.3C10.1886 16.5 10.2915 16.7 10.2915 17Z"
                fill="#747579" />
            <path
                d="M21.6122 12C21.6122 12.6 21.2005 13 20.583 13H4.11656C3.49906 13 3.0874 12.6 3.0874 12C3.0874 11.4 3.49906 11 4.11656 11H20.583C21.2005 11 21.6122 11.4 21.6122 12Z"
                fill="#747579" />
        </svg>
    </div>

    <div class="popup-body">
        <form class="form" id="whatsappForm">
            <div class="customWhatsAppSendHIDE">


                <input type="hidden" id="wtemplates_id">
                <div class="single-row">
                    <div class="single-input">
                        <label for="name" class="field-label">Name</label>
                        <input type="text" class="input-field" id="Wtemplates_user_name" name="name" placeholder="Name"
                            value="">
                    </div>

                    <div class="single-input number">
                        <label for="Mobile number" class="field-label">Mobile Number</label>
                        <input type="text" class="input-field" name="phone" id="Wtemplates_user_phone"
                            placeholder="Mobile number" value=""
                            oninput="this.value = this.value.replace(/[^0-9+]/g, '').replace(/(\..*)\./g, '$1');">
                    </div>
                </div>

                <div class="msg-section">
                    <div class="single-input">
                        <label for="message" class="field-label">Templates Type</label>
                        <select class="select-list select2-hide-search" name="Wtemplates_type" id="Wtemplates_type">
                            <option value="">
                                Select Templates Type
                            </option>
                            <option value="custom">
                                Custom
                            </option>
                            <option value="country_selection">
                                Country Selection
                            </option>
                            {{-- <option
                            value="documents_europe_01">
                            Documents List for Europe 
                        </option> --}}
                        <option
                            value="onboarding_link">
                            On-Boarding Link
                        </option>
                        </select>
                    </div>
                    <input type="text" class="input-field Wdefaultshow" id="whatsApp_massage" name="whatsApp_massage" placeholder="Whatsapp Message"
                            value="" style="display: none;">
                    {{-- <textarea class="input-field Wdefaultshow" name="whatsApp_massage" id="whatsApp_massage"
                        placeholder="Whatsapp Message"></textarea> --}}
                </div>
            </div>
            <div class="card-body customWhatsAppSendShow" style="display: none;">
                <h5 class="card-title">Preview</h5>
                <div class="card-text Wdefaulthide">
                    <img src="{{ asset('backend/image/whatapp/default.png') }}" class="card-img-top" alt="user image">
                </div>
                <div class="Wdefaultshow">
                    <pre class="card-text">
Hello <span class="Wtemplates_user_name">User</span>,

<span class="Wtemplates_message"></span>

Thanks and Regards
Team Gradding
                    </pre>
                </div>
            </div>
            <div class="btns">
                <button type="button" class="common-btn customWhatsAppSendHIDE onboardingHide"
                    onclick="customWhatsAppSend('Preview')">Preview</button>
                <button class="common-btn save customWhatsAppSendShow onboardingShow" onclick="customWhatsAppSend(event)"
                    style="display: none;">Send<i class="proceed_spin" id="loader2" style="display: none;"></i></button>
            </div>
        </form>
    </div>
</div>

<!--email-popup-->
<div class="email-popup">
    <div class="popup-head">
        <svg class="close-popup" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Email Message (<span class="templates_user_name">User</span>)</p>
        <svg  class="back-btn " id="closee_mail_popup" width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path
                d="M10.2915 7C10.2915 7.3 10.1886 7.5 9.98274 7.7L4.83696 12.7C4.4253 13.1 3.80781 13.1 3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3L8.54192 6.3C8.95358 5.9 9.57108 5.9 9.98274 6.3C10.1886 6.5 10.2915 6.7 10.2915 7Z"
                fill="#747579" />
            <path
                d="M10.2915 17C10.2915 17.3 10.1886 17.5 9.98274 17.7C9.57108 18.1 8.95358 18.1 8.54192 17.7L3.39615 12.7C2.98449 12.3 2.98449 11.7 3.39615 11.3C3.80781 10.9 4.4253 10.9 4.83696 11.3L9.98274 16.3C10.1886 16.5 10.2915 16.7 10.2915 17Z"
                fill="#747579" />
            <path
                d="M21.6122 12C21.6122 12.6 21.2005 13 20.583 13H4.11656C3.49906 13 3.0874 12.6 3.0874 12C3.0874 11.4 3.49906 11 4.11656 11H20.583C21.2005 11 21.6122 11.4 21.6122 12Z"
                fill="#747579" />
        </svg>
    </div>

    <div class="popup-body">
        <form action="" class="form" id="emailPopupform">
            <input type="hidden" id="templates_id">
            <div class="single-row">
                <div class="single-input">
                    <label for="templates_type" class="field-label">Email Template</label>
                    <select class="select-list select2-hide-search" name="templates_type" id="templates_type">
                        <option value="" data-class="emailTemplate">Email Template</option>
                        <option value="enquiryEmail" data-class="enquiryEmail">Study Abroad Enquiry</option>
                        <option value="offerLetter" data-class="offerLetter">Offer Letter</option>
                        <option value="universityCourseSuggestionsEmail"
                            data-class="universityCourseSuggestionsEmail">University/Course Suggestions</option>
                        <option value="customEmail" data-class="customEmail">Custom Email</option>
                    </select>
                </div>
                <div class="single-input optionalTemplate">
                    <label for="name" class="field-label">Name</label>
                    <input type="text" class="input-field" placeholder="Subject" value="">
                </div>
                <div
                    class="single-input optional-field enquiryEmail offerLetter universityCourseSuggestionsEmail customContactInformation customEmail">
                    <label for="name"
                        class="field-label optional-field enquiryEmail offerLetter universityCourseSuggestionsEmail customContactInformation customEmail"
                        name="Subject">Name</label>
                    <input type="text"
                        class="input-field optional-field enquiryEmail offerLetter universityCourseSuggestionsEmail customContactInformation customEmail templates_subject"
                        type="text" name="templates_subject" value="Custom Email" name="name"
                        placeholder="Subject" id="templates_subject">
                </div>

                <div
                    class="single-input file-select optional-field customEmail universityCourseSuggestionsEmail customContactInformation">
                    <small id="fileHelp" class="form-text text-muted">Allowed file extensions: Maximum file size:
                        20MB each.</small>
                    <p class="file-icon">
                        <input class="file"
                            class="optional-field customFile customEmail universityCourseSuggestionsEmail customContactInformation"
                            id="customFileD" type="file" name="customFile[]" placeholder="Attachment" multiple
                            onchange="checkFiles(this)" />
                        <img src="{{ asset('backend') }}/lead-management/images/pin-1.svg" alt="pin">
                    </p>
                </div>
            </div>
            <div class="msg-section optionalTemplate">
                <textarea class="input-field" name="" id="" placeholder="Template ...."></textarea>
            </div>

            <div class="msg-section optional-field enquiryEmail">
                <textarea id="editor_enquiryEmail" rows="8" type="text" class="input-field editor1"
                    name="templates_message" placeholder="{{ __('enter') }} {{ __('notes') }}"> 
                </textarea>
            </div>
            <div class="msg-section optional-field customEmail">
                <textarea id="editor_customEmail" rows="8" type="text" class="input-field editor1"
                    name="templates_message" placeholder="{{ __('enter') }} {{ __('notes') }}">
                    
                </textarea>
            </div>
            <div class="msg-section optional-field offerLetter">
                <textarea id="editor_offerLetter" rows="8" type="text" class="input-field editor1"
                    name="templates_message" placeholder="{{ __('enter') }} {{ __('notes') }}">
                    
                </textarea>
            </div>
            <div class="msg-section optional-field universityCourseSuggestionsEmail">
                <textarea id="editor_universityCourseSuggestionsEmail" rows="8" type="text" class="input-field editor1"
                    name="templates_message" placeholder="{{ __('enter') }} {{ __('notes') }}">
                    
                </textarea>
            </div>

            <div class="msg-section optional-field customContactInformation">
                <textarea id="editor_customContactInformation" rows="8" type="text" class="input-field editor1"
                    name="templates_message" placeholder="{{ __('enter') }} {{ __('notes') }}">
                    
                </textarea>
            </div>
            <div class="btns"><button class="common-btn" onclick="customEmail(event)">Send <i class="proceed_spin"
                        id="loader3" style="display: none;"></i></button> </div>
        </form>
    </div>


</div>

<!--whatsapp-popup-->
{{-- <div class="whatsapp-popup">
    <div class="popup-head">
        <svg class="close-popup" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Whatsapp Message</p>
    </div>

    <div class="popup-body">
        <form action="" class="form">
            <div class="single-row">
                <div class="single-input">
                    <label for="name" class="field-label">Name</label>
                    <input type="text" class="input-field" id="name" name="name" placeholder="Name"
                        value="">
                </div>

                <div class="single-input number">
                    <label for="Mobile number" class="field-label">Mobile Number</label>
                    <input type="text" class="input-field" name="phone" id="phone"
                        placeholder="Mobile number" value=""
                        oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');">
                </div>
            </div>

            <div class="msg-section">
                <div class="single-input">
                    <label for="message" class="field-label">Message</label>
                    <select class="select-list select2-hide-search" name="message" id="message">
                        <option value="" selected disabled>Message</option>
                        <option value="Message">Message</option>
                        <option value="Message">Message</option>
                    </select>
                </div>
                <textarea class="input-field" name="" id="" placeholder="Whatsapp Message"></textarea>
            </div>
            <div class="btns"><button class="common-btn">Save</button></div>
        </form>
    </div>
</div>

<!--email-popup-->
<div class="email-popup">
    <div class="popup-head">
        <svg class="close-popup" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
        <p class="name">Email Message</p>
    </div>

    <div class="popup-body">
        <form action="" class="form">
            <div class="single-row">
                <div class="single-input">
                    <label for="follow-up" class="field-label">Email Template</label>
                    <select class="select-list select2-hide-search" name="follow-up" id="follow-up">
                        <option value="" selected disabled>Email Template</option>
                        <option value="">Template</option>
                        <option value="">Template</option>
                    </select>
                </div>

                <div class="single-input">
                    <label for="name" class="field-label">Name</label>
                    <input type="text" class="input-field" id="name" name="name" placeholder="Name"
                        value="">
                </div>

                <div class="single-input file-select">
                    <input type="text" class="input-field" id="file_name" name="file_name"
                        placeholder="Attachment" value="" readonly>
                    <p class="file-icon">
                        <input type="file" class="file" name="" id="">
                        <img src="{{ asset('backend') }}/lead-management/images/pin.svg" alt="pin">
                    </p>
                </div>
            </div>

            <div class="msg-section">
                <textarea class="input-field" name="" id="" placeholder="Template ...."></textarea>
            </div>
            <div class="btns"><button class="common-btn">Save</button></div>
        </form>
    </div>
</div> --}}



<div class="loader"></div>

<!--Success Popup-->
<div class="success-popup" id="success-popup">
    <p class="head" id="success_popup_heading" >Confirm the action</p>
    <div class="popup-body">
        <div class="" id="icons_success_popup">
        </div>
                {{-- <img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%"
        height="100%">
        <img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%"
        height="100%">

        <img src="{{ asset('backend') }}/lead-management/images/error-2.svg" alt="error" width="100%"
        height="100%"> --}}

        <p class="m-head">Success</p>
        <p class="small-head" id="success_popup_text">

        </p>

        <a href="javascript:;" class="common-btn close-btn">Ok</a>
    </div>
</div>

<!--Delete Popup-->
<div class="delete-popup">
    <p class="head">Confirm the action</p>
    <div class="popup-body">
        <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete" width="100%"
            height="100%">

        <p class="m-head">Are you sure you want to remove the selected course</p>

        <p class="btns"><a href="javascript:;" class="common-btn close-btn">Cancel</a><a href="javascript:;"
                class="common-btn">Ok</a></p>
    </div>
</div>

<!--View-Document-Popup-->
<div class="view-document-popup">
    <p class="popup-head">
        <svg class="close" width="24" height="24" viewBox="0 0 24 24" fill="none"
            xmlns="http://www.w3.org/2000/svg">
            <path
                d="M13.2329 11.9993L18.7414 6.4989C18.906 6.33424 18.9985 6.11091 18.9985 5.87804C18.9985 5.64517 18.906 5.42184 18.7414 5.25717C18.5767 5.09251 18.3534 5 18.1206 5C17.8877 5 17.6644 5.09251 17.4998 5.25717L12 10.7663L6.50024 5.25717C6.33559 5.09251 6.11228 5 5.87944 5C5.64659 5 5.42328 5.09251 5.25864 5.25717C5.09399 5.42184 5.00149 5.64517 5.00149 5.87804C5.00149 6.11091 5.09399 6.33424 5.25864 6.4989L10.7671 11.9993L5.25864 17.4996C5.17668 17.5809 5.11164 17.6776 5.06725 17.7842C5.02285 17.8907 5 18.005 5 18.1205C5 18.2359 5.02285 18.3502 5.06725 18.4568C5.11164 18.5633 5.17668 18.66 5.25864 18.7413C5.33992 18.8233 5.43663 18.8884 5.54318 18.9327C5.64972 18.9771 5.76401 19 5.87944 19C5.99486 19 6.10915 18.9771 6.2157 18.9327C6.32225 18.8884 6.41895 18.8233 6.50024 18.7413L12 13.2322L17.4998 18.7413C17.581 18.8233 17.6778 18.8884 17.7843 18.9327C17.8909 18.9771 18.0051 19 18.1206 19C18.236 19 18.3503 18.9771 18.4568 18.9327C18.5634 18.8884 18.6601 18.8233 18.7414 18.7413C18.8233 18.66 18.8884 18.5633 18.9328 18.4568C18.9771 18.3502 19 18.2359 19 18.1205C19 18.005 18.9771 17.8907 18.9328 17.7842C18.8884 17.6776 18.8233 17.5809 18.7414 17.4996L13.2329 11.9993Z"
                fill="#24292D" />
        </svg>
    </p>
    <div class="popup-body">
        <iframe id="view_document_iframe" src="" title="Document Viewer" frameborder="0"
                    style="width:100%;min-height:640px;display:none;"></iframe>
       
    </div>
</div>

<div class="overlay"></div>
<div class="sidebar-overlay"></div>

<!--Loader-->
<div class="spinner" style="display:none">
    <lottie-player class="popup-img" src="{{ asset('backend') }}/lead-management/js/loader.json"
        background="transparent" speed="1" width="100%" hight="100%"
        style="width: 150px; height: 150px;" loop autoplay></lottie-player>
</div>

{{-- <div class="modal fade" id="iframe_modal" tabindex="-1" aria-labelledby="exampleModal2Label"
    aria-hidden="true">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <!-- Close button at the top right corner -->
            <div class="d-flex align-items-center justify-content-end">
                <button type="button" class="float-right btn-close" data-bs-dismiss="modal"
                    aria-label="Close"></button>
            </div>
            <div class="ratio ratio-4x3 dynamic_iframe">
                <iframe id="iframe_document" src="" title="Document Viewer" frameborder="0"
                    style="width:100%;min-height:640px;display:none;"></iframe>
                <div id="show_loader" class="loading text-center"
                    style="width:100%;height:100%; display: flex; justify-content: center; align-items: center;"><img
                        src="/Loading_2.gif" alt=""></div>
            </div>
        </div>
    </div>
</div> --}}


@endsection

@section('style')
<link rel="stylesheet"
    href="{{ asset('backend') }}/lead-management/css/customer-detail.css?v={{ env('CRM_VERSION') }}">

<style>

</style>
@endsection



@section('script')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js?v={{ env('CRM_VERSION') }}"
    integrity="sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw=="
    crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="{{ asset('backend') }}/lead-management/js/common.js?v={{ env('CRM_VERSION') }}"></script>
<script src="{{ asset('backend') }}/lead-management/js/customer-detail.js?v={{ env('CRM_VERSION') }}"></script>
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js?v={{ env('CRM_VERSION') }}">
</script>

<script type="text/javascript"
    src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js?v={{ env('CRM_VERSION') }}"></script>
<script type="text/javascript"
    src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js?v={{ env('CRM_VERSION') }}"></script>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js?v={{ env('CRM_VERSION') }}">
</script>
<link rel="stylesheet" type="text/css"
    href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css?v={{ env('CRM_VERSION') }}" />


<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>



<script>
    $(document).ready(function() {
        jquary_update();
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        followup_list();
        $('textarea.textarea-input-field').each(function(){
            if($(this).is(':empty')){
                // console.log('empty');
            }else{
                this.style.height = '80px';
            }
        });
        $('.textarea-input-field').on('input', function () {
            // console.log(this.scrollHeight);
            if (this.scrollHeight >= "80") {
                this.style.height = '80px';
            } else if (this.scrollHeight >= "40") {
                this.style.height = 'auto';
                this.style.height = (this.scrollHeight) + 'px';
            }
        });
        // var totalselects=$(".multiple-select-field-value").find(".select2-selection__rendered");
        // for (let j = 0; j < totalselects.length; j++) {
        //     if ($(totalselects[j]).children().length > 1) {
        //         $(totalselects[j]).find(".select2-selection__choice").eq(0).css("display","none");
        //     } else {
        //         $(totalselects[j]).find(".select2-selection__choice").eq(0).css("display","block");
        //     }
        // }
    });



    function followup_list(){
        
        var user_id = {{ $candidate->user_id }};
        $(".upload-loader").show();
        $(".overlay").show();
        $.ajax({
            type: "post",
            url: "{{ route('lead-management.followup') }}",
            data: {
                'user_id': user_id
            },
            success: function(res) {
                // console.log(res[0]);
                // for(var value in res){}
                
                $('#followup_list').html(res);
                $(".upload-loader").hide();
                $(".overlay").hide();
            }
        });
        
    }



    

    function refresh_education_data(type) {
        var user_id = {{ $candidate->user_id }};
        
        $.ajax({
            type: "post",
            url: "{{ route('lead-management.get_documents') }}",
            data: {
                'user_id': user_id
            },
            success: function(res) {
                data_list = res;
                
                show_education_detail(data_list,type);
            }
        });
    }

    function show_education_detail(data_list,type) {
        $(".upload-loader").show();
        $(".overlay").show();
        formData = new FormData();
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("doc_id", "null");
       
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.education_detail_get') }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {

                if (res[0] == undefined) {
                    var code = "";
                    code = code +
                        '<center>No Data Avaialable</center>';
                    code = code + '';
                    $("#education-cards").html(code);
                } else {
                    var code = "";
                    for (let x in res) {


                        code = code +
                            '<div class="details"><div class="ed-head"><span class="qualification">' +
                            res[x]['qualification'] +
                            '</span> <p class="ed-del"><a href="javascript:;" data-id="' + res[x]['id'] +
                            '" class="edit_education_btn"><img src="{{ asset('backend') }}/lead-management/images/edit.svg" alt="edit-icon"></a><a  data-id="'+res[x]['id'] +'" data-passing_year="'+res[x]['passing_year'] +'"  data-year="'+res[x]['year'] +'" href="javascript:;" class="delete_education_btn del-detail"><img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete-icon"></a></p></div><ul class="list-type2">';
                        '" href="javascript:;" class="delete_education_btn del-detail"><img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete-icon"></a></p></div><ul class="list-type2">';
                        
                            if (res[x]['qualification'] == "10th" || res[x]['qualification'] == "12th") {
                               

                            } else{
                                code = code + '<li class="ed-list"><span class="ed-value">Start Year</span> <span class="passing_year" id="10_pass_year">' + (res[x]['year'] != null && res[x]['year'] !== "" ? res[x]['year'] : '-') + '</span></li>';
                            }

                        code = code + '<li class="ed-list"><span class="ed-value">Passing Year</span> <span class="passing_year" id="10_pass_year">' + (res[x]['passing_year'] != null && res[x]['passing_year'] !== "" ? res[x]['passing_year'] : '-') + '</span></li>';

                        code = code +'<li class="ed-list"><span class="ed-value">Board / University</span> <span class="passing_year" id="10_pass_year">' + (res[x]['education_board'] != null && res[x]['education_board'] !== "" ? res[x]['education_board'] : '-') + '</span></li>';

                        code = code +'<li class="ed-list"><span class="ed-value">Institute</span> <span class="passing_year" id="10_pass_year">' + (res[x]['institute_name'] != null && res[x]['educainstitute_nametion_board'] !== "" ? res[x]['institute_name'] : '-') + '</span></li>';

                        code = code +'<li class="ed-list"><span class="ed-value">Mark</span> <span class="passing_year" id="10_pass_year">' + (res[x]['grade_percentage'] != null && res[x]['grade_percentage'] !== "" ? res[x]['grade_percentage'] : '-') + ' '+res[x]['grade_type']+' </span></li>';

                        code = code + '<li class="ed-list"><span class="ed-value">Medium</span> <span class="passing_year" id="10_pass_year">' + (res[x]['medium'] == "hindi" ? "Hindi" : (res[x]['medium'] == "english" ? "English" : res[x]['medium'])) + '</span></li>';

                            
                            if (res[x]['qualification'] == "10th" || res[x]['qualification'] == "12th") {
                               

                            } else{
                                code = code +'<li class="ed-list"><span class="ed-value">Backlog</span> <span class="passing_year" id="10_pass_year">' + (res[x]['backlogs'] != null && res[x]['backlogs'] !== "" ? res[x]['backlogs'] : '-') + '</span></li>';

                            code = code +
                                '<li class="ed-list"><span class="ed-value">Gap</span> <span class="passing_year" id="10_pass_year">' + (res[x]['gaps'] != null && res[x]['gaps'] !== "" ? res[x]['gaps'] : '-') + '</span></li>';
                             }
                        
                        if (res[x]['medium'] != null && res[x]['medium'] != "") {
                            var flag = 0;
                            for (let w in data_list['data']['document']) {

                                if (data_list['data']['document'][w]['document_subcategory_id'] == '37' &&
                                    res[x]['qualification'] == "1th") {
                                    flag = 1;
                                    break;
                                } else if (data_list['data']['document'][w]['document_subcategory_id'] ==
                                    '12' && res[x]['qualification'] == "12th") {
                                    flag = 1;
                                    break;
                                } else if (data_list['data']['document'][w]['document_subcategory_id'] ==
                                    '' && res[x]['qualification'] == "Diploma") {
                                    flag = 1;
                                    break;
                                } else if (data_list['data']['document'][w]['document_subcategory_id'] ==
                                    '8' && res[x]['qualification'] == "Bachelors") {
                                    flag = 1;
                                    break;
                                } else if (data_list['data']['document'][w]['document_subcategory_id'] ==
                                    '11' && res[x]['qualification'] == "Masters") {
                                    flag = 1;
                                    break;
                                }
                            }
                            code = code +
                                '<li class="ed-list"><span class="ed-value">Document Status</span> <span class="passing_year" id="10_pass_year">';
                            if (flag == 0) {
                                code = code + 'Panding';
                            } else {
                                code = code + 'Document Uploaded';
                            }
                            code = code + '</span></li>';
                        }

                        code = code + '<li class="ed-list"><span class="ed-value">Remark</span> <span class="remark" id="remark">' + (res[x]['remark'] != null && res[x]['remark'] !== "" ? res[x]['remark'] : '-') + '</span></li>';


                        code = code + '</ul></div>';
                    }
                    $("#education-cards").html(code);


                    $(".delete_education_btn").click(function() {
                        $(".delete-ed-popup").show();
                        var dataIdValue = $(this).attr("data-id");
                        $('#doc_delete_id').val(dataIdValue);
                        
                        $('#doc_type').attr('value', 'education');

                        $('.overlay').show();

                    })

                    $(".delete-doc").click(function() {
                        $(".delete-ed-popup").show();
                        var dataIdValue = $(this).attr("data-id");
                        $('#doc_delete_id').val(dataIdValue);
                        $('#doc_type').attr('value', 'document');
                        $('.overlay').show();

                    })


                    // $(".delete_webinar_btn").click(function() {
                    //     $(".delete-ed-popup").show();
                    //     var dataIdValue = $(this).attr("data-id");
                    //     $('#doc_delete_id').val(dataIdValue);
                        
                    //     $('#doc_type').attr('value', 'webinar_delete');

                    //     $('.overlay').show();

                    // })

                    

                    $(".edit_education_btn").click(function(e) {
                        $('.overlay').show();
                        var dataIdValue = $(this).attr("data-id");
                        $('#qualification').attr('data-id', dataIdValue);
                        
                        formData.append("user_id", {{ $candidate->user_id }});
                        formData.append("doc_id", dataIdValue);

                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: 'POST',
                            url: "{{ route('lead-management.education_detail_get') }}",
                            data: formData,
                            cache: false,
                            processData: false,
                            contentType: false,
                            success: (res) => {
                               
                                $('#edit_form_open').show();
                                $("#qualification").val(res.qualification).trigger(
                                    "change");
                                $("#admission_year").val(res.year).trigger("change");
                                
                                if (res.qualification == "10th" || res.qualification ==
                                    "12th") {
                                    if ($("#education_board option[value='" + res
                                            .education_board + "']").length > 0) {
                                        $("#education_board").val(res.education_board)
                                            .trigger("change");
                                    } else {
                                        $("#education_board").val("other").trigger(
                                            "change");
                                        $("#board_other").val(res.education_board);
                                    }
                                } else if (res.qualification == "Bachelors" || res
                                    .qualification == "Masters" ||
                                    res.qualification == "Diploma") {

                                    if ($("#uni_board option[value='" + res
                                            .education_board + "']").length > 0) {
                                        $("#uni_board").val(res.education_board)
                                            .trigger("change");
                                    } else {
                                        $("#uni_board").val("other").trigger("change");
                                        $("#uni_other").val(res.education_board);
                                    }
                                }
                                $("#board_other_input").val(res.board_other_input)
                                    .trigger("change");
                                $("#doc_id").val(res.id);
                                $("#institute_name").val(res.institute_name);
                                $("#grade_type").val(res.grade_type).trigger("change");
                                if(res.medium == "hindi"){
                                    $("#medium").val(res.medium).trigger("change");
                                }else if(res.medium == "hindi"){
                                    $("#medium").val(res.medium).trigger("change");
                                }else{
                                    $("#medium").val("other").trigger("change");
                                    $("#medium_other").val(res.medium);
                                }
                                $("#remark").val(res.remark);
                                $("#backlog").val(res.backlogs);
                                $("#gap").val(res.gaps);
                                $("#grade_percentage").val(res.grade_percentage);
                                $("#passing_year").val(res.passing_year).trigger(
                                    "change");
                                $("#year").val(res.year).trigger(
                                    "change");
                            }
                        });
                    })
                }
                if(type == "overlay_show"){

                }else{
                    $(".overlay").hide();
                }
                $(".upload-loader").hide();

            }
        });

    }
    function delete_webinar_btn(id){
        $('.overlay').show();
        $(".delete-ed-popup").show();
        var dataIdValue = id;
        $('#doc_delete_id').val(dataIdValue);
        
        $('#doc_type').attr('value', 'webinar_delete');

        
    }

    

    $("#grade_type").change(function(e) {
        var grade = $("#grade_type").val();
        
        if (grade == "Percentage") {
            $("#grade_percentage").val("");
            $("#grade_percentage").attr("maxlength", 3);
            // $("#grade_percentage").attr("max", "100");
            
        } else if (grade == "CGPA (10)") {
            $("#grade_percentage").attr("maxlength", 2);
            $("#grade_percentage").val("");
            // $("#grade_percentage").attr("max", 10);
            
        } else if (grade == "CGPA (4)") {
            $("#grade_percentage").attr("maxlength", 1);
            $("#grade_percentage").val("");
            // $("#grade_percentage").attr("max", 4);
            
        }
    });

    $('#grade_percentage').keyup(function(e) {
        

        var grade = $("#grade_type").val();
        if (grade == "Percentage") {
            
            $("#grade_percentage").attr("maxlength", 5);
            // $("#grade_percentage").attr("max", "100");
            if ($("#grade_percentage").val() > 100) {
                $("#grade_percentage").val('100');
            }
           
            
        } else if (grade == "CGPA (10)") {
            $("#grade_percentage").attr("maxlength", 5);
            // $("#grade_percentage").attr("max", 10);
            if ($("#grade_percentage").val() > 10) {
                    $("#grade_percentage").val('10');
                }
            
        } else if (grade == "CGPA (4)") {
            $("#grade_percentage").attr("maxlength", 4);
            // $("#grade_percentage").attr("max", 4);
            if ($("#grade_percentage").val() > 4) {
                    $("#grade_percentage").val('4');
                }
            
        }
    });




    $("#delete_certificate").submit(function(e) {
        e.preventDefault();
        var doc_type = document.getElementById('doc_type').value;
        $(".upload-loader").hide();
        $(".overlay").hide();
        var serializedData = $('#delete_certificate').serialize();
        var formData = new FormData();
        var dataArray = serializedData.split('&');
        for (var i = 0; i < dataArray.length; i++) {
            var item = dataArray[i].split('=');
            var key = decodeURIComponent(item[0]);
            var value = decodeURIComponent(item[1]);
            formData.append(key, value);
        }
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("doc_type", doc_type);

        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.education_detail_delete') }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $('.delete-ed-popup').hide();
                $('.overlay').show();
                code = "";
                if (res.status == 1) {
                    $('.m-head').html("Success");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                    );
                    $('#success-popup').css('display', 'block');

                } else if (res.status == 2) {
                    $('.m-head').html("Failed Try Again");
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                } else {
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }
                if (res.type == "education") {
                    refresh_education_data("overlay_hide");
                } else if (res.type == "document") {
                    refresh_education_data("overlay_show");
                    refreshDocuments("overlay_show");
                }
                else if (res.type == "work_experience") {
                    show_form_work_experience("overlay_show");
                    
                }
                else if (res.type == "webinar_delete") {
                    $('#tbody_webinar_list1').html(res.code);
                    
                }
                


            }
        });
    });

    $('#form_work_experience').on('submit', function(e) {
        e.preventDefault();
        $(".upload-loader").show();
        $(".overlay").show();   
        formData = new FormData();
        var form = document.getElementById('form_work_experience');
        var inputs = form.querySelectorAll('input[name]');
        var values = {};
        inputs.forEach(function(input) {
            formData.append(input.name, input.value);
        });

        var inputs = form.querySelectorAll('select[name]');

        var values = {};
        inputs.forEach(function(input) {
            formData.append(input.name, input.value);
        });

        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("type", "work_experience");


        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $('.delete-ed-popup').hide();
                
                $('#edit_form_open').hide();
                $('#success_popup_heading').html("Education Detail");
                $(".upload-loader").hide();
                
                show_form_work_experience("overlay_show");
                $(".overlay").show();  
                code = "";
                if (res.status == 1) {
                    $('.m-head').html("Success");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                    );
                    $('#success-popup').css('display', 'block');
                    $('.work-exp-popup').hide()
                    $('.overlay').show();

                } else if (res.status == 2) {
                    $('.m-head').html("Failed Try Again");
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                } else if(res.status == 3) {
                    for (const fieldName in res['error']) {
                        if (res['error'].hasOwnProperty(fieldName)) {
                            const errorMessages = res['error'][fieldName];
                            if (errorMessages.length > 0) {
                                code = code + `<p> ${fieldName} : ${errorMessages[0]} </p>`;
                            
                            }
                        }
                    }
                    $('.m-head').html("Failed Try Again");
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }
                

            }
        });
    });
    function show_form_work_experience(type) {
        formData = new FormData();
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("id", "null");
        $(".upload-loader").show();
        $(".overlay").show();
        
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.form_work_experience_get') }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                // console.log(res);
                if(type == "overlay_show"){

                }else{
                    $(".overlay").hide();
                }
                $(".upload-loader").hide();
                
                code = "";
                if (res.length<=0) {
                    $('#experience_show_div').hide();
                    if (res[0] == undefined) {
                    var code = "";
                    code = code +
                        '<br><center>No Data Avaialable</center>';
                    code = code + '';
                    $("#word_experience_null").html(code);
                    $("#word_experience_null").show();
                }
                } else {
                    $("#word_experience_null").hide();
                    $('#experience_show_div').show();
                    for(var value in res){
                        code = code +`
                        <tr>
                            <td class="t-col">${res[value]['organization_name'] !== null ? res[value]['organization_name'] : ''}</td>

                            <td class="t-col">${res[value]['start_date'] !== null ? res[value]['start_date'] : ''}</td>
                            <td class="t-col">${res[value]['end_date'] !== null ? res[value]['end_date'] : ''}</td>
                            <td class="t-col">${res[value]['position'] !== null ? res[value]['position'] : ''}</td>
                            <td class="t-col">${res[value]['organization_type'] !== null ? res[value]['organization_type'] : ''}</td>
                            <td class="t-col"><span class="address">${res[value]['organization_address'] !== null ? res[value]['organization_address'] : ''}</span></td>
                            <td class="t-col">${res[value]['name'] !== null ? res[value]['name'] : ''}</td>
                            <td class="t-col">${res[value]['department_name'] !== null ? res[value]['department_name'] : ''}</td>
                            <td class="t-col">${res[value]['experience_letter'] !== null ? res[value]['experience_letter'] : ''}</td>
                            <td class="t-col">${res[value]['mode_of_salery'] !== null ? res[value]['mode_of_salery'] : ''}</td>
                            <td class="t-col">${res[value]['mobile_number'] !== null ? res[value]['mobile_number'] : ''}</td>

                            
                            <td class="t-col">
                                <p class="users-btns">
                                    <a href="javascript:;" class="single-btn edit-work-exp" data-id="${res[value]['id']}">
                                        <img src="{{ asset('backend') }}/lead-management/images/edit.svg"
                                            alt="edit" width="100%" height="100%">
                                    </a>
                                    <a href="javascript:;" class="single-btn delete-work-exp" data-id="${res[value]['id']}">
                                        <img src="{{ asset('backend') }}/lead-management/images/delete.svg"
                                            alt="delete" width="100%" height="100%">
                                    </a>
                                </p>
                            </td>
                        </tr>
                    `;
                    }
                    
                    code = code + '';
                    $("#work_exp_tbody").html(code);

                    $(".edit-work-exp").click(function(e) {
                        $('.overlay').show();   
                        var dataIdValue = $(this).attr("data-id");
                        formData.append("user_id", {{ $candidate->user_id }});
                        formData.append("id", dataIdValue);

                        $.ajaxSetup({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            }
                        });
                        $.ajax({
                            type: 'POST',
                            url: "{{ route('lead-management.form_work_experience_get') }}",
                            data: formData,
                            cache: false,
                            processData: false,
                            contentType: false,
                            success: (res) => {
                                // console.log(res.start_date);
                                $('.work-exp-popup').show();
                                $("#organization_name").val(res.organization_name);
                                $("#organization_type").val(res.organization_type);
                                $("#organization_address").val(res.organization_address);
                                $("#position_name").val(res.position);
                                $("#start_date").attr("value", res.start_date);
                                $("#end_date").attr("value", res.end_date);
                                $("#name").val(res.name);
                                $("#dpt_name").val(res.department_name);
                                $("#mobile_number").val(res.mobile_number);
                                $('#exp_id').val(res.id);
                                $("#experience_letter").val(res.experience_letter).trigger("change");
                                $("#mode_of_salery").val(res.mode_of_salery).trigger("change");
                            }
                        });
                    })
                }
                $(".delete-work-exp").click(function() {
                    
                    $(".delete-ed-popup").show();
                    var dataIdValue = $(this).attr("data-id");
                    $('#doc_delete_id').val(dataIdValue);
                    
                    $('#doc_type').attr('value', 'work_experience');

                    $('.overlay').show();

                })

                $(".delete-doc").click(function() {
                    $(".delete-ed-popup").show();
                    var dataIdValue = $(this).attr("data-id");
                    $('#doc_delete_id').val(dataIdValue);
                    $('#doc_type').attr('value', 'document');
                    $('.overlay').show();

                })
            }
        });
    }

    $(".close_delete_popup").click(function(e) {
        $(".delete-ed-popup").hide();
        $('.overlay').hide();

    });

    $("#close_popup").click(function(e) {
        $(".stage_popup").hide();
        $('.overlay').hide();

    });
    

    function jquary_update() {
        $(".close,#skip_education_btn").click(function(e) {
            $('#edit_form_open').hide();
            $(".upload-loader").hide();
            $(".overlay").hide();
        });

        $('#qualification').on('change', function(e) {   

            var qualification_data = document.getElementById('qualification').value;
            if (qualification_data == "10th" || qualification_data == "12th") {
                document.getElementById('board_input').style.display = "inline";
                document.getElementById('board_input').required = true;
                document.getElementById('uni_board_input').style.display = "none";
                document.getElementById('uni_board_input').required = false;
                document.getElementById('backlogs').style.display = "none";
                document.getElementById('gaps').style.display = "none";
                $('#starting_year').hide();

            } else if (qualification_data == "Bachelors" || qualification_data == "Masters" ||
                qualification_data ==
                "Diploma") {
                document.getElementById('board_input').style.display = "none";
                document.getElementById('uni_board_input').style.display = "inline";
                document.getElementById('uni_board_input').required = true;
                document.getElementById('board_input').required = false;
                document.getElementById('backlogs').style.display = "inline-block";
                document.getElementById('gaps').style.display = "inline-block";
                $('#starting_year').show();
                $('#starting_year').show();
            }
            
            var formData = new FormData();
            formData.append("user_id", {{ $candidate->user_id }});
            formData.append("qualification", qualification_data);
            var dataIdValue = $(this).attr("data-id");
                        
            formData.append("doc_id", dataIdValue);
            $.ajax({
                type: 'POST',
                url: "{{ route('lead-management.check_qualification_year') }}",
                data: formData,
                cache: false,
                processData: false,
                contentType: false,
                success: (res) => {
                //    console.log(res['max']);
                    
                    $('#admission_year').empty();
                    for (var i = res.min; i <= res.max; i++) {
                        var newOption = new Option(i, i);
                        $('#admission_year').append(newOption);
                    }
                    $('#passing_year').empty();
                    for (var i = res.min; i <= res.max; i++) {
                        var newOption = new Option(i, i);
                        $('#passing_year').append(newOption);
                    }
                    if (res['education_detail'].hasOwnProperty('passing_year') && res['education_detail'].passing_year != null && res['education_detail'].passing_year != "") {
                        $("#passing_year").val(res['education_detail'].passing_year).trigger("change");
                    } else {
                        // Handle the case when 'passing_year' key does not exist
                        // For example, you can set a default value or display an error message
                        console.log("Passing year not found in education details");
                    }


                    
                    $("#admission_year").val(res['education_detail'].year).trigger(
                        "change");
                }
            });

        });

        $('#admission_year').change(function() {
            var admission_year = $('#admission_year').val();
            var passing_year = $('#passing_year').val();
            if (admission_year > passing_year) {
                $('#passing_year').empty();
                var admission_year_lastValue = $('#admission_year option:last-child').val();
                for (var i = admission_year; i <= admission_year_lastValue; i++) {
                    var newOption = new Option(i, i);
                    $('#passing_year').append(newOption);
                }
            }
        });

        $('#education_board').on('change', function(e) {
            var education_board = document.getElementById('education_board').value;
            if (education_board == "other") {
                document.getElementById('board_other_input').style.display = "inline";
            } else {
                document.getElementById('board_other_input').style.display = "none";
            }
        });

        $('#uni_board').on('change', function(e) {
            var uni_board = document.getElementById('uni_board').value;
            if (uni_board == "other") {
                document.getElementById('uni_other_input').style.display = "inline";
            } else {
                document.getElementById('uni_other_input').style.display = "none";
            }
        });

        $('#education_form').on('submit', function(e) {
            e.preventDefault();
            $(".upload-loader").show();
            $(".overlay").show();
            formData = new FormData();
            var form = document.getElementById('education_form');
            var inputs = form.querySelectorAll('input[name]');
            var values = {};
            inputs.forEach(function(input) {
                formData.append(input.name, input.value);
            });

            var inputs = form.querySelectorAll('select[name]');

            var values = {};
            inputs.forEach(function(input) {
                formData.append(input.name, input.value);
            });

            formData.append("user_id", {{ $candidate->user_id }});
            formData.append("type", "education_detail");


            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            $.ajax({
                type: 'POST',
                url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
                data: formData,
                cache: false,
                processData: false,
                contentType: false,
                success: (res) => {
                    $('.delete-ed-popup').hide();
                    $('.overlay').show();
                    $('#edit_form_open').hide();
                    $('#success_popup_heading').html("Education Detail");
                    $(".upload-popup").hide();
                    
                    code = "";
                    if (res.status == 1) {
                        $('.m-head').html("Success");
                        $(".overlay").show();
                        code = code + res.message;
                        $('#success_popup_text').html(code);
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                        );
                        $('#success-popup').css('display', 'block');

                    } else if (res.status == 2) {
                        $('.m-head').html("Failed Try Again");
                        code = code + res.message;
                        $(".overlay").show();
                        $('#success_popup_text').html(code);
                        $('#success-popup').css('display', 'block');
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                        );


                    } else if (res.status == 3) {
                        $(".overlay").show();
                        for (const fieldName in res['error']) {
                            if (res['error'].hasOwnProperty(fieldName)) {
                                const errorMessages = res['error'][fieldName];
                                if (errorMessages.length > 0) {
                                    code = code + `<p><strong> ${fieldName} : </strong>${errorMessages[0]} </p>`;
                                
                                }
                            }
                        }
                        $('.m-head').html("Failed Try Again");
                        $('#success_popup_text').html(code);
                        $('#success-popup').css('display', 'block');
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                        );

                    } else {
                        $(".overlay").show();
                        code = code + res.message;
                        $('#success_popup_text').html(code);
                        $('#success-popup').css('display', 'block');
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                        );
                    }
                    refresh_education_data("overlay_show");

                }
            });

        });

        $("#add_more_btn").on("click", function() {
            var form = document.getElementById('education_form');
            form.reset();
            $('#doc_id').val('null');
            $('#edit_form_open').show();
            $("#qualification").val("").trigger(
                "change");
            $("#admission_year").val("").trigger("change");
            
            
            $("#education_board").val("")
                        .trigger("change");
            $("#board_other_input").val("")
                .trigger("change");
            
            $("#institute_name").val("");
            $("#grade_type").val("").trigger("change");
            $("#medium").val("").trigger("change");
            $("#backlog").val("");
            $("#gap").val("");
            $("#uni_board").val("").trigger(
                "change");
            $("#grade_percentage").val("");
            $("#remark").val("");
            $("#medium_other").val('');
            $("#passing_year").val("").trigger(
                "change");
        });

        $("#add_more_btn").click(function(e) {
            $('#grade_type').val("Percentage").css("color", "#B0B2B5");
            $("#qualification,#grade_type").trigger("change");
        })

        $(".add-exp-btn").on("click", function() {
            var newform1 = document.getElementById('form_work_experience');
            newform1.reset();
            $('#exp_id').val(null);
            $('.work-exp-popup').show();
            $("#organization_name").val("");
            $("#organization_type").val("");
            $("#organization_address").val("");
            $("#position_name").val("");
            $("#start_date").attr("value", "");
            $("#end_date").attr("value", "");
            $("#name").val("");
            $("#dpt_name").val("");
            $("#mobile_number").val("");
            
            $("#experience_letter").val("").trigger("change");
            $("#mode_of_salery").val("").trigger("change");
        });

        $(".edit-work-exp").on("click", function() {
            var dataIdValue = $(this).attr("data-id"); 
            $('#exp_id').val(dataIdValue);
        });
    }   
    
        // var change_edit_save_personal_info = 0;
        // $('#personal_info_form_edit, #study_abroad_form_edit, #budget_preference_form_edit, #test_status_form_edit, #webinar_form_edit,#personal_info_form_cancel, #study_abroad_form_cancel, #budget_preference_form_cancel, #test_status_form_cancel, #webinar_form_cancel,#delete_webinar').on('click', function(e) {

        function save_data(id){
            // e.preventDefault();
            // console.log(id);
            var clickedId = id;
            var operation_type = $('#'+id).attr('data-operation_type');
        
            
            if(operation_type == "cancel"){
                $(".overlay").show();
                
                clickedId = clickedId.slice(0, -7);
                var form = document.getElementById(clickedId);
                
                var inputs = form.getElementsByTagName('input');
                var select = form.getElementsByTagName('select');

                document.getElementById(clickedId+'_edit_button').innerHTML = "Edit";
                document.getElementById(clickedId+'_edit_image').src =
                    "{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg";
                    document.getElementById(clickedId + '_cancel_button').style.display = "none";
                for (let i = 0; i < inputs.length; i++) {
                    inputs[i].readOnly = true;
                }
                for (let i = 0; i < select.length; i++) {
                    select[i].disabled = true;
                }
                change_edit_save_personal_info = 0;
                form = null;
                save_form_data(form, clickedId, operation_type);

            }
            else if(operation_type == "delete"){
                
                save_form_data(form, clickedId, operation_type);
            }
            else{
                clickedId = clickedId.slice(0, -5);
                var form = document.getElementById(clickedId);
                // console.log(form);
                var inputs = form.getElementsByTagName('input');
                var select = form.getElementsByTagName('select');
                if (document.getElementById(clickedId+'_edit_button').innerHTML == "Edit") {
                    
                    document.getElementById(clickedId+'_edit_button').innerHTML = "Save";
                    document.getElementById(clickedId + '_cancel_button').style.display = "block";
                    document.getElementById(clickedId+'_edit_image').src =
                        "{{ asset('backend') }}/lead-management/images/customer-detail/file-save.svg";
                    for (let i = 0; i < inputs.length; i++) {
                        inputs[i].readOnly = false;
                    }
                    for (let i = 0; i < select.length; i++) {
                        select[i].disabled = false;
                    }
                    change_edit_save_personal_info = 1;
                }else if(clickedId == "webinar_form"){
                    save_form_data(form , clickedId, operation_type);
                } 
                else {
                    document.getElementById(clickedId+'_edit_button').innerHTML = "Edit";
                    document.getElementById(clickedId+'_edit_image').src =
                        "{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg";
                        document.getElementById(clickedId + '_cancel_button').style.display = "none";
                    for (let i = 0; i < inputs.length; i++) {
                        inputs[i].readOnly = true;
                    }
                    for (let i = 0; i < select.length; i++) {
                        select[i].disabled = true;
                    }
                    var form = document.getElementById(clickedId);
                    change_edit_save_personal_info = 0;
                    save_form_data(form , clickedId ,operation_type);
                }
                
            }
            
        }
   
        $('#start_date, #end_date').change(function() {
            var startDate = new Date($('#start_date').val());
            var endDate = new Date($('#end_date').val());

            // Compare the two dates
            if (startDate > endDate) {
                // console.log("Start date is after end date");
                
                var minDate = startDate.toISOString().split('T')[0]; // Convert to string in format "YYYY-MM-DD"
                $('#end_date').attr('min', minDate);
                $('#end_date').attr('value', minDate);
                $('#end_date').html(minDate);
                $('#end_date').val(minDate);
            } else if (startDate < endDate) {
                var minDate = startDate.toISOString().split('T')[0]; // Convert to string in format "YYYY-MM-DD"
                $('#end_date').attr('min', minDate);
                $('#end_date').attr('value', minDate);
                // $('#end_date').html(minDate);
                // $('#end_date').val(minDate);
                // console.log("End date is after start date");
            } else {
                
            //    console.log("Start date and end date are the same"); 
            }
        });
    


    function save_form_data(form, clickedId, operation_type) {

        // console.log(clickedId);
        $(".upload-loader").show();
        $(".overlay").show();
        var form = document.getElementById(clickedId);
        if(operation_type == "delete"){

            formData = new FormData();
            operation_id = $('#'+clickedId).attr('data-operation_id');
            formData.append("operation_type", operation_type);
            formData.append("operation_id", operation_id);
            formData.append("user_id", {{ $candidate->user_id }});
            formData.append("type", clickedId); 
            $(".upload-loader").hide();
            $(".overlay").hide();
        }
        else{
            formData = new FormData(); 
            var inputs = form.querySelectorAll('input[name]');
            var values = {};
            inputs.forEach(function(input) {
                formData.append(input.name, input.value);
            });
            
            var textareas = form.querySelectorAll('textarea[name]');
            var values = {};
            //console.log(textareas);
            textareas.forEach(function(textarea) {
                formData.append(textarea.name, textarea.value);
                
            });
            var selects = form.querySelectorAll('select[name]');
            selects.forEach(function(select) {
                var selectedOptions = Array.from(select.selectedOptions).map(option => option.value);
                formData.append(select.name, selectedOptions);
            });
            
            formData.append("operation_type", operation_type);
            formData.append("user_id", {{ $candidate->user_id }});
            formData.append("type", clickedId);
            
        }
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $(".upload-loader").hide();
                $(".overlay").hide();
                var form = document.getElementById(clickedId);
                // console.log(form);
                if(clickedId == "webinar_form"){
                    $('#tbody_webinar_list1').html(res.code);
                    if(res.status == 2){
                        var massage = "Worning";
                        type = "failed";
                    }else{
                        var massage = "Success";
                        type = "success";
                    }
                    
                    
                    code = res.message;
                    header = form.getElementsByClassName('p-head')[0].innerHTML;
                    show_success_pop_up(code,type,massage,header);
                    profile_update();
                    jquary_update();
                    
                   
                }
                else{
                    code = "";
                    // console.log(form);
                    
                    $('.delete-ed-popup').hide();
                    
                    code = "";
                    if (res.status == 1) {
                        if(clickedId == "personal_info_form"){
                            document.getElementById('candidate_name_update').innerHTML = formData.get('name') +" "+ formData.get('last_name');
                        }
                        
                        var warningElements = form.getElementsByClassName('warning');
                        for (var i = 0; i < warningElements.length; i++) {
                            warningElements[i].style.display = "none";
                        }
                        var fetch_data = res.fetch_data;
                        data_update_by_database(fetch_data ,form);
                        var massage = "Success";
                        type = "success";
                        code = res.message;
                        header = form.getElementsByClassName('p-head')[0].innerHTML;
                        show_success_pop_up(code,type,massage,header);
                        profile_update();

                    } else if (res.status == 2) {

                        var fetch_data = res.fetch_data;
                        data_update_by_database(fetch_data ,form);
                        var massage = "Failed Try Again";
                        type = "failed";
                        code = res.message;
                        header = form.getElementsByClassName('p-head')[0].innerHTML;
                        show_success_pop_up(code,type,massage,header);
                        profile_update();
                        
                    } else if (res.status == 3) {
                        document.getElementById(clickedId+'_edit_button').innerHTML = "Save";
                        document.getElementById(clickedId + '_cancel_button').style.display = "block";
                        document.getElementById(clickedId+'_edit_image').src =
                            "{{ asset('backend') }}/lead-management/images/customer-detail/file-save.svg";
                            
                            var form = document.getElementById(clickedId);
                        // console.log(form);
                        var inputs = form.getElementsByTagName('input');    
                        var select = form.getElementsByTagName('select');
                        for (let i = 0; i < inputs.length; i++) {
                            inputs[i].readOnly = false;
                        }
                        for (let i = 0; i < select.length; i++) {
                            select[i].disabled = false;
                        }
                        change_edit_save_personal_info = 1;
                        errors_form = res['error'];
                        form_validation_check(form , errors_form);
                        var fetch_data = res.fetch_data;
                        data_update_by_database(fetch_data ,form);
                        profile_update();
                    }
                    else if (res.status == 4) {
                        var form = document.getElementById(clickedId);
                        var fetch_data = res.fetch_data;
                        data_update_by_database(fetch_data ,form);  
                        profile_update();
                        $('.overlay').hide();
                        

                              
                    }
                    else {
                        var form = document.getElementById(clickedId);
                        var massage = "Error";
                        type = "failed";
                        code = res.message;
                        header = form.getElementsByClassName('p-head')[0].innerHTML;
                        show_success_pop_up(code,type,massage,header);
                        var fetch_data = res.fetch_data;
                        data_update_by_database(fetch_data ,form);
                        profile_update();
                    }
                }
            }
        });
    }

    function data_update_by_database(fetch_data ,form){
       

        for (var key in fetch_data) {
            if (fetch_data.hasOwnProperty(key)) {
                var value = fetch_data[key];
                // console.log(key + ": " + value);
                var element = form.querySelector('[name="'+key+'"]');
                console.log(fetch_data);
                if(!element){
                    var element_new = form.querySelector('[name="'+key+'[]"]');
                    if (element_new) {
                        console.log(element_new);
                        if (element_new.tagName === 'SELECT') {
                            
                            element_new.setAttribute('value', value); // Update the value of the input, 
                            $('#' + element_new.id).val(value).trigger('change');
                            if(value == null){

                            }else{
                                var valuesArray = value.split(','); // Split the string into an array of 
                                var values = valuesArray; // Array of values to select
                                $('#' + element_new.id + ' option').prop('selected', false);
                                values.forEach(function(val) {
                                $('#' + element_new.id + ' option[value="' + val + '"]').prop('selected', true);
                                });
                                $('#' + element_new.id).trigger('change');
                            }
                            

                        }
                        
                    }
                }
                // console.log(element);
                if (element) {
                    if (element.tagName === 'INPUT') {
                        element.setAttribute('value', value); // Update the value of the input, select, or textarea element
                        document.getElementById(element.id).value = value;
                    }
                    if (element.tagName === 'SELECT') {
                        element.setAttribute('value', value); // Update the value of the input, select, or textarea element
                        // document.getElementById(element.id).value = value;
                        // console.log(element);
                        $('#' + element.id).val(value).trigger('change');
                    }
                    
                    if (element.tagName === 'TEXTAREA') {
                        document.getElementById(element.id).innerHTML = value;        
                    }
                }
            }
        }
        console.log(fetch_data);
        if(form.id == "personal_info_form" && fetch_data != null){
            
            get_states(fetch_data['country_id'],fetch_data['state_id']);
            get_cites(fetch_data['state_id'], fetch_data['city_id']);
            var country = fetch_data['country'];
            $.ajax({
                url: "{{ url('countryArray.php') }}?t=" + country,
                success: function(res) {
                    $("#country").html(res);
                }
            });
        }
        
        
       
        
    }

    function profile_update(){
        $.ajax({
            type: 'GET',
            url: "{{ url('/api/profile_complete', $candidate->id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $('#data_progress_bar').attr('data-progress', res.available_percentage);
                $('.filled-line').width(res.available_percentage + '%');
                $('.progress-value').html(res.available_percentage + '%');


            }
        });
    }

    function show_success_pop_up(code,type,massage,header){
        if(header == null){
            header = "Operation";
        }
        $('#success_popup_heading').html(header);
        $('.m-head').html(massage);
        $('#success_popup_text').html(code);
        $('#success-popup').css('display', 'block');
        if(type == "success"){
            $('#icons_success_popup').html(
                `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="error" width="100%" height="100%">`
            );
        }else if(type == "failed"){
            $('#icons_success_popup').html(
                `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
            );
        }
        $('.overlay').show();
    }

    function form_validation_check(form , errors_form){
        $('.warning').html("");
        var code = "";
        for (const fieldName in errors_form) {
            if (errors_form.hasOwnProperty(fieldName)) {
                const errorMessages = errors_form[fieldName];
                if (errorMessages.length > 0) {
                    code = code + `<p><strong> ${fieldName} : </strong>${errorMessages[0]} </p>`;
                    var warningElement = document.createElement("p");
                    warningElement.className = "warning";
                    warningElement.textContent = errorMessages[0];
                    var allElements = document.querySelectorAll('input[name="' + fieldName + '"], input[id="' + fieldName + '"],select[id="' + fieldName + '"], select[name="' + fieldName + '"]');
                    allElements.forEach(function(element) {
                        var warningElement = document.createElement("p");
                        warningElement.className = "warning";
                        warningElement.textContent = errorMessages[0];
                        element.parentNode.insertBefore(warningElement.cloneNode(true), element.nextSibling);
                    });
                }
            }
        }
        $('.overlay').hide();
    }

    // var change_edit_save_webinar = 0;
    // $('#edit_text_webinar').on('click', function(e) {
    //     e.preventDefault();

    //     var form = document.getElementById('webinar_form');
    //     var inputs = form.getElementsByTagName('input');
    //     var select = form.getElementsByTagName('select');
    //     if (change_edit_save_webinar == 0) {
    //         document.getElementById('edit_text_webinar').innerHTML = "Save";
    //         document.getElementById('edit_image_webinar').src =
    //             "{{ asset('backend') }}/lead-management/images/customer-detail/file-save.svg";
    //         for (let i = 0; i < inputs.length; i++) {
    //             inputs[i].readOnly = false;
    //         }
    //         for (let i = 0; i < select.length; i++) {
    //             select[i].disabled = false;
    //         }
    //         change_edit_save_webinar = 1;
    //     } else {
    //         document.getElementById('edit_text_webinar').innerHTML = "add";
    //         document.getElementById('edit_image_webinar').src =
    //             "{{ asset('backend') }}/lead-management/images/customer-detail/pencil.svg";
    //         for (let i = 0; i < inputs.length; i++) {
    //             inputs[i].readOnly = true;
    //         }
    //         for (let i = 0; i < select.length; i++) {
    //             select[i].disabled = true;
    //         }
    //         change_edit_save_webinar = 0;
    //         save_webinar();
    //     }
    // });

    // function save_webinar() {
    //     formData = new FormData();
    //     var form = document.getElementById('webinar_form');
    //     var inputs = form.querySelectorAll('input[name]');
    //     var values = {};
    //     inputs.forEach(function(input) {
    //         formData.append(input.name, input.value);
    //     });
    //     var inputs = form.querySelectorAll('select[name]');
    //     var values = {};
    //     inputs.forEach(function(input) {
    //         formData.append(input.name, input.value);
    //     });
    //     formData.append("user_id", {{ $candidate->user_id }});
    //     formData.append("type", "webinar");
    //     $.ajaxSetup({
    //         headers: {
    //             'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    //         }
    //     });
    //     $.ajax({
    //         type: 'POST',
    //         url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
    //         data: formData,
    //         cache: false,
    //         processData: false,
    //         contentType: false,
    //         success: (res) => {
    //             code = "";
    //             $('.delete-ed-popup').hide();
    //             $('.overlay').show();
    //             code = "";
    //             if (res.status == 1) {
    //                 $('.m-head').html("Success");
    //                 code = code + res.message;
    //                 $('#success_popup_text').html(code);
    //                 $('#icons_success_popup').html(
    //                     `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
    //                 );
    //                 $('#success-popup').css('display', 'block');
    //                 // Get today's date
    //                 var today = new Date();
    //                 var year = today.getFullYear();
    //                 var month = String(today.getMonth() + 1).padStart(2, '0');
    //                 var day = String(today.getDate()).padStart(2, '0');
    //                 var hours = String(today.getHours()).padStart(2, '0');
    //                 var minutes = String(today.getMinutes()).padStart(2, '0');
    //                 var seconds = String(today.getSeconds()).padStart(2, '0');
    //                 var currentDateTime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes +
    //                     ':' + seconds;
    //                 var code = '';
    //                 for (let x in res['webinards']) {
    //                     for (let y in res['candidate_web_find']) {
    //                         var specificDate = res['webinards'][x]['dateTime'];
    //                         if (res['webinards'][x]['id'] == res['candidate_web_find'][y] &&
    //                             currentDateTime <= specificDate) {

    //                             var d = new Date(specificDate);
    //                             var dformat = [(d.getMonth() + 1),
    //                                 d.getDate(),
    //                                 d.getFullYear()
    //                             ].join('-') + ' ' + [d.getHours(),
    //                                 d.getMinutes(),
    //                                 d.getSeconds()
    //                             ].join(':');

    //                             code = code + `<tr>
    //                                 <td class="t-col"><span class="title">${res['webinards'][x]['webinar_name']}</span></td>
    //                                 <td class="t-col"><span class="title">${dformat}</span></td>
    //                                 <td class="t-col"><span class="at-wb true"><a href="${res['webinards'][x]['webinar_link']}"> Join Link</a></span></td>
    //                                 </tr>`;
    //                         }
    //                     }
    //                 }

    //                 $('#tbody_webinar_list1').html(code);

    //                 var code = "";
    //                 for (let x in res['webinards']) {
    //                     for (let y in res['candidate_web_find']) {
    //                         var specificDate = res['webinards'][x]['dateTime'];
    //                         if (res['webinards'][x]['id'] == res['candidate_web_find'][y] &&
    //                             currentDateTime > specificDate) {
    //                             var d = new Date(specificDate);
    //                             var dformat = [(d.getMonth() + 1),
    //                                 d.getDate(),
    //                                 d.getFullYear()
    //                             ].join('-') + ' ' + [d.getHours(),
    //                                 d.getMinutes(),
    //                                 d.getSeconds()
    //                             ].join(':');

    //                             code = code + `<tr>
    //                                 <td class="t-col"><span class="title">${res['webinards'][x]['webinar_name']}</span></td>
    //                                 <td class="t-col"><span class="title">${dformat}</span></td>
    //                                 <td class="t-col"><span class="at-wb true"><a href="${res['webinards'][x]['webinar_link']}"> Join Link</a></span></td>
    //                                 </tr>`;
    //                         }
    //                     }
    //                 }

    //                 $('#tbody_webinar_list2').html(code);
    //             } else if (res.status == 2) {
    //                 $('.m-head').html("Failed Try Again");
    //                 $('#success_popup_text').html(code);
    //                 $('#success-popup').css('display', 'block');
    //                 $('#icons_success_popup').html(
    //                     `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
    //                 );
    //             } else if (res.status == 3) {
    //                 console.log(res['error']);
    //                 errors_form = res['error'];
    //                 form_validation_check(form , errors_form);
    //                 $('.overlay').hide();
    //             } else {
    //                 code = code + res.message;
    //                 $('#success_popup_text').html(code);
    //                 $('#success-popup').css('display', 'block');
    //                 $('#icons_success_popup').html(
    //                     `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
    //                 );
    //             }
    //         }
    //     });
    // }

    document.getElementById('file').onchange = function() {
        var file = document.getElementById('file').files[0];
        $('#file_name').html(file['name']);
       
    };

    $('#file_upload_by_ajax').on('submit', function(e) {
        e.preventDefault();
        formData = new FormData($(this)[0]);
        var user_id = {{ $candidate->user_id }};
        var subcategory_name = document.getElementById('subcategory_name').value;
        var document_name = document.getElementById('document_name').value;
        var document_subcategory_id = document.getElementById('document_subcategory_id').value;
        var file = document.getElementById('file').files[0];
        formData.append('user_id', user_id);
        formData.append('subcategory_name', subcategory_name);
        formData.append('document_name', document_name);
        formData.append('document_subcategory_id', document_subcategory_id);
        formData.append('file', file);
        
            if (file != null) {

                if (file['size'] >= 10000000) {
                    code = "Document Upload Maximum Size Only 10 Mb";
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                    $(".upload-popup").hide();
                    $(".overlay").hide();
                    //document. ('upload-popup').style.display="none";
                    const ele_var = document.querySelectorAll('body');
                    ele_var.forEach((element) => {
                        element.classList.remove('no-scroll');
                    });
                }
                else{
                    $('#upload-popup').hide();
                    $(".upload-loader").show();
                    $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                    });
                    $.ajax({
                        type: 'POST',
                        url: "{{ route('lead-management.documents_upload') }}",
                        data: formData,
                        cache: false,
                        processData: false,
                        contentType: false,
                        success: (res) => {
                            var code = "";
                            $(".upload-loader").hide();
                            if (res.status == 1) {
                                $('.m-head').html("Success");
                                $(".overlay").show();
                                
                                code = code + res.massage;
                                $('#success_popup_text').html(code);
                                $('#success-popup').css('display', 'block');
                                $('#icons_success_popup').html(
                                    `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="error" width="100%" height="100%">`
                                );
                            } else if (res.status == 2) {
                                code = code + res.massage;
                                $('#success_popup_text').html(code);
                                $('#success-popup').css('display', 'block');
                                $('#icons_success_popup').html(
                                    `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                                );

                            } else if (res.status == 3) {
                                code = code + res.error['file'][0];
                                $('.m-head').html(code);
                                $(".overlay").show();
                                $('#success_popup_text').html(code);
                                $('#success-popup').css('display', 'block');
                                $('#icons_success_popup').html(
                                    `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                                );
                            }
                            //document.getElementsByClassName("overlay").style.display="none";
                            $(".upload-popup").hide();
                            
                            //document. ('upload-popup').style.display="none";
                            const ele_var = document.querySelectorAll('body');
                            ele_var.forEach((element) => {
                                element.classList.remove('no-scroll');
                            });
                            refresh_education_data("overlay_show");
                            refreshDocuments("overlay_show");
                        }
                    });
                }
                
            } else {
                Swal.fire('First Upload File')
            }
       
        $('#file_name').html("Select File");
    });

    

    $(document).ready(function() {
        
        

        
        if($('#marital_status').val() == "Married"){
            $('.spouse-ques').show();
        }else{
            $('.spouse-ques').hide();
            $('.family-details').hide();
        }

        if($('#spouse_comming').val() == "Yes"){
            $('.family-details').show();
        }else if($('#spouse_comming').val() == ""){
            $('.family-details').hide();
        }else{
            $('.family-details').hide();
        }



        $('#marital_status').change(function(){
            if($('#marital_status').val() == "Married"){
                $('.spouse-ques').show();
                $('#spouse_comming').val("Yes").trigger('change');
                $('.family-details').show();
            } else {
                $('.spouse-ques').hide();
                $('#spouse_comming').val("No").trigger('change')
                $('.family-details').hide();
            }
        });


        $('#spouse_comming').change(function(){
            if($('#spouse_comming').val() == "Yes"){
                $('.family-details').show();
            } else {
                $('.family-details').hide();
            }
        });




    });
    
    function document_show(){
        refreshDocuments("overlay_hide");
    }
    function work_experience_show(){
        show_form_work_experience("overlay_hide");  
    }
    function work_education_show(){
        refresh_education_data("overlay_hide");
    }
    var current_tab_active = 0;

    function refreshDocuments(type) {
        console.log(type);
        $(".overlay").show();
        $(".upload-loader").show();
        var user_id = {{ $candidate->user_id }};
        $.ajax({
            type: "post",
            url: "{{ route('lead-management.get_documents') }}",
            data: {
                'user_id': user_id
            },
            beforeSend: function() {
                // Show image container
                $("#accordionExample2").html("");
                $("#pills-section-additional").html("");
                
            },
            success: function(res) {
                
                if(type == "overlay_show"){
                    $(".overlay").show();
                }else{
                    $(".overlay").hide();
                }
                
                $(".upload-loader").hide();
                var code = `<p class="panel-top"> 
                    <span class="p-head">Documents</span> </p>
                        <ul class="tab-list">
                          <li class="tabs active" data-key="All">All </li>`;
                for (let ww in res['data']['doc_category']) {
                    code = code +
                        `<li class="tabs" data-key="pop_up${res['data']['doc_category'][ww]['id']}">${res['data']['doc_category'][ww]['document_category_name']}</li>`;
                }
                code = code + `<li class="tabs active" data-key="Other">Additional </li> </ul> `;
                code = code + `<div class="view-documents  All" style="display:block;"> `;
                for (let doc__sub_category_increment in res['data']['doc_sub_category']) {

                    var flag = 0;
                    for (let y in res['data']['document']) {
                        if (res['data']['document'][y]['document_subcategory_id'] == res['data'][
                                'doc_sub_category'
                            ][doc__sub_category_increment]['id']) {
                            code = code + ` <i class="fas fa-upload"></i>
                                            <div class="doc-item">
                                                <p class="doc-name uploaded">
                                                    <img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick"width="100%" height="100%">
                                                    ${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}
                                                </p>
                                                <p class="user-actions">
                                                    <a  class="user-link doc-view" data-link="${res['data']['document_link']}${res['data']['document'][y]['document_location']}" >
                                                        <img src="{{ asset('backend') }}/lead-management/images/eye.svg"  alt="view-icon" width="100%" height="100%">
                                                    </a> 
                                                    <a  href="javascript:;" class="user-link delete-doc" data-id="${res['data']['document'][y]['id']}" aria-label="delete" >
                                                        <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete" width="100%" height="100%">
                                                    </a> 
                                                </p> 
                                            </div>`;
                            flag = 1;
                            break;
                        }
                    }
                    if (flag == 0) {
                        code = code + `<div class="doc-item">
                                            <p class="doc-name">
                                                <img src="{{ asset('backend') }}/lead-management/images/customer-detail/no-tick.svg" alt="no-tick" width="100%" height="100%">${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}
                                            </p> 
                                            <p class="user-actions"> 
                                                <a href="javascript:;" class="user-link up-link" aria-label="upload" data-document_name="" data-subcategory="${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}" data-document_subcategory_id="${res['data']['doc_sub_category'][doc__sub_category_increment]['id']}" >
                                                    <img src="{{ asset('backend') }}/lead-management/images/up-icon.svg" alt="up-icon" width="100%" height="100%">
                                                </a> 
                                            </p>
                                        </div>`;
                    }


                }
                code = code + '</div>';

                for (let doc_category_increment in res['data']['doc_category']) {
                    code = code +
                        `<div class="view-documents  pop_up${res['data']['doc_category'][doc_category_increment]['id']}">`;
                    for (let doc__sub_category_increment in res['data']['doc_sub_category']) {
                        if (res['data']['doc_sub_category'][doc__sub_category_increment][
                                'document_category_id'
                            ] == res['data']['doc_category'][doc_category_increment]['id']) {
                            var flag = 0;
                            for (let y in res['data']['document']) {
                                if (res['data']['document'][y]['document_subcategory_id'] == res['data'][
                                        'doc_sub_category'
                                    ][doc__sub_category_increment]['id']) {
                                    code = code + ` <i class="fas fa-upload">
                                                            </i><div class="doc-item">
                                                                <p class="doc-name uploaded">
                                                                    <img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick"width="100%" height="100%">
                                                                    ${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}
                                                                </p>
                                                                <p class="user-actions">
                                                                    <a  class="user-link doc-view" data-link="${res['data']['document_link']}${res['data']['document'][y]['document_location']}" >
                                                                        <img src="{{ asset('backend') }}/lead-management/images/eye.svg"  alt="view-icon" width="100%" height="100%">
                                                                    </a> 
                                                                    <a  href="javascript:;" class="user-link delete-doc" data-id="${res['data']['document'][y]['id']}" aria-label="delete" >
                                                                    <a  href="javascript:;" class="user-link delete-doc" data-id="${res['data']['document'][y]['id']}" aria-label="delete" >
                                                                        <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete" width="100%" height="100%">
                                                                    </a> 
                                                                </p> 
                                                            </div>`;
                                    flag = 1;
                                    break;
                                }
                            }
                            if (flag == 0) {
                                code = code + `<div class="doc-item">
                                                    <p class="doc-name">
                                                        <img src="{{ asset('backend') }}/lead-management/images/customer-detail/no-tick.svg" alt="no-tick" width="100%" height="100%">${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}
                                                    </p> 
                                                    <p class="user-actions"> 
                                                        <a href="javascript:;" class="user-link up-link" aria-label="upload" data-document_name="" data-subcategory="${res['data']['doc_sub_category'][doc__sub_category_increment]['document_subcategory_name']}" data-document_subcategory_id="${res['data']['doc_sub_category'][doc__sub_category_increment]['id']}" >
                                                            <img src="{{ asset('backend') }}/lead-management/images/up-icon.svg" alt="up-icon" width="100%" height="100%">
                                                        </a> 
                                                    </p>
                                                </div>`;
                            }
                        }
                    }
                    code = code + '</div>';
                }

                code = code + `<div class="view-documents  Other" style="display:block;">  <div class="other-doc">
                                <img src="{{ asset('backend') }}/lead-management/images/up-icon.svg"
                                alt="icon">
                                <p class="ad-head">Upload Additional Documents</p>
                                <p class="ad-subhead">Documents which don’t come under Application, Visa & Financial
                                Type</p>


                                <a href="javascript:;" class="btn upload-btn up-link" aria-label="upload"
                                data-document_name="other" data-subcategory="Income_Tax_Returns"
                                data-document_subcategory_id="">Upload</a>
                                </div>`;
                

                    var flag = 0;
                    for (let y in res['data']['document']) {
                        if (res['data']['document'][y]['document_subcategory_id'] == null) {
                            code = code + ` <i class="fas fa-upload"></i>
                                            <div class="doc-item">
                                                <p class="doc-name uploaded">
                                                    <img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick"width="100%" height="100%">
                                                    ${res['data']['document'][y]['document_name']}
                                                </p>
                                                <p class="user-actions">
                                                    <a  class="user-link doc-view" data-link="${res['data']['document_link']}${res['data']['document'][y]['document_location']}" >
                                                        <img src="{{ asset('backend') }}/lead-management/images/eye.svg"  alt="view-icon" width="100%" height="100%">
                                                    </a> 
                                                    <a  href="javascript:;" class="user-link delete-doc" data-id="${res['data']['document'][y]['id']}" aria-label="delete" >
                                                        <img src="{{ asset('backend') }}/lead-management/images/delete.svg" alt="delete" width="100%" height="100%">
                                                    </a> 
                                                </p> 
                                            </div>`;
                            flag = 1;
                           
                        }
                    }
                    


                code = code + '</div>';

                var flag = 0;
                $("#update_document").html(code);

                $(".up-link").click(function() {
                    var newform = document.getElementById('file_upload_by_ajax');
                    newform.reset();
                    var subcategory = this.getAttribute('data-subcategory');
                    var document_subcategory_id = this.getAttribute('data-document_subcategory_id');
                    var document_name = this.getAttribute('data-document_name');
                    document.getElementById('subcategory_name').value = subcategory;
                    document.getElementById("document_subcategory_id").value =
                        document_subcategory_id;
                    if (document_name == "other") {
                        $("#document_name_open").show();
                        $("#document_name").prop('required', true);
                    } else {
                        $("#document_name_open").hide();
                        $("#document_name").prop('required', false);
                    }
                    $(".upload-popup").show();
                    $('.overlay').show();
                });
                $('.tabs').click(function() {
                    current_tab_active = $(this).index(".tabs");
                    $('.tabs').removeClass('active');
                    $(this).addClass('active');
                    if ($(this).attr('data-key') != 'app') {
                        $('.view-documents').hide();
                        $('.' + $(this).attr('data-key')).show();
                    } else {
                        $('.view-documents').hide();
                        $('.app').show();
                    }
                });

                $('.tabs').removeClass('active');
                $('.tabs:eq(' + current_tab_active + ')').addClass('active');
                if ($('.tabs:eq(' + current_tab_active + ')').attr('data-key') != 'app') {
                    $('.view-documents').hide();
                    $('.' + $('.tabs:eq(' + current_tab_active + ')').attr('data-key')).show();
                } else {
                    $('.view-documents').hide();
                    $('.app').show();
                }

                $(".doc-view").click(function(){
                    $(".view-document-popup").show();
                    
                    var link = $(this).attr('data-link');
                    $("#view_document_iframe").show()
                    $('#view_document_iframe').attr('src', link);
                })

                $(".close").click(function(){
                    $(".view-document-popup").hide();
                    $('#view_document_iframe').attr('src', "");
                })
                $(".delete-doc").click(function() {
                    $(".delete-ed-popup").show();
                    var dataIdValue = $(this).attr("data-id");
                    $('#doc_delete_id').val(dataIdValue);
                    $('#doc_type').attr('value', 'document');
                    $('.overlay').show();
                })
                
            }
        });
    }

    $("#medium").on("change", function () {
        if ($(this).val() === "other") {
            $("#medium_other_input").show();
        } else {
            $("#medium_other_input").hide();
        }
    });

    var second_call = 0;
    $(document).ready(function() {
        //If Other is Selected
        if ($('.apt-other').val().toLowerCase() === "other") {
            $(".aptitude-other").show();
            // $(".apt-taken-date").css("margin-right", "50px");
            // $(".apt-taken-date").next().css("margin-right", "0");
            if (window.innerWidth > 1366) {
                // $(".apt-taken-date").css("margin-right", "0");
                // $(".apt-taken-date").next().css("margin-right", "50px");
            }
        } else {
            $(".aptitude-other").hide();
            // $(".apt-taken-date").css("margin-right", "0");
            // $(".apt-taken-date").next().css("margin-right", "50px");
            if (window.innerWidth > 1366) {
                // $(".apt-taken-date").css("margin-right", "50px");
                // $(".apt-taken-date").next().css("margin-right", "0");
            }
        }

        if ($('.eng-other').val().toLowerCase() == "other") {
            $(".english-other").show();
            // $(".eng-taken-date").css("margin-right", "50px");
            // $(".eng-taken-date").next().css("margin-right", "0");
            if (window.innerWidth > 1366) {
                // $(".eng-taken-date").css("margin-right", "0");
                // $(".eng-taken-date").next().css("margin-right", "50px");
            }
        } else {
            $(".english-other").hide();
            // $(".eng-taken-date").css("margin-right", "0");
            // $(".eng-taken-date").next().css("margin-right", "50px");
            if (window.innerWidth > 1366) {
                // $(".eng-taken-date").css("margin-right", "50px");
                // $(".eng-taken-date").next().css("margin-right", "0");
            }
        }

        // If None is Selected
        if ($(this).val().toLowerCase() === "none") {
            $(".eng-taken-date,.eng-result-date,.eng-score").hide();
        } else {
            $(".eng-taken-date,.eng-result-date,.eng-score").show();
        }

        var country_id = '{{ @$candidate->country_id }}';
        if (country_id != null) {
            var selected_state_id = '{{ @$candidate->state_id }}';
            get_states(country_id, selected_state_id);
        }
        
        $('#country_id').on('change', function() {
            if($('#country_id').val() == "other"){
            $('#country_id_name_div').show();
            }else{
                $('#country_id_name_div').hide();
                $('#country_id_name').attr('value', '');
            }
            var country_id = this.value;
            var selected_state_id = '{{ @$candidate->state_id }}';
            second_call++;
            get_states(country_id, selected_state_id);
        });

        $('#state_id').on('change', function() {
            var state_id = this.value;
            var selected_city_id = '{{ @$candidate->city_id }}';
            get_cites(state_id, selected_city_id);
            if($('#state_id').val() == "other"){
                $('#state_id_name_div').show();
            }else{
                $('#state_id_name_div').hide();
               
            }
        });

        $('#city_id').on('change', function() {
           
            if($('#city_id').val() == "other"){
                $('#city_id_name_div').show();
            }else{
                $('#city_id_name_div').hide();
                $('#city_id_name').attr('value', '');
            }
        });


        

    });

    // view cities by state
    $(document).ready(function() {

        var country = "{{ @$candidate->user->country }}";
        // console.log(country);
    $.ajax({
        url: "{{ url('countryArray.php') }}?t=" + country,
        success: function(res) {
            $("#country").html(res);
        }
    });
        // This function use for when visa refusal is yes show 3 sub manu and when no hide sub manu     
        $('#visa_refusal').change(function() {
            if($('#visa_refusal').val() == "1"){
                $('.vias_submanu').show();
            } else {
                $('.vias_submanu').hide();
            }
        });

        if($('#visa_refusal').val() == "1"){
            $('.vias_submanu').show();
        } else {
            $('.vias_submanu').hide();
        }
        

        $('#passport_status').change(function() {
           
            if($('#passport_status').val() == "1"){
                $('.passport_submanu').show();
            }
            
            else {
                    $('.passport_submanu').hide();
                    $('#passport_number').val('');
                }
        });

        var passport_data = '{{@$candidate->passport_number}}';
        // console.log(passport_data);
        if($('#passport_status').val() == "1"){
            $('.passport_submanu').show();
        }
        else if(passport_data != null && passport_data != ""){
            $('.passport_submanu').show();
            document.getElementById('passport_status').value = 1;

            // Create and dispatch a change event
            var event = new Event('change', { bubbles: true });
            document.getElementById('passport_status').dispatchEvent(event);
                
        }
        else {
            $('.passport_submanu').hide();
        }




        var state_id = '{{ @$candidate->state_id }}';
        var selected_city_id = '{{ @$candidate->city_id }}';
        get_cites(state_id, selected_city_id);
        

        if($('#country_id').val() == "other"){
            $('#country_id_name_div').show();
        }else{
            $('#country_id_name_div').hide();
           
        }

        if($('#state_id').val() == "other"){
            $('#state_id_name_div').show();
        }else{
            $('#state_id_name_div').hide();
            
        }


        if($('#city_id').val() == "other"){
            $('#city_id_name_div').show();
        }else{
            $('#city_id_name_div').hide();
            
        }

        


    });


    



    var stages_name = "{{ @$user->stages }}";
    $.ajax({
        url: "{{ url('stageArray.php') }}?t=" + stages_name,
        success: function(res) {
            $("#stageSelect").html(res);
        }
    });

    

    function get_states(country_id, selected_state_id) {
         $("#state_id").empty();
        $.ajax({
            url: "{{ route('admin.universityGetStateByCountry') }}",
            type: "POST",
            data: {
                country_id: country_id,
                _token: '{{ csrf_token() }}'
            },
            dataType: 'json',
            success: function(result) {
                var flag = 0;
                $("#state_id").empty();
                // console.log(second_call);
                console.log(selected_state_id);
                var option = '<option value="">Select State</option>';
                    $("#state_id").append(option);
                    $.each(result.states, function(key, value) {
                        var option = '<option value="' + value.id + '">' + value.name + '</option>';
                        if (selected_state_id == value.id) {
                            option = '<option value="' + value.id + '" selected>' + value.name +
                                '</option>';
                                flag = 1;
                        }
                        $("#state_id").append(option);
                    });
                
                    

                    if(selected_state_id != "" && flag == 0){
                        var option = '<option selected  value="other">other</option>';
                        $("#state_id").append(option);
                        $('#state_id_name_div').show();
                    }
                    else{
                        var option = '<option  value="other">other</option>';
                        $("#state_id").append(option);
                        $('#state_id_name_div').hide();
                    }

                // if (flag == 1 && (selected_state_id == null || selected_state_id == "")) {
                //     var option = '<option  value="other">other</option>';
                //     $("#state_id").append(option);
                //     $('#state_id_name_div').hide();
                   
                // }else{
                //     var option = '<option selected value="other">other</option>';
                //     $("#state_id").append(option);
                //     $('#state_id_name_div').show();

                    
                // }

                // if($('#state_id').val() == "other"){
                //     $('#state_id_name_div').show();
                // }else{
                //     $('#state_id_name_div').hide();
                //     $('#state_id_name').attr('value', '');
                // }

                
            }
        });
        
        
    }

    function get_cites(state_id, selected_city_id) {
        $.ajax({
            url: "{{ route('admin.universityGetCityByCountry') }}",
            type: "POST",
            data: {
                state_id: state_id,
                _token: '{{ csrf_token() }}'
            },
            dataType: 'json',
            success: function(result) {
                $("#city_id").empty();
                var flag = 0;
                var option = '<option value="">Select City</option>';
                    $("#city_id").append(option);
                $.each(result.cities, function(key, value) {
                    var option = '<option value="' + value.id + '">' + value.name + '</option>';
                    if (selected_city_id == value.id) {
                        option = '<option value="' + value.id + '" selected>' + value.name +
                            '</option>';
                        flag = 1;
                    }
                    $("#city_id").append(option);
                });

                if(selected_city_id != "" && flag == 0){
                    var option = '<option selected  value="other">other</option>';
                    $("#city_id").append(option);
                    $('#city_id_name_div').show();
                }
                else{
                    var option = '<option  value="other">other</option>';
                    $("#city_id").append(option);
                    $('#city_id_name_div').hide();
                }

                // if (flag == "0" && (selected_city_id != null || selected_city_id != "")) {
                //     var option = '<option selected value="other">other</option> ';
                //     $("#city_id").append(option);
                // }else{
                //     var option = '<option  value="other">other</option>';
                //     $("#city_id").append(option);
                // }

                // if($('#city_id').val() == "other"){
                //     $('#city_id_name_div').show();
                // }else{
                //     $('#city_id_name_div').hide();
                   
                // }
                
            }
        });

        if($('#city_id').val() == "other"){
            $('#city_id_name_div').show();
        }else{
            $('#city_id_name_div').hide();
           
        }
    }

    $('#applied_university').change(function() {
        if ($('#applied_university').val() == "Yes") {
            $('#applied_university_name_box').show();
            $('.consultant').removeClass("mr-0");
        } else {
            $('#applied_university_name_box').hide();
            $('.consultant').addClass("mr-0");
        }
    });

    $('#consultant').change(function() {
        if ($('#consultant').val() == "Yes") {
            $('#consultant_name_box').show();
        } else {
            $('#consultant_name_box').hide();
        }
    });

    var stage_name = "<?php echo getStageGroup($user->stages) ?>";
    var select = document.getElementById("stageshow");
        var option = document.createElement("option");
        option.value = stage_name;
        option.text = stage_name;
        select.add(option);


    $('#stageSelect').change(function() {
        var stage = $('#stageSelect').val();
       
        formData = new FormData();
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("type", "stage_change");
        formData.append("stage", stage);
        if (stage == "Student backed out / Dropped") {
            $('.stage_popup').show();
            $('#icons_stage_popup').html(`<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`);
            // document.getElementById('type_save').setAttribute('value', 'student_drop');
            $('#expire_date_div').hide();
            $('#stage_popup').show();
            $('#reason_dropdown').show();
            $('.overlay').show();
            $('#reason_dropdown_select').change(function() {
                var reason_data = $('#reason_dropdown_select').val();
                if (reason_data == "other") {
                    $('#reason_other').show();
                } else {
                    $('#reason_other').hide();
                }
            });
           
            var reason_data = $('#reason_dropdown_select').val();
            if (reason_data == "other") {
                $('#reason_other').show();
            } else {
                $('#reason_other').hide();
            }

            
        } else if(stage == "Offer Accepted"){
            $('.stage_popup').show();
            $('#icons_stage_popup').html(`<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`);
            // document.getElementById('type_save').setAttribute('value', 'student_drop');
            $('#expire_date_div').show();
            $('#stage_popup').show();
            $('#reason_dropdown').hide();
            $('#reason_other').hide();
            
            $('.overlay').show();
            // $('#reason_dropdown_select').change(function() {
            //     var reason_data = $('#reason_dropdown_select').val();
            //     if (reason_data == "other") {
            //         $('#reason_other').show();
            //     } else {
            //         $('#reason_other').hide();
            //     }
            // });
           
            // var reason_data = $('#reason_dropdown_select').val();
            // if (reason_data == "other") {
            //     $('#reason_other').show();
            // } else {
            //     $('#reason_other').hide();
            // }

        }else if(stage == "Offer Rejected"){
            $('.stage_popup').show();
            $('#icons_stage_popup').html(`<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`);
            // document.getElementById('type_save').setAttribute('value', 'student_drop');
            $('#expire_date_div').hide();
            $('#stage_popup').show();
            $('#reason_dropdown').show();
            $('.overlay').show();
            $('#reason_dropdown_select').change(function() {
                var reason_data = $('#reason_dropdown_select').val();
                if (reason_data == "other") {
                    $('#reason_other').show();
                } else {
                    $('#reason_other').hide();
                }
            });
           
            var reason_data = $('#reason_dropdown_select').val();
            if (reason_data == "other") {
                $('#reason_other').show();
            } else {
                $('#reason_other').hide();
            }


        }else {
            $.ajax({
                type: 'POST',
                url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
                data: formData,
                cache: false,
                processData: false,
                contentType: false,
                success: (res) => {
                    code = "";
                    $('.delete-ed-popup').hide();
                    $('.overlay').show();
                    $('#activity_log').html(res.code);
                    code = "";
                    if (res.status == 1) {
                        $('.m-head').html("Success");
                        code = code + res.message;
                        $('#success_popup_text').html(code);
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                        );
                        $('#success-popup').css('display', 'block');
                        ;
                        var select = document.getElementById("stageshow");
                            select.innerHTML = '';
                            var option = document.createElement("option");
                            option.value = res.stage_name;
                            option.text = res.stage_name;
                            select.add(option);
                    } else if (res.status == 0) {
                        $('.m-head').html("Failed Try Again");
                        $.ajax({
                            url: "{{ url('stageArray.php') }}?t=" + res.stage,
                            success: function(res) {
                                $("#stageSelect").html(res);
                            }
                        });
                        code = code + res.message;
                        $('#success_popup_text').html(code);
                        $('#success-popup').css('display', 'block');
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                        );
                    }else if(res.status == 3){
                        // console.log(res['error']);
                        errors_form = res['error'];
                        form_validation_check(form , errors_form);
                        $('.overlay').hide();
                    } 
                    else {
                        code = code + res.message;
                        $('#success_popup_text').html(code);
                        $('#success-popup').css('display', 'block');
                        $('#icons_success_popup').html(
                            `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                        );
                    }
                }
            });
        }
    });

    $('#lead_type').change(function() {
        var lead_type = $('#lead_type').val();
        formData = new FormData();
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("type", "lead_type");
        formData.append("lead_type", lead_type);
        var old_value = "{{ $candidate->user->lead_type }}";
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                code = "";
                $('.delete-ed-popup').hide();
                $('.overlay').show();
                code = "";
                if (res.status == 1) {
                    $('.m-head').html("Success");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                    );
                    $('#success-popup').css('display', 'block');
                } else if (res.status == 0) {
                    $('.m-head').html("Failed Try Again");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }else if(res.status == 3){
                    // console.log(res['error']);
                    errors_form = res['error'];
                    form_validation_check(form , errors_form);
                    $('.overlay').hide();
                }
                 else {
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }
            }
        });
    });

    $('#stage_submit_form').on('submit', function(e) {
        e.preventDefault();
        formData = new FormData();
        var form = document.getElementById('stage_submit_form');
        var inputs = form.querySelectorAll('input[name]');
        var values = {};
        inputs.forEach(function(input) {
            formData.append(input.name, input.value);
        });
        var selectInputs = form.querySelectorAll('select[name]');
        selectInputs.forEach(function(selectInput) {
            var selectedOptions = Array.from(selectInput.selectedOptions).map(function(option) {
                return option.value;
            });
            formData.append(selectInput.name, selectedOptions);
        });
        formData.append("user_id", {{ $candidate->user_id }});
        formData.append("type", "stage_save");
        var stage = $('#stageSelect').val();
        formData.append("stage", stage);
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $('.stage_popup').hide();
                code = "";
                $('.delete-ed-popup').hide();
                $('.overlay').show();
                $('#activity_log').html(res.code);
                code = "";
                if (res.status == 1) {
                    $('.m-head').html("Success");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                    );
                    $('#success-popup').css('display', 'block');
                    var select = document.getElementById("stageshow");
                    select.innerHTML = '';
                    var option = document.createElement("option");
                    option.value = res.stage_name;
                    option.text = res.stage_name;
                    select.add(option);
                } else if (res.status == 0) {
                    $('.m-head').html("Failed Try Again");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                } else if(res.status == 3){
                    // console.log(res['error']);
                    errors_form = res['error'];
                    form_validation_check(form , errors_form);
                    $('.overlay').hide();
                }
                else {
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }
            }
        });
    });

    function delete_webinar(id){
        $.ajax({
            type: 'POST',
            url: "{{ route('lead-management.update_new', $candidate->user_id) }}",
            data: formData,
            cache: false,
            processData: false,
            contentType: false,
            success: (res) => {
                $('.stage_popup').hide();
                code = "";
                $('.delete-ed-popup').hide();
                $('.overlay').show();
                code = "";
                if (res.status == 1) {
                    $('.m-head').html("Success");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/green-tick.svg" alt="green-tick" width="100%" height="100%">`
                    );
                    $('#success-popup').css('display', 'block');
                    var select = document.getElementById("stageshow");
                    select.innerHTML = '';
                    var option = document.createElement("option");
                    option.value = res.stage_name;
                    option.text = res.stage_name;
                    select.add(option);
                } else if (res.status == 0) {
                    $('.m-head').html("Failed Try Again");
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                } else if(res.status == 3){
                    // console.log(res['error']);
                    errors_form = res['error'];
                    form_validation_check(form , errors_form);
                    $('.overlay').hide();
                }
                else {
                    code = code + res.message;
                    $('#success_popup_text').html(code);
                    $('#success-popup').css('display', 'block');
                    $('#icons_success_popup').html(
                        `<img src="{{ asset('backend') }}/lead-management/images/error-1.svg" alt="error" width="100%" height="100%">`
                    );
                }
            }
        });
    }
    

</script>





{{-- //another page script --}}

     <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js?v={{env('CRM_VERSION')}}"></script>
     <script src="{{ asset('tinymce/tinymce.min.js?v=' . env('CRM_VERSION')) }}" referrerpolicy="origin"></script>
       
    <script>
        function customWhatsApp(event, candidateId, candidateName, candidatePhone, candidateCountryCode, candidateCountry) {
            $('#manage_whatsapp_popup').attr('value', 'close');
            
            event.preventDefault();
        $('.whatsapp-popup').hide();
        // Clear and initialize form input fields
        $('#whatsappForm')[0].reset();
        $('#whatsappForm').find('select').val('').trigger('change');

            $('.Wdefaulthide').hide();
            $('.Wdefaultshow').hide();

            $(".customWhatsAppSendShow").hide();
            $(".customWhatsAppSendHIDE").show();

            $("#wtemplates_id").val();
            $("#Wtemplates_user_name").val();
            $("#Wtemplates_user_phone").val();

            $(".Wtemplates_user_name").val();
            $("#whatsApp_massage").val();
            $(".Wtemplates_message").val();
            $("#Wtemplates_type").val('');


            var newPhone = candidateCountryCode + candidatePhone;

            // Handle special case for "India"
            if (candidateCountry == "India") {
                // alert("candidateCountry "+candidateCountry);
                newPhone = candidateCountryCode + candidatePhone.slice(-10);
            }

            // Remove any whitespace from the phone number
            newPhone = newPhone.replace(/\s/g, '');
            

            $("#wtemplates_id").val(candidateId);
            $("#Wtemplates_user_name").val(candidateName);
            $("#Wtemplates_user_phone").val(newPhone);
            $(".Wtemplates_user_name").val(candidateName);

            $(".whatsapp-popup").show();


        }

        $("#whatsApp_massage").keyup(function() {
            $(".Wtemplates_message").text($(this).val())
        });
    </script>
    {{-- //////////////////customWhatsApp/////////////////// --}}
    <script>

        $('#Wtemplates_type').on('change', function() {
            var wtemplatestype = this.value;
                $('.Wdefaulthide').hide();
                $('.Wdefaultshow').show();
            if (wtemplatestype == "country_selection") {
                $('.Wdefaulthide').show();
                $('.Wdefaultshow').hide();
            }
            if (wtemplatestype == "onboarding_link") {
                $('.Wdefaulthide, .Wdefaultshow, .onboardingHide').hide();
                $(".onboardingShow").show();
              
            }
        });

        function customWhatsAppSend(event) {
            
            var Wtemplates_type = $('#Wtemplates_type').val();
            var message = $('#whatsApp_massage').val();

            if (!Wtemplates_type) {
                toastr.error("Template Type is required.");
                return;
            }

            if (!message && Wtemplates_type == "custom") {
                toastr.error("Message is required.");
                return;
            }
            var element = $('.back_btn_whatsapp');
            
            if (event == "Preview") {
                $('#manage_whatsapp_popup').attr('value', 'yes');
                
                $(".customWhatsAppSendShow").show();
                $(".customWhatsAppSendHIDE").hide();
                return;
            }
            event.preventDefault();
            var id = $('#wtemplates_id').val();
            var name = $('#Wtemplates_user_name').val();
            var phone = $('#Wtemplates_user_phone').val();
          


            // $(".customWhatsAppSendShow").hide();
            // $(".customWhatsAppSendHIDE").show();

            if (!id) {
                toastr.error("ID is required.");
                return;
            }

            if (!name) {
                toastr.error("Name is required.");
                return;
            }
            if (!phone) {
                toastr.error("Phone is required.");
                return;
            }
        

            // const button = event.target;
            // button.style.display = 'none';

            const button = event.target;
            button.disabled = true;
            button.style.backgroundColor = 'gray';
            const loader = document.getElementById('loader2');
            loader.style.display = 'inline-block';
            $.ajax({
                url: "{{ route('candidate.customWhatsApp', ['id' => ':id']) }}".replace(':id', id),
                type: "post",
                data: {
                    id: id,
                    name: name,
                    phone: phone,
                    message: message,
                    templates_type: Wtemplates_type,
                    _token: '{{ csrf_token() }}'
                },
                dataType: 'json',
                success: function(result) {
                   
                    element.attr('data-type', 'no');
                    toastr.success("WhatsApp Message send successfully!");

                    loader.style.display = 'none';
                    // button.style.display = 'inline-block';
                    button.disabled = false;
                    button.style.backgroundColor = '#25bb00';
                    $("body").removeClass("no-scroll");
                    $('.close-popup').trigger('click');
                    
                },
                error: function(xhr, status, error) {
                    element.attr('data-type', 'no');
                    // Handle the error response, e.g., show an error message
                    // console.error(xhr.responseText);
                    toastr.error("Error WhatsApp Message. Please try again later.");

                    loader.style.display = 'none';
                    // button.style.display = 'inline-block';
                    button.disabled = false;
                    button.style.backgroundColor = '#25bb00';

                    $(".customWhatsAppSendShow").hide();
                    $(".customWhatsAppSendHIDE").show();
                }
            });

        };
    </script>

    {{-- ////////////////////////////form Submit by on change//////////////// --}}
    

    {{-- ////////////////////////////custom Send Email///////////////////////// --}}

    <script>
        function customSendEmailModel(candidateId, candidateName, candidateEmail) {
            

            $('.email-popup').hide();
            // Clear and initialize form input fields
            $('#emailPopupform')[0].reset();
            $('#emailPopupform').find('select').val('').trigger('change');

            $("#templates_type").val('');
            $("#customFile").val('');

            $("#templates_id").val();
            $("#templates_user_name").val();
            $(".templates_user_email").val();

            $(".templates_user_name").val();
            $("#whatsApp_massage").val();
            $(".Wtemplates_message").val();

            $(".optional-field").hide();

            $("#templates_id").val(candidateId);
            $("#templates_user_name").val(candidateName);
            $(".templates_user_email").val(candidateEmail);
            $(".templates_user_name").text(candidateName);

            $(".email-popup").show();



        }

        $("#templates_type").change(function() {
            $(".optional-field").hide();
            var className = $('option:selected', this).data('class').trim();

            templatesHideShowFunction(className);
            var candidateName = $(".templates_user_name").text().trim();
            
            updateEditorContent(className, candidateName);
        });

        // Initial setup on page load
        var initialTemplateType = $("#templates_type").val().trim();
        var initialCandidateName = $(".templates_user_name").text().trim();
        updateEditorContent(initialTemplateType, initialCandidateName);
        templatesHideShowFunction(initialTemplateType);


        function templatesHideShowFunction(className) {
            $(".optionalTemplate").show();
            
            if (className == 'enquiryEmail') {
                $('#templates_subject').val('Study Abroad Enquiry');
                $(".optionalTemplate").hide();
            } else if (className == 'customEmail') {
                $('#templates_subject').val('Custom Email');
                $(".optionalTemplate").hide();
            } else if (className == 'offerLetter') {
                $('#templates_subject').val('Congratulations on Acceptance of Your University Application! 🎉');
                $(".optionalTemplate").hide();
            } else if (className == 'universityCourseSuggestionsEmail') {
                $('#templates_subject').val('University/Course Suggestions');
                $(".optionalTemplate").hide();
            } else if (className == 'customContactInformation') {
                $('#templates_subject').val(
                    'Update us with your Contact Information for a Smooth Transition to Studying Abroad');
                $(".optionalTemplate").hide();
            } else if (className == 'emailTemplate') {
                $(".optionalTemplate").show();
            }





            if (className) {
                $("." + className).show();
            }

        }


        function updateEditorContent(templateType, candidateName) {
            if (templateType === 'enquiryEmail') {
                // Get the content for the enquiryEmail template and set it to the editor
                var enquiryEmailContent = `<p><strong >Dear <span>${candidateName}</span>,</strong></p>
                    <div dir="ltr">
                    <div>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;">Thank you for expressing your interest in studying abroad. We appreciate your enthusiasm and trust in our services &amp; are confident that we can assist you in securing admission to your desired program at the preferred university.</span></p>
                        <p></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;"><b>Destination Country -&nbsp;</b></span></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;"><b>Program Name -</b></span></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;"><b>Preferred University (if any) -</b></span></p>
                        <p></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;">Please also share the following required&nbsp;documents for thorough profile evaluation.</span></p>
                        <ol>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">10th Marksheet</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">12th Marksheet</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">Bachelor&rsquo;s Marksheet</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">Transcripts</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">Resume/CV</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">Passport</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">English&nbsp;Efficiency Proof (IELTS/PTE)</span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">2 LORs (Letter of Recommendation) </span></p>
                        </li>
                        <li>
                            <p><span style="font-family: Times New Roman, serif; font-size: medium;">Personal Statement (SOP)</span></p>
                        </li>
                        </ol>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;">Your prompt response and submission of the above documents will enable us to assess your profile accurately and provide you with further assistance tailored to your specific needs.</span></p>
                        <p></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;">Alternatively, if you have any questions or need immediate assistance, please do not hesitate&nbsp;to contact us via&nbsp;</span></p>
                        <span style="font-family: Times New Roman, serif; font-size: medium;"><b>Call </b></span><span style="font-family: Times New Roman, serif; font-size: medium;">or</span><b> WhatsApp at&nbsp; &nbsp;{{ $website_setting->whatsapp_number }}</b><span style="font-family: Times New Roman, serif; font-size: medium;">. Our dedicated team is available to address any concerns or queries you may have,&nbsp;</span>
                        <p></p>
                        <p><span style="font-family: Times New Roman, serif; font-size: medium;">Thank&nbsp;you once again for choosing our services. We look forward to receiving your documents and working together to make your study abroad aspirations a reality.</span></p>
                    </div>
                    <div>
                        <div style="color: rgb(34,34,34);">
                        <div>-</div>
                        <div>Thanks &amp; Regards,</div>
                        <table cellpadding="0" cellspacing="0" style="color: rgb(0,0,0); font-family: Arial; font-size: 16px; border-collapse: collapse;">
                            <tbody>
                            <tr>
                                <td style="line-height: 1.2; padding: 0.01px;"><span style="text-transform: initial; font-weight: bold; color: rgb(100,100,100); letter-spacing: 0px; line-height: 1.2;"> <br>&nbsp; &nbsp; Team Gradding </span></td>
                            </tr>
                            <tr>
                                <td>
                                <table cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
                                    <tbody>
                                    <tr>
                                        <td nowrap="nowrap" width="421" style="padding-top: 14px; width: 421px;">
                                        <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="tel:{{ @$website_setting->phone }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ @$website_setting->phone }}</span> </a> &nbsp;|&nbsp;&nbsp; <a href="https://www.gradding.com/" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gradding.com/&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw38FZCAQNqgTXnlONjQEoxU"> <span style="line-height: 1.2; color: rgb(33,33,33);">www.gradding.com</span> </a> &nbsp;|&nbsp;&nbsp; <a href="mailto:{{ $setting->email }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $setting->email }}</span> </a> </span></p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td nowrap="nowrap" width="801" style="padding-top: 7px; width: 801px;">
                                        <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="https://maps.google.com/?q=P.%20No.4,%203rd%20Floor,%20Lal%20Niwas,%20Heera%20Bagh,%20Near%20Narayan%20Singh%20Circle,%20Tonk%20Road,%20Jaipur,%20Rajasthan" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://maps.google.com/?q%3DP.%2520No.4,%25203rd%2520Floor,%2520Lal%2520Niwas,%2520Heera%2520Bagh,%2520Near%2520Narayan%2520Singh%2520Circle,%2520Tonk%2520Road,%2520Jaipur,%2520Rajasthan&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw2Wh5O1jfYxDeB-ONspFB5l"> <span style="line-height: 1.2; color: rgb(33,33,33);">P. No.4, 3rd Floor, Lal Niwas, Heera Bagh, Near Narayan Singh Circle, Tonk Road, Jaipur, Rajasthan</span> </a> </span></p>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding: 14px 0.01px 0.01px;">
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tbody>
                                        <tr>
                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->facebook }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:11px;height:21px;" src="https://i.imgur.com/WG1xTUx.png" alt="icons">
                                                </a>
                                            </td>
                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->twitter }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:20px;height:16px;" src="https://i.imgur.com/nYdYc4n.png" alt="icons">
                                                </a>
                                            </td>
                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->instagram }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:18px;height:19px;" src="https://i.imgur.com/EhfqaPM.png" alt="icons">
                                                </a>
                                            </td>

                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->pinterest }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:16px;height:20px;" src="https://i.imgur.com/p8u8BFA.png" alt="icons">
                                                </a>
                                            </td>

                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->linkedin }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:17px;height:18px;" src="https://i.imgur.com/wdzPBPP.png" alt="icons">
                                                </a>
                                            </td>
                                            <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                <a href="{{ @$website_setting->youtube }}" target="_Blank"
                                                    style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                    <img style="width:23px;height:16px;" src="https://i.imgur.com/7Zf8wM8.png" alt="icons">
                                                </a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        </div>
                    </div>
                    </div>`;
                tinymce.get("editor_enquiryEmail").setContent(enquiryEmailContent);
            } else if (templateType === 'customEmail') {

                var customEmailContent = `<p><strong>Dear <span>${candidateName}</span>,</strong></p>
                            <div dir="ltr">
                            <div>
                                <p><span style="font-family: Times New Roman, serif;"><span style="font-size: medium;">Thank&nbsp;you once again for choosing our services. We look forward to receiving your documents and working together to make your study abroad aspirations a reality.</span></span></p>
                            </div>
                            <div>
                                <div style="color: rgb(34,34,34);">
                                <div>-</div>
                                <div>Thanks &amp; Regards,</div>
                                <table cellpadding="0" cellspacing="0" style="color: rgb(0,0,0); font-family: Arial; font-size: 16px; border-collapse: collapse;">
                                    <tbody>
                                    <tr>
                                        <td style="line-height: 1.2; padding: 0.01px;"><span style="text-transform: initial; font-weight: bold; color: rgb(100,100,100); letter-spacing: 0px; line-height: 1.2;"> <br>&nbsp; &nbsp; Team Gradding </span></td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <table cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
                                            <tbody>
                                            <tr>
                                                <td nowrap="nowrap" width="421" style="padding-top: 14px; width: 421px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="tel:{{ $website_setting->phone }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $website_setting->phone }}</span> </a> &nbsp;|&nbsp;&nbsp; <a href="https://www.gradding.com/" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gradding.com/&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw38FZCAQNqgTXnlONjQEoxU"> <span style="line-height: 1.2; color: rgb(33,33,33);">www.gradding.com</span> </a> &nbsp;|&nbsp;&nbsp; <a href="mailto:{{ $setting->email }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $setting->email }}</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td nowrap="nowrap" width="801" style="padding-top: 7px; width: 801px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="https://maps.google.com/?q=P.%20No.4,%203rd%20Floor,%20Lal%20Niwas,%20Heera%20Bagh,%20Near%20Narayan%20Singh%20Circle,%20Tonk%20Road,%20Jaipur,%20Rajasthan" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://maps.google.com/?q%3DP.%2520No.4,%25203rd%2520Floor,%2520Lal%2520Niwas,%2520Heera%2520Bagh,%2520Near%2520Narayan%2520Singh%2520Circle,%2520Tonk%2520Road,%2520Jaipur,%2520Rajasthan&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw2Wh5O1jfYxDeB-ONspFB5l"> <span style="line-height: 1.2; color: rgb(33,33,33);">P. No.4, 3rd Floor, Lal Niwas, Heera Bagh, Near Narayan Singh Circle, Tonk Road, Jaipur, Rajasthan</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 14px 0.01px 0.01px;">
                                        <table border="0" cellpadding="0" cellspacing="0">
                                            <tbody>
                                                <tr>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->facebook }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:11px;height:21px;" src="https://i.imgur.com/WG1xTUx.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->twitter }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:20px;height:16px;" src="https://i.imgur.com/nYdYc4n.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->instagram }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:18px;height:19px;" src="https://i.imgur.com/EhfqaPM.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->pinterest }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:16px;height:20px;" src="https://i.imgur.com/p8u8BFA.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->linkedin }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:17px;height:18px;" src="https://i.imgur.com/wdzPBPP.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->youtube }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:23px;height:16px;" src="https://i.imgur.com/7Zf8wM8.png" alt="icons">
                                                        </a>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                </div>
                            </div>
                            </div>`;

                tinymce.get("editor_customEmail").setContent(customEmailContent);
            } else if (templateType === 'offerLetter') {

                var offerLetterContent = `
                <table cellspacing="0" cellpadding="0" style="max-width: 100%; width: 100%; background:#EFEFEF;">
                    <tr>
                        <td>
                            <table cellspacing="0" cellpadding="0" style="max-width: 600px; width: 100%; background: #ffffff; margin: 20px auto 0; font-family: Arial, Helvetica, sans-serif; color: #3E3E3E; font-weight: 400;">
                                <tbody>
                                    <tr>
                                        <td style="text-align: center; border-left: 1px solid #d1d1d1; border-right: 1px solid #d1d1d1; border-top: 1px solid #d1d1d1;">
                                            <a href="https://gradding.com/" target="_blank">
                                                <img src="https://i.imgur.com/JUtvZS6.jpg" alt="Welcome to Gradding" class="logo" style="max-width: 100%;">
                                            </a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 15px 20px 0; border-left: 1px solid #d1d1d1; border-right: 1px solid #d1d1d1;">
                                            <strong>Dear <span>${candidateName}</span>,</strong>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 15px 20px 20px; border-left: 1px solid #d1d1d1; border-right: 1px solid #d1d1d1;">
                                            <p style="font-size: 14px; line-height: 18px; color: #101010; margin: 0 0 10px 0;">Warm Greetings!</p>
                                            <p style="font-size: 14px; line-height: 18px; color: #101010; margin: 0 0 15px 0;">We are delighted to inform you that you have received an offer letter from one of the universities you have applied through us.</p>
                                            <p style="font-size: 14px; line-height: 18px; color: #101010; margin: 0;">Please get in touch with your assigned counsellor soon after you receive this email to know the details of your offer and proceed with your admission.</p>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 0 20px 0; border-left: 1px solid #d1d1d1; border-right: 1px solid #d1d1d1;">
                                            <p style="font-size: 15px; line-height: 20px; color: #055aaa; margin: 0;"><strong>We thank you for giving us the chance to serve you.</strong></p>
                                            <p style="font-size: 15px; line-height: 20px; color: #101010; margin: 0; border-bottom: 1px solid #101010; padding: 0 0 15px 0;"><strong>Team <span style="color: #055aaa;">Gradding</span></strong></p>
                                        </td>
                                    </tr>
                                </tbody>
                                <tfoot>			
                                    <tr style="background:#ffffff;">
                                        <td style="padding:5px 0 17px;text-align:center;border-left: 1px solid #d1d1d1;border-right: 1px solid #d1d1d1;border-bottom: 1px solid #d1d1d1;">
                                            <p style="margin: 0; color: #616161; font-size: 13px;  line-height: 18px;  padding: 10px 14px 15px;">
                                                If you have any questions or concerns, please do not hesitate to get in <br class="dnone" >touch with us at <a href="mailto:{{ $setting->email }}" style="color: #055aaa; text-decoration:none">{{ @$setting->email }}</a> or <a href="tel:{{ $website_setting->phone }}"style="color: #055aaa; text-decoration:none" >{{ @$website_setting->phone }}</a>
                                            </p>									
                                            <a href="{{ @$website_setting->facebook }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:11px;height:21px;" src="https://i.imgur.com/WG1xTUx.png" alt="icons">
                                            </a>									
                                            <a href="{{ @$website_setting->twitter }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:20px;height:16px;" src="https://i.imgur.com/nYdYc4n.png" alt="icons">
                                            </a>
                                            <a href="{{ @$website_setting->instagram }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:18px;height:19px;" src="https://i.imgur.com/EhfqaPM.png" alt="icons">
                                            </a>
                                            <a href="{{ @$website_setting->pinterest }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:16px;height:20px;" src="https://i.imgur.com/p8u8BFA.png" alt="icons">
                                            </a>
                                            <a href="{{ @$website_setting->linkedin }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:17px;height:18px;" src="https://i.imgur.com/wdzPBPP.png" alt="icons">
                                            </a>									
                                            <a href="{{ @$website_setting->youtube }}" target="_Blank" style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                <img style="width:23px;height:16px;" src="https://i.imgur.com/7Zf8wM8.png" alt="icons">
                                            </a>											
                                        </td>				
                                    </tr>	
                                </tfoot>
                            </table>
                        </td>
                    </tr>
                </table>`;

                tinymce.get("editor_offerLetter").setContent(offerLetterContent);
            } else if (templateType === 'universityCourseSuggestionsEmail') {

                var universityCourseSuggestionsEmailContent = `<p><strong>Dear <span>${candidateName}</span>,</strong></p>
                            <div dir="ltr">
                            <div>
                                <p><span style="font-family: Times New Roman, serif;"><span style="font-size: medium;">Thank&nbsp;you once again for choosing our services. Please find attached for the shortlisted university & course suggestions as per your profile.
                                Kindly revert us back as soon as possible with your selected choices to proceed with application
                                Response awaited.</span></span></p>
                            </div>
                            <div>
                                <div style="color: rgb(34,34,34);">
                                
                                <div>Thanks &amp; Regards,</div>
                                <table cellpadding="0" cellspacing="0" style="color: rgb(0,0,0); font-family: Arial; font-size: 16px; border-collapse: collapse;">
                                    <tbody>
                                    <tr>
                                        <td style="line-height: 1.2; padding: 0.01px;"><span style="text-transform: initial; font-weight: bold; color: rgb(100,100,100); letter-spacing: 0px; line-height: 1.2;"> <br>&nbsp; &nbsp; Team Gradding </span></td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <table cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
                                            <tbody>
                                            <tr>
                                                <td nowrap="nowrap" width="421" style="padding-top: 14px; width: 421px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="tel:{{ $website_setting->phone }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $website_setting->phone }}</span> </a> &nbsp;|&nbsp;&nbsp; <a href="https://www.gradding.com/" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gradding.com/&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw38FZCAQNqgTXnlONjQEoxU"> <span style="line-height: 1.2; color: rgb(33,33,33);">www.gradding.com</span> </a> &nbsp;|&nbsp;&nbsp; <a href="mailto:{{ $setting->email }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $setting->email }}</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td nowrap="nowrap" width="801" style="padding-top: 7px; width: 801px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="https://maps.google.com/?q=P.%20No.4,%203rd%20Floor,%20Lal%20Niwas,%20Heera%20Bagh,%20Near%20Narayan%20Singh%20Circle,%20Tonk%20Road,%20Jaipur,%20Rajasthan" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://maps.google.com/?q%3DP.%2520No.4,%25203rd%2520Floor,%2520Lal%2520Niwas,%2520Heera%2520Bagh,%2520Near%2520Narayan%2520Singh%2520Circle,%2520Tonk%2520Road,%2520Jaipur,%2520Rajasthan&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw2Wh5O1jfYxDeB-ONspFB5l"> <span style="line-height: 1.2; color: rgb(33,33,33);">P. No.4, 3rd Floor, Lal Niwas, Heera Bagh, Near Narayan Singh Circle, Tonk Road, Jaipur, Rajasthan</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 14px 0.01px 0.01px;">
                                        <table border="0" cellpadding="0" cellspacing="0">
                                            <tbody>
                                                <tr>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->facebook }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:11px;height:21px;" src="https://i.imgur.com/WG1xTUx.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->twitter }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:20px;height:16px;" src="https://i.imgur.com/nYdYc4n.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->instagram }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:18px;height:19px;" src="https://i.imgur.com/EhfqaPM.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->pinterest }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:16px;height:20px;" src="https://i.imgur.com/p8u8BFA.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->linkedin }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:17px;height:18px;" src="https://i.imgur.com/wdzPBPP.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->youtube }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:23px;height:16px;" src="https://i.imgur.com/7Zf8wM8.png" alt="icons">
                                                        </a>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                </div>
                            </div>
                            </div>`;

                tinymce.get("editor_universityCourseSuggestionsEmail").setContent(universityCourseSuggestionsEmailContent);
            } else if (templateType === 'customContactInformation') {

                var customContactInformationContent = `<p><strong>Dear <span>${candidateName}</span>,</strong></p>
                            <div dir="ltr">
                            <div>
                                <p>Greetings from Gradding!</p>
                        <p>We hope this message finds you in great spirits. We appreciate your interest in pursuing higher education abroad with Gradding. However, it seems that the contact number we have on file may not be accurate or not available on WhatsApp. To ensure that we can provide you with the best guidance and support, we kindly request you to provide us with an updated contact (or WhatsApp) number where we can reach out to you. This will enable us to schedule a call and discuss your study abroad plans in detail.</p>
                        <p>Please take a moment to reply to this email with your preferred contact number, or feel free to give us a call at +91-9773388670. We look forward to connecting with you and assisting you on this exciting educational journey.</p>
                            </div>
                            <div>
                                <div style="color: rgb(34,34,34);">
                                
                                <div>Thanks &amp; Regards,</div>
                                <table cellpadding="0" cellspacing="0" style="color: rgb(0,0,0); font-family: Arial; font-size: 16px; border-collapse: collapse;">
                                    <tbody>
                                    <tr>
                                        <td style="line-height: 1.2; padding: 0.01px;"><span style="text-transform: initial; font-weight: bold; color: rgb(100,100,100); letter-spacing: 0px; line-height: 1.2;"> <br>&nbsp; &nbsp; Team Gradding </span></td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <table cellpadding="0" cellspacing="0" style="border-collapse: collapse;">
                                            <tbody>
                                            <tr>
                                                <td nowrap="nowrap" width="421" style="padding-top: 14px; width: 421px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="tel:{{ $website_setting->phone }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $website_setting->phone }}</span> </a> &nbsp;|&nbsp;&nbsp; <a href="https://www.gradding.com/" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gradding.com/&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw38FZCAQNqgTXnlONjQEoxU"> <span style="line-height: 1.2; color: rgb(33,33,33);">www.gradding.com</span> </a> &nbsp;|&nbsp;&nbsp; <a href="mailto:{{ $setting->email }}" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank"> <span style="line-height: 1.2; color: rgb(33,33,33);">{{ $setting->email }}</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td nowrap="nowrap" width="801" style="padding-top: 7px; width: 801px;">
                                                <p style="margin: 0.1px; line-height: 1;"><span style="font-size: 11px; color: rgb(33,33,33);"> <a href="https://maps.google.com/?q=P.%20No.4,%203rd%20Floor,%20Lal%20Niwas,%20Heera%20Bagh,%20Near%20Narayan%20Singh%20Circle,%20Tonk%20Road,%20Jaipur,%20Rajasthan" rel="nofollow noopener noreferrer" style="color: rgb(17,85,204); text-decoration: unset;" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://maps.google.com/?q%3DP.%2520No.4,%25203rd%2520Floor,%2520Lal%2520Niwas,%2520Heera%2520Bagh,%2520Near%2520Narayan%2520Singh%2520Circle,%2520Tonk%2520Road,%2520Jaipur,%2520Rajasthan&amp;source=gmail&amp;ust=1691320115837000&amp;usg=AOvVaw2Wh5O1jfYxDeB-ONspFB5l"> <span style="line-height: 1.2; color: rgb(33,33,33);">P. No.4, 3rd Floor, Lal Niwas, Heera Bagh, Near Narayan Singh Circle, Tonk Road, Jaipur, Rajasthan</span> </a> </span></p>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="padding: 14px 0.01px 0.01px;">
                                        <table border="0" cellpadding="0" cellspacing="0">
                                            <tbody>
                                                <tr>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->facebook }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:11px;height:21px;" src="https://i.imgur.com/WG1xTUx.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->twitter }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:20px;height:16px;" src="https://i.imgur.com/nYdYc4n.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->instagram }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:18px;height:19px;" src="https://i.imgur.com/EhfqaPM.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->pinterest }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:16px;height:20px;" src="https://i.imgur.com/p8u8BFA.png" alt="icons">
                                                        </a>
                                                    </td>

                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->linkedin }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:17px;height:18px;" src="https://i.imgur.com/wdzPBPP.png" alt="icons">
                                                        </a>
                                                    </td>
                                                    <td align="left" style="padding-right: 6px; text-align: center; padding-top: 0px;">
                                                        <a href="{{ @$website_setting->youtube }}" target="_Blank"
                                                            style="text-decoration:none;padding: 0 17px 0 0;display: inline-block;">
                                                            <img style="width:23px;height:16px;" src="https://i.imgur.com/7Zf8wM8.png" alt="icons">
                                                        </a>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                </div>
                            </div>
                            </div>`;

                tinymce.get("editor_customContactInformation").setContent(customContactInformationContent);
            }


        }


        tinymce.init({
            selector: `#editor_enquiryEmail`,
            plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount code imagetools fontawesome',
            toolbar: 'fontawesome | searchreplace |undo redo | blocks |bold italic underline strikethrough | align | link image media table | numlist bullist indent outdent',
            // toolbar: 'undo redo | blocks fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat code | fontawesome | searchreplace',
            image_advtab: true,
            // extended_valid_elements: 'svg[*],path[*],use[*]',
            valid_elements: '*[*]',
            valid_children: '*[*]',
            extended_valid_elements: '*[*]',
            file_picker_types: 'image',
            file_picker_callback: function(callback, value, meta) {
                if (meta.filetype === 'image') {
                    // Implement your custom file picker logic here
                    // For example, you can use an input type=file or open a file picker dialog
                    // Once the user selects an image, pass the selected file to the callback
                    // using the callback function provided by TinyMCE
                }
            }
        });

        tinymce.init({
            selector: `#editor_customEmail`,
            plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount code imagetools fontawesome',
            toolbar: 'fontawesome | searchreplace |undo redo | blocks |bold italic underline strikethrough | align | link image media table | numlist bullist indent outdent',
            // toolbar: 'undo redo | blocks fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat code | fontawesome | searchreplace',
            image_advtab: true,
            // extended_valid_elements: 'svg[*],path[*],use[*]',
            valid_elements: '*[*]',
            valid_children: '*[*]',
            extended_valid_elements: '*[*]',
            file_picker_types: 'image',
            file_picker_callback: function(callback, value, meta) {
                if (meta.filetype === 'image') {
                    // Implement your custom file picker logic here
                    // For example, you can use an input type=file or open a file picker dialog
                    // Once the user selects an image, pass the selected file to the callback
                    // using the callback function provided by TinyMCE
                }
            }
        });


        tinymce.init({
            selector: `#editor_offerLetter`,
            plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount code imagetools fontawesome',
            toolbar: 'fontawesome | searchreplace |undo redo | blocks |bold italic underline strikethrough | align | link image media table | numlist bullist indent outdent',
            // toolbar: 'undo redo | blocks fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat code | fontawesome | searchreplace',
            image_advtab: true,
            // extended_valid_elements: 'svg[*],path[*],use[*]',
            valid_elements: '*[*]',
            valid_children: '*[*]',
            extended_valid_elements: '*[*]',
            file_picker_types: 'image',
            file_picker_callback: function(callback, value, meta) {
                if (meta.filetype === 'image') {
                    // Implement your custom file picker logic here
                    // For example, you can use an input type=file or open a file picker dialog
                    // Once the user selects an image, pass the selected file to the callback
                    // using the callback function provided by TinyMCE
                }
            }
        });


        tinymce.init({
            selector: `#editor_universityCourseSuggestionsEmail`,
            plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount code imagetools fontawesome',
            toolbar: 'fontawesome | searchreplace |undo redo | blocks |bold italic underline strikethrough | align | link image media table | numlist bullist indent outdent',
            // toolbar: 'undo redo | blocks fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat code | fontawesome | searchreplace',
            image_advtab: true,
            // extended_valid_elements: 'svg[*],path[*],use[*]',
            valid_elements: '*[*]',
            valid_children: '*[*]',
            extended_valid_elements: '*[*]',
            file_picker_types: 'image',
            file_picker_callback: function(callback, value, meta) {
                if (meta.filetype === 'image') {
                    // Implement your custom file picker logic here
                    // For example, you can use an input type=file or open a file picker dialog
                    // Once the user selects an image, pass the selected file to the callback
                    // using the callback function provided by TinyMCE
                }
            }
        });


        tinymce.init({
            selector: `#editor_customContactInformation`,
            plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount code imagetools fontawesome',
            toolbar: 'fontawesome | searchreplace |undo redo | blocks |bold italic underline strikethrough | align | link image media table | numlist bullist indent outdent',
            // toolbar: 'undo redo | blocks fontsize | bold italic underline strikethrough | link image media table | align lineheight | numlist bullist indent outdent | emoticons charmap | removeformat code | fontawesome | searchreplace',
            image_advtab: true,
            // extended_valid_elements: 'svg[*],path[*],use[*]',
            valid_elements: '*[*]',
            valid_children: '*[*]',
            extended_valid_elements: '*[*]',
            file_picker_types: 'image',
            file_picker_callback: function(callback, value, meta) {
                if (meta.filetype === 'image') {
                    // Implement your custom file picker logic here
                    // For example, you can use an input type=file or open a file picker dialog
                    // Once the user selects an image, pass the selected file to the callback
                    // using the callback function provided by TinyMCE
                }
            }
        });



        function customEmail(event) {
            event.preventDefault();
            var id = $('#templates_id').val();
            var type = $('#templates_type').val();
            var subject = $('#templates_subject').val();
            var customFile = $('#customFileD').val();
            
            var message = null;

            var formData = new FormData();

            // Append the selected file to the FormData object
            var customFileInput = document.getElementById('customFileD');
            if (customFileInput.files.length > 0) {
                for (var i = 0; i < customFileInput.files.length; i++) {
                    formData.append('customFile[]', customFileInput.files[i]);
                }
            }


            if (type === 'enquiryEmail') {
                message = tinymce.get("editor_enquiryEmail").getContent();
            } else if (type === 'customEmail') {
                message = tinymce.get("editor_customEmail").getContent();

                var isFileValid = checkFiles(customFileInput);

                if (isFileValid != true && customFile) {
                    toastr.error("Invalid file. Please check the file size and type.");
                    return;
                }
            } else if (type === 'offerLetter') {
                message = tinymce.get("editor_offerLetter").getContent();
            } else if (type === 'universityCourseSuggestionsEmail') {
                message = tinymce.get("editor_universityCourseSuggestionsEmail").getContent();
                var isFileValid = checkFiles(customFileInput);

                if (isFileValid != true && customFile) {
                    toastr.error("Invalid file. Please check the file size and type.");
                    return;
                }
            } else if (type === 'customContactInformation') {
                message = tinymce.get("editor_customContactInformation").getContent();
                var isFileValid = checkFiles(customFileInput);

                if (isFileValid != true && customFile) {
                    toastr.error("Invalid file. Please check the file size and type.");
                    return;
                }
            }



            if (!id) {
                toastr.error("ID is required.");
                return;
            }

            if (!type) {
                toastr.error("Templates Type is required.");
                return;
            }
          
            if (!subject || !message) {
                toastr.error("Templates Subject and Message are required.");
                return;
            }
            const button = event.target;
            // button.style.display = 'none';
            button.disabled = true;
            button.style.backgroundColor = 'gray';
            const loader = document.getElementById('loader3');
            loader.style.display = 'inline-block';

            formData.append('id', id);
            formData.append('type', type);
            formData.append('subject', subject);
            formData.append('message', message);
            formData.append('_token', '{{ csrf_token() }}');

            $.ajax({
                url: "{{ route('candidate.customEmail', ['id' => ':id']) }}".replace(':id', id),
                type: "post",
                data: formData, // Use the FormData object for data
                contentType: false, // Set to false for FormData
                processData: false, // Set to false for FormData
                dataType: 'json',
                success: function(result) {
                    loader.style.display = 'none';
                    // button.style.display = 'inline-block';
                    button.disabled = false;
                    button.style.backgroundColor = '#066AC9';
                    var customFile = $('#customFileD').val('');
                    toastr.success("Email send successfully!");
                    $("body").removeClass("no-scroll");
                    $('#exampleModal_customEmail').find('[data-dismiss="modal"]').trigger('click');
                },
                error: function(xhr, status, error) {
                    loader.style.display = 'none';
                    // button.style.display = 'inline-block';
                    button.disabled = false;
                    button.style.backgroundColor = '#066AC9';
                    // Handle the error response, e.g., show an error message
                    // console.error(xhr.responseText);
                    toastr.error("Error sending email. Please try again later.");
                }
            });

        };

        function checkFiles(input) {
            const maxFileSizeMB = 22;
            const allowedExtensions = ['pdf', 'doc', 'xlsx' ,'csv', 'docx', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg'];

            const files = input.files;

            for (let i = 0; i < files.length; i++) {
                const file = files[i];

                const fileSizeMB = file.size / (1024 * 1024); // Convert bytes to megabytes
                const fileExtension = file.name.split('.').pop().toLowerCase();

                if (fileSizeMB > maxFileSizeMB) {
                    alert('File size exceeds the maximum limit of ' + maxFileSizeMB + 'MB.');
                    input.value = ''; // Clear the file input
                    return false;
                }
                // else if (!allowedExtensions.includes(fileExtension)) {
                //     alert('Invalid file extension. Please select valid files with extensions: ' + allowedExtensions.join(', '));
                //     input.value = ''; // Clear the file input
                //     return false;
                // }
            }
            return true;
        }
    </script>
    {{-- /////////////////////////follow-up////////////////////////// --}}
    <script>
        $(document).ready(function() {

            var dtToday = new Date();
            var month = dtToday.getMonth() + 1; // getMonth() is zero-based
            var day = dtToday.getDate();
            var year = dtToday.getFullYear();
            if (month < 10)
                month = '0' + month.toString();
            if (day < 10)
                day = '0' + day.toString();

            var maxDate = year + '-' + month + '-' + day;
            $('#follow-up-date').attr('min', maxDate);

            // Select the date and time input fields and the error message element
            var dateInput = $('#follow-up-date');
            var timeInput = $('#follow-up-time');
            var errorMsg = $('.follow-up-date-time-msg');

            // Function to validate date and time
            function validateDateTime() {
                var selectedDate = dateInput.val();
                var selectedTime = timeInput.val();

                if (!selectedDate || !selectedTime) {
                    errorMsg.text("Please select both a date and a time");
                    return false;
                }

                // Clear any error message if both date and time are selected
                errorMsg.text("");
                return true;
            }

            // Add change event listeners to date and time inputs
            dateInput.on('change', validateDateTime);
            timeInput.on('change', validateDateTime);
        });


        $('#follow-up').on('change', function() {
            var selectedOption = $(this).val();
            $('#form32').val(' ');
            if (selectedOption === 'no' || selectedOption === 'close') {
                $('#follow-up-date').val('');
                $('#follow-up-time').val('');
                $('.followDatetimehide').hide();
            } else {
                $('.followDatetimehide').show();
            }
        });


        function customFollowupModel(event, candidateId) {
            event.preventDefault();
            $("#followClose").hide();
            $('.create-followup-popup').hide();
            $('#manage_followup_popup').attr('value', 'close');
            $("#customFollowUpShow").show();
            $("#followClose,#followCloseShow").hide();
            // Clear and initialize form input fields
            $('#FollowUpsForm')[0].reset();
            $('#FollowUpsForm').find('select').val('').trigger('change');

            // Show your popup or perform other actions here
            $("#follow-up-id").val(candidateId);

            $('.create-followup-popup').show();
        }



        $('#follow_up_status').on('change', function(event) {
            var follow_up_s = $(this).val();
            if (follow_up_s == 'Connected') {
                $('.comment_not_connected').hide();
                $('.comment_connected').show();
            } else if (follow_up_s == 'Not Connected') {
                $('.comment_not_connected').show();
                $('.comment_connected').hide();
            }
            $('.comment_not_connected').hide();
                $('.comment_connected').hide();

        });


        $('.comment_not_connected').hide();
        // $('.comment_connected').hide();
        $('.hide_comment').hide();


        $('#follow_up_status').on('change', function(event) {
            var follow_up_s = $(this).val();
            if (follow_up_s == 'Connected') {
                $('.comment_not_connected').hide();
                $('.comment_connected').show();
            } else if (follow_up_s == 'Not Connected') {
                $('.comment_not_connected').show();
                $('.comment_connected').hide();
            }

        });

        $('#comment_connected, #comment_not_connected').on('change', function(event) {
            $('.hide_comment').hide();
            var comment_connecteds = $(this).val();
            if (comment_connecteds === 'Other') {
                $('#comment').val("");
                $('.hide_comment').show();
                
            }else if(comment_connecteds != ''){
                $('#comment').val(comment_connecteds);
                $('.hide_comment').show();
            }
        });

        function customFollowupSave(event, closenext) {
            $('.text-danger').text('');
            
            event.preventDefault();

            var user_id = $("#follow-up-id").val();
            var comment = $('#comment').val();
            var type = $('#follow-up-type').val();
            var followupdate = $('#follow-up-date').val();
            var followuptime = $('#follow-up-time').val();

            var followupstage = $('#follow_up_stage').val();
            var followupdroppedreason = $('#stageSelect_hide_show').val();
            var followupdroppedreasoncomment = $('#follow_up_dropped_reason_comment').val();



            var datetimeMarage = followupdate + " " + followuptime;
            var formattedDateTime = null;
            var comment_not_connected = $('#comment_not_connected').val();
            var comment_connected = $('#comment_connected').val();
            var assign_to = $('#assignee_name').val();

            if (datetimeMarage) {
                var parsedDate = new Date(datetimeMarage);

                // Format the date and time in the desired format
                var formattedDateTime = parsedDate.getFullYear() + "-" +
                    String(parsedDate.getMonth() + 1).padStart(2, '0') + "-" +
                    String(parsedDate.getDate()).padStart(2, '0') + " " +
                    String(parsedDate.getHours() % 12 || 12).padStart(2, '0') + ":" +
                    String(parsedDate.getMinutes()).padStart(2, '0') + ":" +
                    String(parsedDate.getSeconds()).padStart(2, '0') + " " +
                    (parsedDate.getHours() >= 12 ? "PM" : "AM");

            }


            var datetime = formattedDateTime;
            var follow_up_status = $('#follow_up_status').val();
            var priority = $('#priority').val();
            var followup = "close";


            if (!user_id) {
                toastr.error("ID is required.");
                return;
            }

            // Reset any previous error messages
            $('.text-danger').text('');

            var isValid = true;
            var customFollowupSave = false;

            if (type === '') {
                $('.follow-up-type-msg').text('Please select a type.');
                
                isValid = false;
                return;
            }


            if (follow_up_status === '') {
                $('.follow_up_status_msg').text('Please select a status.');
             
                isValid = false;
                return;

            } else {

                if (follow_up_status == "Connected") {
                  
                    if ($('#comment_connected').val() == '') {
                        $('.comment_connected_msg').text('Please select a comment.');
                        isValid = false;
                        return;
                    }

                } else if (follow_up_status == "Not Connected") {
                   
                    if ($('#comment_not_connected').val() == '') {
                        $('.comment_not_connected_msg').text('Please select a comment.');
                        isValid = false;
                        return;

                    }
                }
            }



            if (followup == '') {
                $('.follow_up_status_msg').text('Please select a status.');
              
                isValid = false;
                return;

            }


            if (followup == '') {
                $('.follow-up-msg').text('Please select an option.');

                isValid = false;
                return;
            }


            if(closenext == 'close'){
                followup = "close";
                 $("#followClose").hide();
                 $("#followCloseShow").show();
                 $('#manage_followup_popup').attr('value', 'yes');
                 $("#customFollowUpShow").hide();
                if (!followupstage) {
                    $('.follow_up_stage_msg').text('Please select an option.');
                    isValid = false;
                    return;
                }
                if (followupstage && followupstage == "Student backed out / Dropped") {
                    if(!followupdroppedreason){
                        $('.follow_up_dropped_reason_msg').text('Please select an option.');
                        isValid = false;
                        return;
                    }
                    if (!followupdroppedreasoncomment) {
                        $('.follow_up_dropped_reason_comment_msg').text('Please enter a dropped reason.');
                        isValid = false;
                        return;
                    }
                   
                }
               
                return;
            }else if(closenext == 'closenext'){
                setDefaultTime();
                $('#manage_followup_popup').attr('value', 'yes');
                $("#customFollowUpShow").hide();
                $("#followClose").show();
                $("#followCloseShow").hide();
                return;
            }else if(closenext == 'closeSave'){
                if (!followupstage) {
                    $('.follow_up_stage_msg').text('Please select an option.');
                    isValid = false;
                    return;
                }
                if (followupstage && followupstage == "Student backed out / Dropped") {
                    if(!followupdroppedreason){
                        $('.follow_up_dropped_reason_msg').text('Please select an option.');
                        isValid = false;
                        return;
                    }
                    if (!followupdroppedreasoncomment) {
                        $('.follow_up_dropped_reason_comment_msg').text('Please enter a dropped reason.');
                        isValid = false;
                        return;
                    }
                    followup = "close";
                }
            }else{
                $("#followClose").show();
                $("#followCloseShow").hide();
                var followup = "yes";

            }
          






            if (followup != 'close' && followup != 'no' && datetime !== '') {
                var checkfollowupsDatetime = true;
                if (followupdate == '' || followuptime == '') {
                    $('.follow-up-date-time-msg').text('Please enter a date and time.');
                    
                    isValid = false;
                    checkfollowupsDatetime = false;
                }
                if (checkfollowupsDatetime) {
                   
                    $.ajax({
                        url: "{{ route('candidate.checkfollowupsDatetime') }}",
                        type: "get",
                        data: {
                            admin_id: assign_to,
                            datetime: datetime,
                            _token: '{{ csrf_token() }}'
                        },
                        dataType: 'json',
                        success: function(result) {

                            if (result.status == "1") {
                                
                                isValid = false;
                               
                                $('.follow-up-date-time-msg').text('This slot already book.');
                                // $('#datetime').find('.text-danger').text('This slot already book.');

                            } else if (isValid) {
                                saveFollowup(user_id,type,follow_up_status,priority,assign_to,comment_connected,comment_not_connected,comment,followup,datetime,event,followupstage,followupdroppedreason,followupdroppedreasoncomment);
                            }



                        }
                    });
                }



            } else {

                if (isValid) {
                    customFollowupSave = true;
                      saveFollowup(user_id,type,follow_up_status,priority,assign_to,comment_connected,comment_not_connected,comment,followup,datetime,event,followupstage,followupdroppedreason,followupdroppedreasoncomment);
                }
            }

            
           
            // console.log("list pringt");
            followup_list();


        }

        


        function saveFollowup(user_id, type, follow_up_status, priority, assign_to, comment_connected, comment_not_connected, comment, followup, datetime, event, stage, reason, reasonComment) {
            var sumbittype = true;

            if (followup == "close" && stage) {
                sumbittype = false;

                Swal.fire({
                    title: "Are you sure?",
                    text: "Are you sure you want to change this stage: " + stage + "?",
                    icon: "warning",
                    showCancelButton: true,
                    confirmButtonText: "Yes",
                    cancelButtonText: "No",
                }).then((result) => {
                    if (result.isConfirmed) {
                        sumbittype = true;
                        // Perform any further actions if confirmed
                        performFollowup(user_id, type, follow_up_status, priority, assign_to, comment_connected, comment_not_connected, comment, stage, reasonComment, followup, datetime, event);
                    }
                });
            } else {
                performFollowup(user_id, type, follow_up_status, priority, assign_to, comment_connected, comment_not_connected, comment, stage, reasonComment, followup, datetime, event);
            }
        }

        function performFollowup(user_id, type, follow_up_status, priority, assign_to, comment_connected, comment_not_connected, comment, stage, reasonComment, followup, datetime, event) {
            const button = event.target;
            button.disabled = true;
            button.style.backgroundColor = 'gray';
            var loader = followup === "close" ? document.getElementById('loader5') : document.getElementById('loader4');
            loader.style.display = 'inline-block';

            $.ajax({
                url: "{{ route('followup.storeFollowup', ['id' => ':id']) }}".replace(':id', user_id),
                type: "post",
                data: {
                    type: type,
                    follow_up_status: follow_up_status,
                    priority: priority,
                    assign_to: assign_to,
                    comment_connected: comment_connected,
                    comment_not_connected: comment_not_connected,
                    comment: comment,
                    stage: stage,
                    reasonComment: reasonComment,
                    followup_up: followup,
                    datetime: datetime,
                    _token: '{{ csrf_token() }}'
                },
                dataType: 'json',
                success: function(result) {
                    button.disabled = false;
                    button.style.backgroundColor = '#055aab';
                    loader.style.display = 'none';
                    
                    toastr.success("FollowUp Created successfully!");
                    $("body").removeClass("no-scroll");
                    $('.create-followup-popup').hide();
                    $(".overlay").hide();
                    followup_list();

                },
                error: function(xhr, status, error) {
                    loader.style.display = 'none';
                    button.disabled = false;
                    button.style.backgroundColor = '#055aab';
                    // console.error(xhr.responseText);
                    toastr.error("Something Went Wrong", 'Error!');
                }
            });
        }

    </script>

    <script>
            function backBtnWhatsapp(){
                var value = $('#manage_whatsapp_popup').val();
                
               
                if(value == "close"){
                   $('.whatsapp-popup').hide();
                   $('.overlay').hide();
                   $("body").removeClass("no-scroll");
                   $('#manage_whatsapp_popup').attr('value', 'close');
                }else if(value == "yes"){
                    $(".customWhatsAppSendShow").hide();
                    $(".customWhatsAppSendHIDE").show();
                    $('#manage_whatsapp_popup').attr('value', 'close');
                }else{
                    $('.close-popup').trigger('click');
                    $("body").removeClass("no-scroll");
                    $('#manage_whatsapp_popup').attr('value', 'close');
                }

               
            }

            function backBtnFollows(){
                var value = $('#manage_followup_popup').val();
                
               
                if(value == "close"){
                    $('.create-followup-popup').hide();
                   $('.overlay').hide();
                   $("body").removeClass("no-scroll");
                   $('#manage_followup_popup').attr('value', 'close');
                }else if(value == "yes"){
                    $("#customFollowUpShow").show();
                    $('#followCloseShow, #followClose').hide();
                    $('#manage_followup_popup').attr('value', 'close');
                }else{
                    $('.close-popup').trigger('click');
                    $("body").removeClass("no-scroll");
                    $('#manage_followup_popup').attr('value', 'close');
                }
               
            }

            $('#closee_mail_popup').click(function() {
                $('.close-popup').trigger('click');
                
            });


            $('.follow_up_stage').on('change', function() {
            var selectedOption = $(this).val();
            
            if(selectedOption == "Student backed out / Dropped"){
              stageSelect_hide_show("Student backed out / Dropped");
            
            }else if(selectedOption == "Offer Rejected"){
              stageSelect_hide_show("Offer Rejected");
            }else if(selectedOption == "Offer Accepted"){
              stageSelect_hide_show("Offer Accepted");
            }else{
                stageSelect_hide_show("no");
            }
            });

            function stageSelect_hide_show(selectedOption) {
                $(".stageSelect_hide_show, .stageType_hide_show").hide();
        
                if (selectedOption === 'Student backed out / Dropped') {      
                    $(".stageSelect_hide_show").show();
                   
                }
               
            }


            $('.stageTypeSelect_show').on('change', function() {
                var selectedOptiontype = $(this).val();
                $("#follow_up_dropped_reason_comment").val("");
                if (selectedOptiontype === 'other') {     
                    stageSelectype_hide_show("yes");
                }else{
                    $("#follow_up_dropped_reason_comment").val(selectedOptiontype);
                    stageSelectype_hide_show("no");
                }
            
            });

            function stageSelectype_hide_show(selectedOpftion) {

            if (selectedOpftion === 'yes') {      
                    $(".stageType_hide_show").show();
                } else {
                    $(".stageType_hide_show").hide();
                }
            }
            

        ////////////////////////defolet corent time ///////////////
        function setDefaultTime() {
            const timeInput = document.getElementById('follow-up-time');
            if (timeInput) {
                timeInput.value = getCurrentTimePlusOneMinute();
            }
        }

        function getCurrentTimePlusOneMinute() {
            const now = new Date();
            now.setMinutes(now.getMinutes() + 1); // Increment current time by one minute
            const hours = String(now.getHours()).padStart(2, '0');
            const minutes = String(now.getMinutes()).padStart(2, '0');
            return `${hours}:${minutes}`;
        }

        </script>

@endsection
