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,createSvgIcon as f,dxtToLocalServerTime as p,jsx as m,jsxs as h,modal_default as g,require_Delete as _,require_react as v,useAppSelector as y}from"./index-hCP7Trns.js";var b=d(v()),x=f(b.createElement(`path`,{d:`M19 13H5v-2h14v2z`}),`Remove`),S=d(_());const C=({value:t,onChange:r,disabled:o=!1,title:s,variant:c=`standard`,error:l})=>{let[d,f]=(0,b.useState)(!1),[_,v]=(0,b.useState)(t);(0,b.useEffect)(()=>{d&&v(t||null)},[d]);let y=()=>{r(_),f(!1)},x=e=>{e.stopPropagation(),e.preventDefault(),v(null),r(null)};return h(i,{children:[m(u,{variant:c,onClick:()=>{!o&&f(!0)},fullWidth:!0,value:t?p(t,`yyyy-MM-dd HH:mm`):``,InputLabelProps:{shrink:!0},InputProps:{endAdornment:m(i,{children:t?m(a,{onClick:x,children:m(S.default,{})}):null})},label:s,error:!!l,helperText:l}),h(g,{open:d,handleClose:()=>{f(!1)},maxWidth:`lg`,id:s,title:s,children:[m(g.Content,{children:m(n,{value:_,onChange:e=>v(e)})}),m(g.Actions,{children:m(e,{fullWidth:!0,variant:`contained`,color:`primary`,onClick:y,children:`APPLY`})})]})]})},w=({locationId:e,onChange:n,locationTypeIdFilters:i,rootTypeIdFilters:a,disabled:u=!1})=>{let d=y(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 h(r,{style:{minWidth:`170px`,width:`100%`},children:[m(o,{children:`Locations`}),h(l,{onChange:e=>n(e.target.value),displayEmpty:!0,disabled:u,value:e,input:m(s,{}),renderValue:e=>e?m(t,{label:d[e].locationName}):m(`div`,{}),inputProps:{"aria-label":`Without label`},children:[m(c,{disabled:!0,value:``,children:m(`div`,{})}),f.map(e=>m(c,{value:e.locationId,children:e.locationName},`location-${e.locationId}`))]})]})};export{C as DateTimeFormField,w as LocationFormField,x as Remove_default};
//# sourceMappingURL=location.form-field-D3lQYOGT.js.map