Connecticut Department of Public Health
Risk Category: {{ $inspection_data->permit ? $inspection_data->permit->risk_factor : '' }} Food Establishment Inspection Report
Establishment Type:    Permanent     Temporary     Mobile  
Other
Date: {{ isset($inspection_data->inspection_date) ? date(config('site.dateFormat'), strtotime($inspection_data->inspection_date)) : '' }}
Establishment: {{ $inspection_data->permit ? $inspection_data->permit->est_name : '' }}
Time In: {{ isset($inspection_data->time_in) ? date(config('site.timeTwelveFormat'), strtotime($inspection_data->time_in)) : '' }} Time Out: {{ isset($inspection_data->time_out) ? date(config('site.timeTwelveFormat'), strtotime($inspection_data->time_out)) : '' }}
Address: {{ $inspection_data->permit ? $inspection_data->permit->est_mailing_address : '' }} LHD: Montgomery County
Town/City: {{ $inspection_data->permit ? $inspection_data->permit->est_mailing_city : '' }} @foreach ($purposes as $key => $purpose) {{-- Close and start a new row every 2 items --}} @if (($key + 1) % 2 == 0) {{-- Empty cell under "Purpose of Inspection:" --}} @endif @endforeach
Purpose of Inspection: @if ($purpose->id == $inspection_data->purpose_id) @endif @if ($purpose->id == 4) {{ $purpose->name }} @else {{ $purpose->name }} @endif
Permit Holder: {{ $inspection_data->permit ? $inspection_data->permit->owner_name : '' }}
@php $count1 = 0; $dbstatus = ''; $in = ''; $out = ''; $no = ''; $na = ''; $cos = ''; $r = ''; $path = ''; $forcedItems = [15]; // <-- items that should always go to right column with section name @endphp @foreach ($food_sections as $q) @php $count = 0; $total_count = 0; $left_col = []; $right_col = []; // count total foreach ($q->subsection()->orderBy('id', 'ASC')->get() as $p) { $total_count++; foreach ($p->items as $i) { $total_count++; } } foreach ($q->subsection()->orderBy('id', 'ASC')->get() as $p) { $count++; // check if this subsection has a forced item $hasForcedItem = $p->items()->whereIn('id', $forcedItems)->exists(); // only add section name if not a forced section if (!$hasForcedItem) { if ($count <= floor($total_count / 2)) { $left_col[] = ['item_id' => null, 'name' => $p->name, 'status' => '']; } else { $right_col[] = ['item_id' => null, 'name' => $p->name, 'status' => '']; } } foreach ($p->items()->orderBy('id', 'ASC')->get() as $i) { $count1++; $dbstatus = $inspection_data->details()->where('item_id', $i->id); $dbstatus = $dbstatus->count() > 0 ? $dbstatus->first() : null; $in = $dbstatus ? $dbstatus->in : null; $out = $dbstatus ? $dbstatus->out : null; $no = $dbstatus ? $dbstatus->no : null; $na = $dbstatus ? $dbstatus->na : null; $cos = $dbstatus ? $dbstatus->cos : null; $r = $dbstatus ? $dbstatus->r : null; $image = $inspection_data->details->where('item_id', $i->id)->first(); $path = $image ? public_path('storage/image/food_inspection/snapshots/'.$inspection_data->id.'/'.$image->image) : null; // force items into right col with section name if (in_array($i->id, $forcedItems)) { // add section name only to right $right_col[] = ['item_id' => null, 'name' => $p->name, 'status' => '']; $right_col[] = [ 'serial_number' => $i->serial_no, 'item_id' => $i->id, 'name' => $i->name, 'is_in' => $i->is_in, 'is_out' => $i->is_out, 'is_no' => $i->is_no, 'is_na' => $i->is_na, 'in' => $in, 'out' => $out, 'no' => $no, 'na' => $na, 'cos' => $cos, 'r' => $r, 'image' => $path, ]; } elseif ($count <= floor($total_count / 2)) { $left_col[] = [ 'serial_number' => $i->serial_no, 'item_id' => $i->id, 'name' => $i->name, 'is_in' => $i->is_in, 'is_out' => $i->is_out, 'is_no' => $i->is_no, 'is_na' => $i->is_na, 'in' => $in, 'out' => $out, 'no' => $no, 'na' => $na, 'cos' => $cos, 'r' => $r, 'image' => $path, ]; } else { $right_col[] = [ 'serial_number' => $i->serial_no, 'item_id' => $i->id, 'name' => $i->name, 'is_in' => $i->is_in, 'is_out' => $i->is_out, 'is_no' => $i->is_no, 'is_na' => $i->is_na, 'in' => $in, 'out' => $out, 'no' => $no, 'na' => $na, 'cos' => $cos, 'r' => $r, 'image' => $path, ]; } $count++; } } $count = 0; @endphp @if ($q->id == 1) @else @endif @for ($i = 0; $i < max(count($left_col), count($right_col)); $i++) @php $d = $left_col[$i] ?? null; $r = $right_col[$i] ?? null; @endphp @if (!$d || !isset($d['item_id'])) @if ($i == 0) @else @endif @else @endif {{-- RIGHT --}} @if (!$r || !isset($r['item_id'])) @if ($i == 0) @else @endif @else @endif @endfor
{{ $q->name }}
Risk factors are important practices or procedures identified as the most prevalent contributing factors of foodborne illness or injury. Interventions are control measures to prevent foodborne illness or injury.
Mark designated compliance status ( IN, OUT, N/A, N/O ) for each numbered item     IN =in compliance     OUT =not in compliance     N/A =not applicable     N/O =not observed
P =Priority item     Pf =Priority foundation item     C =Core item     V =violation type    Mark in appropriate box for COS and/or R    COS =corrected on-site during inspection     R =repeat violation
Good Retail Practices are preventative measures to control the addition of pathogens, chemicals, and physical objects into foods.
Mark OUT if numbered item is not in compliance     V =violation type     Mark in appropriate box for COS and/or R     COS =corrected on-site during inspection     R =repeat violation
IN OUT NA NO {{ $d['name'] ?? '' }} V COS R {{ $d['name'] ?? '' }} {{ $d['item_id'] }} @if (boolval($d['in'])) @endif @if (boolval($d['out'])) @endif @if (boolval($d['na'])) @endif @if (boolval($d['no'])) @endif {{ $d['name'] }} @php $conditions = []; if ($inspection_data->foodcodeDetails) { $conditions = collect($inspection_data->foodcodeDetails) ->where('inspection_id', $inspection_data->id) ->where('item_id', $d['item_id'] ?? null) ->pluck('condition')->unique()->toArray(); } @endphp {{ implode(', ', $conditions) }} @if (boolval($d['cos'])) @endif @if (boolval($d['r'])) @endif IN OUT NA NO {{ $r['name'] ?? '' }} V COS R {{ $r['name'] ?? '' }} @if ($r['item_id'] != 57) {{ $r['item_id'] }} @endif @if (boolval($r['in'])) @endif @if (boolval($r['out'])) @endif @if (boolval($r['na'])) @endif @if (boolval($r['no'])) @endif {{ $r['name'] }} @php $conditions = []; if ($inspection_data->foodcodeDetails) { $conditions = collect($inspection_data->foodcodeDetails) ->where('inspection_id', $inspection_data->id) ->where('item_id', $r['item_id'] ?? null) ->pluck('condition')->unique()->toArray(); } @endphp {{ implode(', ', $conditions) }} @if (boolval($r['cos'])) @endif @if (boolval($r['r'])) @endif
@endforeach {{-- LEFT SIDE - Signatures --}} {{-- RIGHT SIDE - Violations --}}
Permit Holder shall notify customers that a copy of the most recent inspection report is available.
Person in Charge (Signature) @if ($inspection_data->receivedSignature) @endif Date {{ $inspection_data->receivedSignatureDate ? date(config('site.dateFormat'), strtotime($inspection_data->receivedSignatureDate)) : '' }}
Person in Charge (Printed) {{ $inspection_data->receivedBy }}
Inspector (Signature) @if ($inspection_data->inspectedSignature) @endif Date {{ $inspection_data->inspectedSignatureDate ? date(config('site.dateFormat'), strtotime($inspection_data->inspectedSignatureDate)) : '' }}
Inspector (Printed) {{ $inspection_data->inspectedBy }}
Violations documented Date corrections due #
Priority Item Violations {{ $inspection_data->priority_item_due_date ? date(config('site.dateFormat'), strtotime($inspection_data->priority_item_due_date)) : '' }} {{ $inspection_data->foodcodeDetails?->where('condition', 'P')->count() ?? 0 }}
Priority Foundation Item Violations {{ $inspection_data->priority_foundation_due_date ? date(config('site.dateFormat'), strtotime($inspection_data->priority_foundation_due_date)) : '' }} {{ $inspection_data->foodcodeDetails?->where('condition', 'PF')->count() ?? 0 }}
Core Item Violations {{ $inspection_data->core_item_due_date ? date(config('site.dateFormat'), strtotime($inspection_data->core_item_due_date)) : '' }} {{ $inspection_data->foodcodeDetails?->where('condition', 'C')->count() ?? 0 }}
Risk Factor/Public Health Intervention Violations {{ $inspection_data->details?->where('item_id', '<=', 29)->where('out', 1)->count() ?? 0 }}
Repeat Risk Factor/Public Health Intervention Violations {{ $inspection_data->details?->where('r', 1)->count() ?? 0 }}
Good Retail Practices Violations {{ $inspection_data->details?->where('item_id', '>', 29)->where('out', 1)->count() ?? 0 }}
Requires Reinspection - check if you intend to reinspect {!! $inspection_data->followUp ? '' : '' !!} {{-- {!! $inspection_data->details?->where('item_id', '>', 29)->where('out', 1)->count() > 0 ? '' : '' !!} --}}
Appeal: The owner or operator of a food establishment aggrieved by this order to correct any inspection violation identified by the food inspector or to hold, destroy, or
dispose of unsafe food, may appeal such order to the Director of Health, not later than forty-eight hours after issuance of such order.
{{--
Food Establishment Inspection Report
--}}
Food Establishment Inspection Report
LHD: Montgomery County Inspection Report Continuation Sheet Date: {{ isset($inspection_data->inspection_date) ? date(config('site.dateFormat'), strtotime($inspection_data->inspection_date)) : '' }}
Establishment: {{ $inspection_data->permit ? $inspection_data->permit->est_name : '' }} Address: {{ $inspection_data->permit ? $inspection_data->permit->est_mailing_address : '' }} Town: {{ $inspection_data->permit ? $inspection_data->permit->est_mailing_city : '' }}
{{-- @foreach ($inspection_data->temperature as $key => $temp) @endforeach --}} @foreach ($inspection_data->temperature as $key => $temp) @if ($key % 3 == 0) @endif @if (($key + 1) % 3 == 0) @endif @endforeach {{-- Pad last row if not complete --}} @php $remaining = count($inspection_data->temperature) % 3; @endphp @if ($remaining > 0) @for ($i = 0; $i < 3 - $remaining; $i++) @endfor @endif
TEMPERATURE OBSERVATIONS
SL No. Item Location Temp
{{ $loop->iteration }} {{ $temp->item }} {{ $temp->location }} {{ $temp->temp }}
Item/Location Temp(°F) Item/Location Temp(°F) Item/Location Temp(°F)
{{$temp->item }}{{ $temp->location ? '/'.$temp->location : '' }} {{ $temp->temp ? $temp->temp.'°F' : ''}}
   
