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-d895656a.js";import{o as N}from"./yup-9573aa79.js";import{c as P,b as R,u as V}from"./index.esm-1087b2f3.js";import"./GenericThumbnailView-532ea2d7.js";import"./componentStyles-866300fe.js";import{P as _}from"./PageBreadCrumb-5e129db8.js";import"./ScrollableList-e2b22048.js";import"./TextArea-fb0d0821.js";import{G as n}from"./Grid2-5bd460ea.js";import{T as M}from"./TextField-6f73e19a.js";import{I as q}from"./InputAdornment-36977269.js";import{F as A}from"./FilterFilled-9d5acdc3.js";import{F as H}from"./FilterOutlined-b6007bf1.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};
