Rapport-Laravel/resources/views/horizonreport/fieldwork.blade.php

153 lines
8.2 KiB
PHP

@extends('layouts.vertical', ['page_title' => $title])
@section('css')
<style>
.horizon-field-wrap {
overflow: auto;
max-height: 70vh;
}
.horizon-field-grid.table {
color: #000;
border-color: #000;
}
.horizon-field-grid.table > :not(caption) > * > * {
background-color: #fff;
color: #000;
border: 1px solid #000;
box-shadow: none;
}
.horizon-field-grid.table > thead > tr > th,
.horizon-field-grid.table > tbody > tr.horizon-field-total > td {
background-color: #95B3D7;
color: #000;
font-weight: 700;
text-align: center;
vertical-align: middle;
}
.horizon-field-grid.table > tbody > tr.horizon-field-total > td:first-child {
text-align: left;
}
.horizon-field-grid.table a {
color: #0563C1;
text-decoration: underline;
}
</style>
@endsection
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card mt-3">
<div class="card-body">
<h4 class="page-title mb-0">{{ $title }}</h4>
@if ($access === false)
<div class="alert alert-danger mb-0 mt-3" role="alert">You do not have access to this report.</div>
@else
@if (!empty($error))
<div class="alert alert-danger mt-3" role="alert">{{ $error }}</div>
@endif
<form method="get" action="/horizonreport/fieldwork" class="row g-2 align-items-end mt-2">
<div class="col-md-4">
<label for="horizon-field-month" class="form-label">Month</label>
<select class="form-select" name="month" id="horizon-field-month">
@foreach ($months as $option)
<option value="{{ $option }}" {{ $month === $option ? 'selected' : '' }}>{{ $option }}</option>
@endforeach
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary">Show report</button>
</div>
@if (empty($error) && count($rows))
<div class="col-auto">
<a href="/horizonreport/export?month={{ urlencode($month) }}" class="btn btn-outline-primary">Download Excel</a>
</div>
@endif
</form>
@endif
</div>
</div>
</div>
</div>
@if ($access !== false && empty($error))
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive horizon-field-wrap">
<table class="table table-bordered table-sm mb-0 text-nowrap horizon-field-grid">
<thead>
<tr>
<th rowspan="2">RBM/ZBM Name</th>
<th rowspan="2">Emp Code</th>
<th rowspan="2">Role Name</th>
<th rowspan="2">Position Name</th>
<th rowspan="2">Manager 1 Code</th>
<th rowspan="2">Manager 1 Name</th>
<th rowspan="2">Manager 2 Code</th>
<th rowspan="2">Manager 2 Name</th>
@foreach ($days as $day)
<th colspan="2">{{ $dayLabels[$day] ?? $day }}</th>
@endforeach
<th rowspan="2">RBM/ZBM wise Total</th>
</tr>
<tr>
@foreach ($days as $day)
<th>Link</th>
<th>Time</th>
@endforeach
</tr>
</thead>
<tbody>
@forelse ($rows as $row)
<tr>
<td>{{ $row['name'] ?? '' }}</td>
<td>{{ $row['employee_code'] ?? '' }}</td>
<td>{{ $row['role_name'] ?? '' }}</td>
<td>{{ $row['position_name'] ?? '' }}</td>
<td>{{ $row['manager_1_code'] ?? '' }}</td>
<td>{{ $row['manager_1_name'] ?? '' }}</td>
<td>{{ $row['manager_2_code'] ?? '' }}</td>
<td>{{ $row['manager_2_name'] ?? '' }}</td>
@foreach ($days as $day)
@php
$cell = $row['days'][$day] ?? ['status' => 'blank'];
$status = $cell['status'] ?? 'blank';
@endphp
@if ($status === 'link' && !empty($cell['link']))
<td class="text-center">
<a href="{{ $cell['link'] }}" target="_blank" rel="noreferrer">Link</a>
</td>
<td class="text-center">{{ $cell['time'] ?? '' }}</td>
@elseif ($status === 'no')
<td colspan="2" class="text-center">No</td>
@else
<td colspan="2"></td>
@endif
@endforeach
<td class="text-center">{{ $row['total'] ?? 0 }}</td>
</tr>
@empty
<tr>
<td colspan="{{ 8 + count($days) * 2 + 1 }}">No rows for this month.</td>
</tr>
@endforelse
@if (count($rows))
<tr class="fw-semibold horizon-field-total">
<td colspan="{{ 8 + count($days) * 2 }}">Total</td>
<td class="text-center">{{ $total }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endif
</div>
@endsection