This commit is contained in:
Lizandro Guarnizo
2026-05-15 14:26:52 -05:00
parent 70a43597f3
commit b340d29583
8 changed files with 165 additions and 41 deletions
+51
View File
@@ -51,6 +51,7 @@
<th class="py-2 px-4 border-b w-52 ">Nombre</th>
<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-32"></th>
</tr>
</thead>
@@ -86,6 +87,16 @@
</span>
</template>
</td>
<td class="py-3 text-xs px-4 border-b">
<div class="flex flex-col gap-1">
<template x-if="registro.es_portal_cliente">
<span class="bg-blue-100 text-blue-700 px-2 py-0.5 rounded text-xs font-medium">Usuario Final</span>
</template>
<template x-if="registro.es_portal_partner">
<span class="bg-purple-100 text-purple-700 px-2 py-0.5 rounded text-xs font-medium">Partner</span>
</template>
</div>
</td>
<td class="py-3 text-xs px-4 border-b ">
<div class="flex justify-between space-x-1">
<button
@@ -105,6 +116,8 @@
Name = registro.name;
Description = registro.description;
Submodules = [...registro.submodules];
EsPortalCliente = registro.es_portal_cliente || false;
EsPortalPartner = registro.es_portal_partner || false;
modulos.forEach(modulo => {
modulo.submodules.forEach(submodulo => {
submodulo.checked = Submodules.some(sm => sm.ID === submodulo.ID);
@@ -209,6 +222,19 @@
</div>
</template>
</div>
<div class="mt-4 p-3 border rounded-md bg-slate-50">
<p class="font-semibold text-sm mb-2">Tipo de acceso Portal</p>
<div class="flex gap-6">
<label class="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" x-model="EsPortalCliente" @change="if(EsPortalCliente) EsPortalPartner=false" class="rounded">
Usuario Final (Cliente)
</label>
<label class="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" x-model="EsPortalPartner" @change="if(EsPortalPartner) EsPortalCliente=false" class="rounded">
Partner
</label>
</div>
</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"
@@ -253,6 +279,19 @@
</div>
</div>
</template>
<div class="mt-4 p-3 border rounded-md bg-slate-50">
<p class="font-semibold text-sm mb-2">Tipo de acceso Portal</p>
<div class="flex gap-6">
<label class="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" x-model="newEsPortalCliente" @change="if(newEsPortalCliente) newEsPortalPartner=false" class="rounded">
Usuario Final (Cliente)
</label>
<label class="flex items-center gap-2 text-sm cursor-pointer">
<input type="checkbox" x-model="newEsPortalPartner" @change="if(newEsPortalPartner) newEsPortalCliente=false" class="rounded">
Partner
</label>
</div>
</div>
<div class="mt-4 flex justify-between">
<button type="submit" class="bg-[#8eb02f] text-white px-4 py-2 rounded">Guardar</button>
@@ -291,9 +330,13 @@
newName: '',
newDescription: '',
newEsPortalCliente: false,
newEsPortalPartner: false,
Name: '',
Description: '',
EsPortalCliente: false,
EsPortalPartner: false,
modulos: [],
Submodules: [],
submodulos: [],
@@ -415,6 +458,8 @@
const requestData = {
name: this.newName,
description: this.newDescription,
es_portal_cliente: this.newEsPortalCliente,
es_portal_partner: this.newEsPortalPartner,
submodules: selectedSubmodules.flatMap(modulo => modulo.submodules)
};
@@ -427,6 +472,8 @@
.then(() => {
this.newName = '';
this.newDescription = '';
this.newEsPortalCliente = false;
this.newEsPortalPartner = false;
this.modulos.forEach(modulo => {
modulo.submodules.forEach(submodulo => submodulo.checked = false); // Reset checkboxes
});
@@ -471,6 +518,8 @@
body: JSON.stringify({
name: this.Name,
description: this.Description,
es_portal_cliente: this.EsPortalCliente,
es_portal_partner: this.EsPortalPartner,
submodules: this.submodulos
})
})
@@ -478,6 +527,8 @@
.then(() => {
this.Name = '';
this.Description = '';
this.EsPortalCliente = false;
this.EsPortalPartner = false;
this.submodulos = [];
this.modulos.forEach(modulo => {
modulo.submodules.forEach(submodulo => {