(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{5130:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>r});var a=s(53441);function n(e,t){void 0===t&&(t={});var s,a,n=(s=e)&&"j"===s[0]&&":"===s[1]?s.substr(2):s;if(void 0===(a=t.doNotParse)&&(a=!n||"{"!==n[0]&&"["!==n[0]&&'"'!==n[0]),!a)try{return JSON.parse(n)}catch(e){}return e}var c=function(){return(c=Object.assign||function(e){for(var t,s=1,a=arguments.length;s=0&&this.changeListeners.splice(t,1)},e}()},32383:()=>{},49473:function(e,t,s){var a,n;void 0===(n="function"==typeof(a=function(){"use strict";function t(e,t,s){var a=new XMLHttpRequest;a.open("GET",e),a.responseType="blob",a.onload=function(){i(a.response,t,s)},a.onerror=function(){console.error("could not download file")},a.send()}function a(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function n(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(s){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var c="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof s.g&&s.g.global===s.g?s.g:void 0,r=c.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),i=c.saveAs||("object"!=typeof window||window!==c?function(){}:"download"in HTMLAnchorElement.prototype&&!r?function(e,s,r){var i=c.URL||c.webkitURL,l=document.createElement("a");l.download=s=s||e.name||"download",l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?n(l):a(l.href)?t(e,s,r):n(l,l.target="_blank")):(l.href=i.createObjectURL(e),setTimeout(function(){i.revokeObjectURL(l.href)},4e4),setTimeout(function(){n(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,s,c){if(s=s||e.name||"download","string"!=typeof e){var r;navigator.msSaveOrOpenBlob((void 0===(r=c)?r={autoBom:!1}:"object"!=typeof r&&(console.warn("Deprecated: Expected third argument to be a object"),r={autoBom:!r}),r.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),s)}else if(a(e))t(e,s,c);else{var i=document.createElement("a");i.href=e,i.target="_blank",setTimeout(function(){n(i)})}}:function(e,s,a,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof e)return t(e,s,a);var i="application/octet-stream"===e.type,l=/constructor/i.test(c.HTMLElement)||c.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&l||r)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=e:location=e,n=null},d.readAsDataURL(e)}else{var m=c.URL||c.webkitURL,h=m.createObjectURL(e);n?n.location=h:location.href=h,n=null,setTimeout(function(){m.revokeObjectURL(h)},4e4)}});c.saveAs=i.saveAs=i,e.exports=i})?a.apply(t,[]):a)||(e.exports=n)},53441:(e,t)=>{"use strict";t.q=function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");for(var a={},n=e.split(";"),c=(t||{}).decode||s,r=0;r{var a=s(5130);a=a.default||a,e.exports=function(e,t){var s=e.req&&e.req.headers&&e.req.headers.cookie;return new a(s).getAll(t)}},70436:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>O});var a=s(37876),n=s(14232),c=s(60072),r=s.n(c),i=s(72647),l=s(96390),o=s.n(l),d=s(48230),m=s.n(d),h=s(49473),u=s.n(h),x=s(12770),p=s(41116),j=s.n(p);let N=e=>{let[t,s]=(0,n.useState)(null),[c,r]=(0,n.useState)(e.token),[i,l]=(0,n.useState)(e.customerName),[d,m]=(0,n.useState)(e.modelName),[h,u]=(0,n.useState)(e.inspectionCustomerName),[x,p]=(0,n.useState)(!0),j=e.modelId+"_"+e.imageID;return(0,n.useEffect)(()=>{(async()=>{s(null);let t=await g(c,i,d,e.imageID,e.IID,h),a="".concat("https://api-cs.neuronaware.net","/inspections/image2?imageKey=").concat(t);await o()(a,{method:"GET",headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"*"}}).then(e=>{if(200===e.status)return e.json();throw Error("Return is 400 get image error")}).then(e=>{s(e.imageBase)}).catch(e=>{console.error("!!!!!!!!!! [GET]/inspectionImg api ERROR !!!!!!! \n ".concat(e)),s(null),p(!1)})})()},[e.imageID,e.IID]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mr-2 p-2 justify-content-center w-50",children:[e.detectionObjectResults?(0,a.jsxs)("table",{className:"table-striped table-condensed table table-bordered tabel-hover text-center align-middle align-middle table-sm w-100",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"객체명"}),(0,a.jsx)("th",{children:"검출 / 기대"}),(0,a.jsx)("th",{children:"결 과"})]})}),(0,a.jsx)("tbody",{children:e.detectionObjectResults.map(e=>(0,a.jsx)(n.Fragment,{children:!0==e.result?(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:e.name}),(0,a.jsxs)("td",{children:[e.numDetection," /"," ",e.numObjects]}),(0,a.jsx)("td",{children:"합 격"})]}):(0,a.jsxs)("tr",{className:"bg-danger text-light",children:[(0,a.jsx)("td",{children:e.name}),(0,a.jsxs)("td",{children:[e.numDetection," /"," ",e.numObjects]}),(0,a.jsx)("td",{children:"불합격"})]})},e.name))})]}):(0,a.jsx)(a.Fragment,{}),e.colorDetectionResults&&e.colorDetectionResults.length>0?(0,a.jsxs)("table",{className:"table-striped table-condensed table table-bordered tabel-hover text-center align-middle align-middle table-sm w-100",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"색상"}),(0,a.jsx)("th",{children:"범위(최소값)"}),(0,a.jsx)("th",{children:"범위(최대값)"}),(0,a.jsx)("th",{children:"검출 값"}),(0,a.jsx)("th",{children:"결 과"})]})}),(0,a.jsx)("tbody",{children:e.colorDetectionResults.map(e=>(0,a.jsx)(n.Fragment,{children:!0===e.result?(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:e.color}),(0,a.jsx)("td",{children:e.preset-e.range}),(0,a.jsx)("td",{children:e.preset+e.range}),(0,a.jsx)("td",{children:e.value}),(0,a.jsx)("td",{children:"합 격"})]}):(0,a.jsxs)("tr",{className:"bg-danger text-light",children:[(0,a.jsx)("td",{children:e.color}),(0,a.jsx)("td",{children:e.preset-e.range}),(0,a.jsx)("td",{children:e.preset+e.range}),(0,a.jsx)("td",{children:e.value}),(0,a.jsx)("td",{children:"불합격"})]})},e.color))})]}):(0,a.jsx)(a.Fragment,{})]}),(0,a.jsx)("div",{className:"mr-2 p-2 float-right w-50",children:null==t?(0,a.jsx)(a.Fragment,{children:!1==x?(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("p",{children:"검사 이미지 로딩에 실패 했습니다."})}):(0,a.jsx)("div",{className:"text-center align-middle mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light",type:"button",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"검사 이미지 Loading..."]})})}):(0,a.jsx)("img",{id:j,src:"data:image/jpg;base64,".concat(t),class:"img-fluid p-2"})})]})};async function g(e,t,s,a,n,c){let r;return await o()("".concat("https://api-cs.neuronaware.net","/inspections/imageKey"),{method:"POST",headers:{"Content-Type":"application/json",authorization:e,customerid:t,csattempt:!0,"Access-Control-Allow-Origin":"*","Aceess-Control-Allow-Credentials":!0,"Access-Control-Allow-Headers":"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization"},body:JSON.stringify({modelName:s,imageID:a,IID:n,customerName:c})}).then(e=>{if(200===e.status)return e.json();throw Error("Return is 400 get imagekey error")}).then(e=>{r=e.imageKey}).catch(e=>{console.error("!!!!!!!!!! [GET]/imageKey api ERROR !!!!!!! \n ".concat(e))}),r}let b=e=>(0,a.jsx)(a.Fragment,{children:e.state.modelHistories.map(t=>(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("header",{className:"mr-2 p-2 d-flex justify-content-center",children:(0,a.jsxs)("h1",{children:[t.modelName," [ ",t.cameraIp," ]"]})}),(0,a.jsx)("main",{children:(0,a.jsx)("div",{className:"mr-2 p-2 d-flex justify-content-center",children:(0,a.jsx)(N,{detectionObjectResults:t.detectionObjects,colorDetectionResults:t.colorDetections,token:e.state.token,customerName:e.state.customerName,inspectionCustomerName:e.inspectionCustomerName,modelName:t.modelName,imageID:t.imageID,modelId:t.modelId,IID:e.IID},t.modelId)})})]},t.modelId))}),f=e=>{let[t,s]=(0,n.useState)({}),[c,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{(async()=>{try{let t="".concat("https://api-cs.neuronaware.net","/inspections/EtcResult?IID=").concat(e.IID,"&imageID=").concat(e.imageID);await o()(t,{method:"GET",headers:{"Content-Type":"application/json",authorization:e.state.token,customerid:e.state.customerName,csattempt:!0,"Access-Control-Allow-Origin":"*","Aceess-Control-Allow-Credentials":!0,"Access-Control-Allow-Headers":"*"}}).then(e=>{if(200===e.status)return e.json();throw Error(e)}).then(e=>{s(e),r(!0)})}catch(e){console.error("!!!!!!!!!! [GET]/EtcResult ERROR !!!!!!! \n ".concat(e))}})()},[e.IID,e.imageID]),(0,a.jsx)("div",{className:"mr-2 p-2 d-flex justify-content-center",children:!0==c&&(0,a.jsxs)("table",{className:"table table-condensed table-bordered text-center table-sm w-100 bg-light",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"검사 결과"}),(0,a.jsx)("th",{children:"검출 된 색상"}),(0,a.jsx)("th",{children:"검출되어야 할 색상"})]})}),(0,a.jsx)("tbody",{children:(0,a.jsxs)("tr",{children:[!0==t.result&&(0,a.jsx)("td",{children:"합 격"}),!1==t.result&&(0,a.jsx)("td",{children:"불합격"}),(0,a.jsx)("td",{children:t.detected}),(0,a.jsx)("td",{children:t.expected})]})})]})})},y=e=>{let[t,s]=(0,n.useState)([]),[c,r]=(0,n.useState)(),[i,l]=(0,n.useState)(),[d,m]=(0,n.useState)([]),[h,u]=(0,n.useState)(0),[x,p]=(0,n.useState)(!1),[j,N]=(0,n.useState)({}),[g,y]=(0,n.useState)(!0),[D,I]=(0,n.useState)(""),[w,C]=(0,n.useState)(""),[v,k]=(0,n.useState)(!1),[E,S]=(0,n.useState)(0),[O,A]=(0,n.useState)("");(0,n.useEffect)(()=>{(async()=>{try{let t="".concat("https://api-cs.neuronaware.net","/inspections/history/").concat(e.state.IID);await o()(t,{method:"GET",headers:{"Content-Type":"application/json",authorization:e.state.token,customerid:e.state.customerName,csattempt:!0}}).then(e=>{if(200===e.status)return e.json();throw Error(e)}).then(t=>{S(t.customerId),A(t.customerName),r(t.LotSeq),l(t.InspectionResult),m(t.EtcResult),s(t.Histories),y(!1),I(e.state.IID),t.EtcResult.forEach(e=>{"Barcode"==e.key&&C(e.value),"ColorClusterDetection"==e.key&&k(!0)})}).catch(e=>{console.error("!!!!!!!!!! [GET]/history api ERROR !!!!!!! \n ".concat(e))})}catch(e){window.alert("상세정보를 불러오는데 실패하였습니다. 동일한 에러가 계속 발생시 관리자 문의 부탁드립니다.")}})()},[]);let R=async s=>{u(s.target.id),t.forEach(t=>{t.HID==s.target.id&&N({modelHistories:t.models,token:e.state.token,customerName:e.state.customerName,inspectionCustomerName:e.state.inspectionCustomerName,imageID:t.imageID})}),p(!0)};return(0,a.jsx)(a.Fragment,{children:!0==g?(0,a.jsx)("div",{className:"text-center mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light",type:"button",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-border spinner-border-sm",role:"status","aria-hidden":"true"}),"검사 상세 정보 Loading..."]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mr-2 p-2 d-flex justify-content-center",children:(0,a.jsx)("table",{className:"table table-condensed table-bordered text-center table-sm w-100 bg-light",children:(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"bg-secondary text-white",children:"차 종"}),(0,a.jsx)("td",{children:e.state.inspectionName})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"bg-secondary text-white",children:"검사 고유 번호"}),(0,a.jsx)("td",{children:e.state.IID})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"bg-secondary text-white",children:"Lot"}),(0,a.jsx)("td",{children:c})]}),(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"bg-secondary text-white",children:"최종 검사 결과"}),!0==i&&(0,a.jsx)("td",{children:"합 격"}),!1==i&&(0,a.jsx)("td",{children:"불합격"})]}),w.length>0&&(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"bg-secondary text-white",children:"BarCode 정보"}),(0,a.jsx)("td",{children:w})]})]})})}),(0,a.jsx)("div",{className:"mr-2 p-2 d-flex justify-content-center",children:(0,a.jsxs)("table",{className:"table table-sm table-hover text-center align-middle w-100",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:"검사 일시"}),(0,a.jsx)("td",{children:"검사 결과"})]})}),(0,a.jsx)("tbody",{children:t.map(e=>(0,a.jsx)("tr",{children:h==e.HID?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"bg-secondary",children:(0,a.jsx)("a",{className:"text-white",href:"#",id:e.HID,onClick:R,children:e.inspectionDate})}),(0,a.jsxs)("td",{className:"bg-secondary",children:["1"==e.result&&(0,a.jsx)("a",{className:"text-white",href:"#",id:e.HID,onClick:R,children:"합 격"}),"0"==e.result&&(0,a.jsx)("a",{className:"text-white",href:"#",id:e.HID,onClick:R,children:"불합격"})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{children:(0,a.jsx)("a",{className:"text-secondary",href:"#",id:e.HID,onClick:R,children:e.inspectionDate})}),(0,a.jsxs)("td",{children:["1"==e.result&&(0,a.jsx)("a",{className:"text-secondary",href:"#",id:e.HID,onClick:R,children:"합 격"}),"0"==e.result&&(0,a.jsx)("a",{className:"text-secondary",href:"#",id:e.HID,onClick:R,children:"불합격"})]})]})},e.HID))})]})}),!0==x&&(0,a.jsxs)(a.Fragment,{children:[!0==v&&(0,a.jsx)(f,{state:j,IID:D,imageID:j.imageID}),(0,a.jsx)(b,{state:j,IID:D,inspectionCustomerId:E,inspectionCustomerName:O})]})]})})},D=e=>{let[t,s]=(0,n.useState)(!1),[c,r]=(0,n.useState)(!0),[i,l]=(0,n.useState)([]),[d,m]=(0,n.useState)({});(0,n.useEffect)(()=>{(async()=>{let t="".concat("https://api-cs.neuronaware.net","/inspections/historyList?inspectionDateStart=").concat(e.state.startDate,"&inspectionDateEnd=").concat(e.state.endDate,"&inspectionID=").concat(e.state.inspectionID,"&result=").concat(e.state.inspectionResult);await o()(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":"*"}}).then(e=>{if(200==e.status)return e.json();throw Error("Return is ".concat(e.status))}).then(e=>{l(e.history),r(!1)}).catch(e=>{console.error("!!!!!!!!!! [GET]/history api ERROR !!!!!!! \n ".concat(e)),window.alert("검사 이력을 조회하는 중에 오류가 발생했습니다.")})})()},[]);let h=t=>{m({token:e.state.token,customerName:e.state.customerName,IID:t.target.id,inspectionID:e.state.inspectionID,inspectionName:e.state.inspectionName,inspectionCustomerName:e.state.inspectionCustomerName}),s(!0)};return(0,a.jsx)(a.Fragment,{children:!0==c?(0,a.jsx)("div",{className:"text-center mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light",type:"button",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-border spinner-border-sm",role:"status","aria-hidden":"true"}),"검사 목록 Loading..."]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("header",{children:(0,a.jsx)("div",{className:"w-100",children:(0,a.jsxs)("nav",{className:"navbar navbar-expand-sm navbar-dark navbar-fixed-top bg-dark",children:[(0,a.jsx)("div",{children:(0,a.jsx)("h1",{className:"text-light text-center",children:"검사 이력"})}),(0,a.jsx)("div",{className:"collapse navbar-collapse justify-content-end",children:(0,a.jsxs)("ul",{className:"navbar-nav",children:[(0,a.jsx)("li",{className:"nav-item",children:!0==t&&(0,a.jsx)("a",{className:"nav-link",href:"#",onClick:e=>{s(!1)},children:"BACK"})}),(0,a.jsx)("li",{children:(0,a.jsx)("a",{className:"nav-link",href:"#",onClick:t=>{e.setShowInspectionHistoriesState()},children:"CLOSE"})})]})})]})})}),(0,a.jsx)("br",{}),(0,a.jsx)("main",{overflow:"auto",children:!0==t?(0,a.jsx)(y,{state:d,overflow:"auto"}):(0,a.jsxs)("div",{children:[(0,a.jsx)("table",{className:"table mb-0 w-100",children:(0,a.jsx)("thead",{className:"bg-light text-dark d-block",children:(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("td",{className:"col-sm-2 text-center",children:"검사 제품 명"}),(0,a.jsx)("td",{className:"col-sm-4 text-center",children:e.state.inspectionName}),(0,a.jsx)("td",{className:"col-sm-2 text-center",children:"조회 기간"}),(0,a.jsxs)("td",{className:"col-sm-4 text-center",children:[e.state.startDate," - ",e.state.endDate]})]})})}),(0,a.jsxs)("table",{className:"table table-fixed table-hover table-condensed table-bordered text-center table-sm w-100",children:[(0,a.jsx)("thead",{className:"bg-secondary bg-gradient text-white d-block",children:(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("th",{className:"col-sm-4 align-middle",children:"검사 일시"}),(0,a.jsx)("th",{className:"col-sm-4 align-middle",children:"검사 결과"}),(0,a.jsx)("th",{className:"col-sm-4 align-middle",children:"Lot"})]})}),(0,a.jsx)("tbody",{className:"overflow-auto d-block",children:i.map(e=>(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("td",{className:"col-sm-4 align-middle",id:e.IID,children:(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:h,id:e.IID,value:e.imageID,children:function(e){let t=e.split("T"),s=t[1].split(".");return t[0]+" "+s[0]}(e.inspectionDate)})}),1==e.result&&(0,a.jsx)("td",{className:"col-sm-4 align-middle",id:e.IID,children:(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:h,id:e.IID,value:e.imageID,children:"합격"})}),0==e.result&&(0,a.jsx)("td",{className:"col-sm-4 align-middle",id:e.IID,children:(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:h,id:e.IID,value:e.imageID,children:"불합격"})}),(0,a.jsx)("td",{className:"col-sm-4 align-middle",children:null==e.LotSeq?(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:h,id:e.IID,value:e.imageID,children:"검사 불합격으로 lot 없음"}):(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:h,id:e.IID,value:e.imageID,children:e.LotSeq})})]},e.IID))})]})]})})]})})},I=e=>{let[t,s]=(0,n.useState)([]),[c,r]=(0,n.useState)([]);return(0,n.useEffect)(()=>{(async()=>{try{let t="".concat("https://api-cs.neuronaware.net","/inspections/detectionObjectResults?IID=").concat(e.state.IID,"&HID=").concat(e.state.HID,"&modelId=").concat(e.state.modelId);await fetch(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":"*"}}).then(e=>{if(200===e.status)return e.json();throw Error(e)}).then(e=>{e.detectionObjectResults.forEach(e=>{e.numDetection=e.detectionObjectCount,e.numObjects=e.numOfObject}),s(e.detectionObjectResults),r(e.colorDetectionResults)}).catch(e=>{console.error("!!!!!!!!!! [GET]/detectionObjectResults api ERROR !!!!!!! \n ".concat(e))})}catch(e){window.alert("상세정보를 불러오는데 실패하였습니다. 동일한 에러가 계속 발생시 관리자 문의 부탁드립니다.")}})()},[]),(0,a.jsxs)("div",{children:[(0,a.jsx)("header",{children:(0,a.jsx)("div",{className:"w-100",children:(0,a.jsxs)("nav",{className:"navbar navbar-expand-sm navbar-dark navbar-fixed-top bg-dark",children:[(0,a.jsx)("div",{children:(0,a.jsx)("h1",{className:"text-light text-center",children:"검사 이력"})}),(0,a.jsx)("div",{className:"collapse navbar-collapse justify-content-end",children:(0,a.jsx)("ul",{className:"navbar-nav",children:(0,a.jsx)("li",{children:(0,a.jsx)("a",{className:"nav-link",href:"#",onClick:t=>{e.setCloseFailDetectionObjectState()},children:"CLOSE"})})})})]})})}),(0,a.jsx)("br",{}),(0,a.jsxs)("main",{children:[(0,a.jsx)("table",{className:"table mb-0 w-100",children:(0,a.jsx)("thead",{className:"bg-light text-dark d-block",children:(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("td",{className:"col-sm-4 text-center",children:"검사 일시"}),(0,a.jsx)("td",{className:"col-sm-4 text-center",children:function(e){let t=e.split("T"),s=t[1].split(".");return t[0]+" "+s[0]}(e.state.inspectionDate)})]})})}),(0,a.jsx)("div",{className:"mr-2 p-2 d-flex justify-content-center",children:"objectDetection"==e.state.detectionType?(0,a.jsx)(N,{detectionObjectResults:t,token:e.state.token,customerName:e.state.customerName,inspectionCustomerName:null,modelName:e.state.modelName,imageID:e.state.imageID,modelId:e.state.modelId,IID:e.state.IID},e.state.modelId):(0,a.jsx)(N,{colorDetectionResults:c,token:e.state.token,customerName:e.state.customerName,inspectionCustomerName:null,modelName:e.state.modelName,imageID:e.state.imageID,modelId:e.state.modelId,IID:e.state.IID},e.state.modelId)})]})]})},w=e=>{let[t,s]=(0,n.useState)([]),[c,r]=(0,n.useState)({}),[i,l]=(0,n.useState)(!1),[o,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{let t="".concat("https://api-cs.neuronaware.net","/inspections/failHistories?startDate=").concat(e.historyDetailInput.startDate,"&endDate=").concat(e.historyDetailInput.endDate,"&modelId=").concat(e.historyDetailInput.modelId,"&detectionType=").concat(e.historyDetailInput.detectionType,"&subpartId=").concat(e.historyDetailInput.subpartId,"&errorCode=").concat(e.historyDetailInput.errorCode);await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",authorization:e.historyDetailInput.token,customerid:e.historyDetailInput.customerName,"Access-Control-Allow-Origin":"*","Aceess-Control-Allow-Credentials":!0,"Access-Control-Allow-Headers":"*"}}).then(e=>{if(200==e.status)return e.json();throw Error("Return is ".concat(e.status))}).then(t=>{t.forEach(t=>{t.token=e.historyDetailInput.token,t.customerName=e.historyDetailInput.customerName,t.inspectionCustomerName=e.historyDetailInput.inspectionCustomerName,t.modelId=e.historyDetailInput.modelId,t.modelName=e.historyDetailInput.modelName,t.detectionType=e.historyDetailInput.detectionType,t.subpartId=e.historyDetailInput.subpartId,t.colorCode=e.historyDetailInput.colorCode,t.errorCode=e.historyDetailInput.errorCode,t.startDate=e.historyDetailInput.startDate,t.endDate=e.historyDetailInput.endDate}),s(t),d(!0)}).catch(e=>{console.error("!!!!!!!!!! [GET]/failHistories api ERROR !!!!!!! \n ".concat(e)),window.alert("검사 실패 이력을 조회하는 중에 오류가 발생했습니다.")})})()},[e.historyDetailInput.modelId,e.historyDetailInput.detectionType,e.historyDetailInput.subpartId,e.historyDetailInput.colorCode,e.historyDetailInput.errorCode,e.historyDetailInput.startDate,e.historyDetailInput.endDate]);let m=e=>{let s,a=e.target.id;t.forEach(e=>{e.imageID==a&&(s=e)}),r(s),l(!0)},h=e=>{l(!i)};return(0,a.jsxs)("div",{className:"w-100",children:[(0,a.jsx)("h1",{children:e.historyDetailInput.modelName}),!1==o?(0,a.jsx)("div",{className:"text-center mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light",type:"button",id:"carType",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-grow spinner-grow-sm",role:"status","aria-hidden":"true"}),"Loading..."]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("table",{className:"table table-fixed table-hover table-condensed table-bordered text-center table-sm w-100",children:[(0,a.jsx)("thead",{className:"bg-secondary bg-gradient text-white d-block",children:(0,a.jsx)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:(0,a.jsx)("td",{className:"col-sm-12 align-middle",children:"검사 일시"})})}),(0,a.jsx)("tbody",{className:"overflow-auto d-block",children:t.map(e=>(0,a.jsx)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:(0,a.jsx)("td",{className:"col-sm-12 align-middle",id:e.imageID,children:(0,a.jsx)("a",{className:"text-secondary",href:"#",onClick:m,id:e.imageID,children:function(e){let t=e.split("T"),s=t[1].split(".");return t[0]+" "+s[0]}(e.inspectionDate)})})}))})]}),i&&(0,a.jsx)(j(),{isOpen:i,onRequestClose:h,style:{overlay:{backgroundColor:"rgba(0, 0, 0, 0.6)"},content:{top:"50%",left:"50%",right:"auto",bottom:"auto",marginRight:"-50%",transform:"translate(-50%, -50%)",width:"90%",height:"90%"}},close:!0,children:(0,a.jsx)(I,{state:c,setCloseFailDetectionObjectState:h})})]})]})},C=e=>{let[t,s]=(0,n.useState)(e.modelId),[c,r]=(0,n.useState)(e.modelName),[i,l]=(0,n.useState)(e.subparts),[o,d]=(0,n.useState)(),[m,h]=(0,n.useState)(e.state.startDate),[u,x]=(0,n.useState)(e.state.endDate),[p,j]=(0,n.useState)(!1),[N,g]=(0,n.useState)(),[b,f]=(0,n.useState)(e.colorDetections);(0,n.useEffect)(()=>{let t=0;e.subparts.forEach(e=>{t+=e.SubpartErrorCount}),d(t)},[]);let y=s=>{console.log(s.target.dataset);let a=s.target.dataset.detectiontype,n=s.target.dataset.subpartid?s.target.dataset.subpartid:null,r=s.target.dataset.colorcode?s.target.dataset.colorcode:null,i={token:e.state.token,customerName:e.state.customerName,inspectionCustomerName:e.state.inspectionCustomerName,modelId:t,modelName:c,detectionType:a,subpartId:n,colorCode:r,errorCode:s.target.dataset.errorcode,startDate:m,endDate:u};s.target.dataset.count>0&&(g(i),j(!0),e.setShowFailDetailState(!0))};return(0,a.jsx)(a.Fragment,{children:!0==p?(0,a.jsx)(w,{props:e,historyDetailInput:N}):(0,a.jsxs)("div",{className:"mr-2 p-2 justify-content-center w-100",children:[(0,a.jsx)("h1",{children:c}),i.length>0?(0,a.jsxs)("table",{className:"table mb-0 w-10 table-hover",children:[(0,a.jsx)("thead",{className:"bg-light text-dark",children:(0,a.jsxs)("tr",{className:"align-content-start align-middle",children:[(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검사 부품명"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"부품 검출 안됨"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"알수 없는 객체 검출"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출되지 말아야 할 부품 검출"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출된 부품 수가 맞지 않음"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출되지 않은 부품이 있음"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출 영역을 벗어남"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출 영역에서 검출되지 않음"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"부품 유사도가 떨어짐"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"재질 검사 실패"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"정의되지 않은 검사 실패"})]})}),(0,a.jsx)("tbody",{children:i.map(e=>(0,a.jsxs)("tr",{id:e.subpartId,children:[(0,a.jsx)("td",{className:"col-sm-1",children:null==e.subpartName?(0,a.jsx)(a.Fragment,{children:"삭제된 검사 부품"}):(0,a.jsx)(a.Fragment,{children:e.subpartName})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NoDetections?e.NoDetections:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDeection","data-subpartid":e.subpartId,"data-errorcode":"1","data-count":e.NoDetections,children:e.NoDetections})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.UnknownObjectDetected?e.UnknownObjectDetected:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"2","data-count":e.UnknownObjectDetected,children:e.UnknownObjectDetected})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NegativeObjectDetected?e.NegativeObjectDetected:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"3","data-count":e.NegativeObjectDetected,children:e.NegativeObjectDetected})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NumberOfObjectNotMatched?e.NumberOfObjectNotMatched:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"4","data-count":e.NumberOfObjectNotMatched,children:e.NumberOfObjectNotMatched})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NotEnoughObjectDetected?e.NotEnoughObjectDetected:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"5","data-count":e.NotEnoughObjectDetected,children:e.NotEnoughObjectDetected})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.BoundaryNotMatched?e.BoundaryNotMatched:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"6","data-count":e.BoundaryNotMatched,children:e.BoundaryNotMatched})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.ObjectNotDetectedOnTheBoundary?e.ObjectNotDetectedOnTheBoundary:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"7","data-count":e.ObjectNotDetectedOnTheBoundary,children:e.ObjectNotDetectedOnTheBoundary})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NotMatchedHistogram?e.NotMatchedHistogram:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"8","data-count":e.NotMatchedHistogram,children:e.NotMatchedHistogram})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NotMatchedRGBKMeansClustering?e.NotMatchedRGBKMeansClustering:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"9","data-count":e.NotMatchedRGBKMeansClustering,children:e.NotMatchedRGBKMeansClustering})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.UnknownObjectDetected?e.UnknownObjectDetected:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"objectDetection","data-subpartid":e.subpartId,"data-errorcode":"99","data-count":e.UnknownObjectDetected,children:e.UnknownObjectDetected})})]}))})]}):(0,a.jsx)(a.Fragment,{}),b.length>0?(0,a.jsxs)("table",{className:"table mb-0 w-10 table-hover",children:[(0,a.jsx)("thead",{className:"bg-light text-dark",children:(0,a.jsxs)("tr",{className:"align-content-start align-middle",children:[(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검사 색상명"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"색상 검출 범위를 벗어남"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출 영역에 대한 기준 부품 ID가 없음"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출 영역에 대한 기준 부품이 없음"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"검출 영역을 벗어남"}),(0,a.jsx)("th",{className:"col-sm-1 text-center",children:"정의되지 않은 검사 실패"})]})}),(0,a.jsx)("tbody",{children:b.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"col-sm-1 text-center",children:e.colorCode}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.ColorOutOfRange?e.ColorOutOfRange:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"colorDetection","data-colorcode":e.colorCode,"data-errorcode":"1","data-count":e.ColorOutOfRange,children:e.ColorOutOfRange})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NotMatchYoloIdBetweenSubpartAndColorDetection?e.NotMatchYoloIdBetweenSubpartAndColorDetection:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"colorDetection","data-colorcode":e.colorCode,"data-errorcode":"2","data-count":e.NotMatchYoloIdBetweenSubpartAndColorDetection,children:e.NotMatchYoloIdBetweenSubpartAndColorDetection})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.NotFoundYoloIdFromDetectResult?e.NotFoundYoloIdFromDetectResult:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"colorDetection","data-colorcode":e.colorCode,"data-errorcode":"3","data-count":e.NotFoundYoloIdFromDetectResult,children:e.NotFoundYoloIdFromDetectResult})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.OutOfColorDetectionBoundaryMatching?e.OutOfColorDetectionBoundaryMatching:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"colorDetection","data-colorcode":e.colorCode,"data-errorcode":"4","data-count":e.OutOfColorDetectionBoundaryMatching,children:e.OutOfColorDetectionBoundaryMatching})}),(0,a.jsx)("td",{className:"col-sm-1 text-center",onClick:y,children:0==e.InternalExceptionOccurred?e.InternalExceptionOccurred:(0,a.jsx)("a",{className:"text-secondary",href:"#","data-detectiontype":"colorDetection","data-colorcode":e.colorCode,"data-errorcode":"5","data-count":e.InternalExceptionOccurred,children:e.InternalExceptionOccurred})})]}))})]}):(0,a.jsx)(a.Fragment,{})]})})},v=e=>{let[t,s]=(0,n.useState)(!0),[c,r]=(0,n.useState)(0),[i,l]=(0,n.useState)([]),[d,m]=(0,n.useState)(!1),[h,u]=(0,n.useState)(0),[x,p]=(0,n.useState)([]);(0,n.useEffect)(()=>{(async()=>{let t="".concat("https://api-cs.neuronaware.net","/inspections/historiesFailOverview?startDate=").concat(e.state.startDate,"&endDate=").concat(e.state.endDate,"&inspectionID=").concat(e.state.inspectionID);await o()(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":"*"}}).then(e=>{if(200==e.status)return e.json();throw Error("Return is ".concat(e.status))}).then(e=>{r(e.totalErrorCount),l(e.detectionErrorHistories),u(e.colorClusterDetectionErrorCount),p(e.colorDetectionFailResults),s(!1),m(!1)}).catch(e=>{console.error("!!!!!!!!!! [GET]/historiesFailOverview api ERROR !!!!!!! \n ".concat(e)),window.alert("검사 실패 이력을 조회하는 중에 오류가 발생했습니다.")})})()},[e.state.inspectionID,e.state.startDate,e.state.endDate,t]);let j=e=>{m(!0)};return(0,a.jsx)(a.Fragment,{children:!0==t?(0,a.jsx)("div",{className:"text-center mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light",type:"button",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-border spinner-border-sm",role:"status","aria-hidden":"true"}),"검사 실패 이력 Loading..."]})}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("header",{children:(0,a.jsx)("div",{className:"w-100",children:(0,a.jsxs)("nav",{className:"navbar navbar-expand-sm navbar-dark navbar-fixed-top bg-dark",children:[(0,a.jsx)("div",{children:(0,a.jsx)("h1",{className:"text-light text-center",children:"검사 실패 이력"})}),(0,a.jsx)("div",{className:"collapse navbar-collapse justify-content-end",children:(0,a.jsxs)("ul",{className:"navbar-nav",children:[(0,a.jsx)("li",{className:"nav-item",children:!0==d&&(0,a.jsx)("a",{className:"nav-link",href:"#",onClick:e=>{s(!0),m(!1)},children:"BACK"})}),(0,a.jsx)("li",{children:(0,a.jsx)("a",{className:"nav-link",href:"#",onClick:t=>{e.setShowInspectionFailHistoriesState()},children:"CLOSE"})})]})})]})})}),(0,a.jsx)("br",{}),(0,a.jsxs)("main",{children:[(0,a.jsx)("div",{className:"w-100",children:(0,a.jsx)("table",{className:"table mb-0 w-100",children:(0,a.jsx)("thead",{className:"bg-light text-dark d-block",children:(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("td",{className:"col-sm-2 text-center",children:"검사 제품 명"}),(0,a.jsx)("td",{className:"col-sm-4 text-center",children:e.state.inspectionName}),(0,a.jsx)("td",{className:"col-sm-2 text-center",children:"조회 기간"}),(0,a.jsxs)("td",{className:"col-sm-4 text-center",children:[e.state.startDate," - ",e.state.endDate]})]})})})}),(0,a.jsx)("br",{}),h>0&&(0,a.jsx)("table",{className:"table mb-0 w-100",children:(0,a.jsx)("tbody",{className:"bg-light text-dark",children:(0,a.jsxs)("tr",{className:"d-flex align-content-start flex-wrap align-middle",children:[(0,a.jsx)("td",{className:"col-sm-6 text-center",children:"재질 검사 실패"}),(0,a.jsx)("td",{className:"col-sm-6 text-center",children:h})]})})}),null!=i&&i.length>0?i.map(t=>(0,a.jsx)("div",{children:(0,a.jsx)(C,{modelId:t.modelId,modelName:t.modelName,subparts:t.subparts,colorDetections:x,startDate:e.state.startDate,endDate:e.state.endDate,state:e.state,setShowFailDetailState:j})})):x.map(t=>(0,a.jsx)("div",{children:(0,a.jsx)(C,{modelId:t.modelId,modelName:t.modelName,subparts:[],colorDetections:x,startDate:e.state.startDate,endDate:e.state.endDate,state:e.state,setShowFailDetailState:j})}))]})]})})},k=e=>{let[t,s]=(0,n.useState)([]),[c,r]=(0,n.useState)([]),[i,l]=(0,n.useState)("all"),[d,h]=(0,n.useState)(!1),[p,N]=(0,n.useState)({}),[g,b]=(0,n.useState)(!1),[f,y]=(0,n.useState)(!1),[I,w]=(0,n.useState)(!1),[C,k]=(0,n.useState)("bg-secondary text-white sticky-top");(0,n.useEffect)(()=>{(async()=>{if(e.state.submitInspectionHistorySearchEngine||I){h(!0),l("all");let t="".concat("https://api-cs.neuronaware.net","/inspections/historiesOverview?startDate=").concat(e.state.startDate,"&endDate=").concat(e.state.endDate);E(e.state.selectcustomer)&&(t+="&customerName=".concat(e.state.selectcustomer)),E(e.state.carType)&&(t+="&carType=".concat(e.state.carType)),E(e.state.specification)&&(t+="&specification=".concat(e.state.specification)),E(e.state.productName)&&(t+="&productName=".concat(e.state.productName)),E(e.state.colorCode)&&(t+="&colorCode=".concat(e.state.colorCode)),E(e.state.ALC)&&(t+="&ALC=".concat(e.state.ALC)),E(e.state.productNumber)&&(t+="&productNumber=".concat(e.state.productNumber)),await o()(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 ".concat(e.status))}).then(e=>{s(e),r(e),h(!1)}).catch(e=>{console.error("!!!!!!!!!! [GET]/overview api ERROR !!!!!!! \n ".concat(e)),window.alert("검사 결과를 조회하는 중에 오류가 발생했습니다.")})}})()},[e]);let S=t=>{let s=t.target.id.split("+"),a=!0;"FAIL"==s[3]&&(a=!1),"ALL"==s[3]&&(a="all"),N({inspectionID:s[0],inspectionName:s[1],inspectionCustomerName:s[2],inspectionResult:a,token:e.state.token,customerName:e.state.customerName,startDate:e.state.startDate,endDate:e.state.endDate}),O()},O=()=>{g?k("bg-secondary text-white"):k("bg-secondary"),w(!0),b(!g)},A=t=>{let s=t.target.id.split("+"),a=!0;"FAIL"==s[3]&&(a=!1),"ALL"==s[3]&&(a="all"),N({inspectionID:s[0],inspectionName:s[1],inspectionCustomerName:s[2],inspectionResult:a,token:e.state.token,customerName:e.state.customerName,startDate:e.state.startDate,endDate:e.state.endDate}),R()},R=()=>{f?k("bg-secondary bg-gradient text-white"):k("bg-secondary"),w(!0),y(!f)},T={overlay:{backgroundColor:"rgba(0, 0, 0, 0.6)"},content:{top:"50%",left:"50%",right:"auto",bottom:"auto",marginRight:"-50%",transform:"translate(-50%, -50%)",width:"90%",height:"90%"}};return(0,a.jsx)(a.Fragment,{children:!0==e.state.submitInspectionHistorySearchEngine&&(0,a.jsx)("div",{className:"container-fluid",children:!0==d?(0,a.jsx)("div",{className:"text-center mr-5 p-5",children:(0,a.jsxs)("button",{className:"btn btn-light align-middle text-center",type:"button",disabled:!0,children:[(0,a.jsx)("span",{className:"spinner-border spinner-border-sm",role:"status","aria-hidden":"true"}),"검사 결과 Loading..."]})}):(0,a.jsxs)("div",{className:"h-75",children:[(0,a.jsxs)("div",{className:"row g-1 p-1 m-3",children:[(0,a.jsxs)("h4",{className:"col-md-8 text-secondary",children:["검사 기간 [ ",e.state.startDate," - ",e.state.endDate," ]"]}),(0,a.jsx)("div",{className:"col-md-2",children:(0,a.jsxs)("div",{className:"form-floating",children:[(0,a.jsxs)("select",{className:"form-select",value:i,onChange:e=>{let s=e.target.value;if(l(s),"all"===s)return void r(t);r(t.filter(e=>{let t=e.inspectionName.match(/LINE(\d+)/i);return t&&t[1]===s}))},children:[(0,a.jsx)("option",{value:"all",children:"전체"}),[1,2,3,4,5].map(e=>(0,a.jsxs)("option",{value:e.toString(),children:["LINE ",e]},e))]}),(0,a.jsx)("label",{children:"LINE 필터"})]})}),(0,a.jsx)("button",{type:"button",className:"btn btn-outline-secondary bg-secondary text-white col-md-2",width:50,height:20,onClick:()=>{try{let t="조회 기간 [ ".concat(e.state.startDate," - ").concat(e.state.endDate," ] 검사 결과 ");"TRUE"==e.state.inspectionResult&&(t+=" (합 격)"),"FALSE"==e.state.inspectionResult&&(t+=" (불 합 격)");let s=[];c.forEach(t=>{let a={};a["고객사"]=t.customerName,a["검사 명"]=t.inspectionName,a["차종"]=t.carType,a["사양"]=t.specification,a["품명"]=t.productName,a["ALC CODE"]=t.ALCCODE,a["품번"]=t.productNumber,("TRUE"==e.state.inspectionResult||"ALL"==e.state.inspectionResult)&&(a["검사 합격 수"]=t.pass),("FALSE"==e.state.inspectionResult||"ALL"==e.state.inspectionResult)&&(a["검사 불합격 수"]=t.fail),a["총 검사 수"]=t.total,a["검사 합격율"]=t.percent,s.push(a)});let a=x.default.utils.json_to_sheet(s),n=x.default.write({Sheets:{data:a},SheetNames:["data"]},{bookType:"xlsx",type:"array"}),r=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"});u().saveAs(r,t+".xlsx")}catch(e){console.error("HistoryOverview Download Error \n ".concat(e)),alert("검사 결과를 다운로드하는데 문제가 발생했습니다. 계속적으로 문제가 발생할 경우 관리자에게 문의 해 주세요.")}},children:"검사 결과 다운로드 (xlsx)"})]}),(0,a.jsx)("div",{className:"row h-auto",children:(0,a.jsxs)("table",{className:"table table-fixed table-hover table-bordered text-center",children:[(0,a.jsx)("thead",{className:C,children:(0,a.jsxs)("tr",{children:["ALL"==e.state.inspectionResult.toUpperCase()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("th",{className:"align-middle text-center",children:"고객사"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"차종"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"사양"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"ALC CODE"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품번"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 합격 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 불합격 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"총 검사 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 합격율"})]}),"TRUE"==e.state.inspectionResult&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("th",{className:"align-middle text-center",children:"고객사"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 제품 명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"차종"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"사양"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"ALC CODE"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품번"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 합격 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"총 검사 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 합격율"})]}),"FALSE"==e.state.inspectionResult&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("th",{className:"align-middle text-center",children:"고객사"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 제품 명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"차종"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"사양"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품명"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"ALC CODE"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"품번"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 불합격 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"총 검사 수"}),(0,a.jsx)("th",{className:"align-middle text-center",children:"검사 합격율"})]})]})}),(0,a.jsx)("tbody",{className:"vh-75",children:c.map(t=>(0,a.jsxs)("tr",{className:"align-content-start align-middle",children:["ALL"==e.state.inspectionResult.toUpperCase()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"align-middle text-center",children:t.customerName}),(0,a.jsx)("td",{children:t.inspectionName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.carType}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.specification}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.productName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.ALCCODE}),(0,a.jsx)("td",{children:t.productNumber}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-primary",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+PASS",onClick:S,children:t.pass})}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-danger",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+FAIL",onClick:A,children:t.fail})}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-secondary",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+ALL",onClick:S,children:t.total})}),(0,a.jsxs)("td",{className:"align-middle text-center",children:[t.percent,"%"]})]}),"TRUE"==e.state.inspectionResult&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"align-middle text-center",children:t.customerName}),(0,a.jsx)("td",{children:t.inspectionName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.carType}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.specification}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.productName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.ALCCODE}),(0,a.jsx)("td",{children:t.productNumber}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-primary",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+PASS",onClick:S,children:t.pass})}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-secondary",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+ALL",onClick:S,children:t.total})}),(0,a.jsxs)("td",{className:"align-middle text-center",children:[t.percent,"%"]})]}),"FALSE"==e.state.inspectionResult&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"align-middle text-center",children:t.customerName}),(0,a.jsx)("td",{children:t.inspectionName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.carType}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.specification}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.productName}),(0,a.jsx)("td",{className:"align-middle text-center",children:t.ALCCODE}),(0,a.jsx)("td",{children:t.productNumber}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-danger",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+FAIL",onClick:A,children:t.fail})}),(0,a.jsx)("td",{className:"align-middle text-center",children:(0,a.jsx)(m(),{href:"#",className:"text-secondary",id:t.inspectionId+"+"+t.inspectionName+"+"+t.customerName+"+ALL",onClick:A,children:t.total})}),(0,a.jsxs)("td",{className:"align-middle text-center",children:[t.percent,"%"]})]})]},t.inspectionId))})]})}),g&&(0,a.jsx)("div",{className:"modal",children:(0,a.jsx)(j(),{isOpen:g,onRequestClose:()=>O(),style:T,close:!0,width:600,height:500,children:(0,a.jsx)(D,{state:p,setShowInspectionHistoriesState:O})})}),f&&(0,a.jsx)(j(),{isOpen:f,onRequestClose:()=>R(),style:T,close:!0,width:600,height:500,children:(0,a.jsx)(v,{state:p,setShowInspectionFailHistoriesState:R})})]})})})};function E(e){return void 0!=e&&"undifined"!=e&&null!=e&&"all"!=e&&"All"!=e&&"ALL"!=e&&0!=e.length&&!0}class S extends n.Component{static async getInitialProps(e){return{token:r()(e).token,customerName:r()(e).customerID}}async handleSubmitInspectionHistorySearchEngine(e){this.setState({selectcustomer:e.selectcustomer,startDate:e.startDate,endDate:e.endDate,carType:e.carType,productName:e.productName,colorCode:e.colorCode,productNumber:e.productNumber,ALCCode:e.ALC,productNumber:e.productNumber,specification:e.specification,inspectionResult:e.inspectionResult,submitInspectionHistorySearchEngine:!0})}render(){return(0,a.jsxs)("div",{className:"container-fluid vh-100 d-flex flex-column",children:[(0,a.jsx)("div",{className:"row g-1 m-3",children:(0,a.jsxs)("div",{className:"w-100",children:[(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),(0,a.jsx)("h3",{className:"align-middle text-center",children:"검사 결과 조회"}),(0,a.jsx)(i.A,{state:this.state,handleSubmitInspectionHistorySearchEngine:this.handleSubmitInspectionHistorySearchEngine})]})}),(0,a.jsx)("div",{className:"row flex-grow-1 overflow-auto",children:(0,a.jsx)(k,{state:this.state})})]})}constructor(e){super(e),this.handleSubmitInspectionHistorySearchEngine=this.handleSubmitInspectionHistorySearchEngine.bind(this),this.state={token:e.token,customerName:e.customerName,startDate:null,endDate:null,carTypeId:null,productNameId:null,colorCodeId:null,productNumber:null,ALCCode:null,specification:null,inspectionResult:null,submitInspectionHistorySearchEngine:!1,selectcustomer:null}}}let O=S},82491:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/inspectionHistory",function(){return s(70436)}])},83686:()=>{},96390:(e,t,s)=>{"use strict";var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==s.g)return s.g;throw Error("unable to locate global object")}();e.exports=t=a.fetch,a.fetch&&(t.default=a.fetch.bind(a)),t.Headers=a.Headers,t.Request=a.Request,t.Response=a.Response}},e=>{var t=t=>e(e.s=t);e.O(0,[509,647,636,593,792],()=>t(82491)),_N_E=e.O()}]);