162 lines
8.4 KiB
PHP
162 lines
8.4 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', __('maintenance::lang.reports'))
|
|
|
|
@section('content')
|
|
@include('maintenance::layouts.nav')
|
|
|
|
@php $util = app(\Modules\Maintenance\Utils\MaintenanceUtil::class); @endphp
|
|
|
|
<section class="content no-print mt-page">
|
|
<div class="mt-page-header">
|
|
<h1><i class="fas fa-chart-bar" style="color:#14b8a6;margin-left:8px;"></i> @lang('maintenance::lang.reports')</h1>
|
|
</div>
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-body">
|
|
{!! Form::open(['url' => action([\Modules\Maintenance\Http\Controllers\ReportController::class, 'index']), 'method' => 'get', 'class' => 'form-inline']) !!}
|
|
<div class="row">
|
|
<div class="col-md-3">
|
|
<div class="form-group" style="width:100%">
|
|
{!! Form::label('equipment_id', __('maintenance::lang.equipment') . ':') !!}
|
|
{!! Form::select('equipment_id', $equipment_dropdown, $equipment_id, ['class' => 'form-control select2', 'placeholder' => __('maintenance::lang.all'), 'style' => 'width:100%']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="width:100%">
|
|
{!! Form::label('from', __('maintenance::lang.from') . ':') !!}
|
|
{!! Form::text('from', $from ? $util->formatDate($from) : null, ['class' => 'form-control mm-datepicker']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="width:100%">
|
|
{!! Form::label('to', __('maintenance::lang.to') . ':') !!}
|
|
{!! Form::text('to', $to ? $util->formatDate($to) : null, ['class' => 'form-control mm-datepicker']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="width:100%">
|
|
{!! Form::label('year', __('maintenance::lang.year') . ':') !!}
|
|
{!! Form::number('year', $year, ['class' => 'form-control']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="width:100%">
|
|
{!! Form::label('month', __('maintenance::lang.month') . ':') !!}
|
|
{!! Form::number('month', $month, ['class' => 'form-control', 'min' => '1', 'max' => '12']) !!}
|
|
</div>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<div class="form-group"><label> </label>
|
|
<button type="submit" class="btn btn-primary btn-block">@lang('maintenance::lang.filter')</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{!! Form::close() !!}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.report_equipment_costs')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead><tr><th>@lang('maintenance::lang.equipment')</th><th>@lang('maintenance::lang.total_cost')</th></tr></thead>
|
|
<tbody>
|
|
@forelse($equipment_costs ?? [] as $row)
|
|
<tr>
|
|
<td>{{ is_array($row) ? ($row['equipment_name'] ?? $row['name'] ?? '—') : ($row->equipment_name ?? '—') }}</td>
|
|
<td>{{ $util->formatMoney(is_array($row) ? ($row['total_cost'] ?? 0) : ($row->total_cost ?? 0)) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="2" class="text-center text-muted">@lang('maintenance::lang.no_records')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.report_downtime')</h3></div>
|
|
<div class="mt-card-body">
|
|
@if(is_array($downtime))
|
|
<p><strong>@lang('maintenance::lang.total_downtime'):</strong> {{ $downtime['total_hours'] ?? ($downtime['total_downtime'] ?? '—') }} @lang('maintenance::lang.downtime_hours')</p>
|
|
<p><strong>@lang('maintenance::lang.failure_count'):</strong> {{ $downtime['failure_count'] ?? '—' }}</p>
|
|
@else
|
|
<p class="text-muted">@lang('maintenance::lang.no_records')</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.report_technicians')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead><tr><th>@lang('maintenance::lang.assigned_technician')</th><th>@lang('maintenance::lang.completed_orders')</th></tr></thead>
|
|
<tbody>
|
|
@forelse($technicians ?? [] as $tech)
|
|
<tr>
|
|
<td>{{ is_array($tech) ? ($tech['technician_name'] ?? '—') : ($tech->technician_name ?? '—') }}</td>
|
|
<td>{{ is_array($tech) ? ($tech['completed_count'] ?? 0) : ($tech->completed_count ?? 0) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="2" class="text-center text-muted">@lang('maintenance::lang.no_records')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.report_monthly_stats')</h3></div>
|
|
<div class="mt-card-body">
|
|
@if(is_array($monthly))
|
|
<p><strong>@lang('maintenance::lang.completed_orders'):</strong> {{ $monthly['completed_work_orders'] ?? '—' }}</p>
|
|
<p><strong>@lang('maintenance::lang.total_cost'):</strong> {{ $util->formatMoney($monthly['total_cost'] ?? 0) }}</p>
|
|
<p><strong>@lang('maintenance::lang.failure_count'):</strong> {{ $monthly['failure_count'] ?? '—' }}</p>
|
|
@else
|
|
<p class="text-muted">@lang('maintenance::lang.no_records')</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-card">
|
|
<div class="mt-card-header"><h3 class="mt-card-title">@lang('maintenance::lang.report_failures')</h3></div>
|
|
<div class="mt-card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped">
|
|
<thead><tr><th>@lang('maintenance::lang.failure_type')</th><th>@lang('maintenance::lang.failure_count')</th></tr></thead>
|
|
<tbody>
|
|
@forelse($failures ?? [] as $fail)
|
|
<tr>
|
|
<td>{{ is_array($fail) ? ($fail['failure_type'] ?? '—') : ($fail->failure_type ?? '—') }}</td>
|
|
<td>{{ is_array($fail) ? ($fail['count'] ?? 0) : ($fail->count ?? 0) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="2" class="text-center text-muted">@lang('maintenance::lang.no_records')</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
@endsection
|
|
|
|
@section('javascript')
|
|
<script>$(function(){ $('.select2').select2(); if (typeof MmDate !== 'undefined') MmDate.initDatepicker('.mm-datepicker'); });</script>
|
|
@endsection
|