import{G as $,d as C,a as F,b as O,r as w,dx 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-0698dbe6.js";import{o as _}from"./yup-7a53beb8.js";import{c as E,b as N,u as P}from"./index.esm-85d015f3.js";import"./GenericThumbnailView-dca658f3.js";import"./componentStyles-91278318.js";import{P as V}from"./PageBreadCrumb-4672acbd.js";import"./ScrollableList-fc87149c.js";import"./TextArea-91c96faf.js";import{G as n}from"./Grid2-a3850bef.js";import{T as q}from"./TextField-4222c766.js";import{I as A}from"./InputAdornment-0c2174b6.js";import{F as H}from"./FilterFilled-b68f936d.js";import{F as J}from"./FilterOutlined-0ae4b12f.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})=>{C();const{userAccessList:a}=F(s=>O(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=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(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};
