1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="39cf9db3-c584-562d-92b1-2b4a98a1bb2b")}catch(e){}}(); 3import{s as Z}from"./index-Dr_HB0ri.js";import{s as ee}from"./index-Bq3pQ7HC.js";import{s as te}from"./index-8E-BRJRm.js";import{s as ae}from"./index-DjyK5_pe.js";import{s as le}from"./index-CVBWxi4R.js";import{s as ie}from"./index-uZZ866yL.js";import{s as se}from"./index-D_7lm_C2.js";import{s as oe}from"./index-DhAuHHpt.js";import{_ as re}from"./CollapsiblePanel-B_uow1XW.js";import{_ as ne}from"./LM_Dialog-CqMpHu0d.js";import{_ as de}from"./SettingToggle-D1p5I7EY.js";import{p as ue,q as me,v as _,h as F,I as z,i as ce,H as pe,g as w,w as c,o as P,b as i,a as s,t as v,d as n,m as q,e as H,z as V,c as ve}from"./app-D8smhW-8.js";import{m as fe,a as _e,b as ge,c as be}from"./index.esm-DhaoWu9u.js";import"./index-CvJX-ygu.js";import"./index-DcVJZHr1.js";import"./index-CgUgeut3.js";import"./index-BRwx-sw_.js";import"./index-B7nDuGmM.js";import"./index-BivIgIpV.js";import"./index-C-AIgEhS.js";import"./index-BhkXLnVr.js";import"./index-BbX67C3c.js";import"./index-B22Lm7PL.js";import"./index-BPyQoOEd.js";import"./index-Buugz4Bf.js";import"./index-CLl6RUan.js";import"./index-DjySesLs.js";import"./index-BfSkpXat.js";import"./index-BMhTkYOg.js";import"./index-DJMsScdq.js";import"./index-Dd1zjV7H.js";import"./index-BPTirxP1.js";import"./index-CQU6wxO-.js";import"./index-B93c5Z8a.js";import"./_plugin-vue_export-helper-Cr6OieEI.js";import"./index-CMMD-5f-.js";(function(){try{var u=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};u.SENTRY_RELEASE={id:"ce5f413906e32e862b2b7b1bcfc6ea1090bec070"}}catch{}})();try{(function(){var u=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},g=new u.Error().stack;g&&(u._sentryDebugIds=u._sentryDebugIds||{},u._sentryDebugIds[g]="2ed9a838-0b84-41e4-a213-c3a908d92462",u._sentryDebugIdIdentifier="sentry-dbid-2ed9a838-0b84-41e4-a213-c3a908d92462")})()}catch{}const ye={class:"flex flex-col gap-4"},Ue={class:"flex flex-col gap-2"},Pe={for:"editUserName"},he={class:"flex flex-col gap-2"},xe={for:"editUserEmail"},Fe={class:"flex flex-col gap-2"},we={for:"editUserRoles"},Ee={key:0,class:"text-xs text-surface-400"},Ae={class:"grid grid-cols-2 gap-3"},Se={class:"flex flex-col gap-1"},Ve={class:"text-xs text-surface-500 dark:text-surface-400"},De={class:"flex flex-col gap-1"},Oe={class:"text-xs text-surface-500 dark:text-surface-400"},ke={class:"flex justify-end gap-2"},ft={__name:"UserSettingsEditUser",props:{visibleEditUserModal:{type:Boolean,default:!1},userObject:{type:Object,default:null}},emits:["update:visibleEditUserModal","submit"],setup(u,{emit:g}){var j,T,I;const{t:a}=ue(),E=me(),p=u,D=g,b=_(!1),y=_(((j=p.userObject)==null?void 0:j.active)??!0),o=_(null),d=_(null),A=_(!((T=p.userObject)!=null&&T.active_from||(I=p.userObject)!=null&&I.active_until)),O=F(()=>{if(!o.value&&!d.value)return null;const e=t=>{if(!t)return"â¦";const r=t instanceof Date?t:new Date(t);return`${String(r.getDate()).padStart(2,"0")}.${String(r.getMonth()+1).padStart(2,"0")}.${r.getFullYear()}`};return`${e(o.value)} â ${e(d.value)}`});function Y(){const e=new Date,t=!o.value||e>=o.value,r=!d.value||e<=d.value;y.value=t&&r}z([o,d],()=>{(o.value||d.value)&&Y()});const h=F({get:()=>p.visibleEditUserModal,set:e=>D("update:visibleEditUserModal",e)}),k=ce(),G=F(()=>(k.props.clientRoles??[]).filter(e=>{var t;return e.slug!==((t=S.value)==null?void 0:t.locode)+"-public"})),S=F(()=>k.props.client),B=_({name:"",role_ids:[],active:!0});z(()=>p.userObject,e=>{B.value={name:(e==null?void 0:e.name)??"",role_ids:((e==null?void 0:e.roles)??[]).map(t=>t.id)},y.value=(e==null?void 0:e.active)??!0,o.value=e!=null&&e.active_from?new Date(e.active_from):null,d.value=e!=null&&e.active_until?new Date(e.active_until):null,A.value=!(e!=null&&e.active_from||e!=null&&e.active_until)},{immediate:!0});const J=fe(_e().shape({name:be().required(a("superAdminPage.userPage.editUserForm.nameErrorMessage")),role_ids:ge().min(1,a("superAdminPage.userPage.newUserForm.roleRequiredError")).required()})),f=pe({name:"",clients_roles:[],active:!0,active_from:null,active_until:null});function K({valid:e,values:t}){if(b.value=!0,!e){E.add({severity:"error",summary:a("superAdminPage.userPage.editUserForm.formErrorMessage"),life:5e3}),b.value=!1;return}f.name=t.name,f.active=y.value,f.active_from=o.value?o.value.toISOString():null,f.active_until=d.value?d.value.toISOString():null,f.clients_roles=(t.role_ids??[]).map(r=>({client:S.value.id,role:r})),f.put(route("client.admin.users.update",{client:S.value.locode,id:p.userObject.id}),{headers:{Accept:"application/json"},onSuccess:()=>{E.add({severity:"success",summary:a("superAdminPage.userPage.editUserForm.userEditedMessage"),life:5e3}),h.value=!1,b.value=!1,D("submit")},onError:r=>{Object.values(r).forEach(x=>{E.add({severity:"error",summary:x,life:8e3})}),b.value=!1}})}return(e,t)=>{const r=oe,x=se,M=ie,Q=le,L=ae,W=te,X=ee,R=Z;return P(),w(ne,{visible:h.value,"onUpdate:visible":t[5]||(t[5]=U=>h.value=U),modal:"",header:i(a)("superAdminPage.userPage.editUserForm.changeUserHeader"),width:40,breakpoints:{"1199px":"40rem","575p
3x":"90vw"}},{footer:c(()=>[n(X),s("div",ke,[n(R,{label:i(a)("superAdminPage.userPage.buttons.cancelButton"),variant:"outlined",onClick:t[4]||(t[4]=U=>h.value=!1)},null,8,["label"]),n(R,{form:"clientEditUserForm",label:i(a)("superAdminPage.userPage.buttons.saveUserChangesButton"),loading:b.value,type:"submit"},null,8,["label","loading"])])]),default:c(()=>{var U;return[(P(),w(W,{id:"clientEditUserForm",key:(U=p.userObject)==null?void 0:U.id,"initial-values":B.value,resolver:i(J),validateOnValueUpdate:!0,validateOnBlur:!0,validateOnSubmit:!0,onSubmit:K},{default:c(m=>{var C,N,$;return[s("div",ye,[s("div",Ue,[s("label",Pe,v(i(a)("superAdminPage.userPage.editUserForm.nameLabel")),1),n(x,{name:"name"},{default:c(l=>[n(r,q({id:"editUserName"},l.props,{fluid:""}),null,16)]),_:1}),(C=m==null?void 0:m.name)!=null&&C.error?(P(),w(M,{key:0,size:"small",severity:"error",variant:"simple"},{default:c(()=>[H(v(m.name.error.message),1)]),_:2},1024)):V("",!0)]),s("div",he,[s("label",xe,v(i(a)("superAdminPage.userPage.editUserForm.emailLabel")),1),n(r,{id:"editUserEmail",value:((N=p.userObject)==null?void 0:N.email)??"",fluid:"",disabled:""},null,8,["value"])]),s("div",Fe,[s("label",we,v(i(a)("superAdminPage.userPage.headerColumns.role")),1),n(x,{name:"role_ids"},{default:c(l=>[n(Q,q({id:"editUserRoles"},l.props,{options:G.value,optionValue:"id",optionLabel:"name_is",placeholder:i(a)("superAdminPage.userPage.newUserForm.chooseClientRoleLabel"),display:"chip",fluid:""}),null,16,["options","placeholder"])]),_:1}),($=m==null?void 0:m.role_ids)!=null&&$.error?(P(),w(M,{key:0,size:"small",severity:"error",variant:"simple"},{default:c(()=>{var l;return[H(v(((l=m.role_ids.error)==null?void 0:l.message)??m.role_ids.error),1)]}),_:2},1024)):V("",!0)]),n(re,{collapsed:A.value,"onUpdate:collapsed":t[2]||(t[2]=l=>A.value=l),label:i(a)("superAdminPage.userPage.editUserForm.activeTimeframeLabel")},{summary:c(()=>[O.value?(P(),ve("span",Ee,v(O.value),1)):V("",!0)]),default:c(()=>[s("div",Ae,[s("div",Se,[s("span",Ve,v(i(a)("superAdminPage.userPage.editUserForm.activeFromLabel")),1),n(L,{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=l=>o.value=l),showTime:"",hourFormat:"24",fluid:"",size:"small",dateFormat:"dd/mm/yy",showButtonBar:""},null,8,["modelValue"])]),s("div",De,[s("span",Oe,v(i(a)("superAdminPage.userPage.editUserForm.activeUntilLabel")),1),n(L,{modelValue:d.value,"onUpdate:modelValue":t[1]||(t[1]=l=>d.value=l),showTime:"",hourFormat:"24",fluid:"",size:"small",dateFormat:"dd/mm/yy",showButtonBar:"",minDate:o.value??void 0},null,8,["modelValue","minDate"])])])]),_:1},8,["collapsed","label"]),n(de,{modelValue:y.value,"onUpdate:modelValue":t[3]||(t[3]=l=>y.value=l),title:i(a)("superAdminPage.userPage.editUserForm.enabledLabel"),description:i(a)("superAdminPage.userPage.editUserForm.enabledInfo")},null,8,["modelValue","title","description"])])]}),_:1},8,["initial-values","resolver"]))]}),_:1},8,["visible","header"])}}};export{ft as default}; 4 5//# debugId=39cf9db3-c584-562d-92b1-2b4a98a1bb2b
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.