1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3216],{46693:function(e,t,s){Promise.resolve().then(s.bind(s,11477))},11477:function(e,t,s){"use strict";s.d(t,{default:function(){return h}});var r=s(57437),a=s(2265),l=s(16463),n=s(14418),i=s(57357),o=s(65251),d=s(60912),u=s(86366);s(74590);var c=s(58064),m=(0,c.$)("da095585396ca2f5a6584c86e9677aeda616f5ab");(0,c.$)("0b45d2b8eda7e18d8d16ae8a01eb70830c5129ef");var x=(0,c.$)("ebba4b038ba9194e6006503d00babcc3d63b5845");function h(e){let{data:t}=e,s=(0,l.useRouter)(),[c,h]=(0,a.useTransition)(),[p,f]=(0,a.useState)(""),[g,v]=(0,a.useState)(""),[b,j]=(0,a.useState)(""),[y,N]=(0,a.useState)(""),[w,k]=(0,a.useState)(""),S=(0,a.useMemo)(()=>{let e=b.trim().toLowerCase();return e?t.users.filter(t=>{var s,r,a,l,n;return[null!==(s=t.name)&&void 0!==s?s:"",null!==(r=t.firstname)&&void 0!==r?r:"",null!==(a=t.lastname)&&void 0!==a?a:"",null!==(l=t.shortname)&&void 0!==l?l:"",null!==(n=t.email)&&void 0!==n?n:"",...t.roles.map(e=>e.name)].join(" ").toLowerCase().includes(e)}):t.users},[t.users,b]);return(0,r.jsxs)("div",{className:"space-y-4",children:[y&&(0,r.jsxs)("div",{className:"flex items-start gap-2 rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-800",children:[(0,r.jsx)(n.Z,{size:18,className:"mt-0.5 shrink-0"}),y]}),w&&(0,r.jsx)("div",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-sm font-medium text-emerald-800",children:w}),(0,r.jsxs)("section",{className:"overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[(0,r.jsxs)("div",{className:"border-b border-slate-100 px-4 py-4 sm:px-5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(i.Z,{size:19,className:"text-purple-700"}),(0,r.jsx)("h2",{className:"text-sm font-bold text-slate-900",children:"Asignar rol"})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:"Se puede asignar cualquier rol existente excepto superadmin, que es exclusivamente global. Si existiera una asignaci\xf3n hist\xf3rica de superadmin, se muestra para poder eliminarla."})]}),(0,r.jsxs)("form",{onSubmit:function(e){e.preventDefault(),N(""),k(""),h(async()=>{let e=await x({orgId:t.organization.id,email:p,roleId:g});if(!e.ok){N(e.error);return}f(""),k("Rol asignado correctamente."),s.refresh()})},className:"grid gap-3 p-4 sm:p-5 md:grid-cols-[1fr_280px_auto]",children:[(0,r.jsx)("input",{type:"email",value:p,onChange:e=>f(e.target.value),placeholder:"Email de un usuario existente",required:!0,className:"h-11 rounded-xl border border-slate-300 bg-white px-3 text-sm outline-none transition focus:border-purple-500 focus:ring-2 focus:ring-purple-200"}),(0,r.jsxs)("select",{value:g,onChange:e=>v(e.target.value),disabled:0===t.roles.length,className:"h-11 rounded-xl border border-slate-300 bg-white px-3 text-sm outline-none transition focus:border-purple-500 focus:ring-2 focus:ring-purple-200 disabled:bg-slate-100",children:[(0,r.jsx)("option",{value:"",disabled:!0,children:"Seleccionar rol"}),t.roles.map(e=>(0,r.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,r.jsxs)("button",{type:"submit",disabled:c||!g||0===t.roles.length,className:"inline-flex h-11 items-center justify-center gap-2 rounded-xl bg-purple-700 px-4 text-sm font-semibold text-white transition hover:bg-purple-800 disabled:cursor-not-allowed disabled:opacity-40",children:[(0,r.jsx)(o.Z,{size:18}),"Asignar"]})]})]}),(0,r.jsxs)("section",{className:"overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 border-b border-slate-100 px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-sm font-bold text-slate-900",children:"Usuarios de la organizaci\xf3n"}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-slate-500",children:[S.length," de ",t.users.length," usuarios con roles organizacionales."]})]}),(0,r.jsxs)("div",{className:"relative w-full sm:max-w-xs",children:[(0,r.jsx)(d.Z,{size:17,className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,r.jsx)("input",{type:"search",value:b,onChange:e=>j(e.target.value),placeholder:"Buscar usuario o rol...",className:"h-10 w-full rounded-xl border border-slate-300 bg-white pl-10 pr-3 text-sm outline-none transition focus:border-purple-500 focus:ring-2 focus:ring-purple-200"})]})]}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"min-w-full divide-y divide-slate-200 text-sm",children:[(0,r.jsx)("thead",{className:"bg-slate-50",children:(0,r.jsxs)("tr",{className:"text-left text-xs font-semibold uppercase tracking-wide text-slate-500",children:[(0,r.jsx)("th",{className:"px-4 py-3",children:"Usuario"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Estado"}),(0,r.jsx)("th",{className:"px-4 py-3",children:"Roles en organizaci\xf3n"})]})}),(0,r.jsxs)("tbody",{className:"divide-y divide-slate-100 bg-white",children:[S.map(e=>{var a;
1let l=e.shortname||[e.firstname,e.lastname].filter(Boolean).join(" ")||e.name||"-";return(0,r.jsxs)("tr",{className:"transition hover:bg-slate-50/70",children:[(0,r.jsxs)("td",{className:"px-4 py-3",children:[(0,r.jsx)("div",{className:"font-semibold text-slate-900",children:l}),(0,r.jsx)("div",{className:"text-xs text-slate-500",children:null!==(a=e.email)&&void 0!==a?a:"Sin email"})]}),(0,r.jsx)("td",{className:"px-4 py-3",children:(0,r.jsx)("span",{className:["inline-flex rounded-full px-2.5 py-1 text-xs font-semibold",e.isActive?"bg-emerald-50 text-emerald-700":"bg-slate-100 text-slate-600"].join(" "),children:e.isActive?"Activo":"Inactivo"})}),(0,r.jsx)("td",{className:"px-4 py-3",children:(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:e.roles.map(a=>(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-purple-100 bg-purple-50 px-2.5 py-1 text-xs font-medium text-purple-800",children:[a.name,(0,r.jsx)("button",{type:"button",disabled:c,onClick:()=>{var r,l;return r=e.id,l=a.id,void(N(""),k(""),h(async()=>{let e=await m({orgId:t.organization.id,userId:r,roleId:l});if(!e.ok){N(e.error);return}k("Rol removido correctamente."),s.refresh()}))},title:"Quitar rol",className:"rounded-full p-0.5 text-purple-400 transition hover:bg-red-50 hover:text-red-600 disabled:opacity-40",children:(0,r.jsx)(u.Z,{size:14})})]},a.id))})})]},e.id)}),0===S.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:3,className:"px-4 py-12 text-center text-sm text-slate-500",children:"No hay usuarios para mostrar."})})]})]})})]})]})}},16463:function(e,t,s){"use strict";var r=s(71169);s.o(r,"redirect")&&s.d(t,{redirect:function(){return r.redirect}}),s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}}),s.o(r,"useSelectedLayoutSegments")&&s.d(t,{useSelectedLayoutSegments:function(){return r.useSelectedLayoutSegments}})},58064:function(e,t,s){"use strict";Object.defineProperty(t,"$",{enumerable:!0,get:function(){return a}});let r=s(74590);function a(e){let{createServerReference:t}=s(6671);return t(e,r.callServer)}},55487:function(e,t,s){"use strict";s.d(t,{Z:function(){return l}});var r=s(2265),a={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/** 2 * @license @tabler/icons-react v3.34.1 - MIT 3 * 4 * This source code is licensed under the MIT license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let l=(e,t,s,l)=>{let n=(0,r.forwardRef)((s,n)=>{let{color:i="currentColor",size:o=24,stroke:d=2,title:u,className:c,children:m,...x}=s;return(0,r.createElement)("svg",{ref:n,...a[e],width:o,height:o,className:["tabler-icon","tabler-icon-".concat(t),c].join(" "),..."filled"===e?{fill:i}:{strokeWidth:d,stroke:i},...x},[u&&(0,r.createElement)("title",{key:"svg-title"},u),...l.map(e=>{let[t,s]=e;return(0,r.createElement)(t,s)}),...Array.isArray(m)?m:[m]])});return n.displayName="".concat(s),n}},14418:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(55487).Z)("outline","alert-triangle","AlertTriangle",[["path",{d:"M12 9v4",key:"svg-0"}],["path",{d:"M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]])},65251:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(55487).Z)("outline","plus","Plus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]])},60912:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(55487).Z)("outline","search","Search",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]])},86366:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(55487).Z)("outline","trash","Trash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]])},57357:function(e,t,s){"use strict";s.d(t,{Z:function(){return r}});let r=(0,s(55487).Z)("outline","users","Users",[["path",{d:"M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"svg-2"}],["path",{d:"M21 21v-2a4 4 0 0 0 -3 -3.85",key:"svg-3"}]])}},function(e){e.O(0,[2971,7023,1744],function(){return e(e.s=46693)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.