@extends('layouts.admin')
@section('content')
<div class="content">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">



<!-- Template for each user
                @foreach(Auth::user()->roles as $key => $roles)
                @if($roles->title == "Engineer")
                    somthing something
                @endif
                @endforeach
-->



<!-- ENGINEER DASHBOARD -->

@foreach(Auth::user()->roles as $key => $roles)
@if($roles->title == "Engineer")
<div class="card-header">
    Engineer Dashboard
</div>

<div class="card-body">
    <div class="row">


        <div class="col-md-3"><button class="btn btn-success btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/service-complaints/create">
                <i class="bi bi-plus-circle"></i> <i class="bi bi-clipboard-plus"></i> New Service Complaint</a>
            </button></div>

            <div class="col-md-3"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
                <a class="text-white" href="/admin/assets/create">
                    <i class="bi bi-plus-circle"></i> <i class="bi bi-clipboard-plus"></i> New Commissioning</a>
                </button></div>

        <div class="col-md-3"><button class="btn btn-danger btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/service-complaints">Service Complaints </a>
            </button></div>



        <div class="col-md-3"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/assets">    Commissioning </a>
        </button></div>
        </div>

                <div class="card-body">
                    @if(session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <div class="row">

                        {{-- Pending Complaints Widget - latest entries --}}
                        <div class="{{ $settings16['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings16['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings16['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings16['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings16['data'] as $entry)
                                        <tr>
                                            @foreach($settings16['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings16['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>

                        <br><br><br>        <br><br><br>


                        {{-- Commissioning Widget - latest entries --}}
                        <div class="table-responsive" style="overflow-x: auto;">
                            <h3>{{ $settings17['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings17['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings17['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings17['data'] as $entry)
                                        <tr>
                                            @foreach($settings17['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>

                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}

                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.assets.edit', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>

                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings17['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>

                        <br><br><br>



                        {{-- This Months AMC Pending for Clients - latest entries --}}
                        <div class="table-responsive" style="overflow-x: auto;">
                            <h3>{{ $settings21['chart_title'] }}</h3>

 <!-- Pending Company -->
 <div class="d-flex flex-wrap gap-3 content-center">
    @foreach($settings21['data'] as $key => $value)
    @foreach($value as $k => $v)
        @if ($k == 'amcpending' & $v == 'Yes')
            <div class="card text-center">
                <div class="card-body">
                    <h5 class="card-title">{{ $value['clientname']}}</h5>
                    <a href="admin/service-complaints/create"
            <button type="button" class="btn btn-danger btn-lg">Pending</button>
            </a>

                </div>
            </div>
        @endif
    @endforeach
@endforeach
</div>
</div>


<br><br><br>






                        {{-- This Months AMC Pending for Clients - latest entries --}}


                        {{-- Next Months AMC Widget - latest entries --}}
                        <div class="table-responsive">
                            <h3>{{ $settings20['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings20['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings20['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings20['data'] as $entry)
                                        <tr>
                                            @foreach($settings20['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings20['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>


@endif
@endforeach

<!-- ENGINEER DASHBOARD -->

<!-- SUPERVISOR DASHBOARD -->
@foreach(Auth::user()->roles as $key => $roles)
@if($roles->title == "Supervisor")
<div class="card-header">
    Supervisor Dashboard
</div>


<div class="card-body">
    <div class="row">


        <div class="col-md-3"><button class="btn btn-danger btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/service-complaints">Service Complaints </a>
            </button></div>



        <div class="col-md-3"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/assets">    Commissioning </a>
        </button></div>
        </div>

                <div class="card-body">
                    @if(session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <div class="row">


                        {{-- Complaints Widget - latest entries --}}
                        <div class="{{ $settings18['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings18['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings18['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings18['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings18['data'] as $entry)
                                        <tr>
                                            @foreach($settings18['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings18['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>


                        {{-- Commissioning Widget - latest entries --}}
                        <div class="{{ $settings19['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings19['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings19['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings19['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings19['data'] as $entry)
                                        <tr>
                                            @foreach($settings19['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                            sdfd
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}

                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.assets.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>

                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings17['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>



                        {{-- Parts Filter by Negative Numbers - latest entries --}}
                        <div class="row">
                        <div class="{{ $settings12['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings12['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings12['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings12['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                        <th>
                                            Needs Replacement Soon
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings12['data1'] as $stepdown)
                                        <tr>
                                            @foreach($stepdown as $entry)
                                            @foreach($settings12['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            @endforeach
                                            <td>
                                                Parts Need Replacement
                                            </td>
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target="_blank" href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings12['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>
                        </div>

                        {{-- Parts Filter by Negative Numbers - latest entries --}}



                        {{-- AMC Expiry This Month  - latest entries --}}
                        <div class="{{ $settings8['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings8['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings8['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings8['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings8['data'] as $entry)
                                        <tr>
                                            @foreach($settings8['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>

                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.amc-contracts.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>                </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings8['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>


                        {{-- Warrenty Expiry This Month - latest entries --}}
                        <div class="{{ $settings9['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings9['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings9['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings9['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings9['data'] as $entry)
                                        <tr>
                                            @foreach($settings9['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.assets.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings9['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>
                    </div>
@endif
@endforeach
<!-- SUPERVISOR DASHBOARD -->

<!-- CUSTOMER CARE DASHBOARD -->
@foreach(Auth::user()->roles as $key => $roles)
@if($roles->title == "Customer Care")
<div class="card-header">
    Customer Care Dashboard
</div>

<div class="card-body">

<div class="row">
    <div class="col-md-4"><button class="btn btn-danger btn-lg" type="button" style="width: 250px;">
        <a class="text-white" href="/admin/service-complaints/create">Add Service Complaints</a>
        </button></div>

    <div class="col-md-4"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
        <a class="text-white" href="/admin/assets/create"> Add Commissioning </a>
    </button></div>
</div>
<br><br>
<div class="row">

    <div class="col-md-3 " >
        <button class="btn btn-primary btn-lg" type="button" style="width: 200px;">
           <a class="text-white" href="/admin/contact-companies">Clients</a>
        </button>
     </div>

    <div class="col-md-3"><button class="btn btn-danger btn-lg" type="button" style="width: 200px;">
        <a class="text-white" href="/admin/service-complaints">Service Complaints </a>
        </button></div>

    <div class="col-md-3"><button class="btn btn-success btn-lg" type="button" style="width: 200px;">
        <a class="text-white" href="/admin/amc-contracts">AMC</a>
    </button></div>

    <div class="col-md-3"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
        <a class="text-white" href="/admin/assets">    Commissioning </a>
    </button></div>
    </div>
    <br><br>
    <div class="row">
    <br><br>
{{-- AMC Chart - latest entries --}}
<div class="col-md-6">
    <h3>{!! $chart15->options['chart_title'] !!}</h3>
    {!! $chart15->renderHtml() !!}
</div>
</div>

{{-- AMC Chart - latest entries --}}

{{-- Parts Filter by Negative Numbers - latest entries --}}
<div class="row">
<div class="{{ $settings12['column_class'] }}" style="overflow-x: auto;">
    <h3>{{ $settings12['chart_title'] }}</h3>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                @foreach($settings12['fields'] as $key => $value)
                    <th>
                        {{ trans(sprintf('cruds.%s.fields.%s', $settings12['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                    </th>
                @endforeach
                <th>
                    Needs Replacement Soon
                </th>
            </tr>
        </thead>
        <tbody>
            @forelse($settings12['data1'] as $stepdown)
                <tr>
                    @foreach($stepdown as $entry)
                    @foreach($settings12['fields'] as $key => $value)
                        <td>
                            @if($value === '')
                                {{ $entry->{$key} }}
                            @elseif(is_iterable($entry->{$key}))
                                @foreach($entry->{$key} as $subEentry)
                                    <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                @endforeach
                            @else
                                {{ data_get($entry, $key . '.' . $value) }}
                            @endif
                        </td>
                    @endforeach
                    @endforeach
                    <td>
                        Parts Need Replacement
                    </td>
                    <td>
                        <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                            <i class="fa fa-eye" aria-hidden="true"></i>
                        </a>
                    </td>
                </tr>
                @empty
                <tr>
                    <td colspan="{{ count($settings12['fields']) }}">{{ __('No entries found') }}</td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>
</div>

{{-- Parts Filter by Negative Numbers - latest entries --}}



{{-- AMC Expiry This Month  - latest entries --}}
<div class="{{ $settings8['column_class'] }}" style="overflow-x: auto;">
    <h3>{{ $settings8['chart_title'] }}</h3>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                @foreach($settings8['fields'] as $key => $value)
                    <th>
                        {{ trans(sprintf('cruds.%s.fields.%s', $settings8['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                    </th>
                @endforeach
            </tr>
        </thead>
        <tbody>
            @forelse($settings8['data'] as $entry)
                <tr>
                    @foreach($settings8['fields'] as $key => $value)
                        <td>
                            @if($value === '')
                                {{ $entry->{$key} }}
                            @elseif(is_iterable($entry->{$key}))
                                @foreach($entry->{$key} as $subEentry)
                                    <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                @endforeach
                            @else
                                {{ data_get($entry, $key . '.' . $value) }}
                            @endif
                        </td>

                    @endforeach
                    <td>
                        <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.amc-contracts.show', $entry ?? 0) }}">
                            <i class="fa fa-eye" aria-hidden="true"></i>
                        </a>
                    </td>                </tr>
                @empty
                <tr>
                    <td colspan="{{ count($settings8['fields']) }}">{{ __('No entries found') }}</td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>


{{-- Warrenty Expiry This Month - latest entries --}}
<div class="{{ $settings9['column_class'] }}" style="overflow-x: auto;">
    <h3>{{ $settings9['chart_title'] }}</h3>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                @foreach($settings9['fields'] as $key => $value)
                    <th>
                        {{ trans(sprintf('cruds.%s.fields.%s', $settings9['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                    </th>
                @endforeach
            </tr>
        </thead>
        <tbody>
            @forelse($settings9['data'] as $entry)
                <tr>
                    @foreach($settings9['fields'] as $key => $value)
                        <td>
                            @if($value === '')
                                {{ $entry->{$key} }}
                            @elseif(is_iterable($entry->{$key}))
                                @foreach($entry->{$key} as $subEentry)
                                    <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                @endforeach
                            @else
                                {{ data_get($entry, $key . '.' . $value) }}
                            @endif
                        </td>
                    @endforeach
                    <td>
                        <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.assets.show', $entry ?? 0) }}">
                            <i class="fa fa-eye" aria-hidden="true"></i>
                        </a>
                    </td>                        </tr>
                @empty
                <tr>
                    <td colspan="{{ count($settings9['fields']) }}">{{ __('No entries found') }}</td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>

</div>


@endif
@endforeach
<!-- CUSTOMER CARE DASHBOARD -->








<!-- Manager DASHBOARD -->
@foreach(Auth::user()->roles as $key => $roles)
@if($roles->title == "Director" || $roles->title == "Manager" || $roles->title == "Admin")
<div class="card-header">
    Manager Dashboard
</div>

<div class="card-body">
    <div class="row">
        <div class="col-md-3 " >
            <button class="btn btn-primary btn-lg" type="button" style="width: 200px;">
               <a class="text-white" href="/admin/contact-companies">Clients</a>
            </button>
         </div>

        <div class="col-md-3"><button class="btn btn-danger btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/service-complaints">Service Complaints </a>
            </button></div>

        <div class="col-md-3"><button class="btn btn-success btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/amc-contracts">AMC</a>
        </button></div>

        <div class="col-md-3"><button class="btn btn-info btn-lg" type="button" style="width: 200px;">
            <a class="text-white" href="/admin/assets">    Commissioning </a>
        </button></div>
        </div>




                <div class="card-body">
                    @if(session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <div class="row">

                        <div class="{{ $chart2->options['column_class'] }}">
                            <h3>{!! $chart2->options['chart_title'] !!}</h3>
                            {!! $chart2->renderHtml() !!}
                        </div>
                        <div class="{{ $chart3->options['column_class'] }}">
                            <h3>{!! $chart3->options['chart_title'] !!}</h3>
                            {!! $chart3->renderHtml() !!}
                        </div>
                        <div class="{{ $chart4->options['column_class'] }}">
                            <h3>{!! $chart4->options['chart_title'] !!}       </h3>
                            {!! $chart4->renderHtml() !!}
                        </div>

                    </div>
                        {{-- Widget - latest entries --}}
                        <div class="{{ $settings5['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings5['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings5['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings5['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings5['data'] as $entry)
                                        <tr>
                                            @foreach($settings5['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings5['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>



                        {{-- Widget - latest entries --}}
                        <div class="{{ $settings7['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings7['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings7['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings7['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings7['data'] as $entry)
                                        <tr>
                                            @foreach($settings7['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings7['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>

                        {{-- Widget - latest entries --}}
                        <div class="{{ $settings8['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings8['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings8['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings8['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings8['data'] as $entry)
                                        <tr>
                                            @foreach($settings8['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings8['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>

                        {{-- Warrenty Expiry This Month - latest entries --}}
                        <div class="{{ $settings9['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings9['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings9['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings9['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings9['data'] as $entry)
                                        <tr>
                                            @foreach($settings9['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings9['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>

                        {{-- Parts Filter by Negative Numbers - latest entries --}}

                        <div class="{{ $settings12['column_class'] }}" style="overflow-x: auto;">
                            <h3>{{ $settings12['chart_title'] }}</h3>
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        @foreach($settings12['fields'] as $key => $value)
                                            <th>
                                                {{ trans(sprintf('cruds.%s.fields.%s', $settings12['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                                            </th>
                                        @endforeach
                                        <th>
                                            Needs Replacement Soon
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @forelse($settings12['data1'] as $stepdown)
                                        <tr>
                                            @foreach($stepdown as $entry)
                                            @foreach($settings12['fields'] as $key => $value)
                                                <td>
                                                    @if($value === '')
                                                        {{ $entry->{$key} }}
                                                    @elseif(is_iterable($entry->{$key}))
                                                        @foreach($entry->{$key} as $subEentry)
                                                            <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                                        @endforeach
                                                    @else
                                                        {{ data_get($entry, $key . '.' . $value) }}
                                                    @endif
                                                </td>
                                            @endforeach
                                            @endforeach
                                            <td>
                                                Parts Need Replacement
                                            </td>
                                            <td>
                                                <a class="btn btn-xs btn-primary pull-right" target=_blank href="{{ route('admin.service-complaints.show', $entry ?? 0) }}">
                                                    <i class="fa fa-eye" aria-hidden="true"></i>
                                                </a>
                                            </td>
                                        </tr>
                                        @empty
                                        <tr>
                                            <td colspan="{{ count($settings12['fields']) }}">{{ __('No entries found') }}</td>
                                        </tr>
                                    @endforelse
                                </tbody>
                            </table>
                        </div>


                        {{-- Parts Filter by Negative Numbers - latest entries --}}
                <div class="row">
                        <div class="{{ $settings13['column_class'] }}">
                            <div class="card text-white bg-primary">
                                <div class="card-body pb-0">
                                    <div class="text-value">{{ number_format($settings13['total_number']) }}</div>
                                    <div>{{ $settings13['chart_title'] }}</div>
                                    <br />
                                </div>
                            </div>
                        </div>
                        <div class="{{ $settings10['column_class'] }}">
                            <div class="card text-white bg-primary">
                                <div class="card-body pb-0">
                                    <div class="text-value">{{ number_format($settings10['total_number']) }}</div>
                                    <div>{{ $settings10['chart_title'] }}</div>
                                    <br />
                                </div>
                            </div>
                        </div>
                        <div class="{{ $settings11['column_class'] }}">
                            <div class="card text-white bg-primary">
                                <div class="card-body pb-0">
                                    <div class="text-value">{{ number_format($settings11['total_number']) }}</div>
                                    <div>{{ $settings11['chart_title'] }}</div>
                                    <br />
                                </div>
                            </div>
                        </div>
                        <div class="{{ $settings1['column_class'] }}">
                            <div class="card text-white bg-primary">
                                <div class="card-body pb-0">
                                    <div class="text-value">{{ number_format($settings1['total_number']) }}</div>
                                    <div>{{ $settings1['chart_title'] }}</div>
                                    <br />
                                </div>
                            </div>
                        </div>
                </div>
                        <div class="{{ $chart14->options['column_class'] }}">
                            <h3>{!! $chart14->options['chart_title'] !!}</h3>
                            {!! $chart14->renderHtml() !!}
                        </div>
                        <div class="{{ $chart15->options['column_class'] }}">
                            <h3>{!! $chart15->options['chart_title'] !!}</h3>
                            {!! $chart15->renderHtml() !!}
                        </div>



{{-- All Complaints - latest entries --}}
<div class="{{ $settings6['column_class'] }}" style="overflow-x: auto;">
    <h3>{{ $settings6['chart_title'] }}</h3>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                @foreach($settings6['fields'] as $key => $value)
                    <th>
                        {{ trans(sprintf('cruds.%s.fields.%s', $settings6['translation_key'] ?? 'pleaseUpdateWidget', $key)) }}
                    </th>
                @endforeach
            </tr>
        </thead>
        <tbody>
            @forelse($settings6['data'] as $entry)
                <tr>
                    @foreach($settings6['fields'] as $key => $value)
                        <td>
                            @if($value === '')
                                {{ $entry->{$key} }}
                            @elseif(is_iterable($entry->{$key}))
                                @foreach($entry->{$key} as $subEentry)
                                    <span class="label label-info">{{ $subEentry->{$value} }}</span>
                                @endforeach
                            @else
                                {{ data_get($entry, $key . '.' . $value) }}
                            @endif
                        </td>
                    @endforeach
                </tr>
                @empty
                <tr>
                    <td colspan="{{ count($settings6['fields']) }}">{{ __('No entries found') }}</td>
                </tr>
            @endforelse
        </tbody>
    </table>
</div>


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



@endif
@endforeach
<!-- Manager DASHBOARD -->





@endsection
@section('scripts')
@parent
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
{!! $chart2->renderJs() !!}
{!! $chart3->renderJs() !!}
{!! $chart4->renderJs() !!}
{!! $chart14->renderJs() !!}{!! $chart15->renderJs() !!}
@endsection
