"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[647],{72647:(e,t,a)=>{a.d(t,{A:()=>m});var l=a(37876),s=a(14232),c=a(96390),r=a.n(c),o=a(89099);let n=e=>{let[t,a]=(0,s.useState)(e.state.customerName),[c,n]=(0,s.useState)([]),[i,d]=(0,s.useState)(""),u=(0,o.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;n(t.customers),c.length>1&&e.setUsingChildCustomer(),u&&"true"===u.query.isMove&&(d(u.query.selectcustomer),e.changeCustomer({name:u.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:i||"ALL",onChange:t=>{let a=t.target.value;d(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:"고객사"})]})})})},i=e=>{let[t,a]=(0,s.useState)(),[c,r]=(0,s.useState)(),n=(0,o.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"===n.query.isMove&&(a(n.query.startDate),r(n.query.endDate),e.changeDate({startDate:n.query.startDate,endDate:n.query.endDate}))})()},[]);let i=l=>{let s=l.target.id,o=l.target.value;"startDate"==s&&(a(o),e.changeDate({startDate:o,endDate:c})),"endDate"==s&&(r(o),e.changeDate({startDate:t,endDate:o}))};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:"검사 종료일"})]})]})},d=e=>{let[t,a]=(0,s.useState)([]),[c,n]=(0,s.useState)([]),[i,d]=(0,s.useState)([]),[m,p]=(0,s.useState)([]),[h,N]=(0,s.useState)([]),[g,v]=(0,s.useState)([]),[x,j]=(0,s.useState)(!1),[b,f]=(0,s.useState)(e.selectCustomer),[C,y]=(0,s.useState)("all"),[L,A]=(0,s.useState)("all"),[w,F]=(0,s.useState)("all"),[S,T]=(0,s.useState)("all"),[D,E]=(0,s.useState)("all"),[q,R]=(0,s.useState)("all"),k=(0,o.useRouter)();(0,s.useEffect)(()=>{(async()=>{let t="".concat("https://api-cs.neuronaware.net","/inspections/namefilter");u(e.selectCustomer)&&(t+="?customerName=".concat(e.selectCustomer)),j(!1),f(e.selectCustomer),"true"===k.query.isMove?(y(k.query.carType),e.selectNameFilter({id:"carType",value:k.query.carType}),F(k.query.productName),e.selectNameFilter({id:"productName",value:k.query.productName}),T(k.query.colorCode),e.selectNameFilter({id:"colorCode",value:k.query.colorCode}),E(k.query.ALC),e.selectNameFilter({id:"ALC",value:k.query.ALC}),R(k.query.productNumber),e.selectNameFilter({id:"productNumber",value:k.query.productNumber})):(y("all"),e.selectNameFilter({id:"carType",value:"all"}),F("all"),e.selectNameFilter({id:"productName",value:"all"}),T("all"),e.selectNameFilter({id:"colorCode",value:"all"}),E("all"),e.selectNameFilter({id:"ALC",value:"all"}),R("all"),e.selectNameFilter({id:"productNumber",value:"all"})),await Promise.all([I(t)]),e.changeLookUp()})()},[e.selectCustomer]);let I=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(e.carTypes),d(e.productNames),p(e.colorCodes),N(e.ALCCodes),v(e.productNumbers),n(e.specifications),j(!0)}).catch(e=>{console.error("!!!!!!!!!! [GET]/inspection/namefilter api ERROR !!!!!!! \n ".concat(e)),window.alert("검색 정보를 가져오는데 오류가 발생했습니다.")})},U=t=>{e.selectNameFilter({id:t.target.id,value:t.target.value});let a="".concat("https://api-cs.neuronaware.net","/inspections/namefilter?"),l="";switch(u(b)&&(l+="customerName=".concat(b)),t.target.id){case"carType":y(t.target.value),A("all"),e.selectNameFilter({id:"specification",value:"all"}),F("all"),e.selectNameFilter({id:"productName",value:"all"}),T("all"),e.selectNameFilter({id:"colorCode",value:"all"}),E("all"),e.selectNameFilter({id:"ALC",value:"all"}),R("all"),e.selectNameFilter({id:"productNumber",value:"all"}),!u(l)&&u(t.target.value)?l+="carType=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&carType=".concat(t.target.value));break;case"specification":A(t.target.value),e.selectNameFilter({id:"productName",value:"all"}),T("all"),e.selectNameFilter({id:"colorCode",value:"all"}),E("all"),e.selectNameFilter({id:"ALC",value:"all"}),R("all"),e.selectNameFilter({id:"productNumber",value:"all"}),!u(l)&&u(C)?l+="carType=".concat(C):u(l)&&u(C)&&(l+="&carType=".concat(C)),!u(l)&&u(t.target.value)?l+="specification=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&specification=".concat(t.target.value));break;case"productName":F(t.target.value),!u(l)&&u(C)?l+="carType=".concat(C):u(l)&&u(C)&&(l+="&carType=".concat(C)),!u(l)&&u(L)?l+="specification=".concat(L):u(l)&&u(L)&&(l+="&specification=".concat(L)),!u(l)&&u(t.target.value)?l+="specification=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&productName=".concat(t.target.value));break;case"productNumber":R(t.target.value),!u(l)&&u(C)?l+="carType=".concat(C):u(l)&&u(C)&&(l+="&carType=".concat(C)),!u(l)&&u(L)?l+="specification=".concat(L):u(l)&&u(L)&&(l+="&specification=".concat(L)),!u(l)&&u(w)?l+="productName=".concat(w):u(l)&&u(w)&&(l+="&productName=".concat(w)),!u(l)&&u(t.target.value)?l+="productNumber=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&productNumber=".concat(t.target.value));break;case"colorCode":T(t.target.value),!u(l)&&u(C)?l+="carType=".concat(C):u(l)&&u(C)&&(l+="&carType=".concat(C)),!u(l)&&u(L)?l+="specification=".concat(L):u(l)&&u(L)&&(l+="&specification=".concat(L)),!u(l)&&u(w)?l+="productName=".concat(w):u(l)&&u(w)&&(l+="&productName=".concat(w)),!u(l)&&u(q)?l+="productNumber=".concat(q):u(l)&&u(q)&&(l+="&productNumber=".concat(q)),!u(l)&&u(t.target.value)?l+="colorCode=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&colorCode=".concat(t.target.value));break;case"ALC":E(t.target.value),!u(l)&&u(C)?l+="carType=".concat(C):u(l)&&u(C)&&(l+="&carType=".concat(C)),!u(l)&&u(L)?l+="specification=".concat(L):u(l)&&u(L)&&(l+="&specification=".concat(L)),!u(l)&&u(w)?l+="productName=".concat(w):u(l)&&u(w)&&(l+="&productName=".concat(w)),!u(l)&&u(q)?l+="productNumber=".concat(q):u(l)&&u(q)&&(l+="&productNumber=".concat(q)),!u(l)&&u(S)?l+="colorCode=".concat(S):u(l)&&u(S)&&(l+="&colorCode=".concat(S)),!u(l)&&u(t.target.value)?l+="ALC=".concat(t.target.value):u(l)&&u(t.target.value)&&(l+="&ALC=".concat(t.target.value))}I(a+=l)};return(0,l.jsxs)("div",{className:"row g-1 p-1",children:[!0==x?(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:C,onChange:U,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:L,onChange:U,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:w,onChange:U,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:S,onChange:U,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),m.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:D,onChange:U,children:[(0,l.jsx)("option",{id:"all",children:"ALL"},"all"),h.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:q,onChange:U,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:"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:S,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 u(e){return void 0!=e&&"undifined"!=e&&null!=e&&"all"!=e&&"All"!=e&&"ALL"!=e&&0!=e.length&&!0}let m=e=>{let[t,a]=(0,s.useState)(),[c,r]=(0,s.useState)(),[u,m]=(0,s.useState)(p(new Date)),[h,N]=(0,s.useState)(p(new Date)),[g,v]=(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,F]=(0,s.useState)("ALL"),[S,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,o.useRouter)();(0,s.useEffect)(()=>{"true"===z.query.isMove&&!0===k&&(H(),k=!1)},[k]);let H=t=>{e.handleSubmitInspectionHistorySearchEngine({selectcustomer:b,startDate:u,endDate:h,carType:C,productName:L,colorCode:w,ALC:S,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)(n,{state:e.state,changeCustomer:e=>{f(e.name)},setUsingChildCustomer:()=>{v(!0)}})}),(0,l.jsx)("div",{className:"col",children:(0,l.jsx)(i,{state:e.state,changeDate:e=>{m(e.startDate),N(e.endDate)}})})]}),(0,l.jsx)("div",{className:"row g-1",children:(0,l.jsx)(d,{state:e.state,selectCustomer:b,selectNameFilter:e=>{"carType"==e.id&&y(e.value),"productName"==e.id&&A(e.value),"colorCode"==e.id&&F(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 p(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}}}]);