feat: shipping warehouse and cost
This commit is contained in:
@@ -30,18 +30,15 @@ export const useDealServicesTableColumns = (props: Props) => {
|
||||
accessorKey: "price",
|
||||
header: "Цена",
|
||||
},
|
||||
{
|
||||
enableGrouping: false,
|
||||
accessorKey: "service.cost",
|
||||
header: "Себестоимость"
|
||||
},
|
||||
{
|
||||
enableGrouping: false,
|
||||
accessorKey: "quantity",
|
||||
header: "Количество",
|
||||
// Cell: ({row}) => {
|
||||
// return (
|
||||
// <PlusMinusInput
|
||||
// value={row.original.quantity}
|
||||
// onChange={(value) => onChange(row.original, value)}
|
||||
// />
|
||||
// )
|
||||
// }
|
||||
},
|
||||
{
|
||||
enableGrouping: false,
|
||||
|
||||
@@ -287,7 +287,6 @@ const DealEditDrawerProductsTable = () => {
|
||||
|
||||
const useDealStatusChangeState = () => {
|
||||
const {selectedDeal} = useDealPageContext();
|
||||
|
||||
return {
|
||||
statusHistory: selectedDeal?.statusHistory || []
|
||||
}
|
||||
@@ -342,12 +341,6 @@ const DealEditDrawer: FC = () => {
|
||||
<Tabs.Tab value={"servicesAndProducts"} leftSection={<IconBox/>}>
|
||||
Товары и услуги
|
||||
</Tabs.Tab>
|
||||
{/*<Tabs.Tab value={"services"} leftSection={<IconBox/>}>*/}
|
||||
{/* Услуги*/}
|
||||
{/*</Tabs.Tab>*/}
|
||||
{/*<Tabs.Tab value={"products"} leftSection={<IconBarcode/>}>*/}
|
||||
{/* Товары*/}
|
||||
{/*</Tabs.Tab>*/}
|
||||
</Tabs.List>
|
||||
<Tabs.Panel value={"general"}>
|
||||
<Box h={"100%"} w={"100%"} p={rem(10)}>
|
||||
|
||||
@@ -64,7 +64,6 @@ const Content: FC<Props> = ({deal}) => {
|
||||
return (
|
||||
<form onSubmit={form.onSubmit((values) => handleSubmit(values))}>
|
||||
<Flex direction={'column'}>
|
||||
|
||||
<Fieldset legend={"Общие параметры"}>
|
||||
<Flex direction={"column"} gap={rem(10)}>
|
||||
<TextInput
|
||||
@@ -83,12 +82,17 @@ const Content: FC<Props> = ({deal}) => {
|
||||
placeholder={"Текущий статус"}
|
||||
label={"Текущий статус"}
|
||||
value={DealStatusDictionary[deal.currentStatus as DealStatus]}/>
|
||||
|
||||
<Textarea
|
||||
label={'Коментарий к сделке'}
|
||||
placeholder={'Введите коментарий к сделке'}
|
||||
{...form.getInputProps('comment')}
|
||||
/>
|
||||
<TextInput
|
||||
disabled
|
||||
placeholder={"Введите склад отгрузки"}
|
||||
label={"Склад отгрузки"}
|
||||
value={form.values.shippingWarehouse?.name}
|
||||
/>
|
||||
</Flex>
|
||||
</Fieldset>
|
||||
<Fieldset legend={"Клиент"}>
|
||||
|
||||
@@ -58,7 +58,7 @@ const ProductAndServiceTab: FC = () => {
|
||||
</div>
|
||||
</Flex>
|
||||
<Flex direction={"column"} className={styles['deal-container-wrapper']}>
|
||||
<Title order={3}>Общая стоимость всех услуг: {getTotalPrice()}</Title>
|
||||
<Title order={3}>Общая стоимость всех услуг: {getTotalPrice().toLocaleString("ru")}₽</Title>
|
||||
</Flex>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -9,15 +9,21 @@ type Props = {
|
||||
const useProductServicesTableColumns = (props: Props) => {
|
||||
const {data, quantity} = props;
|
||||
const totalPrice = useMemo(() => data.reduce((acc, row) => acc + (row.price * quantity), 0), [data, quantity]);
|
||||
const totalCost = useMemo(() => data.reduce((acc, row) => acc + ((row.service.cost || 0) * quantity), 0), [data, quantity]);
|
||||
return useMemo<MRT_ColumnDef<DealProductServiceSchema>[]>(() => [
|
||||
{
|
||||
accessorKey: "service.name",
|
||||
header: "Услуга",
|
||||
},
|
||||
{
|
||||
accessorKey: "service.cost",
|
||||
header: "Себестоимость",
|
||||
Footer: () => <>Итоговая себестоимость: {totalCost.toLocaleString("ru")}₽</>,
|
||||
},
|
||||
{
|
||||
accessorKey: "price",
|
||||
header: "Цена",
|
||||
Footer: () => <>Итог: {totalPrice}₽</>,
|
||||
Footer: () => <>Итог: {totalPrice.toLocaleString("ru")}₽</>,
|
||||
}
|
||||
], [totalPrice]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user