order: revert cancel button for master
This commit is contained in:
parent
fead5353e7
commit
46ab2d67dc
@ -36,8 +36,9 @@ export function OrderButtons({ documentId }: Readonly<OrderComponentProps>) {
|
||||
|
||||
return (
|
||||
<FloatingActionPanel
|
||||
isCancelling={isCancelling}
|
||||
onCancel={isCancelled || isCancelling || isCompleted ? undefined : () => handleCancel()}
|
||||
onCancel={
|
||||
isCancelled || (!isMaster && isCancelling) || isCompleted ? undefined : () => handleCancel()
|
||||
}
|
||||
onConfirm={
|
||||
!isMaster || isApproved || isCancelled || isCancelling || isCompleted
|
||||
? undefined
|
||||
|
||||
@ -2,10 +2,9 @@
|
||||
|
||||
import { Button } from '@repo/ui/components/ui/button';
|
||||
import { Card } from '@repo/ui/components/ui/card';
|
||||
import { Ban, Check, Loader2, Lock, RotateCcw, Trash2, Unlock } from 'lucide-react';
|
||||
import { Ban, Check, Lock, RotateCcw, Trash2, Unlock } from 'lucide-react';
|
||||
|
||||
type FloatingActionPanelProps = {
|
||||
readonly isCancelling?: boolean;
|
||||
readonly isOpen?: boolean;
|
||||
readonly onCancel?: () => void;
|
||||
readonly onConfirm?: () => void;
|
||||
@ -15,7 +14,6 @@ type FloatingActionPanelProps = {
|
||||
};
|
||||
|
||||
export default function FloatingActionPanel({
|
||||
isCancelling = false,
|
||||
isOpen,
|
||||
onCancel,
|
||||
onConfirm,
|
||||
@ -26,20 +24,6 @@ export default function FloatingActionPanel({
|
||||
// Если не переданы обработчики, скрываем панель
|
||||
if (!onCancel && !onConfirm && !onDelete && !onRepeat && !onToggle) return null;
|
||||
|
||||
// Если слот отменяется, показываем статус вместо кнопок
|
||||
if (isCancelling) {
|
||||
return (
|
||||
<Card className="fixed inset-x-4 bottom-4 z-50 rounded-3xl border-0 bg-background/95 p-4 shadow-2xl backdrop-blur-sm dark:bg-primary/5 md:bottom-6 md:left-auto md:right-6 md:p-6">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<Loader2 className="size-5 animate-spin text-orange-600 dark:text-orange-400" />
|
||||
<span className="font-medium text-orange-700 dark:text-orange-300">
|
||||
Слот отменяется...
|
||||
</span>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card className="fixed inset-x-4 bottom-4 z-50 rounded-3xl border-0 bg-background/95 p-4 shadow-2xl backdrop-blur-sm dark:bg-primary/5 md:bottom-6 md:left-auto md:right-6 md:p-6">
|
||||
<div className="flex flex-col items-center gap-2 sm:flex-row sm:gap-4">
|
||||
|
||||
@ -128,7 +128,7 @@ const ALERT_BY_STATE: Record<string, JSX.Element> = {
|
||||
cancelling: (
|
||||
<Alert className="bg-orange-50 text-orange-800 dark:bg-orange-950 dark:text-orange-200">
|
||||
<AlertCircle className="size-5 text-orange-600 dark:text-orange-400" />
|
||||
<AlertTitle>Отменяется</AlertTitle>
|
||||
<AlertTitle>Ожидает отмены</AlertTitle>
|
||||
</Alert>
|
||||
),
|
||||
closed: (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user