ultimatepos/Modules/AdvancedPlanning/Resources/views/schedule_runs/show.blade.php

135 lines
6.5 KiB
PHP

@extends('layouts.app')
@section('title', $run->ref_no)
@section('content')
@include('advancedplanning::layouts.nav')
@php
$util = app(\Modules\AdvancedPlanning\Utils\AdvancedPlanningUtil::class);
$results = $run->results ?? [];
@endphp
<section class="content-header">
<h1>{{ $run->ref_no }} <small>{{ $util->statusLabel($run->status) }}</small></h1>
</section>
<section class="content">
@if(session('status'))
<div class="alert alert-{{ session('status.success') ? 'success' : 'warning' }} alert-dismissible">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{ session('status.msg') }}
</div>
@endif
<div class="row">
<div class="col-md-6">
<div class="box box-solid">
<div class="box-header"><h3 class="box-title">@lang('advancedplanning::lang.schedule_run_details')</h3></div>
<div class="box-body">
<p><strong>@lang('advancedplanning::lang.horizon_start'):</strong> {{ $run->horizon_start?->format('Y-m-d') }}</p>
<p><strong>@lang('advancedplanning::lang.horizon_end'):</strong> {{ $run->horizon_end?->format('Y-m-d') }}</p>
<p><strong>@lang('advancedplanning::lang.scenario_name'):</strong> {{ $run->scenario_name ?? '—' }}</p>
<p><strong>@lang('advancedplanning::lang.notes'):</strong> {{ $run->notes ?? '—' }}</p>
@if(!empty($results['scheduled_count']))
<p><strong>@lang('advancedplanning::lang.scheduled_count'):</strong> {{ $results['scheduled_count'] }}</p>
<p><strong>@lang('advancedplanning::lang.unscheduled_count'):</strong> {{ $results['unscheduled_count'] ?? 0 }}</p>
@endif
</div>
</div>
</div>
@if(!empty($results['resource_utilization']))
<div class="col-md-6">
<div class="box box-solid">
<div class="box-header"><h3 class="box-title">@lang('advancedplanning::lang.utilization')</h3></div>
<div class="box-body table-responsive">
<table class="table table-condensed table-bordered">
<thead>
<tr>
<th>@lang('advancedplanning::lang.resource')</th>
<th>@lang('advancedplanning::lang.scheduled_hours')</th>
<th>@lang('advancedplanning::lang.available_hours')</th>
<th>%</th>
</tr>
</thead>
<tbody>
@foreach($results['resource_utilization'] as $row)
<tr>
<td>{{ $row['resource_name'] }}</td>
<td>{{ $row['scheduled_hours'] }}</td>
<td>{{ $row['available_hours'] }}</td>
<td>{{ $row['utilization_pct'] }}%</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endif
</div>
@if(!empty($results['unscheduled']))
<div class="box box-warning">
<div class="box-header"><h3 class="box-title">@lang('advancedplanning::lang.unscheduled')</h3></div>
<div class="box-body table-responsive">
<table class="table table-bordered">
<thead>
<tr>
<th>@lang('advancedplanning::lang.work_order')</th>
<th>@lang('advancedplanning::lang.operation')</th>
<th>@lang('advancedplanning::lang.reason')</th>
</tr>
</thead>
<tbody>
@foreach($results['unscheduled'] as $item)
<tr>
<td>{{ $item['work_order_id'] }}</td>
<td>{{ $item['operation'] }}</td>
<td>{{ $item['reason'] }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<div class="box box-primary">
<div class="box-header"><h3 class="box-title">@lang('advancedplanning::lang.operations')</h3></div>
<div class="box-body table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>@lang('advancedplanning::lang.work_order')</th>
<th>@lang('advancedplanning::lang.resource')</th>
<th>@lang('advancedplanning::lang.operation')</th>
<th>@lang('advancedplanning::lang.planned_start')</th>
<th>@lang('advancedplanning::lang.planned_end')</th>
<th>@lang('advancedplanning::lang.duration_hours')</th>
<th>@lang('advancedplanning::lang.quantity')</th>
<th>@lang('advancedplanning::lang.status')</th>
</tr>
</thead>
<tbody>
@forelse($run->scheduledOperations as $op)
<tr>
<td>{{ $op->sequence }}</td>
<td>{{ $op->workOrder?->work_order_number ?? $op->ie_work_order_id ?? '—' }}</td>
<td>{{ $op->resource?->name ?? '—' }}</td>
<td>{{ $op->operation_name ?? $op->operation_code ?? '—' }}</td>
<td>{{ $op->planned_start?->format('Y-m-d H:i') }}</td>
<td>{{ $op->planned_end?->format('Y-m-d H:i') }}</td>
<td>{{ number_format($op->duration_hours, 2) }}</td>
<td>{{ $op->quantity }}</td>
<td>{{ $util->statusLabel($op->status) }}</td>
</tr>
@empty
<tr><td colspan="9" class="text-center">@lang('advancedplanning::lang.no_records')</td></tr>
@endforelse
</tbody>
</table>
</div>
<div class="box-footer">
<a href="{{ action([\Modules\AdvancedPlanning\Http\Controllers\ScheduleRunController::class, 'index']) }}" class="btn btn-default">@lang('advancedplanning::lang.back')</a>
</div>
</div>
</section>
@endsection