import{G as C,d as B,a as $,b as F,r as O,dE as w,b6 as G,j as r,B as u,S as j,_ as T,I as k,e as E,R as g}from"./index-aa25c5ff.js";import{o as R}from"./yup-72cc4918.js";import{c as _,b as N,u as P}from"./index.esm-a7f661dc.js";import"./GenericThumbnailView-e0343bac.js";import"./componentStyles-e32842f3.js";import{P as V}from"./PageBreadCrumb-6e4973c8.js";import"./ScrollableList-9498bc37.js";import"./TextArea-d1a16eb1.js";import{G as o}from"./Grid2-d00e0f6a.js";import{T as q}from"./TextField-55b66d20.js";import{I as A}from"./InputAdornment-1e7eea92.js";import{B as H}from"./Badge-9e87965d.js";import{F as J}from"./FilterFilled-8e291e82.js";import{F as K}from"./FilterOutlined-7f40b65c.js";function f(n){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"}}]})(n)}const or=({permissionPostFix:n,permissionPreFix:l,navigateLink:i,showAddButton:d,addButtonName:m,handleSearch:h,handleInputChange:M,showFilterButton:b=!1,openFilter:p,filteredData:c,openModal:x,children:v})=>{B();const{userAccessList:t}=$(e=>F(e));let z=_({search:N()});const{control:Q,handleSubmit:U,register:S,getValues:I}=P({resolver:R(z),values:{search:c==null?void 0:c.search}}),y=O.useCallback(w(e=>{h({search:e})},300),[h]),s=G();return I("search"),r.jsxs(u,{sx:{borderRadius:"6px",mb:2},children:[r.jsx(u,{mb:2,children:(s==null?void 0:s.title)&&r.jsx(V,{title:s==null?void 0:s.title,subName:s==null?void 0:s.subtitle})}),r.jsxs(o,{container:!0,spacing:2,children:[r.jsx(o,{size:{xs:12,md:12,lg:4,xl:4},children:r.jsx(j,{direction:"row",spacing:1,flex:1,children:r.jsx(q,{type:"text",sx:{width:"100%"},...S("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:e=>{y(e.target.value)}})})}),r.jsx(o,{size:{xs:12,md:12,lg:8,xl:8},children:r.jsxs(j,{spacing:2,direction:"row",justifyContent:{xs:"flex-start",lg:"flex-end"},children:[b&&r.jsx(k,{onClick:()=>p&&p(!0),children:(()=>{const e=Object.values(c||{}).filter(a=>a!==void 0&&a!==""&&a!==null).length;return r.jsx(H,{badgeContent:e||null,color:"error",children:e>0?r.jsx(J,{className:"hp-mr-10",style:{fontSize:"16px"}}):r.jsx(K,{className:"hp-mr-10",style:{fontSize:"16px"}})})})()}),(t==null?void 0:t.indexOf(`${l}.add_${n}`))!==-1&&i&&d&&r.jsx(E,{to:i,children:r.jsx(g,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(f,{size:14}),children:m})}),!i&&d&&(t==null?void 0:t.indexOf(`${l}.add_${n}`))!==-1&&r.jsx(g,{variant:"contained",color:"primary",size:"large",endIcon:r.jsx(f,{size:14}),onClick:e=>{const a=e.target;x&&x(!0),a.blur()},children:m}),v]})})]})]})};export{or as T};
