@extends('layouts.ownerLayout') @section('title', 'Serenatas') @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', 'resources/assets/vendor/libs/flatpickr/flatpickr.scss', 'resources/assets/vendor/libs/select2/select2.scss', 'resources/assets/vendor/libs/@form-validation/form-validation.scss', 'resources/assets/vendor/libs/notyf/notyf.scss' ]) @endsection @section('vendor-script') @vite([ 'resources/assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js', 'resources/assets/vendor/libs/flatpickr/flatpickr.js', 'resources/assets/vendor/libs/select2/select2.js', 'resources/assets/vendor/libs/@form-validation/popular.js', 'resources/assets/vendor/libs/@form-validation/bootstrap5.js', 'resources/assets/vendor/libs/@form-validation/auto-focus.js', 'resources/assets/vendor/libs/notyf/notyf.js' ]) @endsection @section('page-script') @vite('resources/assets/js/owner-serenatas.js') @endsection @section('content') @php $serviceStatusOptions = ['Pendiente', 'Confirmada', 'Realizada', 'Cancelada']; $normalizeServiceStatus = function ($status) { return match ((string) $status) { 'Confirmado', 'Confirmada' => 'Confirmada', 'Completada', 'Realizada' => 'Realizada', 'Cancelado', 'Cancelada' => 'Cancelada', 'Cedida', 'Pendiente' => 'Pendiente', default => 'Pendiente', }; }; $paymentBadgeClass = function ($status) { return match ((string) $status) { 'Pagado' => 'bg-label-success', 'Abono parcial' => 'bg-label-info', 'Cancelada sin cobro' => 'bg-label-danger', default => 'bg-label-warning', }; }; @endphp

{{ $stats['pending'] }}

Por cobrar


{{ $stats['completed'] }}

Realizadas


{{ $stats['ceded'] }}

Cedidas

{{ $stats['cancelled'] }}

Canceladas

Filtros
@foreach ($orders as $order) @php $giftItems = collect($order->gift_items ?? [])->filter(function ($item) { return !(bool) data_get($item, 'is_deleted', false); }); $giftIncluded = $giftItems->filter(function ($item) { $type = strtolower((string) data_get($item, 'type', 'included')); return $type !== 'additional'; })->values(); $giftAdditional = $giftItems->filter(function ($item) { $type = strtolower((string) data_get($item, 'type', 'included')); return $type === 'additional'; })->values(); $formatGiftLine = function ($item): string { $name = (string) data_get($item, 'name', 'Obsequio'); $qty = max(1, (int) data_get($item, 'quantity', 1)); $unit = (float) data_get($item, 'unit_price', 0); return $name . " x{$qty} ($" . number_format($unit, 0, ',', '.') . ')'; }; $includedText = $giftIncluded->isNotEmpty() ? $giftIncluded->map($formatGiftLine)->implode(', ') : 'Ninguno'; $additionalText = $giftAdditional->isNotEmpty() ? $giftAdditional->map($formatGiftLine)->implode(', ') : 'Ninguno'; $phoneDigits = $order->contact_phone_1_whatsapp_digits; $confirmMessage = implode("\n", [ "Hola {$order->payer_name}, te habla Camila Serenatas.", 'Queremos reconfirmar tu servicio:', 'Fecha: ' . optional($order->event_date)->format('d/m/Y'), 'Horario estimado: ' . $order->eventWindowLabel(), "Dirección: {$order->service_address}", "Barrio: {$order->neighborhood}", '', '¿Todo sigue en pie? Muchas gracias.' ]); $waConfirmUrl = $phoneDigits !== '' ? 'https://wa.me/' . $phoneDigits . '?text=' . rawurlencode($confirmMessage) : null; $shareLines = [ "SERVICIO {$order->code}", 'Grupo: ' . (optional($order->mariachiGroup)->name ?: 'Sin grupo'), "Cliente: {$order->payer_name}", 'Correo: ' . ($order->payer_email ?: '-'), "Teléfono 1: {$order->formatted_contact_phone_1}", 'Teléfono 2: ' . ($order->formatted_contact_phone_2 ?: '-'), "Dirección: {$order->service_address}", 'País: ' . ($order->service_country ?: 'Colombia'), 'Departamento: ' . ($order->service_department ?: '-'), "Ciudad/Municipio: {$order->locality}", 'Localidad: ' . ($order->service_locality ?: '-'), 'Sector/UPZ: ' . ($order->service_sector ?: '-'), "Barrio: {$order->neighborhood}", 'Fecha: ' . optional($order->event_date)->format('d/m/Y'), 'Horario estimado: ' . $order->eventWindowLabel(), "De parte de: {$order->from_name}", "Para quién: {$order->to_name}", 'Motivo: ' . ($order->reason ?: '-'), "Obsequios incluidos: {$includedText}", "Obsequios adicionales: {$additionalText}", 'Precio total: $' . number_format((float) ($order->total_charged ?? 0), 0, ',', '.'), ]; if (!empty($order->address_additional)) { $shareLines[] = "Dirección adicional: {$order->address_additional}"; } if (!empty($order->service_private_note)) { $shareLines[] = "Nota para el servicio: {$order->service_private_note}"; } $shareText = implode("\n", $shareLines); $displayDate = $order->event_date ? mb_strtoupper($order->event_date->locale('es')->translatedFormat('d F'), 'UTF-8') : '-'; $displayTime = $order->eventWindowLabel() ?: '-'; @endphp @endforeach
Serenata Fecha Grupo Cliente Pago Estado Método Acciones
{{ $order->code }}
{{ $displayDate }} {{ $displayTime }}
{{ optional($order->mariachiGroup)->name ?: 'Sin grupo' }} @if ($order->customer_id) {{ $order->payer_name }} @else {{ $order->payer_name }} @endif {{ $order->payment_status }} @php $serviceStatusLabel = $normalizeServiceStatus($order->service_status); @endphp {{ $serviceStatusLabel }} {{ $order->payment_method }} @if($waConfirmUrl) @else @endif
@endsection