@extends('supervisor.layouts.master')
@section('content')
    <div class="container-fluid mt-1" style="padding: 0px !important;">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-12">
                        <div class="card profile_top_part_info">
                            <div class="whole_part">
                                <div class="right_part">
                                    <div class="right_part_right">
                                        <div class="right_part_right_whole">
                                            <div class="col-md-5 mt-1 left-box">
                                                <div class="ms-3 mt-2">
                                                    <div style="display:flex;">
                                                        @if($proposal_details->student_details->nationality)
                                                            <img class="img-responsive listFlag mt-2" style="border-radius: 2px; padding: 0px;height: 45px; width: 45px;" src="{{ asset('/assets/img/flags/4x3').'/'.strtolower(cn($proposal_details,'student_details.country_name.iso_3166_2','')).'.svg' }}" alt="Flag" data-toggle="tooltip" title="" data-placement="top">
                                                        @endif
                                                        <div class="alert" style="background-color:white; padding: 3px 7px; margin-bottom: 0px;">
                                                            <span style="font-size: 19px; font-weight: 700;">{{cn($proposal_details,'student_details.first_name','')}} {{cn($proposal_details,'student_details.last_name','')}}</span> <br>
                                                            <span style="font-size:12px;">
                                                                <!-- <span style="color: #868e96;">Gender :</span> -->
                                                                <a href="" class="rounded" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Gender" style="color: black !important;">{{\Str::ucfirst(cn($proposal_details,'student_details.gender',''))}}</a>
                                                            </span>
                                                            <span> • </span>
                                                            <span style="font-size:12px;">
                                                                <a href="" class="rounded" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Age" style="color: black !important;">{{age_calculator(cn($proposal_details,'student_details.dob',''))}}</a>
                                                                <!-- <span style="color: #868e96;">Age :</span> -->
                                                                {{-- <strong>23 years 3 month</strong> --}}
                                                            </span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="p-3 left-box" style="width: 65%;">
                                                <h6 class="ref">
                                                        Apply Ref: {{$proposal_details->student_apply_ref ?? "N/A"}}

                                                        {{-- {{cn($proposal_details,'teacher_details.ref_no','')}} --}}
                                                </h6>
                                                <span>
                                                    <strong style="font-size: 14px;">
                                                        {{cn($proposal_details,'proposal.title','')}}
                                                    </strong >
                                                </span>
                                                <div class="mt-1">
                                                    <span style="font-size:12px;">
                                                        <a href="" class="rounded" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Methology" style="color: black !important;">{{cn($proposal_details,'proposal.methology','')}}</i></a>
                                                    </span>
                                                    <span> • </span>
                                                    <span style="font-size:12px;">
                                                        <a href="" class="rounded" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Funding Status" style="color: black !important;">{{cn($proposal_details,'proposal.status','')}}</i></a>
                                                    </span>
                                                    <span> • </span>
                                                    <span style="font-size:12px;">
                                                        <a href="" class="rounded" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Preferred Start Date" style="color: black !important;">{{ date("M Y", strtotime($proposal_details->created_at))}}</i></a>
                                                    </span>
                                                </div>
                                                <div class="mt-1">
                                                    <span style="font-size:12px;">
                                                        <span>Applied On : </span>
                                                        <strong style="font-weight: 700; font-size: 12px; letter-spacing: 0.8px;">{{ date("d M Y", strtotime($proposal_details->created_at))}}</strong>
                                                    </span>
                                                </div>
                                            </div>
                                            <div class="ms-3 mt-1" style="width: 40%; padding: 7px; display: grid;">
                                                <div class="card rounded border-0" style="background-color: white;">
                                                    <div class="info-palate mt-0" style="margin:0px;">
                                                        <div class="left">
                                                            <div>
                                                                <div class="single_glance_row mt-1">
                                                                    <span class="title" style="font-size:12px; font-weight: 600;">Proposal Quality :</span>
                                                                    <span class="tbl2 mb-2 pro_top_rating" style="float:right;">
                                                                        <input type="radio" class="rate_star_update" data-id="{{$proposal_details->id}}" id="star5" name="rate" value="5" @if($proposal_details->proposal_quality ==5) checked @endif/>
                                                                        <label class="rate_star hand tooltips" for="star5" title="5 stars"></label>
                                                                        <input type="radio" class="rate_star_update" data-id="{{$proposal_details->id}}" id="star4" name="rate" value="4" @if($proposal_details->proposal_quality ==4) checked @endif/>
                                                                        <label class="rate_star hand tooltips" for="star4" title="4 stars"></label>
                                                                        <input type="radio" class="rate_star_update" data-id="{{$proposal_details->id}}" id="star3" name="rate" value="3" @if($proposal_details->proposal_quality ==3) checked @endif/>
                                                                        <label class="rate_star hand tooltips" for="star3" title="3 stars"></label>
                                                                        <input type="radio" class="rate_star_update" data-id="{{$proposal_details->id}}" id="star2" name="rate" value="2" @if($proposal_details->proposal_quality ==2) checked @endif/>
                                                                        <label class="rate_star hand tooltips" for="star2" title="2 stars"></label>
                                                                        <input type="radio" class="rate_star_update" data-id="{{$proposal_details->id}}" id="star1" name="rate" value="1"  @if($proposal_details->proposal_quality ==1) checked @endif/>
                                                                        <label class="rate_star hand tooltips" for="star1" title="1 star"></label>
                                                                    </span>
                                                                </div>
                                                                <div class="single_glance_row mt-1">
                                                                    <span class="title" style="font-size:12px; font-weight: 600;">Concept :</span>
                                                                    <div class="top_part_status" style="position: relative; width: fit-content; margin-left: 10px; float: right;">
                                                                        @if($proposal_details->concept==1)
                                                                            <span class="top_part_status_name" style="background: #bcfaca; color: #0a9652;">
                                                                                Good
                                                                            </span>
                                                                        @elseif($proposal_details->concept==2)
                                                                            <span class="top_part_status_name" style="background: #ffca84; color: #ee8414;">
                                                                                Average
                                                                            </span>
                                                                        @else
                                                                            <span class="top_part_status_name" style="background: #f8c8c8; color: #db390c;">
                                                                                Poor
                                                                            </span>
                                                                        @endif
                                                                        <div class="dropdown" style="top:-2px; position: absolute; right: 9px;">
                                                                                <i class="fa fa-caret-down dropdown-toggle add_hover tooltips" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" data-original-title="Change Status" style="color: #8c9094; margin-top: 4px;"></i>
                                                                            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; transform: translate3d(10px, 13px, 0px); top: 0px; left: 0px; will-change: transform; margin-left: -75px; z-index: 2; margin-top: 10px;">
                                                                                <a class="dropdown-item concept_change" data-val="1" @if($proposal_details->concept==1) {{'activate'}} @endif" data-id="{{$proposal_details->id}}"  name="concept">Good</a>
                                                                                <a class="dropdown-item concept_change" data-val="2" @if($proposal_details->concept==2) {{'activate'}} @endif" data-id="{{$proposal_details->id}}" name="concept">Average</a>
                                                                                <a class="dropdown-item concept_change" data-val="3" @if($proposal_details->concept==3) {{'activate'}} @endif" data-id="{{$proposal_details->id}}" name="concept">Poor</a>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="single_glance_row mt-1" style="border-bottom: none;">
                                                                        <span class="title" style="font-size:12px; font-weight: 600;">Status :</span>
                                                                    <div class="top_part_status" style="position: relative; width: fit-content; margin-left: 10px; float: right;">
                                                                        @if($proposal_details->proposal_status==1)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            New
                                                                        </span>
                                                                        @endif
                                                                        @if($proposal_details->proposal_status==2)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Reviewing
                                                                        </span>
                                                                        @endif
                                                                        @if($proposal_details->proposal_status==3)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Pause
                                                                        </span>
                                                                        @endif
                                                                        @if($proposal_details->proposal_status==4)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Hold
                                                                        </span>
                                                                        @endif
                                                                        @if($proposal_details->proposal_status==5)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Interested
                                                                        </span>
                                                                        @endif

                                                                        @if($proposal_details->proposal_status==6)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Rejected
                                                                        </span>
                                                                        @endif
                                                                        @if($proposal_details->proposal_status==7)
                                                                        <span class="top_part_status_name" style="background: #dcdcdc; color: #8c9094;">
                                                                            Terminate
                                                                        </span>
                                                                        @endif
                                                                        <div class="dropdown" style="top: -2px; position: absolute; right: 9px;">
                                                                                <i class="fa fa-caret-down dropdown-toggle add_hover tooltips" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" data-original-title="Change Status" style="color: #8c9094;"></i>
                                                                            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton" x-placement="bottom-start" style="position: absolute; transform: translate3d(10px, 13px, 0px); top: 0px; left: 0px; will-change: transform; margin-left: -75px; z-index: 2; margin-top: 10px;">
                                                                                {{-- <a class="dropdown-item status_change hand" data-val="1" data-id="{{$proposal_details->id}}" name="proposal_status">New</a> --}}
                                                                                <a class="dropdown-item status_change hand" data-val="2" data-id="{{$proposal_details->id}}" name="proposal_status">In Review</a>
                                                                                <a class="dropdown-item status_change hand" data-val="3" data-id="{{$proposal_details->id}}" name="proposal_status">Pause</a> <!--Push means less than 2 seconds does one thing -->
                                                                                <a class="dropdown-item status_change hand" data-val="4" data-id="{{$proposal_details->id}}" name="proposal_status">Hold</a>  <!--holding it for longer does something-->
                                                                                <a class="dropdown-item status_change hand" data-val="5" data-id="{{$proposal_details->id}}" name="proposal_status">Interested</a>
                                                                                <a class="dropdown-item open_modal_page hand" data-url="{{route('modal-get',['name'=>'proposal_status_rejected_form','id'=>$proposal_details->id])}}" data-title="Rejected" data-val="6" data-id="{{$proposal_details->id}}">Rejected</a>
                                                                                <a class="dropdown-item status_change hand" data-val="7" data-id="{{$proposal_details->id}}" name="proposal_status">Terminate</a>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4 mt-3 pt-2" style="width: 27%;">
                        <div class="card p-3 rounded border-0 mb-4" style="background-color: white;">
                            <div class="info-palate mt-0">
                                <div class="left">
                                    <div class="mb-2">
                                        <div class="Feedback" style="font-size: 17px; font-weight: 700;">Applicante Profile</div>
                                    </div>
                                    @if(count($education_history) > 0)
                                    @foreach($education_history as $row)
                                    <div class="summary_edu_part mt-1">
                                        <div class="education_head">
                                            <div class="left">
                                                <span class="edu_title">{{cn($row,'academic_level_info.name','')}}</span>
                                            </div>
                                            <div class="right">
                                                <span class="label_badge_radius" style="font-weight: 600; background: #1416398a; color: white;">{{$row->result}}</span>
                                            </div>
                                        </div>
                                        <div class="education_body mt-2">
                                            <ul>
                                                <li>{{$row->subject}}</li>
                                                <li>{{$row->institution}}</li>
                                                <li>{{$row->passing_year}}</li>
                                            </ul>
                                        </div>
                                    </div>
                                    @endforeach
                                    @endif

                                    <div class="summary_ielts_part mt-2 ms-2">
                                        <div class="education_head">
                                            <div class="left">
                                                <span class="edu_title">{{cn($proposal_details,'scores.test_name','')}}</span>
                                                    <div class="expiration">
                                                        <span class="tooltips" style="font-size: 11px; color: #868e96;" data-original-title="Expiration">
                                                            <i class="fa fa-calendar-check-o mr-1" style="color: #908f8f;"></i>
                                                            @if(!empty($proposal_details->scores->expiration_date)) {{ date('d M Y', strtotime(cn($proposal_details,'scores.expiration_date','')))}} @else @endif
                                                        </span>
                                                    </div>
                                                <span class="label_badge_radius" style="position: absolute; right: 10px; font-weight: 600; background: #1416398a; color: white;">{{cn($proposal_details,'scores.overall_score','')}}</span>
                                            </div>
                                        </div>
                                        <div class="education_body mt-1" style="border-bottom: 1px solid #e8eef1;padding: 8px 0px">
                                            <div class="result" style="display: flex;">
                                                <div class="result-part" style="font-size: 11px;">
                                                    <span class="single_point">Speaking:
                                                        <span class="point_number" style="font-weight: 700;">{{cn($proposal_details,'scores.speaking','')}},
                                                        </span>
                                                    </span>
                                                    </div>
                                                <div class="result-part" style="font-size: 11px;">
                                                    <span class="single_point ms-2">Listening:
                                                        <span class="point_number" style="font-weight: 700;">{{cn($proposal_details,'scores.listening','')}},
                                                        </span>
                                                    </span>
                                                </div>
                                                <div class="result-part" style="font-size: 11px;">
                                                    <span class="single_point ms-2">Writing:
                                                        <span class="point_number" style="font-weight: 700;">{{cn($proposal_details,'scores.writing','')}},
                                                        </span>
                                                    </span>
                                                </div>
                                                <div class="result-part" style="font-size: 11px;">
                                                    <span class="single_point ms-2">Reading:
                                                        <span class="point_number" style="font-weight: 700;">{{cn($proposal_details,'scores.reading','')}}
                                                        </span>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="single_glance_row mt-1" style="display: flex; width: 100%;">
                                        <span class="title" style="font-size:11px; font-weight: 600;">Work Experience:</span>

                                        @php    
                                            $work_history_first =$proposal_details->work_experience_date()->whereNotNull('start_date')->oldest()->first();

                                            $work_history_last =$proposal_details->work_experience_date()->latest()->first();
                                            if($work_history_first && $work_history_last && $work_history_last->end_date){

                                            $diff_in_days =diff_in_days($work_history_first->start_date,$work_history_last->end_date);

                                            }elseif($work_history_first){
                                            $diff_in_days =diff_in_days($work_history_first->start_date, now());
                                            }else{
                                            $diff_in_days =0;
                                            }

                                            $years = ($diff_in_days / 365) ;
                                            $years = floor($years);
                                            $month = ($diff_in_days % 365) / 30.5;
                                            $month = floor($month);
                                            $days = ($diff_in_days % 365) % 30.5;
                                            
                                        @endphp
                                        @if($proposal_details->student_details->is_work_experience ==1)
                                            <span class="label_badge_radius" style="background: #e7f3ea !important; color: #0ba52e; margin-left: 3px; position: absolute !important; right: 23px;">{{$years}} years</span>
                                            <span style="font-size: 12px; color: #868e96;"> 
                                                ({{ dDate($work_history_first->start_date) }} - {{dDate($work_history_last->end_date, 'd M Y', 'Continue')}})
                                            </span>
                                        @else
                                            <span class="label_badge_radius" style="background: #f1ac93 !important; color: #f80707; margin-left: 3px; position: absolute !important; right: 23px;">no</span>
                                        @endif
                                        <span style="font-size: 11px; color: #868e96;"></span>
                                    </div>
                                    <div class="single_glance_row mt-1" style="display: flex; width: 100%;">
                                        <span class="title" style="font-size:11px; font-weight: 600;">Have you ever attended any conferences<br> to present your papers?</span>
                                        @if($proposal_details->student_details->is_attended_conference ==1)
                                            <span class="label_badge_radius mt-2" style="background: #e7f3ea !important; color: #0ba52e; margin-left: 3px; position: absolute !important; right: 23px;">yes</span>
                                        @else
                                            <span class="label_badge_radius mt-2" style="background: #f1ac93 !important; color: #f80707; margin-left: 3px; position: absolute !important; right: 23px;">no</span>
                                        @endif
                                        <span style="font-size: 11px; color: #868e96;"></span>
                                    </div>
                                    <div class="single_glance_row_publication mt-1" style="display: flex; width: 100%;">
                                        <span class="title" style="font-size:11px; font-weight: 600;">Do you have any Publication?</span>
                                        @if($proposal_details->student_details->is_publication ==1) 
                                            <span class="label_badge_radius" style="background: #e7f3ea !important; color: #0ba52e; margin-left: 3px; position: absolute !important; right: 23px;">yes</span>
                                            
                                        @else
                                            <span class="label_badge_radius" style="background: #f1ac93 !important; color: #f80707; margin-left: 3px; position: absolute !important; right: 23px;">no</span>
                                        @endif
                                        <span style="font-size: 11px; color: #868e96;"></span>
                                    </div>
                                    @if($proposal_details->student_details->is_publication ==1)
                                    <div class="education_body mt-1">
                                        <div class="result" style="display: flex;">
                                            @foreach($proposal_details->publications as $row)
                                            <div class="result-part" style="font-size: 11px;">
                                                <span class="single_point">{{$row->publication }}:  
                                                    <span class="" style="font-weight: 700;background: #e7f3ea !important; color: #0ba52e;">
                                                        @if($row->status==1)
                                                          Published
                                                        @endif
                                                        @if($row->status==2)
                                                            Under Review
                                                        @endif
                                                        @if($row->status==3)
                                                            Draft stage
                                                        @endif
                                                    </span>
                                                </span>
                                            </div> 
                                            @endforeach
                                        </div>
                                    </div>
                                    @endif
                                </div>
                            </div>
                        </div>
                    </div><!--end col-->
                    <div class="col-md-8 mt-2" style="width: 73%;">
                        <div class="card border-0 mb-3" style="border-radius:6px !important;">
                            <div class="row">
                                @if($proposal_details->feedback_msg || $proposal_details->feedback_reason)
                                <div class="col-md-12" style="width: 99%;font-size: 12px !important; background-color:#fff0d6; border-radius: 6px; padding: 10px;color: rgb(237, 14, 14);">
                                    <div class="single_glance_row mt-1 single_edit_item">
                                        <div class="row" style="display: flex;">
                                            <div class="col-md-10" style="width: 90%;">
                                                <span class="title" style="font-size:11px; font-weight: 600; color: rgb(237, 14, 14) !important;"> <i class="fa fa-warning" style="font-size: 11px; margin-right: 5px; color: rgb(237, 14, 14) !important; top: 0px; position: relative;"></i>
                                                Feedback : @if($proposal_details->feedback_msg) {{$proposal_details->feedback_msg}}  @endif
                                                @if($proposal_details->feedback_reason) {{$proposal_details->feedback_reason}}   @endif
                                                </span>
                                            </div>

                                            <div class="col-md-2" style="width: 10%;">
                                                {{-- <span class="title" style="font-size:11px; font-weight: 600;">
                                                    <button type="button" class="btn btn2 edit_feedback mb-1" data-id="{{$proposal_details->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-pencil"></i></button>
                                                </span>
                                                <span class="title" style="font-size:11px; font-weight: 600;">
                                                    <button type="button" class="btn btn2 delete_feedback mb-1" data-id="{{$proposal_details->id}}" style="padding: 2px 5px !important; font-size: 11px;"><i class="fa fa-trash" style="margin-left:2px;"></i></button>
                                                </span> --}}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                @endif
                            </div>
                        </div>
                        <div class="card border-0 mt-0" style="border-radius:6px !important;">
                            <div class="row">
                                <div class="col-md-12" style="width: 99%; background-color:white; border-radius: 6px; padding: 10px;">
                                    <div class="row mt-3">
                                        <div class="col-md-8" style="width: 62%;">
                                            @if(file_exists( public_path().'/uploads/proposal/'.@$proposal_details->proposal->document_file ) && @$proposal_details->proposal->document_file != null)
                                                <iframe src ="{{url(asset('/uploads/proposal').'/'.@$proposal_details->proposal->document_file) }}" type="application/pdf"  width="100%" height="560px"></iframe>
                                            @else
                                                <iframe src ="{{url(asset('web/files/CRM.pdf'))}}" type="application/pdf"  width="100%" height="670px"></iframe>
                                            @endif
                                        </div><!--end col-->
                                        <div class="col-md-4" style="width: 35.5%;">
                                            <div class="info-palate mt-0" style="margin-left: -4px;">
                                                <div class="left">
                                                    <div id="doc_required_load"></div>

                                                    </div>
                                                </div>
                                                @if(count($doc_info) > 0)
                                                    <div class="col-md-12" style="float: right; margin-top:5px;">
                                                        <span class="btn open_modal_page submit_button" data-url="{{route('modal-get',['send_email_document_information', 'id'=>$proposal_details->id])}}" data-title="Send Email">Send Email
                                                        </span>
                                                    </div>
                                                @endif
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection
@push('js')    
      <script> 

        $(function(){

            var form_row_added=false;

            $('.edit_feedback').on('click', function(){
                if(form_row_added){
                    $('.open_feedback_msg_info_div').remove();
                    form_row_added=false;
                }
                var self=$(this);
                var self_tr=self.closest('.single_edit_item');

                var std_propsal_id=self.data('id');

                form_row_added=true;

                self_tr.after(
                "<div class='open_feedback_msg_info_div'><div class='open_feedback_msg_edit_info_div_inner'></div></div>"
                );

                fetch_sub_content(
                    '.open_feedback_msg_edit_info_div_inner',
                    "{{ route('sub-content', ['name'=>'edit_feedback_msg_form']) }}?std_propsal_id="+std_propsal_id
                );

            });

            $('.delete_feedback').on('click', function(){
                var id = $(this).attr("data-id");
                var form_data={
                    _token: "{{ csrf_token() }}",
                    delete_id: id,
                }
                swal({
                    title: "Are you sure?",
                    text: "You will not be able to recover this data!",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonClass: "btn-danger",
                    cancelButtonClass: "btn-info",
                    confirmButtonText: "Yes, delete!",
                    cancelButtonText: "No, cancel!",

                }, function(isConfirm){

                    if(isConfirm){
                        $.post("{{ route('ajax-post', ['name'=>'delete_student_feedback_msg']) }}",form_data
                        ).done(function(res){
                            pop_up_msg(res.msg);
                            window.location.reload();
                        }).fail(function(err){
                            pop_up_msg(err_msg(err), 'error');
                        });
                    }
                });

            });

            $('.rate_star_update').on('click', function(){
                var self =$(this);
                var id =self.data('id');
                var value =self.attr('value');

                var form_data={
                    _token: "{{ csrf_token() }}",
                    id: id,
                    value:value
                }

                $.post("{{ route('ajax-post', ['name'=>'proposal_quality_rate_star_update']) }}", form_data, function(res){
                    pop_up_msg(res.msg);
                    window.location.reload();

                }).fail(function(err){

                    pop_up_msg(err_msg(err), 'error');

                });

            });

            $('.concept_change').on('click', function(){
                var self =$(this);
                var id =self.data('id');
                var value =self.data('val');

                var form_data={
                    _token :"{{csrf_token()}}",
                    'id':id,
                    'value':value
                 }

                 swal({
                    title: "Are you sure you want to change status?",
                    text: "Please check before submitting!",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonClass: "btn-danger",
                    cancelButtonClass: "btn-info",
                    confirmButtonText: "Yes",
                    cancelButtonText: "No",
                    closeOnConfirm: true,
                    closeOnCancel: true
                }, function(isConfirm){

                    if(isConfirm){

                        $.post("{{ route('ajax-post', ['name'=>'concept_status_update']) }}", form_data, function(res){
                            pop_up_msg(res.msg);
                            window.location.reload();

                        }).fail(function(err){

                            pop_up_msg(err_msg(err), 'error');

                        });
                    }
                });
            });

            $('.status_change').on('click', function(){
                var self =$(this);
                var id =self.data('id');
                var value =self.data('val');

                var form_data={
                    _token :"{{csrf_token()}}",
                    'id':id,
                    'value':value
                 }

                 if(value==2 || value ==3  || value ==4  || value ==5 || value ==7){  // 2 =Reviewing; 3 =Push; 4 =Hold; 5 =Interested

                    swal({
                        title: "Are you sure you want to change status?",
                        text: "Please check before submitting!",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonClass: "btn-danger",
                        cancelButtonClass: "btn-info",
                        confirmButtonText: "Yes",
                        cancelButtonText: "No",
                        closeOnConfirm: true,
                        closeOnCancel: true
                    }, function(isConfirm){

                        if(isConfirm){

                            $.post("{{ route('ajax-post', ['name'=>'proposal_status_update']) }}", form_data, function(res){
                                pop_up_msg(res.msg);
                                window.location.reload();

                            }).fail(function(err){

                                pop_up_msg(err_msg(err), 'error');

                            });
                        }
                    });
                 }
            });



            // $('.feedback_btn').click(function(){

            //     var id =$(this).data('id');
            //     var message =$('#message').val();
            //     var proposal_status =$('#p_status').val();

            //     var form_data={
            //         _token: "{{ csrf_token() }}",
            //         id: id,
            //         message: message,
            //         proposal_status: proposal_status,
            //     }

            //     $.post("{{ route('ajax-post', ['name'=>'proposal_feedback_update']) }}", form_data, function(res){
            //         pop_up_msg(res.msg);
            //         window.location.reload();

            //     }).fail(function(err){

            //         pop_up_msg(err_msg(err), 'error');

            //     });
            // });

            fetch_sub_content(
                '#doc_required_load',
                "{{ route('sub-content', ['name'=>'document_required_load', 'id'=>$proposal_details->id]) }}"
            );

        });
      </script>
      @endpush