@extends('layouts/layoutMaster') @section('title', 'Detalle del anuncio') @section('vendor-style') @vite([ 'resources/assets/vendor/libs/datatables-bs5/datatables.bootstrap5.scss', 'resources/assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.scss', 'resources/assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.scss', ]) @endsection @section('page-style') @endsection @section('page-script') @endsection @section('content') @php $statusMap = [ 'draft' => ['label' => 'Borrador', 'class' => 'secondary'], 'pending' => ['label' => 'Pendiente de revision', 'class' => 'warning'], 'approved' => ['label' => 'Aprobado', 'class' => 'success'], 'rejected' => ['label' => 'Rechazado', 'class' => 'danger'], ]; $operationalMap = [ 'draft' => ['label' => 'Borrador', 'class' => 'secondary'], 'awaiting_plan' => ['label' => 'Sin plan', 'class' => 'warning'], 'awaiting_payment' => ['label' => 'Esperando pago', 'class' => 'warning'], 'active' => ['label' => 'Activo', 'class' => 'success'], 'paused' => ['label' => 'Pausado', 'class' => 'secondary'], ]; $paymentMap = [ 'none' => ['label' => 'Sin pago', 'class' => 'secondary'], 'pending' => ['label' => 'Pago en revision', 'class' => 'warning'], 'approved' => ['label' => 'Pago aprobado', 'class' => 'success'], 'rejected' => ['label' => 'Pago rechazado', 'class' => 'danger'], ]; $reviewMeta = $statusMap[$listing->review_status] ?? ['label' => $listing->reviewStatusLabel(), 'class' => 'secondary']; $operationalMeta = $operationalMap[$listing->status] ?? ['label' => \Illuminate\Support\Str::headline($listing->status ?: 'draft'), 'class' => 'secondary']; $paymentMeta = $paymentMap[$listing->payment_status] ?? ['label' => $listing->paymentStatusLabel(), 'class' => 'secondary']; $providerName = $listing->mariachiProfile?->business_name ?: $listing->mariachiProfile?->user?->display_name ?: 'Mariachi'; $providerUser = $listing->mariachiProfile?->user; $coverPhoto = $listing->photos->first(); $latestPayment = $listing->latestPayment; $paymentHistory = $listing->payments->sortByDesc('id')->values(); $pendingPayment = $paymentHistory->firstWhere('status', \App\Models\ListingPayment::STATUS_PENDING); $pendingPaymentCount = $paymentHistory->where('status', \App\Models\ListingPayment::STATUS_PENDING)->count(); $renderedFaqs = $listing->renderedFaqRows(true); $listingInitials = collect(preg_split('/\s+/', trim($listing->title ?: $providerName))) ->filter() ->take(2) ->map(fn (string $part): string => strtoupper(mb_substr($part, 0, 1))) ->implode(''); $providerInitials = collect(preg_split('/\s+/', trim($providerName))) ->filter() ->take(2) ->map(fn (string $part): string => strtoupper(mb_substr($part, 0, 1))) ->implode(''); $contentRows = [ [ 'name' => 'Portada principal', 'detail' => $listing->title ?: 'Anuncio sin titulo', 'sub' => $listing->slug ?: 'slug pendiente', 'state' => $coverPhoto ? 'Cargada' : 'Pendiente', 'stateClass' => $coverPhoto ? 'success' : 'warning', 'qty' => $coverPhoto ? 1 : 0, 'signal' => 'Hero', 'thumb' => $coverPhoto?->path ? asset('storage/'.$coverPhoto->path) : null, ], [ 'name' => 'Fotos', 'detail' => 'Galeria visual del anuncio', 'sub' => 'Fotos publicables y de apoyo', 'state' => $listing->photos->isNotEmpty() ? 'Completa' : 'Pendiente', 'stateClass' => $listing->photos->isNotEmpty() ? 'success' : 'warning', 'qty' => $listing->photos->count(), 'signal' => 'Media', 'thumb' => $coverPhoto?->path ? asset('storage/'.$coverPhoto->path) : null, ], [ 'name' => 'Videos', 'detail' => 'Apoyo audiovisual y prueba social', 'sub' => $listing->videos->isNotEmpty() ? $listing->videos->first()->platform : 'Sin videos cargados', 'state' => $listing->videos->isNotEmpty() ? 'Disponible' : 'Vacio', 'stateClass' => $listing->videos->isNotEmpty() ? 'info' : 'secondary', 'qty' => $listing->videos->count(), 'signal' => 'Video', 'thumb' => null, ], [ 'name' => 'Cobertura', 'detail' => 'Ciudad principal y zonas extra', 'sub' => $listing->city_name ?: 'Sin ciudad definida', 'state' => $listing->travels_to_other_cities || $listing->serviceAreas->isNotEmpty() ? 'Extendida' : 'Local', 'stateClass' => $listing->travels_to_other_cities || $listing->serviceAreas->isNotEmpty() ? 'primary' : 'secondary', 'qty' => $listing->serviceAreas->count(), 'signal' => 'Zona', 'thumb' => null, ], [ 'name' => 'FAQs', 'detail' => 'Preguntas frecuentes del anuncio', 'sub' => $renderedFaqs->isNotEmpty() ? $renderedFaqs->first()['question'] : 'Sin preguntas frecuentes', 'state' => $renderedFaqs->isNotEmpty() ? 'Completo' : 'Vacio', 'stateClass' => $renderedFaqs->isNotEmpty() ? 'success' : 'secondary', 'qty' => $renderedFaqs->count(), 'signal' => 'Soporte', 'thumb' => null, ], ]; @endphp @if (session('status'))
{{ session('status') }}
@endif @if ($errors->any())
@endif
Anuncio #{{ $listing->id }} {{ $reviewMeta['label'] }} {{ $operationalMeta['label'] }} {{ $paymentMeta['label'] }}

