-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathproject.component.tsx
More file actions
68 lines (66 loc) · 1.74 KB
/
project.component.tsx
File metadata and controls
68 lines (66 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import {
TabComponent,
TabListComponent,
TabPanelComponent,
} from 'common/components';
import AppBar from '@material-ui/core/AppBar';
import {
DataComponent,
EmployeeComponent,
ReportComponent,
} from './components';
import { Project, Report } from './project.vm';
import * as classes from './project.styles';
interface Props {
isEditMode: boolean;
project: Project;
report: Report;
onGenerateExcel: (report: Report) => void;
onSave: (project: Project) => void;
onCancel: () => void;
}
export const ProjectComponent: React.FunctionComponent<Props> = ({
isEditMode,
project,
report,
onGenerateExcel,
onSave,
onCancel,
}) => {
const [tab, setTab] = React.useState(0);
return (
<>
<AppBar position="static">
<TabListComponent value={tab} onChange={setTab}>
<TabComponent label="Datos" />
<TabComponent label="Empleados" disabled={!isEditMode} />
<TabComponent label="Informes" disabled={!isEditMode} />
</TabListComponent>
</AppBar>
<TabPanelComponent value={tab} index={0}>
<DataComponent
project={project}
onCancel={onCancel}
onSave={onSave}
className={classes.root}
/>
</TabPanelComponent>
<TabPanelComponent value={tab} index={1}>
<EmployeeComponent
employeeSummaryList={project.employees}
onCancel={onCancel}
className={classes.root}
/>
</TabPanelComponent>
<TabPanelComponent value={tab} index={2}>
<ReportComponent
report={report}
onCancel={onCancel}
className={classes.root}
onGenerateExcel={onGenerateExcel}
/>
</TabPanelComponent>
</>
);
};