import{q as L,j as a,r,d as i,I as h}from"./index-76f1ce5c.js";import{T as M}from"./tabs-8bdf8fba.js";import{R as y,C as S,d as c,I as g}from"./iconBase-883829c2.js";import{D as U}from"./index-a0cf5c09.js";import{D as p}from"./person-0b52ed1d.js";import{B as E}from"./button.esm-4f236e1d.js";import"./index-31a0332c.js";import"./tooltip.esm-3f4b62d9.js";function w({intl:q}){const{messages:m}=q,D=({onSend:b,setOnSend:T,onReset:C,setOnReset:j,tab:n,active:v})=>{const[l,o]=r.useState([{name:"",instituition:"",title:"",desc:"",image:p,images:null}]),[I,z]=r.useState([]);function B(){o([{name:"",instituition:"",title:"",desc:"",image:p,images:null}]),console.log("reset",n)}function P(){console.log(l,n)}r.useEffect(()=>{C&&v&&(B(),j(!1))},[C]),r.useEffect(()=>{b&&v&&(P(),T(!1))},[b]);function R(t,e){function s(f){const u=document.getElementsByClassName(`photo-${e}-${n}`),G=n=="pt-br"||e>0?0:1,N=u[G].getElementsByClassName("dz-message");f.length>0?t.images?N[0].innerText=`A imagem "${t.images.name}" já foi carregada com sucesso!
Clique aqui para substituí-la `:N[0].innerText=`
Tipo de imagem aceita: JPEG ou PNG
`:setTimeout(()=>{z(N)},100)}s(I)}r.useEffect(()=>{l.map((t,e)=>R(t,e))},[I,l,n]);const k=t=>{const e=[...l];e.splice(t,1),o(e)},A=t=>{t.preventDefault(),o([...l,{name:"",instituition:"",title:"",desc:"",image:p,images:null}])},d=(t,e)=>{const{name:s,value:f}=t.target,u=[...l];u[e][s]=f,o(u)},$=(t,e)=>{const s=[...l];s[e].image=t,o(s)},x=(t,e)=>{const s=[...l];s[e].images=t,o(s)};return a("form",{onSubmit:A,children:a("div",{className:"contents",children:l.map((t,e)=>i("div",{className:"box",children:[i(y,{children:[a("div",{className:"col-auto miniature ml-3",children:i("div",{className:"has-float-label",children:[a("label",{children:"Imagem Parceria"}),a("img",{src:t.image,alt:"imagem de perfil"})]})}),a(S,{className:"col-dropzone",children:a(c,{children:a(U,{scrollingContainer:".parent-scroll",id:`photo-${e}`,className:`photo-${e}-${n}`,name:"photo",addImage:s=>{x(s,e),$(s.dataURL,e)},removeImage:()=>{x(null,e),$(p,e)},images:t.images})})})]}),i(y,{children:[a(c,{className:"col-12",children:i("div",{className:"has-float-label",children:[a("label",{children:a(h,{id:"admin.name"})}),a(g,{required:!0,placeholder:m["admin.name"],type:"text",name:"name",id:`name-${e}`,onChange:s=>d(s,e),value:t.name})]})}),a(c,{className:"col-12",children:i("div",{className:"has-float-label",children:[a("label",{children:a(h,{id:"admin.instituition"})}),a(g,{required:!0,placeholder:m["admin.instituition"],type:"text",name:"instituition",id:`instituition-${e}`,onChange:s=>d(s,e),value:t.instituition})]})}),a(c,{className:"col-12",children:i("div",{className:"has-float-label",children:[a("label",{children:a(h,{id:"admin.title"})}),a(g,{required:!0,placeholder:m["admin.title"],type:"text",name:"title",id:`title-${e}`,onChange:s=>d(s,e),value:t.title})]})}),a(c,{className:"col-12",children:i("div",{className:"has-float-label",children:[a("label",{children:a(h,{id:"admin.desc"})}),a(g,{required:!0,placeholder:m["admin.desc"],type:"textarea",name:"desc",id:`desc-${e}`,onChange:s=>d(s,e),value:t.desc})]})}),i(c,{className:"mb-4",children:[l.length!==1&&a(E,{icon:"pi pi-trash",className:"mr-2",label:"Excluir",onClick:()=>k(e),severity:"danger"}),l.length-1===e&&l.length<8&&a(E,{label:"Adicionar",icon:"pi pi-plus",type:"submit"})]})]})]},e))})})};return a(M,{title:m["sidebar.collaborators"],Component:D})}const X=L(w);export{X as default};