{{ optional($listing->submitted_for_review_at ?: $listing->updated_at)->format('d/m/Y H:i') ?: 'Sin fecha registrada' }} · {{ $listing->city_name ?: 'Sin ciudad' }}

Volver @if ($providerUser) Ver mariachi @endif @if ($listing->isApprovedForMarketplace() && $listing->slug) Abrir publico @endif
@foreach ($contentRows as $row) @endforeach
contenido estado qty senal
@if ($row['thumb']) {{ $row['name'] }} @else {{ strtoupper(mb_substr($row['name'], 0, 2)) }} @endif
{{ $row['name'] }}
{{ $row['detail'] }} {{ $row['sub'] }}
{{ $row['state'] }} {{ $row['qty'] }} {{ $row['signal'] }}
Completitud:
{{ (int) $listing->listing_completion }}%
Precio base:
{{ $listing->base_price ? '$'.number_format((float) $listing->base_price, 0, ',', '.') : 'Pendiente' }}
Plan:
{{ \Illuminate\Support\Str::headline($listing->selected_plan_code ?: 'sin plan') }}
Interacciones:
{{ (int) $listing->quote_conversations_count }} leads / {{ (int) $listing->reviews_count }} opiniones
Detalles del mariachi
{{ $providerInitials ?: 'MR' }}
{{ $providerName }}
Perfil #{{ $listing->mariachiProfile?->id ?: 'N/D' }}
{{ (int) $listing->quote_conversations_count }} leads asociados
Contacto
@if ($providerUser)
Abrir ficha
@endif

Email: {{ $providerUser?->email ?: 'Sin email' }}

Mobile: {{ $providerUser?->phone ?: ($listing->mariachiProfile?->whatsapp ?: 'Sin telefono') }}

Ciudad: {{ $listing->mariachiProfile?->city_name ?: $listing->city_name ?: 'Sin ciudad' }}

Ubicacion y publicacion

{{ $listing->address ?: 'Direccion pendiente' }}
{{ $listing->zone_name ?: 'Zona pendiente' }}
{{ $listing->city_name ?: 'Ciudad pendiente' }} {{ $listing->postal_code ?: '' }}
{{ $listing->country ?: 'Pais pendiente' }}

Market city: {{ $listing->marketplaceCity?->name ?: 'Sin relacion' }}
Plan vigente: {{ \Illuminate\Support\Str::headline($listing->selected_plan_code ?: 'sin plan') }}
Pago: {{ $paymentMeta['label'] }}
Viaja a otras: {{ $listing->travels_to_other_cities ? 'Si' : 'No' }}
Visible ahora: {{ $listing->isApprovedForMarketplace() ? 'Si' : 'No' }}
Resumen de pago
{{ $paymentMeta['label'] }}
@if ($latestPayment)
Plan solicitado
{{ \Illuminate\Support\Str::headline($latestPayment->plan_code) }}
Monto
${{ number_format((int) $latestPayment->amount_cop, 0, ',', '.') }} COP
Enviado
{{ $latestPayment->created_at?->format('d/m/Y H:i') ?: 'Sin fecha' }}
Metodo {{ strtoupper($latestPayment->method) }}
@if ($latestPayment->checkout_reference || $latestPayment->reference_text)
Referencia checkout
{{ $latestPayment->checkout_reference ?: $latestPayment->reference_text }}
@endif @if ($latestPayment->provider_transaction_id)
Transacción ePayco
{{ $latestPayment->provider_transaction_id }}
{{ $latestPayment->provider_transaction_status ?: 'Sin estado reportado' }}
@endif @if ($latestPayment->proof_path)
Comprobante historico Comprobante historico Abrir comprobante
@endif @if ($latestPayment->reviewed_at)
Revision del pago
{{ $latestPayment->reviewed_at->format('d/m/Y H:i') }}
{{ $latestPayment->reviewedBy?->display_name ?: 'Sin revisor asignado' }}
@endif @if ($latestPayment->rejection_reason)

Motivo del rechazo del pago

{{ $latestPayment->rejection_reason }}

@endif @if ($pendingPaymentCount > 0)
Hay {{ $pendingPaymentCount }} pago(s) pendiente(s). Valídalos en la pestaña Pagos antes de moderar el anuncio.
@endif @else
Todavia no hay transaccion registrada para este anuncio.
@endif
Moderacion
Estado editorial {{ $reviewMeta['label'] }}
Enviado a revision
{{ $listing->submitted_for_review_at?->format('d/m/Y H:i') ?: 'Aun no enviado' }}
Ultima revision
{{ $listing->reviewed_at?->format('d/m/Y H:i') ?: 'Sin revisar' }}
{{ $listing->reviewedBy?->display_name ?: 'Sin revisor asignado' }}
@if ($listing->rejection_reason)

Motivo del rechazo

{{ $listing->rejection_reason }}

@endif @if ($pendingPaymentCount > 0)
Primero resuelve los pagos pendientes desde la pestaña Pagos. La moderación editorial ya no aprueba ni rechaza cobros.
@else
@csrf @method('PATCH')
@csrf @method('PATCH')
@endif
@if ($listing->photos->isNotEmpty())
Galeria rapida
@foreach ($listing->photos->take(6) as $photo)
Foto del anuncio
@endforeach
@endif
@endsection