@extends('admin.admin_master')

@section('admin')
<div class="page-content">
    <div class="container-fluid">
        <div class="row mb-4">
            <div class="col-12">
                <h4 class="page-title mb-1">Edit Workflow</h4>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                @if($errors->any())
                    <div class="alert alert-danger">
                        <ul class="mb-0">
                            @foreach($errors->all() as $error)
                                <li>{{ $error }}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                <form action="{{ route('workflow.update', $workflow) }}" method="POST">
                    @csrf
                    @method('PUT')
                    <div class="mb-3">
                        <label for="name" class="form-label">Workflow Name</label>
                        <input type="text" name="name" id="name" class="form-control" value="{{ $workflow->name }}" required>
                    </div>
                    <div class="mb-3">
                        <label for="description" class="form-label">Description</label>
                        <textarea name="description" id="description" class="form-control">{{ $workflow->description }}</textarea>
                    </div>
                    <button type="submit" class="btn btn-success">Update Workflow</button>
                    <a href="{{ route('workflow.index') }}" class="btn btn-secondary">Cancel</a>
                    <a href="{{ route('workflow.steps.create', $workflow->id) }}" class="btn btn-primary ms-2">Next</a>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
