@extends('layouts.app')
@section('title',' View Claim Details | ')
@section('content')

<!-- Content Header (Page header) -->
<div class="content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h4 class="m-0">View Claim Details</h4>
            </div><!-- /.col -->
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                    <li class="breadcrumb-item active">Claim Management</li>
                </ol>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<section class="content">
    <div class="container-fluid">
        <div class="card card-dark" id="claim_details">
            <div class="card-header hide_in_print">
                <div class="card-title">
                    <h4 class="card-title">Claim Details</h4>
                </div>
                <button type="button" class="btn btn-sm btn-light float-right print_btn">Print</button>
            </div>
            <div class="card-body">
                @if(session('success'))
                <div class="alert alert-success alert-dismissible fade show" role="alert">
                    <strong>{{ session('success') }}</strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                @endif
                @if(session('error'))
                <div class="alert alert-danger alert-dismissible fade show" role="alert">
                    <strong>{{ session('error') }}</strong>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                @endif
                <div class="row">
                    @if(!empty($claims))
                    <div class="col-md-12 border p-1">
                        <h5 class="font-weight-bolder text-info border-bottom border-secondary p-2 mb-2">Basic Details
                        </h5>
                        <div class="row">
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Claim Master ID:
                                    <strong>{{ $claims->claim_master_id }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Employee ID:
                                    <strong>{{ $claims->emp_id }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Employee Name:
                                    <strong>{{ $claims->emp_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Employee Mobile:
                                    <strong>{{ $claims->emp_mobile }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Department :
                                    <strong>{{ $claims->department_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Scheme:
                                    <strong>{{ $claims->scheme_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Division:
                                    <strong>{{ $claims->division_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Posting Place:
                                    <strong>{{ $claims->posting_place_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Date of Joinig:
                                    <strong>{{ formatDate($claims->date_of_joining) }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Father/Husband's Name:
                                    <strong>{{ $claims->father_husband_name }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Relation:
                                    <strong>{{ ($claims->relation_type == 1) ? 'Father' : 'Husband'}}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Addhar Number:
                                    <strong>{{ $claims->aadhar_number }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Accident Date:
                                    <strong>{{ formatDate($claims->accident_date) }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Death Date:
                                    <strong>{{ formatDate($claims->death_date) }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Cause of Death:
                                    <strong>{{ $claims->cause_of_death }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Claim Type:
                                    <strong>{{ ($claims->claim_type == 1) ?  'Death' : 'Accident'}}</strong>
                                </p>
                            </div>
                            @if($claims->claim_type == 1)
                            <!-- <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Death Intimation
                                    Letter:
                                    <strong>{{ ($claims->death_intimation_letter == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div> -->
                            @endif
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Claimant Statement:
                                    <strong>{{ ($claims->claimant_statement == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            @if($claims->claim_type == 1)
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Death Certificate:
                                    <strong>{{ ($claims->death_certificate == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            @endif
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Age Proof:
                                    <strong>{{ ($claims->age_proof == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Docuement of Age
                                    Proof:
                                    <strong>{{ $claims->age_proof_doc }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">FIR Report:
                                    <strong>{{ ($claims->fir_report == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            @if($claims->claim_type == 1)
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Post Mortem Report:
                                    <strong>{{ ($claims->post_mortem_report == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            @endif
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Employer Certificate:
                                    <strong>{{ ($claims->employer_certificate == 1) ? 'Submitted' : 'Not Submit' }}</strong>
                                </p>
                            </div>
                            {{-- @if($claims->claim_type == 2) --}}
                            @if(!empty($claims->accidental_body_part))
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Permanent
                                    Disability <small>(Accidental Body Part)</small>:
                                    <strong class="d-flex">
                                        @foreach(explode(',',$claims->accidental_body_part) as $disability) 
                                        <span class="border border-dark pl-1 pr-1 mr-1 ">
                                            {{ getPermanentDisability($disability) }}
                                        </span>
                                        @endforeach
                                    </strong>
                                </p>
                            </div>
                            @endif
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Accident Time:
                                    <strong>{{ $claims->accident_time }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Shift Timing: 
                                    <strong>{{ (!empty($claims->shift_start_time)) ?  $claims->shift_start_time : '00:00:00'}} to {{ (!empty($claims->shift_end_time)) ? $claims->shift_end_time : '00:00:00' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Accident Place:
                                    <strong>{{ $claims->accident_place }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Basic Information
                                    about
                                    Accident:
                                    <strong>{{ $claims->accident_info }}</strong>
                                </p>
                            </div>
                            
                        </div>
                    </div>

                    @if($claims->claim_applied_for->count() > 0)
                    <div class="col-md-12 mt-2 border-bottom">
                        <h5 class="font-weight-bolder text-info">Applied Claims</h5>
                    </div>
                    @foreach($claims->claim_applied_for as $claims_for)
                    <div class="col-md-12 mt-2 border">
                        <h5 class="font-weight-bolder text-dark border-bottom p-2">Claim for:
                            {{ $claims_for->claim_category}}</h5>
                        <div class="row">
                            @if($claims_for->claim_category == 'EPF' || $claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Member ID:
                                    <strong>{{ $claims_for->member_id }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'EPF')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">UAN Number:
                                    <strong>{{ $claims_for->uan_number }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">ESI Number:
                                    <strong>{{ $claims_for->esi_number }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'WC' || $claims_for->claim_category == 'GPA')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Policy Number:
                                    <strong>{{ $claims_for->policy_number }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Company Name:
                                    <strong>{{ $claims_for->company_name }}</strong>
                                </p>
                            </div>
                            @endif
                            
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Intimation Date:
                                    <strong>{{ formatDate($claims_for->intimation_date) }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Submission Date:
                                    <strong>{{ formatDate($claims_for->submission_date) }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Current Status:
                                    <strong>
                                        @if($claims_for->claim_status == 1)
                                        Pending
                                        @elseif($claims_for->claim_status == 2)
                                        Processing
                                        @elseif($claims_for->claim_status == 3)
                                        Done
                                        @elseif($claims_for->claim_status == 4)
                                        Rejected
                                        @elseif($claims_for->claim_status == 5)
                                        Partial Amount Paid
                                        @endif
                                    </strong>
                                </p>
                            </div>
                            @if($claims_for->claim_category == 'EPF' || $claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Aadhar of Divyang Employee:
                                    <strong>{{ ($claims_for->aadhar == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims->claim_type == 1)
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Death Certificate:
                                    <strong>{{ ($claims_for->death_certificate == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'EPF' || $claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Nominee's Docuement:
                                    <strong>{{ ($claims_for->nominee_doc == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">PAN:
                                    <strong>{{ ($claims_for->pan == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <small class="text-muted">(Join account in SBI bank with mother if child is
                                    minor)</small>
                                <p class="p-0 m-0 text-secondary bbbb border-muted">
                                    Bank Passbook:
                                    <strong>{{ ($claims_for->bank_passbook == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Ration Card:
                                    <strong>{{ ($claims_for->ration_card == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">3 Photos:
                                    <strong>{{ ($claims_for->photos == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">FIR Report:
                                    <strong>{{ ($claims_for->fir_report == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims->claim_type == 1 && $claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Scratch of the place
                                    where
                                    the
                                    accident happend:
                                    <strong>{{ ($claims_for->scratch_report == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'ESI')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">2 witnesses with aadhar mobile number:
                                    <strong>{{ ($claims_for->witness == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Passbook 6 months:
                                    <strong>{{ ($claims_for->passbook_statement == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims->claim_type == 1 && $claims_for->claim_category == 'WC' || $claims_for->claim_category == 'GPA')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Post Mortem Report:
                                    <strong>{{ ($claims_for->post_mortem_report == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif
                            @if($claims_for->claim_category == 'WC' || $claims_for->claim_category == 'GPA')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Bills:
                                    <strong>{{ ($claims_for->bills == 1) ? 'Submitted' : 'Not Submitted' }}</strong>
                                </p>
                            </div>
                            @endif

                            @if($claims_for->claim_category == 'GPA')
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Date of hand over the
                                    lawyer:
                                    <strong>{{ formatDate($claims_for->gpa_hand_over_date) }}</strong>
                                </p>
                            </div>
                            @endif
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Claim By:
                                    <strong>{{ $claims_for->claim_by }}</strong>
                                </p>
                            </div>
                            <div class="col-md-6 col-lg-6 col-sm-12 mb-2">
                                <p class="p-0 m-0 text-secondary bbbb border-muted">Relation with Employee:
                                    <strong>{{ getRelations($claims_for->relation_with_emp) }}</strong>
                                </p>
                            </div>
                            
                        </div>

                        <!-- Print Remarks -->
                        @if($claims_for->remarks->count() > 0)
                        
                        <div class="row">
                            <h5 class="font-weight-bolder text-dark  p-2">Remarks:</h5>
                            <div class="col-md-12">
                                @foreach($claims_for->remarks as $remark)
                                    <div class="card card-body bg-light p-2">
                                        <p class="p-0 m-0 text-secondary bbbb border-muted">
                                            Status:
                                            <strong> 
                                                @if($remark->status == 1) 
                                                    {{ __('Pending') }}
                                                @elseif($remark->status == 2)
                                                    {{ __('Processing') }}
                                                @elseif($remark->status == 3)
                                                    {{ __('Done') }}
                                                @elseif($remark->status == 4)
                                                    {{ __('Rejected') }}
                                                @elseif($remark->status == 4)
                                                    {{ __('Partial Amount Paid') }}
                                                @endif
                                            </strong>
                                            <br>
                                            
                                        </p>
                                        <p class="p-0 m-0 text-secondary bbbb border-muted"> 
                                        Remark: <strong>{{ $remark->remark }}</strong>
                                        </p>
                                        <p class="p-0 m-0 text-secondary bbbb border-muted"> 
                                          <small> Remarked By: <strong>{{ $remark->full_name }} ({{getUserType($remark->user_role)}})</strong></small>
                                        </p>
                                        <p class="p-0 m-0 text-secondary bbbb border-muted"> 
                                          <small> Remarked Date: <strong>{{ formatDate($remark->created_at) }}</strong></small>
                                        </p>
                                       
                                    </div>
                                  
                                @endforeach
                            </div>
                        </div>
                           
                        @endif




                    </div>
                    @endforeach
                    
                    @endif
                    <a class="btn btn-secondary m-1" href="{{ route('list.all.claims') }}">Back</a>
                    @else
                    <div class="col-md-12 col-lg-12 col-sm-12 mb-2">
                        <p class="p-0 m-0 text-secondary border-muted">
                            <strong>No Record Found</strong>
                        </p>
                    </div>
                    @endif
                </div>
               
            </div>
        </div>

    </div>
    <!-- /.container-fluid -->
</section>
<!-- /.content -->
@endsection