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-dc933734.js";import{o as _}from"./yup-5b2e0cf9.js";import{c as E,b as N,u as P}from"./index.esm-288e984c.js";import"./GenericThumbnailView-69a8725b.js";import"./componentStyles-4df963a1.js";import{P as V}from"./PageBreadCrumb-e8300c1b.js";import"./ScrollableList-c8354e44.js";import"./TextArea-80ac5c9b.js";import{G as n}from"./Grid2-9337452f.js";import{T as q}from"./TextField-a8016ff3.js";import{I as A}from"./InputAdornment-a4d846b9.js";import{F as H}from"./FilterFilled-5453348f.js";import{F as J}from"./FilterOutlined-7e274bb4.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};
