@extends('layouts.master') @section('title') Complain Detail @endsection @section('page-title') Complain Detail @endsection @section('body') @endsection @section('content')
Print
logo
{{ optional($complain->company)->company_name }}

{{ optional($complain->company)->company_address }}, {{ optional(optional($complain->company)->area)->area_name }}, {{ optional(optional($complain->company)->city)->city_name }}, {{ optional(optional($complain->company)->state)->state_name }}, {{ optional(optional($complain->company)->country)->country_name }}, {{ optional($complain->company)->company_pincode }}

GST No: {{ optional($complain->company)->company_gstin }}, Email: {{ optional($complain->company)->company_email }}, Phone No: {{ $complain->company->company_phone_no_1 ?? '' }}, {{ $complain->company->company_phone_no_2 ?? '' }}


To,
{{ optional($complain->customer)->customer_name }}

{{ $complain->customerAddress->customer_address }}, {{ $complain->customerAddress->customer_pincode }}, {{ $complain->customerAddress->area->area_name }}, {{ $complain->customerAddress->city->city_name }}, {{ $complain->customerAddress->state->state_name }}, {{ $complain->customerAddress->country->country_name }},
@if ($complain->customer->customer_phone_no_1) Phone No: {{ $complain->customerAddress->customer_address_phone_no ?? $complain->customer->customer_phone_no_1 }}
@endif @if ($complain->customer->customer_gstin) GST No: {{ $complain->customer->customer_gstin ?? '' }} @endif

@if ($complain->complain_reported_by != NULL) @endif @if ($complain->technician_id != NULL) @endif @if ($complain->complain_completion_date != NULL) @endif @if ($complain->complain_completion_remarks != NULL) @endif
Complain No

{{ $complain->complain_prefix }}/{{ $complain->complain_financial_year }}/{{ $complain->complain_number }}

Complain Register Date

{{ \Carbon\Carbon::parse($complain->complain_date)->format('d-m-Y') }}

Complain Reported By

{{$complain->complain_reported_by}}

Assigned Technician

{{$complain->technician->employee_first_name}} {{$complain->technician->employee_last_name}}

Completion Date

{{ \Carbon\Carbon::parse($complain->complain_completion_date)->format('d-m-Y') }}

Completion Remarks

{{$complain->complain_completion_remarks}}


Complain


