feat: cancel deal bill, date range in timetable

This commit is contained in:
2024-08-09 05:23:55 +03:00
parent 75860395b2
commit 0a971819dc
11 changed files with 309 additions and 35 deletions

View File

@@ -156,6 +156,32 @@ const ProductAndServiceTab: FC = () => {
}
});
}
const onCancelBillClick = () => {
if (!dealState.deal) return;
const dealId = dealState.deal.id;
modals.openConfirmModal({
withCloseButton: false,
children:
<Text style={{textAlign: "justify"}}>
Вы уверены что хотите отозвать заявку на оплату?
</Text>,
onConfirm: () => {
BillingService.cancelDealBill({
requestBody: {
dealId
}
}).then(async ({ok, message}) => {
notifications.guess(ok, {message});
await dealState.refetch();
})
},
labels: {
confirm: "Отозвать",
cancel: "Отмена"
},
});
}
return (
<div
className={
@@ -209,11 +235,19 @@ const ProductAndServiceTab: FC = () => {
</div>
<Divider my={rem(15)}/>
<div className={styles['deal-container-buttons']}>
<Button
disabled={isLocked}
onClick={onCreateBillClick}
variant={"default"}
fullWidth>Выставить счет</Button>
{isLocked ? <Button
onClick={onCancelBillClick}
color={"red"}
>
Отозвать счет
</Button> :
<Button
disabled={isLocked}
onClick={onCreateBillClick}
variant={"default"}
fullWidth>Выставить счет</Button>
}
</div>
</Flex>