import{Button_default as e,Chip_default as t,DateTimePickerComponent as n,FormControl_default as r,Fragment as i,IconButton_default as a,InputLabel_default as o,Input_default as s,MenuItem_default as c,Select_default as l,TextField_default as u,__toESM as d,dxtToLocalServerTime as f,jsx as p,jsxs as m,modal_default as h,require_Delete as g,require_react as _,useAppSelector as v}from"./index-CA65pJ_5.js";var y=d(g()),b=d(_());const x=({value:t,onChange:r,disabled:o=!1,title:s,variant:c=`standard`,error:l,minDate:d,maxDate:g})=>{let[_,v]=(0,b.useState)(!1),[x,S]=(0,b.useState)(t);(0,b.useEffect)(()=>{_&&S(t||null)},[_]);let C=()=>{r(x),v(!1)},w=e=>{e.stopPropagation(),e.preventDefault(),S(null),r(null)};return m(i,{children:[p(u,{variant:c,onClick:()=>{!o&&v(!0)},fullWidth:!0,value:t?f(t,`yyyy-MM-dd HH:mm`):``,InputLabelProps:{shrink:!0},InputProps:{endAdornment:p(i,{children:t?p(a,{onClick:w,children:p(y.default,{})}):null})},label:s,error:!!l,helperText:l}),m(h,{open:_,handleClose:()=>{v(!1)},maxWidth:`lg`,id:s,title:s,children:[p(h.Content,{children:p(n,{value:x,onChange:e=>S(e),minDate:d,maxDate:g})}),p(h.Actions,{children:p(e,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:C,children:`APPLY`})})]})]})},S=({locationId:e,onChange:n,locationTypeIdFilters:i,rootTypeIdFilters:a,disabled:u=!1})=>{let d=v(e=>{var t;return(t=e.common.lookupTables)?.locations}),f=(0,b.useMemo)(()=>d?Object.values(d).filter(e=>{let t=a?!!a[e.rootTypeId]:!0,n=i?!!i[e.locationTypeId]:!0;return n&&t}):[],[d,i]);return m(r,{style:{minWidth:`170px`,width:`100%`},children:[p(o,{children:`Locations`}),m(l,{onChange:e=>n(e.target.value),displayEmpty:!0,disabled:u,value:e,input:p(s,{}),renderValue:e=>e?p(t,{label:d[e].locationName}):p(`div`,{}),inputProps:{"aria-label":`Without label`},children:[p(c,{disabled:!0,value:``,children:p(`div`,{})}),f.map(e=>p(c,{value:e.locationId,children:e.locationName},`location-${e.locationId}`))]})]})};export{x as DateTimeFormField,S as LocationFormField};
//# sourceMappingURL=location.form-field--N3X0s94.js.map