浏览代码

update escalation log

master
kelvinsuen 1 天前
父节点
当前提交
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 router = useRouter();
const [escLog, setEscLog] = useState<EscalationResult[]>([])
const [escLog, setEscLog] = useState<EscalationResult[]>([]);

const getPendingLog = () => {
return escLog.filter(esc => esc.status == "pending");
};
useEffect(() => {
setEscLog(escalationLogs);
@@ -39,7 +43,11 @@ const DashboardPage: React.FC<Props> = ({
<ThemeProvider theme={theme}>
<Grid container spacing={2}>
<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>
<EscalationLogTable items={escLog}/>
</CardContent>


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

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

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

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

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

} else {
await postStockInLine(qcData);
}


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

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

正在加载...
取消
保存