import{G as $,d as w,a as C,b as F,r as O,dw as B,b4 as G,j as r,B as x,S as u,_ as T,I as k,e as R,R as j}from"./index-3141de2d.js";import{o as _}from"./yup-c2fea6fa.js";import{c as E,b as N,u as P}from"./index.esm-8b0c9a99.js";import"./GenericThumbnailView-c2621934.js";import"./componentStyles-24f97919.js";import{P as V}from"./PageBreadCrumb-cf694986.js";import"./ScrollableList-fa62971d.js";import"./TextArea-ceaff311.js";import{G as n}from"./Grid2-488bb30d.js";import{T as q}from"./TextField-ec161c03.js";import{I as A}from"./InputAdornment-1680248d.js";import{F as H}from"./FilterFilled-94ea2c05.js";import{F as J}from"./FilterOutlined-d6dd1d6d.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:K,showFilterButton:b=!1,openFilter:h,filteredData:c,openModal:p,children:f})=>{w();const{userAccessList:a}=C(s=>F(s));let v=E({search:N()});const{control:M,handleSubmit:Q,register:z,getValues:S}=P({resolver:_(v),values:{search:c==null?void 0:c.search}}),I=O.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(V,{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(q,{type:"text",sx:{width:"100%"},...z("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:r.jsx(A,{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:[b&&r.jsx(k,{onClick:()=>h&&h(!0),children:Object.values(c||{}).every(s=>s==null||s==""||s==null)?r.jsx(J,{className:"hp-mr-10",style:{fontSize:"16px"}}):r.jsx(H,{className:"hp-mr-10",style:{fontSize:"16px"}})}),(a==null?void 0:a.indexOf(`${o}.add_${t}`))!==-1&&i&&l&&r.jsx(R,{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}),f]})})]})]})};export{ir as T};
