Doctors section: list, week schedule, interval settings, schedule profiles
- doctors open as section tabs; tab remembers subsection and week (?week=) - list: search, alphabet (only present letters), specialty chips with counts, grouped by specialty, today's load, quick links to subsections - schedule: week grid built from intervals and profiles; free/booked/past slots, live queue for zero-duration profiles, book via patient picker, cancel with undo, open patient card from a slot, vacation/off days - settings: intervals with dates, active/vacation, «continue» copy, per-block weekday hours with presets; validation incl. overlaps; draft survives tab switches - profiles: accordion form (duration, color, place, flags, funding, services), save/reset, delete with confirmation and usage warning - mock intervals moved from 2018 to Sep–Dec 2026; deterministic demo appointments around today (some linked to patient cards) - kit: TimeRangeInput, ConfirmDialog, SaveBar; ScrollArea horizontal; section tabs honour an explicit href when opening an existing tab Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c4cc228d80
commit
83d3e840b5
|
|
@ -0,0 +1,53 @@
|
|||
import * as React from "react"
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
} from "@/components/ui/alert-dialog"
|
||||
import { buttonVariants } from "@/components/ui/button"
|
||||
|
||||
/** Подтверждение необратимого действия: «Удалить профиль?» → Удалить / Отмена. */
|
||||
export function ConfirmDialog({
|
||||
title,
|
||||
description,
|
||||
confirmLabel = "Удалить",
|
||||
destructive = true,
|
||||
onConfirm,
|
||||
children,
|
||||
}: {
|
||||
title: string
|
||||
description?: React.ReactNode
|
||||
confirmLabel?: string
|
||||
destructive?: boolean
|
||||
onConfirm: () => void
|
||||
/** Кнопка-триггер. */
|
||||
children: React.ReactElement
|
||||
}) {
|
||||
return (
|
||||
<AlertDialog>
|
||||
<AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>{title}</AlertDialogTitle>
|
||||
{description && <AlertDialogDescription>{description}</AlertDialogDescription>}
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Отмена</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={onConfirm}
|
||||
className={destructive ? buttonVariants({ variant: "destructive" }) : undefined}
|
||||
>
|
||||
{confirmLabel}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
)
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
// Переиспользуемые компоненты МИС «Медицина». Витрина — /ui (src/pages/ui/ui-page.tsx).
|
||||
export * from "./code-block"
|
||||
export * from "./confirm-dialog"
|
||||
export * from "./content-tabs"
|
||||
export * from "./data-table"
|
||||
export * from "./date-leaf"
|
||||
|
|
@ -14,6 +15,8 @@ export * from "./pagination"
|
|||
export * from "./patient-avatar"
|
||||
export * from "./patient-panel"
|
||||
export * from "./person-chip"
|
||||
export * from "./save-bar"
|
||||
export * from "./search-input"
|
||||
export * from "./stat-tile"
|
||||
export * from "./status-badge"
|
||||
export * from "./time-range-input"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
import * as React from "react"
|
||||
import { CircleAlertIcon, CircleCheckIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
/**
|
||||
* Липкая панель внизу формы: показывает, есть ли несохранённые изменения,
|
||||
* и даёт «Сохранить» / «Сбросить». Можно добавить свои действия слева.
|
||||
*/
|
||||
export function SaveBar({
|
||||
dirty,
|
||||
onSave,
|
||||
onReset,
|
||||
saveLabel = "Сохранить",
|
||||
error,
|
||||
children,
|
||||
className,
|
||||
}: {
|
||||
dirty: boolean
|
||||
onSave: () => void
|
||||
onReset?: () => void
|
||||
saveLabel?: string
|
||||
/** Блокирует сохранение и показывается вместо статуса. */
|
||||
error?: string | null
|
||||
children?: React.ReactNode
|
||||
className?: string
|
||||
}) {
|
||||
return (
|
||||
<div className={cn("sticky bottom-0 z-20 flex flex-wrap items-center gap-2 border-t bg-card/95 px-5 py-3 backdrop-blur", className)}>
|
||||
{children}
|
||||
<span
|
||||
className={cn(
|
||||
"ml-auto inline-flex items-center gap-1.5 text-xs",
|
||||
error ? "text-destructive" : dirty ? "text-warning" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{error || dirty ? <CircleAlertIcon className="size-3.5" /> : <CircleCheckIcon className="size-3.5" />}
|
||||
{error ?? (dirty ? "Есть несохранённые изменения" : "Все изменения сохранены")}
|
||||
</span>
|
||||
{onReset && (
|
||||
<Button variant="ghost" size="sm" disabled={!dirty} onClick={onReset}>
|
||||
Сбросить
|
||||
</Button>
|
||||
)}
|
||||
<Button size="sm" disabled={!dirty || Boolean(error)} onClick={onSave}>
|
||||
{saveLabel}
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import { XIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export interface TimeRangeValue {
|
||||
from: string
|
||||
to: string
|
||||
}
|
||||
|
||||
/** Диапазон времени «с–по» в одну строку; подсвечивается, если «по» раньше «с». */
|
||||
export function TimeRangeInput({
|
||||
value,
|
||||
onChange,
|
||||
onRemove,
|
||||
className,
|
||||
}: {
|
||||
value: TimeRangeValue
|
||||
onChange: (value: TimeRangeValue) => void
|
||||
onRemove?: () => void
|
||||
className?: string
|
||||
}) {
|
||||
const invalid = Boolean(value.from && value.to && value.to <= value.from)
|
||||
const input =
|
||||
"h-7 w-[4.6rem] rounded-md bg-transparent px-1 font-mono text-xs tabular outline-none focus:bg-accent/60 [&::-webkit-calendar-picker-indicator]:hidden"
|
||||
|
||||
return (
|
||||
<div
|
||||
aria-invalid={invalid}
|
||||
className={cn(
|
||||
"group flex items-center rounded-lg border bg-card pr-0.5 transition focus-within:border-primary/50",
|
||||
invalid && "border-destructive/60 bg-destructive/5",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="time"
|
||||
aria-label="С"
|
||||
value={value.from}
|
||||
onChange={(e) => onChange({ ...value, from: e.target.value })}
|
||||
className={input}
|
||||
/>
|
||||
<span className="text-xs text-muted-foreground">–</span>
|
||||
<input
|
||||
type="time"
|
||||
aria-label="По"
|
||||
value={value.to}
|
||||
onChange={(e) => onChange({ ...value, to: e.target.value })}
|
||||
className={input}
|
||||
/>
|
||||
{onRemove && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Удалить время"
|
||||
onClick={onRemove}
|
||||
className="grid size-5 place-items-center rounded text-muted-foreground opacity-0 transition group-hover:opacity-100 hover:bg-muted hover:text-destructive focus-visible:opacity-100"
|
||||
>
|
||||
<XIcon className="size-3" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
|
||||
import * as React from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { AlertDialog as AlertDialogPrimitive } from "radix-ui"
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
function AlertDialog({
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
||||
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
||||
}
|
||||
|
||||
function AlertDialogTrigger({
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
|
||||
return (
|
||||
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogPortal({
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
||||
return (
|
||||
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogOverlay({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
|
||||
return (
|
||||
<AlertDialogPrimitive.Overlay
|
||||
data-slot="alert-dialog-overlay"
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogContent({
|
||||
className,
|
||||
size = "default",
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
||||
size?: "default" | "sm"
|
||||
}) {
|
||||
return (
|
||||
<AlertDialogPortal>
|
||||
<AlertDialogOverlay />
|
||||
<AlertDialogPrimitive.Content
|
||||
data-slot="alert-dialog-content"
|
||||
data-size={size}
|
||||
className={cn(
|
||||
"group/alert-dialog-content fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[size=sm]:max-w-xs data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[size=default]:sm:max-w-lg",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
</AlertDialogPortal>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogHeader({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert-dialog-header"
|
||||
className={cn(
|
||||
"grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogFooter({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert-dialog-footer"
|
||||
className={cn(
|
||||
"flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogTitle({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
||||
return (
|
||||
<AlertDialogPrimitive.Title
|
||||
data-slot="alert-dialog-title"
|
||||
className={cn(
|
||||
"text-lg font-semibold sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogDescription({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
||||
return (
|
||||
<AlertDialogPrimitive.Description
|
||||
data-slot="alert-dialog-description"
|
||||
className={cn("text-sm text-muted-foreground", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogMedia({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="alert-dialog-media"
|
||||
className={cn(
|
||||
"mb-2 inline-flex size-16 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogAction({
|
||||
className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
|
||||
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
||||
return (
|
||||
<Button variant={variant} size={size} asChild>
|
||||
<AlertDialogPrimitive.Action
|
||||
data-slot="alert-dialog-action"
|
||||
className={cn(className)}
|
||||
{...props}
|
||||
/>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
function AlertDialogCancel({
|
||||
className,
|
||||
variant = "outline",
|
||||
size = "default",
|
||||
...props
|
||||
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
|
||||
Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
|
||||
return (
|
||||
<Button variant={variant} size={size} asChild>
|
||||
<AlertDialogPrimitive.Cancel
|
||||
data-slot="alert-dialog-cancel"
|
||||
className={cn(className)}
|
||||
{...props}
|
||||
/>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogMedia,
|
||||
AlertDialogOverlay,
|
||||
AlertDialogPortal,
|
||||
AlertDialogTitle,
|
||||
AlertDialogTrigger,
|
||||
}
|
||||
|
|
@ -10,8 +10,12 @@ function ScrollArea({
|
|||
children,
|
||||
type = "hover",
|
||||
scrollHideDelay = 700,
|
||||
horizontal = false,
|
||||
...props
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
||||
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root> & {
|
||||
/** Ещё и горизонтальная прокрутка (широкие сетки, таблицы). */
|
||||
horizontal?: boolean
|
||||
}) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.Root
|
||||
data-slot="scroll-area"
|
||||
|
|
@ -27,6 +31,7 @@ function ScrollArea({
|
|||
{children}
|
||||
</ScrollAreaPrimitive.Viewport>
|
||||
<ScrollBar />
|
||||
{horizontal && <ScrollBar orientation="horizontal" />}
|
||||
<ScrollAreaPrimitive.Corner />
|
||||
</ScrollAreaPrimitive.Root>
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue