@extends('layouts.base') @section('content') @section('breadcrumb') @endsection @php $address = $program->addresses->first(); $canProgramsWrite = auth()->user()->canAccessPartnerProgramsWrite(); $canLots = auth()->user()->canAccessPartnerLotsRead(); $canLotsWrite = auth()->user()->canAccessPartnerLotsWrite(); $canSaleParametersTab = auth()->user()->canAccessPartnerSaleParameters(); @endphp

{{ $program->name }}

@if($program->fiscalites->count() > 0) @foreach($program->fiscalites as $fiscalite) {{ $fiscalite->type->label() }} @endforeach @endif @if($address && $address->city) {{ $address->city }} @endif
@if($canProgramsWrite) @else @if($program->is_active)Actif @elseInactif @endif @endif @if($canLots) Visualiser @endif @if($canProgramsWrite || auth()->user()->canDeletePartnerProgram()) @endif
Modifié le {{ $program->updated_at->format('d/m/Y à H:i') }} ID #{{ $program->id }}
@php $programImages = $program->getMedia('images')->sortBy('order_column'); $imagesCount = $programImages->count(); $displayImages = $programImages->take(3); $addPhotoSlotsCount = max(0, 3 - $displayImages->count()); @endphp
Photos du programme
@if($imagesCount > 0) Télécharger @endif @if($canProgramsWrite) @endif
@if($imagesCount > 0) @php $programImagesForGallery = $programImages->map(function ($m) use ($canProgramsWrite, $program) { return [ 'url' => media_url($m, null, 60) ?? $m->getUrl(), 'title' => $m->file_name, 'type' => 'image', 'deleteUrl' => $canProgramsWrite ? route('partner.program.image.destroy', ['program' => $program->token, 'media' => $m->id]) : null, ]; })->values()->all(); @endphp @endif @if($program->documents->count() > 0 && 1 == 2)
Documents PDF
Glissez-déposez pour réorganiser
@endif
Caractéristiques

Toutes les spécificités du programme

@if($program->fiscalites->count() > 0)
Fiscalité
@foreach($program->fiscalites as $fiscalite) {{ $fiscalite->type->label() }} @endforeach
@endif @if($program->marketingTags->count() > 0)
Marketing
@foreach($program->marketingTags as $tag) @if($tag->type) {{ $tag->type->label() }} @endif @endforeach
@endif @if($program->prestations->count() > 0)
Prestations
@foreach($program->prestations as $prestation) {{ $prestation->type->label() }} @endforeach
@endif @if($program->garanties->count() > 0)
Garanties
@foreach($program->garanties as $garantie) @if($garantie->type) {{ $garantie->type->label() }} @endif @endforeach
@endif @if(($program->contrat_type && $program->contrat_type !== \App\Enums\ContratTypeProgram::NON_DEFINI) || $program->normeEcos->count() > 0)
Autres
@if($program->contrat_type && $program->contrat_type !== \App\Enums\ContratTypeProgram::NON_DEFINI) {{ $program->contrat_type->label() }} @endif @if($program->normeEcos->count() > 0) @foreach($program->normeEcos as $normeEco) {{ $normeEco->type->label() }} @endforeach @endif
@endif
Dates clés
@if($program->dates->count() > 0)
@php $programDates = $program->dates->keyBy('type'); @endphp @foreach(\App\Enums\DateTypeProgram::cases() as $dateType) @php $date = $programDates->get($dateType->value); $dateIcon = match ($dateType) { \App\Enums\DateTypeProgram::DATE_COMMERCIALISATION, \App\Enums\DateTypeProgram::DATE_ACTABILITE_PREVISIONNELLE => 'fa-calendar-days', \App\Enums\DateTypeProgram::DATE_LIVRAISON => 'fa-key', }; @endphp @if($date && $date->value)
{{ $dateType->shortLabel() }}
{{ $date->value->format('d/m/Y') }}
@endif @endforeach
@endif

Programme ajouté le {{ $program->created_at->format('d/m/Y') }}

Localisation
@if($address) {{ $address->city }} @if($address->line_1)

{{ $address->line_1 }}

@endif @if($address->line_2)

{{ $address->line_2 }}

@endif @if($address->zip_code || $address->city)

{{ $address->zip_code }} {{ $address->city }}

