import{fW as C,c as $,a as O,h as w,bd as B,j as r,B as p,K as c,M as u,a1 as F,I as T,d as k,E as j}from"./index-1350aa97.js";import{o as E}from"./yup-eafdc449.js";import{u as G}from"./index.esm-e43efa83.js";import"./CustomDatepicker-9019a583.js";import"./index-bd875dae.js";import{P as N}from"./PageBreadCrumb-7473d003.js";import"./ScrollableList-3f260516.js";import{c as P,b as R}from"./index.esm-74444d29.js";import"./SectionDivider-474af95d.js";import{T as _}from"./TextField-db0e4632.js";import{I as K}from"./InputAdornment-0139a25d.js";import{F as M,a as V}from"./FilterOutlined-57d28dd2.js";function f(a){return C({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"}}]})(a)}const er=({permissionPostFix:a,permissionPreFix:o,navigateLink:n,showAddButton:l,addButtonName:m,handleSearch:d,handleInputChange:W,showFilterButton:g=!1,openFilter:h,filteredData:i,openModal:x,children:v})=>{$();const{userAccessList:e}=O(s=>w(s));let b=P({search:R()});const{control:q,handleSubmit:z,register:S,getValues:I}=G({resolver:E(b),values:{search:i==null?void 0:i.search}}),t=B();return I("search"),r.jsxs(p,{sx:{borderRadius:"6px",mb:2},children:[r.jsx(p,{mb:2,children:r.jsx(N,{title:t==null?void 0:t.title,subName:t==null?void 0:t.subtitle})}),r.jsxs(c,{container:!0,spacing:2,children:[r.jsx(c,{size:{xs:12,md:8,lg:6,xl:4},children:r.jsx("form",{onSubmit:z(d),children:r.jsx(u,{direction:"row",spacing:1,flex:1,children:r.jsx(_,{type:"text",sx:{width:"100%"},...S("search"),id:"input-with-icon-textfield",size:"small",InputProps:{startAdornment:r.jsx(K,{position:"start",children:r.jsx(F,{size:20})})},variant:"outlined",placeholder:"Search",onChange:s=>d({search:s.target.value})})})})}),r.jsx(c,{size:{xs:12,md:4,lg:6,xl:8},children:r.jsxs(u,{spacing:2,direction:"row",justifyContent:{xs:"flex-start",md:"flex-end"},children:[g&&r.jsx(T,{onClick:()=>h&&h(!0),children:Object.values(i).every(s=>s==null||s==""||s==null)?r.jsx(V,{className:"hp-mr-10",style:{fontSize:"16px"}}):r.jsx(M,{className:"hp-mr-10",style:{fontSize:"16px"}})}),(e==null?void 0:e.indexOf(`${o}.add_${a}`))!==-1&&n&&l&&r.jsx(k,{to:n,children:r.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(f,{size:14}),children:m})}),!n&&l&&(e==null?void 0:e.indexOf(`${o}.add_${a}`))!==-1&&r.jsx(j,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(f,{size:14}),onClick:s=>{const y=s.target;x&&x(!0),y.blur()},children:m}),v]})})]})]})};export{er as T};
