260917_02_ENH: 팝업 오늘하루만 체크박스 토글 가능하게 수정, 학당 로그인 시 진행현황에서 세부적인 내용은 보이지 않게 수정
This commit is contained in:
@@ -33,6 +33,9 @@ export default function ProgressPage() {
|
|||||||
|
|
||||||
const reportQuery = useProgressReportQuery();
|
const reportQuery = useProgressReportQuery();
|
||||||
|
|
||||||
|
// 비관리자(Center)에게는 설문 항목(리포트 헤더) 컬럼을 숨기고 id/학당명/목표 표본/완료 수만 노출한다.
|
||||||
|
const visibleHeaders = admin ? (reportQuery.data?.headers ?? []) : [];
|
||||||
|
|
||||||
const content = useMemo(() => {
|
const content = useMemo(() => {
|
||||||
const rows = reportQuery.data?.content ?? [];
|
const rows = reportQuery.data?.content ?? [];
|
||||||
if (!admin || selectedCenterCds.length === 0) return rows;
|
if (!admin || selectedCenterCds.length === 0) return rows;
|
||||||
@@ -55,7 +58,7 @@ export default function ProgressPage() {
|
|||||||
exportReportToExcel({
|
exportReportToExcel({
|
||||||
fileName: `진행현황_${new Date().toISOString().slice(0, 10)}.xlsx`,
|
fileName: `진행현황_${new Date().toISOString().slice(0, 10)}.xlsx`,
|
||||||
sheetName: "진행현황",
|
sheetName: "진행현황",
|
||||||
headers: reportQuery.data.headers,
|
headers: visibleHeaders,
|
||||||
content,
|
content,
|
||||||
scale: "current",
|
scale: "current",
|
||||||
leadingColumns,
|
leadingColumns,
|
||||||
@@ -66,20 +69,19 @@ export default function ProgressPage() {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<AppPageTitle title="진행 현황" description="학당별 목표 표본 대비 설문 완료 현황입니다." />
|
<AppPageTitle title="진행 현황" description="학당별 목표 표본 대비 설문 완료 현황입니다." />
|
||||||
|
|
||||||
<div className="flex items-center justify-between gap-2">
|
{/* 필터(학당 선택)와 Excel 다운로드는 관리자 전용. 비관리자는 툴바 자체를 노출하지 않는다. */}
|
||||||
{admin ? (
|
{admin ? (
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
<MultiSelect className="w-105" maxCount={2} options={centerOptions} defaultValue={selectedCenterCds} onValueChange={setSelectedCenterCds} placeholder="학당 선택 (전체)" />
|
<MultiSelect className="w-105" maxCount={2} options={centerOptions} defaultValue={selectedCenterCds} onValueChange={setSelectedCenterCds} placeholder="학당 선택 (전체)" />
|
||||||
) : (
|
|
||||||
<span />
|
|
||||||
)}
|
|
||||||
<ExcelDownloadButton disabled={!reportQuery.data} onClick={handleDownload} />
|
<ExcelDownloadButton disabled={!reportQuery.data} onClick={handleDownload} />
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{reportQuery.isLoading ? (
|
{reportQuery.isLoading ? (
|
||||||
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
<p className="text-sm text-muted-foreground">불러오는 중...</p>
|
||||||
) : (
|
) : (
|
||||||
<ReportTable
|
<ReportTable
|
||||||
headers={reportQuery.data?.headers ?? []}
|
headers={visibleHeaders}
|
||||||
content={content}
|
content={content}
|
||||||
scale="current"
|
scale="current"
|
||||||
leadingColumns={leadingColumns}
|
leadingColumns={leadingColumns}
|
||||||
|
|||||||
@@ -48,10 +48,20 @@ export function ActivePopupGate() {
|
|||||||
|
|
||||||
const dismiss = () => setDismissedIds((ids) => [...ids, current.popupId]);
|
const dismiss = () => setDismissedIds((ids) => [...ids, current.popupId]);
|
||||||
|
|
||||||
const hideToday = () => {
|
// 닫기 전까지는 체크를 다시 해제할 수 있어야 하므로, 체크/해제 모두 쿠키에 반영한다.
|
||||||
|
const setHideToday = (next: boolean) => {
|
||||||
|
if (next) {
|
||||||
const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])];
|
const nextHiddenIds = [...new Set([...readHiddenPopupIds(), current.popupId])];
|
||||||
cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() });
|
cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() });
|
||||||
setHideTodayChecked(true);
|
} else {
|
||||||
|
const nextHiddenIds = readHiddenPopupIds().filter((id) => id !== current.popupId);
|
||||||
|
if (nextHiddenIds.length === 0) {
|
||||||
|
cookieStore.remove(CookieKeys.PopupHideToday);
|
||||||
|
} else {
|
||||||
|
cookieStore.set(CookieKeys.PopupHideToday, JSON.stringify(nextHiddenIds), { expires: getEndOfToday() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setHideTodayChecked(next);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -65,7 +75,7 @@ export function ActivePopupGate() {
|
|||||||
footer={
|
footer={
|
||||||
<>
|
<>
|
||||||
<label className="flex items-center gap-2 text-sm text-muted-foreground">
|
<label className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||||
<Checkbox checked={hideTodayChecked} onCheckedChange={(checked) => checked === true && hideToday()} />
|
<Checkbox checked={hideTodayChecked} onCheckedChange={(checked) => setHideToday(checked === true)} />
|
||||||
오늘 하루 보지 않기
|
오늘 하루 보지 않기
|
||||||
</label>
|
</label>
|
||||||
<Button type="button" onClick={dismiss}>닫기</Button>
|
<Button type="button" onClick={dismiss}>닫기</Button>
|
||||||
|
|||||||
@@ -162,12 +162,16 @@ export function ReportTable({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rounded-md border">
|
// leaf 컬럼이 없으면 테이블이 내용 폭만 차지하므로, 외곽 border 박스도 w-fit으로 함께 줄여
|
||||||
|
// 빈 영역이 넓게 남지 않도록 한다(가로가 넘칠 땐 max-w-full로 컨테이너를 넘지 않게 제한).
|
||||||
|
<div className={cn("rounded-md border", layout.leafColumns.length === 0 && "w-fit max-w-full")}>
|
||||||
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다.
|
{/* DataTable.tsx와 동일하게 x/y 스크롤을 하나의 컨테이너에서 처리해야 sticky의 기준 컨테이너가 어긋나지 않는다.
|
||||||
overflow-x-auto만 있는 별도 wrapper를 추가로 두면 CSS 스펙상 overflow-y도 auto로 강제되어
|
overflow-x-auto만 있는 별도 wrapper를 추가로 두면 CSS 스펙상 overflow-y도 auto로 강제되어
|
||||||
중첩 스크롤 컨테이너가 생기고 sticky top이 깨진다. */}
|
중첩 스크롤 컨테이너가 생기고 sticky top이 깨진다. */}
|
||||||
<div className="relative w-full overflow-auto" style={{ maxHeight: maxBodyHeight }}>
|
<div className="relative w-full overflow-auto" style={{ maxHeight: maxBodyHeight }}>
|
||||||
<table className="w-full table-fixed caption-bottom text-sm">
|
{/* leaf 컬럼이 없으면(예: 비관리자 진행현황) w-full로 늘리면 leading 컬럼이 과하게 벌어지므로
|
||||||
|
내용 폭(=지정한 컬럼 폭 합)만큼만 차지하도록 w-auto로 둔다. */}
|
||||||
|
<table className={cn("table-fixed caption-bottom text-sm", layout.leafColumns.length > 0 ? "w-full" : "w-auto")}>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
{leadingColumns.map((column) => (
|
{leadingColumns.map((column) => (
|
||||||
<col
|
<col
|
||||||
|
|||||||
Reference in New Issue
Block a user