@endif @if($address->country)

{{ $address->country->name }}

@endif @endif
@if(isset($formEditor) && $formEditor && $formEditor->fields->count() > 0)

Champs personnalisés
Données spécifiques à cette application
Note : Ces champs ne concernent pas l'affichage sur le site de diffusion. Ils sont uniquement utilisés pour la gestion interne.
@foreach($formEditor->fields as $field) @php $fieldValue = $field->data && isset($field->data->json['value']) ? $field->data->json['value'] : null; @endphp @if($fieldValue !== null && $fieldValue !== '')
@if($field->type === \App\Enums\FieldType::TEXT || $field->type === \App\Enums\FieldType::NUMBER)

{{ $fieldValue }}

@elseif($field->type === \App\Enums\FieldType::CHECKBOX)

@if($fieldValue == '1') Activé @else Désactivé @endif

@elseif($field->type === \App\Enums\FieldType::DATE)

{{ \Carbon\Carbon::parse($fieldValue)->format('d/m/Y') }}

@else

{{ $fieldValue }}

@endif @if($field->description) {{ $field->description }} @endif
@endif @endforeach
@if($formEditor->fields->filter(fn($f) => $f->data && isset($f->data->json['value']) && $f->data->json['value'] !== '')->count() === 0)
Aucune donnée personnalisée renseignée
@endif
@php $sharedApps = $program->applications->where('id', '!=', $application->id); @endphp @if($sharedApps->count() > 0)
Programme partagé avec
@foreach($sharedApps as $app)
{{ Str::of($app->name)->substr(0,1) }}
{{ $app->name }}
{{ $app->slug }}
@endforeach
Ce programme est partagé avec {{ $sharedApps->count() }} autre(s) application(s)
@endif
@endif
@php $programLots = $program->lots->sortBy('number', SORT_NATURAL)->values(); $lotFiscaliteOptions = $program->fiscalites ->map(fn ($f) => $f->type) ->filter() ->unique(fn ($t) => $t->value) ->values(); $lotPriceOptions = $programLots ->map(fn ($lot) => $lot->prices->first()?->value) ->filter(fn ($value) => $value !== null) ->map(fn ($value) => (float) $value) ->unique() ->sort() ->values(); $lotStatusFilterOptions = [ ['value' => 'actif', 'label' => 'Actif', 'attrs' => ['data-filter-group' => 'status']], ['value' => 'inactif', 'label' => 'Inactif', 'attrs' => ['data-filter-group' => 'status']], ]; $lotDisponibiliteFilterOptions = \App\Enums\ProductState::selectableCases(); $lotDisponibiliteFilterOptions = collect($lotDisponibiliteFilterOptions)->map(fn ($state) => [ 'value' => $state->value, 'label' => $state->label(), 'attrs' => ['data-filter-group' => 'disponibilite'], ])->values()->all(); $lotFiscaliteFilterOptions = $lotFiscaliteOptions->map(fn ($fiscaliteType) => [ 'value' => $fiscaliteType->value, 'label' => $fiscaliteType->label(), 'attrs' => ['data-filter-group' => 'fiscalite'], ])->values()->all(); @endphp @if($programLots->isEmpty())
Aucun lot à l'horizon

Vous retrouvez ici la liste complète des lots du programme

