- 새 페이지 다섯(View_Assigned · Temp · People · Company · CompanyDefaults) · 등록부 다섯 줄 교체 - 표 줄 40 · 세로선 없음 · 줄 끝 ⋯ · 한글 배지 · 빈 상태 · 사람 탭 가입 요청 수 배지 · 보관함 남은 날 막대(7 일 안 빨강) - 옛 구역 정리(Legacy · Company · AssignedPlans · TempUpload 다시 씀) · 시험 test_549 · test_546 stub 일반화 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import { createButton } from "@ui/ui_template_elements";
|
|
import {
|
|
processJoinRequest,
|
|
setCompanyLogo,
|
|
type CompanyInfo,
|
|
type DashboardUser,
|
|
} from "./B01_Dashboard_Api_Fetch";
|
|
import { openAssetPicker } from "./B01_Dashboard_UI_AssetPicker";
|
|
import { openEditCompanyModal } from "./B01_Dashboard_UI_Modals";
|
|
import { table, text } from "@ui/ui_template_general_blocks";
|
|
import { DASHBOARD_VISIBLE_ROWS, L, runRequest } from "./B01_Dashboard_UI_Common";
|
|
|
|
export function companyTable(companies: CompanyInfo[], user?: DashboardUser): HTMLElement {
|
|
// 로고는 회사 등록 단계에서 받고 여기서 바꾼다 (2026-09-02 사용자 확정).
|
|
const logoCell = (company: CompanyInfo): HTMLElement => {
|
|
if (!user) return text("");
|
|
const button = createButton({
|
|
label: company.logo_asset_id ? "로고 변경…" : "로고 지정…",
|
|
variant: "ghost",
|
|
onClick: () =>
|
|
void openAssetPicker(
|
|
"LOGO",
|
|
company.id,
|
|
user,
|
|
company.logo_asset_id ?? null,
|
|
async (id) => {
|
|
await setCompanyLogo(id, company.id);
|
|
company.logo_asset_id = id;
|
|
button.textContent = id ? "로고 변경…" : "로고 지정…";
|
|
},
|
|
),
|
|
});
|
|
return button;
|
|
};
|
|
return table(
|
|
[
|
|
L("B01_Dashboard_Table_Company"),
|
|
L("B01_Dashboard_Field_BusinessNumber"),
|
|
L("B01_Dashboard_Table_Status"),
|
|
"로고",
|
|
L("B01_Dashboard_Table_Action"),
|
|
],
|
|
companies.map((company) => [
|
|
text(company.name),
|
|
text(company.business_registration_number),
|
|
text(company.business_status),
|
|
logoCell(company),
|
|
user
|
|
? createButton({
|
|
label: L("Common_Btn_Edit"),
|
|
variant: "ghost",
|
|
onClick: () => openEditCompanyModal(company),
|
|
})
|
|
: text(""),
|
|
]),
|
|
DASHBOARD_VISIBLE_ROWS,
|
|
);
|
|
}
|
|
|
|
export async function onB01_JoinRequest_Process_Click(
|
|
requestId: number,
|
|
action: "APPROVE" | "REJECT",
|
|
systemMode: boolean,
|
|
): Promise<void> {
|
|
await runRequest(() =>
|
|
systemMode && action === "APPROVE"
|
|
? import("./B01_Dashboard_Api_Fetch").then((api) => api.systemApproveJoinRequest(requestId))
|
|
: processJoinRequest(requestId, action),
|
|
);
|
|
window.dispatchEvent(new HashChangeEvent("hashchange"));
|
|
}
|