@extends('layouts.main') 
@section('title', 'Client Mapping Data')
@section('content')
    <!-- push external head elements to head -->
    @push('head')
        <link rel="stylesheet" href="{{ asset('plugins/DataTables/datatables.min.css') }}">
        <link rel="stylesheet" href="{{ asset('plugins/jquery-ui/jquery-ui.css') }}">
    @endpush

    
    <div class="container-fluid">
        <div class="page-header">
            <div class="row align-items-end">
                <div class="col-lg-8">
                    <div class="page-header-title">
                        <i class="ik ik-pie-chart bg-blue"></i>
                        <div class="d-inline">
                            <h5>{{ __('Client Mapping Data') }}</h5>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4">
                    <nav class="breadcrumb-container" aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">
                                <a href="{{route('dashboard')}}"><i class="ik ik-home"></i></a>
                            </li>
                            
                           <li class="breadcrumb-item active" aria-current="page">{{ __('Client Mapping')}}</li>
                        </ol>
                    </nav>
                </div>
            </div>
        </div>
        
        <div class="row clearfix">
            <div class="col-md-12">
                @if(session()->has('success'))
                <div class="box no-border">
                    <div class="box-tools">
                        <p class="alert alert-success alert-dismissible">
                            {{ session()->get('success') }}
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        </p>
                    </div>
                </div>
                @endif
                @if(session()->has('error'))
                <div class="box no-border">
                    <div class="box-tools">
                        <p class="alert alert-danger alert-dismissible">
                            {{ session()->get('error') }}
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        </p>
                    </div>
                </div>
                @endif
                <div class="card">
                    <div class="card-header">
                        <div class="col-md-9 pl-0">
                            <h3>{{ __('Client Mapping Data Table') }}</h3>
                        </div>
                        <!--<div class="col-md-3 text-right">-->
                        <!--    <a href="{{'upload-patient-mapping'}}" class='btn btn-primary'>{{__('Import Client Mapping')}}</a>-->
                        <!--</div>-->
                    </div>
                    <div class="card-body table-responsive">
                        <table id="myAdvancedTable" class="table p-3">
                            <thead>
                                <tr>
                                    <th style="display: none;">{{ __('State Code') }}</th>
                                    <th style="display: none;">{{ __('Dist Code') }}</th>
                                    <th>{{ __('Staff Code') }}</th>
                                    <th style="display: none;">{{ __('ART Center Code') }}</th>
                                    <th>{{ __('Pre ART REG Number') }}</th>
                                    <th>{{ __('ART REG Number') }}</th>
                                    <th>{{ __('Client Name') }}</th>
                                    <th style="display: none;">{{ __('Client UID') }}</th>
                                    <th>{{ __('Linelist Received Date') }}</th>
                                    <th>{{ __('Linelist Type') }}</th>
                                    <th>{{ __('Linelist Reason') }}</th>
                                    <th>{{ __('Linelist Status') }}</th>
                                    <th>{{ __('Final Outcome Date') }}</th>
                                    <th>{{ __('Linelist Closed Date') }}</th>
                                </tr>
                            </thead>
                            <tbody>
                                 @foreach ($getdata as $getdatas)
                                <tr>
                                    <td style="display: none;">{{ $getdatas->state_code }}</td>
                                    <td style="display: none;">{{ $getdatas->dist_code }}</td>
                                    <td>{{ $getdatas->emp_code }}</td>
                                    <td style="display: none;">{{ $getdatas->art_centre_code }}</td>

                                    <?php
                                    $getpatregdata = DB::table('patient_register')->where(['id'=>$getdatas->pat_uid])->first();
                                    ?>

                                    <td>{{ $getpatregdata->pre_art_reg_num ?? '' }}</td>
                                    <td>{{ $getpatregdata->art_reg_num ?? '' }}</td>
                                    <td>{{ $getpatregdata->pat_name ?? '' }}</td>
                                    <td style="display: none;">{{ $getpatregdata->pat_uid ?? '' }}</td>
                                    @if(isset($getdatas->linelist_date))
                                    <td>{{ date('d-m-Y',strtotime($getdatas->linelist_date)) }}</td>
                                    @else
                                    <td></td>
                                    @endif
                                    @if($getdatas->linelist_type == 1)
                                    <td>Outreach</td>
                                        @if($getdatas->linelist_reason == 1)
                                        <td>LFU</td>
                                        @elseif($getdatas->linelist_reason == 2)
                                        <td>MIS</td>
                                        @elseif($getdatas->linelist_reason == 3)
                                        <td>Home Delivery</td>
                                        @elseif($getdatas->linelist_reason == 4)
                                        <td>VL</td>
                                        @else
                                        <td>-</td>
                                        @endif
                                        
                                    @elseif($getdatas->linelist_type == 2)
                                    <td>Calling</td>
                                        @if($getdatas->linelist_reason == 6)
                                        <td>LFU</td>
                                        @elseif($getdatas->linelist_reason == 7)
                                        <td>MIS</td>
                                        @elseif($getdatas->linelist_reason == 8)
                                        <td>CD4</td>
                                        @elseif($getdatas->linelist_reason == 9)
                                        <td>TLD</td>
                                        @elseif($getdatas->linelist_reason == 10)
                                        <td>Due Date Call</td>
                                        @elseif($getdatas->linelist_reason == 11)
                                        <td>TB Follow up</td>
                                        @else
                                        <td>-</td>
                                        @endif
                                    @else
                                    <td>EAC</td>
                                    <td>-</td>
                                    @endif
                                    <td>{{ $getdatas->linelist_status }}</td>
                                    <td>{{ $getdatas->final_outcome_date }}</td>
                                    <td>{{ $getdatas->linelist_close_date }}</td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                    </div>
                </div> 
            </div>
        </div>
    </div>

    <!-- push external js -->
    @push('script')
    <script src="{{ asset('plugins/jquery-ui/jquery-ui.min.js') }}"></script>
    <script src="{{ asset('plugins/DataTables/datatables.min.js') }}"></script>
    <!--get editable datatable script-->
    <script src="{{ asset('js/editable-datatable.js') }}"></script>
    @endpush
@endsection
