mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: add project select.
This commit is contained in:
@@ -47,17 +47,24 @@ const projectSelectProps = {
|
|||||||
labelAccessor: 'name',
|
labelAccessor: 'name',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} param0
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
export function ProjectsSelect({ projects, ...rest }) {
|
export function ProjectsSelect({ projects, ...rest }) {
|
||||||
|
return <FSelect {...projectSelectProps} items={projects} {...rest} />;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} param0
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function ProjectSelectButton({ label, ...rest }) {
|
||||||
return (
|
return (
|
||||||
<FSelect
|
<Button
|
||||||
items={projects}
|
text={label ? label : intl.get('find_or_choose_a_project')}
|
||||||
{...projectSelectProps}
|
|
||||||
{...rest}
|
{...rest}
|
||||||
input={ProjectSelectButton}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ProjectSelectButton({ label }) {
|
|
||||||
return <Button text={label ? label : intl.get('find_or_choose_a_project')} />;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import {
|
|||||||
FormattedMessage as T,
|
FormattedMessage as T,
|
||||||
} from '@/components';
|
} from '@/components';
|
||||||
import { useProjectTimeEntryFormContext } from './ProjectTimeEntryFormProvider';
|
import { useProjectTimeEntryFormContext } from './ProjectTimeEntryFormProvider';
|
||||||
import { TaskSelect, ProjectsSelect } from '../../components';
|
import {
|
||||||
|
TaskSelect,
|
||||||
|
ProjectsSelect,
|
||||||
|
ProjectSelectButton,
|
||||||
|
} from '../../components';
|
||||||
import { momentFormatter } from '@/utils';
|
import { momentFormatter } from '@/utils';
|
||||||
import { useSetProjectToForm } from './utils';
|
import { useSetProjectToForm } from './utils';
|
||||||
|
|
||||||
@@ -43,6 +47,7 @@ function ProjectTimeEntryFormFields() {
|
|||||||
<ProjectsSelect
|
<ProjectsSelect
|
||||||
name={'project_id'}
|
name={'project_id'}
|
||||||
projects={projects}
|
projects={projects}
|
||||||
|
input={ProjectSelectButton}
|
||||||
popoverProps={{ minimal: true }}
|
popoverProps={{ minimal: true }}
|
||||||
/>
|
/>
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user