@foreach ($inspection_data->foodcodeDetails as $details) {{-- @if ($details->code_id) --}} {{-- @endif --}} @endforeach
Observation and Corrective Action
Item No. OBSERVATIONS AND CORRECTIVE ACTIONS
{{ $details->item_id . ' ' . ($details->condition ? ' - ' . $details->condition : '') }} {{ $details->comment ? $details->comment: '' }} {{ $details->foodCodeDetails ? ($details->foodCodeDetails->code ? ' - '.$details->foodCodeDetails->code : ''): '' }} {{ $details->foodCodeDetails ? ( $details->foodCodeDetails->description ? ' - '.$details->foodCodeDetails->description : '') : '' }}
{{-- --}}
General Comment
{{$inspection_data->generalComment ? $inspection_data->generalComment : ''}}{!! $inspection_data->generalComment !!}

Person in Charge (Signature) @if ($inspection_data->receivedSignature) @endif Date {{ $inspection_data->receivedSignatureDate ? date(config('site.dateFormat'), strtotime($inspection_data->receivedSignatureDate)) : '' }}
Person in Charge (Printed) {{ $inspection_data->receivedBy }}
Inspector (Signature) @if ($inspection_data->inspectedSignature) @endif Date {{ $inspection_data->inspectedSignatureDate ? date(config('site.dateFormat'), strtotime($inspection_data->inspectedSignatureDate)) : '' }}
Inspector (Printed) {{ $inspection_data->inspectedBy }}


@foreach ($inspection_data->detailsWithImages()->orderBy('id')->get() as $key => $detail) @if ($detail->image) @if (($key + 1) % 2 == 0) @endif @endif @endforeach
-=====Inspection Image=====-

Item No. {{ $detail->item_id }}