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