(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[550],{5307:function(e,t,n){Promise.resolve().then(n.bind(n,7530))},7530:function(e,t,n){"use strict";n.r(t);var r=n(7437);n(146);var s=n(2265);t.default=e=>{let{roles:t}=e,[n,i]=(0,s.useState)(null),[o,c]=(0,s.useState)({title:"",description:"",permissions:""});console.log(t);let l=(e,t)=>{i(e),c(t)};console.log(o);let a=async e=>{try{i(null)}catch(e){notify("error","Failed to update admin: ".concat(e.message))}},d=(e,t)=>{c(n=>({...n,[e]:t}))};return(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full",children:[(0,r.jsx)("thead",{className:"bg-gray-100",children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{className:"text-left p-4",children:"Title"}),(0,r.jsx)("th",{className:"text-left p-4",children:"Permissions"}),(0,r.jsx)("th",{className:"text-left p-4",children:"Description"}),(0,r.jsx)("th",{className:"text-left p-4",children:"Actions"})]})}),(0,r.jsx)("tbody",{children:null==t?void 0:t.map((e,s)=>s===n?(0,r.jsxs)("tr",{className:"border-t",children:[(0,r.jsx)("td",{className:"p-4",children:(0,r.jsx)("input",{type:"text",value:o.title,onChange:e=>d("title",e.target.value),className:"border p-2 rounded"})}),(0,r.jsx)("td",{className:"p-4",children:(0,r.jsx)("input",{type:"permissions",value:o.permissions,onChange:e=>d("permissions",e.target.value),className:"border p-2 rounded"})}),(0,r.jsx)("td",{className:"p-4",children:(0,r.jsxs)("select",{value:o.description,onChange:e=>d("description",e.target.value),className:"border p-2 rounded",children:[(0,r.jsx)("option",{value:o.role,children:o.role}),t.map(e=>(0,r.jsx)("option",{value:e.id,children:e.title},e.id))]})}),(0,r.jsx)("td",{className:"p-4",children:(0,r.jsx)("button",{onClick:()=>a(s),className:"bg-green-500 text-white px-4 py-1 rounded hover:bg-green-600",children:"Save"})})]},e.id):(0,r.jsxs)("tr",{className:"border-t",children:[(0,r.jsx)("td",{className:"p-4",children:e.title}),(0,r.jsx)("td",{className:"p-4",children:e.permissions}),(0,r.jsx)("td",{className:"p-4",children:e.role}),(0,r.jsx)("td",{className:"p-4",children:(0,r.jsx)("button",{onClick:()=>l(s,e),className:"bg-blue-500 text-white px-4 py-1 rounded hover:bg-blue-600",children:"Edit"})})]},e.id))})]})})}},146:function(e,t,n){"use strict";/*! js-cookie v3.0.5 | MIT */function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}n.d(t,{Z:function(){return s}});var s=function e(t,n){function s(e,s,i){if("undefined"!=typeof document){"number"==typeof(i=r({},n,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var c in i)i[c]&&(o+="; "+c,!0!==i[c]&&(o+="="+i[c].split(";")[0]));return document.cookie=e+"="+t.write(s,e)+o}}return Object.create({set:s,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},s=0;s<n.length;s++){var i=n[s].split("="),o=i.slice(1).join("=");try{var c=decodeURIComponent(i[0]);if(r[c]=t.read(o,c),e===c)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){s(e,"",r({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,r({},this.attributes,t))},withConverter:function(t){return e(r({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})}},function(e){e.O(0,[971,69,744],function(){return e(e.s=5307)}),_N_E=e.O()}]);