Machine Details
@php $groupedItems = $complain->complainItems ->unique('complain_item_id') // ensure one row per unique service ->groupBy(function($item) { return $item->serviceItems->serviceMachines->machine_no ?? 'unknown'; }); @endphp @foreach ($groupedItems as $machineNo => $items) @php // Unique items by service_id to get AMC info $filteredItems = $items->unique('service_id'); // Get AMC display values for comparison $amcDetails = $filteredItems->map(function($item) { return [ 'amc_status' => $item->amc_status, 'amc_type' => $item->serviceItems->service->amc_type ?? '', 'start' => \Carbon\Carbon::parse($item->serviceItems->service->amc_start_date)->format('d/m/Y'), 'end' => \Carbon\Carbon::parse($item->serviceItems->service->amc_end_date)->format('d/m/Y'), ]; }); // Check if all AMC details are the same $firstAmc = $amcDetails->first(); $isSameAmc = $amcDetails->every(fn($amc) => $amc === $firstAmc); @endphp @foreach ($items->values() as $index => $complainItem) {{-- Machine No --}} @if ($index === 0) @endif {{-- AMC Status --}} @if ($isSameAmc && $index === 0) @elseif (!$isSameAmc) @endif {{-- Other columns --}} @if ($index === 0) @endif @endforeach @endforeach
Machine No AMC Status Product Brand AC Type Model No Serial No Complain Type Complain Remarks
{{ $complainItem->serviceItems->serviceMachines->machine_no ?? '' }} {{ $firstAmc['amc_status'] }} ({{ $firstAmc['amc_type'] }})
Start Date: {{ $firstAmc['start'] }}
End Date: {{ $firstAmc['end'] }}
{{ $complainItem->amc_status }} ({{ $complainItem->serviceItems->service->amc_type ?? '' }})
Start Date: {{ \Carbon\Carbon::parse($complainItem->serviceItems->service->amc_start_date)->format('d/m/Y') ?? '' }}
End Date: {{ \Carbon\Carbon::parse($complainItem->serviceItems->service->amc_end_date)->format('d/m/Y') ?? '' }}
{{ $complainItem->serviceItems->product_brand->product_brand_name ?? '' }} {{ $complainItem->serviceItems->service_item_type }} {{ $complainItem->serviceItems->model_no }} {{ $complainItem->serviceItems->serial_no }}{{ $complainItem->complain_type }} {{ $complainItem->remarks }}
@if ($breakdowns->isNotEmpty())
Breakdown Report
@foreach ($breakdowns as $breakdown) @php $parameters = [ ['Voltage (1-Ph)', $breakdown->voltage_1_ph_before, $breakdown->voltage_1_ph_after], ['Voltage (3-Ph)', $breakdown->voltage_3_ph_before, $breakdown->voltage_3_ph_after], ['Earthing Volt(N-E)', $breakdown->earthing_volt_before, $breakdown->earthing_volt_after], ['Section Pressure (PSI)', $breakdown->section_pressure_before, $breakdown->section_pressure_after], ['Discharge Pressure (PSI)', $breakdown->discharge_pressure_before, $breakdown->discharge_pressure_after], ['Compressor (AMP)', $breakdown->compressor_before, $breakdown->compressor_after], ['Unit (AMP)', $breakdown->unit_before, $breakdown->unit_after], ['Room Temperature', $breakdown->room_temperature_before, $breakdown->room_temperature_after], ['Return Air Temperature', $breakdown->return_air_before, $breakdown->return_air_after], ['Grill Air Temperature', $breakdown->grill_air_before, $breakdown->grill_air_after], ['Ambient Temperature', $breakdown->ambient_before, $breakdown->ambient_after], ['Grill Temp', $breakdown->grill_temp_before, $breakdown->grill_temp_after], ['AMP', $breakdown->amp_before, $breakdown->amp_after], ]; $parts = [ ['Compressor', $breakdown->compressor, $breakdown->compressor_action], ['IDU Fan Motor', $breakdown->idu_fan_motor, $breakdown->idu_fan_motor_action], ['ODU Fan Motor', $breakdown->odu_fan_motor, $breakdown->odu_fan_motor_action], ['Contector', $breakdown->contector, $breakdown->contector_action], ['Capacitor', $breakdown->capacitor, $breakdown->capacitor_action], ['Relay / OLP', $breakdown->relay_olp, $breakdown->relay_olp_action], ['IDU PCB', $breakdown->idu_pcb, $breakdown->idu_pcb_action], ['ODU PCB', $breakdown->odu_pcb, $breakdown->odu_pcb_action], ['IDU Cooling Coil', $breakdown->idu_colling_coil, $breakdown->idu_colling_coil_action], ['ODU Cooling Coil', $breakdown->odu_colling_coil, $breakdown->odu_colling_coil_action], ['Refrigeration', $breakdown->refrigeration, $breakdown->refrigeration_action], ['IDU Service Required', $breakdown->idu_service_required, $breakdown->idu_service_required_action], ['ODU Service Required', $breakdown->odu_service_required, $breakdown->odu_service_required_action], ]; $rowCount = max(count($parameters), count($parts)); @endphp @for ($i = 0; $i < $rowCount; $i++) @if ($i === 0) @endif {{-- Technical Parameter --}} {{-- Parts & Material --}} @if ($i === 0) @endif @endfor @endforeach
Machine No Technical Parameter Before After Part Name Requirement Action Breakdown Remarks
{{ $breakdown->complainItems->machine->machine_no }}{{ $parameters[$i][0] ?? '' }} {{ $parameters[$i][1] ?? '' }} {{ $parameters[$i][2] ?? '' }}{{ $parts[$i][0] ?? '' }} {{ $parts[$i][1] ?? '' }} {{ $parts[$i][2] ?? '' }}{{ $breakdown->remarks }}
@endif @if ($followUps->isNotEmpty())
Follow Up History
@foreach ($followUps as $followUp) @endforeach
Technician Date Note
{{ $followUp->technician->employee_first_name }} {{ $followUp->technician->employee_last_name }} {{\Carbon\Carbon::parse($followUp->follow_up_date)->format('d-m-Y')}} {{ $followUp->follow_up_note }}
@endif

Customer Name ____________________

Customer Sign ____________________

Customer Remarks ____________________

In Time ____________________

Out Time ____________________

@endsection @section('scripts') @endsection