@if($canLotsWrite) Ajouter un lot @endif
@else
{{ $programLots->count() }} {{ $programLots->count() > 1 ? 'lots' : 'lot' }} @if($canLotsWrite) Ajouter un lot @endif
@foreach($programLots as $lot) @php $lotDisplayPrice = $lot->prices->first(); $lotFiscalites = $lot->fiscalites->map(fn ($f) => $f->type?->label())->filter()->values(); $lotFiscaliteValues = $lot->fiscalites->map(fn ($f) => $f->type?->value)->filter()->values(); $lotTypeLabel = null; try { $lotTypeLabel = $lot->type ? $lot->type->label() : null; } catch (\Throwable $e) { $lotTypeLabel = null; } @endphp @endforeach
{{ $lot->number }} @if($lotTypeLabel) {{ $lotTypeLabel }} @endif
{{ $lot->surface !== null ? number_format($lot->surface, 0, ',', ' ') . ' m²' : '—' }} {{ $lot->floor ? $lot->floor->shortLabel() : '—' }} @if($lotFiscalites->isNotEmpty()) {{ $lotFiscalites->join(', ') }} @else Aucun dispositif @endif @if($lotDisplayPrice) {{ number_format($lotDisplayPrice->value, 0, ',', ' ') }} € @else Non défini @endif @if($lot->current_state) {{ $lot->current_state->label() }} @else Non défini @endif @if($canLotsWrite) @else {{ $lot->is_active ? 'Actif' : 'Inactif' }} @endif
@endif
@if($canProgramsWrite)
@php $argumentaireTypeFilterOptions = collect(\App\Enums\ArgumentaireType::selectableCases()) ->map(fn ($type) => [ 'value' => $type->value, 'label' => $type->label(), ]) ->values() ->all(); @endphp @if($program->creatorApplication()?->id === $application->id)
@else
Programme partagé - Seule l'application créatrice ({{ $program->creatorApplication()?->name }}) peut ajouter des argumentaires.
@endif @if($program->argumentaires->count() > 0)
@foreach($program->argumentaires->sortBy('order') as $argumentaire)
{{ $argumentaire->type->label() }}
@if($program->creatorApplication()?->id === $application->id)
@endif
{!! $argumentaire->text !!}

{{ $argumentaire->updated_at?->format('d/m/Y') ?? '-' }} @if($argumentaire->user) @php $firstInitial = strtoupper(substr($argumentaire->user->firstname ?? '', 0, 1)); $lastInitial = strtoupper(substr($argumentaire->user->lastname ?? '', 0, 1)); $initials = $firstInitial . $lastInitial; @endphp @if($initials) {{ $initials }} @endif @auth {{ $argumentaire->user_id === auth()->id() ? 'Vous' : $argumentaire->user->firstname . ' ' . $argumentaire->user->lastname }} @else {{ $argumentaire->user->firstname }} {{ $argumentaire->user->lastname }} @endauth @endif @if($program->creatorApplication()?->id === $application->id) @endif
@endforeach
@else

Aucun argumentaire

@endif
@php $programDocuments = $program->documents->sortBy('order')->values(); $documentTypeFilterOptions = collect(\App\Enums\DocumentTypeProgram::cases()) ->map(fn ($type) => ['value' => $type->value, 'label' => $type->label()]) ->all(); @endphp @if($programDocuments->isNotEmpty())
Tout télécharger
@foreach($programDocuments as $document) @php $documentTitle = trim((string) ($document->name ?: 'Document')); $documentTypeValue = (string) ($document->type ?? ''); $documentTypeLabel = trim((string) ($document->type_enum?->label() ?? '-')); @endphp @endforeach
{{ $documentTitle }}
{{ $documentTypeLabel }} {{ $document->created_at?->format('d/m/Y H:i') ?? '-' }}
@foreach($programDocuments as $document) @endforeach @else

Aucun document

