import{G as $,d as C,a as F,b as O,r as w,ds as B,aV as G,j as s,B as x,S as u,M as T,I as k,e as E,z as j}from"./index-4dfc510b.js";import{o as N}from"./yup-80def618.js";import{c as P,b as R,u as V}from"./index.esm-0a454763.js";import"./GenericThumbnailView-6256cad7.js";import"./componentStyles-df94248d.js";import{P as _}from"./PageBreadCrumb-59ca32fd.js";import"./ScrollableList-bef4a518.js";import"./TextArea-a0cc14f3.js";import{G as n}from"./Grid2-713975b3.js";import{T as M}from"./TextField-c0d4022e.js";import{I as q}from"./InputAdornment-ccd6e8ff.js";import{F as A}from"./FilterFilled-dc66781c.js";import{F as H}from"./FilterOutlined-6c52d192.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 is=({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(r=>O(r));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(r=>{d({search:r})},300),[d]),e=G();return S("search"),s.jsxs(x,{sx:{borderRadius:"6px",mb:2},children:[s.jsx(x,{mb:2,children:(e==null?void 0:e.title)&&s.jsx(_,{title:e==null?void 0:e.title,subName:e==null?void 0:e.subtitle})}),s.jsxs(n,{container:!0,spacing:2,children:[s.jsx(n,{size:{xs:12,md:12,lg:4,xl:4},children:s.jsx(u,{direction:"row",spacing:1,flex:1,children:s.jsx(M,{type:"text",sx:{width:"100%"},...z("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:s.jsx(q,{position:"start",children:s.jsx(T,{size:20})})},variant:"outlined",placeholder:"Search",onChange:r=>{I(r.target.value)}})})}),s.jsx(n,{size:{xs:12,md:12,lg:8,xl:8},children:s.jsxs(u,{spacing:2,direction:"row",justifyContent:{xs:"flex-start",lg:"flex-end"},children:[f&&s.jsx(k,{onClick:()=>h&&h(!0),children:Object.values(c||{}).every(r=>r==null||r==""||r==null)?s.jsx(H,{className:"hp-mr-10",style:{fontSize:"16px"}}):s.jsx(A,{className:"hp-mr-10",style:{fontSize:"16px"}})}),(a==null?void 0:a.indexOf(`${o}.add_${t}`))!==-1&&i&&l&&s.jsx(E,{to:i,children:s.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:s.jsx(g,{size:14}),children:m})}),!i&&l&&(a==null?void 0:a.indexOf(`${o}.add_${t}`))!==-1&&s.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:s.jsx(g,{size:14}),onClick:r=>{const y=r.target;p&&p(!0),y.blur()},children:m}),v]})})]})]})};export{is as T};
