@extends('layouts.app')
@php
$status = $customer->customer->status ?? null;
$badgeClass = match($status) {
'1' => 'success',
'0' => 'danger',
'2' => 'warning',
default => 'secondary'
};
$statusText = match($status) {
'1' => 'Activo',
'0' => 'Inactivo',
'2' => 'Facturable',
default => 'Desconocido'
};
// Preparar días de pago para JavaScript
$diasPago = is_array($customer->payment_days) ? $customer->payment_days : json_decode($customer->payment_days, true);
$paymentDaysJS = $diasPago && is_array($diasPago) ?
array_map(function($dia) {
return \Carbon\Carbon::parse($dia)->format('Y-m-d');
}, $diasPago) : [];
@endphp
@section('content')
@include('layouts.alert')
Detalles de {{ $customer->customer->name }}
Datos Personales
{{ $customer->customer->tax_name ?? '-' }}
{{ $customer->customer->rfc ?? '-' }}
Información Fiscal
{{ number_format($customer->credit->current_balance, 2) }}
{{ number_format($customer->credit->limit_amount, 2) }}
{{ $customer->customer->taxRegime->name ?? '-' }}
{{ $customer->cfdiUsage->code ?? '-' }}
{{ $customer->cfdiUsage->description ?? '' }}
Fechas y Observaciones
@if($customer->payment_start_date)
{{ \Carbon\Carbon::parse($customer->payment_start_date)->format('d/m/Y') }}
@else
-
@endif
@if($customer->payment_end_date)
{{ \Carbon\Carbon::parse($customer->payment_end_date)->format('d/m/Y') }}
@else
-
@endif
@if($customer->credit->notes)
{{ $customer->credit->notes }}
@else
Sin observaciones
@endif
{{-- Tabla de facturas del cliente --}}
@include('invoices.tables.customer_invoices')
@endsection