Form:
{{$case->form_name ?? ' '}}
{{$case->created_at->format('d M Y, h:i a')}}
{{$case->getReporter()->name ?? 'External User'}}
Reported from @else Reported from @endifgetReporter()->id) && $case->getReporter()->email != 'external@qitech.com') title="{{$case->location_full_address}}"@endif> @if (isset($case->saved_loc)) {{ isset($case->saved_loc->location_id) ? $case->saved_loc->location_id : $case->saved_loc->trading_name}} @else {{ isset($case->location->location_id) ? $case->location->location_id : $case->location_name}} @endif
{{ $case->updated_at->diffForHumans() }}
{{ $case->link_case_with_form->form->name }}
Complete Report
-
@foreach ($json as $id => $changes)
@php
// Function to extract values
if (!function_exists('extractValues')) {
function extractValues($value) {
if (is_array($value) && !empty($value)) {
$flattened = [];
foreach ($value as $item) {
if (is_array($item)) {
if (!empty($item['vtm']['vtm_string'])) {
$flattened[] = $item['vtm']['vtm_string'];
}
if (!empty($item['other'])) {
$flattened[] = $item['other'];
}
} else {
$flattened[] = (string) $item;
}
}
return !empty($flattened) ? implode(', ', $flattened) : null;
}
return !empty($value) ? (string) $value : null;
}
}
// Extract values
$original_value = extractValues($changes['original']['value'] ?? null);
$modified_value = extractValues($changes['modified']['value'] ?? null);
// Skip rendering if both values are empty
if (empty($original_value) && empty($modified_value)) {
continue;
}
// Get details or fallback
$details = !empty($original_value) ? $record->get_question_details_by_id($id, $modification->parent_record_id, $original_value) : null;
$modified_details = !empty($modified_value) ? $record->get_question_details_by_id($id, $modification->parent_record_id, $modified_value) : null;
if (empty($details) && !empty($original_value)) {
$details = $original_value;
}
if (empty($modified_details) && !empty($modified_value)) {
$modified_details = $modified_value;
}
// Format results
$result = is_array($details) && !empty($details) ? implode(', ', array_map('strval', $details)) : ($details ?? 'N/A');
$modified_result = is_array($modified_details) && !empty($modified_details) ? implode(', ', array_map('strval', $modified_details)) : ($modified_details ?? 'N/A');
@endphp
-
Question: {{ $changes['original']['label'] ?? 'Unknown' }}
Response: {{ $result ?? 'N/A' }} → {{ $modified_result ?? 'N/A' }}
@endforeach
No modifications!
@endif