fix(hostinger): DNS aplanado + nameservers, facturacion precios formateados, subscriptions endpoint

This commit is contained in:
Lizandro Guarnizo
2026-05-14 20:17:45 -05:00
parent beb9e9d9eb
commit abecb9b305
3 changed files with 88 additions and 27 deletions
+19 -7
View File
@@ -164,8 +164,8 @@
<th class="py-2 px-3">Nombre</th>
<th class="py-2 px-3">Estado</th>
<th class="py-2 px-3">Precio</th>
<th class="py-2 px-3">Moneda</th>
<th class="py-2 px-3">Vence</th>
<th class="py-2 px-3">Período</th>
<th class="py-2 px-3">Vence / Próximo cobro</th>
</tr>
</thead>
<tbody>
@@ -174,12 +174,12 @@
<td class="py-2 px-3 text-xs" x-text="o.name || '—'"></td>
<td class="py-2 px-3">
<span class="px-2 py-0.5 rounded-full text-xs"
:class="o.status === 'active' ? 'bg-green-100 text-green-700' : 'bg-yellow-100 text-yellow-700'"
:class="o.status === 'active' ? 'bg-green-100 text-green-700' : o.status === 'in_trial' ? 'bg-blue-100 text-blue-700' : 'bg-gray-100 text-gray-500'"
x-text="o.status"></span>
</td>
<td class="py-2 px-3 text-xs font-semibold" x-text="o.total_price || '—'"></td>
<td class="py-2 px-3 text-xs" x-text="o.currency_code || '—'"></td>
<td class="py-2 px-3 text-xs text-gray-500" x-text="o.expires_at || '—'"></td>
<td class="py-2 px-3 text-xs font-semibold font-mono" x-text="o.total_price ? o.currency_code + '\u00a0' + new Intl.NumberFormat('es-CO').format(o.total_price / 100) : '—'"></td>
<td class="py-2 px-3 text-xs text-gray-500" x-text="o.billing_period + '\u00a0' + (o.billing_period_unit === 'year' ? (o.billing_period === 1 ? 'año' : 'años') : (o.billing_period === 1 ? 'mes' : 'meses'))"></td>
<td class="py-2 px-3 text-xs text-gray-500" x-text="o.expires_at || o.next_billing_at || '—'"></td>
</tr>
</template>
</tbody>
@@ -202,6 +202,15 @@
</button>
</div>
<div class="overflow-y-auto p-5">
<!-- Nameservers -->
<div x-show="dnsNameServers" class="mb-4 p-3 bg-gray-50 rounded-lg border">
<p class="text-xs font-semibold text-gray-500 mb-2">Nameservers</p>
<div class="flex flex-wrap gap-2">
<template x-for="(ns, i) in [dnsNameServers?.ns1, dnsNameServers?.ns2, dnsNameServers?.ns3, dnsNameServers?.ns4].filter(Boolean)" :key="i">
<span class="px-2 py-1 bg-white border rounded text-xs font-mono text-gray-700" x-text="ns"></span>
</template>
</div>
</div>
<div x-show="dnsRecords.length === 0" class="text-sm text-gray-400 text-center py-8">Sin registros DNS encontrados.</div>
<table class="table-auto w-full text-xs" x-show="dnsRecords.length > 0">
<thead>
@@ -213,7 +222,7 @@
</tr>
</thead>
<tbody>
<template x-for="r in dnsRecords" :key="r.id">
<template x-for="(r, rIdx) in dnsRecords" :key="rIdx">
<tr class="border-b hover:bg-gray-50">
<td class="py-1.5 px-2"><span class="px-1.5 py-0.5 bg-blue-100 text-blue-700 rounded text-xs font-mono" x-text="r.type"></span></td>
<td class="py-1.5 px-2 font-mono" x-text="r.name"></td>
@@ -283,6 +292,7 @@ document.addEventListener('alpine:init', () => {
orders: [],
dnsRecords: [],
dnsDomain: '',
dnsNameServers: null,
dnsModal: false,
configModal: false,
cfgForm: { id: 0, token: '', nota: '' },
@@ -329,9 +339,11 @@ document.addEventListener('alpine:init', () => {
this.loading = true;
this.dnsDomain = domain;
this.dnsRecords = [];
this.dnsNameServers = null;
try {
const res = await axios.get('/app/hostinger/dns/' + encodeURIComponent(domain));
this.dnsRecords = res.data.data || [];
this.dnsNameServers = res.data.name_servers || null;
this.dnsModal = true;
} catch (e) {
this.showToast(e.response?.data?.error || 'Error al cargar DNS', 'error');