@php $backgroundImage = ($invitation->variables->where('name', 'backgroundImage')->first()); $templateFolder = $invitation->template->version == 2 ? 'templates_v2' : 'templates'; $assetRoot = 'img/'.$templateFolder.'/'.str_replace(' ', '-', strtolower($invitation->template->name)).'/cover.jpg'; $cover = $backgroundImage ? Storage::url($backgroundImage['value']) : asset($assetRoot); $privateTransport = optional($invitation->variables->where('name', 'enablePrivateTransportation')->first())->value == 1; $EssentialMusic = optional($invitation->variables->where('name', 'enableEssentialMusic')->first())->value == 1; $ConfirmationAttendance = optional($invitation->variables->where('name', 'enableAttendanceConfirmation')->first())->value == 1; $plan = $invitation->plan; $guestsEnabled = $plan ? (bool) ($plan->enable_guests ?? true) : true; $tablesEnabled = $plan ? (bool) ($plan->enable_table_layout ?? true) : true; $confirmationsEnabled = $plan ? (bool) ($plan->enable_confirmations ?? true) : true; // Considerar Free por nombre del plan o ausencia de plan $isFreePlan = !$plan || strtolower((string) $plan->name) === 'free'; $commonEditRule = $invitation->customer_id == auth()->user()->id || auth()->user()->role_id == \App\Models\User::BUSINESS_ROL_ID; @endphp @php // Calcular el precio base (lista) del plan actual según el país $currentPlanPriceRow = $plan ? $plan->prices()->first() : null; $currentPlanBasePrice = $currentPlanPriceRow ? (float) $currentPlanPriceRow->price : 0.0; // Determinar si el plan actual es pago para reglas de upgrade (para el monto mostrado) $isPaidPlanForPricing = $plan && strtolower((string) $plan->name) !== 'free'; // Construir lista de planes superiores por jerarquía (level) al actual, visibles // Solo mostrar planes para clientes finales (is_business = false o null) $allVisiblePlans = \App\Models\Plan::where('is_visible', true) ->where(function($q) { $q->where('is_business', false) ->orWhereNull('is_business'); }) ->get(); $currentLevel = $plan ? (int)($plan->level ?? 0) : 0; $upgradePlans = $allVisiblePlans ->filter(function($p) use ($plan, $currentLevel) { // Excluir el plan actual if ($plan && $p->id === $plan->id) return false; // Considerar superior si su nivel es mayor al nivel actual return (int)($p->level ?? 0) > $currentLevel; }) // Ordenar por jerarquía ascendente (de inferior a superior); empate por precio ascendente ->sortBy(function($p){ $lvl = (int)($p->level ?? PHP_INT_MAX); $row = $p->prices()->first(); $price = $row ? (float) $row->price : PHP_INT_MAX; return sprintf('%08d-%015.2f', $lvl, $price); }) ->values(); $upgradePlanFeatures = collect(); if ($upgradePlans->isNotEmpty()) { $upgradePlanFeatures = \App\Models\PlanFeature::query() ->whereIn('plan_id', $upgradePlans->pluck('id')) ->active() ->forInvitationType($invitation->invitation_type_id) ->ordered() ->get() ->groupBy('plan_id'); } @endphp
{{ $invitation->type->name }} - {{ optional($plan)->name ?? 'Free' }}

{{ $invitation->title }}

@php $eventDateSrc = $invitation->event_date ?? $invitation->date ?? $invitation->event_at ?? null; $eventDateStr = $eventDateSrc ? \Carbon\Carbon::parse($eventDateSrc)->locale('es')->isoFormat('D[/]MM[/]YYYY') : null; @endphp @if($eventDateStr)
{{ $eventDateStr }}
@endif
Modelo {{ $invitation->template->name }}.
@if($commonEditRule && auth()->user()->can_edit_invitation == 1) Editar invitación @endif @if(auth()->user()->role_id == \App\Models\User::BUSINESS_ROL_ID && $allowedPlans && $allowedPlans->count() > 0) @endif Ver invitación @php $shareEnabled = $plan ? (bool) ($plan->enable_share ?? true) : true; @endphp @if($shareEnabled) @endif
@if(!$isFreePlan && $guestsEnabled)
Lista de invitados
Agregá y gestioná a todos tus invitados.
@else @endif
@if(!$isFreePlan && $tablesEnabled)
Organizador de mesas
Distribuí a tus invitados fácilmente.
@else @endif
@php $isControlTotal = $plan && stripos((string) $plan->name, 'control total') !== false; @endphp @if($isControlTotal)
Ver Confirmados
Revisá quiénes confirmaron su asistencia.
@elseif(!$isFreePlan && $confirmationsEnabled) @else @endif
@if($isFreePlan) @else @endif
@if($isFreePlan) @else @endif
@push('styles') @endpush @push('scripts') @endpush @script @endscript