@endif
@if($program->creatorApplication()?->id !== $application->id)
Programme partagé - Seule l'application créatrice ({{ $program->creatorApplication()?->name }}) peut ajouter des opérations commerciales.
@endif @if($program->opeComs->count() > 0)
@if($program->creatorApplication()?->id === $application->id)
@endif
@elseif($program->creatorApplication()?->id === $application->id)
@endif @if($program->opeComs->count() > 0) @php $allOpeComs = $program->opeComs->sortBy('order')->values(); $allLotsForProgram = $program->lots ?? collect(); $allLotsNumbersForProgram = $allLotsForProgram->pluck('number')->filter()->values(); $allCommercialisateursForProgram = $program->application?->commercialisateursActif ?? collect(); @endphp
@foreach($allOpeComs as $opeCom) @php $opeComIsActive = $opeCom->is_active ?? true; if ((bool) $opeCom->default_products) { $lotsCount = $allLotsForProgram->count(); $lotsTooltip = $allLotsNumbersForProgram->isNotEmpty() ? $allLotsNumbersForProgram->map(fn ($n) => 'Lot ' . $n)->implode(', ') : 'Aucun lot'; } else { $lots = $opeCom->products ?? collect(); $lotsCount = $lots->count(); $lotsNumbers = $lots->pluck('number')->filter()->values(); $lotsTooltip = $lotsNumbers->isNotEmpty() ? $lotsNumbers->map(fn ($n) => 'Lot ' . $n)->implode(', ') : 'Aucun lot'; } $usersTooltip = $allCommercialisateursForProgram->map(fn ($u) => $u->fullName())->implode(', '); @endphp
@if($opeCom->type)
{{ $opeCom->type->label() }} @else
{{ $opeCom->name ?? 'Opération commerciale' }} @endif
@if($program->creatorApplication()?->id === $application->id) @endif
{!! $opeCom->text !!}
@php $dateStart = $opeCom->dates->firstWhere('type', 'date_start'); $dateEnd = $opeCom->dates->firstWhere('type', 'date_end'); @endphp @if($dateStart || $dateEnd) @if($dateStart && $dateEnd) Du {{ $dateStart->value->format('d/m/Y') }} au {{ $dateEnd->value->format('d/m/Y') }} @elseif($dateStart) À partir du {{ $dateStart->value->format('d/m/Y') }} @else Jusqu'au {{ $dateEnd->value->format('d/m/Y') }} @endif @endif @if($opeCom->recipient_type?->value !== \App\Enums\OpeComRecipient::CLIENT->value)
Commercialisateurs concernés
@php $concernedCommercialisateurs = (bool) $opeCom->default_users ? $allCommercialisateursForProgram : ($opeCom->users ?? collect()); @endphp @forelse($concernedCommercialisateurs as $commercialisateur) Commercialisateur {{ trim(($commercialisateur->firstname ?? '') . ' ' . ($commercialisateur->lastname ?? '')) }} @empty Aucun commercialisateur @endforelse
Lots concernés
@php $concernedLots = (bool) $opeCom->default_products ? $allLotsForProgram : ($opeCom->products ?? collect()); @endphp @forelse($concernedLots as $lot) @php $surfaceLabel = $lot->surface !== null ? number_format($lot->surface, 0, ',', ' ') . ' m²' : '—'; $prixTtc = $lot->getPrixLotTTC(); $priceLabel = $prixTtc > 0 ? number_format($prixTtc, 0, ',', ' ') . ' €' : '—'; @endphp {{ $lot->number }} | {{ $surfaceLabel }} | {{ $priceLabel }} @empty Aucun lot @endforelse
@endif
@if($dateStart) À partir du

{{ $dateStart->value->format('d/m/Y') }}

@endif

{{ $opeCom->created_at?->format('d/m/Y') ?? '-' }} @if($opeCom->user) @php $firstInitial = strtoupper(substr($opeCom->user->firstname ?? '', 0, 1)); $lastInitial = strtoupper(substr($opeCom->user->lastname ?? '', 0, 1)); $initials = $firstInitial . $lastInitial; @endphp @if($initials) {{ $initials }} @endif @auth {{ $opeCom->user_id === auth()->id() ? 'Vous' : $opeCom->user->firstname . ' ' . $opeCom->user->lastname }} @else {{ $opeCom->user->firstname }} {{ $opeCom->user->lastname }} @endauth @endif @if($program->creatorApplication()?->id === $application->id)
@csrf @method('DELETE')
@endif
@endforeach
Aucune opération commerciale pour ce destinataire.
@else

Aucune opération commerciale

@endif
@if($program->creatorApplication()?->id !== $application->id)
Programme partagé - Seule l'application créatrice ({{ $program->creatorApplication()?->name }}) peut synchroniser les lots.
@else
Synchronisation des lots - Associez des fiscalités et opérations commerciales aux lots individuellement
@if($program->lots->count() > 0)
@foreach($program->lots as $index => $lot)

