force-submit-overdue-settlement: move 代為提交 from the settlement detail page to the /admin/settlements overview, next to the 逾期未提交 badge (user decision 2026-10-30); the detail page links to the overview instead
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9bf9a93c4e
commit
2ec341db35
@@ -210,7 +210,7 @@ If Playwright's browser download fails (CDN returns 403 on this machine), set `P
|
||||
- DB triggers reject changes to amounts/allocations of non-`open` settlements. Only `status` may change.
|
||||
- E2E: `monthsAgo(2)` is always past the submission deadline. Control the cap with `setHeadcount(departmentId, month, n)` before opening the page. `insertPendingApplication` takes `cardDate` / `twdAmount` / `status`.
|
||||
- Admin side (`src/server/settlement/company.ts`, `payouts.ts`; pages `/admin/settlements`, `/admin/settlements/:departmentId/:month`, `/admin/settlements/export`). Admin role only; the services also check it.
|
||||
- Overdue forced submit (`force-submit-overdue-settlement`, user decision 2026-10-30): after the manager deadline an admin can 「代為提交」 on the detail page (`forceSubmitSettlement` mode `admin`, reason required, `ReasonDialog` + `confirmStep`); when the rule param `autoSubmit.enabled` (default off, `graceDays` 0–10, default 3, read from the version effective **now**) is on, the hourly settlement scheduler (`runAutoSubmit`, `auto-submit.ts`) submits overdue departments with at least one non-draft case in the previous 1–2 card months after deadline + grace days (mode `auto`, actor `SYSTEM_ACTOR`, label 「系統(自動提交)」). Both share `submitInTx` with the manager submit: pending-review / needs-revision cases first go through the `overdue_reject` transition (actor admin or system, system comment) and stay rejected after a later return; overrides over the cap/personal cap block (auto skips the department and sends `reminder.auto_submit_failed` once a day per month). `submission_mode` / `submission_reason` on `department_settlements` and `settlement_submissions`; managers get `settlement.force_submitted`; audits `settlement.proxy_submitted` / `settlement.auto_submitted`. Managers' own submit is still blocked by unreviewed cases.
|
||||
- Overdue forced submit (`force-submit-overdue-settlement`, user decision 2026-10-30): after the manager deadline an admin can 「代為提交」 next to the 「逾期未提交」 badge on the `/admin/settlements` overview (`force-submit-button.tsx`; moved from the detail page, user decision 2026-10-30; `forceSubmitSettlement` mode `admin`, reason required, `ReasonDialog` + `confirmStep`); when the rule param `autoSubmit.enabled` (default off, `graceDays` 0–10, default 3, read from the version effective **now**) is on, the hourly settlement scheduler (`runAutoSubmit`, `auto-submit.ts`) submits overdue departments with at least one non-draft case in the previous 1–2 card months after deadline + grace days (mode `auto`, actor `SYSTEM_ACTOR`, label 「系統(自動提交)」). Both share `submitInTx` with the manager submit: pending-review / needs-revision cases first go through the `overdue_reject` transition (actor admin or system, system comment) and stay rejected after a later return; overrides over the cap/personal cap block (auto skips the department and sends `reminder.auto_submit_failed` once a day per month). `submission_mode` / `submission_reason` on `department_settlements` and `settlement_submissions`; managers get `settlement.force_submitted`; audits `settlement.proxy_submitted` / `settlement.auto_submitted`. Managers' own submit is still blocked by unreviewed cases.
|
||||
- Settlement status: `open → submitted → finalized`. **Final approval is the end** (`remove-payout-management`, user decision 2026-10-28): no payout tracking, no `paid` transition, no corrections. A return goes `submitted → open` and unlocks the snapshot; a finalized settlement can't be returned or corrected.
|
||||
- Every submit appends a `settlement_submissions` version. Versions are append-only; return info is written once.
|
||||
- `finalizeSettlement` moves cases to `finalized` and notifies applicants (final amount, expected payout month = card month + 2, pay item 「其他獎金」). It creates no payout records.
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
### D6 介面
|
||||
|
||||
- 管理端詳情頁:月結 open 且已過主管截止時,在「部長尚未提交」區塊顯示「代為提交」(管理者唯一主要動作)。按下開 `ReasonDialog`:說明「將以目前試算提交,N 筆待審核、M 筆待補件案件將改為不核准」,原因必填,`confirmStep` 再確認一次。截止前不顯示按鈕,server action 也拒絕。
|
||||
- 全公司月結總覽(使用者 2026-10-30 調整:從詳情頁改到總覽):「逾期未提交」提醒旁顯示小型次要按鈕「代為提交」,總覽可能有多個逾期部門,所以不用主要按鈕;詳情頁的「部長尚未提交」說明改為指向全公司月結。按下開 `ReasonDialog`:說明「將以目前試算提交,N 筆待審核、M 筆待補件案件將改為不核准」,原因必填,`confirmStep` 再確認一次。截止前不顯示按鈕,server action 也拒絕。
|
||||
- 總覽與詳情:提交方式不是主管時加 `ToneBadge`「管理者代提交」/「系統自動提交」;詳情的版本清單顯示方式與原因。
|
||||
- 部門月結頁:已提交資訊改為「由 {label} 於 … 提交(逾期提交)」,並顯示代提交原因。
|
||||
- 後台「制度參數」:新增「逾期自動提交月結」核取方塊與「截止後第 N 天」欄位,說明「關閉時只能由管理者代提交」。
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## What Changes
|
||||
|
||||
- **管理者代提交**:主管提交截止過後,管理者可在全公司月結的部門詳情頁按「代為提交」,原因必填、確認後以當下試算提交;月結標示「管理者代提交」並記錄代提交者與原因。
|
||||
- **管理者代提交**:主管提交截止過後,管理者可在全公司月結總覽該部門「逾期未提交」提醒旁按「代為提交」,原因必填、確認後以當下試算提交;月結標示「管理者代提交」並記錄代提交者與原因。
|
||||
- **系統自動提交(可開關)**:後台「制度參數」新增「逾期自動提交月結」開關(預設關閉)與「截止後第幾天自動提交」(預設 3 天)。開啟時,背景排程在期限過後自動以當下試算提交仍未提交的部門月結,標示「系統自動提交」。
|
||||
- **未審案件視為不核准**:代提交或自動提交時,該部門該月仍為「待主管審核」或「待補件」的案件在同一交易內轉為「不核准」,原因由系統帶入(逾期未審核),申請人收到審核結果通知。
|
||||
- 代提交或自動提交後的月結與主管提交相同:鎖定、標示逾期提交、可被管理者退回或最終核定。
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
- `company-settlement`:新增管理者代提交與系統自動提交;部門詳情頁對逾期未提交部門提供代提交;總覽與詳情標示提交方式。
|
||||
- `company-settlement`:新增管理者代提交與系統自動提交;總覽對逾期未提交部門提供代提交;總覽與詳情標示提交方式。
|
||||
- `department-settlement`:被代提交/自動提交的月結在部門月結頁顯示提交方式與原因。
|
||||
- `application-lifecycle`:新增「逾期強制提交時未審案件轉為不核准」轉移(待主管審核/待補件 → 不核准,執行者為管理者或系統);月結提交轉移的執行者可為管理者或系統。
|
||||
- `rule-settings`:制度參數新增逾期自動提交開關與天數。
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 管理者代提交逾期月結
|
||||
主管提交截止(刷卡月份次月 25 日 23:59:59,Asia/Taipei)過後,該部門該月月結仍未提交時,管理者 SHALL 能在部門月結詳情頁代為提交。代提交 MUST 填寫原因並經確認視窗確認;確認視窗 SHALL 說明將以目前試算提交,並列出將改為不核准的待主管審核與待補件件數。代提交 SHALL 以當下最新資料重新計算後提交,結果與主管提交相同(明細快照、案件轉為已提交、人數快照鎖定、標示逾期提交),並記錄代提交者、時間、原因與提交方式「管理者代提交」。主管提交截止前 MUST NOT 允許代提交;非管理者 MUST NOT 能代提交。手動調整合計超過月上限或調整超過個人上限時,代提交 SHALL 被擋下並顯示原因。
|
||||
主管提交截止(刷卡月份次月 25 日 23:59:59,Asia/Taipei)過後,該部門該月月結仍未提交時,管理者 SHALL 能在全公司月結總覽該部門列的「逾期未提交」提醒旁按「代為提交」。代提交 MUST 填寫原因並經確認視窗確認;確認視窗 SHALL 說明將以目前試算提交,並列出將改為不核准的待主管審核與待補件件數。代提交 SHALL 以當下最新資料重新計算後提交,結果與主管提交相同(明細快照、案件轉為已提交、人數快照鎖定、標示逾期提交),並記錄代提交者、時間、原因與提交方式「管理者代提交」。主管提交截止前 MUST NOT 允許代提交;非管理者 MUST NOT 能代提交。手動調整合計超過月上限或調整超過個人上限時,代提交 SHALL 被擋下並顯示原因。
|
||||
|
||||
#### Scenario: 截止後代提交
|
||||
- **WHEN** 2026/11/27 行銷部 10 月月結仍未提交,管理者在詳情頁按「代為提交」、填寫原因「部長請假」並確認
|
||||
- **THEN** 月結變為已提交,標示「逾期提交」與「管理者代提交」,詳情與版本清單顯示代提交者與原因
|
||||
- **WHEN** 2026/11/27 行銷部 10 月月結仍未提交,管理者在全公司月結總覽行銷部列的「逾期未提交」旁按「代為提交」、填寫原因「部長請假」並確認
|
||||
- **THEN** 月結變為已提交,總覽該列改為標示「逾期提交」與「管理者代提交」,詳情的版本清單顯示代提交者與原因
|
||||
|
||||
#### Scenario: 代提交時有未審案件
|
||||
- **WHEN** 行銷部 10 月仍有 1 筆待主管審核、1 筆待補件,管理者代提交
|
||||
- **THEN** 確認視窗說明這 2 筆將改為不核准;確認後 2 筆案件變為不核准,不納入月結計算,其他待月結案件變為已提交
|
||||
|
||||
#### Scenario: 截止前不可代提交
|
||||
- **WHEN** 2026/11/24 管理者開啟行銷部 10 月未提交月結
|
||||
- **THEN** 頁面不顯示「代為提交」;直接呼叫代提交被拒絕,月結不變
|
||||
- **WHEN** 2026/11/24 管理者開啟 2026/10 全公司月結總覽,行銷部尚未提交
|
||||
- **THEN** 行銷部列不顯示「代為提交」;直接呼叫代提交被拒絕,月結不變
|
||||
|
||||
#### Scenario: 原因必填
|
||||
- **WHEN** 管理者按「代為提交」但未填原因
|
||||
@@ -72,8 +72,8 @@
|
||||
|
||||
#### Scenario: 未提交部門
|
||||
- **WHEN** 管理者在主管提交截止前開啟尚未提交的行銷部 2026/10 月結
|
||||
- **THEN** 頁面以唯讀顯示目前試算,並標示「部長尚未提交」,不提供核定、退回與代提交
|
||||
- **THEN** 頁面以唯讀顯示目前試算,並標示「部長尚未提交」,不提供核定與退回
|
||||
|
||||
#### Scenario: 逾期未提交部門
|
||||
- **WHEN** 管理者在主管提交截止後開啟尚未提交的行銷部 2026/10 月結
|
||||
- **THEN** 頁面以唯讀顯示目前試算,標示「部長尚未提交」,並提供「代為提交」,不提供核定與退回
|
||||
- **THEN** 頁面以唯讀顯示目前試算,標示「部長尚未提交」並說明可在全公司月結代為提交,詳情頁本身不提供核定、退回與代提交
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
## 5. 介面
|
||||
|
||||
- [x] 5.1 管理端詳情頁:open 且已過主管截止時顯示「代為提交」(`ReasonDialog` + `confirmStep`,說明將改為不核准的件數);server action 呼叫 `requireRole("admin")`;版本清單顯示提交方式與原因。
|
||||
- [x] 5.1 全公司月結總覽「逾期未提交」旁顯示「代為提交」(使用者 2026-10-30 從詳情頁改到總覽),open 且已過主管截止時(`ReasonDialog` + `confirmStep`,說明將改為不核准的件數);server action 呼叫 `requireRole("admin")`;版本清單顯示提交方式與原因。
|
||||
- [x] 5.2 管理端總覽與詳情加「管理者代提交」/「系統自動提交」標示;部門月結頁提交資訊顯示提交者、方式與原因。
|
||||
- [x] 5.3 `/help` 管理端說明與 CLAUDE.md(Department settlement/Admin side)更新;`review-month-and-help` 相關測試通過。
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@ import { useState } from "react";
|
||||
import { StickyActions } from "@/components/page-header";
|
||||
import { ConfirmDialog } from "@/components/ui/confirm-dialog";
|
||||
import { Field, inputClass } from "@/components/ui/field";
|
||||
import { ReasonDialog } from "@/components/ui/reason-dialog";
|
||||
import { useToast } from "@/components/ui/toast";
|
||||
import { finalizeAction, forceSubmitAction, returnAction } from "../../actions";
|
||||
import { finalizeAction, returnAction } from "../../actions";
|
||||
import { buttonClass } from "@/components/ui/button";
|
||||
|
||||
const primary = buttonClass("primary");
|
||||
@@ -102,52 +101,3 @@ export function AdminSettlementActions({
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 逾期未提交月結的「代為提交」(主管提交截止後才顯示):原因必填,再確認一次;
|
||||
* 說明將以目前試算提交,以及會改為不核准的待審核、待補件件數。
|
||||
*/
|
||||
export function ForceSubmitButton({
|
||||
departmentId,
|
||||
month,
|
||||
summary,
|
||||
pendingReview,
|
||||
needsRevision,
|
||||
}: {
|
||||
departmentId: number;
|
||||
month: string;
|
||||
summary: string;
|
||||
pendingReview: number;
|
||||
needsRevision: number;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const toast = useToast();
|
||||
const rejecting = pendingReview + needsRevision;
|
||||
const consequence =
|
||||
rejecting > 0
|
||||
? `尚未審核的 ${pendingReview} 筆待審核、${needsRevision} 筆待補件案件將改為不核准,不納入計算。`
|
||||
: "沒有尚未審核的案件。";
|
||||
return (
|
||||
<ReasonDialog
|
||||
triggerLabel="代為提交"
|
||||
triggerClassName={primary}
|
||||
title="代為提交月結"
|
||||
description={`主管提交截止已過,將以目前試算代部長提交,提交後名單鎖定並標示「管理者代提交」。${consequence}`}
|
||||
reasonLabel="代提交原因"
|
||||
reasonHint="部長會在部門月結頁看到這段文字"
|
||||
confirmLabel="下一步"
|
||||
confirmStep={{
|
||||
title: "確定代為提交?",
|
||||
description: `${summary}。${consequence}不核准的案件之後即使退回月結也不會恢復。`,
|
||||
confirmLabel: "確定代為提交",
|
||||
}}
|
||||
onConfirm={async (reason) => {
|
||||
const result = await forceSubmitAction({ departmentId, month, reason });
|
||||
if (result.error) return result.error;
|
||||
toast("已代為提交月結");
|
||||
router.refresh();
|
||||
return undefined;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
import { findSettlement, getSettlementView, submitCheck } from "@/server/settlement/service";
|
||||
import { AttachmentsCard, TimelineCard } from "../../../../applications/[id]/sections";
|
||||
import { AllocationTable } from "../../../../department/settlement/allocation-table";
|
||||
import { AdminSettlementActions, ForceSubmitButton } from "./admin-actions";
|
||||
import { AdminSettlementActions } from "./admin-actions";
|
||||
import { appNow } from "@/server/clock";
|
||||
|
||||
function Item({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
@@ -86,8 +86,11 @@ export default async function AdminSettlementDetailPage({
|
||||
以下為目前的試算結果(唯讀)。部長提交後才能最終核定或退回。
|
||||
{overdue && check && (
|
||||
<p className="mt-1">
|
||||
主管提交截止({formatDate(check.managerDeadline, timeZone)}
|
||||
)已過,可由管理者代為提交。
|
||||
主管提交截止({formatDate(check.managerDeadline, timeZone)})已過,可在
|
||||
<Link href={`/admin/settlements?month=${month}`} className="text-primary">
|
||||
全公司月結
|
||||
</Link>
|
||||
代為提交。
|
||||
</p>
|
||||
)}
|
||||
{returned && (
|
||||
@@ -161,28 +164,6 @@ export default async function AdminSettlementDetailPage({
|
||||
</>
|
||||
)}
|
||||
|
||||
{overdue && check && (
|
||||
<Card title="代為提交">
|
||||
<div className="space-y-3" data-testid="force-submit">
|
||||
<p className="text-sm text-muted">
|
||||
以目前試算代部長提交,提交後名單鎖定並標示「管理者代提交」;
|
||||
{check.blocking.length > 0
|
||||
? `尚未審核的 ${check.pendingReview} 筆待審核、${check.needsRevision} 筆待補件案件將改為不核准。`
|
||||
: "目前沒有尚未審核的案件。"}
|
||||
</p>
|
||||
<div className="flex justify-end">
|
||||
<ForceSubmitButton
|
||||
departmentId={departmentId}
|
||||
month={month}
|
||||
summary={`${dept.name} ${formatMonth(month)}${view.ok ? `:${view.value.allocations.length} 人、目前試算最終補助合計 ${formatMoney(view.value.finalTotal)}` : ""}`}
|
||||
pendingReview={check.pendingReview}
|
||||
needsRevision={check.needsRevision}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{versions.length > 0 && (
|
||||
<Card title="提交版本紀錄">
|
||||
<ol className="space-y-3" data-testid="versions">
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { buttonClass } from "@/components/ui/button";
|
||||
import { ReasonDialog } from "@/components/ui/reason-dialog";
|
||||
import { useToast } from "@/components/ui/toast";
|
||||
import { forceSubmitAction } from "./actions";
|
||||
|
||||
/**
|
||||
* 全公司月結總覽「逾期未提交」旁的「代為提交」(force-submit-overdue-settlement):原因必填,
|
||||
* 再確認一次;說明將以目前試算提交,以及會改為不核准的待審核、待補件件數。
|
||||
*/
|
||||
export function ForceSubmitButton({
|
||||
departmentId,
|
||||
departmentName,
|
||||
month,
|
||||
monthLabel,
|
||||
pendingReview,
|
||||
needsRevision,
|
||||
}: {
|
||||
departmentId: number;
|
||||
departmentName: string;
|
||||
month: string;
|
||||
monthLabel: string;
|
||||
pendingReview: number;
|
||||
needsRevision: number;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const toast = useToast();
|
||||
const rejecting = pendingReview + needsRevision;
|
||||
const consequence =
|
||||
rejecting > 0
|
||||
? `尚未審核的 ${pendingReview} 筆待審核、${needsRevision} 筆待補件案件將改為不核准,不納入計算。`
|
||||
: "沒有尚未審核的案件。";
|
||||
return (
|
||||
<ReasonDialog
|
||||
triggerLabel="代為提交"
|
||||
triggerClassName={buttonClass("secondary", "sm")}
|
||||
triggerAriaLabel={`代為提交${departmentName} ${monthLabel} 月結`}
|
||||
title={`代為提交 ${departmentName} ${monthLabel} 月結`}
|
||||
description={`主管提交截止已過,將以目前試算代部長提交,提交後名單鎖定並標示「管理者代提交」。${consequence}`}
|
||||
reasonLabel="代提交原因"
|
||||
reasonHint="部長會在部門月結頁看到這段文字"
|
||||
confirmLabel="下一步"
|
||||
confirmStep={{
|
||||
title: "確定代為提交?",
|
||||
description: `${departmentName} ${monthLabel}:${consequence}不核准的案件之後即使退回月結也不會恢復。`,
|
||||
confirmLabel: "確定代為提交",
|
||||
}}
|
||||
onConfirm={async (reason) => {
|
||||
const result = await forceSubmitAction({ departmentId, month, reason });
|
||||
if (result.error) return result.error;
|
||||
toast("已代為提交月結");
|
||||
router.refresh();
|
||||
return undefined;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -20,7 +20,9 @@ import {
|
||||
companySettlementMonths,
|
||||
type CompanyRow,
|
||||
} from "@/server/settlement/company";
|
||||
import { submitCheck } from "@/server/settlement/service";
|
||||
import { MonthSelect } from "../month-select";
|
||||
import { ForceSubmitButton } from "./force-submit-button";
|
||||
import { appNow } from "@/server/clock";
|
||||
|
||||
const STATUS_TONE: Record<SettlementStatus, StatusTone> = {
|
||||
@@ -47,10 +49,11 @@ function StatCard({
|
||||
);
|
||||
}
|
||||
|
||||
function Flags({ row }: { row: CompanyRow }) {
|
||||
function Flags({ row, forceSubmit }: { row: CompanyRow; forceSubmit?: React.ReactNode }) {
|
||||
return (
|
||||
<span className="flex flex-wrap gap-1.5">
|
||||
<span className="flex flex-wrap items-center gap-1.5">
|
||||
{row.overdueUnsubmitted && <ToneBadge tone="danger">逾期未提交</ToneBadge>}
|
||||
{row.overdueUnsubmitted && forceSubmit}
|
||||
{row.lateSubmission && <ToneBadge tone="warning">逾期提交</ToneBadge>}
|
||||
{row.forcedSubmission && (
|
||||
<ToneBadge tone="warning">{FORCED_SUBMISSION_LABELS[row.forcedSubmission]}</ToneBadge>
|
||||
@@ -83,6 +86,21 @@ export default async function AdminSettlementsPage({
|
||||
const exportHref = (format: string) =>
|
||||
`/admin/settlements/export?month=${month}&format=${format}`;
|
||||
const exportButton = buttonClass("secondary");
|
||||
// 逾期未提交的部門可在「提醒」旁代為提交(force-submit-overdue-settlement)。
|
||||
const forceSubmit = (r: CompanyRow) => {
|
||||
if (!r.overdueUnsubmitted) return undefined;
|
||||
const check = submitCheck(db, r.departmentId, month, now, timeZone);
|
||||
return (
|
||||
<ForceSubmitButton
|
||||
departmentId={r.departmentId}
|
||||
departmentName={r.departmentName}
|
||||
month={month}
|
||||
monthLabel={formatMonth(month)}
|
||||
pendingReview={check.pendingReview}
|
||||
needsRevision={check.needsRevision}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
@@ -192,7 +210,12 @@ export default async function AdminSettlementsPage({
|
||||
header: "提交時間",
|
||||
render: (r) => (r.submittedAt ? formatDateTime(r.submittedAt, timeZone) : "--"),
|
||||
},
|
||||
{ key: "flags", header: "提醒", essential: true, render: (r) => <Flags row={r} /> },
|
||||
{
|
||||
key: "flags",
|
||||
header: "提醒",
|
||||
essential: true,
|
||||
render: (r) => <Flags row={r} forceSubmit={forceSubmit(r)} />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</section>
|
||||
|
||||
@@ -118,7 +118,7 @@ export default async function HelpPage() {
|
||||
全公司月結頁依月份列出各部門的計算人數、月上限、最終補助、狀態與提交時間,並標示逾期未提交、逾期提交、管理者代提交、系統自動提交與缺人數快照。
|
||||
</li>
|
||||
<li>
|
||||
主管提交截止後仍未提交的部門,可在部門月結詳情按「代為提交」:必須填寫原因並再確認一次,尚未審核的案件會改為不核准且不會恢復。後台「制度參數」可開啟逾期自動提交並設定截止後第幾天(預設關閉、3
|
||||
主管提交截止後仍未提交的部門,可在全公司月結頁該部門「逾期未提交」旁按「代為提交」:必須填寫原因並再確認一次,尚未審核的案件會改為不核准且不會恢復。後台「制度參數」可開啟逾期自動提交並設定截止後第幾天(預設關閉、3
|
||||
天);自動提交失敗的部門會通知管理端。
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -225,7 +225,7 @@ test("匯出核定名單:與部門預覽相同的明細表,含部門合計
|
||||
expect(settlementStatus(t.departmentId, MONTH)).toBe("finalized");
|
||||
});
|
||||
|
||||
test("代為提交逾期月結:截止前沒有按鈕;截止後原因必填、未審案件改為不核准、部長看得到代提交原因", async ({
|
||||
test("代為提交逾期月結:總覽「逾期未提交」旁的按鈕;截止前沒有;原因必填、未審案件改為不核准、部長看得到原因", async ({
|
||||
page,
|
||||
browser,
|
||||
}) => {
|
||||
@@ -238,16 +238,20 @@ test("代為提交逾期月結:截止前沒有按鈕;截止後原因必填
|
||||
await page.setViewportSize({ width: 1280, height: 900 });
|
||||
await loginAs(page, DEMO.admin);
|
||||
|
||||
// 本月的主管提交截止在下個月 25 日:還不能代提交
|
||||
await page.goto(`/admin/settlements/${t.departmentId}/${PAYOUT}`);
|
||||
await expect(page.getByText("部長尚未提交")).toBeVisible();
|
||||
await expect(page.getByTestId("force-submit")).toHaveCount(0);
|
||||
const forceButton = (name: string) =>
|
||||
overviewRow(page, name).getByRole("button", { name: /^代為提交/ });
|
||||
|
||||
await openDetail(page, t.departmentName);
|
||||
const card = page.getByTestId("force-submit");
|
||||
await expect(card).toContainText("1 筆待審核、0 筆待補件案件將改為不核准");
|
||||
await card.getByRole("button", { name: "代為提交" }).click();
|
||||
// 本月的主管提交截止在下個月 25 日:還不能代提交
|
||||
await page.goto(`/admin/settlements?month=${PAYOUT}`);
|
||||
await expect(overviewRow(page, t.departmentName)).toContainText("待提交");
|
||||
await expect(forceButton(t.departmentName)).toHaveCount(0);
|
||||
|
||||
await page.goto(`/admin/settlements?month=${MONTH}`);
|
||||
const row = overviewRow(page, t.departmentName);
|
||||
await expect(row).toContainText("逾期未提交");
|
||||
await forceButton(t.departmentName).click();
|
||||
const dialog = page.getByRole("dialog");
|
||||
await expect(dialog).toContainText("1 筆待審核、0 筆待補件案件將改為不核准");
|
||||
await dialog.getByRole("button", { name: "下一步" }).click();
|
||||
await expect(dialog.getByText("請填寫代提交原因")).toBeVisible();
|
||||
await dialog.getByLabel("代提交原因").fill("部長請假,HR 代為提交");
|
||||
@@ -259,11 +263,11 @@ test("代為提交逾期月結:截止前沒有按鈕;截止後原因必填
|
||||
expect(settlementStatus(t.departmentId, MONTH)).toBe("submitted");
|
||||
expect(applicationStatus(pending)).toBe("rejected");
|
||||
expect(applicationStatus(t.appA)).toBe("submitted");
|
||||
await expect(page.getByText("管理者代提交").first()).toBeVisible();
|
||||
await expect(row).toContainText("管理者代提交");
|
||||
await expect(row).not.toContainText("逾期未提交");
|
||||
await expect(forceButton(t.departmentName)).toHaveCount(0);
|
||||
await openDetail(page, t.departmentName);
|
||||
await expect(page.getByTestId("versions")).toContainText("管理者代提交:部長請假,HR 代為提交");
|
||||
await expect(page.getByTestId("force-submit")).toHaveCount(0);
|
||||
await page.goto(`/admin/settlements?month=${MONTH}`);
|
||||
await expect(overviewRow(page, t.departmentName)).toContainText("管理者代提交");
|
||||
|
||||
const context = await browser.newContext({ viewport: { width: 1280, height: 900 } });
|
||||
const manager = await context.newPage();
|
||||
|
||||
Reference in New Issue
Block a user