feat: time entry dialog.

This commit is contained in:
elforjani13
2022-06-23 00:14:49 +02:00
parent 50522af72d
commit 7be568b8ac
13 changed files with 41 additions and 29 deletions

View File

@@ -42,7 +42,7 @@ import CustomerOpeningBalanceDialog from '../containers/Dialogs/CustomerOpeningB
import VendorOpeningBalanceDialog from '../containers/Dialogs/VendorOpeningBalanceDialog';
import ProjectFormDialog from '../containers/Projects/containers/ProjectFormDialog';
import TaskFormDialog from '../containers/Projects/containers/TaskFormDialog';
import TimeEntryFormDialog from '../containers/Timesheets/containers/TimeEntryFormDialog';
import TimeEntryFormDialog from '../containers/Projects/containers/TimeEntryFormDialog';
/**
* Dialogs container.

View File

@@ -9,10 +9,15 @@ import TimeEntryForm from './TimeEntryForm';
export default function TimeEntryFormDialogContent({
// #ownProps
dialogName,
project,
timeEntry,
}) {
return (
<TimeEntryFormProvider timeEntryId={timeEntry} dialogName={dialogName}>
<TimeEntryFormProvider
projectId={project}
timeEntryId={timeEntry}
dialogName={dialogName}
>
<TimeEntryForm />
</TimeEntryFormProvider>
);

View File

@@ -1,7 +1,8 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
import { Classes, Position } from '@blueprintjs/core';
import styled from 'styled-components';
import { Classes, Intent, Position } from '@blueprintjs/core';
import { CLASSES } from 'common/classes';
import classNames from 'classnames';
import {
@@ -9,10 +10,11 @@ import {
FInputGroup,
FDateInput,
FTextArea,
FEditableText,
FieldRequiredHint,
FormattedMessage as T,
} from 'components';
import { ProjectSelect, TaskSelect } from '../../components';
import { ProjectSelect, TaskSelect } from './components';
import { momentFormatter } from 'utils';
/**
@@ -30,11 +32,8 @@ function TimeEntryFormFields() {
className={classNames('form-group--select-list', Classes.FILL)}
>
<ProjectSelect
name={'projectId'}
projects={[
{ id: '1', name: 'Project 1' },
{ id: '2', name: 'Project 2' },
]}
name={'tesc'}
projects={[]}
popoverProps={{ minimal: true }}
/>
</FFormGroup>
@@ -47,34 +46,23 @@ function TimeEntryFormFields() {
>
<TaskSelect
name={'taskId'}
tasks={[
{ id: '1', name: 'Task 1' },
{ id: '2', name: 'Task 2' },
]}
tasks={[]}
popoverProps={{ minimal: true }}
/>
</FFormGroup>
{/*------------ Description -----------*/}
<FFormGroup
name={'description'}
label={intl.get('time_entry.dialog.description')}
className={'form-group--description'}
>
<FTextArea name={'description'} />
</FFormGroup>
{/*------------ Duration -----------*/}
<FFormGroup
label={intl.get('time_entry.dialog.duration')}
name={'duration'}
labelInfo={<FieldRequiredHint />}
>
<FInputGroup name="duration" />
<FInputGroup name="duration" inputProps={{}} />
</FFormGroup>
{/*------------ Date -----------*/}
<FFormGroup
label={intl.get('time_entry.dialog.date')}
name={'date'}
labelInfo={<FieldRequiredHint />}
className={classNames(CLASSES.FILL, 'form-group--date')}
>
<FDateInput
@@ -87,6 +75,21 @@ function TimeEntryFormFields() {
}}
/>
</FFormGroup>
{/*------------ Description -----------*/}
<FFormGroup
name={'description'}
label={intl.get('time_entry.dialog.description')}
className={'form-group--description'}
>
<FTextArea name={'description'} />
{/* <FEditableText
multiline={true}
// minLines={1.78}
// maxLines={1.78}
name={'description'}
placeholder=""
/> */}
</FFormGroup>
</div>
);
}

View File

@@ -11,6 +11,7 @@ const TimeEntryFormContext = React.createContext();
function TimeEntryFormProvider({
// #ownProps
dialogName,
projectId,
timeEntryId,
...props
}) {

View File

@@ -1,7 +1,7 @@
import React from 'react';
import intl from 'react-intl-universal';
import { MenuItem, Button } from '@blueprintjs/core';
import { FSelect } from '../../../components/Forms';
import { FSelect } from '../../../../../components/Forms';
/**
*
@@ -41,7 +41,7 @@ const projectItemRenderer = (project, { handleClick, modifiers, query }) => {
};
const projectSelectProps = {
itemPredicate: projectItemPredicate,
// itemPredicate: projectItemPredicate,
itemRenderer: projectItemRenderer,
valueAccessor: 'id',
labelAccessor: 'name',

View File

@@ -1,7 +1,7 @@
import React from 'react';
import intl from 'react-intl-universal';
import { MenuItem, Button } from '@blueprintjs/core';
import { FSelect } from '../../../components/Forms';
import { FSelect } from '../../../../../components/Forms';
/**
*

View File

@@ -12,7 +12,11 @@ const TimeEntryFormDialogContent = React.lazy(
* Time entry form dialog.
* @returns
*/
function TimeEntryFormDialog({ dialogName, isOpen, payload: { timeEntryId } }) {
function TimeEntryFormDialog({
dialogName,
isOpen,
payload: { projectId = null, timeEntryId = null },
}) {
return (
<TimeEntryFormDialogRoot
name={dialogName}
@@ -25,6 +29,7 @@ function TimeEntryFormDialog({ dialogName, isOpen, payload: { timeEntryId } }) {
<DialogSuspense>
<TimeEntryFormDialogContent
dialogName={dialogName}
project={projectId}
timeEntry={timeEntryId}
/>
</DialogSuspense>
@@ -38,14 +43,12 @@ const TimeEntryFormDialogRoot = styled(Dialog)`
.bp3-dialog-body {
.bp3-form-group {
margin-bottom: 15px;
margin-top: 15px;
label.bp3-label {
margin-bottom: 3px;
font-size: 13px;
}
}
.form-group {
&--description {
.bp3-form-content {