<div class="col-md-12 mb-4 mt-4 open_education_edit_info_div">
    <div  style="width: 100%;">
        <div class="panel-body" style="padding:10px; background-color: #4b4c6824;  border: 1px solid #e9e5e5; border-radius: 5px;">
            <form method="POST" action="{{route('ajax-post', ['name'=>'update_work_experience'])}}" class="edit_form"> 
                <input type="hidden" name="_token" value="{{ csrf_token() }}" />
                <input type="hidden" name="edit_id" value="{{$edit_data->id}}">
                <div class="row">
                    <div class="col-md-3">
                        <div class="mb-1">
                                <label class="form-label">Company Name <span class="text-danger">*</span></label>
                            <div class="form-icon position-relative">
                                    <input type="text" for="company name" name="companyname" value="{{$edit_data->company_name}}" class="form-control ps-2" placeholder="Company Name" required="">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="mb-1">
                                <label class="form-label" for="designation">Designation <span class="text-danger">*</span></label>
                        <div class="form-icon position-relative">
                                <input type="text" for="designation" name="designation" value="{{$edit_data->designation}}" class="form-control ps-2" placeholder="Designation" required="">
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-1">
                                        <label class="form-label">Start Date <span class="text-danger">*</span></label>
                                    <div class="form-icon position-relative">
                                        <select name="startdate" id="start date" class="form-control frm" required="">
                                            <option disabled="" selected="" value="">Year</option> 
                                            @foreach($years as $row)
                                            <option value="{{$row}}" @if($edit_data->start_date==$row) selected @endif>{{$row}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="mb-1 mt-2">
                                        <label class="form-label"></label>
                                    <div class="form-icon position-relative">
                                        <select name="startmonth" id="month" class="form-control frm" required="">
                                            <option disabled="" selected="" value="">Month</option>
                                            <option value="01">January</option>
                                            <option value="02">February</option>
                                            <option value="03">March</option>
                                            <option value="04">April</option>
                                            <option value="05">May</option>
                                            <option value="06">June</option>
                                            <option value="07">July</option>
                                            <option value="08">August</option>
                                            <option value="09">September</option>
                                            <option value="10">October</option>
                                            <option value="11">November</option>
                                            <option value="12">December</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3 mt-4 pt-2" style="display:flex; font-size:13px; font-weight:600; color: white;">
                        Currently working in that company?
                        <div class="form-check form-switch" id="checkCurrentlyWorking" style="margin-top: 14px;">
                            <input class="form-check-input" type="checkbox" name="currently_working" @if($edit_data->currently_working =='1') checked @endif>
                            <label class="form-check-label" for="checkCurrentlyWorking"></label>
                        </div>
                    </div>
                    <div class="col-md-3" id="end_date_div">
                        <div class="row">
                            <div class="col-md-6">
                                <div class="mb-1">
                                        <label class="form-label">End Date <span class="text-danger">*</span></label>
                                    <div class="form-icon position-relative">
                                        <select name="enddate" id="end date" class="form-control frm">
                                            <option disabled="" selected="" value="">Year</option> 
                                            @foreach($years as $row)
                                            <option value="{{$row}}" @if($edit_data->end_date==$row) selected @endif>{{$row}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="mb-1 mt-2">
                                        <label class="form-label"></label>
                                    <div class="form-icon position-relative">
                                        <select name="endmonth" id="month" class="form-control frm">
                                            <option disabled="" selected="" value="">Month</option>
                                            <option value="01">January</option>
                                            <option value="02">February</option>
                                            <option value="03">March</option>
                                            <option value="04">April</option>
                                            <option value="05">May</option>
                                            <option value="06">June</option>
                                            <option value="07">July</option>
                                            <option value="08">August</option>
                                            <option value="09">September</option>
                                            <option value="10">October</option>
                                            <option value="11">November</option>
                                            <option value="12">December</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="text-end">
                        <button type="button" class="btn cancel_button mr-1 btn-cancel close_form" style="background-color: #ffbd59 !important; border: 2px solid #ffbd59; color: white;border-radius: 18px; padding: 2px 6px;" >
                            <i aria-hidden="true" class="fa fa-refresh"></i>
                        </button>
                        <button class="btn btn2">Update</button>                      
                    </div>
                </div>
                
            </form>  
        </div>
    </div>
</div>
 

<script>
    $(function(){ 
         
        $('.edit_form').on('submit', function(event){
                event.preventDefault();
                var self = $(this); 
                ajax_form(self, function(self){
                    $('.edit_work_experience_form').empty();
                    fetch_sub_content(
                        '#work_experience_load',
                        "{{ route('sub-content', ['name'=>'work_experience_load']) }}"
                    );  
                });
        });
   

    $('.cancel_button').on('click', function(){ 
        $('.edit_data').addClass('d-none')
    });
});
</script>