- 해시 ?tab= 탭 줄(B08 단추 꼴) · 고른 탭 자료만 받음 · 설정 카드는 탭 줄 위 · 회사 고르기 알약은 탭 줄 오른쪽 하나 - 회사 없음 진입 두 곳(router · M02 Layer)은 ?tab=company · 회사 관리자 프로젝트 목록 한 번만 받음 - 개요 숫자 카드(단계별 · 실패 · 재확인 · 가입 대기 · 보관함 · 리소스) · 프로젝트 표 칸 보강 · 찾기 · 거르기 · 쪽 넘김 · 진행 현황 - 회사 정보 칸(사업자번호 · 대표 · 상태) · 팀원 읽기 · 자산 표 · 내 계정 마지막 로그인 · 시스템 리소스 7·30·90일 · 활성 추이 · 전체 회사 · 사용자 · 로그 쪽 · 고객 문의 - 시험 test_b01_dashboard_tabs 신규 · test_b01_settings_cards 고침 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
94 lines
3.2 KiB
TypeScript
94 lines
3.2 KiB
TypeScript
import { createButton } from "@ui/ui_template_elements";
|
|
import { text } from "@ui/ui_template_general_blocks";
|
|
import { createStepBar } from "@ui/ui_template_workflow_layout";
|
|
import { workflowSteps } from "../A00_Common/b_page_scaffold";
|
|
import { goToWorkflowStage, WORKFLOW_STEP_ROUTES } from "../A00_Common/b_workflow_nav";
|
|
import type { DashboardUser, ProjectItem } from "./B01_Dashboard_Api_Fetch";
|
|
import { canDeleteProject, canEditProject } from "./B01_Dashboard_UI_Helper";
|
|
import { openDeleteProjectModal, openEditProjectModal } from "./B01_Dashboard_UI_Modals";
|
|
import { formatDate, L } from "./B01_Dashboard_UI_Common";
|
|
import { createPagedTable } from "./B01_Dashboard_UI_Paging";
|
|
|
|
/** 프로젝트 표 머리 — 연도 · 도로 종류 · 연장 · 발주처 · 작성자 · 만든 날까지(92-2) */
|
|
export function projectHeaders(): string[] {
|
|
return [
|
|
L("B01_Dashboard_Table_Project"),
|
|
L("B01_Dashboard_Table_Region"),
|
|
L("B01_Pj_Year"),
|
|
L("B01_Pj_RoadType"),
|
|
L("B01_Pj_Length"),
|
|
L("B01_Pj_Client"),
|
|
L("B01_Pj_Author"),
|
|
// 진행도(%) 열은 없앴다 (2026-09-06 사용자 지시) — 워크플로 배지가 같은 것을 보여 준다.
|
|
L("B01_Dashboard_Table_Workflow"),
|
|
L("B01_Pj_Created"),
|
|
L("B01_Dashboard_Table_Updated"),
|
|
L("B01_Dashboard_Table_Action"),
|
|
];
|
|
}
|
|
|
|
function lengthText(meters?: number | null): string {
|
|
return meters == null ? "-" : `${meters.toLocaleString("ko-KR")} m`;
|
|
}
|
|
|
|
export function projectRow(project: ProjectItem, currentUser: DashboardUser): HTMLElement[] {
|
|
const actCell = document.createElement("div");
|
|
actCell.className = "b01-dashboard__actions";
|
|
|
|
if (canEditProject(currentUser, project)) {
|
|
actCell.append(
|
|
createButton({
|
|
label: L("Common_Btn_Edit"),
|
|
variant: "ghost",
|
|
onClick: () => openEditProjectModal(currentUser, project),
|
|
}),
|
|
);
|
|
}
|
|
if (canDeleteProject(currentUser)) {
|
|
actCell.append(
|
|
createButton({
|
|
label: L("Common_Btn_Delete"),
|
|
variant: "danger",
|
|
onClick: () => openDeleteProjectModal(currentUser, project),
|
|
}),
|
|
);
|
|
}
|
|
|
|
return [
|
|
text(project.name),
|
|
text(project.region),
|
|
text(project.project_year),
|
|
text(project.road_type),
|
|
text(lengthText(project.estimated_length_m)),
|
|
text(project.client_org),
|
|
text(project.owner_name),
|
|
workflow(project),
|
|
text(formatDate(project.created_at)),
|
|
text(formatDate(project.updated_at)),
|
|
actCell,
|
|
];
|
|
}
|
|
|
|
/** 쪽으로 넘기는 프로젝트 표 — 찾기 · 거르기는 프로젝트 탭이 `createPagedTable` 로 직접 씀 */
|
|
export function projectTable(projects: ProjectItem[], currentUser: DashboardUser): HTMLElement {
|
|
return createPagedTable(
|
|
projectHeaders(),
|
|
(p: ProjectItem) => projectRow(p, currentUser),
|
|
projects,
|
|
).root;
|
|
}
|
|
|
|
export function workflow(project: ProjectItem): HTMLElement {
|
|
return createStepBar(
|
|
workflowSteps(),
|
|
project.workflow_state?.current_stage ?? project.workflow_stage,
|
|
{
|
|
stages: project.workflow_state?.stages,
|
|
currentStage: project.workflow_state?.current_stage,
|
|
routes: WORKFLOW_STEP_ROUTES,
|
|
compact: true,
|
|
onStepClick: (stepIndex) => goToWorkflowStage(project.id, WORKFLOW_STEP_ROUTES[stepIndex]),
|
|
},
|
|
);
|
|
}
|