PageSourceSearch

https://datasuite.fptcloud.com/assets/ReportTemplatesManagementPage-CsPGVQla.js

js fptcloud.com collected 2026-10-01 12:39:57 UTC 21,788 bytes, 1 lines download raw bytes

1var Ce=Object.defineProperty;var ge=(r,t,o)=>t in r?Ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var F=(r,t,o)=>ge(r,typeof t!="symbol"?t+"":t,o);import{r as A,j as e}from"./react-DJo-hRcj.js";import{a as Pe,S as P,C as te,B as c,T as M,bT as re,I as ae,A as oe,L as Me,bU as fe,Y as Le,F as be,bf as Ie,bV as Oe,a7 as ye,b as je,P as Se,g as $,c as G}from"./index-B5XNITP8.js";import{C as Ne}from"./index-Kc8NKc2M.js";import{P as se}from"./Plus-VBX5Yw5b.js";import{H as De}from"./index-CDFiJbiS.js";import{N as ve}from"./NoBorderLayout-BJhYtsvm.js";import{b$ as ne,bV as we,bq as ie,I as L,c8 as D,bd as q,bW as ke,cp as Ke,bY as Fe,ax as N,bc as v,bb as Ge,cH as Be,cO as qe,J as Ue,ba as He}from"./vendors-_9dKRPAn.js";import{F as We}from"./index-BG5wa17B.js";import{C as X}from"./ControlledInput-t0pN4OLl.js";import{A as le}from"./index-D44FK_Cc.js";import{T as Ye,a as ze}from"./TemplateHelmet-DALg0yad.js";import{S as Qe}from"./index-MmSGyg3S.js";import{r as U,R as Ee}from"./queryKeys-kKAYVQ50.js";import{u as Te,T as Ve,a as $e,b as Xe}from"./ThumbnailUploadField-CJ3ZY6SJ.js";import"./index-XVdP7IIM.js";import{_ as J}from"./lodash-D9U91hCZ.js";import"./IconMenu-ivf-GgzL.js";import{a as B}from"./toastifyV2-JsPZrQKQ.js";import{A as Je}from"./index-SnFB1gz5.js";import{P as Ze}from"./PipelineTemplateRepository-DV76QlCI.js";import{a4 as et,C as Z,aq as tt,an as rt,ae as at}from"./mui-core-DIGHSUz9.js";import{T as ot}from"./index-DrXyz3GH.js";import{S as st}from"./Search-CSvDv4Dl.js";import{E as nt}from"./useCheckPermissionSidebar-BJ_M-sXv.js";import{S as it}from"./SearchReportTemplates-OWMnp8q0.js";import"./mui-x-WaaF4sFd.js";import"./LocalStorageManager-Brbsb2wO.js";import"./languageManager-_RIZidnS.js";import"./SharedComponents-CFIIYYlL.js";import"./useUrlParams-9vBjnh_J.js";import"./Search-BtClgkYE.js";import"./ModalV2-Bwgoj2D8.js";import"./org-switch-rules-CALv74Cz.js";import"./useOrgList-CLYvyZdj.js";import"./getTenantId-D-FzaJmc.js";import"./index-C6hXkfvS.js";import"./DashboardQueryRepository-BaKnPLob.js";import"./Building-_OqbRV1u.js";import"./Check-DzZWfpvT.js";import"./LocalStorageManager-Cf9EMmua.js";import"./constants-BhQb0AAi.js";import"./getHttpStatusCode-D6Fy-dO9.js";class lt{constructor(t){F(this,"repository");this.repository=t}async execute(t){if(!t.projectId)throw new Error("projectId is required");if(!t.dashboardId)throw new Error("dashboardId is required");if(!t.name)throw new Error("name is required");if(!t.summary)throw new Error("summary is required");if(!t.thumbnail)throw new Error("thumbnail is required");return this.repository.create(t)}}function Et(){const r=ne(),t=new Ee,o=new lt(t);return we({mutationFn:s=>o.execute(s),onSuccess:()=>{r.invalidateQueries(U.searches())}})}class Tt{async findByProjectId(t){return(await Pe.post(`/v2/project/${t.projectId}/report-template/dashboard`,{pageSize:t.pageSize||1e3,pageNumber:t.pageNumber||1})).data.data||{data:[],meta:{pagination:{total:0,pageNumber:t.pageNumber||1,pageSize:t.pageSize||100,pageCount:0}}}}}class ct{constructor(t){F(this,"repository");this.repository=t}async execute(t){if(!t.projectId)throw new Error("projectId is required");return this.repository.findByProjectId(t)}}function dt(r){const t=new Tt,o=new ct(t);return ie({queryKey:U.dashboards(r),queryFn:()=>o.execute({projectId:r}),enabled:!!r})}function pt(r){const{open:t,onClose:o,onSuccess:s}=r,{t:a}=L(),{projectId:l}=D(),h=q(),{tenantId:u}=D(),{data:m,isLoading:x}=dt(l),{data:d,isLoading:R}=Te(l),g=A.useMemo(()=>(m?.data||[]).map(i=>({value:i.id,label:i.attributes?.name||i.name||String(i.id),disabled:i.isUsed===!0})),[m]),_=A.useMemo(()=>(d||[]).map(i=>({value:i.id,label:i.attributes?.name||i.name||String(i.id)})),[d]),p=ke({mode:"onChange",defaultValues:{dashboardId:g[0]?.value||"",templateChartCategoryIds:[],name:"",summary:"",description:"",thumbnail:""}});A.useEffect(()=>{t&&p.reset({dashboardId:"",templateChartCategoryIds:[],name:"",summary:"",description:"",thumbnail:""})},[t]);const E=Ke({control:p.control,name:"templateChartCategoryIds"}),{mutateAsync:b,isLoading:I}=Et(),O=!p.formState.isValid||!Array.isArray(E)||E.length===0||I,y=async n=>{try{const i={projectId:Number(l),dashboardId:Number(n.dashboardId),templateChartCategoryIds:n.templateChartCategoryIds?.map(f=>Number(f?.value??f))||[],name:n.name,summary:n.summary,description:n.description,thumbnail:n.thumbnail},C=await b(i);B.success({title:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CREATE_SUCCESS","Template created successfully")}),s?.(C),o(),C?.id&&h.push(v(re,{tenantId:u,projectId:l,templateId:C.id}))}catch(i){console.error("Create template failed:",i),i?.response?.status<500&&i?.response?.data?.message?B.error({title:i.response.data.message}):B.error({title:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CREATE_FAILED","Create template failed")})}};return e.jsx(We,{open:t,title:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CREATE","Create Template"),cancelText:a("Cancel","Cancel"),submitText:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CREATE","Create"),onClose:o,onSubmit:p.handleSubmit(y),isLoading:I,isSubmitDisabled:O,form:p,children:e.jsx(Fe,{...p,children:e.jsxs(P,{gap:4,children:[e.jsx(N,{name:"dashboardId",control:p.control,rules:{required:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SELECT_REPORT_REQUIRED","Required")},render:({field:n,fieldState:i})=>e.jsx(Qe,{required:!0,name:"dashboardId",label:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.REPORT","Report"),options:g.map(C=>({...C,disabledTooltip:C.disabled?a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.DASHBOARD_ALREADY_USED","This report has already been used to create a template and cannot be used again."):void 0})),value:n.value,onChange:n.onChange,helperText:i.error?.message,placeholder:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SELECT_REPORT","Select Report"),disabled:x})}),e.jsx(X,{fullWidth:!0,name:"name",required:!0,label:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.TEMPLATE_REPORT_NAME","Template Report Name"),placeholder:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.TEMPLATE_REPORT_NAME_PLACEHOLDER","Enter Template Report Name"),rules:{required:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.NAME_REQUIRED","Required"),maxLength:{value:255,message:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.NAME_MAX_LENGTH","Maximum 255 characters")}
1,validate:n=>n.trim().length>0||a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.NAME_REQUIRED","Required")}}),e.jsx(N,{control:p.control,name:"templateChartCategoryIds",rules:{validate:n=>Array.isArray(n)&&n.length>0||a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CATEGORY_REQUIRED","Required")},render:({field:n,fieldState:i})=>e.jsx(le,{size:"md",ref:n.ref,onBlur:n.onBlur,limitTags:3,multiple:!0,required:!0,disabled:R,popupIcon:e.jsx(te,{}),options:_,getOptionLabel:C=>C.label,isOptionEqualToValue:(C,f)=>C.value===f.value,value:_.filter(C=>(n.value||[]).includes(C.value)),onChange:(C,f)=>{n.onChange(f.map(j=>j.value))},label:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.CHART_CATEGORY","Categories"),placeholder:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SELECT_CHART_CATEGORY","Select categories"),error:!!i.error,helperText:i.error?.message})}),e.jsx(X,{fullWidth:!0,required:!0,name:"summary",label:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SUMMARY","Summary"),placeholder:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SUMMARY_PLACEHOLDER","Enter a summary"),rules:{required:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SUMMARY_REQUIRED","Required"),maxLength:{value:255,message:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SUMMARY_MAX_LENGTH","Maximum 255 characters")},validate:n=>n.trim().length>0||a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.SUMMARY_REQUIRED","Required")}}),e.jsx(N,{name:"description",control:p.control,render:({field:n,fieldState:i})=>e.jsxs(c,{children:[e.jsx(M,{variant:"bodyMBaseMedium",sx:{display:"block",mb:"4px"},children:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.DESCRIPTION","Description")}),e.jsx(Ye,{...n,placeholder:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.DESCRIPTION_PLACEHOLDER",""),error:!!i.error,helperText:i.error?.message,maxRows:8,style:{overflowY:"auto"}})]})}),e.jsx(N,{name:"thumbnail",control:p.control,rules:{required:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_DIALOG.THUMBNAIL_REQUIRED","Required")},render:({field:n,fieldState:i})=>e.jsx(Ve,{value:n.value,onChange:n.onChange,open:t,error:i.error?.message})})]})})})}function ce({name:r,summary:t,thumbnail:o,categoryNames:s,to:a,loading:l}){const{t:h}=L(),u=A.useRef(null),[m,x]=A.useState(4),d=R=>20+R.length*7;return A.useEffect(()=>{if(u.current&&s){const R=u.current.offsetWidth;let g=0,_=0;for(const p of s){const E=d(p);if(g+E>R)break;g+=E+6,_++}x(_)}},[s]),l?e.jsx(et,{variant:"rounded",width:"100%",height:340}):e.jsxs(c,{component:Ge,to:a,sx:{display:"flex",flexDirection:"column",textDecoration:"none",borderRadius:"8px",overflow:"hidden",border:"1px solid #F2F4F7",backgroundColor:"#fff",height:"100%",boxShadow:"0px 1px 3px 0px #1018281A","&:hover":{borderColor:"#DEE0E6"}},children:[e.jsx(c,{sx:{width:"100%",aspectRatio:"2/1",backgroundColor:"#F3F4F6",overflow:"hidden",flexShrink:0},children:o?e.jsx(c,{component:"img",src:o,alt:r,sx:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}):e.jsx(c,{sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#E9EBF0"},children:e.jsx(M,{variant:"bodyMBaseRegular",color:"text.disabled",children:h("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.NO_PREVIEW","No preview")})})}),e.jsxs(c,{sx:{p:"12px 14px",display:"flex",flexDirection:"column",gap:"6px",flexGrow:1,borderTop:"1px #F2F4F7 solid"},children:[e.jsx(M,{variant:"bodyMBaseMedium",sx:{color:"#111827",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",lineHeight:"1.4"},children:r}),e.jsx(M,{variant:"bodySRegular",sx:{color:"#6B7280",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",lineHeight:"1.5",height:"3em"},children:t||""}),s&&s.length>0&&e.jsx(c,{ref:u,sx:{mt:"auto",pt:"6px",display:"flex",flexWrap:"nowrap",gap:"6px",overflow:"hidden"},children:(()=>{const R=s.slice(0,m),g=R.length>0?R:[s[0]],_=s.length-g.length,p=R.length===0;return e.jsxs(e.Fragment,{children:[g.map((E,b)=>e.jsx(Z,{label:E,size:"small",variant:"outlined",sx:{height:"26px",fontSize:"12px",fontWeight:400,backgroundColor:"#fff",color:"#374151",borderColor:"#D1D5DB",borderRadius:"999px",flexShrink:b===0&&p?1:0,minWidth:0,"& .MuiChip-label":{px:"10px",...b===0&&p?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:{}}}},E)),_>0&&e.jsx(Z,{label:`+${_}`,size:"small",variant:"outlined",sx:{height:"26px",fontSize:"12px",fontWeight:400,backgroundColor:"#fff",color:"#374151",borderColor:"#D1D5DB",borderRadius:"999px","& .MuiChip-label":{px:"10px"},flexShrink:0}})]})})()})]})]})}function ut({viewMode:r,total:t,searchValue:o,selectedCategoryIds:s,categoryOptions:a,isCategoriesLoading:l,onSearchChange:h,onCategoryChange:u}){const{t:m}=L(),x=a.filter(d=>s.includes(d.value));return e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:2,sx:{flexWrap:"nowrap"},children:[e.jsx(M,{component:"h2",variant:"h4SMedium",children:r==="explore"?m("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.REPORT_TEMPLATE_LIST.EXPLORE_TITLE","Explore {{total}} templates for your business needs",{total:t}):m("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.REPORT_TEMPLATE_LIST.WORKSPACE_TITLE","You have {{total}} templates in your workspace",{total:t})}),e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:"12px",flexShrink:0},children:[e.jsx(ot,{onChange:h,placeholder:m("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.SEARCH_PLACEHOLDER","Search Report Template Name"),icon:e.jsx(st,{fontSize:"small"}),value:o,hiddenLabel:!0,sx:{width:280,marginTop:"3px"}}),e.jsx(c,{sx:{width:240,flexShrink:0},children:e.jsx(le,{size:"md",multiple:!0,singleLine:!0,disabled:l,popupIcon:e.jsx(te,{}),options:a,getOptionLabel:d=>d.label,isOptionEqualToValue:(d,R)=>d.value===R.value,value:x,onChange:(d,R)=>u(R.map(g=>g.value)),placeholder:m("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.ALL_CATEGORIES","All Template"),showSelectAll:!0,selectAllLabel:m("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.ALL_CATEGORIES","All Template")})})]})]})}function mt({viewMode:r,isFiltered:t,onCreateClick:o,canCreateTemplate:s}){const{t:a}=L();return e.jsxs(P,{flexGrow:1,alignItems:"center",justifyContent:"center",spacing:2,role:"main","aria-labelledby":"empty-state-title",children:[e.jsx(c,{sx:{width:64,height:64,borderRadius:"50%",backgroundColor:"#0044A214",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(nt,{size:"medium",sx:{color:"grey.400"}})}),e.jsx(M,{variant:"h4SMedium",color:"text.primary",children:t?a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.EMPTY_SEARCH_TITLE","No results found"):a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.EMPTY_TITLE","No templates yet")}),t?e.jsx(M,{variant:"bodyMBaseRegular",color:"text.secondary",children:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.EMPTY_SEARCH_DESCRIPTION","Try adjusting your search or filters to find what you're looking for.")}):r==="my"&&o&&s&&e.jsxs(e.Fragment,{children:[e.jsx(M,{variant:"bodyMBaseRegular",color:"text.secondary",children:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.EMPTY_DESCRIPTION","Create your first template to save and reuse report structures.")}),e.jsx(c,{sx:{pt:"12px"},children:e.jsx(ae,{icon:e.jsx(se,{size:"sm"}),variant:"tertiary",text:a("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE_TEMPLATE","Create Template")||"Create Template",onClick:o})})]})]})}function Rt({message:r}){const{t}=L();return e.jsxs(P,{flexGrow:1,alignItems:"center",justifyContent:"center",py:8,spacing:2,role:"alert","aria-live":"assertive",children:[e.jsx(M,{variant:"h4SMedium",color:"error",id:"error-title",children:t("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.ERROR_LOADING")}),e.jsx(M,{variant:"bodyMBaseRegular",color:"text.secondary",id:"error-description",children:r||t("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.FAILED_TO_LOAD_CONTENT")}),e.jsx(oe,{variant:"contained",onClick:()=>window.location.reload(),"aria-describedby":"error-title error-description",children:t("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.RETRY")})]})}function At(){const[r,t]=A.useState(0),[o,s]=A.useState(10),a=A.useRef(()=>{});return A.useEffect(()=>{a.current=()=>{if(r===100)t(0),s(10);else if(t(r+1),o<100&&r%5===0){const l=o+1+Math.random()*10;s(l>100?100:l)}}}),A.useEffect(()=>{const l=setInterval(()=>{a.current()},100);return()=>{clearInterval(l)}},[]),e.jsxs(tt,{justifyContent:"center",alignItems:"center",children:[e.jsx(Me,{sx:{width:"40px",height:"40px",marginBottom:"20px"}}),e.jsx(rt,{sx:{width:"80px",margin:"0 auto",borderRadius:"4px"},children:e.jsx(at,{variant:"buffer",value:r,valueBuffer:o,sx:{borderRadius:"3px","& .MuiLinearProgress-bar":{backgroundColor:"#3F444B",borderRadius:"3px"},"& .MuiLinearProgress-bar2Buffer":{backgroundColor:"#5e6166"},"& .MuiLinearProgress-dashed":{backgroundImage:"radial-gradient(#5e6166 0%, transparent 42%)"}}})})]})}const ht=12;
1function xt(){return e.jsx(c,{role:"status","aria-label":"Loading report templates",sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",xl:"repeat(4, 1fr)"},gap:4},children:Array.from({length:ht}).map((r,t)=>e.jsx(ce,{loading:!0},`skeleton-${t}`))})}function _t({projectId:r,name:t,templateChartCategoryIds:o,pageSize:s=12,enabled:a=!0}={}){const l=new Ee,h=new it(l);return Be({queryKey:U.search(r,t,o,s,void 0),queryFn:({pageParam:u=1})=>h.execute({projectId:r,name:t,templateChartCategoryIds:o,pageSize:s,pageNumber:u}),getNextPageParam:u=>{const m=u?.data?.pagination;if(!m)return;const{page:x,pageCount:d}=m;return x<d?x+1:void 0},enabled:a,keepPreviousData:!1})}const Ct=12;function gt({viewMode:r="explore",onCreateClick:t,canCreateTemplate:o}){const{t:s}=L(),a=q(),{tenantId:l,projectId:h}=D(),u=ne(),m=new Ze({queryClient:u}),{data:x}=ie({...m.getPipelineTemplates({workspaceId:h,page:0,pageSize:1,isPending:"true"}),enabled:!!h&&r==="explore",keepPreviousData:!0}),d=J(x,"data.data.rows",[]),R=J(d,"[0].id",""),g=()=>{a.replace(v(Le,{projectId:h,pipelineReleaseId:R,tenantId:l}))},[_,p]=A.useState(""),[E,b]=A.useState([]),I=qe(_.trim(),300),O=A.useRef(null),y=A.useRef(null),n=r==="my"?Number(h):void 0,{data:i,isLoading:C}=Te(h),f=(i||[]).map(T=>({value:T.id,label:T.attributes?.name||T.name||String(T.id)})),{data:j,isFetching:de,isFetchingNextPage:S,fetchNextPage:H,hasNextPage:w,error:W}=_t({projectId:n,name:I||void 0,templateChartCategoryIds:E.length>0?E:void 0,pageSize:Ct}),pe=j?.pages?.length??0;A.useEffect(()=>{const T=y.current,Q=O.current;if(!T||!Q||!w||S)return;const V=new IntersectionObserver(_e=>{_e[0]?.isIntersecting&&H()},{root:Q,rootMargin:"150px"});return V.observe(T),()=>V.disconnect()},[H,w,S,pe]);const ue=T=>{p(T.target.value)},me=T=>{b(T)};if(W){const T=W?.response?.data?.message||s("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.FAILED_TO_LOAD_CONTENT");return e.jsx(Rt,{message:T})}const Y=j?.pages??[],z=Y.flatMap(T=>T?.data?.data??[]),Re=Y[0]?.data?.pagination?.total??0,k=_.trim()!==I,K=de&&!S,Ae=!K&&!k&&z.length===0,he=!!I||E.length>0,xe=r==="explore"&&d&&d.length>0;return e.jsxs(P,{display:"flex",flexDirection:"column",minHeight:0,height:"100%",gap:4,children:[e.jsx(ut,{viewMode:r,total:Re,searchValue:_,selectedCategoryIds:E,categoryOptions:f,isCategoriesLoading:C,onSearchChange:ue,onCategoryChange:me}),xe&&e.jsx(Je,{hasButton:!0,variant:"warning",buttonStyle:{minWidth:120,backgroundColor:"#F79F08"},buttonText:s("MARKET_TEMPLATE.REPORT_TEMPLATE_ALERT.BTN_CONTINUE_SETUP")||"Continue Setup",title:s("MARKET_TEMPLATE.REPORT_TEMPLATE_ALERT.TITLE","Incomplete Pipeline"),onButtonClick:g,descriptionStyle:{flex:1},description:e.jsx(c,{style:{color:"#DC6903"},children:e.jsx(Ue,{i18nKey:"MARKET_TEMPLATE.REPORT_TEMPLATE_ALERT.SUMMARY",components:{bold:e.jsx("span",{style:{fontWeight:"500",color:"#DC6903"}})}})}),sx:{backgroundColor:"#FFFAB8",border:"1px solid #F3D768",color:"#DC6903"}}),e.jsxs(c,{ref:O,flex:1,minHeight:0,pb:2,overflowY:"auto",display:"flex",flexDirection:"column",sx:{"&::-webkit-scrollbar":{display:"none"},msOverflowStyle:"none",scrollbarWidth:"none"},children:[(K||k)&&e.jsx(xt,{}),Ae&&e.jsx(mt,{viewMode:r,isFiltered:he,onCreateClick:t,canCreateTemplate:o}),e.jsx(c,{role:"list","aria-label":s("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.LIST"),sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",xl:"repeat(4, 1fr)"},columnGap:4,rowGap:6},children:!K&&!k&&z.map(T=>e.jsx(ce,{name:T.name,summary:T.summary,thumbnail:T.thumbnail,categoryNames:T.categoryNames,to:v(r==="explore"?fe:re,{templateId:T.id,tenantId:l,projectId:h})},T.id))}),w&&e.jsx(c,{ref:y,sx:{height:1,flexShrink:0}}),S&&e.jsx(P,{alignItems:"center",py:2,children:e.jsx(At,{})})]})]})}function ee(r){const{viewMode:t,onCreateClick:o,canCreateTemplate:s}=r;return e.jsx(c,{height:"100%",display:"flex",flexDirection:"column",children:e.jsx(c,{bgcolor:"#FFFFFF",borderRadius:"24px",height:"100%",display:"flex",flexDirection:"column",children:e.jsx(gt,{viewMode:t,onCreateClick:o,canCreateTemplate:s})})})}function dr(){const{t:r}=L(),{tenantId:t,projectId:o}=D(),s=He(),a=s.pathname.includes("/explore-template"),l=s.pathname.includes("/my-template"),h=q(),{isTemplateFactory:u=!1}=$e(),[m,x]=A.useState(!1),{data:d=null}=Xe({projectId:o,isTemplateFactory:u});if(!u&&l)return e.jsx(be,{});const R=[{name:r("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.EXPLORE_TEMPLATES","Explore Templates"),url:Ie,isActive:a},{name:r("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.MY_TEMPLATES","My Templates"),url:Oe,isActive:l}],g=E=>{h.push(v(E,{tenantId:t,projectId:o}))},_=u&&d?.readReportTemplate,p=u&&l&&d?.writeReportTemplate;return e.jsx(ye,{customKey:`report-template-market-place_${o}`,action:Se.workspace["read-workspace"],subject:{name:je.workspace,id:o},children:e.jsxs(ve,{children:[e.jsx(ze,{title:r("template_marketplace")}),e.jsx(Ne,{header:e.jsx(c,{sx:_?void 0:{borderBottom:`1px ${$.bd.surface.main} solid`,paddingBottom:4},children:e.jsx(De,{title:r("template_marketplace"),description:r(a?"template_marketplace.description.explore":"template_marketplace.description.my"),actions:p?e.jsx(ae,{icon:e.jsx(se,{size:"sm"}),variant:"primary",text:r("MARKET_TEMPLATE.REPORT_TEMPLATE_CREATION.CREATE")||"Create Template",onClick:()=>x(!0)}):void 0})}),content:e.jsx(c,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:e.jsxs(P,{gap:6,flexGrow:1,minHeight:0,children:[_&&e.jsx(c,{display:"flex",flexDirection:"row",alignItems:"center",position:"relative",sx:{"&:after":{content:'""',clear:"both",height:"1px",background:$.bd.surface.main,display:"initial",position:"absolute",width:"100%",bottom:0,left:0}},children:R.map(E=>e.jsx(oe,{variant:"text",onClick:()=>g(E.url),sx:{boxShadow:"none",borderRadius:0,borderBottom:E.isActive?`2px solid ${G.border.brand.border1Strong}
1`:"2px solid transparent",color:E.isActive?G.border.brand.border1Strong:G.content.neutral.neutralMedium,fontWeight:E.isActive?600:400},children:E.name},E.url))}),e.jsxs(P,{direction:"row",flexGrow:1,minHeight:0,children:[a&&e.jsx(P,{flex:1,minHeight:0,children:e.jsx(ee,{viewMode:"explore"})}),l&&e.jsx(P,{flex:1,minHeight:0,children:e.jsx(ee,{viewMode:"my",onCreateClick:()=>x(!0),canCreateTemplate:p})})]})]})})}),m&&e.jsx(pt,{open:m,onClose:()=>x(!1),onSuccess:()=>x(!1)})]})})}export{dr 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.