|
|
|
@@ -48,8 +48,10 @@ import { NEXT_PUBLIC_API_URL } from "@/config/api"; |
|
|
|
import axiosInstance from "@/app/(main)/axios/axiosInstance"; |
|
|
|
import EscalationComponent from "./EscalationComponent"; |
|
|
|
import QcDataGrid from "./QCDatagrid"; |
|
|
|
import { dummyEscalationHistory, dummyQCData } from "./dummyQcTemplate"; |
|
|
|
import { escape, min } from "lodash"; |
|
|
|
import { dummyEscalationHistory, |
|
|
|
dummyQcData_A1, dummyQcData_E1, dummyQcData_E2, |
|
|
|
dummyQcHeader_A1, dummyQcHeader_E1, dummyQcHeader_E2 } from "./dummyQcTemplate"; |
|
|
|
import { escape, isNull, min } from "lodash"; |
|
|
|
import { PanoramaSharp } from "@mui/icons-material"; |
|
|
|
import EscalationLogTable from "../DashboardPage/escalation/EscalationLogTable"; |
|
|
|
import { EscalationResult } from "@/app/api/escalation"; |
|
|
|
@@ -389,7 +391,7 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { |
|
|
|
useEffect(() => { |
|
|
|
console.log("%c Qc Record updated:", "color:green", qcRecord); |
|
|
|
if (qcRecord.length < 1) { // New QC |
|
|
|
const fetchedQcData = dummyQCData; //TODO fetch from DB |
|
|
|
const fetchedQcData = dummyQcData; //TODO fetch from DB |
|
|
|
setValue("qcResult", fetchedQcData); |
|
|
|
} else { |
|
|
|
if (itemDetail?.status == "escalated") { // Copy the previous QC data for editing |
|
|
|
@@ -470,6 +472,33 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { |
|
|
|
} else { return 60} |
|
|
|
}; |
|
|
|
|
|
|
|
// For DEMO |
|
|
|
const dummyQcData = useMemo(() => { |
|
|
|
const d = itemDetail; |
|
|
|
if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") { |
|
|
|
return dummyQcData_E2; |
|
|
|
} else { |
|
|
|
if (d.jobOrderId === null) { |
|
|
|
return dummyQcData_A1; |
|
|
|
} else { |
|
|
|
return dummyQcData_E1; |
|
|
|
} |
|
|
|
} |
|
|
|
}, [itemDetail]) |
|
|
|
|
|
|
|
const dummyQcHeader = useMemo(() => { |
|
|
|
const d = itemDetail;console.log("I am checking now", d); |
|
|
|
if (d.itemId == 23239 || d.itemNo == "PP2277" || d.itemName == "烚意粉") { |
|
|
|
return dummyQcHeader_E2; |
|
|
|
} else { |
|
|
|
if (d.jobOrderId === null) { |
|
|
|
return dummyQcHeader_A1; |
|
|
|
} else { |
|
|
|
return dummyQcHeader_E1; |
|
|
|
} |
|
|
|
} |
|
|
|
}, [itemDetail]) |
|
|
|
|
|
|
|
return ( |
|
|
|
<> |
|
|
|
<Grid container justifyContent="flex-start" alignItems="flex-start"> |
|
|
|
@@ -498,14 +527,13 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { |
|
|
|
|
|
|
|
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}> |
|
|
|
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
|
Group A - 急凍貨類 (QCA1-MEAT01) |
|
|
|
{dummyQcHeader.name} |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle1" sx={{ color: '#666' }}> |
|
|
|
<b>品檢類型</b>:IQC |
|
|
|
<b>品檢類型</b>:{dummyQcHeader.type} |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle2" sx={{ color: '#666' }}> |
|
|
|
記錄探測溫度的時間,請在1小時内完成卸貨盤點入庫,以保障食品安全<br/> |
|
|
|
監察方法:目視檢查、嗅覺檢查和使用適當的食物溫度計,檢查食物溫度是否符合指標 |
|
|
|
{dummyQcHeader.description} |
|
|
|
</Typography> |
|
|
|
</Box> |
|
|
|
{/* <QcDataGrid<ModalFormInput, QcData, EntryError> |
|
|
|
@@ -545,16 +573,15 @@ const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false }) => { |
|
|
|
<EscalationLogTable type="qc" items={itemDetail.escResult || []}/> |
|
|
|
<CollapsibleCard title={t("QC Record")}> |
|
|
|
<Box sx={{ mb: 2, p: 2, backgroundColor: '#f5f5f5', borderRadius: 1 }}> |
|
|
|
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
|
Group A - 急凍貨類 (QCA1-MEAT01) |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle1" sx={{ color: '#666' }}> |
|
|
|
<b>品檢類型</b>:IQC |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle2" sx={{ color: '#666' }}> |
|
|
|
記錄探測溫度的時間,請在1小時内完成卸貨盤點入庫,以保障食品安全<br/> |
|
|
|
監察方法:目視檢查、嗅覺檢查和使用適當的食物溫度計,檢查食物溫度是否符合指標 |
|
|
|
</Typography> |
|
|
|
<Typography variant="h5" component="h2" sx={{ fontWeight: 'bold', color: '#333' }}> |
|
|
|
{dummyQcHeader.name} |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle1" sx={{ color: '#666' }}> |
|
|
|
<b>品檢類型</b>:{dummyQcHeader.type} |
|
|
|
</Typography> |
|
|
|
<Typography variant="subtitle2" sx={{ color: '#666' }}> |
|
|
|
{dummyQcHeader.description} |
|
|
|
</Typography> |
|
|
|
</Box> |
|
|
|
<StyledDataGrid |
|
|
|
columns={qcColumns} |
|
|
|
|