1import{B as j,a as W}from"./w6LzkVB9.js";import{b2 as N,b1 as B,aW as M,b8 as l,bl as $,be as e,bb as r,bf as a,ba as o,bc as f,bd as s,fD as H,dL as Q,b9 as h,bj as q,bk as R,aU as A,bt as x,bu as X,bm as Y,bh as Z,c4 as ee,bq as E,bs as te,bg as T,bi as O,eS as ae,eT as oe,b4 as ne,eV as re,eE as se,c7 as ie,c0 as le,bD as ue,bp as ce,bn as D,f8 as me,cE as de}from"./szcXUDxO.js";import{_ as F}from"./D9wjDhk-.js";import{w as pe}from"./gsQmYL8-.js";import{l as fe,b as _e,i as ge,u as ve,r as be}from"./B9ioR0Ey.js";import{_ as he}from"./s2YtejdB.js";import{_ as L}from"./CBWkCLve.js";import{D as ze}from"./DI4YRGOI.js";import{_ as we}from"./BvPUNUzI.js";import{_ as ye}from"./CvQZxOE_.js";import{_ as $e}from"./DKAXJNwN.js";import{r as xe}from"./BuLz0Nwm.js";import{a as Oe}from"./JZyINr7C.js";import{S as Se}from"./qgvxzavr.js";import{c as Ce}from"./CxL9z_sY.js";import"./DkBByVkp.js";import"./CbzZngf6.js";import"./BdAdJOS2.js";import"./BQ8Q5Wmx.js";import"./Bm92f-5u.js";import"./CxIZtCgj.js";import"./xa67PyFm.js";import"./Bu6mFo6t.js";import"./B3Ccnh5Q.js";import"./D65RwsWk.js";import"./RxKU0bsn.js";import"./kVV428Hw.js";import"./Cb0PnI2E.js";import"./DyUAU4Io.js";import"./BKLWHK6E.js";import"./3HtORDs0.js";import"./COGHe4ZY.js";import"./D9UOlKaQ.js";import"./vjNz0Kjj.js";import"./BTGXXOaW.js";import"./ClP5St4K.js";import"./Gc_2MR4g.js";import"./DPUTChqd.js";import"./CzT8EFJ-.js";import"./DfxzkHXw.js";import"./D9m04HH5.js";import"./Bw7_0Fdy.js";import"./SLFGBvS_.js";import"./DzsCG8Kb.js";import"./BvCWwLts.js";import"./0a7geFEE.js";import"./Cu2Br0G0.js";import"./CE1G-McA.js";const ke={class:"fr-search-bar flex-wrap"},Te=["onMousedown"],Ne={class:"font-bold"},Ve=N({__name:"Search",setup(i){const{t:n}=B(),g=A(),u=x(""),{$api:z}=M(),m=x([]);async function S(){try{const _=await z("/api/1/organizations/suggest/",{params:{q:u.value,size:50}});m.value=_}catch{ee.error(n("Une erreur s'est produite lors de la mise à jour des options."))}}async function C(_){await E(`/organizations/${_}`)}return pe(u,async(_,p)=>{_!==p&&await S()},{debounce:300}),(_,p)=>{const w=Z;return l(),$(e(fe),{as:"div",class:"flex-1 relative"},{default:r(({activeOption:y})=>[a("div",ke,[o(e(_e),{class:"fr-label"},{default:r(()=>[f(s(e(n)("Rechercher des données")),1)]),_:1}),o(e(H),{class:"absolute text-base top-3 left-2",size:"16","aria-hidden":"true"}),o(e(ge),{class:"fr-input fr-col-12 !pl-8",placeholder:e(n)("Rechercher une organisation sur {platform}",{platform:e(g).public.title}),autocomplete:"off","data-cy":"search-input",name:"q",onKeydown:Q(t=>C(y.slug),["enter"]),onChange:p[0]||(p[0]=t=>u.value=t.target.value)},null,8,["placeholder","onKeydown"])]),o(e(ve),{class:"absolute w-full mt-2 max-h-60 overflow-auto bg-white py-1 drop-shadow rounded-b p-0"},{default:r(()=>[(l(!0),h(q,null,R(m.value,t=>(l(),$(e(be),{key:t.id,class:"marker:hidden p-0",value:t},{default:r(({active:v})=>[a("div",{class:Y(["relative flex items-center py-2 fr-enlarge-link border-neutral-200 border-b",{"bg-indigo-100 outline outline-primary outline-offset-[-2px]":v}]),onMousedown:X(b=>C(t.slug),["left"])},[o(e(F),{organization:t,class:"flex-none mx-2","size-class":"size-8"},null,8,["organization"]),o(w,{class:"flex-1",to:`/organizations/${t.slug}`},{default:r(()=>[a("span",Ne,s(t.name),1)]),_:2},1032,["to"])],42,Te)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})}}}),je=Object.assign(te(Ve,[["__scopeId","data-v-d4fbc7fd"]]),{__name:"OrganizationSearch"}),De={class:"flex items-start md:flex-wrap"},Be={class:"fr-col-12 flex items-start relative"},Me={class:"fr-col-12 fr-col-lg-8"},qe={class:"fr-col-12 fr-col-lg-4 ml-auto"},Re={class:"flex items-center md:flex-wrap"},Ae={class:"flex-1 text-center ml-3v m-0"},Ee={class:"flex-1 ml-3v m-0"},Fe=N({__name:"Step1CreateOrJoinOrganization",emits:["start"],setup(i){const{t:n}=B();return(g,u)=>{const z=je,m=he;return l(),h("div",De,[o(e(L),{class:"mb-6"},{default:r(()=>[o(m,{"actions-alignment":"center",title:e(n)("Rejoindre une organisation"),content:e(n)("Une organisation est une entité dans laquelle les utilisateurs peuvent collaborer. Les jeux de données publiés dans une organisation peuvent être édités par ses membres."),icon:"/illustrations/organization.svg","stretch-height":!0},{actions:r(()=>[a("div",Be,[a("div",Me,[o(z)]),a("div",qe,[a("div",Re,[a("p",Ae,s(e(n)("ou")),1),a("div",Ee,[o(e(T),{color:"primary",onClick:u[0]||(u[0]=S=>g.$emit("start"))},{default:r(()=>[f(s(e(n)("Créer une organisation")),1)]),_:1})])])])])]),_:1},8,["title","content"])]),_:1})])}}}),Le=Object.assign(Fe,{__name:"OrganizationNewStep1CreateOrJoinOrganization"}),Ue=ae(oe),Ie={class:"flex flex-wrap gap-3"},Je={class:"flex-1"},Pe={class:"m-0 font-bold"},Ke={class:"m-0 text-xs"},Ge={class:"my-6 p-6 !border border-neutral-200 fr-enlarge-link"}
1,We={class:"fr-grid-row fr-grid-row--gutters fr-grid-row--top"},He={class:"fr-col-auto"},Qe={class:"fr-col"},Xe={class:"fr-mb-1v fr-grid-row"},Ye=["href"],Ze={key:0},et={class:"fr-grid-row fr-grid-row--right gap-3"},tt={key:0},at={key:1},ot=N({__name:"Step3CompleteTheOrganization",props:{organization:{},errors:{}},setup(i){return(n,g)=>{const u=Ue,z=we;return l(),$(e(L),null,{default:r(()=>[o(e($e),{type:"primary",class:"-mb-3"},{default:r(()=>[a("div",Ie,[g[0]||(g[0]=a("div",{class:"flex-none"},[a("img",{src:ye,width:"50",loading:"lazy",alt:""})],-1)),a("div",Je,[a("p",Pe,s(n.$t("Votre organisation a été créée !")),1),a("p",Ke,s(n.$t("Vous pouvez maintenant publier du contenu ou inviter des membres à rejoindre votre organisation.")),1)])])]),_:1}),a("article",Ge,[a("div",We,[a("div",He,[o(e(F),{organization:i.organization,"size-class":"size-16"},null,8,["organization"])]),a("div",Qe,[a("h4",Xe,[a("a",{href:i.organization.page,class:"text-gray-title"},[f(s(i.organization.name)+" ",1),i.organization.acronym?(l(),h("small",Ze,s(i.organization.acronym),1)):O("",!0)],8,Ye)]),o(u,{class:"fr-mt-1w fr-mb-2w fr-hidden fr-unhidden-sm overflow-wrap-anywhere","auto-resize":!0,text:e(xe)(i.organization.description),"max-lines":2},null,8,["text"])])])]),a("div",et,[o(e(T),{color:"secondary",href:`/admin/organizations/${i.organization.id}/profile`},{default:r(()=>[f(s(n.$t("Gérer lâorganisation")),1)]),_:1},8,["href"]),o(e(T),{href:"/admin/reuses/new",color:"primary"},{default:r(()=>[f(s(n.$t("Publiez une réutilisation")),1)]),_:1}),o(e(T),{href:"/admin/datasets/new",color:"primary"},{default:r(()=>[f(s(n.$t("Publier un jeu de données")),1)]),_:1})]),i.errors?.length?(l(),$(z,{key:0,type:"error",class:"fr-mt-2w fr-mb-2w"},{title:r(()=>[f(s(n.$t("Une erreur est survenue | Des erreurs sont survenues",i.errors.length)),1)]),default:r(()=>[i.errors.length>1?(l(),h("ul",tt,[(l(!0),h(q,null,R(i.errors,m=>(l(),h("li",{key:m},s(m),1))),128))])):(l(),h("p",at,s(i.errors[0]),1))]),_:1})):O("",!0)]),_:1})}}}),nt=Object.assign(ot,{__name:"OrganizationNewStep3CompleteTheOrganization"}),Zt=N({__name:"new",setup(i){const{t:n}=B(),g=A(),u=ne(),{$api:z}=M(),{organizations:m,setCurrentOrganization:S}=re(),C=se(),_=D(()=>[n("Créer ou rejoindre une organisation sur {site}",{site:g.public.title}),n("Décrivez votre organisation"),n("Finaliser votre organisation")]),p=x({name:"",acronym:"",business_number_id:"",description:"",url:"",logo:""}),w=x(!1),y=x([]),t=ie("new-organization",()=>null),v=x(!1),b=D(()=>parseInt(u.query.step)||1),U=D(()=>!(b.value<1||b.value>_.value.length));function k(c){me(u,{...u.query,step:c})}async function I(c){y.value=[],w.value=!1;try{v.value=!0,t.value=await z("/api/1/organizations/",{method:"POST",body:JSON.stringify({...p.value,business_number_id:Ce(p.value.business_number_id)})}),m.value[t.value.id]={...t.value,class:"Organization"},S(m.value[t.value.id]),w.value=!0}catch(d){d instanceof Error&&y.value.push(d.message)}finally{v.value=!1}if(c&&t.value)try{v.value=!0;const d=await Oe(t.value.id,c);t.value.logo_thumbnail=d.image}catch{y.value.push(n("Impossible de téléverser le logo, vous pouvez le téléverser à nouveau dans votre panneau d'administration"))}finally{v.value=!1}w.value&&(de(C),await k(3),w.value=!1)}return le(()=>{U.value||k(1)}),ue(b,c=>{c===1&&(t.value=null),t.value?.id&&t.value.id in m.value&&!w.value&&!v.value&&c<3&&E(`/admin/organizations/${t.value.id}/profile`,{replace:!0})},{immediate:!0}),(c,d)=>{const J=W,P=Le,K=ze,G=nt;return l(),h("div",null,[o(J,null,{default:r(()=>[o(j,{to:"/"},{default:r(()=>[f(s(c.$t("Accueil")),1)]),_:1}),o(j,{to:"/organizations"},{default:r(()=>[f(s(c.$t("Organisations")),1)]),_:1}),o(j,null,{default:r(()=>[f(s(c.$t("Formulaire de publication")),1)]),_:1})]),_:1}),o(Se,{steps:e(_),"current-step":e(b)},null,8,["steps","current-step"]),e(b)===1?(l(),$(P,{key:0,onStart:d[0]||(d[0]=V=>k(2))})):O("",!0),e(b)===2?(l(),$(K,{key:1,modelValue:e(p),"onUpdate:modelValue":d[1]||(d[1]=V=>ce(p)?p.value=V:null),type:"create","submit-label":c.$t("Créer l'organisation"),errors:e(y),loading:e(v),onPrevious:d[2]||(d[2]=V=>k(1)),onSubmit:I},null,8,["modelValue","submit-label","errors","loading"])):O("",!0),e(b)===3&&e(t)?(l(),$(G,{key:2,organization:e(t),errors:e(y)},null,8,["organization","errors"])):O("",!0)])}}});
1export{Zt 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.