import{G as $,b as C,a as F,g as O,r as w,e3 as B,eb as T,j as s,B as x,P as n,Q as u,Y as k,I as G,c as P,J as j}from"./index-d2b25495.js";import{o as E}from"./yup-267e586f.js";import{u as N}from"./index.esm-ce3c2c20.js";import"./componentStyles-0e851d91.js";/* empty css                   */import{P as R}from"./PageBreadCrumb-02480d86.js";import"./ScrollableList-fc1de312.js";import{c as _,b as J}from"./index.esm-3043d6d4.js";import{T as Q}from"./TextField-e155d2be.js";import{I as V}from"./InputAdornment-d0c3ebef.js";import{F as Y}from"./FilterFilled-4dfce120.js";import{F as q}from"./FilterOutlined-653b7cb0.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:d,handleInputChange:A,showFilterButton:b=!1,openFilter:h,filteredData:c,openModal:p,children:f})=>{C();const{userAccessList:a}=F(e=>O(e));let v=_({search:J()});const{control:H,handleSubmit:K,register:z,getValues:S}=N({resolver:E(v),values:{search:c==null?void 0:c.search}}),I=w.useCallback(B(e=>{d({search:e})},300),[d]),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:[b&&s.jsx(G,{onClick:()=>h&&h(!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(P,{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}),f]})})]})]})};export{cs as T};
