mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
feat: add convert to vendor credit in drawer.
This commit is contained in:
@@ -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)}
|
||||
/>
|
||||
</Can>
|
||||
<Can I={BillAction.Edit} a={AbilitySubject.Bill}>
|
||||
<NavbarDivider />
|
||||
<BillMenuItem
|
||||
payload={{
|
||||
onConvert: handleConvertToVendorCredit,
|
||||
}}
|
||||
/>
|
||||
</Can>
|
||||
</NavbarGroup>
|
||||
</DrawerActionsBar>
|
||||
);
|
||||
|
||||
@@ -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 }) {
|
||||
<Choose>
|
||||
<Choose.When condition={bill.is_overdue}>
|
||||
<StatusTag intent={Intent.WARNING} round={true}>
|
||||
Overdue
|
||||
<T id={'overdue'} />
|
||||
</StatusTag>
|
||||
</Choose.When>
|
||||
<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)`
|
||||
min-width: 65px;
|
||||
text-align: center;
|
||||
|
||||
@@ -141,12 +141,12 @@ export function InvoiceDetailsStatus({ invoice }) {
|
||||
<Choose>
|
||||
<Choose.When condition={invoice.is_overdue}>
|
||||
<StatusTag intent={Intent.WARNING} round={true}>
|
||||
Overdue
|
||||
<T id={'overdue'} />
|
||||
</StatusTag>
|
||||
</Choose.When>
|
||||
<Choose.Otherwise>
|
||||
<StatusTag intent={Intent.PRIMARY} round={true}>
|
||||
Delivered
|
||||
<T id={'delivered'} />
|
||||
</StatusTag>
|
||||
</Choose.Otherwise>
|
||||
</Choose>
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user