1487 lines
71 KiB
TypeScript
1487 lines
71 KiB
TypeScript
import { useEffect, useRef, useState } from "react";
|
||
import { useTranslation } from "react-i18next";
|
||
import {
|
||
FeatherArrowUpDown,
|
||
FeatherCalendarRange,
|
||
FeatherChevronDown,
|
||
FeatherChevronLeft,
|
||
FeatherChevronRight,
|
||
FeatherColumns,
|
||
FeatherEdit2,
|
||
FeatherList,
|
||
FeatherPlus,
|
||
FeatherUser,
|
||
} from "@subframe/core";
|
||
import * as SubframeCore from "@subframe/core";
|
||
import {
|
||
addDaysIso,
|
||
buildPlantafelDetailDraft,
|
||
buildPlantafelWeek,
|
||
scheduleStatusTone,
|
||
sortPlantafelEntries,
|
||
parsePlantafelSort,
|
||
PLANTAFEL_SORTS,
|
||
type PlantafelSort,
|
||
type PlantafelDetailDraft,
|
||
type PlantafelEntryVM,
|
||
type PlantafelScreenVM,
|
||
type PlantafelWeekEntry,
|
||
type PlantafelWeekGrid,
|
||
} from "@hivegrid/view-models";
|
||
import { PAGE_HEADER_ICON_CLASS, PageBody, PageHeader, PageShell } from "../shared/PageShell";
|
||
import { FacetFilterBar, type ClientFacet } from "../shared/FacetFilterBar";
|
||
import { Alert } from "~/ui/components/Alert";
|
||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||
import { Button } from "~/ui/components/Button";
|
||
import { Card } from "~/ui/components/Card";
|
||
import { Checkbox } from "~/ui/components/Checkbox";
|
||
import { Dialog } from "~/ui/components/Dialog";
|
||
import { DropdownMenu } from "~/ui/components/DropdownMenu";
|
||
import { DropdownMenuMultiSelect } from "~/ui/components/DropdownMenuMultiSelect";
|
||
import { FilterBar } from "~/ui/components/FilterBar";
|
||
import { IconButton } from "~/ui/components/IconButton";
|
||
import { ToggleGroup } from "~/ui/components/ToggleGroup";
|
||
import { EmptyState } from "~/ui/components/EmptyState";
|
||
import { Select } from "~/ui/components/Select";
|
||
import { Table } from "~/ui/components/Table";
|
||
import { TextArea } from "~/ui/components/TextArea";
|
||
import { TextInput } from "~/ui/components/TextInput";
|
||
import { APP_TIME_ZONE } from "~/locale/format";
|
||
|
||
export type PlantafelSubmit = (intent: string, fields?: Record<string, string>) => void;
|
||
export type PlantafelOption = { id: string; label: string };
|
||
export type PlantafelActionResult = { intent: string | null; ok?: boolean; error?: string };
|
||
|
||
/**
|
||
* What the loader should fetch. `assignedUserId: null` = everybody the user may
|
||
* see; `includePast` widens the table window backwards over finished jobs;
|
||
* `sort` orders the table rows.
|
||
*/
|
||
export type PlantafelFilter = { assignedUserId: string | null; includePast: boolean; sort: PlantafelSort };
|
||
export type PlantafelViewMode = "table" | "calendar";
|
||
|
||
export type PlantafelPageProps = {
|
||
vm: PlantafelScreenVM;
|
||
projectLabels: readonly PlantafelOption[];
|
||
editableProjectIds: readonly string[];
|
||
projectOptions: readonly PlantafelOption[];
|
||
projectOptionsHasMore: boolean;
|
||
projectPickerLoading: boolean;
|
||
assigneeOptions: readonly PlantafelOption[];
|
||
canWrite: boolean;
|
||
canBulkReassign: boolean;
|
||
filter: PlantafelFilter;
|
||
/** Table or Monday-first working week. GET-driven, so the loader resolves the matching window. */
|
||
view: PlantafelViewMode;
|
||
/** ISO calendar date (`YYYY-MM-DD`) inside the rendered week, resolved by the loader. */
|
||
anchorIso: string;
|
||
todayIso: string;
|
||
submitting: boolean;
|
||
actionResult?: PlantafelActionResult | null;
|
||
actions: {
|
||
onSubmit: PlantafelSubmit;
|
||
onProjectSearch: (query: string) => void;
|
||
onFilterChange: (next: PlantafelFilter) => void;
|
||
onViewChange: (view: PlantafelViewMode) => void;
|
||
onAnchorChange: (anchorIso: string) => void;
|
||
};
|
||
};
|
||
|
||
const DATETIME_INPUT_TYPE = "datetime-local" as const;
|
||
const SCHEDULE_STATUSES = ["planned", "confirmed", "in_progress", "done", "cancelled"] as const;
|
||
const headingText = "text-body-large-0 font-body-large-0 text-text-neutral-primary";
|
||
const mutedText = "text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary";
|
||
/** The table sits in the page chrome now instead of a card - same framing as the forms list. */
|
||
const tableFrame = "flex w-full min-w-0 flex-col items-start overflow-hidden overflow-x-auto rounded-lg border border-solid border-border-default shadow-sm";
|
||
|
||
function formatDateTime(value: string | null, language: string): string {
|
||
if (!value) return "—";
|
||
return new Intl.DateTimeFormat(language, { timeZone: APP_TIME_ZONE, dateStyle: "medium", timeStyle: "short" }).format(new Date(value));
|
||
}
|
||
|
||
/**
|
||
* Render a plain calendar date. Anchoring at noon UTC keeps the displayed date
|
||
* stable, so a Monday cell never labels itself as the Sunday before it.
|
||
*/
|
||
function formatCalendarDate(dateIso: string, language: string, options: Intl.DateTimeFormatOptions): string {
|
||
return new Intl.DateTimeFormat(language, { timeZone: APP_TIME_ZONE, ...options }).format(new Date(`${dateIso}T12:00:00Z`));
|
||
}
|
||
|
||
function statusTone(statusTone: string): "subtle-neutral" | "subtle-information" | "subtle-positive" | "subtle-warning" | "subtle-negative" {
|
||
if (statusTone === "positive") return "subtle-positive";
|
||
if (statusTone === "information") return "subtle-information";
|
||
if (statusTone === "warning") return "subtle-warning";
|
||
if (statusTone === "negative") return "subtle-negative";
|
||
return "subtle-neutral";
|
||
}
|
||
|
||
function newCreateMutationId(): string {
|
||
return globalThis.crypto?.randomUUID?.() ?? `plantafel-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
||
}
|
||
|
||
/**
|
||
* Rows per table page. The plantafel window is loaded whole (the calendar needs
|
||
* every entry of its week), so paging is a reading aid over the loaded set, not
|
||
* a second query.
|
||
*/
|
||
const PLANTAFEL_PAGE_SIZE = 25;
|
||
|
||
/** One hour of the time axis, in pixels. Sets how deep the whole week gets. */
|
||
const HOUR_ROW_PX = 84;
|
||
/** Narrower than this and a block cannot hold readable text. */
|
||
const DAY_COLUMN_MIN_PX = 240;
|
||
const TIME_GUTTER_PX = 64;
|
||
/** Below this height a block only has room for its time and title. */
|
||
const COMPACT_BLOCK_MINUTES = 60;
|
||
/** From here on a block can also carry the project and the status badge. */
|
||
const ROOMY_BLOCK_MINUTES = 120;
|
||
|
||
function minuteLabel(minute: number): string {
|
||
return `${String(Math.floor(minute / 60)).padStart(2, "0")}:${String(minute % 60).padStart(2, "0")}`;
|
||
}
|
||
|
||
/**
|
||
* One appointment as a block on the day's time axis. How much it shows depends
|
||
* on how much room it has: a two-hour job carries project and status, a short
|
||
* one only its time and title, so nothing gets clipped mid-word.
|
||
*/
|
||
function WeekEntry({
|
||
placed,
|
||
projectLabel,
|
||
assigneeLabel,
|
||
startHour,
|
||
endHour,
|
||
onOpen,
|
||
}: {
|
||
placed: PlantafelWeekEntry;
|
||
projectLabel?: string;
|
||
assigneeLabel: string;
|
||
startHour: number;
|
||
endHour: number;
|
||
onOpen: () => void;
|
||
}) {
|
||
const { t } = useTranslation();
|
||
const { entry } = placed;
|
||
const minutes = placed.endMinute - placed.startMinute;
|
||
// Clamp into the rendered window: the night stretch of a multi-day job can
|
||
// fall outside it and still has to appear as a strip at the edge instead of
|
||
// vanishing.
|
||
const windowStart = startHour * 60;
|
||
const windowEnd = endHour * 60;
|
||
const visibleStart = Math.min(Math.max(placed.startMinute, windowStart), windowEnd - 15);
|
||
const visibleEnd = Math.max(Math.min(placed.endMinute, windowEnd), visibleStart + 15);
|
||
const top = ((visibleStart - windowStart) / 60) * HOUR_ROW_PX;
|
||
// Keep a floor so a 15-minute call-out stays clickable and legible.
|
||
const height = Math.max(((visibleEnd - visibleStart) / 60) * HOUR_ROW_PX, 34);
|
||
const width = 100 / placed.laneCount;
|
||
const showAssignee = minutes >= COMPACT_BLOCK_MINUTES;
|
||
const showDetails = minutes >= ROOMY_BLOCK_MINUTES;
|
||
return (
|
||
<div
|
||
// Subtle blue - the same tint the design system already uses for a picked
|
||
// item - so appointments read as blocks against the grid instead of
|
||
// blending into the day column.
|
||
className="focus-visible:shadow-focus absolute cursor-pointer overflow-hidden rounded-md border border-solid border-border-default bg-surface-ui-subtle-blue-default px-2 py-1 shadow-sm outline-none"
|
||
style={{
|
||
top: `${top}px`,
|
||
height: `${height}px`,
|
||
left: `calc(${placed.lane * width}% + 2px)`,
|
||
width: `calc(${width}% - 4px)`,
|
||
}}
|
||
// A block is not a button - a single click must stay free for a later
|
||
// drag. The keyboard gets the same door via Enter/Space, otherwise the
|
||
// details would only be reachable with a mouse.
|
||
role="button"
|
||
tabIndex={0}
|
||
aria-label={`${t("projects.plantafel.detail.open")}: ${entry.title}`}
|
||
onDoubleClick={onOpen}
|
||
onKeyDown={(event) => {
|
||
if (event.key !== "Enter" && event.key !== " ") return;
|
||
event.preventDefault();
|
||
onOpen();
|
||
}}
|
||
title={`${minuteLabel(placed.startMinute)} – ${minuteLabel(placed.endMinute)} · ${entry.title}${projectLabel ? ` · ${projectLabel}` : ""}`}
|
||
data-ui-id={`ui.projects.plantafel.week.entry.${entry.id}`}
|
||
data-entry-id={entry.id}
|
||
data-lane={placed.lane}
|
||
data-lane-count={placed.laneCount}
|
||
>
|
||
<div className="flex min-w-0 flex-col">
|
||
<span className="truncate text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary">
|
||
{placed.continuesBefore ? "↑ " : ""}
|
||
{minuteLabel(placed.startMinute)} – {minuteLabel(placed.endMinute)}
|
||
{placed.continuesAfter ? " ↓" : ""}
|
||
</span>
|
||
<span className="truncate text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-primary">{entry.title}</span>
|
||
{showAssignee ? (
|
||
<span className="truncate text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-secondary">{assigneeLabel}</span>
|
||
) : null}
|
||
{showDetails && projectLabel ? (
|
||
<span className="truncate text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary">{projectLabel}</span>
|
||
) : null}
|
||
{showDetails ? (
|
||
<div className="mt-0.5 flex flex-wrap items-center gap-1">
|
||
<BadgeFeedback farbe={statusTone(entry.statusTone)} size="small">
|
||
{t(entry.statusLabelKey)}
|
||
</BadgeFeedback>
|
||
{entry.conflictCount > 0 ? (
|
||
<BadgeFeedback farbe={entry.blockingConflictCount > 0 ? "subtle-negative" : "subtle-warning"} size="small">
|
||
{t("projects.plantafel.conflicts", { count: entry.conflictCount })}
|
||
</BadgeFeedback>
|
||
) : null}
|
||
</div>
|
||
) : null}
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
/**
|
||
* Monday-Sunday week as a time grid: hours down the left, one column per day,
|
||
* appointments placed at their actual time and side by side where they overlap.
|
||
* The columns keep a readable minimum width, so the grid scrolls sideways on a
|
||
* narrow screen rather than squeezing seven days into it.
|
||
*/
|
||
function PlantafelWeek({
|
||
grid,
|
||
projectLabels,
|
||
assigneeLabels,
|
||
onOpenEntry,
|
||
}: {
|
||
grid: PlantafelWeekGrid;
|
||
projectLabels: ReadonlyMap<string, string>;
|
||
assigneeLabels: ReadonlyMap<string, string>;
|
||
onOpenEntry: (entryId: string) => void;
|
||
}) {
|
||
const { t, i18n } = useTranslation();
|
||
const hours = Array.from({ length: grid.endHour - grid.startHour }, (_, index) => grid.startHour + index);
|
||
const bodyHeight = hours.length * HOUR_ROW_PX;
|
||
const columns = `${TIME_GUTTER_PX}px repeat(7, minmax(${DAY_COLUMN_MIN_PX}px, 1fr))`;
|
||
|
||
return (
|
||
<div
|
||
className="w-full min-w-0 overflow-x-auto rounded-lg border border-solid border-border-default shadow-sm"
|
||
data-ui-id="ui.projects.plantafel.week"
|
||
>
|
||
<div className="min-w-max">
|
||
{/* Day header row. The gutter cell above the hours stays empty. */}
|
||
<div className="grid border-b border-solid border-border-default bg-surface-neutral-secondary" style={{ gridTemplateColumns: columns }}>
|
||
<div className="border-r border-solid border-border-default" />
|
||
{grid.days.map((day) => (
|
||
<div
|
||
key={day.dateIso}
|
||
className={`flex items-baseline gap-1.5 border-r border-solid border-border-default px-2 py-2 ${
|
||
day.isWeekend ? "bg-surface-neutral-tertiary" : ""
|
||
}`}
|
||
>
|
||
<span className="text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 uppercase tracking-wide text-text-neutral-tertiary">
|
||
{formatCalendarDate(day.dateIso, i18n.language, { weekday: "short" })}
|
||
</span>
|
||
<span
|
||
className={
|
||
day.isToday
|
||
? "flex h-6 min-w-6 items-center justify-center rounded-round bg-brand-brand-surface-solid-default px-1 text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 text-text-neutral-on-solid"
|
||
: "text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 text-text-neutral-primary"
|
||
}
|
||
>
|
||
{day.dayOfMonth}
|
||
</span>
|
||
</div>
|
||
))}
|
||
</div>
|
||
|
||
<div className="grid" style={{ gridTemplateColumns: columns, height: `${bodyHeight}px` }}>
|
||
{/* Time axis. Labels sit on their hour line, hence the -0.5 line shift. */}
|
||
<div className="relative border-r border-solid border-border-default bg-surface-neutral-secondary" data-ui-id="ui.projects.plantafel.week.hours">
|
||
{hours.map((hour, index) => (
|
||
<span
|
||
key={hour}
|
||
// The first label would be cut off by the top edge, so it sits
|
||
// on the line instead of centred on it.
|
||
className={`absolute right-2 text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary ${
|
||
index === 0 ? "" : "-translate-y-1/2"
|
||
}`}
|
||
style={{ top: `${index * HOUR_ROW_PX + (index === 0 ? 2 : 0)}px` }}
|
||
data-hour={hour}
|
||
>
|
||
{minuteLabel(hour * 60)}
|
||
</span>
|
||
))}
|
||
</div>
|
||
|
||
{grid.days.map((day) => (
|
||
<div
|
||
key={day.dateIso}
|
||
className={`relative border-r border-solid border-border-default ${day.isWeekend ? "bg-surface-neutral-secondary" : "bg-surface-neutral-primary"}`}
|
||
data-date={day.dateIso}
|
||
data-today={day.isToday ? "true" : "false"}
|
||
>
|
||
{/* Hour lines, drawn behind the blocks. */}
|
||
{hours.map((hour, index) =>
|
||
index === 0 ? null : (
|
||
<div
|
||
key={hour}
|
||
className="absolute inset-x-0 border-t border-solid border-border-default"
|
||
style={{ top: `${index * HOUR_ROW_PX}px` }}
|
||
/>
|
||
)
|
||
)}
|
||
{day.entries.map((placed) => (
|
||
<WeekEntry
|
||
key={`${day.dateIso}-${placed.entry.id}`}
|
||
placed={placed}
|
||
startHour={grid.startHour}
|
||
endHour={grid.endHour}
|
||
projectLabel={projectLabels.get(placed.entry.projectId)}
|
||
assigneeLabel={assigneeLabels.get(placed.entry.assignedUserId) ?? t("projects.plantafel.unknownAssignee")}
|
||
onOpen={() => onOpenEntry(placed.entry.id)}
|
||
/>
|
||
))}
|
||
</div>
|
||
))}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|
||
|
||
export function PlantafelPage(props: PlantafelPageProps) {
|
||
const { t, i18n } = useTranslation();
|
||
const [search, setSearch] = useState("");
|
||
const [createOpen, setCreateOpen] = useState(false);
|
||
const [draft, setDraft] = useState({
|
||
projektId: props.projectOptions[0]?.id ?? "",
|
||
assignedUserId: props.assigneeOptions[0]?.id ?? "",
|
||
title: "",
|
||
startAt: "",
|
||
endAt: "",
|
||
status: "planned",
|
||
});
|
||
const [projectQuery, setProjectQuery] = useState("");
|
||
// Detail popup: which entry, and whether it has been unlocked for editing.
|
||
// It always opens read-only - looking something up must not risk changing it.
|
||
const [detailEntryId, setDetailEntryId] = useState<string | null>(null);
|
||
const [detailEditing, setDetailEditing] = useState(false);
|
||
const [detailDraft, setDetailDraft] = useState<PlantafelDetailDraft | null>(null);
|
||
const [detailOverrideReason, setDetailOverrideReason] = useState("");
|
||
const [detailSubmitted, setDetailSubmitted] = useState(false);
|
||
const [detailResultAtSubmission, setDetailResultAtSubmission] = useState<PlantafelActionResult | null>(null);
|
||
const [conflictOverrideReason, setConflictOverrideReason] = useState("");
|
||
const [createMutationId, setCreateMutationId] = useState("");
|
||
const [createSubmitted, setCreateSubmitted] = useState(false);
|
||
const [actionResultAtSubmission, setActionResultAtSubmission] = useState<PlantafelActionResult | null>(null);
|
||
const [selectedEntryIds, setSelectedEntryIds] = useState<readonly string[]>([]);
|
||
// Which page of the table is on screen. Kept local because search and sorting
|
||
// are evaluated on the loaded window too - a page number in the URL would
|
||
// outlive the result set it counted into.
|
||
const [page, setPage] = useState(1);
|
||
const [bulkAssignee, setBulkAssignee] = useState(props.assigneeOptions[0]?.id ?? "");
|
||
const [bulkOverrideReason, setBulkOverrideReason] = useState("");
|
||
const [offlinePayload, setOfflinePayload] = useState({ clientMutationId: "", operation: "schedule_upsert", payload: "{}" });
|
||
const [localSubmitting, setLocalSubmitting] = useState(false);
|
||
const [localProjectSearchLoading, setLocalProjectSearchLoading] = useState(false);
|
||
const submitLockedRef = useRef(false);
|
||
const projectSearchLockedRef = useRef(false);
|
||
const sawSubmittingRef = useRef(false);
|
||
const sawProjectPickerLoadingRef = useRef(false);
|
||
const previousActionResultRef = useRef(props.actionResult);
|
||
const previousProjectOptionsRef = useRef(props.projectOptions);
|
||
|
||
// Anything that reshuffles the result set sends the reader back to page one -
|
||
// otherwise a narrowed search lands on a page that no longer exists.
|
||
useEffect(() => {
|
||
setPage(1);
|
||
}, [search, props.filter.assignedUserId, props.filter.includePast, props.filter.sort, props.view]);
|
||
|
||
useEffect(() => {
|
||
if (props.projectOptions.some(({ id }) => id === draft.projektId)) return;
|
||
setDraft((current) => ({ ...current, projektId: props.projectOptions[0]?.id ?? "" }));
|
||
}, [draft.projektId, props.projectOptions]);
|
||
|
||
useEffect(() => {
|
||
if (props.submitting) {
|
||
sawSubmittingRef.current = true;
|
||
return;
|
||
}
|
||
if (!sawSubmittingRef.current) return;
|
||
sawSubmittingRef.current = false;
|
||
submitLockedRef.current = false;
|
||
setLocalSubmitting(false);
|
||
}, [props.submitting]);
|
||
|
||
useEffect(() => {
|
||
if (previousActionResultRef.current === props.actionResult) return;
|
||
previousActionResultRef.current = props.actionResult;
|
||
submitLockedRef.current = false;
|
||
setLocalSubmitting(false);
|
||
}, [props.actionResult]);
|
||
|
||
useEffect(() => {
|
||
const optionsChanged = previousProjectOptionsRef.current !== props.projectOptions;
|
||
previousProjectOptionsRef.current = props.projectOptions;
|
||
if (props.projectPickerLoading) {
|
||
sawProjectPickerLoadingRef.current = true;
|
||
return;
|
||
}
|
||
if (!sawProjectPickerLoadingRef.current && !optionsChanged) return;
|
||
sawProjectPickerLoadingRef.current = false;
|
||
projectSearchLockedRef.current = false;
|
||
setLocalProjectSearchLoading(false);
|
||
}, [props.projectOptions, props.projectPickerLoading]);
|
||
|
||
const createActionResult =
|
||
createSubmitted && props.actionResult !== actionResultAtSubmission && props.actionResult?.intent === "upsertSchedule" ? props.actionResult : null;
|
||
|
||
useEffect(() => {
|
||
if (!createActionResult?.ok) return;
|
||
setCreateOpen(false);
|
||
setCreateSubmitted(false);
|
||
setActionResultAtSubmission(createActionResult);
|
||
setConflictOverrideReason("");
|
||
setCreateMutationId("");
|
||
}, [createActionResult]);
|
||
|
||
// Both dialogs save through `upsertSchedule`; the submitted flags keep their
|
||
// results apart, so a create result never closes the detail popup.
|
||
const detailActionResult =
|
||
detailSubmitted && props.actionResult !== detailResultAtSubmission && props.actionResult?.intent === "upsertSchedule" ? props.actionResult : null;
|
||
|
||
useEffect(() => {
|
||
if (!detailActionResult?.ok) return;
|
||
setDetailResultAtSubmission(detailActionResult);
|
||
setDetailSubmitted(false);
|
||
setDetailEditing(false);
|
||
setDetailDraft(null);
|
||
setDetailOverrideReason("");
|
||
setDetailEntryId(null);
|
||
}, [detailActionResult]);
|
||
|
||
const bulkActionResult = props.actionResult?.intent === "bulkReassign" ? props.actionResult : null;
|
||
const bulkNeedsOverride = bulkActionResult?.error === "projects.error.scheduleConflictOverrideRequired";
|
||
|
||
useEffect(() => {
|
||
if (!bulkActionResult?.ok) return;
|
||
setSelectedEntryIds([]);
|
||
setBulkOverrideReason("");
|
||
}, [bulkActionResult]);
|
||
|
||
if (props.vm.status !== "ready") return null;
|
||
const data = props.vm.data;
|
||
const projectLabels = new Map(props.projectLabels.map((option) => [option.id, option.label]));
|
||
const editableProjectIds = new Set(props.editableProjectIds);
|
||
const assigneeLabels = new Map(props.assigneeOptions.map((option) => [option.id, option.label]));
|
||
// The search matches what the row shows - appointment, monteur, project -
|
||
// so a hit is always explainable by something visible on screen. It belongs
|
||
// to the table: the week grid navigates by date, not by term.
|
||
const searchTerm = props.view === "table" ? search.trim().toLocaleLowerCase() : "";
|
||
const matchedEntries = searchTerm
|
||
? data.entries.filter((entry) =>
|
||
[entry.title, assigneeLabels.get(entry.assignedUserId) ?? "", projectLabels.get(entry.projectId) ?? ""]
|
||
.join(" ")
|
||
.toLocaleLowerCase()
|
||
.includes(searchTerm)
|
||
)
|
||
: data.entries;
|
||
// The calendar places entries by time, so only the table takes the order.
|
||
const visibleEntries = props.view === "table" ? sortPlantafelEntries(matchedEntries, props.filter.sort, assigneeLabels) : matchedEntries;
|
||
const visibleConflictCount = visibleEntries.reduce((sum, entry) => sum + entry.conflictCount, 0);
|
||
// The page is clamped rather than corrected in state: a rerender with fewer
|
||
// rows must not need a second render pass before it shows something.
|
||
const pageCount = Math.max(1, Math.ceil(visibleEntries.length / PLANTAFEL_PAGE_SIZE));
|
||
const currentPage = Math.min(Math.max(page, 1), pageCount);
|
||
const pagedEntries =
|
||
props.view === "table" ? visibleEntries.slice((currentPage - 1) * PLANTAFEL_PAGE_SIZE, currentPage * PLANTAFEL_PAGE_SIZE) : visibleEntries;
|
||
const pageSelectableIds = pagedEntries.filter((entry) => editableProjectIds.has(entry.projectId)).map((entry) => entry.id);
|
||
const pageFullySelected = pageSelectableIds.length > 0 && pageSelectableIds.every((id) => selectedEntryIds.includes(id));
|
||
const weekGrid = props.view === "calendar" ? buildPlantafelWeek({ entries: visibleEntries, anchorIso: props.anchorIso, todayIso: props.todayIso }) : null;
|
||
const weekDays = weekGrid?.days ?? [];
|
||
const weekRangeLabel = weekDays.length
|
||
? `${formatCalendarDate(weekDays[0]!.dateIso, i18n.language, { day: "2-digit", month: "2-digit" })} – ${formatCalendarDate(weekDays[6]!.dateIso, i18n.language, { day: "2-digit", month: "2-digit", year: "numeric" })}`
|
||
: "";
|
||
// The picked monteur reads back off the facet button, so a shared link never
|
||
// looks unfiltered; the chip below the bar is the way back out.
|
||
const assigneeFacet: ClientFacet = {
|
||
key: "assignee",
|
||
label: props.filter.assignedUserId
|
||
? (assigneeLabels.get(props.filter.assignedUserId) ?? t("projects.plantafel.unknownAssignee"))
|
||
: t("projects.plantafel.filterAssignee"),
|
||
icon: <FeatherUser />,
|
||
tone: "sky-subtle",
|
||
options: props.assigneeOptions.map((option) => ({ value: option.id, label: option.label })),
|
||
selected: new Set(props.filter.assignedUserId ? [props.filter.assignedUserId] : []),
|
||
};
|
||
|
||
/** Back to the default window and order, and with an empty search box. */
|
||
const resetFilter = () => {
|
||
setSearch("");
|
||
props.actions.onFilterChange({ assignedUserId: null, includePast: false, sort: "start_asc" });
|
||
};
|
||
|
||
const formBusy = props.submitting || localSubmitting;
|
||
const projectSearchBusy = props.projectPickerLoading || localProjectSearchLoading;
|
||
const needsConflictOverride = createActionResult?.error === "projects.error.scheduleConflictOverrideRequired";
|
||
const canSubmitDraft = Boolean(
|
||
createMutationId &&
|
||
draft.projektId &&
|
||
draft.assignedUserId &&
|
||
draft.title.trim() &&
|
||
draft.startAt &&
|
||
draft.endAt &&
|
||
(!needsConflictOverride || conflictOverrideReason.trim())
|
||
);
|
||
|
||
const submitOnce: PlantafelSubmit = (intent, fields) => {
|
||
if (submitLockedRef.current || props.submitting) return;
|
||
submitLockedRef.current = true;
|
||
setLocalSubmitting(true);
|
||
try {
|
||
props.actions.onSubmit(intent, fields);
|
||
} catch (error) {
|
||
submitLockedRef.current = false;
|
||
setLocalSubmitting(false);
|
||
throw error;
|
||
}
|
||
};
|
||
|
||
const searchProjectsOnce = (query: string) => {
|
||
if (projectSearchLockedRef.current || projectSearchBusy || formBusy) return;
|
||
projectSearchLockedRef.current = true;
|
||
setLocalProjectSearchLoading(true);
|
||
try {
|
||
props.actions.onProjectSearch(query);
|
||
} catch (error) {
|
||
projectSearchLockedRef.current = false;
|
||
setLocalProjectSearchLoading(false);
|
||
throw error;
|
||
}
|
||
};
|
||
|
||
// The popup follows the loaded rows: once an entry leaves the window (a
|
||
// reassignment, a changed filter), the popup closes instead of showing stale
|
||
// data.
|
||
const detailEntry = detailEntryId ? (data.entries.find((entry) => entry.id === detailEntryId) ?? null) : null;
|
||
const detailCanEdit = Boolean(detailEntry && props.canWrite && editableProjectIds.has(detailEntry.projectId));
|
||
const detailNeedsOverride = detailActionResult?.error === "projects.error.scheduleConflictOverrideRequired";
|
||
// The entry's own project is not necessarily in the picker's page, so it is
|
||
// seeded in - otherwise the select would open on a different project.
|
||
const detailProjectOptions: PlantafelOption[] = detailEntry
|
||
? [
|
||
...(props.projectOptions.some((option) => option.id === detailEntry.projectId)
|
||
? []
|
||
: [{ id: detailEntry.projectId, label: projectLabels.get(detailEntry.projectId) ?? detailEntry.projectId }]),
|
||
...props.projectOptions,
|
||
]
|
||
: [];
|
||
const canSubmitDetail = Boolean(
|
||
detailDraft &&
|
||
detailDraft.projektId &&
|
||
detailDraft.assignedUserId &&
|
||
detailDraft.title.trim() &&
|
||
detailDraft.startAt &&
|
||
detailDraft.endAt &&
|
||
(!detailNeedsOverride || detailOverrideReason.trim())
|
||
);
|
||
|
||
const openDetail = (entryId: string) => {
|
||
setDetailEntryId(entryId);
|
||
setDetailEditing(false);
|
||
setDetailDraft(null);
|
||
setDetailOverrideReason("");
|
||
setDetailSubmitted(false);
|
||
setDetailResultAtSubmission(props.actionResult ?? null);
|
||
};
|
||
|
||
const startDetailEdit = (entry: PlantafelEntryVM) => {
|
||
setDetailDraft(buildPlantafelDetailDraft(entry, APP_TIME_ZONE));
|
||
setDetailResultAtSubmission(props.actionResult ?? null);
|
||
setDetailEditing(true);
|
||
};
|
||
|
||
const closeDetail = () => {
|
||
if (formBusy) return;
|
||
setDetailEntryId(null);
|
||
setDetailEditing(false);
|
||
setDetailDraft(null);
|
||
setDetailOverrideReason("");
|
||
setDetailSubmitted(false);
|
||
};
|
||
|
||
const closeCreateDialog = () => {
|
||
if (formBusy) return;
|
||
setCreateSubmitted(false);
|
||
setConflictOverrideReason("");
|
||
setCreateMutationId("");
|
||
setCreateOpen(false);
|
||
};
|
||
|
||
return (
|
||
<PageShell uiId="ui.projects.plantafel" className="min-w-0">
|
||
<PageHeader
|
||
icon={<FeatherCalendarRange className={PAGE_HEADER_ICON_CLASS} />}
|
||
title={t("projects.plantafel.title")}
|
||
subtitle={t("projects.plantafel.subtitle")}
|
||
actions={
|
||
<div className="flex flex-wrap items-center gap-2">
|
||
<BadgeFeedback farbe="subtle-neutral">{t("projects.plantafel.entries", { count: visibleEntries.length })}</BadgeFeedback>
|
||
<BadgeFeedback farbe={visibleConflictCount > 0 ? "subtle-warning" : "subtle-positive"}>
|
||
{t("projects.plantafel.conflicts", { count: visibleConflictCount })}
|
||
</BadgeFeedback>
|
||
<BadgeFeedback farbe="subtle-information">{t("projects.plantafel.absences", { count: data.absencesCount })}</BadgeFeedback>
|
||
{/* Labelled table/calendar switch, same place and shape as the leads list. */}
|
||
<ToggleGroup
|
||
value={props.view}
|
||
onValueChange={(value: string) => {
|
||
if (value === "table" || value === "calendar") props.actions.onViewChange(value);
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.viewToggle"
|
||
>
|
||
<ToggleGroup.Item
|
||
icon={<FeatherList />}
|
||
value="table"
|
||
aria-label={t("projects.plantafel.viewMode.table")}
|
||
data-ui-id="ui.projects.plantafel.viewToggle.table"
|
||
>
|
||
{t("projects.plantafel.viewMode.table")}
|
||
</ToggleGroup.Item>
|
||
<ToggleGroup.Item
|
||
icon={<FeatherColumns />}
|
||
value="calendar"
|
||
aria-label={t("projects.plantafel.viewMode.calendar")}
|
||
data-ui-id="ui.projects.plantafel.viewToggle.calendar"
|
||
>
|
||
{t("projects.plantafel.viewMode.calendar")}
|
||
</ToggleGroup.Item>
|
||
</ToggleGroup>
|
||
{props.canWrite ? (
|
||
<Button
|
||
icon={<FeatherPlus />}
|
||
disabled={formBusy}
|
||
onClick={() => {
|
||
setActionResultAtSubmission(props.actionResult ?? null);
|
||
setCreateSubmitted(false);
|
||
setConflictOverrideReason("");
|
||
setCreateMutationId(newCreateMutationId());
|
||
setCreateOpen(true);
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.new"
|
||
>
|
||
{t("projects.plantafel.newEntry")}
|
||
</Button>
|
||
) : null}
|
||
</div>
|
||
}
|
||
/>
|
||
|
||
{/* --- Filter bar: the same strip the files browser and the boards wear -
|
||
free-text box, facet buttons, chips for what is active and one reset.
|
||
The monteur facet is a loader roundtrip (`assignedUserId`); the search
|
||
narrows the loaded window in place, because that window is one day or
|
||
one week, not a paged list. Sorting follows the monteur facet directly;
|
||
the past switch sits at the trailing edge, and the week view puts its
|
||
Mon-Sun navigation there instead. --- */}
|
||
<FacetFilterBar
|
||
uiId="ui.projects.plantafel.filter"
|
||
// The grid has no rows to narrow and navigates by date instead, so the
|
||
// box stays out of the calendar.
|
||
hideSearch={props.view === "calendar"}
|
||
facets={[assigneeFacet]}
|
||
onToggle={(_facetKey, value) =>
|
||
props.actions.onFilterChange({ ...props.filter, assignedUserId: props.filter.assignedUserId === value ? null : value })
|
||
}
|
||
search={search}
|
||
onSearchChange={setSearch}
|
||
searchPlaceholder={t("projects.plantafel.filterSearchPlaceholder")}
|
||
onReset={resetFilter}
|
||
labels={{ reset: t("projects.plantafel.filterReset"), removeChip: t("projects.plantafel.filterRemoveChip") }}
|
||
// Sorting is a table concern - the calendar puts every entry on its own
|
||
// time slot. It sits right behind the monteur facet, because it orders
|
||
// exactly the rows that facet narrows. The button carries the active
|
||
// criterion as its label, so the bar states the order without being
|
||
// opened.
|
||
afterFacets={
|
||
props.view === "table" ? (
|
||
<FilterBar.StatusFilterButton
|
||
icon={<FeatherArrowUpDown />}
|
||
label={t(`projects.plantafel.sortOption.${props.filter.sort}`)}
|
||
count=""
|
||
data-ui-id="ui.projects.plantafel.filter.sort"
|
||
dropdown={
|
||
<DropdownMenuMultiSelect>
|
||
{PLANTAFEL_SORTS.map((sort) => (
|
||
<DropdownMenuMultiSelect.DropdownItem
|
||
key={sort}
|
||
showCheckbox
|
||
selected={sort === props.filter.sort}
|
||
onClick={() => props.actions.onFilterChange({ ...props.filter, sort: parsePlantafelSort(sort) })}
|
||
data-ui-id={`ui.projects.plantafel.filter.sort.${sort}`}
|
||
>
|
||
{t(`projects.plantafel.sortOption.${sort}`)}
|
||
</DropdownMenuMultiSelect.DropdownItem>
|
||
))}
|
||
</DropdownMenuMultiSelect>
|
||
}
|
||
/>
|
||
) : null
|
||
}
|
||
trailing={
|
||
<>
|
||
{/* Only the table needs this switch: the calendar reaches the past
|
||
by paging back a week, so a second control there would say the
|
||
same thing twice. */}
|
||
{props.view === "table" ? (
|
||
<Checkbox
|
||
label={t("projects.plantafel.filterPast")}
|
||
checked={props.filter.includePast}
|
||
disabled={formBusy}
|
||
onCheckedChange={(checked) => props.actions.onFilterChange({ ...props.filter, includePast: checked })}
|
||
data-ui-id="ui.projects.plantafel.filter.past"
|
||
/>
|
||
) : null}
|
||
{/* Week navigation takes the same trailing slot: the range reads
|
||
first, the controls stay at the edge. */}
|
||
{props.view === "calendar" ? (
|
||
<div className="flex flex-wrap items-center gap-2" data-ui-id="ui.projects.plantafel.weekNav">
|
||
<span className={mutedText} data-ui-id="ui.projects.plantafel.weekNav.range">
|
||
{weekRangeLabel}
|
||
</span>
|
||
<Button variant="secondary" size="small" disabled={formBusy} onClick={() => props.actions.onAnchorChange(props.todayIso)}>
|
||
{t("projects.plantafel.week.current")}
|
||
</Button>
|
||
<IconButton
|
||
variant="secondary"
|
||
size="small"
|
||
icon={<FeatherChevronLeft />}
|
||
aria-label={t("projects.plantafel.week.previous")}
|
||
disabled={formBusy}
|
||
onClick={() => props.actions.onAnchorChange(addDaysIso(weekDays[0]?.dateIso ?? props.anchorIso, -7))}
|
||
data-ui-id="ui.projects.plantafel.weekNav.previous"
|
||
/>
|
||
<IconButton
|
||
variant="secondary"
|
||
size="small"
|
||
icon={<FeatherChevronRight />}
|
||
aria-label={t("projects.plantafel.week.next")}
|
||
disabled={formBusy}
|
||
onClick={() => props.actions.onAnchorChange(addDaysIso(weekDays[0]?.dateIso ?? props.anchorIso, 7))}
|
||
data-ui-id="ui.projects.plantafel.weekNav.next"
|
||
/>
|
||
</div>
|
||
) : null}
|
||
</>
|
||
}
|
||
/>
|
||
<PageBody className="max-w-none min-w-0">
|
||
{props.actionResult?.error && !(createOpen && props.actionResult.intent === "upsertSchedule") ? (
|
||
<Alert role="alert" variant="error" notDismissible title={t(props.actionResult.error)} className="min-w-0" />
|
||
) : null}
|
||
|
||
{/* --- Bulk bar: the flat strip the project list wears - a count badge,
|
||
the action, and the way out of the selection. It appears above the
|
||
table only while something is selected, so it never takes room from
|
||
the rows it acts on. --- */}
|
||
{props.canBulkReassign && selectedEntryIds.length > 0 ? (
|
||
<div className="flex w-full min-w-0 flex-col gap-2" data-ui-id="ui.projects.plantafel.bulk">
|
||
<div className="flex w-full flex-wrap items-center gap-3">
|
||
<BadgeFeedback farbe="subtle-neutral" size="small">
|
||
{t("projects.plantafel.bulkSelected", { count: selectedEntryIds.length })}
|
||
</BadgeFeedback>
|
||
<Select
|
||
value={bulkAssignee}
|
||
onValueChange={setBulkAssignee}
|
||
className="max-w-[240px]"
|
||
disabled={formBusy}
|
||
triggerAriaLabel={t("projects.plantafel.columns.assignee")}
|
||
>
|
||
{props.assigneeOptions.map((option) => (
|
||
<Select.Item key={option.id} value={option.id}>{option.label}</Select.Item>
|
||
))}
|
||
</Select>
|
||
<Button
|
||
size="small"
|
||
loading={formBusy}
|
||
disabled={!bulkAssignee || (bulkNeedsOverride && !bulkOverrideReason.trim())}
|
||
onClick={() =>
|
||
submitOnce("bulkReassign", {
|
||
entryIds: JSON.stringify(selectedEntryIds),
|
||
assignedUserId: bulkAssignee,
|
||
...(bulkOverrideReason.trim() ? { conflictOverrideReason: bulkOverrideReason.trim() } : {}),
|
||
})
|
||
}
|
||
data-ui-id="ui.projects.plantafel.bulk.submit"
|
||
>
|
||
{t("projects.actions.bulkReassign")}
|
||
</Button>
|
||
<Button variant="neutral" size="small" disabled={formBusy} onClick={() => setSelectedEntryIds([])} data-ui-id="ui.projects.plantafel.bulk.clear">
|
||
{t("projects.plantafel.bulkClear")}
|
||
</Button>
|
||
</div>
|
||
{bulkNeedsOverride ? (
|
||
<TextInput showLabel label={t("projects.plantafel.conflictOverrideReason")} className="max-w-none">
|
||
<TextInput.Input value={bulkOverrideReason} onChange={(event) => setBulkOverrideReason(event.target.value)} />
|
||
</TextInput>
|
||
) : null}
|
||
</div>
|
||
) : null}
|
||
|
||
{/* Section heading over the bare table - no card around it, same as the
|
||
other list screens. */}
|
||
<div className="flex w-full min-w-0 flex-col gap-3" data-ui-id="ui.projects.plantafel.table">
|
||
<span className={headingText}>{t("projects.plantafel.entriesTitle")}</span>
|
||
{props.view === "calendar" ? (
|
||
<>
|
||
{/* An empty week keeps the grid and gains a slim hint - a search
|
||
that matched nothing says so, instead of reading as "nothing
|
||
planned". */}
|
||
{visibleEntries.length === 0 ? (
|
||
<span className={mutedText} data-ui-id="ui.projects.plantafel.week.empty">
|
||
{searchTerm ? t("projects.plantafel.filterNoMatches") : t("projects.plantafel.week.empty")}
|
||
</span>
|
||
) : null}
|
||
{weekGrid ? (
|
||
<PlantafelWeek grid={weekGrid} projectLabels={projectLabels} assigneeLabels={assigneeLabels} onOpenEntry={openDetail} />
|
||
) : null}
|
||
</>
|
||
) : visibleEntries.length === 0 ? (
|
||
<EmptyState
|
||
outlined
|
||
title={searchTerm ? t("projects.plantafel.filterNoMatches") : t("projects.empty.plantafel.title")}
|
||
body={searchTerm ? t("projects.plantafel.filterNoMatchesBody") : t("projects.empty.plantafel.body")}
|
||
data-ui-id="ui.projects.plantafel.tableEmpty"
|
||
/>
|
||
) : (
|
||
<div className={tableFrame} data-ui-id="ui.projects.plantafel.tableScroll">
|
||
<Table
|
||
className="min-w-[680px]"
|
||
header={
|
||
<Table.HeaderRow>
|
||
{/* Select-all covers the rows on screen and only those the
|
||
reader may actually reassign - a box that also picked up
|
||
rows on other pages would promise more than the action
|
||
delivers. */}
|
||
{props.canBulkReassign ? (
|
||
<Table.HeaderCell className="w-10">
|
||
{pageSelectableIds.length > 0 ? (
|
||
<Checkbox
|
||
checked={pageFullySelected}
|
||
onCheckedChange={(checked) =>
|
||
setSelectedEntryIds((current) =>
|
||
checked
|
||
? [...new Set([...current, ...pageSelectableIds])]
|
||
: current.filter((id) => !pageSelectableIds.includes(id))
|
||
)
|
||
}
|
||
hideLabel
|
||
label={t("projects.plantafel.selectAll")}
|
||
data-ui-id="ui.projects.plantafel.selectAll"
|
||
/>
|
||
) : null}
|
||
</Table.HeaderCell>
|
||
) : null}
|
||
<Table.HeaderCell>{t("projects.plantafel.columns.entry")}</Table.HeaderCell>
|
||
<Table.HeaderCell>{t("projects.plantafel.columns.assignee")}</Table.HeaderCell>
|
||
<Table.HeaderCell>{t("projects.plantafel.columns.period")}</Table.HeaderCell>
|
||
<Table.HeaderCell>{t("projects.plantafel.columns.status")}</Table.HeaderCell>
|
||
</Table.HeaderRow>
|
||
}
|
||
>
|
||
{pagedEntries.map((entry) => (
|
||
// Double-click opens the details, same gesture as in the week
|
||
// grid. Single click stays free for the row's own controls
|
||
// (selection checkbox, status flyout).
|
||
<Table.Row key={entry.id} clickable onDoubleClick={() => openDetail(entry.id)}>
|
||
{props.canBulkReassign ? (
|
||
<Table.Cell className="w-10">
|
||
{editableProjectIds.has(entry.projectId) ? (
|
||
<Checkbox
|
||
checked={selectedEntryIds.includes(entry.id)}
|
||
onCheckedChange={(checked) =>
|
||
setSelectedEntryIds((current) => (checked ? [...current, entry.id] : current.filter((id) => id !== entry.id)))
|
||
}
|
||
aria-label={`${t("projects.plantafel.selectEntry")}: ${entry.title}`}
|
||
data-ui-id={`ui.projects.plantafel.select.${entry.id}`}
|
||
/>
|
||
) : null}
|
||
</Table.Cell>
|
||
) : null}
|
||
<Table.Cell className="max-w-[320px]">
|
||
<div className="flex min-w-0 flex-col gap-1">
|
||
{/* The title is the keyboard-reachable door to the same
|
||
popup - a double-click-only affordance would leave
|
||
keyboard users without one. It carries the link
|
||
colour every other list uses for an openable row, so
|
||
the row reads as clickable before it is tried. */}
|
||
<button
|
||
type="button"
|
||
className="focus-visible:shadow-focus cursor-pointer rounded-sm text-left outline-none hover:underline"
|
||
onClick={() => openDetail(entry.id)}
|
||
data-ui-id={`ui.projects.plantafel.detail.open.${entry.id}`}
|
||
>
|
||
<span className="break-words text-body-default-medium-0 font-body-default-medium-0 text-text-feedback-link-default">
|
||
{entry.title}
|
||
</span>
|
||
</button>
|
||
{/* Entries whose title is just the project label (the demo seed
|
||
does exactly that) would otherwise print the same string twice. */}
|
||
{projectLabels.get(entry.projectId) && projectLabels.get(entry.projectId) !== entry.title ? (
|
||
<span className={mutedText}>{projectLabels.get(entry.projectId)}</span>
|
||
) : null}
|
||
</div>
|
||
</Table.Cell>
|
||
<Table.Cell>{assigneeLabels.get(entry.assignedUserId) ?? t("projects.plantafel.unknownAssignee")}</Table.Cell>
|
||
<Table.Cell>
|
||
<div className="flex flex-col gap-1 whitespace-nowrap">
|
||
<span>{formatDateTime(entry.startAtIso, i18n.language)}</span>
|
||
<span className={mutedText}>{formatDateTime(entry.endAtIso, i18n.language)}</span>
|
||
</div>
|
||
</Table.Cell>
|
||
<Table.Cell>
|
||
<div className="flex flex-col items-start gap-1">
|
||
{/* The status badge is the control: opening it lists the
|
||
statuses and picking one saves right away. That replaced
|
||
the separate select-plus-save column, which cost two
|
||
clicks and a column width for every row. */}
|
||
{props.canWrite && editableProjectIds.has(entry.projectId) ? (
|
||
<SubframeCore.DropdownMenu.Root>
|
||
<SubframeCore.DropdownMenu.Trigger asChild>
|
||
<button
|
||
type="button"
|
||
className="focus-visible:shadow-focus flex items-center gap-1 rounded-sm outline-none disabled:cursor-not-allowed disabled:opacity-60"
|
||
aria-label={`${t("projects.actions.updateStatus")}: ${entry.title}`}
|
||
disabled={formBusy}
|
||
data-ui-id={`ui.projects.plantafel.status.${entry.id}`}
|
||
>
|
||
<BadgeFeedback farbe={statusTone(entry.statusTone)}>{t(entry.statusLabelKey)}</BadgeFeedback>
|
||
<FeatherChevronDown className="text-body-small-regular-0 font-body-small-regular-0 text-icon-neutral-tertiary" />
|
||
</button>
|
||
</SubframeCore.DropdownMenu.Trigger>
|
||
<SubframeCore.DropdownMenu.Portal>
|
||
<SubframeCore.DropdownMenu.Content side="bottom" align="start" sideOffset={4} asChild>
|
||
<DropdownMenu className="gap-1">
|
||
{SCHEDULE_STATUSES.map((status) => (
|
||
<DropdownMenu.DropdownItem
|
||
key={status}
|
||
showCheckbox
|
||
selected={entry.status === status}
|
||
className="bg-surface-neutral-primary hover:bg-surface-neutral-tertiary active:bg-surface-neutral-secondary"
|
||
onSelect={() => status !== entry.status && submitOnce("updateStatus", { entryId: entry.id, status })}
|
||
data-ui-id={`ui.projects.plantafel.status.${entry.id}.${status}`}
|
||
>
|
||
{/* Each option carries its own status colour, so the
|
||
list reads like the column it changes. */}
|
||
<BadgeFeedback farbe={statusTone(scheduleStatusTone(status))}>{t(`projects.scheduleStatus.${status}`)}</BadgeFeedback>
|
||
</DropdownMenu.DropdownItem>
|
||
))}
|
||
</DropdownMenu>
|
||
</SubframeCore.DropdownMenu.Content>
|
||
</SubframeCore.DropdownMenu.Portal>
|
||
</SubframeCore.DropdownMenu.Root>
|
||
) : (
|
||
<BadgeFeedback farbe={statusTone(entry.statusTone)}>{t(entry.statusLabelKey)}</BadgeFeedback>
|
||
)}
|
||
{entry.conflictCount > 0 ? (
|
||
<BadgeFeedback farbe={entry.blockingConflictCount > 0 ? "subtle-negative" : "subtle-warning"}>
|
||
{t("projects.plantafel.conflicts", { count: entry.conflictCount })}
|
||
</BadgeFeedback>
|
||
) : null}
|
||
</div>
|
||
</Table.Cell>
|
||
</Table.Row>
|
||
))}
|
||
</Table>
|
||
</div>
|
||
)}
|
||
|
||
{/* Table footer: how fresh the data is on the left, the way through
|
||
the pages on the right. The "Stand" line used to sit above the
|
||
table, where it pushed the rows down for a detail that is only
|
||
read after them. */}
|
||
<div className="flex w-full flex-wrap items-center justify-between gap-2" data-ui-id="ui.projects.plantafel.tableFooter">
|
||
<span className={mutedText} data-ui-id="ui.projects.plantafel.generatedAt">
|
||
{t("projects.plantafel.generatedAt", { value: formatDateTime(data.generatedAt, i18n.language) })}
|
||
</span>
|
||
{props.view === "table" && visibleEntries.length > 0 ? (
|
||
<div className="flex items-center gap-2" data-ui-id="ui.projects.plantafel.pagination">
|
||
<Button
|
||
variant="neutral"
|
||
size="small"
|
||
disabled={currentPage <= 1}
|
||
onClick={() => setPage(currentPage - 1)}
|
||
data-ui-id="ui.projects.plantafel.pagination.prev"
|
||
>
|
||
{t("projects.plantafel.pagination.previous")}
|
||
</Button>
|
||
<span className={mutedText} data-ui-id="ui.projects.plantafel.pagination.position">
|
||
{t("projects.plantafel.pagination.position", { page: currentPage, pageCount })}
|
||
</span>
|
||
<Button
|
||
variant="neutral"
|
||
size="small"
|
||
disabled={currentPage >= pageCount}
|
||
onClick={() => setPage(currentPage + 1)}
|
||
data-ui-id="ui.projects.plantafel.pagination.next"
|
||
>
|
||
{t("projects.plantafel.pagination.next")}
|
||
</Button>
|
||
</div>
|
||
) : null}
|
||
</div>
|
||
</div>
|
||
|
||
<div className="w-full min-w-0">
|
||
<Card className="max-w-3xl min-w-0" data-ui-id="ui.projects.plantafel.offline">
|
||
<span className={headingText}>{t("projects.plantafel.offlineTitle")}</span>
|
||
<TextInput showLabel label={t("projects.fields.clientMutationId")} className="max-w-none">
|
||
<TextInput.Input
|
||
value={offlinePayload.clientMutationId}
|
||
disabled={formBusy}
|
||
onChange={(event) => setOfflinePayload((current) => ({ ...current, clientMutationId: event.target.value }))}
|
||
/>
|
||
</TextInput>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.fields.operation")}
|
||
value={offlinePayload.operation}
|
||
onValueChange={(operation) => setOfflinePayload((current) => ({ ...current, operation }))}
|
||
className="max-w-none"
|
||
disabled={formBusy}
|
||
triggerAriaLabel={t("projects.fields.operation")}
|
||
>
|
||
<Select.Item value="schedule_upsert">{t("projects.offlineOperation.schedule_upsert")}</Select.Item>
|
||
<Select.Item value="schedule_status">{t("projects.offlineOperation.schedule_status")}</Select.Item>
|
||
<Select.Item value="acceptance_submit">{t("projects.offlineOperation.acceptance_submit")}</Select.Item>
|
||
</Select>
|
||
<TextArea showLabel label={t("projects.fields.payloadJson")} className="max-w-none">
|
||
<TextArea.Input
|
||
value={offlinePayload.payload}
|
||
disabled={formBusy}
|
||
onChange={(event) => setOfflinePayload((current) => ({ ...current, payload: event.target.value }))}
|
||
/>
|
||
</TextArea>
|
||
<Button
|
||
variant="tertiary"
|
||
loading={formBusy}
|
||
disabled={formBusy}
|
||
onClick={() => submitOnce("offlineSync", offlinePayload)}
|
||
data-ui-id="ui.projects.plantafel.offline.submit"
|
||
>
|
||
{t("projects.actions.syncOfflineMutation")}
|
||
</Button>
|
||
</Card>
|
||
</div>
|
||
</PageBody>
|
||
|
||
{/* --- Detail popup. Opens read-only on a double-click in either view;
|
||
"Bearbeiten" top right unlocks the same fields as a form, and only
|
||
then does the footer offer "Speichern" instead of "Schließen". --- */}
|
||
<Dialog
|
||
open={Boolean(detailEntry)}
|
||
onOpenChange={(open) => {
|
||
if (!open) closeDetail();
|
||
}}
|
||
>
|
||
<Dialog.Content
|
||
aria-labelledby="plantafel-detail-dialog-title"
|
||
className="w-[calc(100vw-2rem)] max-w-[640px] min-w-0 p-4 sm:p-6"
|
||
data-ui-id="ui.projects.plantafel.detailDialog"
|
||
>
|
||
{detailEntry ? (
|
||
<div className="flex w-full min-w-0 flex-col gap-4">
|
||
{/* Title and the edit switch share the top line - the switch sits
|
||
in the corner where a dialog's controls are expected. */}
|
||
<div className="flex w-full min-w-0 items-start justify-between gap-3">
|
||
<div className="flex min-w-0 flex-col gap-1">
|
||
<span id="plantafel-detail-dialog-title" className={headingText}>
|
||
{detailEntry.title}
|
||
</span>
|
||
{detailEditing ? <span className={mutedText}>{t("projects.plantafel.detail.editHint")}</span> : null}
|
||
</div>
|
||
{detailCanEdit && !detailEditing ? (
|
||
<Button
|
||
variant="secondary"
|
||
icon={<FeatherEdit2 />}
|
||
className="shrink-0"
|
||
disabled={formBusy}
|
||
onClick={() => startDetailEdit(detailEntry)}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.edit"
|
||
>
|
||
{t("projects.plantafel.detail.edit")}
|
||
</Button>
|
||
) : null}
|
||
</div>
|
||
|
||
{detailActionResult?.error ? (
|
||
<Alert role="alert" variant="error" notDismissible title={t(detailActionResult.error)} className="min-w-0" />
|
||
) : null}
|
||
|
||
{detailEditing && detailDraft ? (
|
||
<>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.plantafel.fields.project")}
|
||
value={detailDraft.projektId}
|
||
onValueChange={(projektId) => setDetailDraft((current) => (current ? { ...current, projektId } : current))}
|
||
className="max-w-none"
|
||
disabled={formBusy}
|
||
triggerAriaLabel={t("projects.plantafel.fields.project")}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.project"
|
||
>
|
||
{detailProjectOptions.map((option) => (
|
||
<Select.Item key={option.id} value={option.id}>
|
||
{option.label}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.plantafel.fields.assignee")}
|
||
value={detailDraft.assignedUserId}
|
||
onValueChange={(assignedUserId) => setDetailDraft((current) => (current ? { ...current, assignedUserId } : current))}
|
||
className="max-w-none"
|
||
disabled={formBusy || props.assigneeOptions.length === 0}
|
||
triggerAriaLabel={t("projects.plantafel.fields.assignee")}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.assignee"
|
||
>
|
||
{props.assigneeOptions.map((option) => (
|
||
<Select.Item key={option.id} value={option.id}>
|
||
{option.label}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
<TextInput showLabel label={t("projects.fields.scheduleTitle")} className="max-w-none">
|
||
<TextInput.Input
|
||
value={detailDraft.title}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDetailDraft((current) => (current ? { ...current, title: event.target.value } : current))}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.title"
|
||
/>
|
||
</TextInput>
|
||
<div className="grid w-full min-w-0 grid-cols-1 gap-4 sm:grid-cols-2">
|
||
<TextInput showLabel label={t("projects.fields.startDate")} className="max-w-none min-w-0">
|
||
<TextInput.Input
|
||
type={DATETIME_INPUT_TYPE}
|
||
value={detailDraft.startAt}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDetailDraft((current) => (current ? { ...current, startAt: event.target.value } : current))}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.start"
|
||
/>
|
||
</TextInput>
|
||
<TextInput showLabel label={t("projects.fields.deadline")} className="max-w-none min-w-0">
|
||
<TextInput.Input
|
||
type={DATETIME_INPUT_TYPE}
|
||
value={detailDraft.endAt}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDetailDraft((current) => (current ? { ...current, endAt: event.target.value } : current))}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.end"
|
||
/>
|
||
</TextInput>
|
||
</div>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.plantafel.columns.status")}
|
||
value={detailDraft.status}
|
||
onValueChange={(status) => setDetailDraft((current) => (current ? { ...current, status } : current))}
|
||
className="max-w-none"
|
||
disabled={formBusy}
|
||
triggerAriaLabel={t("projects.plantafel.columns.status")}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.status"
|
||
>
|
||
{SCHEDULE_STATUSES.map((status) => (
|
||
<Select.Item key={status} value={status}>
|
||
{t(`projects.scheduleStatus.${status}`)}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
{detailNeedsOverride ? (
|
||
<TextArea
|
||
showLabel
|
||
label={t("projects.plantafel.conflictOverrideReason")}
|
||
helpText={t("projects.plantafel.conflictOverrideHelp")}
|
||
className="max-w-none"
|
||
>
|
||
<TextArea.Input
|
||
value={detailOverrideReason}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDetailOverrideReason(event.target.value)}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.conflictOverrideReason"
|
||
/>
|
||
</TextArea>
|
||
) : null}
|
||
</>
|
||
) : (
|
||
<dl className="grid w-full min-w-0 grid-cols-1 gap-3 sm:grid-cols-2" data-ui-id="ui.projects.plantafel.detailDialog.readOnly">
|
||
<div className="flex min-w-0 flex-col gap-0.5">
|
||
<dt className={mutedText}>{t("projects.plantafel.fields.project")}</dt>
|
||
<dd className="break-words text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||
{projectLabels.get(detailEntry.projectId) ?? "—"}
|
||
</dd>
|
||
</div>
|
||
<div className="flex min-w-0 flex-col gap-0.5">
|
||
<dt className={mutedText}>{t("projects.plantafel.columns.assignee")}</dt>
|
||
<dd className="break-words text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||
{assigneeLabels.get(detailEntry.assignedUserId) ?? t("projects.plantafel.unknownAssignee")}
|
||
</dd>
|
||
</div>
|
||
<div className="flex min-w-0 flex-col gap-0.5">
|
||
<dt className={mutedText}>{t("projects.fields.startDate")}</dt>
|
||
<dd className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||
{formatDateTime(detailEntry.startAtIso, i18n.language)}
|
||
</dd>
|
||
</div>
|
||
<div className="flex min-w-0 flex-col gap-0.5">
|
||
<dt className={mutedText}>{t("projects.fields.deadline")}</dt>
|
||
<dd className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">
|
||
{formatDateTime(detailEntry.endAtIso, i18n.language)}
|
||
</dd>
|
||
</div>
|
||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||
<dt className={mutedText}>{t("projects.plantafel.columns.status")}</dt>
|
||
<dd>
|
||
<BadgeFeedback farbe={statusTone(detailEntry.statusTone)}>{t(detailEntry.statusLabelKey)}</BadgeFeedback>
|
||
</dd>
|
||
</div>
|
||
<div className="flex min-w-0 flex-col items-start gap-1">
|
||
<dt className={mutedText}>{t("projects.plantafel.detail.conflicts")}</dt>
|
||
<dd>
|
||
<BadgeFeedback
|
||
farbe={
|
||
detailEntry.conflictCount === 0
|
||
? "subtle-positive"
|
||
: detailEntry.blockingConflictCount > 0
|
||
? "subtle-negative"
|
||
: "subtle-warning"
|
||
}
|
||
>
|
||
{t("projects.plantafel.conflicts", { count: detailEntry.conflictCount })}
|
||
</BadgeFeedback>
|
||
</dd>
|
||
</div>
|
||
</dl>
|
||
)}
|
||
|
||
<div className="flex w-full flex-wrap justify-end gap-2">
|
||
{detailEditing ? (
|
||
<>
|
||
<Button
|
||
variant="neutral"
|
||
disabled={formBusy}
|
||
onClick={() => {
|
||
setDetailEditing(false);
|
||
setDetailDraft(null);
|
||
setDetailOverrideReason("");
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.cancelEdit"
|
||
>
|
||
{t("projects.actions.cancel")}
|
||
</Button>
|
||
<Button
|
||
disabled={!canSubmitDetail || formBusy}
|
||
loading={formBusy}
|
||
onClick={() => {
|
||
if (!detailDraft) return;
|
||
setDetailResultAtSubmission(props.actionResult ?? null);
|
||
setDetailSubmitted(true);
|
||
submitOnce("upsertSchedule", {
|
||
...detailDraft,
|
||
entryId: detailEntry.id,
|
||
conflictOverrideReason: detailOverrideReason,
|
||
});
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.detailDialog.save"
|
||
>
|
||
{detailNeedsOverride ? t("projects.plantafel.conflictOverrideSubmit") : t("projects.actions.saveScheduleEntry")}
|
||
</Button>
|
||
</>
|
||
) : (
|
||
<Button variant="neutral" disabled={formBusy} onClick={closeDetail} data-ui-id="ui.projects.plantafel.detailDialog.close">
|
||
{t("projects.plantafel.detail.close")}
|
||
</Button>
|
||
)}
|
||
</div>
|
||
</div>
|
||
) : null}
|
||
</Dialog.Content>
|
||
</Dialog>
|
||
|
||
{props.canWrite ? (
|
||
<Dialog
|
||
open={createOpen}
|
||
onOpenChange={(open) => {
|
||
if (open) {
|
||
setCreateOpen(true);
|
||
return;
|
||
}
|
||
closeCreateDialog();
|
||
}}
|
||
>
|
||
<Dialog.Content
|
||
aria-labelledby="plantafel-create-dialog-title"
|
||
className="w-[calc(100vw-2rem)] max-w-[640px] min-w-0 p-4 sm:p-6"
|
||
data-ui-id="ui.projects.plantafel.createDialog"
|
||
>
|
||
<div className="flex w-full min-w-0 flex-col gap-4">
|
||
<span id="plantafel-create-dialog-title" className={headingText}>
|
||
{t("projects.plantafel.newEntry")}
|
||
</span>
|
||
{createActionResult?.error ? (
|
||
<Alert role="alert" variant="error" notDismissible title={t(createActionResult.error)} className="min-w-0" />
|
||
) : null}
|
||
|
||
<div className="flex w-full min-w-0 flex-col gap-2" aria-busy={projectSearchBusy}>
|
||
<TextInput showLabel label={t("projects.plantafel.projectPickerSearchLabel")} type="search" className="max-w-none">
|
||
<TextInput.Input
|
||
type="search"
|
||
value={projectQuery}
|
||
disabled={projectSearchBusy || formBusy}
|
||
maxLength={120}
|
||
placeholder={t("projects.plantafel.projectPickerSearchPlaceholder")}
|
||
onChange={(event) => setProjectQuery(event.target.value)}
|
||
onKeyDown={(event) => {
|
||
if (event.key !== "Enter") return;
|
||
event.preventDefault();
|
||
searchProjectsOnce(projectQuery);
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.createDialog.projectSearch"
|
||
/>
|
||
</TextInput>
|
||
<Button
|
||
variant="tertiary"
|
||
loading={projectSearchBusy}
|
||
disabled={projectSearchBusy || formBusy}
|
||
onClick={() => searchProjectsOnce(projectQuery)}
|
||
data-ui-id="ui.projects.plantafel.createDialog.projectSearchSubmit"
|
||
>
|
||
{t("projects.plantafel.projectPickerSearchAction")}
|
||
</Button>
|
||
<div role="status" aria-live="polite" className="min-h-5 min-w-0">
|
||
{projectSearchBusy ? <span className={mutedText}>{t("projects.plantafel.projectPickerLoading")}</span> : null}
|
||
{!projectSearchBusy && props.projectOptionsHasMore ? (
|
||
<span className={`${mutedText} break-words`}>{t("projects.plantafel.projectPickerLimited")}</span>
|
||
) : null}
|
||
{!projectSearchBusy && props.projectOptions.length === 0 ? (
|
||
<span className={`${mutedText} break-words`}>{t("projects.plantafel.projectPickerEmpty")}</span>
|
||
) : null}
|
||
</div>
|
||
</div>
|
||
|
||
<Select
|
||
showLabel
|
||
label={t("projects.plantafel.fields.project")}
|
||
value={draft.projektId}
|
||
onValueChange={(projektId) => setDraft((current) => ({ ...current, projektId }))}
|
||
className="max-w-none"
|
||
disabled={formBusy || projectSearchBusy || props.projectOptions.length === 0}
|
||
triggerAriaLabel={t("projects.plantafel.fields.project")}
|
||
data-ui-id="ui.projects.plantafel.createDialog.project"
|
||
>
|
||
{props.projectOptions.map((option) => (
|
||
<Select.Item key={option.id} value={option.id}>
|
||
{option.label}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.plantafel.fields.assignee")}
|
||
value={draft.assignedUserId}
|
||
onValueChange={(assignedUserId) => setDraft((current) => ({ ...current, assignedUserId }))}
|
||
className="max-w-none"
|
||
disabled={formBusy || props.assigneeOptions.length === 0}
|
||
triggerAriaLabel={t("projects.plantafel.fields.assignee")}
|
||
data-ui-id="ui.projects.plantafel.createDialog.assignee"
|
||
>
|
||
{props.assigneeOptions.map((option) => (
|
||
<Select.Item key={option.id} value={option.id}>
|
||
{option.label}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
<TextInput showLabel label={t("projects.fields.scheduleTitle")} className="max-w-none">
|
||
<TextInput.Input
|
||
value={draft.title}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDraft((current) => ({ ...current, title: event.target.value }))}
|
||
data-ui-id="ui.projects.plantafel.createDialog.title"
|
||
/>
|
||
</TextInput>
|
||
<div className="grid w-full min-w-0 grid-cols-1 gap-4 sm:grid-cols-2">
|
||
<TextInput showLabel label={t("projects.fields.startDate")} className="max-w-none min-w-0">
|
||
<TextInput.Input
|
||
type={DATETIME_INPUT_TYPE}
|
||
value={draft.startAt}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDraft((current) => ({ ...current, startAt: event.target.value }))}
|
||
data-ui-id="ui.projects.plantafel.createDialog.start"
|
||
/>
|
||
</TextInput>
|
||
<TextInput showLabel label={t("projects.fields.deadline")} className="max-w-none min-w-0">
|
||
<TextInput.Input
|
||
type={DATETIME_INPUT_TYPE}
|
||
value={draft.endAt}
|
||
disabled={formBusy}
|
||
onChange={(event) => setDraft((current) => ({ ...current, endAt: event.target.value }))}
|
||
data-ui-id="ui.projects.plantafel.createDialog.end"
|
||
/>
|
||
</TextInput>
|
||
</div>
|
||
<Select
|
||
showLabel
|
||
label={t("projects.fields.stage")}
|
||
value={draft.status}
|
||
onValueChange={(status) => setDraft((current) => ({ ...current, status }))}
|
||
className="max-w-none"
|
||
disabled={formBusy}
|
||
triggerAriaLabel={t("projects.fields.stage")}
|
||
>
|
||
{SCHEDULE_STATUSES.map((status) => (
|
||
<Select.Item key={status} value={status}>
|
||
{t(`projects.scheduleStatus.${status}`)}
|
||
</Select.Item>
|
||
))}
|
||
</Select>
|
||
|
||
{needsConflictOverride ? (
|
||
<TextArea
|
||
showLabel
|
||
label={t("projects.plantafel.conflictOverrideReason")}
|
||
helpText={t("projects.plantafel.conflictOverrideHelp")}
|
||
className="max-w-none"
|
||
>
|
||
<TextArea.Input
|
||
value={conflictOverrideReason}
|
||
disabled={formBusy}
|
||
onChange={(event) => setConflictOverrideReason(event.target.value)}
|
||
data-ui-id="ui.projects.plantafel.createDialog.conflictOverrideReason"
|
||
/>
|
||
</TextArea>
|
||
) : null}
|
||
|
||
<div className="flex w-full flex-wrap justify-end gap-2">
|
||
<Button
|
||
variant="neutral"
|
||
disabled={formBusy}
|
||
onClick={closeCreateDialog}
|
||
data-ui-id="ui.projects.plantafel.createDialog.cancel"
|
||
>
|
||
{t("projects.actions.cancel")}
|
||
</Button>
|
||
<Button
|
||
disabled={!canSubmitDraft || formBusy || projectSearchBusy}
|
||
loading={formBusy}
|
||
onClick={() => {
|
||
setActionResultAtSubmission(props.actionResult ?? null);
|
||
setCreateSubmitted(true);
|
||
submitOnce("upsertSchedule", { ...draft, conflictOverrideReason, clientMutationId: createMutationId });
|
||
}}
|
||
data-ui-id="ui.projects.plantafel.createDialog.confirm"
|
||
>
|
||
{needsConflictOverride ? t("projects.plantafel.conflictOverrideSubmit") : t("projects.actions.saveScheduleEntry")}
|
||
</Button>
|
||
</div>
|
||
</div>
|
||
</Dialog.Content>
|
||
</Dialog>
|
||
) : null}
|
||
</PageShell>
|
||
);
|
||
}
|