1import{bO as O,bT as W,bU as ge,aT as H,j as e,bR as ue,r as N,aD as Re,aW as z,an as M,aE as me,aF as De,aG as Q,aH as he,bP as J,Z as Ce,al as Ae,X as xe,Y as Oe,bQ as fe,a2 as ye,bS as q,a4 as be}from"./index-BiTf2_h3.js";import{C as je}from"./ContentHeaderLegacy-Bdj1mtJ4.js";import{S as K,V as l,T as D,D as Ee,P as V,R as $,u as Te}from"./constants-fzmLquQV.js";import{R as Ne,u as Se,a as we,b as Be}from"./ReportBackButton-C0BoyY3W.js";import{S as G,b as ae,g as Fe,a as Me,c as Ye,d as Pe,u as Ge}from"./utils-BgxNG3mf.js";import{g as Ie}from"./getScoreAsPercentage-G1d0IjdL.js";import{p as Ue}from"./putWordInStartCase-DSE4MhYR.js";import{R as Le,L as ee,l as ve,a as ke,E as _e}from"./ExcludeNodesWithNoData-CcgV4lL7.js";import{R as We}from"./ReportHarveyBall-Dy7pP5d1.js";import{R as He,a as Ke,b as Xe,u as Ze}from"./useGetUserDetails-BGfXcwEg.js";import{P as ze,B as Qe,O as Je}from"./BusinessUnitSelectorMultiNodeForReports-kiSMi-91.js";import{G as qe}from"./GenerateReportButton-RRk3CESH.js";import{u as Ve}from"./useOrganizationSwitchData-72s1Il7B.js";import"./selectStyles-j6E_OGv5.js";import"./useWindowSize-DThsFbjR.js";import"./BackButtonWithContainer-BUjds5kt.js";import"./BackButton-D1DMNlIp.js";import"./P2aInputLabel-CdrjHTcb.js";import"./P2aInputError-Bo2TB0xc.js";import"./P2aButtonGenericLegacy-BPBS5Z50.js";import"./BusinessUnitSelectorWithCompanyTagsModal-Cq5Iy4YE.js";import"./BusinessUnitSelectorWithCompanyTags-B2NBpQao.js";import"./BusinessUnitSelectorMultiNodeForCompanyLevel-UPzhGhpP.js";import"./AVSearch-D8J6s-q4.js";import"./InputGroup-DzMgdGIC.js";import"./CompanyHierarchyGroupedSelectHandler-CcV_aykc.js";import"./P2aButtonText-n9XbASCb.js";import"./useIncludeArchivedBusinessUnits-ELEv8cFA.js";import"./Spinner-b81Vcj7a.js";import"./useGetOrganizationById-Dhb9RPjK.js";import"./useGetStages-B0mJgwLB.js";const $e="_container_1ptvc_1",et="_content_1ptvc_6",tt="_orientation_1ptvc_20",S={container:$e,content:et,orientation:tt},oe=18,ne=10,at=17,ot=10,se=16,re=9,I=35,U=40,L=40,v=20;function ie(a){return(a===O.PORTRAIT?oe:ne)*I+U+L+v}function nt(a){return((a===O.PORTRAIT?se:re)+1)*I+U+L+v}const st=a=>a*I+U+L+v,rt=(a,t,n)=>{const[o,...s]=W.chunk(a.nodes,t),i={...a,nodes:o},d=W.chunk(s.flat(),n===O.PORTRAIT?oe:ne).map(p=>({...a,nodes:p}));return[i,...d]};function P(a,t,n){const o=W.cloneDeep(n);return o[a]=t,o}function it({paginatedReportData:a,currentPage:t,agileOutcomeDataForReport:n,numberOfNodesForPageOneForOutcome:o,orientation:s}){return rt(n,o,s).reduce(({paginatedReportData:c,currentPage:d,availableSpace:p},h)=>({paginatedReportData:P(d,[h],c),currentPage:d+1,availableSpace:p}),{paginatedReportData:a,currentPage:t,availableSpace:ie(s)})}function lt(a,t){return a===0?t===O.PORTRAIT?se:re:t===O.PORTRAIT?at:ot}const dt=({paginatedReportData:a,currentPage:t,availableSpace:n},o,s)=>{const i=o.nodes.length,c=lt(t,s);if(i>c)return it({paginatedReportData:a,currentPage:t,agileOutcomeDataForReport:o,numberOfNodesForPageOneForOutcome:c,orientation:s});const d=st(i+1);if(d<=n){if(a[t]){const x=[...a[t],o];return{paginatedReportData:P(t,x,a),availableSpace:n-d,currentPage:t}}return{paginatedReportData:P(t,[o],a),availableSpace:n-d,currentPage:t}}const p=t+1,h=P(p,[o],a),C=ie(s);return{paginatedReportData:h,availableSpace:C-d,currentPage:p}},ct=(a,t)=>{if(!a)return[];const{paginatedReportData:n}=a.reduce(({paginatedReportData:o,currentPage:s,availableSpace:i},c)=>dt({paginatedReportData:o,currentPage:s,availableSpace:i},c,t),{paginatedReportData:[],currentPage:0,availableSpace:nt(t)});return n},pt=a=>{const t=Object.values(a).filter(s=>ge(s));if(!t.length)return"";const n=H.mean(t),o=Ie(n);return o===null?"":`${Math.ceil(o)}%`},b=K.create({tableRow:{margin:"auto",flexDirection:"row",height:U,backgroundColor:"#E9E9E9",fontFamily:"Helvetica-Bold",fontWeight:"semibold"},tableCol:{borderStyle:"solid",borderColor:G,borderWidth:1,borderRightWidth:0,justifyContent:"center",alignItems:"center"},lastCol:{borderStyle:"solid",borderColor:G,borderWidth:1,justifyContent:"center"},tableCell:{margin:"auto",fontSize:9,fontWeight:"black"}}),gt=({companyLevel:a,agileCapabilities:t})=>e.jsxs(l,{style:b.tableRow,children:[e.jsx(l,{style:{...b.tableCol,width:"12%"},children:e.jsx(D,{style:b.tableCell,children:H.startCase(a.toLowerCase())})}),e.jsx(l,{style:{...b.tableCol,width:"12%"},children:e.jsx(D,{style:b.tableCell,children:"Agile Outcome Score"})}),t.map(({agileCapabilityName:n})=>e.jsx(l,{style:{...b.tableCol,width:`${76/t.length}%`},children:e.jsx(D,{style:b.tableCell,children:n})},n))]}),r=K.create({body:{padding:40},table:{width:"auto"},oddRow:{backgroundColor:"#FFFFFF"},evenRow:{backgroundColor:"#FBFBFB"}
1,tableRow:{height:I,margin:"auto",flexDirection:"row"},tableCol:{borderStyle:"solid",borderColor:G,borderWidth:1,borderTop:0,borderRightWidth:0},lastCol:{borderStyle:"solid",borderColor:G,borderWidth:1,borderTop:0},tableCell:{margin:"auto",fontSize:9,textAlign:"left"},nodeValue:{width:"50%"},centered:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}}),ut=({agileCapabilities:a,averageScores:t,tableColumnStyles:n,companyLevel:o})=>e.jsxs(l,{style:{...r.tableRow,...r.oddRow},children:[e.jsx(l,{style:{...r.tableCol,width:"12%"},children:e.jsxs(D,{style:r.tableCell,children:["All ",Ue(o),"s"]})}),e.jsx(l,{style:{...r.tableCol,width:"12%"},children:e.jsx(D,{style:{...r.tableCell,...r.centered},children:pt(t)})}),a.map(({agileCapabilityId:s},i)=>e.jsx(l,{style:{...n,...i+1===a.length?r.lastCol:r.tableCol},children:e.jsx(D,{style:{...r.tableCell,...r.centered},children:ae(t[s])})},s))]}),Rt=({nodes:a,agileCapabilities:t,averageScores:n,showAverage:o,companyLevel:s})=>{const i={...r.centered,width:`${76/t.length}%`};return e.jsxs(l,{style:r.table,children:[o&&e.jsx(ut,{agileCapabilities:t,averageScores:n,tableColumnStyles:i,companyLevel:s}),a==null?void 0:a.map(({businessUnitId:c,name:d,averageScoreForOutcomeForNode:p,capabilityScoreDataKeyedByCapabilityId:h},C)=>e.jsxs(l,{style:{...r.tableRow,...C%2===0?r.evenRow:r.oddRow},children:[e.jsx(l,{style:{...r.tableCol,width:"12%"},children:e.jsx(D,{style:r.tableCell,children:d})}),e.jsx(l,{style:{...r.tableCol,width:"12%"},children:e.jsx(D,{style:r.tableCell,children:ae(p)})}),t.map(({agileCapabilityId:R},x)=>{var g,m;const A=((g=h[R])==null?void 0:g.assessmentScoreText)||null;return e.jsxs(l,{style:{...i,...x+1===t.length?r.lastCol:r.tableCol},children:[e.jsx(l,{style:r.nodeValue,children:e.jsx(l,{style:{...r.tableCell,width:"100%",height:"100%",alignItems:"center",justifyContent:"center",alignContent:"center",color:"white",backgroundColor:Fe(A)},children:A===ue.NOT_APPLICABLE?e.jsx(D,{children:"N/A"}):e.jsx(We,{assessmentScoreText:A})})}),e.jsx(l,{style:r.nodeValue,children:e.jsx(Le,{style:{margin:"auto"},netChangeInScore:(m=h[R])==null?void 0:m.trend})})]},R)})]},c))]})},mt=({agileOutcomeName:a,stageName:t})=>e.jsxs(l,{style:{marginTop:v,width:"100%",height:L,padding:"5 10",backgroundColor:Me(t),color:"white",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(D,{style:{fontSize:18,fontFamily:"Helvetica-Bold",fontWeight:"semibold"},children:a}),e.jsx(D,{style:{fontSize:14},children:t})]}),Dt="/assets/legendSpectrum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3n8zcrKSglMOt0eTk++ZJC2qK+pgR9//LEXVGgZBWcyuUr/Z5E9+fLPY7kki50Hp0629QnFwwf3Q0qEB9w7Ia4nXx58ngkrYt3gyOH9jwSjt+sU0T358tKn1WBmPrpfsMgcpojyyZf69yrAwX06GD0CjhSKCyKch+eTL4WFhcqps7W1NchkMggi2dPmzZuH5bPStWTtMITAbxu5f7OdrN2dPHkS6qqrIZTc1F1NbusR67PSd47nwupEX0iKi4RfHz8GnZ2dyivthw8egNjwANicRa6inlCI8pHA/3RmQV15AESHeUNTQx0cO3bsYcck0+en01xE+6z0PgLHGU4ytdNqQyNDWBTjLupHAhs6KiE80w8sJ5gr1xFZIFpNsoDlpZH8WWn+Eon/6Y8kU/4VueF7GxkgaggMXyWPS/4hM1MnXiJBb97euzoMKlIDoFIeAAfLIuBvr2TpxEskfriaCad+GQFNG/0hI94Rdlf5woNrmTrxEom6U2shJNkHZnvYwbxFs2FpXjC8dHWrzrxEgq4fFjYkQ9yqEFj2TDgU75JDA8ko+UskOBj5a8f4a8f4a8f4a8c4GDkYORg5GDkYORg5GDkYORg5GDkYORg5GDkYORg5GDkYORg5GDkYORg5GDkYORg5GCkYDxNd0kWRt/SkDXZ7kJutPyWQua2LuntgZRuBzG1d1IOO3DYCmdu6qB++UHxJAHNbV9V0fv15ApnbuqmKIgk3bty4cePGjRs3bj+b/RfZ45Jg8pma4wAAAABJRU5ErkJggg==",Ct=({isNaActive:a})=>{const t=a?ht:Dt;return e.jsxs(l,{children:[e.jsx(ee,{label:"Score Legend",src:t,imgWidth:"60%"}),e.jsx(ee,{label:"Trend Legend",src:ve,imgWidth:"40%"})]})},Y=K.create({page:{padding:"20 40"},title:{fontFamily:"Helvetica-Bold"},subtitle:{marginTop:10,fontSize:12},table:{width:"auto",borderStyle:"solid"}}
1),At=({data:a=[],companyName:t,username:n,companyTree:o,companyLevel:s,startDate:i,endDate:c,isUsingCustomDateRange:d,orientation:p,excludeNodesWithNoData:h})=>{const C=new Date,R=`${H.startCase(s.toLowerCase())}-Level Capability Detail Report`,x=ct(a,p);return e.jsxs(Ee,{children:[e.jsxs(V,{size:"A4",style:Y.page,children:[e.jsxs(l,{children:[e.jsx(He,{companyName:t,username:n,dateGenerated:C,reportTitle:R,companyTree:o,companyLevel:s}),e.jsx(Ke,{isUsingCustomDateRange:d,startDate:i,endDate:c}),e.jsx(Xe,{companyTree:o,companyLevel:s}),h&&e.jsx(ke,{companyLevel:s}),e.jsx(Ct,{isNaActive:!0})]}),e.jsx($,{dateGenerated:C})]}),x.map((A,g)=>e.jsxs(V,{size:"A4",orientation:p.toLowerCase(),style:Y.page,children:[e.jsx(Ne,{reportName:`${t}: Capability Detail Report `}),e.jsxs(l,{children:[g===0&&e.jsx(l,{style:{height:20},children:e.jsx(D,{style:Y.title,children:R})}),A.map(({agileCapabilities:m,nodes:f,agileOutcomeId:y,agileOutcomeName:j,stage:E,averageScores:T})=>{var B,F;return e.jsxs(l,{style:Y.table,children:[e.jsx(mt,{agileOutcomeName:j,stageName:E.name}),e.jsx(gt,{companyLevel:s,agileCapabilities:m}),e.jsx(Rt,{showAverage:y!==((F=(B=x[g-1])==null?void 0:B[A.length-1])==null?void 0:F.agileOutcomeId),nodes:f,agileCapabilities:m,averageScores:T,companyLevel:s})]},`page-${g}`)})]},`page-${g}`),e.jsx($,{dateGenerated:C})]},`page-${g}`))]})},xt=({agileCapabilityData:a,CapabilityDetailPDF:t,companyName:n,orientation:o})=>{const[s,i]=Te({document:t});return N.useEffect(()=>{i(t)},[a,o]),s.loading?e.jsx("div",{children:"Loading ..."}):s.error?e.jsx("div",{children:"Something went wrong"}):e.jsx("a",{href:s.url||"",download:Ye(n,"CapabilityDetail"),children:"Download Capability Detail"})},te=Re({p2aDataCompanyLevel:z().oneOf([M.TEAM,M.SYSTEM,M.ORGANIZATION]).required().default(M.TEAM),businessUnitIds:me().of(De()).nullable().default(null),endDate:Q().nullable().default(new Date),startDate:Q().nullable().default(he(new Date,{months:3})),isUsingCustomDateRange:J().default(!1),orientation:z().oneOf([O.PORTRAIT,O.LANDSCAPE]).required().default(O.PORTRAIT),excludeNodesWithNoData:J().default(!1)}),Ot="_row_1yzmh_1",ft="_input_1yzmh_4",w={row:Ot,input:ft,"row-one":"_row-one_1yzmh_8"},yt=({onSubmitCapabilityDetailConfiguration:a,control:t,setValue:n,businessUnitIds:o,p2aDataCompanyLevel:s,startDate:i,endDate:c,isUsingCustomDateRange:d,isReportGenerating:p})=>e.jsxs("form",{onSubmit:a,children:[e.jsx("div",{className:`${w.row} ${w.input} ${w["row-one"]}`,children:e.jsx(ze,{control:t,name:"p2aDataCompanyLevel"})}),e.jsx("div",{className:w.row,children:e.jsx(Qe,{setValue:n,businessUnitIds:o||[],companyLevelChosen:s})}),e.jsx("div",{className:w.row,children:e.jsx(Je,{control:t,startDateName:"startDate",endDateName:"endDate",isUsingCustomDateRange:d,setValue:n,startDate:i,endDate:c})}),e.jsx(_e,{control:t,property:"excludeNodesWithNoData",companyLevel:s}),e.jsx(qe,{tooltipText:o!=null&&o.length?"":"Please select at least one node to generate the report",isGenerateReportButtonDisabled:!(o!=null&&o.length),isReportGenerating:p})]});function le(a,t,n,o){return`${a.join("-")}-${t}-${n}-${o}`}function bt(a,{p2aDataCompanyLevel:t,businessUnitIds:n,endDate:o,startDate:s,isUsingCustomDateRange:i,excludeNodesWithNoData:c},d,p){return N.useEffect(()=>{a()},[n,t,s,o,i,c]),{currentReportData:le(n||[],s,o,c)===p?d:void 0}}const jt=()=>{const{organization:a}=Ve(),{makeApiMutation:t}=Ce(),{companyTreeForReports:n}=Ae(u=>u.reports),[o,s]=N.useState(),[i,c]=N.useState(),[d,p]=N.useState(!1),{userFullName:h}=Ze(),{setValue:C,watch:R,handleSubmit:x,control:A}=xe({resolver:Oe(te),criteriaMode:"firstError",defaultValues:te.getDefaultFromShape()}),g=R("businessUnitIds"),m=R("p2aDataCompanyLevel"),f=R("startDate"),y=R("endDate"),j=R("isUsingCustomDateRange"),E=R("orientation"),T=R("excludeNodesWithNoData"),B=async u=>{p(!0);try{const _=await t({method:ye.POST,path:"reports/capabilityDetailReport",body:{businessUnitIds:u.businessUnitIds||[],companyLevel:u.p2aDataCompanyLevel,...u.isUsingCustomDateRange&&u.startDate&&{startDate:q(u.startDate)},...u.isUsingCustomDateRange&&u.endDate&&{endDate:q(u.endDate)},orientation:u.orientation,...u.excludeNodesWithNoData&&{excludeNodesWithNoData:u.excludeNodesWithNoData}}});s(_.data),c(le(g||[],f,y,T))}catch(k){be(k,"generateReport CapabilityDetail")}p(!1)},F=()=>{s(void 0)},de=Pe(g||[],m,n),{getDefaultBusinessUnitIdsForReports:ce}=Ge();N.useEffect(()=>{const{businessUnitIds:u}=ce(m);C("businessUnitIds",u)},[m,a]),Se(fe.CAPABILITY_DETAIL,!!o,{businessUnitIds:g,p2aDataCompanyLevel:m,startDate:f,endDate:y,isUsingCustomDateRange:j,orientation:E,excludeNodesWithNoData:T});const{currentReportData:X}=bt(F,{businessUnitIds:g,p2aDataCompanyLevel:m,startDate:f,endDate:y,isUsingCustomDateRange:j,orientation:E,excludeNodesWithNoData:T},o,i),Z=e.jsx(At,{data:X,companyName:(n==null?void 0:n.name)||"",username:h,companyTree:de,companyLevel:m,startDate:f,endDate:y,isUsingCustomDateRange:j,orientation:E,excludeNodesWithNoData:T}
1),pe=o==null?void 0:o.find(u=>Object.values(u.averageScores).find(_=>_!==null)!==void 0);return e.jsxs("div",{className:S.container,children:[e.jsxs("div",{className:S["content-header"],children:[e.jsx(we,{}),e.jsx(je,{title:"Capability Detail Report",description:"Configure and generate a Capability Detail report."})]}),e.jsxs("div",{className:S.content,children:[e.jsx("div",{className:S["configurations-container"],children:e.jsx("div",{className:S.configurations,children:e.jsx(yt,{onSubmitCapabilityDetailConfiguration:x(B),control:A,setValue:C,businessUnitIds:g,p2aDataCompanyLevel:m,startDate:f,endDate:y,isUsingCustomDateRange:j,isReportGenerating:d})})}),e.jsx("div",{children:e.jsx(Be,{hasGeneratedReport:!!o,PdfDocument:Z,control:A,orientationKey:"orientation",givenConfigurationsHaveAssessmentData:!!pe,forceDisplayAsLink:((g==null?void 0:g.length)||0)>50,PdfLink:e.jsx(xt,{agileCapabilityData:X,companyName:(n==null?void 0:n.name)||"",CapabilityDetailPDF:Z,orientation:E})})})]})]})},oa=()=>e.jsx(jt,{});export{oa 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.