feat: add project invoicing cell.

This commit is contained in:
elforjani13
2022-09-08 21:44:16 +02:00
parent c75f46d8a4
commit 2ae720821e
4 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import React from 'react';
import styled from 'styled-components';
import { Popover2 } from '@blueprintjs/popover2';
import { Button } from '@blueprintjs/core';
import { CellType } from '@/constants';
import {
Icon,
FormattedMessage as T,
ButtonLink,
DetailsMenu,
DetailItem,
FormatDate,
} from '@/components';
/**
* @return
*/
export function ProjectInvoicingCell({}) {
const content = (
<ProjectInvoicingContent>
<DetailsMenu direction={'vertical'}>
<DetailItem label={'Type'}>
<ButtonLink>Expense</ButtonLink>
</DetailItem>
<DetailItem label={'Transaction No.'}>EXP-1000</DetailItem>
<DetailItem label={'Date'}>2022-02-02</DetailItem>
<DetailItem label={'Amount'}>$1000.00</DetailItem>
</DetailsMenu>
</ProjectInvoicingContent>
);
return (
<Popover2 content={content}>
<Button
icon={<Icon icon={'info'} iconSize={14} />}
className="m12"
minimal={true}
/>
</Popover2>
);
}
ProjectInvoicingCell.cellType = CellType.Button;
const ProjectInvoicingContent = styled.div`
width: 450px;
padding: 7px 12px;
`;

View File

@@ -11,6 +11,7 @@ import SwitchFieldCell from './SwitchFieldCell';
import TextAreaCell from './TextAreaCell'; import TextAreaCell from './TextAreaCell';
import BranchesListFieldCell from './BranchesListFieldCell'; import BranchesListFieldCell from './BranchesListFieldCell';
import { ProjectsListFieldCell } from './ProjectsListFieldCell'; import { ProjectsListFieldCell } from './ProjectsListFieldCell';
import { ProjectInvoicingCell } from './ProjectInvoicingCell';
import { TextOverviewTooltipCell } from './TextOverviewTooltipCell'; import { TextOverviewTooltipCell } from './TextOverviewTooltipCell';
export { export {
@@ -28,5 +29,6 @@ export {
TextAreaCell, TextAreaCell,
BranchesListFieldCell, BranchesListFieldCell,
ProjectsListFieldCell, ProjectsListFieldCell,
ProjectInvoicingCell,
TextOverviewTooltipCell, TextOverviewTooltipCell,
}; };

View File

@@ -13,6 +13,7 @@ import {
PercentFieldCell, PercentFieldCell,
NumericInputCell, NumericInputCell,
CheckBoxFieldCell, CheckBoxFieldCell,
ProjectInvoicingCell,
} from '@/components/DataTableCells'; } from '@/components/DataTableCells';
/** /**
@@ -152,6 +153,15 @@ export function useEditableItemsEntriesColumns({ landedCost }) {
}, },
] ]
: []), : []),
{
Header: '',
accessor: 'invoicing',
Cell: ProjectInvoicingCell,
disableSortBy: true,
disableResizing: true,
width: 45,
align: Align.Center,
},
{ {
Header: '', Header: '',
accessor: 'action', accessor: 'action',

View File

@@ -40,6 +40,9 @@ function ProjectDetailActionsBar({
// Handle new transaction button click. // Handle new transaction button click.
const handleNewTransactionBtnClick = ({ path }) => { const handleNewTransactionBtnClick = ({ path }) => {
switch (path) { switch (path) {
case 'invoincing':
openDialog('project-invoicing-form');
break;
case 'expense': case 'expense':
openDialog('project-expense-form', { projectId }); openDialog('project-expense-form', { projectId });
break; break;