@extends('layouts.app') @section('title', 'Edit Workflow') @section('content')
Edit Workflow: {{ $workflow->icon }} {{ $workflow->name }}
@csrf @method('PUT')
Workflow Details
@error('name')
{{ $message }}
@enderror
{{ strlen($workflow->description) }}/500
@error('category')
{{ $message }}
@enderror
status) == 'active' ? 'checked' : '' }}>
status) == 'inactive' ? 'checked' : '' }}>
Workflow Steps
Drag to reorder steps
@foreach($workflow->steps as $index => $step)
{{ $index + 1 }}
{{ $step->name }}
@php if ($step->question_type == 'mhb_brand') { $qTypeLabel = 'MHB Brand?'; } elseif (in_array($step->question_type, ['text', 'number'])) { $qTypeLabel = 'Text Area'; } else { $qTypeLabel = 'Selection'; } @endphp {{ $qTypeLabel }}
Mandatory
{{ strlen($step->description ?? '') }}/300
question_type, ['yes_no', 'single_select', 'multi_select']) ? 'checked' : '' }}>
question_type, ['text', 'number']) ? 'checked' : '' }}>
question_type == 'mhb_brand' ? 'checked' : '' }}>
question_type == 'yes_no' ? 'checked' : '' }}>
question_type == 'single_select' ? 'checked' : '' }}>
question_type == 'multi_select' ? 'checked' : '' }}>
@foreach($step->options as $optIndex => $option)
@endforeach
Configuration
is_mandatory ? 'checked' : '' }}>
User cannot skip this step.
allow_skip ? 'checked' : '' }}>
User can bypass this step if needed.
@if($step->skip_reasons) @foreach($step->skip_reasons as $sIndex => $reason)
@endforeach @endif
allow_remarks ? 'checked' : '' }}>
require_photo ? 'checked' : '' }}>
@php $hasTrigger = $step->trigger_sr; @endphp
@if(in_array($step->question_type, ['yes_no', 'single_select', 'multi_select'])) @else @endif
A service request will be created automatically if the answer matches.
{{-- Removed Save Step and Cancel buttons --}}
@endforeach @if($workflow->steps->isEmpty())
No steps added yet

Click "Add Step" to begin building your workflow.

@endif
Conditional Logic

Define when steps should be shown based on previous responses.

@php $conditionIndex = 0; $hasConditions = false; @endphp @foreach($workflow->steps as $stepIdx => $step) @foreach($step->conditions as $condition) @php $hasConditions = true; @endphp
IF
@php $sourceStepIdx = $workflow->steps->search(fn($s) => $s->id == $condition->condition_step_id); @endphp
@php $conditionIndex++; @endphp @endforeach @endforeach
No conditional logic defined

All steps will be shown in sequence.

Workflow Preview
@if(str_starts_with($workflow->icon ?: '', 'fa-')) @else {{ $workflow->icon ?: '🔄' }} @endif
{{ $workflow->name }}
@foreach($workflow->steps as $step)
{{ $step->name }}
@if($step->question_type == 'yes_no')
@elseif($step->question_type == 'text') @else @foreach($step->options as $option)
@endforeach @endif
@endforeach
@endsection @push('js') @push('css') @endpush @push('js') @endpush