@extends('layout') @section('content') @php $editing = $lead !== null; $action = $editing ? '/leads/'.$lead->id : '/leads'; $cancel = $editing ? '/leads/'.$lead->id : '/leads'; $estimatedValue = old('estimated_value') !== null ? old('estimated_value') : ($lead !== null && (float) $lead->estimated_value > 0 ? number_format((float) $lead->estimated_value, 2, ',', '.') : ''); $documentation = \App\Services\RichTextSanitizer::clean((string) old('documentation', $lead->documentation ?? '')); $affiliates = $affiliates ?? []; $destinationProjects = $destinationProjects ?? collect(); $destinationSystems = $destinationSystems ?? collect(); $destinationValue = old('destination', $lead?->destination_project_id ? 'project:'.$lead->destination_project_id : ($lead?->destination_system_id ? 'system:'.$lead->destination_system_id : '')); @endphp
@include('partials.context-back')

{{ $editing ? 'Editar lead' : 'Novo lead' }}

@csrf @if ($editing) @method('PUT') @endif
{!! field_error('destination') !!}
{!! field_error('name') !!}
{!! field_error('email') !!}
{!! field_error('instagram') !!}
@php($selectedAffiliate = field_value($lead, 'affiliate_id', '')) {!! field_error('affiliate_id') !!}
{!! field_error('stage') !!}
{!! field_error('temperature') !!}
{!! field_error('estimated_value') !!}
{!! field_error('next_contact') !!}
@include('partials.rich-editor', [ 'richEditorId' => 'lead-notes', 'richEditorName' => 'notes', 'richEditorValue' => field_raw_value($lead, 'notes'), 'richEditorMaxlength' => 4000, 'richEditorPlaceholder' => 'Contexto, necessidades e próximos passos…', 'richEditorHint' => 'Formatação simples. Digite @ e pelo menos 2 letras para buscar clientes, projetos, soluções, leads e outros registros.', 'richEditorMentionsUrl' => url('float-notes/references'), ]) {!! field_error('notes') !!}
@include('partials.rich-editor', [ 'richEditorId' => 'lead-documentation', 'richEditorName' => 'documentation', 'richEditorValue' => $documentation, 'richEditorMaxlength' => 30000, 'richEditorPlaceholder' => 'Escreva a documentação do lead…', 'richEditorUploadUrl' => url('/leads/'.($lead->id ?? 0).'/documentacao/imagem'), 'richEditorHint' => 'A documentação fica vinculada a este lead. Imagens de até 5 MB.', ]) {!! field_error('documentation') !!}
@if ($editing && $lead->converted_client_id === null) @endif Cancelar
@csrf

Cadastrar afiliado

O lead continuará aberto.

@if (request()->is('leads/novo') || request()->is('leads/*/editar')) @endif @if ($editing && $lead->converted_client_id === null)
@csrf @method('DELETE')
@endif @endsection