form of converet
This commit is contained in:
@@ -3,6 +3,8 @@ import Input from "@/components/Input";
|
||||
import ProductsSelect from "@/pages/order/components/ProductsSelect";
|
||||
import type { CreatePreInvoiceItemType } from "../types/Types";
|
||||
import { Add, Trash } from "iconsax-react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Paths } from "@/config/Paths";
|
||||
type Props = {
|
||||
item: CreatePreInvoiceItemType;
|
||||
index: number;
|
||||
@@ -10,6 +12,7 @@ type Props = {
|
||||
onAdd: () => void;
|
||||
onRemove: () => void;
|
||||
canRemove: boolean;
|
||||
onConvertToOrder?: () => void;
|
||||
error?: Partial<Record<keyof CreatePreInvoiceItemType, string>>;
|
||||
};
|
||||
|
||||
@@ -20,6 +23,7 @@ const InvoiceItemRow: FC<Props> = ({
|
||||
onAdd,
|
||||
onRemove,
|
||||
canRemove,
|
||||
onConvertToOrder,
|
||||
error,
|
||||
}) => {
|
||||
const total = (item.quantity || 0) * (item.unitPrice || 0) - (item.discount || 0);
|
||||
@@ -30,6 +34,7 @@ const InvoiceItemRow: FC<Props> = ({
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-end gap-4 mt-6">
|
||||
|
||||
<div className="min-w-[140px] flex-1">
|
||||
<ProductsSelect
|
||||
value={item.productId}
|
||||
@@ -117,6 +122,17 @@ const InvoiceItemRow: FC<Props> = ({
|
||||
<Trash size={18} color="#dc2626" />
|
||||
</button>
|
||||
)}
|
||||
{item.id && (
|
||||
<Link to={Paths.convertToOrder + '/' + item.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onConvertToOrder}
|
||||
className="h-10 px-4 rounded-xl border border-primary text-primary text-sm hover:bg-primary/5 transition-colors flex-shrink-0"
|
||||
>
|
||||
تبدیل به سفارش
|
||||
</button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user