@php
$recipientTypeValue = old('recipient_type', $opeCom->recipient_type?->value ?? \App\Enums\OpeComRecipient::CLIENT->value);
$currentTypeValue = old('type', $opeCom->type?->value);
$prixLimiteValue = $opeCom->prices->firstWhere('type', 'limite_prix')?->value;
$prixFixeValue = $opeCom->prices->firstWhere('type', 'prix_fixe')?->value;
// Sélection à l'affichage uniquement si :
// - ratio existe (non null) => ratio
// - sinon si un prix_fixe existe => fixed
// - sinon => aucun choix coché
$amountMode = old('amount_mode', $opeCom->ratio !== null ? 'ratio' : ($prixFixeValue !== null ? 'fixed' : null));
@endphp
@php
$commissionSupplementRateValue = $opeCom->rates?->firstWhere('type', 'commission')?->value;
@endphp
value || $currentTypeValue !== \App\Enums\OpeCom::BOOST_DE_COMMISSION->value) ? 'disabled' : '' }}
>
@php
$selectedUserIds = $opeCom->users->pluck('id')->map(fn ($id) => (string) $id);
$commercialisateursActif = $program->application?->commercialisateursActif ?? collect();
$isAllUsersSelected = (bool) $opeCom->default_users;
$networks = $program->application?->networks()?->orderBy('name')->get() ?? collect();
$selectedNetworks = collect(old('networks', []));
$persistedCommissionOperator = match ((string) ($opeCom->mode_calcul ?? '')) {
'>=' => 'gte',
'=' => 'eq',
'<=' => 'lte',
default => null,
};
$persistedCommissionValue = $opeCom->rate_calcul;
$selectedCommissionOperator = old('commission_operator', $persistedCommissionOperator);
$selectedCommissionValue = old('commission_value', $persistedCommissionValue);
$hasCommissionSelected = $selectedCommissionOperator !== null
&& $selectedCommissionValue !== null
&& $selectedCommissionValue !== '';
@endphp
@php
// Lots cochés : strictement ceux présents en pivot.
// Case "Tous les lots" : reflète UNIQUEMENT le flag `default_products` de l'ope_com.
$programLots = $program->lots;
$isAllSelected = (bool) $opeCom->default_products;
@endphp
Utilisez l'éditeur pour mettre en forme votre texte