@extends('back.layout.app') @section('title', config('app.name') . ' - ' . $operation->name) @php $breadcrumb = 'operations.index'; $statusColors = [ 'waiting_deal' => 'kt-badge-destructive', 'waiting_signature' => 'kt-badge-primary', 'signature_reminder' => 'kt-badge-warning', 'waiting_element' => 'kt-badge-warning', 'requested_elements' => 'kt-badge-success', 'waiting_draft' => 'kt-badge-warning', 'waiting_draft_walidation' => 'kt-badge-warning', 'draft_reminder' => 'kt-badge-warning', 'waiting_proof' => 'kt-badge-info', 'waiting_billing' => 'kt-badge-warning', 'billing_done' => 'kt-badge-success', 'wining_list_receipt' => 'kt-badge-success', 'proof_sended' => 'kt-badge-success', 'on_reclamation' => 'kt-badge-destructive', 'closed' => 'kt-badge-secondary', ]; @endphp @section('content')
{{-- ====== COLONNE GAUCHE (2/3) ====== --}}
{{-- Titre + statut + actions --}}

{{ $operation->name }}

@if ($operation->media)
{{ $operation->media->name }} @if ($operation->type) ({{ $operation->type->name }}) @endif
@endif @if ($operation->num_bdc || $operation->invoice_number)
@if ($operation->num_bdc) {{ $operation->num_bdc }} @endif @if ($operation->invoice_number) {{ $operation->invoice_number }} @endif
@endif
{{ \App\Models\Operation::STATUSES[$operation->status] ?? $operation->status }} {{-- Modifier --}} @can('edit-operations') @endcan {{-- Imprimer --}} @can('pdf-operations') @endcan {{-- Dropdown Dupliquer / Supprimer --}}
@can('edit-operations')
@endcan @can('delete-operations') @if (!$operation->invoice_number)
@endif @endcan
{{-- Description --}} @if ($operation->description)

{{ $operation->description }}

@endif {{-- Commercial + Ref commande --}}
Commercial : {{ $operation->user?->firstname ?? '—' }}
@if ($operation->order_reference)
N° bon de commande client : {{ $operation->order_reference }}
@endif
{{-- Dates --}}
Date Opération
{{ $operation->publish_date ?? '—' }}
Début Opération
{{ $operation->start_date ?? '—' }}
Fin Opération
{{ $operation->end_date ?? '—' }}
Date remise éléments
{{ $operation->expiration_date ?? '—' }}
{{-- Bloc Critères --}} @if ($operation->type && $operation->type->operationCriterias->isNotEmpty()) @php $infosByCriteria = $operation->informations->keyBy('criteria_id'); @endphp
@csrf @method('PUT')

Critères

@can('edit-operations')
@endcan
@foreach ($operation->type->operationCriterias as $criteria) @php $value = $infosByCriteria[$criteria->id]->content ?? ''; @endphp
@if ($criteria->type === 'text' || $criteria->type === 'number') @elseif ($criteria->type === 'textarea') @elseif ($criteria->type === 'select') @elseif ($criteria->type === 'radio') @php $radioVal = old('criterias.'.$criteria->id, $value); @endphp
@elseif ($criteria->type === 'checkbox') @endif
@endforeach
{{-- kt-card-content --}}
@endif
{{-- ====== COLONNE DROITE (1/3) ====== --}}
{{-- Client --}}
Client @if ($operation->customer) {{ $operation->customer->name }} @if ($operation->customer->adress_1) {{ $operation->customer->adress_1 }} @endif @if ($operation->customer->zipcode || $operation->customer->city) {{ $operation->customer->zipcode }} {{ $operation->customer->city }} @endif @if ($operation->customer->phone) {{ $operation->customer->phone }} @endif @else @endif
@if ($operation->customercontacts->isNotEmpty() || $operation->contacts->isNotEmpty())
@endif {{-- Contacts client --}} @if ($operation->customercontacts->isNotEmpty())
Contact client @can('edit-operations') @endcan
@foreach ($operation->customercontacts as $cc)
{{ $cc->firstname }} {{ $cc->lastname }} @if ($cc->job) ({{ $cc->job }}) @endif
@if ($cc->email || $cc->phone)
@if ($cc->email) {{ $cc->email }} @endif @if ($cc->email && $cc->phone) | @endif @if ($cc->phone) {{ $cc->phone }} @endif
@endif
@endforeach
@endif {{-- Contacts média --}} @foreach ($operation->contacts as $contact)
Contact média
{{ $contact->firstname }} {{ $contact->lastname }} @if ($contact->job) ({{ $contact->job }}) @endif
@if ($contact->email || $contact->phone)
@if ($contact->email) {{ $contact->email }} @endif @if ($contact->email && $contact->phone) | @endif @if ($contact->phone) {{ $contact->phone }} @endif
@endif
@endforeach
{{-- Bloc prix + BDC / Facture --}}
{{-- Frais --}}
Frais Média {{ number_format($operation->costing_price ?? 0, 2, ',', ' ') }}€ HT
Frais Agence {{ number_format($operation->agency_fees ?? 0, 2, ',', ' ') }}€ HT
Prix Total {{ number_format($operation->total_price ?? 0, 2, ',', ' ') }}€ HT
{{-- Actions BDC --}}
@can('order-operations') @if (!$operation->num_bdc) Créer le bon de commande @else Télécharger le bon de commande @if (!in_array($operation->status, ['waiting_billing', 'billing_done', 'wining_list_receipt', 'proof_sended', 'closed'])) Éditer le bon de commande @endif @endif @endcan {{-- Actions Facture --}} @can('invoice-operations') @if (in_array($operation->status, ['waiting_billing', 'billing_done']))
@if (!$operation->invoice_number) @else
Télécharger la facture
@endif
@endif @endcan
{{-- ====== BLOCS TRACKING + RAPPELS ====== --}}
{{-- Commentaires --}}

Commentaires

@can('edit-operations')
@endcan
@if ($operation->tracking->isEmpty())
Aucun commentaire pour cette opération.
@else @foreach ($operation->tracking as $t) @endforeach
Date Utilisateur Commentaire
{{ $t->created_at }} {{ $t->user?->firstname }} {{ $t->comment }} @can('edit-operations')
Modifier
Supprimer
@endcan
@endif
{{-- Rappels --}} @if (!in_array($operation->status, ['waiting_billing', 'billing_done', 'closed']))

Rappels

@can('edit-operations')
@endcan
@php $reminders = $operation->reminder()->notDone()->orderBy('alert_date')->get(); @endphp @if ($reminders->isEmpty())
Aucun rappel actif.
@else
@foreach ($reminders as $reminder)
{{ $reminder->alert_date }} @if ($reminder->note) {{ $reminder->note }} @endif {{ $reminder->owner?->firstname }}
@can('edit-operations')
@csrf @method('PATCH')
Marquer fait
@endcan
@endforeach
@endif
@endif
{{-- ── Modal Génération de facture ───────────────────────────────────── --}} @include('back.modules.sales.operations.partials.modal-invoice') @include('back.modules.sales.operations.partials.modal-reminder') @include('back.modules.sales.operations.partials.modal-tracking') @include('back.modules.sales.operations.partials.modal-customer-contacts') @include('back.modules.sales.operations.partials.drawer-edit-operation') @endsection @if (session('open_invoice_pdf')) @push('scripts') @endpush @endif @if (session('download_bdc')) @push('scripts') @endpush @endif