Fiscalités applicables
@if($program->fiscalites->count() > 0)
@php $lotFiscalites = $lot->fiscalites->pluck('type')->map(fn($t) => $t->value)->toArray(); @endphp @foreach($program->fiscalites as $fiscalite)
type->value, $lotFiscalites) ? 'checked' : '' }}>
@endforeach
@else
Aucune fiscalité définie pour ce programme.
@endif
Opérations commerciales applicables
@php $lotOpeComTypes = $lot->opeComs ->pluck('type') ->filter() ->map(fn ($t) => $t->value) ->toArray(); @endphp @foreach($program->opeComs as $opeCom) @if($opeCom->type)
type->value, $lotOpeComTypes) ? 'checked' : '' }}>
@endif @endforeach @if($program->opeComs->count() === 0)
Aucune opération commerciale disponible. Créez-en dans l'onglet "Opérations Commerciales".
@endif
@endforeach
@else
Aucun lot disponible pour ce programme. Créer un lot
@endif @endif
@include('partner.annexes.list', ['program' => $program, 'application' => $application])
@endif @if($canSaleParametersTab)
@if($program->creatorApplication()?->id !== $application->id)
Programme partagé - Seule l'application créatrice ({{ $program->creatorApplication()?->name }}) peut gérer les règles de vente.
@else @php $saleParameter = $program->saleParameter ?? $application->saleParameter; $isUsingApplicationParams = !$program->saleParameter; $optionDuration = \App\Enums\OptionDuration::tryFrom($saleParameter->option_duration_day ?? 1); $extensionNumbers = $saleParameter->extension_numbers ?? 0; $extensionLabel = \App\Enums\OptionProlongation::tryFrom($extensionNumbers)?->label() ?? 'Zéro'; @endphp
Configuration des options
Configurez les options et paramètres spécifiques à ce programme
Options
Durée {{ $optionDuration?->label() ?? '1 jour' }} Rang {{ ($saleParameter->option_rang ?? 1) == 2 ? 'Rang 2 autorisé' : 'Rang 1 uniquement' }} Prolongation max {{ $extensionNumbers > 0 ? $extensionLabel : 'Non autorisée' }}
Délais de signature
Délai de signature {{ $saleParameter->option_signature_deadline_day ?? 'Non défini' }}
Paramètres
{{ ($saleParameter->option_jour_ouvrable ?? false) ? 'Jours ouvrables uniquement' : 'Jours ouvrés' }}
{{ ($saleParameter->auto_validated_option ?? false) ? 'Validation automatique des poses d\'option' : 'Acceptation manuelle des poses d\'option' }}
@if($saleParameter->signataire_email ?? $saleParameter->signataire_phone ?? null)
Signataire
@if($saleParameter->signataire_email ?? null) @endif @if($saleParameter->signataire_phone ?? null) @endif @endif
@if($isUsingApplicationParams)
Paramètres par défaut de l'application

Ce programme utilise actuellement les paramètres de vente par défaut de l’application.

@else
Paramètres personnalisés

Ce programme utilise actuellement des paramètres de vente personnalisés.

@endif @if(!$isUsingApplicationParams && Auth::user()->canDeletePartnerSaleParameters()) @endif Consulter les paramètres de l'application
@endif
@endif
@if($canProgramsWrite && $program->creatorApplication()?->id === $application->id) @include('modals.add-argumentaire', ['application' => $application, 'program' => $program]) @endif @if($canProgramsWrite) @foreach($program->argumentaires->sortBy('order') as $argumentaire) @include('modals.update-argumentaire', ['argumentaire' => $argumentaire, 'application' => $application, 'program' => $program]) @include('modals.delete-argumentaire', ['argumentaire' => $argumentaire, 'program' => $program]) @endforeach @if($program->creatorApplication()?->id === $application->id) @include('modals.add-ope-com', ['application' => $application, 'program' => $program]) @endif @foreach($program->opeComs->sortBy('order') as $opeCom) @include('modals.update-ope-com', ['opeCom' => $opeCom, 'application' => $application, 'program' => $program]) @endforeach @include('modals.sync-all-fiscalites', ['application' => $application, 'program' => $program]) @include('modals.sync-all-opecoms', ['application' => $application, 'program' => $program]) @include('modals.detach-annexe', ['application' => $application, 'program' => $program]) @include('modals.attach-annexe', ['application' => $application, 'program' => $program]) @include('modals.cannot-detach-annexe') @endif @if($canSaleParametersTab) @if($program->creatorApplication()?->id === $application->id) @include('modals.edit-sale-parameter', ['application' => $application, 'program' => $program]) @endif @if(Auth::user()->canDeletePartnerSaleParameters()) @include('modals.delete-sale-parameter', ['application' => $application, 'program' => $program]) @endif @endif @if($program->creatorApplication()?->id === $application->id && auth()->user()->canDeletePartnerProgram()) @include('modals.program-delete-modals', ['program' => $program]) @endif @endsection @push('scripts') @endpush