@extends('layouts.app') @section('title', 'Edit Outlet') @push('css') @endpush @section('content')
Edit Outlet: {{ $outlet->name }}
@if($outlet->status === 'draft')
 Draft Status

This outlet is currently in draft mode. Please complete Step 02: Workflow Config to activate it and make it available for field activities.

@endif
@csrf @method('PUT')
Outlet Details
status == 'active' ? 'checked' : '' }}>
Location
Assignment
LSR
{{ $outlet->lsr->name ?? 'Unassigned' }}
Assigned TM
{{ $outlet->tm->name ?? 'N/A' }}
Assigned SM
{{ $outlet->sm->name ?? 'N/A' }}
@csrf @method('PUT')
Workflow Template *
Changing the template will reset any ongoing workflows for this outlet.
Workflow Customization
@if($outlet->template)
@foreach($outlet->template->workflows as $wf) @php $customization = $outlet->customizations->where('workflow_id', $wf->id)->first(); $isEnabled = $customization ? $customization->is_enabled : true; @endphp
@if(str_starts_with($wf->icon ?: '', 'fa-')) @else {{ $wf->icon ?: '🔄' }} @endif
{{ $wf->name }}
{{ $wf->pivot->is_mandatory ? 'Mandatory' : 'Optional' }}
Customize Steps
@foreach($wf->steps as $step) @php $stepCustomization = $customization ? $customization->steps->where('step_id', $step->id)->first() : null; $isStepEnabled = $stepCustomization ? $stepCustomization->is_enabled : true; @endphp
{{ $loop->iteration }} {{ $step->name }}
@endforeach @if($customization) @foreach($customization->steps->where('is_custom', true) as $customStep)
{{ $loop->iteration + $wf->steps->count() }}
{{ $customStep->name }}
{{ $customStep->question_type }} • {{ $customStep->is_mandatory ? 'Mandatory' : 'Optional' }}
is_enabled ? 'checked' : '' }}>
@endforeach @endif
@endforeach
@else

Select a template and save to customize individual workflows.

@endif
Workflow Preview
@if($outlet->template)
@foreach($outlet->template->workflows as $wf)
@if(str_starts_with($wf->icon ?: '', 'fa-')) @else {{ $wf->icon ?: '🔄' }} @endif
{{ $wf->name }}
{{ $wf->steps()->count() }} steps • {{ $wf->pivot->is_mandatory ? 'Mandatory' : 'Optional' }}
@endforeach
@else
No template assigned.
@endif
@csrf @method('PUT')
Must Have Base
Optional Brands
Drive Brand
Must-have brands will trigger alerts if reported unavailable during a visit.
@csrf @method('PUT')
POSM Norms Assignment @can('HoReCa POSM Norms create') @endcan
Assign POSM norms template based on outlet type and size.
use_custom_posm_norms ? 'checked' : '' }}>
Custom norms will override template for this outlet only.
Template Preview
@if($outlet->posmTemplate)

Applicable Types: {{ implode(', ', array_map('ucfirst', $outlet->posmTemplate->outlet_types ?? [])) }}

@foreach($outlet->posmTemplate->items as $item) @endforeach
PRODUCT NAME MIN QTY MAX QTY MUST HAVE
{{ $item->product->name ?? 'Deleted Product' }} {{ $item->min_quantity }} {{ $item->max_quantity }} @if($item->must_have) @else — @endif
@else

Select a template to see details.

@endif
Custom POSM Norms
@php $normIdx = 0; @endphp @forelse($outlet->posmNorms as $norm) @php $normIdx++; @endphp @empty @endforelse
PRODUCT QTY MIN QTY MAX QTY MUST HAVE DEVIATION
must_have ? 'checked' : '' }}>
No custom norms defined. Click "Add Product Line" to start.
@csrf @method('PUT')
Coolers
@php $equipIdx = 0; @endphp @forelse($outlet->equipment->where('equipment_type', 'cooler') as $item) @php $equipIdx++; @endphp @empty @endforelse
Type Quantity Serial Numbers
No coolers added.
Branding Materials
@forelse($outlet->equipment->where('equipment_type', 'branding_material') as $item) @php $equipIdx++; @endphp @empty @endforelse
Type / Name Quantity
No branding materials added.
Pouring Materials
@forelse($outlet->equipment->where('equipment_type', 'pouring_material') as $item) @php $equipIdx++; @endphp @empty @endforelse
Type / Name Quantity
No pouring materials added.
{{-- Activity Filters --}}
@if($activities->count() == 0)

No activity history available.

@else
@foreach($activities as $activity) @php $itemType = $activity['type']; if (in_array($itemType, ['created', 'audit'])) $itemType = 'config'; @endphp
@if($activity['date'])
{{ $activity['date']->format('M d, Y') }}
{{ $activity['date']->format('h:i A') }}
@else
N/A
@endif
{{ $activity['title'] }}
@if(isset($activity['status'])) {{ $activity['status'] }} @endif

{{ $activity['description'] }}

@if(isset($activity['outcome_reason']) && $activity['outcome_reason'])
{{ $activity['outcome_reason'] }}
@endif {{-- Extra Details Grid --}}
@if(isset($activity['check_in']))
Check-in
{{ $activity['check_in'] }}
Check-out
{{ $activity['check_out'] ?? 'N/A' }}
@endif @if(isset($activity['category']))
Category
{{ $activity['category'] }}
@endif @if(isset($activity['assigned_to']))
Assigned To
{{ $activity['assigned_to'] }}
@endif @if(isset($activity['sla_due']))
SLA Due Date
{{ $activity['sla_due'] }}
@endif @if(isset($activity['scheduled']))
Scheduled Date
{{ $activity['scheduled'] }}
Completed Date
{{ $activity['completed'] }}
@endif {{-- Specific Workflow Layout --}} @if(isset($activity['started_at']))
Started
{{ $activity['started_at'] }}
Completed
{{ $activity['completed_at'] }}
Duration
{{ $activity['duration'] }}
Progress
{{ $activity['steps_completed'] }} steps
@endif
{{ $activity['user'] }}
@if(isset($activity['priority']))
{{ $activity['priority'] }} Priority
@endif
@endforeach
@endif
{{-- Pagination --}}
@endsection @push('js') @endpush