瀏覽代碼

update escalation log

master
kelvinsuen 2 天之前
父節點
當前提交
74179d5ab7
共有 4 個檔案被更改,包括 21 行新增14 行删除
  1. +10
    -2
      src/components/DashboardPage/DashboardPage.tsx
  2. +3
    -10
      src/components/PoDetail/EscalationComponent.tsx
  3. +5
    -1
      src/components/PoDetail/QcStockInModalVer2.tsx
  4. +3
    -1
      src/i18n/zh/dashboard.json

+ 10
- 2
src/components/DashboardPage/DashboardPage.tsx 查看文件

@@ -29,7 +29,11 @@ const DashboardPage: React.FC<Props> = ({
const { t } = useTranslation("dashboard"); const { t } = useTranslation("dashboard");
const router = useRouter(); const router = useRouter();
const [escLog, setEscLog] = useState<EscalationResult[]>([])
const [escLog, setEscLog] = useState<EscalationResult[]>([]);

const getPendingLog = () => {
return escLog.filter(esc => esc.status == "pending");
};
useEffect(() => { useEffect(() => {
setEscLog(escalationLogs); setEscLog(escalationLogs);
@@ -39,7 +43,11 @@ const DashboardPage: React.FC<Props> = ({
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item xs={12}> <Grid item xs={12}>
<CollapsibleCard title={t("My Escalation List")}>
<CollapsibleCard
title={`${t("Responsible Escalation List")} (${t("pending")} : ${
getPendingLog().length > 0 ? getPendingLog().length : t("No")})`}
// defaultOpen={getPendingLog().length > 0} // TODO Fix default not opening
>
<CardContent> <CardContent>
<EscalationLogTable items={escLog}/> <EscalationLogTable items={escLog}/>
</CardContent> </CardContent>


+ 3
- 10
src/components/PoDetail/EscalationComponent.tsx 查看文件

@@ -71,15 +71,6 @@ const EscalationComponent: React.FC<Props> = ({
fetchData(); fetchData();
}, []) }, [])


const nameOptions: NameOption[] = [
{ value: '', label: '請選擇姓名...' },
{ value: 'john', label: '張大明' },
{ value: 'jane', label: '李小美' },
{ value: 'mike', label: '王志強' },
{ value: 'sarah', label: '陳淑華' },
{ value: 'david', label: '林建國' },
];

const { const {
register, register,
formState: { errors, defaultValues, touchedFields }, formState: { errors, defaultValues, touchedFields },
@@ -232,7 +223,7 @@ const EscalationComponent: React.FC<Props> = ({
id="reason" id="reason"
// name="reason" // name="reason"
{...register("escalationLog.reason", { {...register("escalationLog.reason", {
required: "reason required!",
required: "請輸入上報原因",
})} })}
label="上報原因" label="上報原因"
multiline multiline
@@ -240,6 +231,8 @@ const EscalationComponent: React.FC<Props> = ({
// value={formData.reason} // value={formData.reason}
onChange={handleInputChange} onChange={handleInputChange}
placeholder="請輸入上報原因" placeholder="請輸入上報原因"
error={Boolean(errors.escalationLog?.reason)}
helperText={errors.escalationLog?.reason?.message}
/> />


{/* <Stack direction="row" justifyContent="flex-end" gap={1}> {/* <Stack direction="row" justifyContent="flex-end" gap={1}>


+ 5
- 1
src/components/PoDetail/QcStockInModalVer2.tsx 查看文件

@@ -301,15 +301,19 @@ const [qcItems, setQcItems] = useState(dummyQCData)


console.log("QC Data for submission:", qcData); console.log("QC Data for submission:", qcData);
if (data.qcDecision == 3) { // Escalate if (data.qcDecision == 3) { // Escalate
if (data.escalationLog?.handlerId == undefined) { alert("請選擇上報負責同事!"); return; }
else if (data.escalationLog?.handlerId < 1) { alert("上報負責同事資料有誤"); return; }
const escalationLog = { const escalationLog = {
type : "qc", type : "qc",
status : "pending", // TODO: update with supervisor decision status : "pending", // TODO: update with supervisor decision
reason : data.escalationLog?.reason, reason : data.escalationLog?.reason,
recordDate : dayjsToInputDateString(dayjs()), recordDate : dayjsToInputDateString(dayjs()),
handlerId : Number(session?.id),
handlerId : data.escalationLog?.handlerId,
} }
console.log("Escalation Data for submission", escalationLog); console.log("Escalation Data for submission", escalationLog);
await postStockInLine({...qcData, escalationLog}); await postStockInLine({...qcData, escalationLog});

} else { } else {
await postStockInLine(qcData); await postStockInLine(qcData);
} }


+ 3
- 1
src/i18n/zh/dashboard.json 查看文件

@@ -52,5 +52,7 @@
"QC Fail-Total Count": "品檢不合格/總數", "QC Fail-Total Count": "品檢不合格/總數",
"escalationStatus": "上報狀態", "escalationStatus": "上報狀態",
"escalated datetime": "上報時間", "escalated datetime": "上報時間",
"escalateFrom": "上報同事"
"escalateFrom": "上報同事",
"No": "無",
"Responsible Escalation List": "負責的上報列表"
} }

Loading…
取消
儲存