feat: pagina principal configurable por rol (HomeUrl)

This commit is contained in:
Lizandro Guarnizo
2026-07-06 23:05:02 -05:00
parent 7d27240f27
commit 9a3a5d4b25
5 changed files with 50 additions and 5 deletions
+37
View File
@@ -52,6 +52,7 @@
<th class="py-2 px-4 border-b">Descripción</th>
<th class="py-2 px-4 border-b">Submodulos</th>
<th class="py-2 px-4 border-b w-28">Portal</th>
<th class="py-2 px-4 border-b w-40">Página principal</th>
<th class="py-2 px-4 border-b w-32"></th>
</tr>
</thead>
@@ -97,6 +98,9 @@
</template>
</div>
</td>
<td class="py-3 text-xs px-4 border-b">
<span x-text="registro.home_url || 'Predeterminada'" class="text-xs text-slate-500"></span>
</td>
<td class="py-3 text-xs px-4 border-b ">
<div class="flex justify-between space-x-1">
<button
@@ -118,6 +122,7 @@
Submodules = [...registro.submodules];
EsPortalCliente = registro.es_portal_cliente || false;
EsPortalPartner = registro.es_portal_partner || false;
HomeUrl = registro.home_url || '';
modulos.forEach(modulo => {
modulo.submodules.forEach(submodulo => {
submodulo.checked = Submodules.some(sm => sm.ID === submodulo.ID);
@@ -235,6 +240,20 @@
</label>
</div>
</div>
<div class="mt-4 p-3 border rounded-md bg-slate-50">
<label class="font-semibold text-sm mb-2 block" for="editHomeUrl">Página principal después del login</label>
<select id="editHomeUrl" x-model="HomeUrl"
class="border border-gray-300 rounded w-full p-2 text-sm">
<option value="">Predeterminada (/app/servidor)</option>
<template x-for="modulo in modulos" :key="modulo.ID">
<optgroup :label="modulo.title">
<template x-for="submodulo in modulo.submodules" :key="submodulo.ID">
<option :value="submodulo.url" x-text="submodulo.title + ' (' + submodulo.url + ')'"></option>
</template>
</optgroup>
</template>
</select>
</div>
<div class="mt-4 flex justify-between">
<button type="submit" class="bg-[#8eb02f] text-white px-4 py-2 rounded">Guardar Cambios</button>
<button type="button" class="bg-gray-600 text-white px-4 py-2 rounded"
@@ -293,6 +312,20 @@
</div>
</div>
<div class="mt-4 p-3 border rounded-md bg-slate-50">
<label class="font-semibold text-sm mb-2 block" for="addHomeUrl">Página principal después del login</label>
<select id="addHomeUrl" x-model="newHomeUrl"
class="border border-gray-300 rounded w-full p-2 text-sm">
<option value="">Predeterminada (/app/servidor)</option>
<template x-for="modulo in modulos" :key="modulo.ID">
<optgroup :label="modulo.title">
<template x-for="submodulo in modulo.submodules" :key="submodulo.ID">
<option :value="submodulo.url" x-text="submodulo.title + ' (' + submodulo.url + ')'"></option>
</template>
</optgroup>
</template>
</select>
</div>
<div class="mt-4 flex justify-between">
<button type="submit" class="bg-[#8eb02f] text-white px-4 py-2 rounded">Guardar</button>
<button type="button" class="bg-gray-600 text-white px-4 py-2 rounded"
@@ -332,11 +365,13 @@
newDescription: '',
newEsPortalCliente: false,
newEsPortalPartner: false,
newHomeUrl: '',
Name: '',
Description: '',
EsPortalCliente: false,
EsPortalPartner: false,
HomeUrl: '',
modulos: [],
Submodules: [],
submodulos: [],
@@ -460,6 +495,7 @@
description: this.newDescription,
es_portal_cliente: this.newEsPortalCliente,
es_portal_partner: this.newEsPortalPartner,
home_url: this.newHomeUrl,
submodules: selectedSubmodules.flatMap(modulo => modulo.submodules)
};
@@ -520,6 +556,7 @@
description: this.Description,
es_portal_cliente: this.EsPortalCliente,
es_portal_partner: this.EsPortalPartner,
home_url: this.HomeUrl,
submodules: this.submodulos
})
})