mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
feat: add convert to vendor credit in drawer.
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
|||||||
PaymentMadeAction,
|
PaymentMadeAction,
|
||||||
AbilitySubject,
|
AbilitySubject,
|
||||||
} from '../../../common/abilityOption';
|
} from '../../../common/abilityOption';
|
||||||
|
import { BillMenuItem } from './utils';
|
||||||
|
|
||||||
import { safeCallback, compose } from 'utils';
|
import { safeCallback, compose } from 'utils';
|
||||||
|
|
||||||
@@ -50,6 +51,14 @@ function BillDetailActionsBar({
|
|||||||
closeDrawer('bill-drawer');
|
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.
|
// Handle delete bill.
|
||||||
const onDeleteBill = () => {
|
const onDeleteBill = () => {
|
||||||
openAlert('bill-delete', { billId });
|
openAlert('bill-delete', { billId });
|
||||||
@@ -92,6 +101,14 @@ function BillDetailActionsBar({
|
|||||||
onClick={safeCallback(onDeleteBill)}
|
onClick={safeCallback(onDeleteBill)}
|
||||||
/>
|
/>
|
||||||
</Can>
|
</Can>
|
||||||
|
<Can I={BillAction.Edit} a={AbilitySubject.Bill}>
|
||||||
|
<NavbarDivider />
|
||||||
|
<BillMenuItem
|
||||||
|
payload={{
|
||||||
|
onConvert: handleConvertToVendorCredit,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Can>
|
||||||
</NavbarGroup>
|
</NavbarGroup>
|
||||||
</DrawerActionsBar>
|
</DrawerActionsBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import intl from 'react-intl-universal';
|
import intl from 'react-intl-universal';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Intent, Tag } from '@blueprintjs/core';
|
import {
|
||||||
|
Button,
|
||||||
|
Popover,
|
||||||
|
PopoverInteractionKind,
|
||||||
|
Position,
|
||||||
|
MenuItem,
|
||||||
|
Menu,
|
||||||
|
Intent,
|
||||||
|
Tag,
|
||||||
|
} from '@blueprintjs/core';
|
||||||
import {
|
import {
|
||||||
FormatNumberCell,
|
FormatNumberCell,
|
||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
Choose,
|
Choose,
|
||||||
|
Icon,
|
||||||
} from '../../../components';
|
} from '../../../components';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +82,7 @@ export function BillDetailsStatus({ bill }) {
|
|||||||
<Choose>
|
<Choose>
|
||||||
<Choose.When condition={bill.is_overdue}>
|
<Choose.When condition={bill.is_overdue}>
|
||||||
<StatusTag intent={Intent.WARNING} round={true}>
|
<StatusTag intent={Intent.WARNING} round={true}>
|
||||||
Overdue
|
<T id={'overdue'} />
|
||||||
</StatusTag>
|
</StatusTag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
<Choose.Otherwise>
|
<Choose.Otherwise>
|
||||||
@@ -92,6 +101,29 @@ export function BillDetailsStatus({ bill }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const BillMenuItem = ({ payload: { onConvert } }) => {
|
||||||
|
return (
|
||||||
|
<Popover
|
||||||
|
minimal={true}
|
||||||
|
interactionKind={PopoverInteractionKind.CLICK}
|
||||||
|
position={Position.BOTTOM_LEFT}
|
||||||
|
modifiers={{
|
||||||
|
offset: { offset: '0, 4' },
|
||||||
|
}}
|
||||||
|
content={
|
||||||
|
<Menu>
|
||||||
|
<MenuItem
|
||||||
|
onClick={onConvert}
|
||||||
|
text={<T id={'convert_to_vendor_credit'} />}
|
||||||
|
/>
|
||||||
|
</Menu>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button icon={<Icon icon="more-vert" iconSize={16} />} minimal={true} />
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const StatusTag = styled(Tag)`
|
const StatusTag = styled(Tag)`
|
||||||
min-width: 65px;
|
min-width: 65px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -141,12 +141,12 @@ export function InvoiceDetailsStatus({ invoice }) {
|
|||||||
<Choose>
|
<Choose>
|
||||||
<Choose.When condition={invoice.is_overdue}>
|
<Choose.When condition={invoice.is_overdue}>
|
||||||
<StatusTag intent={Intent.WARNING} round={true}>
|
<StatusTag intent={Intent.WARNING} round={true}>
|
||||||
Overdue
|
<T id={'overdue'} />
|
||||||
</StatusTag>
|
</StatusTag>
|
||||||
</Choose.When>
|
</Choose.When>
|
||||||
<Choose.Otherwise>
|
<Choose.Otherwise>
|
||||||
<StatusTag intent={Intent.PRIMARY} round={true}>
|
<StatusTag intent={Intent.PRIMARY} round={true}>
|
||||||
Delivered
|
<T id={'delivered'} />
|
||||||
</StatusTag>
|
</StatusTag>
|
||||||
</Choose.Otherwise>
|
</Choose.Otherwise>
|
||||||
</Choose>
|
</Choose>
|
||||||
|
|||||||
@@ -1660,8 +1660,10 @@
|
|||||||
"item.drawer_transactions_by": "معاملات حسب :",
|
"item.drawer_transactions_by": "معاملات حسب :",
|
||||||
"item.drawer_quantity_sold": "الكمية المباعة",
|
"item.drawer_quantity_sold": "الكمية المباعة",
|
||||||
"journal_entries.amount_displayed_base_currency":"يتم عرض المبلغ بالعملة الأساسية الخاصة بك ",
|
"journal_entries.amount_displayed_base_currency":"يتم عرض المبلغ بالعملة الأساسية الخاصة بك ",
|
||||||
"inventory_adjustment.column.product":"المنتج"
|
"inventory_adjustment.column.product":"المنتج",
|
||||||
|
"convert_to_credit_note":"تحويل إلى إشعار الدائن",
|
||||||
|
"convert_to_vendor_credit":"تحويل إلى إشعار المدين",
|
||||||
|
"overdue":"Overdue"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1663,5 +1663,7 @@
|
|||||||
"journal_entries.amount_displayed_base_currency":"Amount is displayed in your base currency",
|
"journal_entries.amount_displayed_base_currency":"Amount is displayed in your base currency",
|
||||||
"inventory_adjustment.column.product":"Product",
|
"inventory_adjustment.column.product":"Product",
|
||||||
"convert_to_credit_note":"Convert to Credit Note",
|
"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"
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user