From d5acb3696e77ad0fe667f45590cf34f8c4974dc6 Mon Sep 17 00:00:00 2001
From: elforjani13 <39470382+elforjani13@users.noreply.github.com>
Date: Sun, 26 Dec 2021 17:11:04 +0200
Subject: [PATCH] feat: add convert to vendor credit in drawer.
---
.../BillDrawer/BillDetailActionsBar.js | 17 +++++++++
src/containers/Drawers/BillDrawer/utils.js | 38 +++++++++++++++++--
.../Drawers/InvoiceDetailDrawer/utils.js | 4 +-
src/lang/ar/index.json | 6 ++-
src/lang/en/index.json | 4 +-
5 files changed, 61 insertions(+), 8 deletions(-)
diff --git a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
index 3a5aecb96..0db244234 100644
--- a/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
+++ b/src/containers/Drawers/BillDrawer/BillDetailActionsBar.js
@@ -27,6 +27,7 @@ import {
PaymentMadeAction,
AbilitySubject,
} from '../../../common/abilityOption';
+import { BillMenuItem } from './utils';
import { safeCallback, compose } from 'utils';
@@ -50,6 +51,14 @@ function BillDetailActionsBar({
closeDrawer('bill-drawer');
};
+ // Handle convert to vendor credit.
+ const handleConvertToVendorCredit = () => {
+ history.push(`/vendor-credits/new?from_bill_id=${billId}`, {
+ billId: billId,
+ });
+ closeDrawer('bill-drawer');
+ };
+
// Handle delete bill.
const onDeleteBill = () => {
openAlert('bill-delete', { billId });
@@ -92,6 +101,14 @@ function BillDetailActionsBar({
onClick={safeCallback(onDeleteBill)}
/>
+
+
+
+
);
diff --git a/src/containers/Drawers/BillDrawer/utils.js b/src/containers/Drawers/BillDrawer/utils.js
index 5f0febb19..1c3be7018 100644
--- a/src/containers/Drawers/BillDrawer/utils.js
+++ b/src/containers/Drawers/BillDrawer/utils.js
@@ -1,12 +1,21 @@
import React from 'react';
import intl from 'react-intl-universal';
import styled from 'styled-components';
-import { Intent, Tag } from '@blueprintjs/core';
-
+import {
+ Button,
+ Popover,
+ PopoverInteractionKind,
+ Position,
+ MenuItem,
+ Menu,
+ Intent,
+ Tag,
+} from '@blueprintjs/core';
import {
FormatNumberCell,
FormattedMessage as T,
Choose,
+ Icon,
} from '../../../components';
/**
@@ -73,7 +82,7 @@ export function BillDetailsStatus({ bill }) {
- Overdue
+
@@ -92,6 +101,29 @@ export function BillDetailsStatus({ bill }) {
);
}
+export const BillMenuItem = ({ payload: { onConvert } }) => {
+ return (
+
+ }
+ />
+
+ }
+ >
+ } minimal={true} />
+
+ );
+};
+
const StatusTag = styled(Tag)`
min-width: 65px;
text-align: center;
diff --git a/src/containers/Drawers/InvoiceDetailDrawer/utils.js b/src/containers/Drawers/InvoiceDetailDrawer/utils.js
index 2b4566b8b..0497cf1dc 100644
--- a/src/containers/Drawers/InvoiceDetailDrawer/utils.js
+++ b/src/containers/Drawers/InvoiceDetailDrawer/utils.js
@@ -141,12 +141,12 @@ export function InvoiceDetailsStatus({ invoice }) {
- Overdue
+
- Delivered
+
diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json
index d1747625b..8a03ba38f 100644
--- a/src/lang/ar/index.json
+++ b/src/lang/ar/index.json
@@ -1660,8 +1660,10 @@
"item.drawer_transactions_by": "معاملات حسب :",
"item.drawer_quantity_sold": "الكمية المباعة",
"journal_entries.amount_displayed_base_currency":"يتم عرض المبلغ بالعملة الأساسية الخاصة بك ",
- "inventory_adjustment.column.product":"المنتج"
-
+ "inventory_adjustment.column.product":"المنتج",
+ "convert_to_credit_note":"تحويل إلى إشعار الدائن",
+ "convert_to_vendor_credit":"تحويل إلى إشعار المدين",
+ "overdue":"Overdue"
}
diff --git a/src/lang/en/index.json b/src/lang/en/index.json
index 224164922..993901c3a 100644
--- a/src/lang/en/index.json
+++ b/src/lang/en/index.json
@@ -1663,5 +1663,7 @@
"journal_entries.amount_displayed_base_currency":"Amount is displayed in your base currency",
"inventory_adjustment.column.product":"Product",
"convert_to_credit_note":"Convert to Credit Note",
- "convert_to_vendor_credit":"Convert to Vendor Credit"
+ "convert_to_vendor_credit":"Convert to Vendor Credit",
+ "overdue":"Overdue"
+
}
\ No newline at end of file