1import{_ as X}from"./BORzugi_.js";import{_ as ee}from"./zPHJerms.js";import{k as oe,l as te,s as C,c as ae,U as R,ay as U,m as ne,v as V,a7 as se,ap as re,q as ie,Y as le,x as ce,y as ue,z as pe,d as H,aj as me,E as de,r as T,j as k,o as E,G as S,e as M,f as N,w as F,h as w,t as y,g as e,_ as ge,H as x,i as q,L as _e,M as ve,Q as D,K as fe,$ as ze,a as he,B as Oe}from"./D1bWPJow.js";import{_ as ye}from"./Dc-Xluzt.js";import{_ as Se}from"./CCGAnPTG.js";import{_ as $e}from"./Dz-azB8w.js";import{u as Ae}from"./CXpW3gHz.js";import{u as Fe}from"./C1tdHh55.js";import"./BzrCZypX.js";import"./DV4QWsYt.js";import"./anlSO-Dz.js";import"./D0a9BaZP.js";import"./xw7q0qxq.js";import"./C-EEHhkG.js";import"./wKZr9U84.js";import"./BXxHesbM.js";import"./BumuHPj7.js";import"./DfwVDTCT.js";import"./tKAeyhDQ.js";import"./doVvDju-.js";import"./CUGN6pCV.js";import"./CX4v9KGG.js";import"./CkWuY49K.js";const Ee=()=>{const{externalServerValidation:s}=oe(),t={serviceOrganizationUuids:[],isPublic:!1},l=te(C(t));return{organizationAccessSharingFormRules:ae(()=>({serviceOrganizationUuids:{externalServerValidation:s}})),organizationAccessSharingForm:l,resetForm:()=>{for(const r in l)l[r]=C(t[r])},defaultFormValues:t}},we=()=>{const{selectedOrganization:s}=R(U()),{organizationAccessSharingForm:t,organizationAccessSharingFormRules:l,resetForm:p,defaultFormValues:i}=Ee(),{v$:r,setExternalValidationResults:f,validateForm:d,resetValidation:g}=ne(t,l);return(()=>{var m,_;t.serviceOrganizationUuids=((_=(m=s.value)==null?void 0:m.serviceOrganizations)==null?void 0:_.map(c=>c.uuid))??C(i.serviceOrganizationUuids)})(),{v$:r,resetForm:p,validateForm:d,resetValidation:g,organizationAccessSharingForm:t,setExternalValidationResults:f}},G=s=>s.stopPropagation(),xe={onMousedown:G,onClick:G},Ve=(s,t)=>{var z;const{selectedOrganization:l}=R(U()),{error:p,organizations:i,onFilter:r,isSearching:f,handleLazyLoad:d,loadMoreOrganizations:g,resetOrganizationsList:a}=Fe(V(null),s,!0),m=V(Object.fromEntries((((z=l.value)==null?void 0:z.serviceOrganizations)??[]).map(o=>[o.uuid,o])));return{organizations:i,organizationsError:p,onFilter:r,isSearching:f,onShow:async()=>{var $,A,n,O,b;const o=t.value;($=o==null?void 0:o.unbindScrollListener)==null||$.call(o),(A=o==null?void 0:o.unbindResizeListener)==null||A.call(o),o&&(o.scrollHandler=null);const u=(O=(n=t.value)==null?void 0:n.$el.querySelector('[role="combobox"]'))==null?void 0:O.getAttribute("aria-controls");if(!u)return;await se(()=>!!document.getElementById(u));const h=(b=document.getElementById(u))==null?void 0:b.parentElement;if(h){s.value=h;for(const L of["wheel","scroll","mouseup"])h.addEventListener(L,()=>d())}await re(500),g()},resetOrganizationsList:a,getOrganizationChipLabel:o=>{const u=m.value[o]??i.value.find(({uuid:h})=>h===o);return u&&!m.value[o]&&(m.value[o]=u),(u==null?void 0:u.legalEntity.companyName)??o},organizationMultiSelectPanelProps:xe}},be=s=>({serviceOrganizationUuids:s.serviceOrganizationUuids}),ke=(s,t,l)=>{const{apiErrorFromCatchException:p}=ie(),{selectedOrganization:i}=R(U()),{execute:r,isLoading:f,error:d}=le("/api/organization/update"),g=V(!1),a=V(),m=async()=>{await s(),a.value=null,g.value=!0;try{const c=await r({uuid:i.value.uuid,organizationUpdateInput:be(t)},"FRAGMENT_ORGANIZATION_PAGE");i.value=C(c)}catch(c){ce(c),a.value=p(c),_()}},_=()=>{var c,z;((c=d.value)==null?void 0:c.type)==="form_validation"&&!ue((z=d.value)==null?void 0:z.errors)&&l(pe(d.value.errors))};return{save:m,error:a,isSaved:g,isLoading:f}},Ce={class:"font-medium text-md flex items-center gap-2"},Le={class:"grid gap-4 grid-cols-12 mt-5"},Ne={class:"text-gray-500 text-2xs"},Re=H({__name:"OrganizationAccessSharing",setup(s){const{getOrganizationAdditionalInformation:t}=Ae(),l=V(null),p=me("organizationMultiSelectEl"),{v$:i,organizationAccessSharingForm:r,setExternalValidationResults:f,validateForm:d}=we(),{organizations:g,organizationsError:a,onFilter:m,isSearching:_,onShow:c,resetOrganizationsList:z,getOrganizationChipLabel:o,organizationMultiSelectPanelProps:u}=Ve(l,p),{save:h,error:$,isSaved:A}=ke(d,r,f);return(n,O)=>{const b=ee,L=ge,j=de("FontAwesomeIcon"),K=ye,Q=Se,Y=fe,Z=$e,J=T("tooltip"),W=T("click");return E(),k("div",null,[S(b,{class:"mt-6"},{default:F(()=>[w(y(n.$t("access_sharing")),1)]),_:1}),e(a)||e($)?(E(),M(L,{key:0,class:"mt-4 mb-6",type:"error",message:e(a)||e($)},null,8,["message"])):N("",!0),S(Z,{class:"mt-5"},{content:F(()=>{var P,B,I;return[x("p",Ce,[S(j,{icon:("faIcons"in n?n.faIcons:e(_e)).farCircleInfo},null,8,["icon"]),w(" "+y(n.$t("allow_these_organizations_to_manage_shipments")),1)]),x("div",Le,[S(Q,{label:n.$t("allowed_organizations"),class:"col-span-12",errors:(P=e(i).serviceOrganizationUuids)==null?void 0:P.$errors,required:!!((I=(B=e(i).serviceOrganizationUuids)==null?void 0:B.required)!=null&&I.$message)},{default:F(()=>[q((E(),M(K,{ref_key:"organizationMultiSelectEl",ref:p,modelValue:e(r).serviceOrganizationUuids,"onUpdate:modelValue":O[0]||(O[0]=v=>e(r).serviceOrganizationUuids=v),display:"chip",options:e(g),"option-label":"legalEntity.companyName","option-value":"uuid",placeholder:n.$t("select..."),class:ve(["w-full",{"bg-red-50 ring-1 ring-red-300":e(a)}]),"scroll-height":"300px","show-toggle-all":!1,"panel-props":e(u),onFilter:e(m),onShow:e(c),onHide:e(z),filter:"","filter-placeholder":`${n.$t("search")}...`,"focus-on-hover":!1,"auto-filter-focus":"","reset-filter-on-hide":"","panel-class":"overscroll-contain [&_.p-virtualscroller]:overflow-x-hidden"},{chip:F(({value:v})=>
1[w(y(e(o)(v)),1)]),option:F(({option:v})=>[x("div",null,[x("p",null,y(v.legalEntity.companyName),1),x("p",Ne,y(e(t)(v)),1)])]),emptyfilter:F(()=>[e(_)?(E(),k(D,{key:0},[w(y(n.$t("searching"))+"... ",1)],64)):N("",!0),e(_)?N("",!0):(E(),k(D,{key:1},[w(y(n.$t("no_results_found")),1)],64))]),_:1},8,["modelValue","options","placeholder","class","panel-props","onFilter","onShow","onHide","filter-placeholder"])),[[J,{content:e(a)?e(a).type==="exception"?e(a).message.text:n.$t("generic_unknown_error"):"",show:e(a)&&e(a).type==="exception"}]])]),_:1},8,["label","errors","required"])]),q(S(Y,{"completed-text":n.$t("changes_saved"),error:e($),"is-completed":e(A),"onUpdate:isCompleted":O[1]||(O[1]=v=>ze(A)?A.value=v:null),class:"px-5 mt-6",text:n.$t("save")},null,8,["completed-text","error","is-completed","text"]),[[W,e(h),void 0,{throttle:!0,"500ms":!0}]])]}),_:1})])}}}),Ue={class:"space-y-8"},ro=H({__name:"access-sharing",setup(s){const{t}=he().$i18n;return Oe({title:`${t("access_sharing")} - ${t("organizations")}`,ogTitle:`${t("access_sharing")} - ${t("organizations")}`}),(l,p)=>{const i=X,r=Re;return E(),k("div",Ue,[S(i,{back:"organizations"}),S(r)])}}});
1export{ro 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.