mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
feat: add project ability.
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import {
|
||||
Icon,
|
||||
Can,
|
||||
AdvancedFilterPopover,
|
||||
DashboardActionViewsList,
|
||||
DashboardFilterButton,
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
FormattedMessage as T,
|
||||
DashboardActionsBar,
|
||||
} from '@/components';
|
||||
import { ProjectAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
|
||||
import withProjects from './withProjects';
|
||||
import withProjectsActions from './withProjectsActions';
|
||||
@@ -75,12 +77,14 @@ function ProjectsActionsBar({
|
||||
onChange={handleTabChange}
|
||||
/>
|
||||
<NavbarDivider />
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="plus" />}
|
||||
text={<T id={'projects.label.new_project'} />}
|
||||
onClick={handleNewProjectBtnClick}
|
||||
/>
|
||||
<Can I={ProjectAction.Create} a={AbilitySubject.Project}>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="plus" />}
|
||||
text={<T id={'projects.label.new_project'} />}
|
||||
onClick={handleNewProjectBtnClick}
|
||||
/>
|
||||
</Can>
|
||||
{/* AdvancedFilterPopover */}
|
||||
|
||||
<Button
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { EmptyStatus, FormattedMessage as T } from '@/components';
|
||||
import { EmptyStatus, Can, FormattedMessage as T } from '@/components';
|
||||
import { ProjectAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
@@ -24,16 +25,18 @@ function ProjectsEmptyStatus({
|
||||
}
|
||||
action={
|
||||
<React.Fragment>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={handleNewProjectClick}
|
||||
>
|
||||
<T id="projects.empty_status.action" />
|
||||
</Button>
|
||||
<Button intent={Intent.NONE} large={true}>
|
||||
<T id={'learn_more'} />
|
||||
</Button>
|
||||
<Can I={ProjectAction.Create} a={AbilitySubject.Project}>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
large={true}
|
||||
onClick={handleNewProjectClick}
|
||||
>
|
||||
<T id="projects.empty_status.action" />
|
||||
</Button>
|
||||
<Button intent={Intent.NONE} large={true}>
|
||||
<T id={'learn_more'} />
|
||||
</Button>
|
||||
</Can>
|
||||
</React.Fragment>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -13,10 +13,12 @@ import {
|
||||
import {
|
||||
Icon,
|
||||
FormatDate,
|
||||
Can,
|
||||
Choose,
|
||||
If,
|
||||
FormattedMessage as T,
|
||||
} from '@/components';
|
||||
import { ProjectAction, AbilitySubject } from '@/constants/abilityOption';
|
||||
import { safeCallback, firstLettersArgs, calculateStatus } from '@/utils';
|
||||
|
||||
/**
|
||||
@@ -81,37 +83,46 @@ export const ActionsMenu = ({
|
||||
text={intl.get('view_details')}
|
||||
onClick={safeCallback(onViewDetails, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('projects.action.edit_project')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<MenuItem
|
||||
icon={<Icon icon="plus" />}
|
||||
text={intl.get('projects.action.new_task')}
|
||||
onClick={safeCallback(onNewTask, original)}
|
||||
/>
|
||||
|
||||
<MenuItem text={'Status'} icon={<Icon icon="plus" />}>
|
||||
<If condition={original.status !== 'InProgress'}>
|
||||
<MenuItem
|
||||
text={'InProgress'}
|
||||
onClick={safeCallback(onStatus, original)}
|
||||
/>
|
||||
</If>
|
||||
<If condition={original.status !== 'Closed'}>
|
||||
<MenuItem text={'Closed'} onClick={safeCallback(onStatus, original)} />
|
||||
</If>
|
||||
</MenuItem>
|
||||
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
text={intl.get('projects.action.delete_project')}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
/>
|
||||
<Can I={ProjectAction.Edit} a={AbilitySubject.Project}>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('projects.action.edit_project')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
</Can>
|
||||
<Can I={ProjectAction.Create} a={AbilitySubject.Project}>
|
||||
<MenuItem
|
||||
icon={<Icon icon="plus" />}
|
||||
text={intl.get('projects.action.new_task')}
|
||||
onClick={safeCallback(onNewTask, original)}
|
||||
/>
|
||||
</Can>
|
||||
<Can I={ProjectAction.View} a={AbilitySubject.Project}>
|
||||
<MenuItem text={'Status'} icon={<Icon icon="plus" />}>
|
||||
<If condition={original.status !== 'InProgress'}>
|
||||
<MenuItem
|
||||
text={'InProgress'}
|
||||
onClick={safeCallback(onStatus, original)}
|
||||
/>
|
||||
</If>
|
||||
<If condition={original.status !== 'Closed'}>
|
||||
<MenuItem
|
||||
text={'Closed'}
|
||||
onClick={safeCallback(onStatus, original)}
|
||||
/>
|
||||
</If>
|
||||
</MenuItem>
|
||||
</Can>
|
||||
<Can I={ProjectAction.Delete} a={AbilitySubject.Project}>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
text={intl.get('projects.action.delete_project')}
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
intent={Intent.DANGER}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
/>
|
||||
</Can>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user