mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat: add project billable entries link & alert.
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import * as R from 'ramda';
|
||||||
|
|
||||||
|
import { ButtonLink } from '@/components';
|
||||||
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
|
||||||
|
function ProjectBillableEntriesLinkComponent({
|
||||||
|
// #ownProps
|
||||||
|
children,
|
||||||
|
projectId,
|
||||||
|
className,
|
||||||
|
|
||||||
|
// #withDialogAction
|
||||||
|
openDialog,
|
||||||
|
}) {
|
||||||
|
const handleBillableEntries = (event) => {
|
||||||
|
openDialog('project-billable-entries', { projectId });
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BillableEntriesLink className={className} onClick={handleBillableEntries}>
|
||||||
|
{children}
|
||||||
|
</BillableEntriesLink>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProjectBillableEntriesLink = R.compose(withDialogActions)(
|
||||||
|
ProjectBillableEntriesLinkComponent,
|
||||||
|
);
|
||||||
|
|
||||||
|
const BillableEntriesLink = styled(ButtonLink)`
|
||||||
|
font-size: 11px;
|
||||||
|
margin-top: 6px;
|
||||||
|
`;
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
export * from './ExpenseSelect';
|
export * from './ExpenseSelect';
|
||||||
export * from './ChangeTypesSelect';
|
export * from './ProjectTaskSelect';
|
||||||
export * from './TaskSelect';
|
export * from './ProjectTaskChargeTypeSelect';
|
||||||
export * from './ProjectsSelect';
|
export * from './ProjectsSelect';
|
||||||
export * from './ProjectMultiSelect'
|
export * from './ProjectMultiSelect';
|
||||||
export * from './FInputGroupComponent';
|
export * from './FInputGroupComponent';
|
||||||
export * from './ProjectSuggestField'
|
export * from './ProjectSuggestField';
|
||||||
export * from './ProjectBillableTypeSuggestField'
|
export * from './ProjectBillableTypeSuggestField';
|
||||||
|
export * from './ProjectBillableEntriesLink';
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import React from 'react';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { Callout, Intent, Classes } from '@blueprintjs/core';
|
||||||
|
import { CLASSES } from '@/constants/classes';
|
||||||
|
import { FormattedMessage as T } from '@/components';
|
||||||
|
|
||||||
export const getDefaultQuery = () => {
|
/**
|
||||||
return {
|
* Empty status callout.
|
||||||
billableType: '',
|
* @returns {React.JSX}
|
||||||
to_date: moment(new Date()).format('YYYY-MM-DD'),
|
*/
|
||||||
};
|
export function EmptyStatuCallout() {
|
||||||
};
|
return (
|
||||||
|
<div className={Classes.DIALOG_BODY}>
|
||||||
|
<Callout intent={Intent.PRIMARY}>
|
||||||
|
<p>
|
||||||
|
<T
|
||||||
|
id={'project_billable_entries.alert.there_is_no_billable_entries'}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</Callout>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ import {
|
|||||||
InvoiceExchangeRateInputField,
|
InvoiceExchangeRateInputField,
|
||||||
InvoiceProjectSelectButton,
|
InvoiceProjectSelectButton,
|
||||||
} from './components';
|
} from './components';
|
||||||
import { ProjectsSelect } from '@/containers/Projects/components';
|
import {
|
||||||
|
ProjectsSelect,
|
||||||
|
ProjectBillableEntriesLink,
|
||||||
|
} from '@/containers/Projects/components';
|
||||||
|
|
||||||
import withSettings from '@/containers/Settings/withSettings';
|
import withSettings from '@/containers/Settings/withSettings';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
@@ -56,6 +59,7 @@ function InvoiceFormHeaderFields({
|
|||||||
// Invoice form context.
|
// Invoice form context.
|
||||||
const { customers, projects } = useInvoiceFormContext();
|
const { customers, projects } = useInvoiceFormContext();
|
||||||
|
|
||||||
|
// Formik context.
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
|
|
||||||
// Handle invoice number changing.
|
// Handle invoice number changing.
|
||||||
@@ -78,14 +82,6 @@ function InvoiceFormHeaderFields({
|
|||||||
// Syncs invoice number settings with form.
|
// Syncs invoice number settings with form.
|
||||||
useObserveInvoiceNoSettings(invoiceNumberPrefix, invoiceNextNumber);
|
useObserveInvoiceNoSettings(invoiceNumberPrefix, invoiceNextNumber);
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (values.project_id) {
|
|
||||||
openDialog('project-billable-entries', {
|
|
||||||
projectId: values.project_id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [values]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_HEADER_FIELDS)}>
|
<div className={classNames(CLASSES.PAGE_FORM_HEADER_FIELDS)}>
|
||||||
{/* ----------- Customer name ----------- */}
|
{/* ----------- Customer name ----------- */}
|
||||||
@@ -254,6 +250,11 @@ function InvoiceFormHeaderFields({
|
|||||||
input={InvoiceProjectSelectButton}
|
input={InvoiceProjectSelectButton}
|
||||||
popoverFill={true}
|
popoverFill={true}
|
||||||
/>
|
/>
|
||||||
|
{values?.project_id && (
|
||||||
|
<ProjectBillableEntriesLink projectId={values?.project_id}>
|
||||||
|
<T id={'add_billable_entries'} />
|
||||||
|
</ProjectBillableEntriesLink>
|
||||||
|
)}
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user