change price logic on the ,rule engine ui, auto generate the contrat

This commit is contained in:
marshal
2026-06-08 10:04:23 +03:00
parent 4993453993
commit 88df20be6b
76 changed files with 4907 additions and 225 deletions

View File

@@ -0,0 +1,60 @@
import { ActionIcon, Group, Tooltip } from "@mantine/core";
import { ChevronDown, ChevronUp } from "lucide-react";
import type { RuleEngineOrderConfig } from "@/pages/ruleEngine/config/resources";
import type { RuleEngineRecord } from "@/types/rule-engine";
import { getOrderValue } from "./ruleEngineOrder.utils";
export interface RuleEngineOrderControlsProps {
record: RuleEngineRecord;
orderConfig: RuleEngineOrderConfig;
totalCount: number;
disabled?: boolean;
onMove: (id: string, direction: "up" | "down") => void;
}
const RuleEngineOrderControls = ({
record,
orderConfig,
totalCount,
disabled = false,
onMove,
}: RuleEngineOrderControlsProps) => {
const id = String(record.id);
const order = getOrderValue(record, orderConfig.field);
const canMoveUp = order > 1;
const canMoveDown = orderConfig.scopeField ? true : order < totalCount;
return (
<Group gap={4} wrap="nowrap">
<Tooltip label="Move up">
<ActionIcon
variant="subtle"
color="gray"
size="sm"
disabled={disabled || !canMoveUp}
onClick={() => onMove(id, "up")}
aria-label="Move up"
>
<ChevronUp size={16} />
</ActionIcon>
</Tooltip>
<Tooltip label="Move down">
<ActionIcon
variant="subtle"
color="gray"
size="sm"
disabled={disabled || !canMoveDown}
onClick={() => onMove(id, "down")}
aria-label="Move down"
>
<ChevronDown size={16} />
</ActionIcon>
</Tooltip>
</Group>
);
};
export default RuleEngineOrderControls;