"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[647],{72647:(e,t,a)=>{a.d(t,{A:()=>g});var l=a(37876),s=a(14232),c=a(96390),r=a.n(c),n=a(89099);let o=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),i=e=>{let[t,a]=(0,s.useState)(e.state.customerName),[c,i]=(0,s.useState)([]),[d,u]=(0,s.useState)(""),m=(0,n.useRouter)();return(0,s.useEffect)(()=>{let a=!0;return(async()=>{try{let l=await r()("".concat("https://api-cs.neuronaware.net","/inspections/namefilter"),{method:"GET",headers:{"Content-Type":"application/json",authorization:e.state.token,customerid:t,"Access-Control-Allow-Origin":"*","Aceess-Control-Allow-Credentials":!0,"Access-Control-Allow-Headers":"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization"}});if(!a)return;if(200===l.status){let t=await l.json();if(!a)return;let s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...e].sort((e,t)=>o.compare(String(null!=e?e:""),String(null!=t?t:"")))}(t.customers);i(s),s.length>1&&e.setUsingChildCustomer(),m&&"true"===m.query.isMove&&(u(m.query.selectcustomer),e.changeCustomer({name:m.query.selectcustomer}))}else throw Error("Return is 400")}catch(e){if(!a)return;console.log("SelectCustomer component getChildrenCustomers error \n ".concat(e)),window.alert("고객사 정보를 가져오는데 오류가 발생했습니다.")}})(),()=>{a=!1}},[]),(0,l.jsx)("div",{className:"row p-1",children:null==t?(0,l.jsx)(l.Fragment,{children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"고객사 Loading..."]})}):(0,l.jsx)(l.Fragment,{children:c.length>1?(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"customerId",className:"form-select",value:d||"ALL",onChange:t=>{let a=t.target.value;u(a),e.changeCustomer({name:a})},children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),c.map(e=>(0,l.jsx)("option",{value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"customerId",className:"ps-3",children:"고객사"})]}):(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsx)("input",{className:"form-control",id:"customerId",value:t,disabled:!0}),(0,l.jsx)("label",{htmlFor:"customerId",children:"고객사"})]})})})},d=e=>{let[t,a]=(0,s.useState)(),[c,r]=(0,s.useState)(),o=(0,n.useRouter)();(0,s.useEffect)(()=>{(async()=>{let t=function(e){let t=new Date(e),a=t.getFullYear(),l=t.getMonth()+1,s=t.getDate();return l<10&&(l="0"+l),s<10&&(s="0"+s),a+"-"+l+"-"+s}(new Date);a(t),r(t),"true"===o.query.isMove&&(a(o.query.startDate),r(o.query.endDate),e.changeDate({startDate:o.query.startDate,endDate:o.query.endDate}))})()},[]);let i=l=>{let s=l.target.id,n=l.target.value;"startDate"==s&&(a(n),e.changeDate({startDate:n,endDate:c})),"endDate"==s&&(r(n),e.changeDate({startDate:t,endDate:n}))};return(0,l.jsxs)("div",{className:"row g-2 p-1",children:[(0,l.jsxs)("div",{className:"col form-floating",children:[(0,l.jsx)("input",{type:"date",id:"startDate",className:"form-control",value:t||"",onChange:i}),(0,l.jsx)("label",{htmlFor:"startDate",children:"검사 시작일"})]}),(0,l.jsxs)("div",{className:"col form-floating",children:[(0,l.jsx)("input",{type:"date",id:"endDate",className:"form-control",value:c||"",onChange:i}),(0,l.jsx)("label",{htmlFor:"endDate",children:"검사 종료일"})]})]})},u=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),m=e=>{let[t,a]=(0,s.useState)([]),[c,o]=(0,s.useState)([]),[i,d]=(0,s.useState)([]),[u,m]=(0,s.useState)([]),[g,v]=(0,s.useState)([]),[N,x]=(0,s.useState)([]),[j,b]=(0,s.useState)(!1),[f,C]=(0,s.useState)(e.selectCustomer),[y,L]=(0,s.useState)("all"),[A,w]=(0,s.useState)("all"),[S,F]=(0,s.useState)("all"),[T,D]=(0,s.useState)("all"),[E,q]=(0,s.useState)("all"),[R,k]=(0,s.useState)("all"),I=(0,n.useRouter)();(0,s.useEffect)(()=>{(async()=>{let t="".concat("https://api-cs.neuronaware.net","/inspections/namefilter");h(e.selectCustomer)&&(t+="?customerName=".concat(e.selectCustomer)),b(!1),C(e.selectCustomer),"true"===I.query.isMove?(L(I.query.carType),e.selectNameFilter({id:"carType",value:I.query.carType}),F(I.query.productName),e.selectNameFilter({id:"productName",value:I.query.productName}),D(I.query.colorCode),e.selectNameFilter({id:"colorCode",value:I.query.colorCode}),q(I.query.ALC),e.selectNameFilter({id:"ALC",value:I.query.ALC}),k(I.query.productNumber),e.selectNameFilter({id:"productNumber",value:I.query.productNumber})):(L("all"),e.selectNameFilter({id:"carType",value:"all"}),F("all"),e.selectNameFilter({id:"productName",value:"all"}),D("all"),e.selectNameFilter({id:"colorCode",value:"all"}),q("all"),e.selectNameFilter({id:"ALC",value:"all"}),k("all"),e.selectNameFilter({id:"productNumber",value:"all"})),await Promise.all([U(t)]),e.changeLookUp()})()},[e.selectCustomer]);let U=async t=>{await r()(t,{method:"GET",headers:{"Content-Type":"application/json",authorization:e.state.token,customerid:e.state.customerName,"Access-Control-Allow-Origin":"*","Aceess-Control-Allow-Credentials":!0,"Access-Control-Allow-Headers":"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization"}}).then(e=>{if(200==e.status)return e.json();throw Error("Return is 400 get namefilter error")}).then(e=>{a(p(e.carTypes)),d(p(e.productNames)),m(p(e.colorCodes)),v(p(e.ALCCodes)),x(p(e.productNumbers)),o(p(e.specifications)),b(!0)}).catch(e=>{console.error("!!!!!!!!!! [GET]/inspection/namefilter api ERROR !!!!!!! \n ".concat(e)),window.alert("검색 정보를 가져오는데 오류가 발생했습니다.")})},M=t=>{e.selectNameFilter({id:t.target.id,value:t.target.value});let a="".concat("https://api-cs.neuronaware.net","/inspections/namefilter?"),l="";switch(h(f)&&(l+="customerName=".concat(f)),t.target.id){case"carType":L(t.target.value),w("all"),e.selectNameFilter({id:"specification",value:"all"}),F("all"),e.selectNameFilter({id:"productName",value:"all"}),D("all"),e.selectNameFilter({id:"colorCode",value:"all"}),q("all"),e.selectNameFilter({id:"ALC",value:"all"}),k("all"),e.selectNameFilter({id:"productNumber",value:"all"}),!h(l)&&h(t.target.value)?l+="carType=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&carType=".concat(t.target.value));break;case"specification":w(t.target.value),e.selectNameFilter({id:"productName",value:"all"}),D("all"),e.selectNameFilter({id:"colorCode",value:"all"}),q("all"),e.selectNameFilter({id:"ALC",value:"all"}),k("all"),e.selectNameFilter({id:"productNumber",value:"all"}),!h(l)&&h(y)?l+="carType=".concat(y):h(l)&&h(y)&&(l+="&carType=".concat(y)),!h(l)&&h(t.target.value)?l+="specification=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&specification=".concat(t.target.value));break;case"productName":F(t.target.value),!h(l)&&h(y)?l+="carType=".concat(y):h(l)&&h(y)&&(l+="&carType=".concat(y)),!h(l)&&h(A)?l+="specification=".concat(A):h(l)&&h(A)&&(l+="&specification=".concat(A)),!h(l)&&h(t.target.value)?l+="specification=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&productName=".concat(t.target.value));break;case"productNumber":k(t.target.value),!h(l)&&h(y)?l+="carType=".concat(y):h(l)&&h(y)&&(l+="&carType=".concat(y)),!h(l)&&h(A)?l+="specification=".concat(A):h(l)&&h(A)&&(l+="&specification=".concat(A)),!h(l)&&h(S)?l+="productName=".concat(S):h(l)&&h(S)&&(l+="&productName=".concat(S)),!h(l)&&h(t.target.value)?l+="productNumber=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&productNumber=".concat(t.target.value));break;case"colorCode":D(t.target.value),!h(l)&&h(y)?l+="carType=".concat(y):h(l)&&h(y)&&(l+="&carType=".concat(y)),!h(l)&&h(A)?l+="specification=".concat(A):h(l)&&h(A)&&(l+="&specification=".concat(A)),!h(l)&&h(S)?l+="productName=".concat(S):h(l)&&h(S)&&(l+="&productName=".concat(S)),!h(l)&&h(R)?l+="productNumber=".concat(R):h(l)&&h(R)&&(l+="&productNumber=".concat(R)),!h(l)&&h(t.target.value)?l+="colorCode=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&colorCode=".concat(t.target.value));break;case"ALC":q(t.target.value),!h(l)&&h(y)?l+="carType=".concat(y):h(l)&&h(y)&&(l+="&carType=".concat(y)),!h(l)&&h(A)?l+="specification=".concat(A):h(l)&&h(A)&&(l+="&specification=".concat(A)),!h(l)&&h(S)?l+="productName=".concat(S):h(l)&&h(S)&&(l+="&productName=".concat(S)),!h(l)&&h(R)?l+="productNumber=".concat(R):h(l)&&h(R)&&(l+="&productNumber=".concat(R)),!h(l)&&h(T)?l+="colorCode=".concat(T):h(l)&&h(T)&&(l+="&colorCode=".concat(T)),!h(l)&&h(t.target.value)?l+="ALC=".concat(t.target.value):h(l)&&h(t.target.value)&&(l+="&ALC=".concat(t.target.value))}U(a+=l)};return(0,l.jsxs)("div",{className:"row g-1 p-1",children:[!0==j?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"carType",className:"form-select",value:y,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),t.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"carType",children:"차 종"})]})}),(0,l.jsx)("div",{className:"col-12 col-md-3",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"specification",className:"form-select",value:A,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),c.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"specification",children:"사 양"})]})}),(0,l.jsx)("div",{className:"col-12 col-md-3",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"productName",className:"form-select",value:S,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),i.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"productName",children:"품 명"})]})}),(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"colorCode",className:"form-select",value:T,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),u.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"colorCode",children:"ColorCode"})]})}),(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"ALC",className:"form-select",value:E,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),g.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"ALC",children:"ALC"})]})}),(0,l.jsx)("div",{className:"col-12 col-md-2",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"productNumber",className:"form-select",value:R,onChange:M,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),N.map(e=>(0,l.jsx)("option",{id:e,value:e,children:e},e))]}),(0,l.jsx)("label",{htmlFor:"productNumber",children:"품 번"})]})})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"carType",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"차 종 ..."]})})}),(0,l.jsx)("div",{className:"col-12 col-md-3",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"specification",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"사 양 ..."]})})}),(0,l.jsx)("div",{className:"col-12 col-md-3",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"productName",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"품 명 ..."]})})}),(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"colorCode",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"Color..."]})})}),(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"colorCode",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"ALC ..."]})})}),(0,l.jsx)("div",{className:"col-12 col-md-2",children:(0,l.jsx)("div",{className:"form-floating",children:(0,l.jsxs)("button",{className:"btn btn-light",type:"button",id:"productNumber",disabled:!0,children:[(0,l.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"품 번 ..."]})})})]}),(0,l.jsx)("div",{className:"col-12 col-md-1",children:(0,l.jsxs)("div",{className:"form-floating",children:[(0,l.jsxs)("select",{id:"inspectionResult",className:"form-select",value:T,onChange:t=>{e.selectInspectionResult(t.target.value)},children:[(0,l.jsx)("option",{id:"all",value:"all",children:"전 체"},"all"),(0,l.jsx)("option",{id:"TRUE",value:"TRUE",children:"합 격"},"TRUE"),(0,l.jsx)("option",{id:"FALSE",value:"FALSE",children:"불합격"},"FALSE")]}),(0,l.jsx)("label",{htmlFor:"inspectionResult",children:"검사결과"})]})})]})};function p(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...e].sort((e,t)=>u.compare(String(null!=e?e:""),String(null!=t?t:"")))}function h(e){return void 0!=e&&"undifined"!=e&&null!=e&&"all"!=e&&"All"!=e&&"ALL"!=e&&0!=e.length&&!0}let g=e=>{let[t,a]=(0,s.useState)(),[c,r]=(0,s.useState)(),[o,u]=(0,s.useState)(v(new Date)),[p,h]=(0,s.useState)(v(new Date)),[g,N]=(0,s.useState)(!1),[x,j]=(0,s.useState)("ALL"),[b,f]=(0,s.useState)("ALL"),[C,y]=(0,s.useState)("ALL"),[L,A]=(0,s.useState)("ALL"),[w,S]=(0,s.useState)("ALL"),[F,T]=(0,s.useState)("ALL"),[D,E]=(0,s.useState)("ALL"),[q,R]=(0,s.useState)("ALL"),[k,I]=(0,s.useState)(!1),[U,M]=(0,s.useState)(!0),z=(0,n.useRouter)();(0,s.useEffect)(()=>{"true"===z.query.isMove&&!0===k&&(H(),k=!1)},[k]);let H=t=>{e.handleSubmitInspectionHistorySearchEngine({selectcustomer:b,startDate:o,endDate:p,carType:C,productName:L,colorCode:w,ALC:F,productNumber:D,inspectionResult:x,specification:q})};return(0,l.jsxs)("div",{className:"container",children:[(0,l.jsxs)("div",{className:"d-flex justify-content-between align-items-center mb-2",children:[(0,l.jsx)("h5",{className:"mb-0",children:"검사 결과 조회"}),(0,l.jsx)("button",{className:"btn btn-sm btn-outline-secondary",onClick:()=>{M(!U)},children:U?"필터 접기 ▲":"필터 펼치기 ▼"})]}),(0,l.jsxs)("div",{style:{display:U?"block":"none",maxHeight:"calc(100vh - 200px)",overflowY:"auto",paddingRight:"10px",marginBottom:"20px"},children:[(0,l.jsxs)("div",{className:"row g-1",children:[(0,l.jsx)("div",{className:"col",children:(0,l.jsx)(i,{state:e.state,changeCustomer:e=>{f(e.name)},setUsingChildCustomer:()=>{N(!0)}})}),(0,l.jsx)("div",{className:"col",children:(0,l.jsx)(d,{state:e.state,changeDate:e=>{u(e.startDate),h(e.endDate)}})})]}),(0,l.jsx)("div",{className:"row g-1",children:(0,l.jsx)(m,{state:e.state,selectCustomer:b,selectNameFilter:e=>{"carType"==e.id&&y(e.value),"productName"==e.id&&A(e.value),"colorCode"==e.id&&S(e.value),"ALC"==e.id&&T(e.value),"productNumber"==e.id&&E(e.value),"specification"==e.id&&R(e.value)},changeLookUp:()=>{I(!0)},selectInspectionResult:e=>{j(e)}})}),(0,l.jsx)("div",{className:"row g-1 p-1 mb-10",children:(0,l.jsx)("button",{type:"button",className:"btn btn-outline-secondary bg-secondary btn-block text-white btn-md",onClick:H,children:"조 회"})}),(0,l.jsx)("div",{className:"mt-8 mb-5 h-[50px]"})]})]})};function v(e){let t=new Date(e),a=t.getFullYear(),l=t.getMonth()+1,s=t.getDate();return l<10&&(l="0"+l),s<10&&(s="0"+s),a+"-"+l+"-"+s}}}]);