This commit is contained in:
Lizandro Guarnizo
2026-05-06 15:44:51 -05:00
parent 1a8cc92a22
commit 048ebf5d70
4 changed files with 365 additions and 30 deletions
+34 -12
View File
@@ -19,6 +19,7 @@
<tr>
<th class="py-2 px-4 border-b">Nombre</th>
<th class="py-2 px-4 border-b">SaaS</th>
<th class="py-2 px-4 border-b">Pasarela</th>
<th class="py-2 px-4 border-b">Endpoint</th>
<th class="py-2 px-4 border-b">Método</th>
<th class="py-2 px-4 border-b">Estado</th>
@@ -27,12 +28,21 @@
</thead>
<tbody class="text-gray-500">
<template x-if="items.length === 0 && !loading">
<tr><td colspan="6" class="py-4 text-center text-gray-400">Sin registros</td></tr>
<tr><td colspan="7" class="py-4 text-center text-gray-400">Sin registros</td></tr>
</template>
<template x-for="item in items" :key="item.ID">
<tr class="hover:bg-gray-50 border-b border-gray-100">
<td class="py-2 px-4 font-medium text-gray-800" x-text="item.nombre"></td>
<td class="py-2 px-4 text-xs text-gray-600" x-text="item.SaasProducto ? item.SaasProducto.nombre : '-'"></td>
<td class="py-2 px-4">
<span x-text="item.pasarela || 'ambas'"
:class="{
'bg-purple-100 text-purple-700': item.pasarela === 'dlocal',
'bg-orange-100 text-orange-700': item.pasarela === 'bold',
'bg-gray-100 text-gray-600': !item.pasarela || item.pasarela === 'ambas'
}"
class="text-xs px-2 py-0.5 rounded-full capitalize"></span>
</td>
<td class="py-2 px-4">
<span class="font-mono text-xs text-blue-700 break-all" x-text="item.endpoint_url"></span>
</td>
@@ -86,16 +96,27 @@
<label class="block text-sm font-medium text-gray-700 mb-1">Nombre / etiqueta <span class="text-red-500">*</span></label>
<input type="text" x-model="form.nombre" class="border rounded w-full p-2 text-sm" placeholder="Ej: VCard confirmar pago">
</div>
<!-- SaaS -->
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Producto SaaS <span class="text-red-500">*</span></label>
<select x-model.number="form.saas_id" class="border rounded w-full p-2 text-sm">
<option value="">— Seleccionar —</option>
<template x-for="s in saasOpts" :key="s.ID">
<option :value="s.ID" x-text="s.nombre"></option>
</template>
</select>
<p class="text-xs text-gray-400 mt-0.5">El SaaS debe tener un Servicio vinculado para que se active al confirmar contratos.</p>
<!-- SaaS + Pasarela -->
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Producto SaaS <span class="text-red-500">*</span></label>
<select x-model.number="form.saas_id" class="border rounded w-full p-2 text-sm">
<option value="">— Seleccionar —</option>
<template x-for="s in saasOpts" :key="s.ID">
<option :value="s.ID" x-text="s.nombre"></option>
</template>
</select>
<p class="text-xs text-gray-400 mt-0.5">Debe tener un Servicio vinculado para activarse al confirmar contratos.</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Pasarela de pago</label>
<select x-model="form.pasarela" class="border rounded w-full p-2 text-sm">
<option value="ambas">Ambas (Bold + dLocal)</option>
<option value="dlocal">Solo dLocal</option>
<option value="bold">Solo Bold</option>
</select>
<p class="text-xs text-gray-400 mt-0.5">Qué pasarela dispara esta notificación.</p>
</div>
</div>
<!-- Endpoint URL -->
<div>
@@ -170,7 +191,7 @@ function saasApiApp() {
saving: false, error: '',
form: {},
defaultForm() {
return { saas_id: 0, nombre: '', endpoint_url: '', metodo: 'POST', api_key_header: '', api_key_value: '', payload_template: '', timeout_seg: 10, activo: true };
return { saas_id: 0, nombre: '', pasarela: 'ambas', endpoint_url: '', metodo: 'POST', api_key_header: '', api_key_value: '', payload_template: '', timeout_seg: 10, activo: true };
},
async init() { await this.load(1); },
async load(p) {
@@ -197,6 +218,7 @@ function saasApiApp() {
id: item.ID,
saas_id: item.saas_id,
nombre: item.nombre,
pasarela: item.pasarela || 'ambas',
endpoint_url: item.endpoint_url,
metodo: item.metodo || 'POST',
api_key_header: item.api_key_header || '',