import{G as $,d as C,a as F,b as O,r as w,dr as B,aV as G,j as r,B as x,S as u,M as T,I as k,e as E,z as j}from"./index-c5c88b67.js";import{o as N}from"./yup-41605283.js";import{c as P,b as R,u as V}from"./index.esm-81620445.js";import"./GenericThumbnailView-43782201.js";import"./componentStyles-a5e5a830.js";import{P as _}from"./PageBreadCrumb-94fdb2ed.js";import"./ScrollableList-21ab2b9c.js";import"./TextArea-aad9dffe.js";import{G as n}from"./Grid2-0ff60c92.js";import{T as M}from"./TextField-78388962.js";import{I as q}from"./InputAdornment-d66117f3.js";import{F as A}from"./FilterFilled-9066fadd.js";import{F as H}from"./FilterOutlined-67649527.js";function g(t){return $({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"}}]})(t)}const ir=({permissionPostFix:t,permissionPreFix:o,navigateLink:i,showAddButton:l,addButtonName:m,handleSearch:d,handleInputChange:J,showFilterButton:f=!1,openFilter:h,filteredData:c,openModal:p,children:v})=>{C();const{userAccessList:a}=F(s=>O(s));let b=P({search:R()});const{control:K,handleSubmit:Q,register:z,getValues:S}=V({resolver:N(b),values:{search:c==null?void 0:c.search}}),I=w.useCallback(B(s=>{d({search:s})},300),[d]),e=G();return S("search"),r.jsxs(x,{sx:{borderRadius:"6px",mb:2},children:[r.jsx(x,{mb:2,children:(e==null?void 0:e.title)&&r.jsx(_,{title:e==null?void 0:e.title,subName:e==null?void 0:e.subtitle})}),r.jsxs(n,{container:!0,spacing:2,children:[r.jsx(n,{size:{xs:12,md:12,lg:4,xl:4},children:r.jsx(u,{direction:"row",spacing:1,flex:1,children:r.jsx(M,{type:"text",sx:{width:"100%"},...z("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:r.jsx(q,{position:"start",children:r.jsx(T,{size:20})})},variant:"outlined",placeholder:"Search",onChange:s=>{I(s.target.value)}})})}),r.jsx(n,{size:{xs:12,md:12,lg:8,xl:8},children:r.jsxs(u,{spacing:2,direction:"row",justifyContent:{xs:"flex-start",lg:"flex-end"},children:[f&&r.jsx(k,{onClick:()=>h&&h(!0),children:Object.values(c||{}).every(s=>s==null||s==""||s==null)?r.jsx(H,{className:"hp-mr-10",style:{fontSize:"16px"}}):r.jsx(A,{className:"hp-mr-10",style:{fontSize:"16px"}})}),(a==null?void 0:a.indexOf(`${o}.add_${t}`))!==-1&&i&&l&&r.jsx(E,{to:i,children:r.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(g,{size:14}),children:m})}),!i&&l&&(a==null?void 0:a.indexOf(`${o}.add_${t}`))!==-1&&r.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(g,{size:14}),onClick:s=>{const y=s.target;p&&p(!0),y.blur()},children:m}),v]})})]})]})};export{ir as T};
