@extends('layouts.app') @section('title', $company->name . ' — TI Manager') @section('content')
{{-- Encabezado --}}
{{-- Columna 1 --}}
{{-- Logo --}} @if($company->logo)
{{ $company->name }}
@endif {{-- Info General --}}
Información General
Nombre {{ $company->name }}
@if($company->nit)
NIT {{ $company->nit }}{{ $company->dv ? '-'.$company->dv : '' }}
@endif @if($company->responsabilidad_fiscal)
Resp. Fiscal {{ $company->responsabilidad_fiscal }}
@endif
{{-- Estado de Cuenta --}}
Estado de Cuenta
@php $totalInvoiced = $company->invoices->sum('total_amount'); $totalPaid = $company->invoices->where('status', 'Pagado')->sum('total_amount'); $totalDebt = $company->invoices->where('status', 'Sin Pagar')->sum('total_amount'); @endphp
Total Facturado ${{ number_format($totalInvoiced, 0) }}
Total Pagado ${{ number_format($totalPaid, 0) }}
Deuda Actual ${{ number_format($totalDebt, 0) }}
{{-- Columna 2 --}}
{{-- Ubicación --}}
Ubicación
@if($company->address)
Dirección {{ $company->address }}
@endif @if($company->city)
Ciudad {{ $company->city }}
@endif @if($company->department)
Departamento {{ $company->department }}
@endif @if(!$company->address && !$company->city && !$company->department)

No se ha registrado ubicación.

@endif
{{-- Contacto --}}
Contacto
@if($company->phone) @endif @if($company->email) @endif @if($company->website) @endif @if(!$company->phone && !$company->email && !$company->website)

No se ha registrado información de contacto.

@endif
{{-- Notas --}} @if($company->notes)
Notas

{{ $company->notes }}

@endif
{{-- Columna 3 --}}
{{-- Sedes / Sucursales --}}

Sedes @if($company->branches->count() > 0) ({{ $company->branches->count() }}) @endif

@if(Auth::user()->isAdmin()) Nueva Sede @endif
@if($company->branches->count() > 0) @foreach($company->branches as $branch)
{{ $branch->name }} @if($branch->is_main) Principal @endif {{ $branch->is_active ? 'Activa' : 'Inactiva' }}
{{ $branch->full_address }} @if($branch->contact_person) · {{ $branch->contact_person }} @endif
@endforeach @else

No hay sedes registradas.

@if(Auth::user()->isAdmin()) Crear primera sede @endif
@endif
{{-- Contactos de las Sedes --}} @php $branchesWithContacts = $company->branches->filter(function($branch) { return !empty($branch->contact_person); }); @endphp

Contactos de Sedes @if($branchesWithContacts->count() > 0) ({{ $branchesWithContacts->count() }}) @endif

@if($branchesWithContacts->count() > 0) @foreach($branchesWithContacts as $branch)
{{ strtoupper(substr($branch->contact_person, 0, 2)) }}
{{ $branch->contact_person }}
{{ $branch->name }}
@if($branch->phone) @endif
@endforeach @else

No hay encargados registrados en las sedes.

@endif
{{-- Facturas DIAN --}}

Facturas DIAN @if($company->invoices->count() > 0) ({{ $company->invoices->count() }}) @endif

@if(!auth()->user()->isClient()) Subir Factura @endif
@if($company->invoices->count() > 0)
@foreach($company->invoices as $invoice) @endforeach
Número Emisión Total Estado Acciones
{{ $invoice->document_number }} {{ $invoice->issue_date ? $invoice->issue_date->format('d/m/Y') : 'N/A' }} ${{ number_format($invoice->total_amount, 0) }} @php $color = $invoice->status === 'Pagado' ? ['bg' => 'rgba(145, 200, 73, 0.1)', 'color' => '#91c849'] : ['bg' => 'rgba(239, 68, 68, 0.1)', 'color' => '#ef4444']; @endphp {{ $invoice->status }}
@else

Esta empresa no tiene facturas registradas.

@endif
@endsection