@extends('layouts/contentLayoutMaster') @section('title', 'Corrective Maintenance Request') @section('vendor-style') {{-- vendor css files --}} @endsection @section('content')

Corrective Note : {{ $corrective->code }}

@if ($success = Session::get('success'))
@endif @if ($errorMessage = Session::get('errorMessage'))
@endif
@if (!isset($corrective->user_id) || $corrective->user_id == null)
@method('PUT') @csrf
@endif
Asset Code : {{$corrective->asset ? $corrective->asset->code : 'N/A'}}
Asset Name : {{$corrective->asset ? $corrective->asset->name : 'N/A'}}
Fault Type : {{$corrective->faultType ? $corrective->faultType->name : 'N/A'}}
@php function getStatusBadge($status) { if ($status == 1) { return 'Completed'; } elseif ($status == 2) { return 'Assigned'; } elseif ($status == 0) { return 'Pending'; } else { return 'N/A'; } } @endphp Status : {!! getStatusBadge($corrective->status) !!}
Facility Code : {{$corrective->facility ? $corrective->facility->code : 'N/A'}}
Area Office : {{$corrective->facility ? ($corrective->facility->area_office ? $corrective->facility->area_office->name : "N/A") : 'N/A'}}
Facility Name : {{$corrective->facility ? $corrective->facility->name : 'N/A'}}
Facility Type : @switch($corrective->type) @case('user') User @break @case('plant') Plant @break @case('building') Plant Building @break @case('plant_mcc') Plant Collection Point @break @case('ao') Area Office @break @case('dp') Dispatch Point @break @case('mcc') Collection Center @break @case('ao_building') Area Office Building @break @default N/A @endswitch
Requested By : {{$corrective->createdBy ? $corrective->createdBy->name : 'N/A'}}
Request Date : {{$corrective->date ? $corrective->date . ' ' . $corrective->time : 'N/A'}}
Request Remarks : {{$corrective->remarks ? $corrective->remarks : 'N/A'}}
Assigned EST : {{$corrective->est ? $corrective->est->name : 'N/A'}}
Completed By : {{$corrective->completedBy ? $corrective->completedBy->name : 'N/A'}}
Completed Date : {{$corrective->completed_at ? $corrective->completed_at : 'N/A'}}
Completed Remarks : {{$corrective->completed_remarks ? $corrective->completed_remarks : 'N/A'}}
@if($corrective->visit_plan_id && $corrective->visit_plan_id != null)
Visit Plan Code : {{$corrective->visitPlan ? $corrective->visitPlan->code : 'N/A'}}
{{--
Visit Plan Date : {{$corrective->visitPlan ? $corrective->visitPlan->date : 'N/A'}}
--}}
@endif
@php if (!function_exists('getCostStatusBadge')) { function getCostStatusBadge($status) { if ($status == 1) return 'Completed'; if ($status == 2) return 'Pending'; if ($status == 3) return 'Rejected'; return 'N/A'; } } @endphp @if($corrective->costEstimations && $corrective->costEstimations != null)

Cost Estimations

@foreach ($corrective->costEstimations as $cost)
{{ $cost->code }}
@if(!empty($cost->item_estimations)) @foreach ($cost->item_estimations as $item) @endforeach
Amount Reason Status
{{ $item['amount'] }} {{ $item['reason'] }} {!! getCostStatusBadge($cost->status) !!}
@endif @endforeach
@endif @if(isset($corrective->local_purchases) && $corrective->local_purchases != null)

Local Purchases

@foreach ($corrective->local_purchases as $cost) @endforeach
Amount Reason Date Attachment
{{ $cost['amount'] }} {{ $cost['reason'] }} {{ $cost['date'] ? $cost['date'] : 'N/A' }} @if(isset($cost['image_url']) && $cost['image_url'] != null) @else N/A @endif
@endif
@endsection @section('vendor-script') @endsection