import{n as L,r as s,a as p,F as f,j as t,H as T,ac as C,b1 as I,a7 as x,G as h,aa as M,B as F,b as k,X as B,Y as P,Z as S,_ as y,aM as g,bi as D}from"./index-09tpYl64.js";const j=L(s.createElement("path",{d:"M19 13H5v-2h14v2z"})),A=({value:a,onChange:c,disabled:l=!1,title:o,variant:m="standard",error:n})=>{const[r,e]=s.useState(!1),[i,d]=s.useState(a);s.useEffect(()=>{r&&d(a||null)},[r]);const b=()=>{c(i),e(!1)},v=u=>{u.stopPropagation(),u.preventDefault(),d(null),c(null)};return p(f,{children:[t(T,{variant:m,onClick:()=>{!l&&e(!0)},fullWidth:!0,value:a?x(a,"yyyy-MM-dd HH:mm"):"",InputLabelProps:{shrink:!0},InputProps:{endAdornment:t(f,{children:a?t(C,{onClick:v,children:t(I,{})}):null})},label:o,error:!!n,helperText:n}),p(h,{open:r,handleClose:()=>{e(!1)},maxWidth:"lg",id:o,title:o,children:[t(h.Content,{children:t(M,{value:i,onChange:u=>d(u)})}),t(h.Actions,{children:t(F,{fullWidth:!0,variant:"contained",color:"primary",onClick:b,children:"APPLY"})})]})]})},E=({locationId:a,onChange:c,locationTypeIdFilters:l,rootTypeIdFilters:o,disabled:m=!1})=>{const n=k(e=>e.common.lookupTables?.locations),r=s.useMemo(()=>n?Object.values(n).filter(e=>{const i=o?!!o[e.rootTypeId]:!0;return(l?!!l[e.locationTypeId]:!0)&&i}):[],[n,l]);return p(B,{style:{minWidth:"170px",width:"100%"},children:[t(P,{children:"Locations"}),p(S,{onChange:e=>c(e.target.value),displayEmpty:!0,disabled:m,value:a,input:t(D,{}),renderValue:e=>e?t(g,{label:n[e].locationName}):t("div",{}),inputProps:{"aria-label":"Without label"},children:[t(y,{disabled:!0,value:"",children:t("div",{})}),r.map(e=>t(y,{value:e.locationId,children:e.locationName},`location-${e.locationId}`))]})]})};export{A as D,E as L,j as R};
//# sourceMappingURL=location.form-field-IWAyfMYN.js.map
