import{r as o,h as r,H as e}from"./p-d55626d1.js";import{c as m}from"./p-2fd22ed9.js";import"./p-0bc4f624.js";import"./p-9bfc48ee.js";import"./p-097729d8.js";import{a}from"./p-c1c5b589.js";import{s as t}from"./p-62c3d279.js";import{b as s}from"./p-c7f96882.js";import{u as i}from"./p-716f6fe3.js";const l=class{constructor(r){o(this,r),this.error=!1,this.user=null,this.userRoles=[{key:"admin",value:"admin"},{key:"user",value:"user"}]}async formEventHandler({detail:o}){console.log("sendForm",o);const r={};Object.keys(o).map((e=>{r[e]=o[e].value})),await m.client.mutate({mutation:t(s),variables:{id:this.formId,userInput:r}})}async queryData(){const o=await m.client.query({query:t(i),variables:{id:this.formId}});o.data.userById&&(this.user=o.data.userById,this.userRoles.map((o=>{this.user.role.map((r=>{o.key===r&&(o.selected=!0)}))})))}async componentWillRender(){a.identity&&await this.queryData()}render(){return r(e,null,a.identity?r("corejam-box",{p:8,rounded:"md",bWidth:1,bColor:"gray-200",max:"md",mx:"auto",px:4,lgPx:0,flex:!0,justify:"between",mb:24},r("corejam-box",{w:"5",mx:"auto"},r("corejam-box",{pb:4,mb:8,bWidthBottom:1,bColor:"gray-400"},r("corejam-type",{as:"h2",size:"xl"},"User Edit")),r("corejam-form-container",{name:"userForm"},r("corejam-box",null,r("corejam-box",null,r("corejam-form-input",{name:"email",type:"text",formId:"userForm",value:this.user.email,label:"Email"})),r("corejam-box",null,r("corejam-form-input",{name:"active",type:"checkbox",formId:"userForm",label:"Active",checked:this.user.active})),r("corejam-box",null,r("corejam-form-select",{name:"roles",options:this.userRoles,multiple:!0,formId:"userForm"})),r("corejam-box",null,r("corejam-form-input",{name:"password",type:"password",formId:"userForm",label:"Password"})),r("corejam-box",null,r("corejam-form-submit",{formId:"userForm"},r("button",{type:"submit"},"Edit"))))))):null)}};export{l as auth_admin_user_form}