1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[4932],{67656(e,s,t){t.r(s),t.d(s,{default:()=>p});var n=t(22224),o=t.n(n),r=t(41594),i=t(98483),d=t(89895),l=t.n(d),a=t(39913),u=t(93351),g=t(28027),c=t(22078),h=t(63988);class m extends r.Component{constructor(e){super(e),this.state={value:"",order_id:null,suggestions:[],orders:e.sales_orders,loading:!1},o().bindAll(this,["onChange","onBlur","onSuggestionsFetchRequested","onSuggestionsClearRequested","getSuggestions","onSuggestionSelected"])}onChange(e,s){let{newValue:t,method:n}=s;this.setState({value:t,order_id:null})}onBlur(e,s){let{focusedSuggestion:t}=s}onSuggestionsFetchRequested(e){let{value:s}=e;this.setState({suggestions:this.getSuggestions(s),order_id:null})}onSuggestionsClearRequested(){this.setState({suggestions:[]})}onSuggestionSelected(e,s){let{suggestion:t}=s;this.setState({order_id:t.order_id})}getSuggestions(e){const s=(0,c.Td)(e.trim());if(""===s)return this.state.orders;const t=new RegExp("^"+s,"i");return this.state.orders.filter(e=>t.test(e.job_number)||t.test(e.job_name))}renderLoading(){return(0,h.jsx)("div",{"data-test-name":"AddToOrderPopup.renderLoading",className:"row popup-content column",children:(0,h.jsx)("div",{className:"small-12 columns",children:(0,h.jsxs)("div",{className:"small-12 text-center",children:[(0,h.jsx)("br",{}),(0,h.jsx)("img",{src:"/images/gears.gif"}),(0,h.jsx)("br",{})]})})})}render(){const{onClosePopup:e,onAddToOrder:s,index:t}=this.props,{value:n,suggestions:o,order_id:r,orders:i}=this.state,d={value:n,onChange:this.onChange,onBlur:this.onBlur,placeholder:"Please type in the number or name of the project you want to add your checkouts to"};return(0,h.jsxs)("div",{"data-test-name":"AddToOrderPopup.render",className:"reveal small",style:{display:"block",height:"initial",overflow:"initial",zIndex:g.z+t},children:[(0,h.jsx)("div",{className:"row",children:(0,h.jsxs)("div",{className:"small-12 columns",children:[(0,h.jsx)("h3",{children:"Add To Project"}),(0,h.jsx)("p",{children:"Checkouts can only be added/aggregated to sales orders that are still in New status."})]})}),this.state.loading?this.renderLoading():[(0,h.jsx)("div",{className:"row",children:(0,h.jsx)("div",{className:"small-12 medium-12 columns assume-identity",children:(0,h.jsx)(l(),{suggestions:o,onSuggestionsFetchRequested:this.onSuggestionsFetchRequested,onSuggestionsClearRequested:this.onSuggestionsClearRequested,getSuggestionValue:e=>`#${e.job_number} â ${e.job_name}`,renderSuggestion:e=>(0,h.jsxs)("div",{"data-test-name":"AddToOrderPopup.render.renderSuggestion",className:"suggestion-item",children:[`#${e.job_number}`," â ",e.job_name]}),inputProps:d,renderInputComponent:e=>(0,h.jsx)("input",{...e}),focusFirstSuggestion:!0,onSuggestionSelected:this.onSuggestionSelected,shouldRenderSuggestions:e=>!0})})}),(0,h.jsx)("a",{className:"button alert",style:{position:"absolute",right:"5rem",top:"1rem"},onClick:s=>{s.preventDefault(),e()},children:"Cancel"}),(0,h.jsx)("a",{className:"button",style:{position:"absolute",right:"1rem",top:"1rem"},onClick:e=>{e.preventDefault(),r&&i.filter(e=>e.order_id===r).length&&this.setState({loading:!0},function(){this.props.onAddToOrder(r)})},children:"Add"})]]})}}const p=(0,i.Ng)(null,(e,s)=>({onClosePopup:()=>e((0,a.fs)()),onAddToOrder:t=>{e((0,u.n8)(s.order_ids,t,s.shop_id))}}))(m)}}]); 2//# sourceMappingURL=components-AddToOrderPopup.48fbfaa4.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.