Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(webapp): add mark as delivered to action bar of invoice details … #360

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ function InvoiceDetailActionsBar({
closeDrawer(DRAWERS.INVOICE_DETAILS);
};

// Hanlde deliver sale invoice.
const handleDeliverInvoice = ({ id }) => {
openAlert('invoice-deliver', { invoiceId });
};

// Handle convert to invoice.
const handleConvertToCreitNote = () => {
history.push(`/credit-notes/new?from_invoice_id=${invoiceId}`, {
Expand Down Expand Up @@ -153,6 +158,7 @@ function InvoiceDetailActionsBar({
onCancelBadDebt: handleCancelBadDebtInvoice,
onNotifyViaSMS: handleNotifyViaSMS,
onConvert: handleConvertToCreitNote,
onDeliver: handleDeliverInvoice,
}}
/>
</Can>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
FormattedMessage as T,
Choose,
Can,
If,
TextOverviewTooltipCell,
} from '@/components';
import { SaleInvoiceAction, AbilitySubject } from '@/constants/abilityOption';
Expand Down Expand Up @@ -94,7 +95,7 @@ export const useInvoiceReadonlyEntriesColumns = () => {
* @returns {React.JSX}
*/
export const BadDebtMenuItem = ({
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS, onConvert },
payload: { onCancelBadDebt, onBadDebt, onNotifyViaSMS, onConvert, onDeliver },
}) => {
const { invoice } = useInvoiceDetailDrawerContext();

Expand All @@ -108,6 +109,12 @@ export const BadDebtMenuItem = ({
}}
content={
<Menu>
<If condition={!invoice.is_delivered}>
<MenuItem
onClick={onDeliver}
text={<T id={'mark_as_delivered'} />}
/>
</If>
<Choose>
<Choose.When condition={!invoice.is_writtenoff}>
<MenuItem
Expand Down
Loading