import{ao as e,aU as i,aP as E,aq as s,f as l,e as o,L as j,ca as T,ah as v,h as U,ag as A,az as d,aj as M,bu as L,bN as k,aI as I,v as S,ba as _}from"./app-k0jcl5PQ.js";import{B as q}from"./CCtuxSlD.chunk.js";import{R as D}from"./4jZ12g_A.chunk.js";import{u as F}from"./Xv5EXWiN.chunk.js";import{J as b}from"./CYLKJSfE.chunk.js";import{S as y}from"./uqbmi2GD.chunk.js";import{U as Y}from"./9ls1F1Ve.chunk.js";import"./CPXlV0fg.chunk.js";import"./DkDkjje4.chunk.js";import"./DwDhXSrj.chunk.js";import"./fstW5ZQE.chunk.js";const u="userManager.inviteRequestsTableEmptyState",B=j.encloseNamespace(u);function G(){return e.jsxs(i,{children:[e.jsx(i.Image,{src:E.EmptyStates.UserManager.STAFF}),e.jsx(i.Heading,{children:e.jsx(s,{namespace:u,phrase:"heading"})}),e.jsx(i.Info,{children:e.jsx(s,{namespace:u,phrase:"info"})}),e.jsx(i.Cta,{text:B("cta"),appLink:{application:o.SETTINGS,action:l.Settings.REQUESTING_ACCESS},className:"btn btn-dark"})]})}const H="_avatarContainer_6gpgg_1",P="_emailText_6gpgg_5",N={avatarContainer:H,emailText:P},g="userManager.inviteRequestsTable";function $(m){const{joinRequests:r,imageCdnUrl:p,currentUser:t,onResolveRequest:n}=m;function h(){return t.instanceRegion===A.US?"MM/DD/YYYY":"DD/MM/YYYY"}return r.length?e.jsxs("table",{className:"w-100 table table-striped table-borderless",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"ps-3",children:e.jsx(s,{namespace:g,phrase:"nameTableHeading"})}),e.jsx("th",{scope:"col",children:e.jsx(s,{namespace:g,phrase:"dateTableHeading"})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:r.map(a=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle ps-3",children:e.jsxs("div",{className:"d-flex align-items-center",children:[e.jsx("div",{className:`${N.avatarContainer} me-2`,children:e.jsx(T,{imageCdnUrl:p,initials:v.getInitialsFromFullName(a.fullName)||a.email.charAt(0)})}),e.jsxs("div",{className:"d-flex flex-column justify-content-center",children:[a.fullName&&e.jsx("span",{className:"fw-semibold",children:a.fullName}),e.jsx("span",{className:`${N.emailText}`,children:a.email})]})]})}),e.jsx("td",{className:"align-middle",children:U.format(a.dateCreated,h())}),e.jsxs("td",{className:"text-end pe-3",children:[e.jsx("button",{className:"btn btn-tertiary me-1",onClick:()=>n(a,b.Denied),children:e.jsx(s,{namespace:g,phrase:"rejectButtonLabel"})}),e.jsx("button",{className:"btn btn-dark",onClick:()=>n(a,b.Approved),children:e.jsx(s,{namespace:g,phrase:"approveButtonLabel"})})]})]},a.id))})]}):e.jsx(G,{})}const c="userManager.accessRequests",R=j.encloseNamespace(c),w={application:o.SETTINGS,action:l.Settings.REQUESTING_ACCESS},Q={application:o.SETTINGS,action:l.Settings.HOME};function te(){var f;F();const m=d(M.currentUser()),r=d(Y.joinRequests()),p=d(L.config()),t=d(D.getRostering()),n=((f=t.data)==null?void 0:f.status)&&t.data.status!=="None";k({title:j.getPhrase(c,"pageTitle")}),I.useEffect(()=>{if(t.hasCompleted&&n){const x={application:o.USER_MANAGER,action:l.UserManager.STAFF};S.trigger(x,{replace:!0})}},[t.hasCompleted,n]);function h(x,C){S.trigger({application:o.USER_MANAGER,action:l.UserManager.RESOLVE_ACCESS_REQUEST,args:[x.id],params:{status:C}})}return!r.hasCompleted||!p.hasCompleted||!m.hasCompleted||!t.hasCompleted||n?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"px-3",children:[e.jsx("h1",{className:"h2",children:e.jsx(s,{namespace:c,phrase:"heading"})}),e.jsx("div",{className:"pb-3",children:e.jsx(q,{breadcrumbs:[{name:R("settingsBreadcrumb"),appLink:Q},{name:R("staffManagerBreadcrumb"),active:!0}]})}),e.jsx(y,{active:"invite-requests"}),e.jsxs("p",{className:"mb-3",children:[e.jsx(s,{namespace:c,phrase:"domainSettingsDescription"}),e.jsx("br",{}),e.jsx(_,{appLink:w,className:"info-link",children:e.jsx(s,{namespace:c,phrase:"domainSettingsLink"})})]}),e.jsx($,{joinRequests:r.data,imageCdnUrl:p.data.imageCdnUrl,onResolveRequest:h,currentUser:m.data})]})}export{te as AccessRequestsView};
//# sourceMappingURL=DV2T9ZPu.chunk.js.map
