import{G as $,b as C,a as F,h as O,r as w,e0 as B,e8 as T,j as s,B as x,Q as n,S as u,Y as k,I as G,c as E,K as j}from"./index-60a3c753.js";import{o as N}from"./yup-92678dde.js";import{u as P}from"./index.esm-c494934a.js";import"./componentStyles-7753bbb9.js";/* empty css                   */import{P as R}from"./PageBreadCrumb-fcf1e00a.js";import"./ScrollableList-1962b023.js";import{c as _,b as K}from"./index.esm-62d6b2f7.js";import{T as Q}from"./TextField-32b29087.js";import{I as V}from"./InputAdornment-96c40dce.js";import{F as Y}from"./FilterFilled-cdde02db.js";import{F as q}from"./FilterOutlined-c131dc67.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 cs=({permissionPostFix:t,permissionPreFix:o,navigateLink:i,showAddButton:l,addButtonName:m,handleSearch:h,handleInputChange:A,showFilterButton:f=!1,openFilter:d,filteredData:c,openModal:p,children:v})=>{C();const{userAccessList:a}=F(e=>O(e));let b=_({search:K()});const{control:H,handleSubmit:J,register:z,getValues:S}=P({resolver:N(b),values:{search:c==null?void 0:c.search}}),I=w.useCallback(B(e=>{h({search:e})},300),[h]),r=T();return S("search"),s.jsxs(x,{sx:{borderRadius:"6px",mb:2},children:[s.jsx(x,{mb:2,children:(r==null?void 0:r.title)&&s.jsx(R,{title:r==null?void 0:r.title,subName:r==null?void 0:r.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(Q,{type:"text",sx:{width:"100%"},...z("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:s.jsx(V,{position:"start",children:s.jsx(k,{size:20})})},variant:"outlined",placeholder:"Search",onChange:e=>{I(e.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(G,{onClick:()=>d&&d(!0),children:Object.values(c||{}).every(e=>e==null||e==""||e==null)?s.jsx(q,{className:"hp-mr-10",style:{fontSize:"16px"}}):s.jsx(Y,{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:e=>{const y=e.target;p&&p(!0),y.blur()},children:m}),v]})})]})]})};export{cs as T};
