biblio-react 2.0.0-alpha106 → 2.0.0-alpha108

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{forwardRef as e,createElement as o,createContext as t,useContext as r,useState as a,useMemo as n,useCallback as i,Fragment as l,useEffect as s,Children as c,cloneElement as d,isValidElement as u,useRef as m,memo as p}from"react";import g from"@mui/icons-material/Lock";import f from"@mui/icons-material/VpnLock";import{MenuItem as h,ListItemIcon as b,ListItemText as y,useMediaQuery as v,Typography as C,Box as k,alpha as x,createTheme as w,StyledEngineProvider as T,Stack as N,Tooltip as O,IconButton as R,ThemeProvider as S,CardContent as P,CircularProgress as _,Collapse as j,List as M,Divider as F,Paper as L}from"@mui/material";import{useTranslate as I,useUserMenu as B,useResourceDefinitions as E,AppBar as D,UserMenu as A,Logout as V,useDataProvider as q,useListContext as z,useNotify as $,useRedirect as W,useRefresh as H,useResourceContext as G,useUnselectAll as U,NumberField as J,DateField as Q,TextField as Y,ReferenceField as Z,useRecordContext as K,useInput as X,useGetList as ee,useSafeSetState as oe,Button as te,Confirm as re,Form as ae,SaveButton as ne,useCreatePath as ie,useResourceDefinition as le,DatagridRoot as se,DatagridClasses as ce,BulkActionsToolbar as de,SimpleList as ue,useGetOne as me,TopToolbar as pe,ListButton as ge,ShowButton as fe,required as he,minValue as be,Create as ye,useDelete as ve,useEditController as Ce,Edit as ke,useSaveContext as xe,SimpleForm as we,useSidebarState as Te,MenuItemLink as Ne,Menu as Oe,DashboardMenuItem as Re,Layout as Se,FilterContext as Pe,sanitizeListRestProps as _e,FilterButton as je,CreateButton as Me,ExportButton as Fe,useLogin as Le,TextInput as Ie,PasswordInput as Be,FieldTitle as Ee,useShowController as De,Show as Ae,FormTab as Ve,getTabbedFormTabFullPath as qe,TabbedFormTabs as ze,Toolbar as $e,defaultTheme as We,BooleanField as He,FileInput as Ge,FileField as Ue,BooleanInput as Je,ReferenceInput as Qe,useChoicesContext as Ye,AutocompleteInput as Ze,SelectInput as Ke,ReferenceArrayInput as Xe,SelectArrayInput as eo,RadioButtonGroupInput as oo,useRecordSelection as to,List as ro,Datagrid as ao,NumberInput as no,DateInput as io,DateTimeInput as lo}from"react-admin";import{Link as so,useLocation as co,matchPath as uo,useResolvedPath as mo,Routes as po,Route as go}from"react-router-dom";import fo,{string as ho,func as bo,any as yo,bool as vo}from"prop-types";import Co from"@mui/icons-material/Add";import ko from"@mui/icons-material/Cancel";import xo from"@mui/icons-material/Delete";import wo from"@mui/icons-material/Edit";import To from"@mui/material/Dialog";import No from"@mui/material/DialogActions";import Oo from"@mui/material/DialogContent";import Ro from"@mui/material/DialogContentText";import So from"@mui/material/DialogTitle";import Po from"@mui/material/Paper";import{ThemeProvider as _o,alpha as jo,styled as Mo}from"@mui/material/styles";import{makeStyles as Fo}from"@mui/styles";import{esES as Lo,DataGridPremium as Io,useGridApiContext as Bo,useGridApiRef as Eo,useKeepGroupedColumnsHidden as Do}from"@mui/x-data-grid-premium";import{useFormContext as Ao,useFormState as Vo}from"react-hook-form";import{useDispatch as qo,useSelector as zo}from"react-redux";import{useMutation as $o}from"react-query";import{GridOverlay as Wo,GridActionsCellItem as Ho}from"@mui/x-data-grid";import Go from"@mui/icons-material/Create";import Uo from"@mui/material/Divider";import Jo from"@mui/material/Tab";import Qo from"@mui/material/Tabs";import Yo from"@mui/icons-material/ChevronLeft";import Zo from"@mui/material/Typography";import{isAfter as Ko}from"date-fns";import Xo from"date-fns/locale/en-US";import et from"date-fns/locale/es";import ot from"@mui/material/IconButton";import tt from"@mui/material/Tooltip";import rt from"@mui/material/Button";import at from"@mui/icons-material/Settings";import nt from"@mui/icons-material/ExpandMore";import it from"@mui/material/Avatar";import lt from"@mui/material/Card";import st from"@mui/material/CardActions";import ct from"@mui/material/CircularProgress";import dt from"@mui/material/Menu";import ut from"@mui/material/MenuItem";import mt from"@mui/icons-material/RemoveRedEye";import pt from"ra-language-english";import gt from"@blackbox-vision/ra-language-spanish";import ft from"@mui/icons-material/Check";import ht from"@mui/icons-material/RemoveCircleOutline";import bt from"@mui/icons-material/Search";import yt from"@mui/icons-material/CheckCircle";import vt from"@mui/icons-material/ErrorOutline";import Ct from"react-draggable";import{TreeView as kt}from"devextreme-react";const xt=e((e,t)=>{const r=I(),{onClose:a}=B(),n=E(),i=n.form_59;return[n.form_275?o(h,Object.assign({component:so,ref:t},e,{key:"/form_275",to:"/form_275",onClick:a}),o(b,null,o(g,null)),o(y,null,r("pos.change_pin"))):null,i?o(h,Object.assign({component:so,ref:t},e,{key:"/form_59",to:"/form_59",onClick:a}),o(b,null,o(f,null)),o(y,null,r("pos.change_password"))):null]}),wt=()=>o(A,null,o(xt,null),o(V,null)),Tt=e=>{const t=v(e=>e.breakpoints.up("sm"));return o(D,Object.assign({},e,{color:"secondary",userMenu:o(wt,null)}),o(C,{variant:"h6",color:"inherit",sx:{flex:1,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},id:"react-admin-title"}),t&&o(k,{component:"span",sx:{flex:1}}))},Nt=t(),Ot=({children:e})=>{const[t,r]=a(!1),i=n(()=>({open:t,show:()=>r(!0),hide:()=>r(!1)}),[t]);return o(Nt.Provider,{value:i},e)},Rt=()=>r(Nt),St=(e,o,t,r)=>({type:"RELOAD_CB",payload:{id:e,method:o,params:t,callback:r}}),Pt=(e,o)=>({type:"RELOAD_CB_SUCCESS",payload:{id:e,callback:o}}),_t=(e,o)=>({type:"HIDE_INPUT",payload:{id:e,hidden:o}}),jt=(e,o)=>({type:"DISABLE_INPUT",payload:{id:e,disabled:o}}),Mt=(e,o)=>({type:"REQUIRE_INPUT",payload:{id:e,required:o}}),Ft=(e,o)=>({type:"ERROR_INPUT",payload:{id:e,error:o}}),Lt=()=>{const e=qo();return i((o,t,r,a)=>{e(St(o,t,r,a))},[e])},It=()=>{const e=qo();return i((o,t)=>{e(_t(o,t))},[e])},Bt=()=>{const e=qo();return i((o,t)=>{e(jt(o,t))},[e])},Et=()=>{const e=qo();return i((o,t)=>{e(Mt(o,t))},[e])},Dt=()=>{const e=qo();return i((o,t)=>{e(Ft(o,t))},[e])},At=(e,o)=>{const t=q(),{mutateAsync:r,isLoading:a}=$o(o=>{const{method:r,params:a}=o;return t.getJson(e,{method:r,params:a})},o);return{mutateAsync:r,isLoading:a}},Vt=e=>{const{mutateAsync:o,isLoading:t}=At(e);return[i((e,t,r)=>o({method:e,params:t},{onSuccess:r,onError:r}),[]),t]},qt=e=>({}),zt=e=>{const o=z(e),t=$(),r=W(),a=H(),n=G(e),i=U(n),[l]=Vt(n);return{ajax:l,data:o,notify:t,redirect:r,refresh:a,unselectAll:i}},$t=e=>{const o=Lt(),t=It(),r=Bt(),a=Et(),n=Dt(),i=Rt(),l=$(),s=W(),c=G(e),[d]=Vt(c);return{ajax:d,notify:l,redirect:s,recargarComboBox:o,progress:i,setHidden:t,setDisable:r,setRequire:a,setError:n,etrs:e.etrs||{}}},Wt=e=>{const o=Lt(),t=It(),r=Bt(),a=Et(),n=Dt(),l=Rt(),s=$(),c=W(),d=Ao(),u=G(e),[m]=Vt(u),p=e.etrs||{},g=e.asisEtr||{},{trigger:f}=d;return{form:d,ajax:m,notify:s,redirect:c,recargarComboBox:o,progress:l,setHidden:i((e,o)=>{t(e,o),setTimeout(()=>{f(e)})},[t,f]),setDisable:i((e,o)=>{r(e,o),setTimeout(()=>{f(e)})},[r,f]),setRequire:i((e,o)=>{a(e,o),setTimeout(()=>{f(e)})},[a,f]),setError:i((e,o)=>{n(e,o),setTimeout(()=>{f(e)})},[n,f]),etrs:p,asisEtr:g}},Ht=t({}),Gt=t(void 0),Ut=e=>{const{estado:o,isLoading:t,fichaProps:a={}}=r(Ht),{[e.source]:n={}}=a,{hidden:i=!1,...l}=e,{hidden:s,useContenido:c=qt,...d}=n,u=void 0!==s?s:i,m=c({...l,estado:o,hidden:u,isLoading:t,...d}),{hidden:p,...g}=m;if(void 0===m)throw new Error(`useContenido está devolviendo undefined para el contenido ${e.source}\n Asegúrese de incluir una instrucción return al final de la función`);return{propsContenido:{...l,...d,...g},hidden:void 0!==p?p:u}},Jt=e=>{const{tipo:t,...r}=e,{propsContenido:a,hidden:n}=Ut(r),i={...a};return!n&&("N"===t||"D"===t?o(J,i):"F"===t?o(Q,i):"Z"===t?o(Q,Object.assign({},i,{showTime:!0})):o(Y,i))},Qt=(e,t,r)=>a=>o(Z,{reference:r,source:t,queryOptions:{meta:{etr:e}},record:{[t]:a.row[t]}},o(Jt,{source:"etiqueta"})),Yt=e=>{const o={...e};return delete o.id,o},Zt=e=>{const{apiRef:o,source:t,enviarTodo:r}=e;return i((e,a)=>{const n=Yt(e),i=o.current.getRowsCount()+1;o.current.updateRows([{...n,id:i}]);const l=r?Array.from(o.current.getRowModels().values(),e=>({...e,claveFila:"",estado:"N"}))||[]:a.getValues()[t]||[];r||l.push({...n,claveFila:"",estado:"N"}),a.setValue(t,l,{shouldDirty:!0})},[o,t])},Kt=e=>{const{apiRef:o,source:t,enviarTodo:r}=e;return i((e,a,n)=>{var i,l;const s="number"==typeof e?"N":"M",c=Yt(a);o.current.updateRows([{...c,id:e}]);const d=r?Array.from(o.current.getRowModels().values(),e=>({...e,estado:s}))||[]:n.getValues()[t]||[];let u=d.findIndex(o=>o.id===e);u=-1===u?d.length:u,d[u]={...c,claveFila:"N"===(null===(i=d[u])||void 0===i?void 0:i.estado)?"":e,estado:"N"===(null===(l=d[u])||void 0===l?void 0:l.estado)?"N":"M"},n.setValue(t,d,{shouldDirty:!0})},[o,t])},Xt=e=>{const{apiRef:o,source:t,enviarTodo:r}=e;return i((e,a)=>{const n=o.current.getRowModels().get(e);o.current.updateRows([{id:e,_action:"delete"}]);const i=r?Array.from(o.current.getRowModels().values(),e=>({...e,estado:"B"}))||[]:a.getValues()[t]||[];let l=i.findIndex(o=>o.claveFila===e);l=-1===l?i.length:l,i[l]={...n,estado:"B",claveFila:e},"number"==typeof e&&i.splice(l,1),a.setValue(t,i,{shouldDirty:!0})},[o,t])},er=e=>{const{[e.source]:o}=e.useFormulario(),t={...e,enviarTodo:o.enviarTodo};return{addRow:Zt(t),editRow:Kt(t),deleteRow:Xt(t),clear:o=>{e.apiRef.current.setRows([]),o.setValue(e.source,"")},api:e.apiRef}},or=Fo(e=>({root:{"& .MuiDataGrid-columnsContainer":{backgroundColor:"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},header:{color:e.palette.secondary.contrastText,backgroundColor:e.palette.secondary.light},rootPaper:{width:"100%",height:"40vh",borderRadius:0,marginTop:e.spacing(1)},rootOverlay:{flexDirection:"column","& .ant-empty-img-1":{fill:"light"===e.palette.mode?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===e.palette.mode?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===e.palette.mode?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===e.palette.mode?"#ffffff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===e.palette.mode?"0.8":"0.08",fill:"light"===e.palette.mode?"#f5f5f5":"#ffffff"}},label:{marginTop:e.spacing(1)},deleteButton:{color:e.palette.error.main,"&:hover":{backgroundColor:x(e.palette.error.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}}}),{name:"GE"}),tr=()=>{const e=or();return o(Wo,{className:e.rootOverlay},o("svg",{width:"120",height:"100",viewBox:"0 0 184 152","aria-hidden":!0,focusable:"false"},o("g",{fill:"none",fillRule:"evenodd"},o("g",{transform:"translate(24 31.67)"},o("ellipse",{className:"ant-empty-img-5",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),o("path",{className:"ant-empty-img-1",d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"}),o("path",{className:"ant-empty-img-2",d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"}),o("path",{className:"ant-empty-img-3",d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"})),o("path",{className:"ant-empty-img-3",d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"}),o("g",{className:"ant-empty-img-4",transform:"translate(149.65 15.383)"},o("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),o("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"})))),o("div",{className:e.label},"No hay registros"))},rr=Fo(e=>({root:{"& .MuiDataGrid-columnsContainer":{backgroundColor:"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},header:{color:e.palette.secondary.contrastText,backgroundColor:e.palette.secondary.light},rootPaper:{width:"100%",height:"40vh",borderRadius:0,marginTop:e.spacing(1)},rootOverlay:{flexDirection:"column","& .ant-empty-img-1":{fill:"light"===e.palette.mode?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===e.palette.mode?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===e.palette.mode?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===e.palette.mode?"#ffffff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===e.palette.mode?"0.8":"0.08",fill:"light"===e.palette.mode?"#f5f5f5":"#ffffff"}},label:{marginTop:e.spacing(1)},deleteButton:{color:e.palette.error.main,"&:hover":{backgroundColor:x(e.palette.error.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}}}),{name:"EtrGrid"}),ar={},nr=e=>{const t=Ao();return o(Gt.Provider,{value:{form:t}},e.children)},ir=e=>o(To,{open:e.open,onClose:e.onClose,fullWidth:!0},o(So,null,`${e.labelEstado} ${e.label}`),o(Ro,{component:"span"},o(ae,{mode:"onBlur",record:ar,resource:e.resource,onSubmit:e.onSubmit},o(nr,null,e.children))));ir.propTypes={label:ho,onClick:bo,icon:yo,open:vo,onClose:bo,labelEstado:ho,resource:yo,save:bo,render:bo};const lr=e=>{const{form:t,resource:a,estado:n,editors:i,recordPadre:u,camposClaveFila:m,setOpen:p,open:g}=e,{dirtyFields:f,isValid:h}=Vo(),{fichaProps:{[e.source]:b,etrs:y}}=r(Ht),v=r(Gt),{onAfterRenderAsistente:C}=b,k=Wt({resource:a,etrs:y,asisEtr:v});return s(()=>{g&&"function"==typeof C&&C({...k,form:t})},[g]),o(l,null,o(Oo,null,o(N,{spacing:4},c.map(i,(e,o)=>d(e,{resource:a,estado:n,defaultValue:u[e.props.source]||"",fullWidth:!0,sx:{margin:0},disabled:"N"!==n&&-1!==m.indexOf(e.props.source),...b[e.props.source]})))),o(No,null,o(ne,{disabled:0===Object.keys(f).length||!h}),o(te,{label:"ra.action.cancel",onClick:e=>{p(!1),e.stopPropagation()}},o(ko,null))))},sr=e=>{const{editors:t,record:r,camposClaveFila:a,label:n,source:i,enviarTodo:s}=e,[c,d]=oe(!1),u=G(e),m=Ao(),p=Bo(),g=Zt({apiRef:p,source:i,enviarTodo:s}),f=I()("ra.action.create");return o(l,null,o(te,{onClick:e=>{d(!0),e.stopPropagation()}},o(Co,null)),o(ir,{open:c,onClose:e=>{d(!1),e.stopPropagation()},labelEstado:f,label:n,resource:u,onSubmit:(e,o)=>{g(e,m),d(!1)}},o(lr,{source:i,form:m,resource:u,estado:"N",editors:t,recordPadre:r||{},camposClaveFila:a,open:c,setOpen:()=>{d(!1)}})))},cr=e=>{const{editors:t,camposClaveFila:r,resource:a,label:n,source:i,row:s,enviarTodo:c}=e,d=I(),[u,m]=oe(!1),p=Bo(),g=Ao(),f=Kt({apiRef:p,source:i,enviarTodo:c}),h=d("ra.action.edit");return o(l,null,o(te,{onClick:e=>{m(!0),e.stopPropagation()}},o(wo,null)),o(ir,{open:u,onClose:e=>{m(!1),e.stopPropagation()},labelEstado:h,label:n,resource:a,onSubmit:(e,o)=>{f(s.id,e,g),m(!1)}},o(lr,{source:i,form:g,resource:a,estado:"M",editors:t,recordPadre:s,camposClaveFila:r,open:u,setOpen:()=>{m(!1)}})))},dr=e=>{const{confirmTitle:t="ra.message.delete_title",confirmContent:r="ra.message.delete_content",row:a,source:n,enviarTodo:i}=e,s=rr(e),[c,d]=oe(!1),u=Bo(),m=Ao(),p=Xt({apiRef:u,source:n,enviarTodo:i});return o(l,null,o(te,{key:"button",onClick:e=>{d(!0),e.stopPropagation()},className:s.deleteButton},o(xo,null)),o(re,{isOpen:c,title:t,content:r,onConfirm:e=>{p(a.id,m)},onClose:e=>{d(!1),e.stopPropagation()}}))},ur=w({},Lo),mr=e=>{const{filterBy:t="",claves:i,sortModel:s,columns:c,reference:d,allowAdd:u=!0,allowRemove:m=!0,enableLoad:p=!0,apiRef:g,...f}=e,[h,b]=a([]),y=K(e),{field:v}=X({defaultValue:"",...e}),C=rr(e),{isLoading:k,fichaProps:{[f.source]:x}}=r(Ht),{enviarTodo:w=!1}=x,[N,O]=a(s),[{field:R,sort:S}]=s;let P={};y&&t.split(",").forEach(e=>{e&&(P[e]=[{type:"string",comparison:"eq",value:y[e],field:e}])});const{isLoading:_}=ee(d,{pagination:{page:1,perPage:200},sort:{field:R,order:S},filter:P},{enabled:p&&!k,onSuccess:e=>{b((null==e?void 0:e.data)||[])}}),j=[...c,{field:" ",width:80,headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(cr,Object.assign({},f,{enviarTodo:w,camposClaveFila:i,row:e.row}))}];u&&j.unshift({field:"BTN",headerName:"",sortable:!1,renderHeader:e=>o(sr,Object.assign({},f,{enviarTodo:w,camposClaveFila:i}))}),m&&j.push({field:" ",headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(dr,Object.assign({},f,{enviarTodo:w,camposClaveFila:i,row:e.row}))});const M=n(()=>j,[JSON.stringify(j)]);return o(Po,{className:C.rootPaper},o(T,{injectFirst:!0},o(_o,{theme:ur},o(l,null,o(Io,Object.assign({apiRef:g,loading:_||k,className:C.root,disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,rows:h,columns:M,sortModel:N,onSortModelChange:e=>O(e),sortable:!1,resizable:!1,disableReorder:!0,disableExport:!0,filterable:!1,disableColumnMenu:!0,components:{NoRowsOverlay:tr}},f)),o("input",Object.assign({type:"hidden"},v))))))},pr=w({},Lo),gr=e=>{const{filterBy:t="",sortModel:i,columns:l,reference:s,enableLoad:c=!0,initialState:d,...u}=e,m=or(e),{isLoading:p}=r(Ht),g=K(),[f,h]=a(i),[{field:b,sort:y}]=i,v=n(()=>[...l],[JSON.stringify(l)]);let C={};g&&t.split(",").forEach(e=>{e&&(C[e]=[{type:"string",comparison:"eq",value:g[e],field:e}])});const{estado:k,isLoading:x,fichaProps:w={}}=r(Ht),N=Wt(e),{[e.source]:O={}}=w,{useContenido:R=qt,restInitialProps:S}=O,{data:P=[],isLoading:_,refetch:j}=ee(s,{pagination:{page:1,perPage:200},sort:{field:b,order:y},filter:C},{enabled:c&&!p}),M=Eo(),F=Do({apiRef:M,initialState:d});return R({...u,estado:k,hidden:e.hidden,isLoading:x,utils:N,...S,refetch:j,apiRef:M}),o(Po,{className:m.rootPaper},o(T,{injectFirst:!0},o(_o,{theme:pr},o(Io,Object.assign({apiRef:M,rows:P,columns:v,loading:_||p,className:m.root,disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,sortModel:f,onSortModelChange:e=>h(e),components:{NoRowsOverlay:tr},initialState:F},u)))))},fr=e=>{const{alignIcon:t="left",children:r,className:a,disabled:n,label:i,color:l="primary",size:s="small",to:c,...d}=e,u=I(),m=i?u(i,{_:i}):void 0,p=hr(c);return i&&!n?o(O,{title:m},o(R,Object.assign({"aria-label":m,className:a,color:l,size:"large"},d,p),r)):o(R,Object.assign({className:a,color:l,disabled:n,size:"large"},d,p),r)};fr.propTypes={alignIcon:fo.oneOf(["left","right"]),children:fo.element,className:fo.string,color:fo.oneOfType([fo.oneOf(["inherit","default","primary","secondary","error","info","success","warning"]),fo.string]),disabled:fo.bool,label:fo.string,size:fo.oneOf(["small","medium","large"])};const hr=e=>{if(null==e)return;if("string"==typeof e)return{to:e};const{redirect:o,replace:t,state:r,...a}=e;return{to:a,redirect:o,replace:t,state:r}},br=e=>e.stopPropagation(),yr={true:{_scrollToTop:!0},false:{}},vr=o(Co,null),Cr=e=>{const{icon:t=vr,label:r="ra.action.create",scrollToTop:a=!0,...n}=e,i=G(e),l=K(e),s=ie();return o(fr,Object.assign({component:so,to:s({type:"create",resource:i}),state:{record:l,...yr[String(a)]},label:r,onClick:br},n),t)},kr=e=>e.stopPropagation(),xr={true:{_scrollToTop:!0},false:{}},wr=o(Go,null),Tr=e=>{const{icon:t=wr,label:r="ra.action.edit",scrollToTop:a=!0,...n}=e,i=G(e),l=K(e),s=ie();return l?o(fr,Object.assign({component:so,to:s({type:"edit",resource:i,id:l.id}),state:xr[String(a)],label:r,onClick:kr},n),t):null},Nr=(e,o)=>void 0===o||"function"==typeof o&&o(e),Or=w({},Lo),Rr=new Map([["is","is"],["not","not"],["after","after"],["onOrAfter","onOrAfter"],["before","before"],["onOrBefore","onOrBefore"],["eq","="],["neq","!="],["gt",">"],["gte",">="],["lt","<"],["lte","<="],["contains","contains"],["equals","equals"],["sw","startsWith"],["ew","endsWith"],["isEmpty","isEmpty"],["isNotEmpty","isNotEmpty"],["isAnyOf","isAnyOf"]]),Sr=new Map(Array.from(Rr,e=>[e[1],e[0]])),Pr=e=>e.items.reduce((e,o)=>(void 0!==o.field&&o.operator&&(Sr.has(o.operator)?e[`${o.field}_${Sr.get(o.operator)}`]=o.value:e[o.field]=o.value),e),{}),_r=e=>{const{actionButtons:t=[],bulkActionButtons:r,sx:a,columns:n,isRowEditable:i,desktopSize:l=!1,hasEdit:s,initialState:c,convertFilterModelToFilterValues:d=Pr,claveNuevo:m,...p}=e,g=zt(e),f=I(),h=G(e),{data:b=[],isLoading:y,selectedIds:v,onSelect:C,displayedFilters:x,setFilters:w}=z(),T=Eo(),N=Do({apiRef:T,initialState:{...c,pinnedColumns:{right:["actions"]}}}),O=n.map((e,o)=>({...e,headerName:""!==e.headerName?f(`resources.${h}.fields.${e.field}`,{_:e.headerName}):e.headerName})),R=t.length>0||s?O.concat([{field:"actions",type:"actions",width:100,hideable:!1,getActions:e=>{const r=T.current.getRowNode(e.id);return e.row.id?[...s?[o(Tr,{record:e.row,disabled:!Nr(e.row,i)})]:[],...t.map(t=>{const{handler:r,...a}=t;return o(Ho,Object.assign({showInMenu:!0,onClick:o=>"function"==typeof r&&r({...g,record:e.row},a.key)},a))})]:-1!==r.children[0].indexOf(m+"=")?[o(Cr,{record:m?{[m]:r.children[0].split(m+"=")[1].replaceAll("[","").trim().split("AND")[0].trim()}:void 0})]:[]}}]):O,P=u(r);return o(se,{sx:a,className:ce.root},P?o(de,{selectedIds:v},r):null,o(k,{sx:{height:"70vh",width:"100%"},className:ce.tableWrapper},o(S,{theme:Or},o(Io,Object.assign({sx:{display:"grid",gridTemplateRows:"auto 1fr auto"},columns:R,rows:b,apiRef:T,loading:y,hideFooterSelectedRowCount:!0,hideFooter:!0,disableMultipleRowSelection:!0,checkboxSelection:P,filterMode:"server",onFilterModelChange:e=>{w(d(e),x)},rowSelectionModel:v,onRowSelectionModelChange:e=>{y||(T.current.isRowSelected(e[0])?C([]):C(e))},isRowSelectable:e=>e.row.id,initialState:N},p)))))},jr=e=>{const{sx:t,columns:r,hasEdit:a,isRowEditable:n,primaryText:i,secondaryText:l}=e,s=r.length;let c=i,d=l;return i||(s>=4?c=e=>`${e[r[0].field]} - ${e[r[0].field]}`:s>=3||s>=2?c=e=>`${e[r[0].field]} - ${e[r[1].field]}`:1===s&&(c=e=>e[r[0].field])),l||(s>=4?d=e=>`${e[r[2].field]} - ${e[r[3].field]}`:s>=3?d=e=>e[r[2].field]:s>=2?c=e=>`${e[r[0].field]} - ${e[r[1].field]}`:1===s&&(c=e=>e[r[0].field])),o(ue,{linkType:e=>!(!a||!Nr(e,n))&&"edit",primaryText:c,secondaryText:d,sx:t})},Mr=e=>{const t=v(e=>e.breakpoints.down("md")),{hasEdit:r}=le(e);(e=>{const{onRenderGrilla:o,onLoadGrilla:t}=e,{isLoading:r}=z(),a=zt(e);s(()=>{o&&o(a)},[]),s(()=>{r||t&&t(a)},[r])})(e);const{desktopSize:a=!1}=e;return o(t&&!1===a?jr:_r,Object.assign({},e,{hasEdit:r}))},Fr=e=>{const{filterValues:t,setFilters:r,tabs:{ids:a,...n},GridComponent:i=Mr,...s}=e,c=t.id;return o(l,null,o(Qo,{value:c,indicatorColor:"primary",onChange:(e,o)=>{r({...t,id:o})}},a.map(e=>o(Jo,{key:e,label:e.charAt(0).toUpperCase()+e.slice(1),value:e}))),o(Uo,null),o(i,Object.assign({},s,n[c])))},Lr=e=>{const{useFormulario:o=qt,...t}=e;return{fichaProps:{...o(t),etrs:t.etrs}}},Ir=(e,o)=>me(e,{id:"-1"},o),Br=e=>e.split("_")[1],Er=Fo(e=>({form:{maxHeight:"70vh",overflow:"auto"},tab:{display:"block",maxHeight:"65vh",overflow:"auto"},contenido:{[e.breakpoints.up("xs")]:{width:"100%"},[e.breakpoints.up("md")]:{width:"12vw","&.MuiAutocomplete-root":{width:"16vw"}}}})),Dr=/^\d{2}\/\d{2}\/\d{4}$/,Ar=e=>{if(!(e instanceof Date)||isNaN(e.getDate()))return"";const o=e.getFullYear().toString(),t=(e.getMonth()+1).toString(),r=e.getDate().toString();return`${o}-${("00"+t).slice(-2)}-${("00"+r).slice(-2)}`},Vr=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Ar(e);if(Dr.test(e)){const o=e.split("/");return o[2]+"-"+o[1]+"-"+o[0]}return Ar(new Date(e))},qr=e=>{if(!e)return"";const o=e.split("-");return o[2]+"/"+o[1]+"/"+o[0]},zr=/^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/,$r=e=>{if(null==e||""===e)return"";if(e instanceof Date)return Ar(e);if(zr.test(e)){const o=e.split(" "),t=o[0].split("/");return t[2]+"-"+t[1]+"-"+t[0]+" "+o[1]}return Ar(new Date(e))},Wr=e=>{if(!e)return"";const o=e.split("T"),t=o[0].split("-");return t[2]+"/"+t[1]+"/"+t[0]+" "+o[1]},Hr=e=>{if(!e)return"";if(e instanceof Date)return e.toString();if(-1!==e.indexOf(":")){const o=e.split(":");let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}{const o=/(\d{2}):(\d{2})/.exec(e);if(null===o)return;let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}},Gr=(e,o)=>e?e.split(" ")[4].substring(0,5):"",Ur=e=>o(Zo,{variant:"h6",gutterBottom:!0},e.children),Jr=({children:e,className:t,data:r,hasShow:a,hasList:n=!0,...i})=>o(pe,Object.assign({className:t},(({...e})=>e)(i)),e,n&&o(ge,{label:"ra.action.back",icon:o(Yo,null)}),a&&o(fe,{record:r})),Qr=he(),Yr=[Qr,be(1)],Zr={inputFormat:"dd/MM/yyyy"},Kr=e=>(o,t)=>{const r=t[e];if(o&&r){const e=new Date(r.split("/").reverse().join("/")),t=new Date(o.split("/").reverse().join("/"));if(Ko(e,t))return{message:"validation.greater_or_equal",args:{menor:r}}}},Xr=(e="es")=>({locale:"en"===e?Xo:et}),ea=[{id:"1",name:"Aprobado"},{id:"2",name:"Rechazado"},{id:"3",name:"Pendiente"}],oa=(e,o)=>{const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.setAttribute("href",e),t.setAttribute("download",o),t.click()},ta=(e,o)=>{const t=G(),{data:r,isLoading:a,error:n}=me("cb_"+Br(t)+"_"+e,{id:o});return a||n?"":(null==r?void 0:r.etiqueta)||""},ra=e=>{const{useFormulario:t=qt,enableLoad:r=!0,...a}=e,i=G(e),{data:l,isLoading:s}=Ir(i,{enabled:r}),{fichaProps:c}=Lr(e),d=n(()=>({estado:"N",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Ot,null,o(Ht.Provider,{value:d},o(ye,Object.assign({redirect:"list"},a,null==c?void 0:c.panel))))};function aa(e){var o,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(o=0;o<e.length;o++)e[o]&&(t=aa(e[o]))&&(r&&(r+=" "),r+=t);else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}function na(){for(var e,o,t=0,r="";t<arguments.length;)(e=arguments[t++])&&(o=aa(e))&&(r&&(r+=" "),r+=o);return r}ra.propTypes={useFormulario:fo.func};const ia=Fo(e=>({deleteButton:{color:e.palette.error.main,"&:hover":{backgroundColor:jo(e.palette.error.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}}})),la=e=>{const t=ia(e),r=I(),{resource:a,className:n,icon:i,label:l="ra.action.delete",...s}=e,c=K(),[d,{isLoading:u}]=ve(a,{id:c.id});return o(tt,{title:r("ra.action.delete")},o(ot,Object.assign({disabled:u,onClick:()=>d(),label:l,className:na("ra-delete-button",t.deleteButton,n),key:"button"},(({...e})=>e)(s),{size:"large"}),i))};la.defaultProps={redirect:"list",icon:o(xo,null)};const sa=e=>{const o={};for(const t in e)"string"==typeof e[t]&&0===e[t].trim().length||(null==e[t]&&(e[t]=""),o[t]=e[t]);return o},ca=e=>{const{useFormulario:t=qt,mutationMode:r="pessimistic",...a}=e,i=Ce({mutationMode:r,...a}),{record:l,isLoading:s}=i,{fichaProps:c}=Lr(e),d=n(()=>({estado:"M",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(Ot,null,o(Ht.Provider,{value:d},o(ke,Object.assign({mutationMode:r,transform:sa},a,null==c?void 0:c.panel))))},da=e((e,t)=>{const{isOpen:r,onConfirm:a,onClose:n,title:i,dialogText:l,children:s,hasAccept:c=!0,hasCancel:d=!0,isLoading:u=!1}=e,m=e=>{n&&n(e)};return o(To,{ref:t,open:r,fullWidth:!0,onClose:m,"aria-labelledby":"form-dialog-title"},o(So,{id:"form-dialog-title"},i),o(Oo,null,o(Ro,null,l),s),(c||d)&&o(No,null,d&&o(rt,{onClick:m,variant:"contained",color:"secondary",sx:{margin:1},disabled:u},"Cancelar"),c&&o(rt,{onClick:e=>{a&&a(e)},variant:"contained",color:"primary",sx:{margin:1},disabled:u},"Ok")))}),ua=Fo(e=>({block:{pointerEvents:"none",backgroundColor:"#ffffff",opacity:.6,position:"relative"},progress:{position:"absolute",left:"50%",top:"50%"}})),ma=e=>{const t=ua(e),a=Rt(),n=G(e),{estado:i,isLoading:l,initialValues:c,fichaProps:d}=r(Ht),u=Wt({resource:n,etrs:d.etrs});return s(()=>{d.onRenderFicha&&d.onRenderFicha(u,i)},[]),s(()=>{l||d.onLoadFicha&&d.onLoadFicha(u,i,c)},[l]),o(P,{className:a.open?t.block:"",sx:e.sx},a.open&&o(_,{className:t.progress,thickness:4,size:50}),e.children)},pa=()=>{},ga=e=>{const{fichaProps:{onBeforeSubmitFicha:o}}=r(Ht),t=$t(e),a=$(),{save:n}=xe(),l=i(async e=>{const r=o&&await o({form:{getValues:()=>e},...t},"N");return"string"==typeof r?void a(r,{type:"error"}):void 0===r||r?n(e):void 0},[o,a,pa,n]);return"function"==typeof o?l:void 0},fa=e=>{const{initialValues:t,fichaProps:{config:a={}}}=r(Ht),n=ga(e);return t?o(we,Object.assign({mode:"onBlur"},e,{onSubmit:n,defaultValues:t,component:ma},a)):null};fa.propTypes={...we.propTypes};const ha=e=>{const{handleToggle:t,isOpen:r,name:a,icon:n,children:i,dense:l}=e,s=I(),[c]=Te(),d=o(h,{dense:l,onClick:t},o(b,{sx:{minWidth:5}},r?o(nt,null):n),o(C,{variant:"inherit",color:"textSecondary"},s(a)));return o("div",null,c||r?d:o(O,{title:s(a),placement:"right"},d),o(j,{in:r,timeout:"auto",unmountOnExit:!0},o(M,{dense:l,component:"div",disablePadding:!0,sx:{paddingLeft:e.children.props.children[0].key.startsWith("menu")?4:0,"& a":{transition:"padding-left 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",paddingLeft:c?4:2}}},i)))},ba=e=>{const{items:t,translate:r,...a}=e,{state:n,handleToggle:i,dense:l}=a;return t&&o("div",null,t.map(e=>{const{name:t,menu:s,label:c,icon:d="settings"}=e;return s?o(ha,{key:t,name:c,handleToggle:()=>i(t),isOpen:n[t],icon:o(at,null),dense:l},ba({items:s,translate:r,...a})):o(Ne,{key:t,to:"/"+t,primaryText:r(`resources.${t}.name`,{_:c}),dense:l,leftIcon:o(at,null)})}))},ya=({dense:e=!1})=>{const t=I(),[r,n]=a({mnuPrueba:!1}),i=v(e=>e.breakpoints.down("sm")),[l]=Te(),s=JSON.parse(localStorage.getItem("menus")),c=ba({items:s,handleToggle:e=>{n(o=>({...o,[e]:!o[e]}))},state:r,activeClassName:"",iconClass:"",className:"",open:l,dense:e,translate:t});return o(k,{sx:{width:l?230:50,marginTop:1,marginBottom:1,transition:e=>e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}},o(Oe,null,o(Re,{primaryText:t("ra.page.dashboard")}),c,i&&o(Ne,{to:"/configuration",primaryText:t("pos.configuration"),leftIcon:o(at,null),dense:e})))};var va=e=>o(Se,Object.assign({},e,{appBar:Tt,menu:ya}));const Ca=(e,o)=>{alert("Falta implementar la función jsBotonGrilla")},ka=e=>{const{className:t,filters:a,children:i,hideFilterButton:l=!1,jsBotonGrilla:s=Ca,...u}=e,{sort:m,displayedFilters:p,filterValues:g,exporter:f,showFilter:h,total:b}=z(e),y=G(e),{hasCreate:v}=le(e),C=r(Pe)||a,k=z(e),x={...zt(e),...k};return n(()=>o(pe,Object.assign({className:t},_e(u)),l?null:a?d(a,{resource:y,showFilter:h,displayedFilters:p,filterValues:g,context:"button"}):C&&o(je,null),v&&o(Me,null),!1!==f&&o(Fe,{disabled:0===b,resource:y,sort:m,filterValues:g}),c.map(i,(e,o)=>d(e,{onClick:e.props.options?null:o=>{e.props.onClick&&e.props.onClick(o),s(x,e.key)},options:e.props.options?e.props.options.map(o=>({...o,onClick:t=>{e.props.onClick&&e.props.onClick(t),s(x,o.key)}})):null}))),[y,p,g,a,h,C,b,t,m,l,f,v])},xa=Fo(e=>({main:{display:"flex",flexDirection:"column",minHeight:"100vh",alignItems:"center",justifyContent:"flex-start",backgroundImage:({loginBackgroundImage:e})=>e,backgroundRepeat:"no-repeat",backgroundSize:"cover"},card:{minWidth:300,marginTop:"6em"},avatar:{margin:"1em",display:"flex",justifyContent:"center"},avatarIcon:{backgroundColor:e.palette.secondary.main},icon:({textLength:o})=>({position:"absolute",left:e.spacing(14-Math.ceil(o/2)-1)}),hint:{marginTop:"1em",display:"flex",justifyContent:"center",color:e.palette.grey[500]},form:{padding:"0 1em 1em 1em"},input:{marginTop:"1em"},actions:{padding:"0 1em 1em 1em"}})),wa=e=>{const{loginBackgroundImage:t,nameSource:r="username",passwordSource:n="password"}=e,[i,l]=a(!1),s=I(),c=s("ra.auth.sign_in"),d=xa({loginBackgroundImage:t,textLength:c.length}),u=$(),m=Le(),p=co();return o(ae,{onSubmit:e=>{l(!0),m(e,p.state?p.state.nextPathname:"/").catch(e=>{l(!1),u("string"==typeof e?e:void 0!==e&&e.message?e.message:"ra.auth.sign_in_error",{type:"error",messageArgs:{_:"string"==typeof e?e:e&&e.message?e.message:void 0}})})},validate:e=>{const o={};return e[r]||(o[r]=s("ra.validation.required")),e[n]||(o[n]=s("ra.validation.required")),o}},o("div",{className:d.main},o(lt,{className:d.card},o("div",{className:d.avatar},o(it,{className:d.avatarIcon},o(g,null))),o("div",{className:d.hint},"Inicio de Sesión"),o("div",{className:d.form},o("div",{className:d.input},o(Ie,{autoFocus:!0,name:r,label:s("ra.auth.username"),disabled:i})),o("div",{className:d.input},o(Be,{name:n,label:s("ra.auth.password"),type:"password",disabled:i}))),o(st,{className:d.actions},o(rt,{variant:"contained",type:"submit",color:"primary",disabled:i,fullWidth:!0},i&&o(ct,{className:d.icon,size:18,thickness:2}),c)))))},Ta=Fo({root:{display:"inline-block"},paddingRight:{paddingRight:4}}),Na=e=>{var t;const{className:r,options:n=[],icon:i,label:l,disabled:s,...c}=e,[d,u]=a(!1),p=m(),[g,f]=a(0),h=Ta(e),b=G(e);return o("div",Object.assign({className:na(h.root,r)},(({...e})=>e)(c)),o(te,{size:"large",className:"add-filter",label:l,onClick:e=>{e.preventDefault(),u(!0),p.current=e.currentTarget},title:n[g].label,disabled:s},(null===(t=n[g])||void 0===t?void 0:t.icon)||i),o(dt,{open:d,anchorEl:p.current,onClose:e=>{p.current&&p.current.contains(e.target)||u(!1)}},n.map((e,t)=>o(ut,{key:e.label,disabled:e.disabled,selected:t===g,onClick:o=>{((e,o)=>{f(o),u(!1)})(0,t),e.onClick&&e.onClick(o,t)},resource:b,title:e.label},e.icon,o("span",{className:h.paddingRight}),o(Ee,{label:e.label,resource:b})))))},Oa=e=>{const{fields:t,className:r,...a}=e,{campos:n,separador:i="",secundario:l=[],hasSecundario:s}=t,c=K(),d=n.map(e=>void 0!==c[e]?c[e]:e).join(""+i);return o(Zo,Object.assign({noWrap:!0,variant:"inherit",className:r},a),d,s&&o(Zo,{component:"span",display:"block",color:"textSecondary",variant:"caption"},l.map(e=>`${e.etiqueta||"---"}: ${c[e.campo]||"---"}`).join(" ")))},Ra=e=>{const{useFormulario:t=qt,...r}=e,a=De(r),{record:i,isLoading:l}=a,{fichaProps:s}=Lr(e),c=n(()=>({estado:"M",initialValues:i,isLoading:l,fichaProps:s}),[i,l,s]);return o(Ot,null,o(Ht.Provider,{value:c},o(Ae,Object.assign({},r,a,null==s?void 0:s.panel))))},Sa=e=>{const{icon:t=_a,label:r="ra.action.show",scrollToTop:a=!0,...n}=e,i=G(e),l=K(e),s=ie();return l?o(fr,Object.assign({component:so,to:s({type:"show",resource:i,id:l.id}),state:Pa[String(a)],label:r,onClick:ja},n),t):null},Pa={true:{_scrollToTop:!0},false:{}},_a=o(mt,null),ja=e=>e.stopPropagation();Sa.propTypes={icon:fo.element,label:fo.string,record:fo.any,scrollToTop:fo.bool};const Ma=p(Sa,(e,o)=>e.resource===o.resource&&(e.record&&o.record?e.record.id===o.record.id:e.record==o.record)&&e.label===o.label&&e.disabled===o.disabled),Fa=e=>{const{children:t,className:n,component:i=Ia,formRootPathname:l,syncWithLocation:s=!0,tabs:m=La,toolbar:p=Ba,onChange:g,...f}=e,h=co(),b=mo(""),y=G(e),[v,C]=a(0),{fichaProps:{etrs:k}}=r(Ht),x=Wt({...e,etrs:k}),{estado:w}=r(Ht),T=(e,o)=>{s||(C(o),g&&g(x,w,{newTab:o,prevTab:v,setTab:C},e))},N=()=>d(m,{onChange:T,syncWithLocation:s,url:l,value:v},t);return o(Ea,Object.assign({className:na("tabbed-form",n)},Da(f)),s?o(po,null,o(go,{path:"/*",element:N()})):N(),o(F,null),o(i,null,c.map(t,(e,o)=>{if(!e)return null;const t=qe(e,o),r=s?!uo(`${b.pathname}/${t}`,h.pathname):v!==o;return u(e)?d(e,{intent:"content",resource:y,hidden:r,value:s?t:o}):null})),!1!==p?p:null)},La=o(ze,null),Ia=({children:e})=>o(P,null,e),Ba=o($e,null),Ea=Mo("div",{name:"RaTabbedForm",overridesResolver:(e,o)=>o.root})(({theme:e})=>({"& .MuiTab-root.RaTabbedForm-errorTabButton":{color:e.palette.error.main}})),Da=({...e})=>e,Aa=e=>{const{...t}=e,r=(()=>{const e=co(),o=uo(":resource/create/*",e.pathname),t=uo(":resource/:id/*",e.pathname);return o?o.pathnameBase:t?t.pathnameBase:""})();return o(ae,Object.assign({formRootPathname:r},t),o(Fa,Object.assign({formRootPathname:r},Va(e))))};Aa.Tab=Ve;const Va=({...e})=>e,qa=e=>{const{initialValues:t,fichaProps:{config:a={}}}=r(Ht),n=ga(e);return t?o(Aa,Object.assign({mode:"onBlur"},e,{onSubmit:n,defaultValues:t,component:ma},a)):null};qa.defaultProps={syncWithLocation:!1};const za={...We,palette:{...We.palette,mode:"dark"},components:{...We.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}};var $a={__proto__:null,lightTheme:{...We,palette:{...We.palette,mode:"light"},components:{...We.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}},darkTheme:za};pt.ra.page.empty="No records yet";const Wa={...pt,login:{id:"ID",hint:"Login",required:"Insert Username or ID",send:"Send",email:"Enter your email address",check_email:"Check your email inbox, we just send you a verification code!",must_enter_credentials:"You must first enter Username or ID",restore_password:"Restore Password",punch_in:"Punch In"},pos:{search:"Search",change_pin:"Change Pin",change_password:"Change Password",configuration:"Configuration",language:"Language",theme:{name:"Theme",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Welcome",subtitle:"Employee Management",aor_button:"Metiri WebSite"}}},validation:{greater_or_equal:"Must be greater than or equal to %{menor}"}};gt.ra.notification.created="Datos guardados correctamente",gt.ra.action.bulk_actions="1 seleccionado |||| %{smart_count} seleccionados",gt.ra.page.dashboard="Inicio",gt.ra.page.empty="Sin registros todavía",gt.ra.page.invite="¿Quiere agregar uno?",gt.ra.page.list="%{name}",gt.ra.page.edit="Editar %{name}",gt.ra.action.back="Volver",gt.ra.message.delete_title="Eliminar",gt.ra.input.file.upload_single="Seleccione o arrastre archivo";const Ha={...gt,login:{id:"Cédula",hint:"Inicio de Sesión",required:"Ingrese Usuario o Cédula",email:"Ingrese su email aquí",send:"Enviar",check_email:"Revisa tu correo electrónico, te enviaremos un código de verificación!",must_enter_credentials:"Debe ingresar Nº de Usuario o Cédula y Contraseña primero",restore_password:"Restablecer Contraseña",punch_in:"Generar Marcas"},pos:{search:"Búsqueda",change_pin:"Cambiar Pin",change_password:"Cambiar Contraseña",configuration:"Configuración",language:"Lenguaje",theme:{name:"Tema Visual",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Bienvenid@",subtitle:"Gestión de Funcionarios",aor_button:"Sitio de Metiri"}}},validation:{greater_or_equal:"Debe ser mayor o igual a %{menor}"}},Ga=e=>{const{propsContenido:t,hidden:r}=Ut(e),a=K(),n=JSON.parse(JSON.stringify(a)),i=n[e.source];return n[e.source]=""!=i&&"0"!=i,!r&&o(He,Object.assign({},t,{record:n}))},Ua=e=>{const{source:o}=e,{estado:t,isLoading:a,fichaProps:n={}}=r(Ht),i=r(Gt),l=void 0!==i,s=zo(e=>{const t=e.configInputs?e.configInputs.filter(e=>e.id===o):[];return t[0]?t[0]:null}),{disabled:c,hidden:d,required:u,error:p}=s||{},g=!0===u?Qr:void 0,f="function"==typeof p?p:()=>p,{[o]:h={},etrs:b}=n,{onFocus:y,onChange:v,onBlur:C,hidden:k=!1,disabled:x=!1,validate:w,...T}=e,{field:N}=X(e),{onFocus:O,onBlur:R,onChange:S,hidden:P,disabled:_,useContenido:j=qt,validate:M,...F}=h,L=l||void 0===P?k:P,I=l||void 0===_?x:_,B=l||void 0===O?y:O,E=l||void 0===R?C:R,D=l||void 0===S?v:S,A=Wt({...e,etrs:b,asisEtr:i}),V=j({...T,estado:t,hidden:L,isLoading:a,utils:A,...F}),q=m(N.value);if(void 0===V)throw new Error(`useContenido está devolviendo undefined para el contenido ${o}\n Asegúrese de incluir una instrucción return al final de la función`);const{hidden:z,disabled:$,onFocus:W,onChange:H,onBlur:G,validate:U,...J}=V,Q=W||B,Y=G||E,Z=H||D,K={...A,prev:q.current};return{propsContenido:{sx:{m:1},onFocus:e=>{Q&&B(A,t,e),q.current=e.target.value},onBlur:e=>Y&&Y(K,t,e),onChange:e=>Z&&Z(K,t,e),helperText:!1,validate:[...Array.isArray(w)?w:[w],...Array.isArray(M)?M:[M],...Array.isArray(U)?U:[U],g,f].filter(e=>void 0!==e),...T,...F,...J,disabled:void 0!==c?c:void 0!==$?$:I},hidden:void 0!==d?d:void 0!==z?z:L}},Ja=e=>{const{propsContenido:t,hidden:r}=Ua(e),{options:a={},disabled:n=!1,...i}=t,l=K();return!r&&o(Ge,Object.assign({accept:"",maxSize:5e6},i,{options:{disabled:n,...a}}),o(Ue,{source:t.source,title:"Ver",record:l}))},Qa=e=>{const{propsContenido:{sx:t,...r},hidden:a}=Ua(e);return!a&&o(Je,Object.assign({},r,{sx:{...t,display:"inline-flex",margin:1}}))},Ya=e((e,t)=>o(O,Object.assign({ref:t},e))),Za=e=>{var t;const{callback:r,sx:a,isTC:n,onChange:i,...l}=e,{isLoading:c,allChoices:d}=Ye(),u=m(null);return s(()=>{c||"function"==typeof r&&r(Object.values([d]))},[d,r,c]),o(Ya,{title:(null===(t=u.current)||void 0===t?void 0:t.value)||"",placement:"top",arrow:!0},o(k,{component:"span",sx:n?{margin:1,...a}:{display:{md:"inline-flex"},margin:1,...a},width:n?{}:{xs:"100%",md:"auto"}},o(Ze,Object.assign({size:"small",sx:n?{width:"100% !important"}:{}},l,{onChange:e=>{i({target:{value:e}})},TextFieldProps:{inputRef:u}}))))},Ka=e=>{const{propsContenido:t,hidden:r}=Ua(e),a=qo(),{source:n,reference:i}=e,l=zo(e=>{const o=e.reload_cb?e.reload_cb.filter(e=>e.id===n):[];return o[0]?o[0]:null}),c=m(l),d=null===l&&c.current?c.current:l;let u,p;if(d){const{callback:e,...o}=d;u=e,p=o}return s(()=>{null!==l&&(c.current=l,a(Pt(n)))},[JSON.stringify(l)]),r?null:o(Qe,{reference:i,source:n,perPage:500,filter:p},o(Za,Object.assign({},t,{callback:u,optionText:"etiqueta",optionValue:n})))},Xa=e=>{const{propsContenido:t,hidden:r}=Ua(e);return!r&&o(Ke,t)},en=e=>{const{title:t,source:r,src:a}=e,n=K(e);return o(it,{title:t,src:`${a}/${n[r]}`})},on=e=>{const{propsContenido:t,hidden:r}=Ua(e),{source:a,reference:n}=e;return r?null:o(Xe,{source:a,reference:n},o(eo,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},tn=e=>{const{propsContenido:t,hidden:r}=Ua(e);return!r&&o(Be,t)},rn=e=>{const{propsContenido:t,hidden:a}=Ua(e),{isLoading:n}=r(Ht),{source:i,reference:l}=e;return n||a?null:o(Qe,{source:i,reference:l},o(oo,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},an=e=>{const{propsContenido:t,hidden:r}=Ua(e);return!r&&o(oo,t)},nn=Fo(e=>({confirmPrimary:{color:e.palette.primary.main},confirmWarning:{color:e.palette.error.main,"&:hover":{backgroundColor:jo(e.palette.error.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}},iconPaddingStyle:{paddingRight:"0.5em"}}),{name:"RaConfirm"}),ln=e=>o(Ct,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(L,e)),sn={cursor:"move"},cn=e=>{const{isOpen:t,isLoading:r,title:a,content:n,cancel:l,confirmColor:s,ConfirmIcon:c,CancelIcon:d,onClose:u,onConfirm:m,contentResource:p,translateOptions:g={}}=e,f=nn(e),h=I(),[b]=to(p),y=i((e,o)=>{e.stopPropagation(),m(e,b)},[b,m]),v=i(e=>{e.stopPropagation()},[]);return o(To,{open:t,onClose:u,onClick:v,fullWidth:!0,maxWidth:"lg",PaperComponent:ln,"aria-labelledby":"draggable-dialog-title"},o(So,{style:sn,id:"draggable-dialog-title"},h(a,{_:a,...g})),o(Oo,{dividers:!0},n),o(No,null,o(rt,{disabled:r,onClick:u},o(d,{className:f.iconPaddingStyle}),h(l,{_:l})),o(rt,{disabled:r,onClick:e=>y(e,"yes"),className:na("ra-confirm",{[f.confirmWarning]:"warning"===s,[f.confirmPrimary]:"primary"===s}),autoFocus:!0},o(c,{className:f.iconPaddingStyle}),h("ra.action.confirm"))))};cn.propTypes={cancel:fo.string,classes:fo.object,confirm:fo.string,confirmColor:fo.string,ConfirmIcon:fo.elementType,CancelIcon:fo.elementType,content:fo.node.isRequired,isOpen:fo.bool,isLoading:fo.bool,onClose:fo.func.isRequired,onConfirm:fo.func.isRequired,title:fo.string.isRequired},cn.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:yt,CancelIcon:vt,isOpen:!1};const dn=()=>o(l,null),un={seleccion:[],all:!0,none:!1},mn=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,pn=e=>e,gn=e=>{const{disabled:t,asistant:r,asistantResource:n,label:c,source:d,sx:u,...m}=e,[p,g]=a(!1),f=Ao();s(()=>{b()},[]);const h=i(()=>{g(!1)},[g]),b=e=>{f.setValue(d,{seleccion:[],all:!0,none:!1})};return o(l,null,o(k,{display:"flex",alignItems:"center",sx:{...u,display:"inline-flex",margin:1}},o(Ie,Object.assign({defaultValue:un},m,{source:d,label:c,disabled:!0,parse:pn,format:mn,helperText:!1,InputProps:{endAdornment:o(l,null,o(ot,{onClick:e=>{f.setValue(d,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(ht,null)),o(ot,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(ft,null)),o(ot,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(bt,null)))}}))),o(cn,{isOpen:p,title:"Selección de "+c,contentResource:n,content:o(r,{bulkActionButtons:o(dn,null),hasCreate:!1,exporter:!1,resource:n}),onConfirm:(e,o)=>{g(!1),f.setValue(d,{seleccion:o,all:!1,none:!1})},onClose:h}))},fn=e=>o(ro,Object.assign({},e,{hasCreate:!1,exporter:!1,perPage:50,empty:!1,title:" ",disableSyncWithLocation:!0}),o(ao,{bulkActionButtons:o("span",null)},o(Y,{source:"funced",sortable:!0,label:"Cédula"}),o(Y,{source:"funpriape",sortable:!0,label:"Apellido"}),o(Y,{source:"funprinom",sortable:!0,label:"Nombre"}))),hn={fillista:"empcod=-1"},bn=e=>{const[t,r]=a(hn),n=q(),l=i(e=>{r({fillista:e.node.key})},[r]),s=i(e=>n.getChildNodes("form_224",{parentId:e?e.itemData.id:""}).then(e=>e.data).catch(()=>{throw new Error("Data Loading Error")}),[n]);return o(k,{display:"flex",flex:1,alignItems:"flex-start",height:"20em"},o(k,{flexGrow:1},o(kt,{id:"funcionarios-treeview",dataStructure:"plain",rootValue:"",onItemClick:l,createChildren:s})),o(k,{flexGrow:2},o(fn,{resource:"form_224",filter:t})))},yn=Fo(e=>({confirmPrimary:{color:e.palette.primary.main},confirmWarning:{color:e.palette.error.main,"&:hover":{backgroundColor:jo(e.palette.error.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}},iconPaddingStyle:{paddingRight:"0.5em"}}),{name:"RaConfirm"}),vn=e=>o(Ct,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(L,e)),Cn={cursor:"move"},kn=e=>{const{isOpen:t,isLoading:r,title:a,cancel:n,confirmColor:l,ConfirmIcon:s,CancelIcon:c,onClose:d,onConfirm:u,translateOptions:m={}}=e,p=yn(e),g=I(),f=i((e,o)=>{e.stopPropagation(),u(e,o)},[u]),h=i(e=>{e.stopPropagation()},[]);return o(To,{open:t,onClose:d,onClick:h,fullWidth:!0,maxWidth:"lg",PaperComponent:vn,"aria-labelledby":"draggable-dialog-title"},o(So,{style:Cn,id:"draggable-dialog-title"},g(a,{_:a,...m})),o(Oo,{dividers:!0},o(bn,null)),o(No,null,o(rt,{disabled:r,onClick:d},o(c,{className:p.iconPaddingStyle}),g(n,{_:n})),o(rt,{disabled:r,onClick:e=>f(e,"yes"),className:na("ra-confirm",{[p.confirmWarning]:"warning"===l,[p.confirmPrimary]:"primary"===l}),autoFocus:!0},o(s,{className:p.iconPaddingStyle}),g("ra.action.confirm"))))};kn.propTypes={cancel:fo.string,classes:fo.object,confirm:fo.string,confirmColor:fo.string,ConfirmIcon:fo.elementType,CancelIcon:fo.elementType,isOpen:fo.bool,isLoading:fo.bool,onClose:fo.func.isRequired,onConfirm:fo.func.isRequired,title:fo.string.isRequired},kn.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:yt,CancelIcon:vt,isOpen:!1};const xn={seleccion:[],all:!0,none:!1},wn=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,Tn=e=>e,Nn=e=>{const{disabled:t,label:r="Funcionarios",allowNone:n=!0,source:c,sx:d,...u}=e,[m]=to("form_224"),[p,g]=a(!1),f=Ao();s(()=>{b()},[]);const h=i(()=>{g(!1)},[g]),b=e=>{f.setValue(c,{seleccion:[],all:!0,none:!1})};return o(l,null,o(k,{display:"flex",alignItems:"center",sx:{...d,display:"inline-flex",margin:1}},o(Ie,Object.assign({defaultValue:xn},u,{source:c,label:r,disabled:!0,parse:Tn,format:wn,helperText:!1,InputProps:{endAdornment:o(l,null,n&&o(ot,{onClick:e=>{f.setValue(c,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(ht,null)),o(ot,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(ft,null)),o(ot,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(bt,null)))}}))),o(kn,{isOpen:p,title:"Selección de "+r,onConfirm:(e,o)=>{g(!1),f.setValue(c,{seleccion:m,all:!1,none:!1})},onClose:h}))},On=e=>{const{propsContenido:t,hidden:r}=Ua(e);return!r&&o(Ie,Object.assign({multiline:!0},t))},Rn=e=>{const{tipo:t,...r}=e,{propsContenido:a,hidden:n}=Ua(r),i=Ao();s(()=>{a.value&&i.setValue(e.source,a.value)});const l={...a};return n?null:"N"===t||"D"===t?o(no,l):"F"===t?o(io,l):"Z"===t?o(lo,l):o(Ie,"H"===t?Object.assign({},l,{type:"time"}):l)},Sn=e=>{const{source:t,label:r,sx:a}=e,{hidden:n}=Ua(e);return n?null:o(k,{sx:{...a,display:"inline-flex",alignItems:"flex-start",marginLeft:1,marginBottom:-1,width:{xs:"100%",md:"calc(24vw + 1em)"}}},o(Ie,Object.assign({},e,{label:"",source:t,sx:{flex:1,marginTop:1}})),o(Ka,Object.assign({},e,{source:t,label:r,isTC:!0,sx:{flex:3}})))};export{Tt as AppBar,Ga as BooleanField,Ja as Camino,Qa as CheckBox,Ka as ComboBox,Xa as ComboBoxManual,ra as CreateEtriek,Cr as CreateGridButton,la as DeleteButtonNoWarning,ca as EditEtriek,Tr as EditGridButton,mr as EtrGrid,Jr as FichaActions,Ht as FichaContext,kn as FiltroFuncionarios,da as FormDialog,fa as FormEtriek,gr as GE,fr as GridButton,Mr as GrillaEtriek,en as ImageField,va as Layout,ka as ListActionsEtriek,on as ListCheck,wa as Login,ya as Menu,Na as MenuButton,Oa as MultiTextField,tn as Password,rn as RadioButton,an as RadioButtonManual,Ur as Separador,Ra as ShowEtriek,Ma as ShowGridButton,ha as SubMenu,Nn as TBSF,qa as TabbedFormEtriek,Fr as TabbedGrillaEtriek,On as TextArea,Rn as TextBox,gn as TextBoxSelection,Sn as TextCombo,Jt as TextField,ea as choicesEstado,Vr as dateFormat,Zr as dateFormatOptions,qr as dateParser,$r as dateTimeFormat,Wr as dateTimeParser,Pt as deleteRecargarComboBox,oa as descargarLink,Wa as enMessages,Ha as esMessages,Kr as etrFechaMayorQue,Qr as etrRequerido,Yr as etrRequeridoNumerico,Br as getFormcodFromResource,Xr as localeOptions,St as recargarComboBox,Qt as renderCellComboBox,jt as setDisableAction,Ft as setErrorAction,_t as setHiddenAction,Mt as setRequireAction,$a as themes,Hr as timeFormat,Gr as timeParser,Vt as useAjax,Ua as useContenidoController,er as useEtrActions,Ut as useFieldController,Rt as useFormProgress,ga as useFormSubmit,At as useGetJson,Lr as useInitFicha,Ir as useNuevo,ta as useReferenceLabel,Er as useStylesContenidos,Wt as useUtils,zt as useUtilsGrilla,$t as useUtilsSubmit};
1
+ import{forwardRef as e,createElement as o,createContext as t,useContext as n,useState as r,useMemo as i,useCallback as a,Fragment as l,useEffect as s,Children as c,cloneElement as d,isValidElement as u,useRef as m,memo as p}from"react";import g from"@mui/icons-material/Lock";import f from"@mui/icons-material/VpnLock";import{MenuItem as h,ListItemIcon as b,ListItemText as v,useMediaQuery as y,Typography as C,Box as x,alpha as w,createTheme as k,StyledEngineProvider as T,Stack as O,Tooltip as R,IconButton as S,ThemeProvider as P,CardContent as N,CircularProgress as F,Collapse as _,List as j,Divider as M,Paper as E}from"@mui/material";import{useTranslate as L,useUserMenu as I,useResourceDefinitions as D,AppBar as A,UserMenu as B,Logout as V,useDataProvider as q,useListContext as z,useNotify as $,useRedirect as W,useRefresh as H,useResourceContext as G,useUnselectAll as U,NumberField as J,DateField as Q,TextField as Y,ReferenceField as Z,Button as K,useRecordContext as X,useInput as ee,useGetList as oe,useSafeSetState as te,Confirm as ne,Form as re,SaveButton as ie,useCreatePath as ae,useResourceDefinition as le,DatagridRoot as se,DatagridClasses as ce,BulkActionsToolbar as de,SimpleList as ue,useGetOne as me,TopToolbar as pe,ListButton as ge,ShowButton as fe,required as he,minValue as be,useSaveContext as ve,Create as ye,useDelete as Ce,useEditController as xe,Edit as we,SimpleForm as ke,useSidebarState as Te,MenuItemLink as Oe,Menu as Re,DashboardMenuItem as Se,Layout as Pe,FilterContext as Ne,sanitizeListRestProps as Fe,FilterButton as _e,CreateButton as je,ExportButton as Me,useLogin as Ee,TextInput as Le,PasswordInput as Ie,FieldTitle as De,useShowController as Ae,Show as Be,FormTab as Ve,getTabbedFormTabFullPath as qe,TabbedFormTabs as ze,Toolbar as $e,defaultTheme as We,BooleanField as He,FileInput as Ge,FileField as Ue,BooleanInput as Je,ReferenceInput as Qe,useChoicesContext as Ye,AutocompleteInput as Ze,SelectInput as Ke,ReferenceArrayInput as Xe,SelectArrayInput as eo,RadioButtonGroupInput as oo,useRecordSelection as to,List as no,Datagrid as ro,NumberInput as io,DateInput as ao,DateTimeInput as lo}from"react-admin";import{Link as so,useLocation as co,matchPath as uo,useResolvedPath as mo,Routes as po,Route as go}from"react-router-dom";import{styled as fo,ThemeProvider as ho}from"@mui/material/styles";import bo,{string as vo,func as yo,any as Co,bool as xo}from"prop-types";import wo from"@mui/icons-material/Add";import ko from"@mui/icons-material/Cancel";import To from"@mui/icons-material/Delete";import Oo from"@mui/icons-material/Edit";import Ro from"@mui/material/Dialog";import So from"@mui/material/DialogActions";import Po from"@mui/material/DialogContent";import No from"@mui/material/DialogContentText";import Fo from"@mui/material/DialogTitle";import _o from"@mui/material/Paper";import{esES as jo,DataGridPremium as Mo,useGridApiContext as Eo,useGridApiRef as Lo,useKeepGroupedColumnsHidden as Io}from"@mui/x-data-grid-premium";import{useFormContext as Do,useFormState as Ao}from"react-hook-form";import{useDispatch as Bo,useSelector as Vo}from"react-redux";import{useMutation as qo}from"react-query";import{GridActionsCellItem as zo}from"@mui/x-data-grid";import $o from"@mui/icons-material/Create";import Wo from"@mui/material/Divider";import Ho from"@mui/material/Tab";import Go from"@mui/material/Tabs";import Uo from"@mui/icons-material/ChevronLeft";import Jo from"@mui/material/Typography";import"@mui/styles";import{isAfter as Qo}from"date-fns";import Yo from"date-fns/locale/en-US";import Zo from"date-fns/locale/es";import Ko from"@mui/material/IconButton";import Xo from"@mui/material/Tooltip";import et from"@mui/material/Button";import ot from"@mui/icons-material/Settings";import tt from"@mui/icons-material/ExpandMore";import nt from"@mui/material/Avatar";import rt from"@mui/material/Card";import it from"@mui/material/CardActions";import at from"@mui/material/CircularProgress";import lt from"@mui/material/Menu";import st from"@mui/material/MenuItem";import ct from"@mui/icons-material/RemoveRedEye";import dt from"ra-language-english";import ut from"@blackbox-vision/ra-language-spanish";import mt from"@mui/icons-material/Check";import pt from"@mui/icons-material/RemoveCircleOutline";import gt from"@mui/icons-material/Search";import ft from"@mui/icons-material/CheckCircle";import ht from"@mui/icons-material/ErrorOutline";import bt from"react-draggable";import{TreeView as vt}from"devextreme-react";const yt=e((e,t)=>{const n=L(),{onClose:r}=I(),i=D(),a=i.form_59;return[i.form_275?o(h,Object.assign({component:so,ref:t},e,{key:"/form_275",to:"/form_275",onClick:r}),o(b,null,o(g,null)),o(v,null,n("pos.change_pin"))):null,a?o(h,Object.assign({component:so,ref:t},e,{key:"/form_59",to:"/form_59",onClick:r}),o(b,null,o(f,null)),o(v,null,n("pos.change_password"))):null]}),Ct=()=>o(B,null,o(yt,null),o(V,null)),xt=e=>{const t=y(e=>e.breakpoints.up("sm"));return o(A,Object.assign({},e,{color:"secondary",userMenu:o(Ct,null)}),o(C,{variant:"h6",color:"inherit",sx:{flex:1,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},id:"react-admin-title"}),t&&o(x,{component:"span",sx:{flex:1}}))},wt=t(),kt=({children:e})=>{const[t,n]=r(!1),a=i(()=>({open:t,show:()=>n(!0),hide:()=>n(!1)}),[t]);return o(wt.Provider,{value:a},e)},Tt=()=>n(wt),Ot=(e,o,t,n)=>({type:"RELOAD_CB",payload:{id:e,method:o,params:t,callback:n}}),Rt=(e,o)=>({type:"RELOAD_CB_SUCCESS",payload:{id:e,callback:o}}),St=(e,o)=>({type:"HIDE_INPUT",payload:{id:e,hidden:o}}),Pt=(e,o)=>({type:"DISABLE_INPUT",payload:{id:e,disabled:o}}),Nt=(e,o)=>({type:"REQUIRE_INPUT",payload:{id:e,required:o}}),Ft=(e,o)=>({type:"ERROR_INPUT",payload:{id:e,error:o}}),_t=()=>{const e=Bo();return a((o,t,n,r)=>{e(Ot(o,t,n,r))},[e])},jt=()=>{const e=Bo();return a((o,t)=>{e(St(o,t))},[e])},Mt=()=>{const e=Bo();return a((o,t)=>{e(Pt(o,t))},[e])},Et=()=>{const e=Bo();return a((o,t)=>{e(Nt(o,t))},[e])},Lt=()=>{const e=Bo();return a((o,t)=>{e(Ft(o,t))},[e])},It=(e,o)=>{const t=q(),{mutateAsync:n,isLoading:r}=qo(o=>{const{method:n,params:r}=o;return t.getJson(e,{method:n,params:r})},o);return{mutateAsync:n,isLoading:r}},Dt=e=>{const{mutateAsync:o,isLoading:t}=It(e);return[a((e,t,n)=>o({method:e,params:t},{onSuccess:n,onError:n}),[]),t]},At=e=>({}),Bt=e=>{const o=z(e),t=$(),n=W(),r=H(),i=G(e),a=U(i),[l]=Dt(i);return{ajax:l,data:o,notify:t,redirect:n,refresh:r,unselectAll:a}},Vt=e=>{const o=_t(),t=jt(),n=Mt(),r=Et(),i=Lt(),a=Tt(),l=$(),s=W(),c=G(e),[d]=Dt(c);return{ajax:d,notify:l,redirect:s,recargarComboBox:o,progress:a,setHidden:t,setDisable:n,setRequire:r,setError:i,etrs:e.etrs||{}}},qt=e=>{const o=_t(),t=jt(),n=Mt(),r=Et(),i=Lt(),l=Tt(),s=$(),c=W(),d=Do(),u=G(e),[m]=Dt(u),p=e.etrs||{},g=e.asisEtr||{},{trigger:f}=d;return{form:d,ajax:m,notify:s,redirect:c,recargarComboBox:o,progress:l,setHidden:a((e,o)=>{t(e,o),setTimeout(()=>{f(e)})},[t,f]),setDisable:a((e,o)=>{n(e,o),setTimeout(()=>{f(e)})},[n,f]),setRequire:a((e,o)=>{r(e,o),setTimeout(()=>{f(e)})},[r,f]),setError:a((e,o)=>{i(e,o),setTimeout(()=>{f(e)})},[i,f]),etrs:p,asisEtr:g}},zt=t({}),$t=t(void 0),Wt=e=>{const{estado:o,isLoading:t,fichaProps:r={}}=n(zt),{[e.source]:i={}}=r,{hidden:a=!1,...l}=e,{hidden:s,useContenido:c=At,...d}=i,u=void 0!==s?s:a,m=c({...l,estado:o,hidden:u,isLoading:t,...d}),{hidden:p,...g}=m;if(void 0===m)throw new Error(`useContenido está devolviendo undefined para el contenido ${e.source}\n Asegúrese de incluir una instrucción return al final de la función`);return{propsContenido:{...l,...d,...g},hidden:void 0!==p?p:u}},Ht=e=>{const{tipo:t,...n}=e,{propsContenido:r,hidden:i}=Wt(n),a={...r};return!i&&("N"===t||"D"===t?o(J,a):"F"===t?o(Q,a):"Z"===t?o(Q,Object.assign({},a,{showTime:!0})):o(Y,a))},Gt=(e,t,n)=>r=>o(Z,{reference:n,source:t,queryOptions:{meta:{etr:e}},record:{[t]:r.row[t]}},o(Ht,{source:"etiqueta"})),Ut=e=>{const o={...e};return delete o.id,o},Jt=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r)=>{const i=Ut(e),a=o.current.getRowsCount()+1;o.current.updateRows([{...i,id:a}]);const l=n?Array.from(o.current.getRowModels().values(),e=>({...e,claveFila:"",estado:"N"}))||[]:r.getValues()[t]||[];n||l.push({...i,claveFila:"",estado:"N"}),r.setValue(t,l,{shouldDirty:!0})},[o,t])},Qt=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r,i)=>{var a,l;const s="number"==typeof e?"N":"M",c=Ut(r);o.current.updateRows([{...c,id:e}]);const d=n?Array.from(o.current.getRowModels().values(),e=>({...e,estado:s}))||[]:i.getValues()[t]||[];let u=d.findIndex(o=>o.id===e);u=-1===u?d.length:u,d[u]={...c,claveFila:"N"===(null===(a=d[u])||void 0===a?void 0:a.estado)?"":e,estado:"N"===(null===(l=d[u])||void 0===l?void 0:l.estado)?"N":"M"},i.setValue(t,d,{shouldDirty:!0})},[o,t])},Yt=e=>{const{apiRef:o,source:t,enviarTodo:n}=e;return a((e,r)=>{const i=o.current.getRowModels().get(e);o.current.updateRows([{id:e,_action:"delete"}]);const a=n?Array.from(o.current.getRowModels().values(),e=>({...e,estado:"B"}))||[]:r.getValues()[t]||[];let l=a.findIndex(o=>o.claveFila===e);l=-1===l?a.length:l,a[l]={...i,estado:"B",claveFila:e},"number"==typeof e&&a.splice(l,1),r.setValue(t,a,{shouldDirty:!0})},[o,t])},Zt=e=>{const{[e.source]:o}=e.useFormulario(),t={...e,enviarTodo:o.enviarTodo};return{addRow:Jt(t),editRow:Qt(t),deleteRow:Yt(t),clear:o=>{e.apiRef.current.setRows([]),o.setValue(e.source,"")},api:e.apiRef}},Kt=fo("div")(({theme:e})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%","& .ant-empty-img-1":{fill:"light"===e.palette.mode?"#aeb8c2":"#262626"},"& .ant-empty-img-2":{fill:"light"===e.palette.mode?"#f5f5f7":"#595959"},"& .ant-empty-img-3":{fill:"light"===e.palette.mode?"#dce0e6":"#434343"},"& .ant-empty-img-4":{fill:"light"===e.palette.mode?"#fff":"#1c1c1c"},"& .ant-empty-img-5":{fillOpacity:"light"===e.palette.mode?"0.8":"0.08",fill:"light"===e.palette.mode?"#f5f5f5":"#fff"}})),Xt=()=>o(Kt,null,o("svg",{width:"120",height:"100",viewBox:"0 0 184 152","aria-hidden":!0,focusable:"false"},o("g",{fill:"none",fillRule:"evenodd"},o("g",{transform:"translate(24 31.67)"},o("ellipse",{className:"ant-empty-img-5",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"}),o("path",{className:"ant-empty-img-1",d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z"}),o("path",{className:"ant-empty-img-2",d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z"}),o("path",{className:"ant-empty-img-3",d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z"})),o("path",{className:"ant-empty-img-3",d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z"}),o("g",{className:"ant-empty-img-4",transform:"translate(149.65 15.383)"},o("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"}),o("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"})))),o(x,{sx:{mt:1}},"No hay registros")),en=fo(K,{name:"EtrDeleteButton",overridesResolver:(e,o)=>o.root})(({theme:e})=>({color:e.palette.primary.main,"&:hover":{backgroundColor:w(e.palette.primary.main,.12),"@media (hover: none)":{backgroundColor:"transparent"}}})),on={},tn=e=>{const t=Do();return o($t.Provider,{value:{form:t}},e.children)},nn=e=>o(Ro,{open:e.open,onClose:e.onClose,fullWidth:!0},o(Fo,null,`${e.labelEstado} ${e.label}`),o(No,{component:"span"},o(re,{mode:"onBlur",record:on,resource:e.resource,onSubmit:e.onSubmit},o(tn,null,e.children))));nn.propTypes={label:vo,onClick:yo,icon:Co,open:xo,onClose:yo,labelEstado:vo,resource:Co,save:yo,render:yo};const rn=e=>{const{form:t,resource:r,estado:i,editors:a,recordPadre:u,camposClaveFila:m,setOpen:p,open:g}=e,{dirtyFields:f,isValid:h}=Ao(),{fichaProps:{[e.source]:b,etrs:v}}=n(zt),y=n($t),{onAfterRenderAsistente:C}=b,x=qt({resource:r,etrs:v,asisEtr:y});return s(()=>{g&&"function"==typeof C&&C({...x,form:t})},[g]),o(l,null,o(Po,null,o(O,{spacing:4},c.map(a,(e,o)=>d(e,{resource:r,estado:i,defaultValue:u[e.props.source]||"",fullWidth:!0,sx:{margin:0},disabled:"N"!==i&&-1!==m.indexOf(e.props.source),...b[e.props.source]})))),o(So,null,o(ie,{disabled:0===Object.keys(f).length||!h}),o(K,{label:"ra.action.cancel",onClick:e=>{p(!1),e.stopPropagation()}},o(ko,null))))},an=e=>{const{editors:t,record:n,camposClaveFila:r,label:i,source:a,enviarTodo:s}=e,[c,d]=te(!1),u=G(e),m=Do(),p=Eo(),g=Jt({apiRef:p,source:a,enviarTodo:s}),f=L()("ra.action.create");return o(l,null,o(K,{onClick:e=>{d(!0),e.stopPropagation()}},o(wo,null)),o(nn,{open:c,onClose:e=>{d(!1),e.stopPropagation()},labelEstado:f,label:i,resource:u,onSubmit:(e,o)=>{g(e,m),d(!1)}},o(rn,{source:a,form:m,resource:u,estado:"N",editors:t,recordPadre:n||{},camposClaveFila:r,open:c,setOpen:()=>{d(!1)}})))},ln=e=>{const{editors:t,camposClaveFila:n,resource:r,label:i,source:a,row:s,enviarTodo:c}=e,d=L(),[u,m]=te(!1),p=Eo(),g=Do(),f=Qt({apiRef:p,source:a,enviarTodo:c}),h=d("ra.action.edit");return o(l,null,o(K,{onClick:e=>{m(!0),e.stopPropagation()}},o(Oo,null)),o(nn,{open:u,onClose:e=>{m(!1),e.stopPropagation()},labelEstado:h,label:i,resource:r,onSubmit:(e,o)=>{f(s.id,e,g),m(!1)}},o(rn,{source:a,form:g,resource:r,estado:"M",editors:t,recordPadre:s,camposClaveFila:n,open:u,setOpen:()=>{m(!1)}})))},sn=e=>{const{confirmTitle:t="ra.message.delete_title",confirmContent:n="ra.message.delete_content",row:r,source:i,enviarTodo:a}=e,[s,c]=te(!1),d=Eo(),u=Do(),m=Yt({apiRef:d,source:i,enviarTodo:a});return o(l,null,o(en,{key:"button",onClick:e=>{c(!0),e.stopPropagation()}},o(To,null)),o(ne,{isOpen:s,title:t,content:n,onConfirm:e=>{m(r.id,u)},onClose:e=>{c(!1),e.stopPropagation()}}))},cn=k({},jo),dn=e=>{const{filterBy:t="",claves:a,sortModel:s,columns:c,reference:d,allowAdd:u=!0,allowRemove:m=!0,enableLoad:p=!0,apiRef:g,...f}=e,[h,b]=r([]),v=X(e),{field:y}=ee({defaultValue:"",...e}),{isLoading:C,fichaProps:{[f.source]:x}}=n(zt),{enviarTodo:w=!1}=x,[k,O]=r(s),[{field:R,sort:S}]=s;let P={};v&&t.split(",").forEach(e=>{e&&(P[e]=[{type:"string",comparison:"eq",value:v[e],field:e}])});const{isLoading:N}=oe(d,{pagination:{page:1,perPage:200},sort:{field:R,order:S},filter:P},{enabled:p&&!C,onSuccess:e=>{b((null==e?void 0:e.data)||[])}}),F=[...c,{field:" ",width:80,headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(ln,Object.assign({},f,{enviarTodo:w,camposClaveFila:a,row:e.row}))}];u&&F.unshift({field:"BTN",headerName:"",sortable:!1,renderHeader:e=>o(an,Object.assign({},f,{enviarTodo:w,camposClaveFila:a}))}),m&&F.push({field:" ",headerName:"",headerAlign:"center",sortable:!1,disableClickEventBubbling:!0,renderCell:e=>o(sn,Object.assign({},f,{enviarTodo:w,camposClaveFila:a,row:e.row}))});const _=i(()=>F,[JSON.stringify(F)]);return o(_o,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(T,{injectFirst:!0},o(ho,{theme:cn},o(l,null,o(Mo,Object.assign({apiRef:g,loading:N||C,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,rows:h,columns:_,sortModel:k,onSortModelChange:e=>O(e),sortable:!1,resizable:!1,disableReorder:!0,disableExport:!0,filterable:!1,disableColumnMenu:!0,slots:{noRowsOverlay:Xt}},f)),o("input",Object.assign({type:"hidden"},y))))))},un=k({},jo),mn=e=>{const{filterBy:t="",sortModel:a,columns:l,reference:s,enableLoad:c=!0,initialState:d,...u}=e,{isLoading:m}=n(zt),p=X(),[g,f]=r(a),[{field:h,sort:b}]=a,v=i(()=>[...l],[JSON.stringify(l)]);let y={};p&&t.split(",").forEach(e=>{e&&(y[e]=[{type:"string",comparison:"eq",value:p[e],field:e}])});const{estado:C,isLoading:x,fichaProps:w={}}=n(zt),k=qt(e),{[e.source]:O={}}=w,{useContenido:R=At,restInitialProps:S}=O,{data:P=[],isLoading:N,refetch:F}=oe(s,{pagination:{page:1,perPage:200},sort:{field:h,order:b},filter:y},{enabled:c&&!m}),_=Lo(),j=Io({apiRef:_,initialState:d});return R({...u,estado:C,hidden:e.hidden,isLoading:x,utils:k,...S,refetch:F,apiRef:_}),o(_o,{sx:{width:"100%",height:"40vh",borderRadius:0,marginTop:1}},o(T,{injectFirst:!0},o(ho,{theme:un},o(Mo,Object.assign({apiRef:_,rows:P,columns:v,loading:N||m,sx:{"& .MuiDataGrid-columnsContainer":{backgroundColor:e=>"light"===e.palette.mode?"#fafafa":"#1d1d1d"},"& .MuiDataGrid-iconSeparator":{display:"none"}},disableRowSelectionOnClick:!0,paginationModel:{page:1,pageSize:50},hideFooter:!0,sortModel:g,onSortModelChange:e=>f(e),slots:{noRowsOverlay:Xt},initialState:j},u)))))},pn=e=>{const{alignIcon:t="left",children:n,className:r,disabled:i,label:a,color:l="primary",size:s="small",to:c,...d}=e,u=L(),m=a?u(a,{_:a}):void 0,p=gn(c);return a&&!i?o(R,{title:m},o(S,Object.assign({"aria-label":m,className:r,color:l,size:"large"},d,p),n)):o(S,Object.assign({className:r,color:l,disabled:i,size:"large"},d,p),n)};pn.propTypes={alignIcon:bo.oneOf(["left","right"]),children:bo.element,className:bo.string,color:bo.oneOfType([bo.oneOf(["inherit","default","primary","secondary","error","info","success","warning"]),bo.string]),disabled:bo.bool,label:bo.string,size:bo.oneOf(["small","medium","large"])};const gn=e=>{if(null==e)return;if("string"==typeof e)return{to:e};const{redirect:o,replace:t,state:n,...r}=e;return{to:r,redirect:o,replace:t,state:n}},fn=e=>e.stopPropagation(),hn={true:{_scrollToTop:!0},false:{}},bn=o(wo,null),vn=e=>{const{icon:t=bn,label:n="ra.action.create",scrollToTop:r=!0,...i}=e,a=G(e),l=X(e),s=ae();return o(pn,Object.assign({component:so,to:s({type:"create",resource:a}),state:{record:l,...hn[String(r)]},label:n,onClick:fn},i),t)},yn=e=>e.stopPropagation(),Cn={true:{_scrollToTop:!0},false:{}},xn=o($o,null),wn=e=>{const{icon:t=xn,label:n="ra.action.edit",scrollToTop:r=!0,...i}=e,a=G(e),l=X(e),s=ae();return l?o(pn,Object.assign({component:so,to:s({type:"edit",resource:a,id:l.id}),state:Cn[String(r)],label:n,onClick:yn},i),t):null},kn=(e,o)=>void 0===o||"function"==typeof o&&o(e),Tn=k({},jo),On=new Map([["is","is"],["not","not"],["after","after"],["onOrAfter","onOrAfter"],["before","before"],["onOrBefore","onOrBefore"],["eq","="],["neq","!="],["gt",">"],["gte",">="],["lt","<"],["lte","<="],["contains","contains"],["equals","equals"],["sw","startsWith"],["ew","endsWith"],["isEmpty","isEmpty"],["isNotEmpty","isNotEmpty"],["isAnyOf","isAnyOf"]]),Rn=new Map(Array.from(On,e=>[e[1],e[0]])),Sn=e=>e.items.reduce((e,o)=>(void 0!==o.field&&o.operator&&(Rn.has(o.operator)?e[`${o.field}_${Rn.get(o.operator)}`]=o.value:e[o.field]=o.value),e),{}),Pn=e=>{const{actionButtons:t=[],bulkActionButtons:n,sx:r,columns:i,isRowEditable:a,desktopSize:l=!1,hasEdit:s,initialState:c,convertFilterModelToFilterValues:d=Sn,claveNuevo:m,...p}=e,g=Bt(e),f=L(),h=G(e),{data:b=[],isLoading:v,selectedIds:y,onSelect:C,displayedFilters:w,setFilters:k}=z(),T=Lo(),O=Io({apiRef:T,initialState:{...c,pinnedColumns:{right:["actions"]}}}),R=i.map((e,o)=>({...e,headerName:""!==e.headerName?f(`resources.${h}.fields.${e.field}`,{_:e.headerName}):e.headerName})),S=t.length>0||s?R.concat([{field:"actions",type:"actions",width:100,hideable:!1,getActions:e=>{const n=T.current.getRowNode(e.id);return e.row.id?[...s?[o(wn,{record:e.row,disabled:!kn(e.row,a)})]:[],...t.map(t=>{const{handler:n,...r}=t;return o(zo,Object.assign({showInMenu:!0,onClick:o=>"function"==typeof n&&n({...g,record:e.row},r.key)},r))})]:-1!==n.children[0].indexOf(m+"=")?[o(vn,{record:m?{[m]:n.children[0].split(m+"=")[1].replaceAll("[","").trim().split("AND")[0].trim()}:void 0})]:[]}}]):R,N=u(n);return o(se,{sx:r,className:ce.root},N?o(de,{selectedIds:y},n):null,o(x,{sx:{height:"70vh",width:"100%"},className:ce.tableWrapper},o(P,{theme:Tn},o(Mo,Object.assign({sx:{display:"grid",gridTemplateRows:"auto 1fr auto"},columns:S,rows:b,apiRef:T,loading:v,hideFooterSelectedRowCount:!0,hideFooter:!0,disableMultipleRowSelection:!0,checkboxSelection:N,filterMode:"server",onFilterModelChange:e=>{k(d(e),w)},rowSelectionModel:y,onRowSelectionModelChange:e=>{v||(T.current.isRowSelected(e[0])?C([]):C(e))},isRowSelectable:e=>e.row.id,initialState:O},p)))))},Nn=e=>{const{sx:t,columns:n,hasEdit:r,isRowEditable:i,primaryText:a,secondaryText:l}=e,s=n.length;let c=a,d=l;return a||(s>=4?c=e=>`${e[n[0].field]} - ${e[n[0].field]}`:s>=3||s>=2?c=e=>`${e[n[0].field]} - ${e[n[1].field]}`:1===s&&(c=e=>e[n[0].field])),l||(s>=4?d=e=>`${e[n[2].field]} - ${e[n[3].field]}`:s>=3?d=e=>e[n[2].field]:s>=2?c=e=>`${e[n[0].field]} - ${e[n[1].field]}`:1===s&&(c=e=>e[n[0].field])),o(ue,{linkType:e=>!(!r||!kn(e,i))&&"edit",primaryText:c,secondaryText:d,sx:t})},Fn=e=>{const t=y(e=>e.breakpoints.down("md")),{hasEdit:n}=le(e);(e=>{const{onRenderGrilla:o,onLoadGrilla:t}=e,{isLoading:n}=z(),r=Bt(e);s(()=>{o&&o(r)},[]),s(()=>{n||t&&t(r)},[n])})(e);const{desktopSize:r=!1}=e;return o(t&&!1===r?Nn:Pn,Object.assign({},e,{hasEdit:n}))},_n=e=>{const{filterValues:t,setFilters:n,tabs:{ids:r,...i},GridComponent:a=Fn,...s}=e,c=t.id;return o(l,null,o(Go,{value:c,indicatorColor:"primary",onChange:(e,o)=>{n({...t,id:o})}},r.map(e=>o(Ho,{key:e,label:e.charAt(0).toUpperCase()+e.slice(1),value:e}))),o(Wo,null),o(a,Object.assign({},s,i[c])))},jn=e=>{const{useFormulario:o=At,...t}=e;return{fichaProps:{...o(t),etrs:t.etrs}}},Mn=(e,o)=>me(e,{id:"-1"},o),En=e=>e.split("_")[1],Ln=/^\d{2}\/\d{2}\/\d{4}$/,In=e=>{if(!(e instanceof Date)||isNaN(e.getDate()))return"";const o=e.getFullYear().toString(),t=(e.getMonth()+1).toString(),n=e.getDate().toString();return`${o}-${("00"+t).slice(-2)}-${("00"+n).slice(-2)}`},Dn=e=>{if(null==e||""===e)return"";if(e instanceof Date)return In(e);if(Ln.test(e)){const o=e.split("/");return o[2]+"-"+o[1]+"-"+o[0]}return In(new Date(e))},An=e=>{if(!e)return"";const o=e.split("-");return o[2]+"/"+o[1]+"/"+o[0]},Bn=/^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/,Vn=e=>{if(null==e||""===e)return"";if(e instanceof Date)return In(e);if(Bn.test(e)){const o=e.split(" "),t=o[0].split("/");return t[2]+"-"+t[1]+"-"+t[0]+" "+o[1]}return In(new Date(e))},qn=e=>{if(!e)return"";const o=e.split("T"),t=o[0].split("-");return t[2]+"/"+t[1]+"/"+t[0]+" "+o[1]},zn=e=>{if(!e)return"";if(e instanceof Date)return e.toString();if(-1!==e.indexOf(":")){const o=e.split(":");let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}{const o=/(\d{2}):(\d{2})/.exec(e);if(null===o)return;let t=new Date;return t.setHours(o[0]),t.setMinutes(o[1]),t.toString()}},$n=(e,o)=>e?e.split(" ")[4].substring(0,5):"",Wn=e=>o(Jo,{variant:"h6",gutterBottom:!0},e.children),Hn=({children:e,className:t,data:n,hasShow:r,hasList:i=!0,...a})=>o(pe,Object.assign({className:t},(({...e})=>e)(a)),e,i&&o(ge,{label:"ra.action.back",icon:o(Uo,null)}),r&&o(fe,{record:n})),Gn=he(),Un=[Gn,be(1)],Jn={inputFormat:"dd/MM/yyyy"},Qn=e=>(o,t)=>{const n=t[e];if(o&&n){const e=new Date(n.split("/").reverse().join("/")),t=new Date(o.split("/").reverse().join("/"));if(Qo(e,t))return{message:"validation.greater_or_equal",args:{menor:n}}}},Yn=(e="es")=>({locale:"en"===e?Yo:Zo}),Zn=[{id:"1",name:"Aprobado"},{id:"2",name:"Rechazado"},{id:"3",name:"Pendiente"}],Kn=(e,o)=>{const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.setAttribute("href",e),t.setAttribute("download",o),t.click()},Xn=(e,o)=>{const t=G(),{data:n,isLoading:r,error:i}=me("cb_"+En(t)+"_"+e,{id:o});return r||i?"":(null==n?void 0:n.etiqueta)||""},er={form:"FormEtriek-form",tab:"FormEtriek-tab",contenido:"FormEtriek-contenido"},or=e=>({["& ."+er.form]:{maxHeight:"70vh",overflow:"auto"},["& ."+er.tab]:{display:"block",maxHeight:"65vh",overflow:"auto"},["& ."+er.contenido]:{[e.breakpoints.up("xs")]:{width:"100%"},[e.breakpoints.up("md")]:{width:"12vw","&.MuiAutocomplete-root":{width:"16vw"}}}}),tr=()=>{},nr=e=>{const{fichaProps:{onBeforeSubmitFicha:o}}=n(zt),t=Vt(e),r=$(),{save:i}=ve(),l=a(async e=>{const n=o&&await o({form:{getValues:()=>e},...t},"N");return"string"==typeof n?void r(n,{type:"error"}):void 0===n||n?i(e):void 0},[o,r,tr,i]);return"function"==typeof o?l:void 0},rr=e=>{const{useFormulario:t=At,enableLoad:n=!0,...r}=e,a=G(e),{data:l,isLoading:s}=Mn(a,{enabled:n}),{fichaProps:c}=jn(e),d=i(()=>({estado:"N",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(kt,null,o(zt.Provider,{value:d},o(ye,Object.assign({redirect:"list"},r,null==c?void 0:c.panel))))};rr.propTypes={useFormulario:bo.func};const ir=fo(rr,{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>or(e));function ar(e){var o,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(o=0;o<e.length;o++)e[o]&&(t=ar(e[o]))&&(n&&(n+=" "),n+=t);else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function lr(){for(var e,o,t=0,n="";t<arguments.length;)(e=arguments[t++])&&(o=ar(e))&&(n&&(n+=" "),n+=o);return n}const sr=e=>{const t=L(),{resource:n,className:r,icon:i,label:a="ra.action.delete",...l}=e,s=X(),[c,{isLoading:d}]=Ce(n,{id:s.id});return o(Xo,{title:t("ra.action.delete")},o(Ko,Object.assign({disabled:d,onClick:()=>c(),label:a,className:lr("ra-delete-button",r),key:"button"},(({...e})=>e)(l),{size:"large"}),i))};sr.defaultProps={redirect:"list",icon:o(To,null)};const cr=e=>{const o={};for(const t in e)"string"==typeof e[t]&&0===e[t].trim().length||(null==e[t]&&(e[t]=""),o[t]=e[t]);return o},dr=fo(e=>{const{useFormulario:t=At,mutationMode:n="pessimistic",...r}=e,a=xe({mutationMode:n,...r}),{record:l,isLoading:s}=a,{fichaProps:c}=jn(e),d=i(()=>({estado:"M",initialValues:l,isLoading:s,fichaProps:c}),[l,s,c]);return o(kt,null,o(zt.Provider,{value:d},o(we,Object.assign({mutationMode:n,transform:cr},r,null==c?void 0:c.panel))))},{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>or(e)),ur=e((e,t)=>{const{isOpen:n,onConfirm:r,onClose:i,title:a,dialogText:l,children:s,hasAccept:c=!0,hasCancel:d=!0,isLoading:u=!1}=e,m=e=>{i&&i(e)};return o(Ro,{ref:t,open:n,fullWidth:!0,onClose:m,"aria-labelledby":"form-dialog-title"},o(Fo,{id:"form-dialog-title"},a),o(Po,null,o(No,null,l),s),(c||d)&&o(So,null,d&&o(et,{onClick:m,variant:"contained",color:"secondary",sx:{margin:1},disabled:u},"Cancelar"),c&&o(et,{onClick:e=>{r&&r(e)},variant:"contained",color:"primary",sx:{margin:1},disabled:u},"Ok")))}),mr={},pr={pointerEvents:"none",backgroundColor:"#ffffff",opacity:.6,position:"relative"},gr=e=>{const t=Tt(),r=G(e),{estado:i,isLoading:a,initialValues:l,fichaProps:c}=n(zt),d=qt({resource:r,etrs:c.etrs});return s(()=>{c.onRenderFicha&&c.onRenderFicha(d,i)},[]),s(()=>{a||c.onLoadFicha&&c.onLoadFicha(d,i,l)},[a]),o(N,{sx:{...e.sx,...t.open?pr:mr}},t.open&&o(F,{sx:{position:"absolute",left:"50%",top:"50%"},thickness:4,size:50}),e.children)},fr=e=>{const{initialValues:t,fichaProps:{config:r={}}}=n(zt),i=nr(e);return t?o(ke,Object.assign({mode:"onBlur"},e,{onSubmit:i,defaultValues:t,component:gr},r)):null};fr.propTypes={...ke.propTypes};const hr=e=>{const{handleToggle:t,isOpen:n,name:r,icon:i,children:a,dense:l}=e,s=L(),[c]=Te(),d=o(h,{dense:l,onClick:t},o(b,{sx:{minWidth:5}},n?o(tt,null):i),o(C,{variant:"inherit",color:"textSecondary"},s(r)));return o("div",null,c||n?d:o(R,{title:s(r),placement:"right"},d),o(_,{in:n,timeout:"auto",unmountOnExit:!0},o(j,{dense:l,component:"div",disablePadding:!0,sx:{paddingLeft:e.children.props.children[0].key.startsWith("menu")?4:0,"& a":{transition:"padding-left 195ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",paddingLeft:c?4:2}}},a)))},br=e=>{const{items:t,translate:n,...r}=e,{state:i,handleToggle:a,dense:l}=r;return t&&o("div",null,t.map(e=>{const{name:t,menu:s,label:c,icon:d="settings"}=e;return s?o(hr,{key:t,name:c,handleToggle:()=>a(t),isOpen:i[t],icon:o(ot,null),dense:l},br({items:s,translate:n,...r})):o(Oe,{key:t,to:"/"+t,primaryText:n(`resources.${t}.name`,{_:c}),dense:l,leftIcon:o(ot,null)})}))},vr=({dense:e=!1})=>{const t=L(),[n,i]=r({mnuPrueba:!1}),a=y(e=>e.breakpoints.down("sm")),[l]=Te(),s=JSON.parse(localStorage.getItem("menus")),c=br({items:s,handleToggle:e=>{i(o=>({...o,[e]:!o[e]}))},state:n,activeClassName:"",iconClass:"",className:"",open:l,dense:e,translate:t});return o(x,{sx:{width:l?230:50,marginTop:1,marginBottom:1,transition:e=>e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}},o(Re,null,o(Se,{primaryText:t("ra.page.dashboard")}),c,a&&o(Oe,{to:"/configuration",primaryText:t("pos.configuration"),leftIcon:o(ot,null),dense:e})))};var yr=e=>o(Pe,Object.assign({},e,{appBar:xt,menu:vr}));const Cr=(e,o)=>{alert("Falta implementar la función jsBotonGrilla")},xr=e=>{const{className:t,filters:r,children:a,hideFilterButton:l=!1,jsBotonGrilla:s=Cr,...u}=e,{sort:m,displayedFilters:p,filterValues:g,exporter:f,showFilter:h,total:b}=z(e),v=G(e),{hasCreate:y}=le(e),C=n(Ne)||r,x=z(e),w={...Bt(e),...x};return i(()=>o(pe,Object.assign({className:t},Fe(u)),l?null:r?d(r,{resource:v,showFilter:h,displayedFilters:p,filterValues:g,context:"button"}):C&&o(_e,null),y&&o(je,null),!1!==f&&o(Me,{disabled:0===b,resource:v,sort:m,filterValues:g}),c.map(a,(e,o)=>d(e,{onClick:e.props.options?null:o=>{e.props.onClick&&e.props.onClick(o),s(w,e.key)},options:e.props.options?e.props.options.map(o=>({...o,onClick:t=>{e.props.onClick&&e.props.onClick(t),s(w,o.key)}})):null}))),[v,p,g,r,h,C,b,t,m,l,f,y])},wr=e=>{const{loginBackgroundImage:t,nameSource:n="username",passwordSource:i="password"}=e,[a,l]=r(!1),s=L(),c=s("ra.auth.sign_in"),d=$(),u=Ee(),m=co();return o(re,{onSubmit:e=>{l(!0),u(e,m.state?m.state.nextPathname:"/").catch(e=>{l(!1),d("string"==typeof e?e:void 0!==e&&e.message?e.message:"ra.auth.sign_in_error",{type:"error",messageArgs:{_:"string"==typeof e?e:e&&e.message?e.message:void 0}})})},validate:e=>{const o={};return e[n]||(o[n]=s("ra.validation.required")),e[i]||(o[i]=s("ra.validation.required")),o}},o(x,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",alignItems:"center",justifyContent:"flex-start",backgroundImage:t,backgroundRepeat:"no-repeat",backgroundSize:"cover"}},o(rt,{sx:{minWidth:300,marginTop:"6em"}},o(x,{sx:{margin:"1em",display:"flex",justifyContent:"center"}},o(nt,{sx:{backgroundColor:"secondary.main"}},o(g,null))),o(x,{sx:{marginTop:"1em",marginBottom:"1em",display:"flex",justifyContent:"center",color:"grey.600"}},"Inicio de Sesión"),o(x,{sx:{padding:"0 1em 1em 1em"}},o(x,{sx:{marginTop:0}},o(Le,{autoFocus:!0,fullWidth:!0,name:n,label:s("ra.auth.username"),disabled:a})),o(x,{sx:{marginTop:0}},o(Ie,{name:i,label:s("ra.auth.password"),type:"password",disabled:a}))),o(it,{sx:{padding:"0 1em 1em 1em"}},o(et,{variant:"contained",type:"submit",color:"primary",disabled:a,fullWidth:!0},a&&o(at,{sx:{position:"absolute"},size:18,thickness:2}),c)))))},kr=e=>{var t;const{options:n=[],icon:i,label:a,disabled:l,...s}=e,[c,d]=r(!1),u=m(),[p,g]=r(0),f=G(e);return o(x,Object.assign({sx:{display:"inline-block"}},(({...e})=>e)(s)),o(K,{size:"large",className:"add-filter",label:a,onClick:e=>{e.preventDefault(),d(!0),u.current=e.currentTarget},title:n[p].label,disabled:l},(null===(t=n[p])||void 0===t?void 0:t.icon)||i),o(lt,{open:c,anchorEl:u.current,onClose:e=>{u.current&&u.current.contains(e.target)||d(!1)}},n.map((e,t)=>o(st,{key:e.label,disabled:e.disabled,selected:t===p,onClick:o=>{((e,o)=>{g(o),d(!1)})(0,t),e.onClick&&e.onClick(o,t)},resource:f,title:e.label},e.icon,o(x,{component:"span",sx:{paddingRight:"4px"}}),o(De,{label:e.label,resource:f})))))},Tr=e=>{const{fields:t,className:n,...r}=e,{campos:i,separador:a="",secundario:l=[],hasSecundario:s}=t,c=X(),d=i.map(e=>void 0!==c[e]?c[e]:e).join(""+a);return o(Jo,Object.assign({noWrap:!0,variant:"inherit",className:n},r),d,s&&o(Jo,{component:"span",display:"block",color:"textSecondary",variant:"caption"},l.map(e=>`${e.etiqueta||"---"}: ${c[e.campo]||"---"}`).join(" ")))},Or=fo(e=>{const{useFormulario:t=At,...n}=e,r=Ae(n),{record:a,isLoading:l}=r,{fichaProps:s}=jn(e),c=i(()=>({estado:"M",initialValues:a,isLoading:l,fichaProps:s}),[a,l,s]);return o(kt,null,o(zt.Provider,{value:c},o(Be,Object.assign({},n,r,null==s?void 0:s.panel))))},{name:"FormEtriek",overridesResolver:(e,o)=>o.root})(({theme:e})=>or(e)),Rr=e=>{const{icon:t=Pr,label:n="ra.action.show",scrollToTop:r=!0,...i}=e,a=G(e),l=X(e),s=ae();return l?o(pn,Object.assign({component:so,to:s({type:"show",resource:a,id:l.id}),state:Sr[String(r)],label:n,onClick:Nr},i),t):null},Sr={true:{_scrollToTop:!0},false:{}},Pr=o(ct,null),Nr=e=>e.stopPropagation();Rr.propTypes={icon:bo.element,label:bo.string,record:bo.any,scrollToTop:bo.bool};const Fr=p(Rr,(e,o)=>e.resource===o.resource&&(e.record&&o.record?e.record.id===o.record.id:e.record==o.record)&&e.label===o.label&&e.disabled===o.disabled),_r=e=>{const{children:t,className:i,component:a=Mr,formRootPathname:l,syncWithLocation:s=!0,tabs:m=jr,toolbar:p=Er,onChange:g,...f}=e,h=co(),b=mo(""),v=G(e),[y,C]=r(0),{fichaProps:{etrs:x}}=n(zt),w=qt({...e,etrs:x}),{estado:k}=n(zt),T=(e,o)=>{s||(C(o),g&&g(w,k,{newTab:o,prevTab:y,setTab:C},e))},O=()=>d(m,{onChange:T,syncWithLocation:s,url:l,value:y},t);return o(Lr,Object.assign({className:lr("tabbed-form",i)},Ir(f)),s?o(po,null,o(go,{path:"/*",element:O()})):O(),o(M,null),o(a,null,c.map(t,(e,o)=>{if(!e)return null;const t=qe(e,o),n=s?!uo(`${b.pathname}/${t}`,h.pathname):y!==o;return u(e)?d(e,{intent:"content",resource:v,hidden:n,value:s?t:o}):null})),!1!==p?p:null)},jr=o(ze,null),Mr=({children:e})=>o(N,null,e),Er=o($e,null),Lr=fo("div",{name:"RaTabbedForm",overridesResolver:(e,o)=>o.root})(({theme:e})=>({"& .MuiTab-root.RaTabbedForm-errorTabButton":{color:e.palette.error.main}})),Ir=({...e})=>e,Dr=e=>{const{...t}=e,n=(()=>{const e=co(),o=uo(":resource/create/*",e.pathname),t=uo(":resource/:id/*",e.pathname);return o?o.pathnameBase:t?t.pathnameBase:""})();return o(re,Object.assign({formRootPathname:n},t),o(_r,Object.assign({formRootPathname:n},Ar(e))))};Dr.Tab=Ve;const Ar=({...e})=>e,Br=e=>{const{initialValues:t,fichaProps:{config:r={}}}=n(zt),i=nr(e);return t?o(Dr,Object.assign({mode:"onBlur"},e,{onSubmit:i,defaultValues:t,component:gr},r)):null};Br.defaultProps={syncWithLocation:!1};const Vr={...We,palette:{...We.palette,mode:"dark"},components:{...We.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}};var qr={__proto__:null,lightTheme:{...We,palette:{...We.palette,mode:"light"},components:{...We.components,MuiTextField:{defaultProps:{variant:"outlined"}},MuiFormControl:{defaultProps:{variant:"outlined"}},RaSidebar:{root:{drawerPaper:{position:"sticky"}}},RaRichTextInput:{root:{"@global":{".ra-rich-text-input":{"& .ql-editor":{"& p:not(:last-child)":{marginBottom:"0"}}}}}}}},darkTheme:Vr};dt.ra.page.empty="No records yet";const zr={...dt,login:{id:"ID",hint:"Login",required:"Insert Username or ID",send:"Send",email:"Enter your email address",check_email:"Check your email inbox, we just send you a verification code!",must_enter_credentials:"You must first enter Username or ID",restore_password:"Restore Password",punch_in:"Punch In"},pos:{search:"Search",change_pin:"Change Pin",change_password:"Change Password",configuration:"Configuration",language:"Language",theme:{name:"Theme",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Welcome",subtitle:"Employee Management",aor_button:"Metiri WebSite"}}},validation:{greater_or_equal:"Must be greater than or equal to %{menor}"}};ut.ra.notification.created="Datos guardados correctamente",ut.ra.action.bulk_actions="1 seleccionado |||| %{smart_count} seleccionados",ut.ra.page.dashboard="Inicio",ut.ra.page.empty="Sin registros todavía",ut.ra.page.invite="¿Quiere agregar uno?",ut.ra.page.list="%{name}",ut.ra.page.edit="Editar %{name}",ut.ra.action.back="Volver",ut.ra.message.delete_title="Eliminar",ut.ra.input.file.upload_single="Seleccione o arrastre archivo";const $r={...ut,login:{id:"Cédula",hint:"Inicio de Sesión",required:"Ingrese Usuario o Cédula",email:"Ingrese su email aquí",send:"Enviar",check_email:"Revisa tu correo electrónico, te enviaremos un código de verificación!",must_enter_credentials:"Debe ingresar Nº de Usuario o Cédula y Contraseña primero",restore_password:"Restablecer Contraseña",punch_in:"Generar Marcas"},pos:{search:"Búsqueda",change_pin:"Cambiar Pin",change_password:"Cambiar Contraseña",configuration:"Configuración",language:"Lenguaje",theme:{name:"Tema Visual",light:"Light",dark:"Dark"},dashboard:{welcome:{title:"Bienvenid@",subtitle:"Gestión de Funcionarios",aor_button:"Sitio de Metiri"}}},validation:{greater_or_equal:"Debe ser mayor o igual a %{menor}"}},Wr=e=>{const{propsContenido:t,hidden:n}=Wt(e),r=X(),i=JSON.parse(JSON.stringify(r)),a=i[e.source];return i[e.source]=""!=a&&"0"!=a,!n&&o(He,Object.assign({},t,{record:i}))},Hr=e=>{const{source:o}=e,{estado:t,isLoading:r,fichaProps:i={}}=n(zt),a=n($t),l=void 0!==a,s=Vo(e=>{const t=e.configInputs?e.configInputs.filter(e=>e.id===o):[];return t[0]?t[0]:null}),{disabled:c,hidden:d,required:u,error:p}=s||{},g=!0===u?Gn:void 0,f="function"==typeof p?p:()=>p,{[o]:h={},etrs:b}=i,{onFocus:v,onChange:y,onBlur:C,hidden:x=!1,disabled:w=!1,validate:k,...T}=e,{field:O}=ee(e),{onFocus:R,onBlur:S,onChange:P,hidden:N,disabled:F,useContenido:_=At,validate:j,...M}=h,E=l||void 0===N?x:N,L=l||void 0===F?w:F,I=l||void 0===R?v:R,D=l||void 0===S?C:S,A=l||void 0===P?y:P,B=qt({...e,etrs:b,asisEtr:a}),V=_({...T,estado:t,hidden:E,isLoading:r,utils:B,...M}),q=m(O.value);if(void 0===V)throw new Error(`useContenido está devolviendo undefined para el contenido ${o}\n Asegúrese de incluir una instrucción return al final de la función`);const{hidden:z,disabled:$,onFocus:W,onChange:H,onBlur:G,validate:U,...J}=V,Q=W||I,Y=G||D,Z=H||A,K={...B,prev:q.current};return{propsContenido:{sx:{m:1},onFocus:e=>{Q&&I(B,t,e),q.current=e.target.value},onBlur:e=>Y&&Y(K,t,e),onChange:e=>Z&&Z(K,t,e),helperText:!1,validate:[...Array.isArray(k)?k:[k],...Array.isArray(j)?j:[j],...Array.isArray(U)?U:[U],g,f].filter(e=>void 0!==e),...T,...M,...J,disabled:void 0!==c?c:void 0!==$?$:L},hidden:void 0!==d?d:void 0!==z?z:E}},Gr=e=>{const{propsContenido:t,hidden:n}=Hr(e),{options:r={},disabled:i=!1,...a}=t,l=X();return!n&&o(Ge,Object.assign({accept:"",maxSize:5e6},a,{options:{disabled:i,...r}}),o(Ue,{source:t.source,title:"Ver",record:l}))},Ur=e=>{const{propsContenido:{sx:t,...n},hidden:r}=Hr(e);return!r&&o(Je,Object.assign({},n,{sx:{...t,display:"inline-flex",margin:1}}))},Jr=e((e,t)=>o(R,Object.assign({ref:t},e))),Qr=e=>{var t;const{callback:n,sx:r,isTC:i,onChange:a,...l}=e,{isLoading:c,allChoices:d}=Ye(),u=m(null);return s(()=>{c||"function"==typeof n&&n(Object.values([d]))},[d,n,c]),o(Jr,{title:(null===(t=u.current)||void 0===t?void 0:t.value)||"",placement:"top",arrow:!0},o(x,{component:"span",sx:i?{margin:1,...r}:{display:{md:"inline-flex"},margin:1,...r},width:i?{}:{xs:"100%",md:"auto"}},o(Ze,Object.assign({size:"small",sx:i?{width:"100% !important"}:{}},l,{onChange:e=>{a({target:{value:e}})},TextFieldProps:{inputRef:u}}))))},Yr=e=>{const{propsContenido:t,hidden:n}=Hr(e),r=Bo(),{source:i,reference:a}=e,l=Vo(e=>{const o=e.reload_cb?e.reload_cb.filter(e=>e.id===i):[];return o[0]?o[0]:null}),c=m(l),d=null===l&&c.current?c.current:l;let u,p;if(d){const{callback:e,...o}=d;u=e,p=o}return s(()=>{null!==l&&(c.current=l,r(Rt(i)))},[JSON.stringify(l)]),n?null:o(Qe,{reference:a,source:i,perPage:500,filter:p},o(Qr,Object.assign({},t,{callback:u,optionText:"etiqueta",optionValue:i})))},Zr=e=>{const{propsContenido:t,hidden:n}=Hr(e);return!n&&o(Ke,t)},Kr=e=>{const{title:t,source:n,src:r}=e,i=X(e);return o(nt,{title:t,src:`${r}/${i[n]}`})},Xr=e=>{const{propsContenido:t,hidden:n}=Hr(e),{source:r,reference:i}=e;return n?null:o(Xe,{source:r,reference:i},o(eo,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},ei=e=>{const{propsContenido:t,hidden:n}=Hr(e);return!n&&o(Ie,t)},oi=e=>{const{propsContenido:t,hidden:r}=Hr(e),{isLoading:i}=n(zt),{source:a,reference:l}=e;return i||r?null:o(Qe,{source:a,reference:l},o(oo,Object.assign({},t,{optionText:"etiqueta",optionValue:e.source})))},ti=e=>{const{propsContenido:t,hidden:n}=Hr(e);return!n&&o(oo,t)},ni=e=>o(bt,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(E,e)),ri={cursor:"move"},ii=e=>{const{isOpen:t,isLoading:n,title:r,content:i,cancel:l,ConfirmIcon:s,CancelIcon:c,onClose:d,onConfirm:u,contentResource:m,translateOptions:p={}}=e,g=L(),[f]=to(m),h=a((e,o)=>{e.stopPropagation(),u(e,f)},[f,u]),b=a(e=>{e.stopPropagation()},[]);return o(Ro,{open:t,onClose:d,onClick:b,fullWidth:!0,maxWidth:"lg",PaperComponent:ni,"aria-labelledby":"draggable-dialog-title"},o(Fo,{style:ri,id:"draggable-dialog-title"},g(r,{_:r,...p})),o(Po,{dividers:!0},i),o(So,null,o(et,{disabled:n,onClick:d},o(c,{sx:{paddingRight:"0.5em"}}),g(l,{_:l})),o(et,{disabled:n,onClick:e=>h(e,"yes"),autoFocus:!0},o(s,{sx:{paddingRight:"0.5em"}}),g("ra.action.confirm"))))};ii.propTypes={cancel:bo.string,classes:bo.object,confirm:bo.string,confirmColor:bo.string,ConfirmIcon:bo.elementType,CancelIcon:bo.elementType,content:bo.node.isRequired,isOpen:bo.bool,isLoading:bo.bool,onClose:bo.func.isRequired,onConfirm:bo.func.isRequired,title:bo.string.isRequired},ii.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:ft,CancelIcon:ht,isOpen:!1};const ai=()=>o(l,null),li={seleccion:[],all:!0,none:!1},si=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,ci=e=>e,di=e=>{const{disabled:t,asistant:n,asistantResource:i,label:c,source:d,sx:u,...m}=e,[p,g]=r(!1),f=Do();s(()=>{b()},[]);const h=a(()=>{g(!1)},[g]),b=e=>{f.setValue(d,{seleccion:[],all:!0,none:!1})};return o(l,null,o(x,{display:"flex",alignItems:"center",sx:{...u,display:"inline-flex",margin:1}},o(Le,Object.assign({defaultValue:li},m,{source:d,label:c,disabled:!0,parse:ci,format:si,helperText:!1,InputProps:{endAdornment:o(l,null,o(Ko,{onClick:e=>{f.setValue(d,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(pt,null)),o(Ko,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(mt,null)),o(Ko,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(gt,null)))}}))),o(ii,{isOpen:p,title:"Selección de "+c,contentResource:i,content:o(n,{bulkActionButtons:o(ai,null),hasCreate:!1,exporter:!1,resource:i}),onConfirm:(e,o)=>{g(!1),f.setValue(d,{seleccion:o,all:!1,none:!1})},onClose:h}))},ui=e=>o(no,Object.assign({},e,{hasCreate:!1,exporter:!1,perPage:50,empty:!1,title:" ",disableSyncWithLocation:!0}),o(ro,{bulkActionButtons:o("span",null)},o(Y,{source:"funced",sortable:!0,label:"Cédula"}),o(Y,{source:"funpriape",sortable:!0,label:"Apellido"}),o(Y,{source:"funprinom",sortable:!0,label:"Nombre"}))),mi={fillista:"empcod=-1"},pi=e=>{const[t,n]=r(mi),i=q(),l=a(e=>{n({fillista:e.node.key})},[n]),s=a(e=>i.getChildNodes("form_224",{parentId:e?e.itemData.id:""}).then(e=>e.data).catch(()=>{throw new Error("Data Loading Error")}),[i]);return o(x,{display:"flex",flex:1,alignItems:"flex-start",height:"20em"},o(x,{flexGrow:1},o(vt,{id:"funcionarios-treeview",dataStructure:"plain",rootValue:"",onItemClick:l,createChildren:s})),o(x,{flexGrow:2},o(ui,{resource:"form_224",filter:t})))},gi=e=>o(bt,{handle:"#draggable-dialog-title",cancel:'[class*="MuiDialogContent-root"]'},o(E,e)),fi={cursor:"move"},hi=e=>{const{isOpen:t,isLoading:n,title:r,cancel:i,ConfirmIcon:l,CancelIcon:s,onClose:c,onConfirm:d,translateOptions:u={}}=e,m=L(),p=a((e,o)=>{e.stopPropagation(),d(e,o)},[d]),g=a(e=>{e.stopPropagation()},[]);return o(Ro,{open:t,onClose:c,onClick:g,fullWidth:!0,maxWidth:"lg",PaperComponent:gi,"aria-labelledby":"draggable-dialog-title"},o(Fo,{style:fi,id:"draggable-dialog-title"},m(r,{_:r,...u})),o(Po,{dividers:!0},o(pi,null)),o(So,null,o(et,{disabled:n,onClick:c},o(s,{sx:{paddingRight:"0.5em"}}),m(i,{_:i})),o(et,{disabled:n,onClick:e=>p(e,"yes"),autoFocus:!0},o(l,{sx:{paddingRight:"0.5em"}}),m("ra.action.confirm"))))};hi.propTypes={cancel:bo.string,classes:bo.object,confirm:bo.string,confirmColor:bo.string,ConfirmIcon:bo.elementType,CancelIcon:bo.elementType,isOpen:bo.bool,isLoading:bo.bool,onClose:bo.func.isRequired,onConfirm:bo.func.isRequired,title:bo.string.isRequired},hi.defaultProps={cancel:"ra.action.cancel",classes:{},confirmColor:"primary",ConfirmIcon:ft,CancelIcon:ht,isOpen:!1};const bi={seleccion:[],all:!0,none:!1},vi=e=>!e||null!=e&&e.all?"Todos":null!=e&&e.none||0===e.seleccion.length?"Ninguno":`Selección (${e.seleccion.length})`,yi=e=>e,Ci=e=>{const{disabled:t,label:n="Funcionarios",allowNone:i=!0,source:c,sx:d,...u}=e,[m]=to("form_224"),[p,g]=r(!1),f=Do();s(()=>{b()},[]);const h=a(()=>{g(!1)},[g]),b=e=>{f.setValue(c,{seleccion:[],all:!0,none:!1})};return o(l,null,o(x,{display:"flex",alignItems:"center",sx:{...d,display:"inline-flex",margin:1}},o(Le,Object.assign({defaultValue:bi},u,{source:c,label:n,disabled:!0,parse:yi,format:vi,helperText:!1,InputProps:{endAdornment:o(l,null,i&&o(Ko,{onClick:e=>{f.setValue(c,{seleccion:[],all:!1,none:!0})},disabled:t,"aria-label":"Ninguno",size:"small",title:"Ninguno"},o(pt,null)),o(Ko,{onClick:b,disabled:t,"aria-label":"Todos",size:"small",title:"Todos"},o(mt,null)),o(Ko,{onClick:e=>g(!0),disabled:t,"aria-label":"Selección",size:"small",title:"Selección"},o(gt,null)))}}))),o(hi,{isOpen:p,title:"Selección de "+n,onConfirm:(e,o)=>{g(!1),f.setValue(c,{seleccion:m,all:!1,none:!1})},onClose:h}))},xi=e=>{const{propsContenido:t,hidden:n}=Hr(e);return!n&&o(Le,Object.assign({multiline:!0},t))},wi=e=>{const{tipo:t,...n}=e,{propsContenido:r,hidden:i}=Hr(n),a=Do();s(()=>{r.value&&a.setValue(e.source,r.value)});const l={...r};return i?null:"N"===t||"D"===t?o(io,l):"F"===t?o(ao,l):"Z"===t?o(lo,l):o(Le,"H"===t?Object.assign({},l,{type:"time"}):l)},ki=e=>{const{source:t,label:n,sx:r}=e,{hidden:i}=Hr(e);return i?null:o(x,{sx:{...r,display:"inline-flex",alignItems:"flex-start",marginLeft:1,marginBottom:-1,width:{xs:"100%",md:"calc(24vw + 1em)"}}},o(Le,Object.assign({},e,{label:"",source:t,sx:{flex:1,marginTop:1}})),o(Yr,Object.assign({},e,{source:t,label:n,isTC:!0,sx:{flex:3}})))};export{xt as AppBar,Wr as BooleanField,Gr as Camino,Ur as CheckBox,Yr as ComboBox,Zr as ComboBoxManual,ir as CreateEtriek,vn as CreateGridButton,sr as DeleteButtonNoWarning,dr as EditEtriek,wn as EditGridButton,dn as EtrGrid,Hn as FichaActions,zt as FichaContext,hi as FiltroFuncionarios,er as FormClasses,ur as FormDialog,fr as FormEtriek,mn as GE,pn as GridButton,Fn as GrillaEtriek,Kr as ImageField,yr as Layout,xr as ListActionsEtriek,Xr as ListCheck,wr as Login,vr as Menu,kr as MenuButton,Tr as MultiTextField,ei as Password,oi as RadioButton,ti as RadioButtonManual,Wn as Separador,Or as ShowEtriek,Fr as ShowGridButton,hr as SubMenu,Ci as TBSF,Br as TabbedFormEtriek,_n as TabbedGrillaEtriek,xi as TextArea,wi as TextBox,di as TextBoxSelection,ki as TextCombo,Ht as TextField,Zn as choicesEstado,Dn as dateFormat,Jn as dateFormatOptions,An as dateParser,Vn as dateTimeFormat,qn as dateTimeParser,Rt as deleteRecargarComboBox,Kn as descargarLink,zr as enMessages,$r as esMessages,Qn as etrFechaMayorQue,Gn as etrRequerido,Un as etrRequeridoNumerico,En as getFormcodFromResource,Yn as localeOptions,Ot as recargarComboBox,Gt as renderCellComboBox,Pt as setDisableAction,Ft as setErrorAction,St as setHiddenAction,Nt as setRequireAction,qr as themes,zn as timeFormat,$n as timeParser,Dt as useAjax,Hr as useContenidoController,Zt as useEtrActions,Wt as useFieldController,Tt as useFormProgress,nr as useFormSubmit,It as useGetJson,jn as useInitFicha,Mn as useNuevo,Xn as useReferenceLabel,qt as useUtils,Bt as useUtilsGrilla,Vt as useUtilsSubmit};
2
2
  //# sourceMappingURL=index.modern.js.map