feat: deal product services
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
.bottom-panel {
|
||||
padding: rem(10);
|
||||
border-radius: rem(5);
|
||||
@mixin light {
|
||||
background-color: var(--mantine-color-gray-1);
|
||||
}
|
||||
@mixin dark {
|
||||
background-color: var(--mantine-color-dark-5);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import {IconBarcode, IconBox, IconCalendarUser, IconSettings} from "@tabler/icon
|
||||
import DealStatusChangeTable from "../../components/DealStatusChangeTable/DealStatusChangeTable.tsx";
|
||||
import DealEditDrawerGeneralTab from "./tabs/DealEditDrawerGeneralTab.tsx";
|
||||
import {useQueryClient} from "@tanstack/react-query";
|
||||
// import styles from './DealEditDrawer.module.css';
|
||||
|
||||
const useDealServicesTableState = () => {
|
||||
const {selectedDeal, setSelectedDeal} = useDealPageContext();
|
||||
@@ -18,11 +19,10 @@ const useDealServicesTableState = () => {
|
||||
|
||||
const onServiceUpdate = (service: DealServiceSchema) => {
|
||||
if (!selectedDeal) return;
|
||||
DealService.updateDealServiceQuantity({
|
||||
DealService.updateDealService({
|
||||
requestBody: {
|
||||
dealId: selectedDeal.id,
|
||||
serviceId: service.service.id,
|
||||
quantity: service.quantity
|
||||
service
|
||||
}
|
||||
}).then(async ({ok, message}) => {
|
||||
|
||||
@@ -72,14 +72,13 @@ const useDealServicesTableState = () => {
|
||||
})
|
||||
}
|
||||
const onServiceCreate = (service: DealServiceSchema) => {
|
||||
console.log('-------Drawer')
|
||||
console.log(service);
|
||||
if (!selectedDeal) return;
|
||||
DealService.addDealService({
|
||||
requestBody: {
|
||||
dealId: selectedDeal.id,
|
||||
serviceId: service.service.id,
|
||||
quantity: service.quantity
|
||||
quantity: service.quantity,
|
||||
price: service.price
|
||||
}
|
||||
}).then(async ({ok, message}) => {
|
||||
if (!ok) {
|
||||
@@ -157,17 +156,14 @@ const useDealProductTableState = () => {
|
||||
|
||||
const onProductUpdate = (product: DealProductSchema) => {
|
||||
if (!selectedDeal) return;
|
||||
DealService.updateDealProductQuantity({
|
||||
DealService.updateDealProduct({
|
||||
requestBody: {
|
||||
dealId: selectedDeal.id,
|
||||
productId: product.product.id,
|
||||
quantity: product.quantity
|
||||
product: product
|
||||
}
|
||||
}).then(async ({ok, message}) => {
|
||||
if (!ok) {
|
||||
notifications.guess(ok, {message});
|
||||
return;
|
||||
}
|
||||
notifications.guess(ok, {message});
|
||||
if (!ok) return;
|
||||
await DealService.getDealById({dealId: selectedDeal.id})
|
||||
.then(setSelectedDeal)
|
||||
})
|
||||
@@ -361,7 +357,6 @@ const DealEditDrawer: FC = () => {
|
||||
</Tabs.Panel>
|
||||
<Tabs.Panel value={"services"}>
|
||||
<Box p={rem(10)}>
|
||||
|
||||
<DealEditDrawerServicesTable/>
|
||||
</Box>
|
||||
</Tabs.Panel>
|
||||
@@ -370,9 +365,15 @@ const DealEditDrawer: FC = () => {
|
||||
|
||||
<DealEditDrawerProductsTable/>
|
||||
</Box>
|
||||
|
||||
</Tabs.Panel>
|
||||
</Tabs>
|
||||
{/*<Flex*/}
|
||||
{/* h={"10%"}*/}
|
||||
{/* align={'flex-end'}*/}
|
||||
{/* justify={"flex-end"}*/}
|
||||
{/*>*/}
|
||||
|
||||
{/*</Flex>*/}
|
||||
</Drawer>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user