PageSourceSearch

https://app.praefy.com/assets/EmployeeView.c3143fed.js

js praefy.com collected 2026-10-06 19:06:57 UTC 4,974 bytes, 1 lines download raw bytes

1import{e as j,i as z,f as F,q as G,r as H,x as V,y as L,A as q,B as J,C as y,E as i,_ as K,e0 as ee,T as u,U as B,aP as ae,e2 as se,e3 as le,e1 as oe,o as w,V as a,X as te,Y as e,Z as ie,$ as U,e6 as d,a0 as $,a as c,t as p,aR as S,bp as M,bq as h,a1 as ne,b as re,eL as ue,a9 as ce,aa as me,f3 as de,ea as pe,gD as k,eQ as fe}from"./index.2b12a2d5.js";const _e={class:"grid grid-cols-1 gap-4 lg:grid-cols-2"},ge={class:"grid grid-cols-1 gap-4 lg:grid-cols-2"},be={__name:"EmployeeView",setup(Ve){const D=ee(),N=j(),m=z(),A=F(),x=G(),b=H(),o=V(()=>x.getViewTranslations("employee")).value,O="add",C=o.updateButton,I=o.addButton,T=L(!1),_=L([]),v=D.params.id;let P="",l="";const f=q(m.getPermissions),E=V(()=>b.getOffices),R=E.value.reduce((n,s)=>(n[s.name]=s.name,n),{});v==O?(l=q(m.getEmployee),P=I):(l=q(m.getEmployeeById(v)),m.fillPermissions(l),l.accesible_id_offices.length>0&&(_.value=l.accesible_id_offices.map(n=>b.getOfficeById(n).name)),P=C);const r=V(()=>A.getValidationsMessages),W=V(()=>A.getCustomRegexValidators),Q=V(()=>Z()),g=J(Q,l),X=async n=>{g.value.$validate(),g.value.$error||(T.value=!0,_.value&&(n.accesible_id_offices=Y(_.value)),v==O?(n.company=N.getEmployeeCompany,n.office=b.getCurrentOffice.id,await m.createEmployee(n)):(await m.setPermissions(),await m.updateEmployee(n)),T.value=!1)};function Y(n){return Object.values(n).map(s=>b.getOfficeByName(s).id)}function Z(){return{name:{required:u.withMessage(r.value.required,B),alphaNumericWithSpacesAndSimbols:u.withMessage(r.value.alphaNumericWithSpacesAndSimbols,W.value.alphaNumericWithSpacesAndSimbols)},email:{required:u.withMessage(r.value.required,B),email:u.withMessage(r.value.email,ae)},phone:{required:u.withMessage(r.value.required,B),numeric:u.withMessage(r.value.numeric,se),minLength:u.withMessage(r.value.internationalPhone,le(9)),maxLength:u.withMessage(r.value.internationalPhone,oe(17))}}}return(n,s)=>(w(),y(K,null,{default:i(()=>[a(me,null,{default:i(()=>[a(te,{icon:e(de),title:e(o).viewTitle,main:""},{default:i(()=>[a(ie,{to:"/users",label:"Volver",icon:e(pe),color:"info","rounded-full":"",small:""},null,8,["icon"])]),_:1},8,["icon","title"]),a(U,null,{default:i(()=>[e(v)==O?(w(),y(d,{key:0},{default:i(()=>[a($,{modelValue:e(l).name,"onUpdate:modelValue":s[0]||(s[0]=t=>e(l).name=t),error:e(g).name.$errors,placeholder:e(o).name},null,8,["modelValue","error","placeholder"]),a($,{modelValue:e(l).email,"onUpdate:modelValue":s[1]||(s[1]=t=>e(l).email=t),error:e(g).email.$errors,placeholder:e(o).email},null,8,["modelValue","error","placeholder"]),a($,{modelValue:e(l).phone,"onUpdate:modelValue":s[2]||(s[2]=t=>e(l).phone=t),error:e(g).phone.$errors,placeholder:e(o).phone},null,8,["modelValue","error","placeholder"])]),_:1})):(w(),y(d,{key:1},{default:i(()=>[c("p",null,[c("b",null,p(e(o).name)+": ",1),S(" "+p(e(l).name),1)]),c("p",null,[c("b",null,p(e(o).email)+": ",1),S(" "+p(e(l).email),1)]),c("p",null,[c("b",null,p(e(o).phone)+": ",1),S(" "+p(e(l).phone),1)])]),_:1}))]),_:1}),a(U,{class:"mt-5"},{default:i(()=>[a(M,{title:e(o).usersPermsTitle,class:"mb-12"},null,8,["title"]),c("div",_e,[a(d,{label:e(o).propertiesOthersperms},{default:i(()=>[a(h,{modelValue:f.Property[0],"onUpdate:modelValue":s[3]||(s[3]=t=>f.Property[0]=t),type:"radio",options:e(k).property,"component-class":"check-radio-success"},null,8,["modelValue","options"])]),_:1},8,["label"]),a(d,{label:e(o).contactsDemandsothersperms},{default:i(()=>[a(h,{modelValue:f.Contact[0],"onUpdate:modelValue":s[4]||(s[4]=t=>f.Contact[0]=t),type:"radio",options:e(k).contact,"component-class":"check-radio-success"},null,8,["modelValue","options"])]),_:1},8,["label"]),a(d,{label:e(o).tasksOthersperms},{default:i(()=>[a(h,{modelValue:f.Task[0],"onUpdate:modelValue":s[5]||(s[5]=t=>f.Task[0]=t),type:"radio",options:e(k).task,"component-class":"check-radio-success"},null,8,["modelValue","options"])]),_:1},8,["label"])]),a(ne),e(E).length>0?(w(),y(d,{key:0,label:"Permisos aplicables en","wrap-body":""},{default:i(()=>[a(h,{modelValue:_.value,"onUpdate:modelValue":s[6]||(s[6]=t=>_.value=t),name:"offices-checkbox",options:e(R),"no-empty-value":"","component-class":"check-radio-success"},null,8,["modelValue","options"])]),_:1})):re("",!0),a(ue,{color:"warning",class:"mt-8",icon:e(fe),outline:"true"},{default:i(()=>[S(p(e(o).permsWarning),1)]),_:1},8,["icon"])]),_:1}),a(U,{class:"mt-5"},{default:i(()=>[a(M,{title:e(o).otherPermissionsTitle,class:"mb-6"},null,8,["title"]),c("div",ge,[a(d,{label:e(o).hasPraefyAcquisition},{default:i(()=>[a(h,{modelValue:e(l).has_praefy_acquisition,"onUpdate:modelValue":s[7]||(s[7]=t=>e(l).has_praefy_acquisition=t),type:"switch",options:e(k).acquisition,"component-class":"check-radio-success"},null,8,["modelValue","options"])]),_:1},8,["label"])])]),_:1}),a($,{class:"mt-4","button-label":e(P),"button-color":"info",onClick:s[8]||(s[8]=t=>X(e(l)))},null,8,["button-label"]),a(ce,{active:T.value},null,8,["active"])]),_:1})]),_:1}))}};export{be as default};

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.