<x-layouts.tenant pageTitle="Facturación">
    <x-page-header title="Facturación" subtitle="Configura datos base para recibos, facturas y comprobantes." />

    <x-card title="Preferencias de facturación">
        <form method="POST" action="{{ route('tenant.invoicing.update') }}" class="space-y-5">
            @csrf
            @method('PUT')
            <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                <label class="block">
                    <span class="text-sm font-semibold text-ink-700">Prefijo</span>
                    <input name="invoice_prefix" value="{{ $settings['invoice_prefix'] ?? 'RES' }}" class="input mt-1.5">
                </label>
                <label class="block">
                    <span class="text-sm font-semibold text-ink-700">Impuesto</span>
                    <input name="tax_name" value="{{ $settings['tax_name'] ?? 'IVA' }}" class="input mt-1.5">
                </label>
                <label class="block">
                    <span class="text-sm font-semibold text-ink-700">Tarifa (%)</span>
                    <input type="number" step="0.01" name="tax_rate" value="{{ $settings['tax_rate'] ?? 0 }}" class="input mt-1.5">
                </label>
                <label class="block md:col-span-3">
                    <span class="text-sm font-semibold text-ink-700">Notas en factura</span>
                    <textarea name="invoice_notes" rows="4" class="input mt-1.5">{{ $settings['invoice_notes'] ?? '' }}</textarea>
                </label>
            </div>
            <x-btn type="submit">Guardar facturación</x-btn>
        </form>
    </x-card>
</x-layouts.tenant>
