import{fW as C,c as $,a as O,h as w,be 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-7d3dbb9c.js";import{o as E}from"./yup-55e79238.js";import{u as G}from"./index.esm-12cc9f7b.js";import"./CustomDatepicker-6d5ad1ab.js";import"./index-b5c17d61.js";import{P as N}from"./PageBreadCrumb-6d7ee77a.js";import"./ScrollableList-ffeab0b0.js";import{c as P,b as R}from"./index.esm-9d396c5f.js";import"./SectionDivider-be0a23cf.js";import{T as _}from"./TextField-a362d747.js";import{I as K}from"./InputAdornment-bbfa18ee.js";import{F as M,a as V}from"./FilterOutlined-459a9fa1.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:h,handleInputChange:W,showFilterButton:g=!1,openFilter:x,filteredData:i,openModal:d,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(h),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=>h({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:()=>x&&x(!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;d&&d(!0),y.blur()},children:m}),v]})})]})]})};export{er as T};
