... | ... |
@@ -5,27 +5,27 @@ import { normalizeData } from './ganttUtils'; |
5 | 5 |
|
6 | 6 |
const algoData = [ |
7 | 7 |
[ |
8 |
- { startTime: 1, endTime: 3, processor: 1 }, |
|
9 |
- { startTime: 4, endTime: 6, processor: 1 }, |
|
10 |
- { startTime: 6, endTime: 10, processor: 1 }, |
|
8 |
+ { startTime: 1, endTime: 3, processor: 1, name: 'UI dizajnér' }, |
|
9 |
+ { startTime: 4, endTime: 6, processor: 1, name: 'UX dizajnér' }, |
|
10 |
+ { startTime: 6, endTime: 10, processor: 1, name: 'UI dizajnér' }, |
|
11 | 11 |
], |
12 | 12 |
[ |
13 |
- { startTime: 6, endTime: 10, processor: 2 }, |
|
14 |
- { startTime: 22, endTime: 23, processor: 2 }, |
|
15 |
- { startTime: 23, endTime: 24, processor: 2 }, |
|
16 |
- { startTime: 24, endTime: 25, processor: 2 }, |
|
13 |
+ { startTime: 6, endTime: 10, processor: 2, name: 'UI dizajnér' }, |
|
14 |
+ { startTime: 22, endTime: 23, processor: 2, name: 'UI dizajnér' }, |
|
15 |
+ { startTime: 23, endTime: 24, processor: 2, name: 'UI dizajnér' }, |
|
16 |
+ { startTime: 24, endTime: 25, processor: 2, name: 'UI dizajnér' }, |
|
17 | 17 |
], |
18 | 18 |
[ |
19 |
- { startTime: 10, endTime: 16, processor: 3 }, |
|
19 |
+ { startTime: 10, endTime: 16, processor: 3, name: 'UI dizajnér' }, |
|
20 | 20 |
], |
21 | 21 |
[ |
22 |
- { startTime: 10, endTime: 16, processor: 4 }, |
|
22 |
+ { startTime: 10, endTime: 16, processor: 4, name: 'UI dizajnér' }, |
|
23 | 23 |
], |
24 | 24 |
[ |
25 |
- { startTime: 10, endTime: 16, processor: 5 }, |
|
25 |
+ { startTime: 10, endTime: 16, processor: 5, name: 'UI dizajnér' }, |
|
26 | 26 |
], |
27 | 27 |
[ |
28 |
- { startTime: 10, endTime: 16, processor: 6 }, |
|
28 |
+ { startTime: 10, endTime: 16, processor: 6, name: 'UI dizajnér' }, |
|
29 | 29 |
] |
30 | 30 |
]; |
31 | 31 |
|
... | ... |
@@ -31,9 +31,13 @@ const computeBoxStyle = ( |
31 | 31 |
|
32 | 32 |
flex, |
33 | 33 |
backgroundColor, |
34 |
+ color, |
|
35 |
+ cursor, |
|
36 |
+ textAlign, |
|
37 |
+ fontSize, |
|
34 | 38 |
|
35 | 39 |
// Border props. |
36 |
- borderColor = 'gray', |
|
40 |
+ borderColor, |
|
37 | 41 |
// We can't use borderColor as default because some component in React Native, |
38 | 42 |
// for example Image, doesn't support that. |
39 | 43 |
borderBottomColor, |
... | ... |
@@ -45,7 +49,7 @@ const computeBoxStyle = ( |
45 | 45 |
borderBottomRightRadius = borderRadius, |
46 | 46 |
borderTopLeftRadius = borderRadius, |
47 | 47 |
borderTopRightRadius = borderRadius, |
48 |
- borderWidth = 0, // Enfore React Native behaviour. It also makes more sense. |
|
48 |
+ borderWidth, |
|
49 | 49 |
borderBottomWidth = borderWidth, |
50 | 50 |
borderLeftWidth = borderWidth, |
51 | 51 |
borderRightWidth = borderWidth, |
... | ... |
@@ -116,6 +120,10 @@ const computeBoxStyle = ( |
116 | 116 |
|
117 | 117 |
flex, |
118 | 118 |
backgroundColor, |
119 |
+ color, |
|
120 |
+ cursor, |
|
121 |
+ textAlign, |
|
122 |
+ fontSize, |
|
119 | 123 |
|
120 | 124 |
// Border props. |
121 | 125 |
borderColor, |
... | ... |
@@ -12,13 +12,34 @@ import PropTypes from 'proptypes'; |
12 | 12 |
import Select from 'react-select'; |
13 | 13 |
import 'react-select/dist/react-select.css'; |
14 | 14 |
import { |
15 |
- filter, find, flatten, identity, map, prop, propEq, reject, uniq, update |
|
15 |
+ filter, find, findIndex, flatten, forEach, identity, map, prop, propEq, reject, uniq, update |
|
16 | 16 |
} from 'rambda'; |
17 |
-import { insert } from 'ramda'; |
|
17 |
+import { insert, remove } from 'ramda'; |
|
18 |
+import theme from '../theme'; |
|
18 | 19 |
|
19 | 20 |
const allJobs = { |
20 |
- frontend: 'Frontend', |
|
21 |
- backend: 'Backend', |
|
21 |
+ whatever: 'Vševediaci', |
|
22 |
+ |
|
23 |
+ marketResearch: 'Prieskum trhu', |
|
24 |
+ |
|
25 |
+ designUi: 'Dizajnér – UI', |
|
26 |
+ designUx: 'Dizajnér – UX', |
|
27 |
+ |
|
28 |
+ architect: 'Softwarový architekt', |
|
29 |
+ |
|
30 |
+ devFrontend: 'Developer – frontend', |
|
31 |
+ devBackend: 'Developer – backend', |
|
32 |
+ devDb: 'Developer – databázy', |
|
33 |
+ |
|
34 |
+ admin: 'Serverový administrátor', |
|
35 |
+ |
|
36 |
+ tester: 'Tester', |
|
37 |
+ |
|
38 |
+ analyst: 'Analytik', |
|
39 |
+ |
|
40 |
+ qa: 'Quality assurance', |
|
41 |
+ |
|
42 |
+ deployManager: 'Deploy' |
|
22 | 43 |
}; |
23 | 44 |
|
24 | 45 |
const nextWorkerName = (rows) => |
... | ... |
@@ -27,58 +48,81 @@ const nextWorkerName = (rows) => |
27 | 27 |
class Form extends React.PureComponent { |
28 | 28 |
state = { |
29 | 29 |
rows: [ |
30 |
- { |
|
31 |
- id: uuid(), |
|
32 |
- name: 'pracovnik 1', |
|
33 |
- preempt: false, |
|
34 |
- linkedTo: null, |
|
35 |
- jobs: [ |
|
36 |
- { id: uuid(), name: 'frontend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 }, |
|
37 |
- { id: uuid(), name: 'backend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 } |
|
38 |
- ] |
|
39 |
- }, |
|
40 |
- { |
|
41 |
- id: uuid(), |
|
42 |
- name: 'pracovnik 2', |
|
43 |
- preempt: false, |
|
44 |
- linkedTo: null, |
|
45 |
- jobs: [ |
|
46 |
- { id: uuid(), name: 'frontend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 }, |
|
47 |
- { id: uuid(), name: 'backend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 } |
|
48 |
- ] |
|
49 |
- } |
|
30 |
+ // { |
|
31 |
+ // id: uuid(), |
|
32 |
+ // name: 'pracovnik 1', |
|
33 |
+ // preempt: false, |
|
34 |
+ // linkedTo: null, |
|
35 |
+ // jobs: [ |
|
36 |
+ // { id: uuid(), name: 'frontend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 }, |
|
37 |
+ // { id: uuid(), name: 'backend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 } |
|
38 |
+ // ] |
|
39 |
+ // }, |
|
40 |
+ // { |
|
41 |
+ // id: uuid(), |
|
42 |
+ // name: 'pracovnik 2', |
|
43 |
+ // preempt: false, |
|
44 |
+ // linkedTo: null, |
|
45 |
+ // jobs: [ |
|
46 |
+ // { id: uuid(), name: 'frontend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 }, |
|
47 |
+ // { id: uuid(), name: 'backend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 } |
|
48 |
+ // ] |
|
49 |
+ // } |
|
50 | 50 |
] |
51 | 51 |
}; |
52 | 52 |
|
53 |
+ onSubmit = (values) => { |
|
54 |
+ console.log(values); |
|
55 |
+ }; |
|
56 |
+ |
|
53 | 57 |
addWorker = (setFieldValue, rows) => { |
54 |
- const updatedRows = [...rows, { id: uuid(), name: nextWorkerName(rows), jobs: [] } ]; |
|
58 |
+ const jobs = [{ |
|
59 |
+ id: uuid(), name: 'whatever', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 |
|
60 |
+ }]; |
|
61 |
+ |
|
62 |
+ const updatedRows = [...rows, { id: uuid(), name: nextWorkerName(rows), jobs } ]; |
|
55 | 63 |
setFieldValue('rows', updatedRows); |
56 | 64 |
}; |
57 | 65 |
|
58 | 66 |
render() { |
59 | 67 |
return ( |
60 |
- <Formik initialValues={this.state} render={({ setFieldValue, values: { rows } }) => ( |
|
61 |
- <React.Fragment> |
|
68 |
+ <Formik initialValues={this.state} onSubmit={this.onSubmit} render={({ setFieldValue, values: { rows } }) => ( |
|
69 |
+ <FormikForm> |
|
62 | 70 |
<h1>Konfigurácia projektu</h1> |
63 | 71 |
|
72 |
+ {rows.length ? |
|
64 | 73 |
<Box flexDirection="row" marginBottom={10}> |
65 |
- <Box flexBasis="20%" flexShrink={0}><strong>Pracovník</strong></Box> |
|
66 |
- <Box flexBasis="60%" flexShrink={0}><strong>Úlohy</strong></Box> |
|
67 |
- <Box flexBasis="10%" flexShrink={0} align="center"><strong>Prerušenie</strong></Box> |
|
68 |
- </Box> |
|
74 |
+ <Box flexBasis="15%" flexShrink={0}><strong>Pracovník</strong></Box> |
|
75 |
+ <Box flexBasis="63%" flexShrink={0}><strong>Úlohy</strong></Box> |
|
76 |
+ <Box flexBasis="12%" flexShrink={0} align="center"><strong>Prerušenie</strong></Box> |
|
77 |
+ </Box> : null |
|
78 |
+ } |
|
69 | 79 |
|
70 | 80 |
<FieldArray name="rows" render={arrayHelpers => ( |
71 |
- <FormikForm> |
|
81 |
+ <React.Fragment> |
|
72 | 82 |
{rows.map((row, i) => <Row key={i} {...row} arrayHelpers={arrayHelpers} prefix={`rows.${i}`} index={i} />)} |
73 |
- </FormikForm> |
|
83 |
+ </React.Fragment> |
|
74 | 84 |
)} /> |
75 | 85 |
|
76 | 86 |
<Box flexDirection="row" marginBottom={10}> |
77 |
- <Box flexBasis="20%" flexShrink={0} onClick={() => this.addWorker(setFieldValue, rows)} style={{ cursor: 'pointer' }}> |
|
87 |
+ <Box |
|
88 |
+ flexShrink={0} |
|
89 |
+ onClick={() => this.addWorker(setFieldValue, rows)} |
|
90 |
+ {...theme.buttons.primary} |
|
91 |
+ > |
|
78 | 92 |
+ Nový pracovník |
79 | 93 |
</Box> |
80 | 94 |
</Box> |
81 |
- </React.Fragment> |
|
95 |
+ |
|
96 |
+ <Box as="button" margin="auto" width="20rem" alignItems="center" padding={5} |
|
97 |
+ {...theme.buttons.primary} backgroundColor="#C89C93"> |
|
98 |
+ <Box fontSize="1rem">Cieľ:</Box> |
|
99 |
+ <Box as="select" marginTop={5}> |
|
100 |
+ <option>Minimalizovať počet oneskorených úloh</option> |
|
101 |
+ <option>2...</option> |
|
102 |
+ </Box> |
|
103 |
+ </Box> |
|
104 |
+ </FormikForm> |
|
82 | 105 |
)}> |
83 | 106 |
</Formik> |
84 | 107 |
) |
... | ... |
@@ -124,7 +168,7 @@ const SortableJob = SortableElement( |
124 | 124 |
const row = find(propEq('id', idRow), rows); |
125 | 125 |
const jobName = find(propEq('id', idJob), row.jobs).name; |
126 | 126 |
|
127 |
- return ({ value, label: `${row.name} – ${jobName}` }); |
|
127 |
+ return ({ value, label: `${row.name} – ${allJobs[jobName]}` }); |
|
128 | 128 |
}, |
129 | 129 |
reject( |
130 | 130 |
value => { |
... | ... |
@@ -136,19 +180,28 @@ const SortableJob = SortableElement( |
136 | 136 |
); |
137 | 137 |
|
138 | 138 |
return ( |
139 |
- <Box flexDirection="row" marginBottom={10} paddingBottom={10} backgroundColor="white" borderBottomColor="#1B1B3A" borderBottomWidth={1} borderStyle="solid"> |
|
140 |
- <Box marginRight={10} style={{ fontSize: '1.5rem' }}> |
|
141 |
- <DragHandle /> |
|
139 |
+ <Box |
|
140 |
+ flexDirection="row" |
|
141 |
+ marginBottom={10} |
|
142 |
+ paddingBottom={10} |
|
143 |
+ className="sortable-inactive" |
|
144 |
+ > |
|
145 |
+ <Box marginRight={10} fontSize="1.5rem" width={20}> |
|
146 |
+ {!rows[rowIndex].linkedTo && |
|
147 |
+ <DragHandle/> |
|
148 |
+ } |
|
142 | 149 |
</Box> |
143 | 150 |
|
144 |
- <Box flex={1}> |
|
151 |
+ <Box flex={1} padding={1}> |
|
145 | 152 |
<Box width={200} marginBottom={10} flexDirection="row"> |
146 |
- <Field component="select" name={`${prefix}.name`}> |
|
153 |
+ <Field component="select" name={`${prefix}.name`} disabled={rows[rowIndex].linkedTo}> |
|
147 | 154 |
{Object.keys(allJobs).map(key => ( |
148 | 155 |
<option value={key} key={key}>{allJobs[key]}</option> |
149 | 156 |
))} |
150 | 157 |
</Field> |
151 |
- <Box style={{ cursor: 'pointer' }} onClick={this.deleteJob} marginLeft={5}>✕</Box> |
|
158 |
+ {!rows[rowIndex].linkedTo && |
|
159 |
+ <Box cursor="pointer" onClick={this.deleteJob} marginLeft={5} color="red">✕</Box> |
|
160 |
+ } |
|
152 | 161 |
</Box> |
153 | 162 |
|
154 | 163 |
<Box flexDirection="row" justifyContent="space-between" marginBottom={10}> |
... | ... |
@@ -174,15 +227,15 @@ const SortableJob = SortableElement( |
174 | 174 |
|
175 | 175 |
<Box> |
176 | 176 |
<Box as="label" flexDirection="row" marginBottom={5}> |
177 |
- <Field type="radio" name={`${prefix}.succOrAnc`} value={0} /> Bez nadväznosti |
|
177 |
+ <Field type="radio" name={`${prefix}.succOrAnc`} value={0} checked={job.succOrAnc == '0'} disabled={rows[rowIndex].linkedTo}/> Bez nadväznosti |
|
178 | 178 |
</Box> |
179 | 179 |
<Box marginBottom={5}> |
180 | 180 |
<Box as="label" flexDirection="row"> |
181 |
- <Field type="radio" name={`${prefix}.succOrAnc`} value={1}/> Predchodcovia |
|
181 |
+ <Field type="radio" name={`${prefix}.succOrAnc`} value={1} checked={job.succOrAnc == '1'} disabled={rows[rowIndex].linkedTo} /> Predchodcovia |
|
182 | 182 |
</Box> |
183 | 183 |
<Box flex={1} marginLeft={10} marginTop={5}> |
184 | 184 |
<Select |
185 |
- disabled={false} |
|
185 |
+ disabled={job.succOrAnc != '1' || rows[rowIndex].linkedTo} |
|
186 | 186 |
multi |
187 | 187 |
onChange={e => this.handleSelectChange('anc', e)} |
188 | 188 |
options={existingJobs} |
... | ... |
@@ -193,11 +246,11 @@ const SortableJob = SortableElement( |
193 | 193 |
</Box> |
194 | 194 |
<Box> |
195 | 195 |
<Box as="label" flexDirection="row"> |
196 |
- <Field type="radio" name={`${prefix}.succOrAnc`} value={2} /> Nasledovníci |
|
196 |
+ <Field type="radio" name={`${prefix}.succOrAnc`} value={2} checked={job.succOrAnc == '2'} disabled={rows[rowIndex].linkedTo} /> Nasledovníci |
|
197 | 197 |
</Box> |
198 | 198 |
<Box flex={1} marginLeft={10} marginTop={5}> |
199 | 199 |
<Select |
200 |
- disabled={false} |
|
200 |
+ disabled={job.succOrAnc != '2' || rows[rowIndex].linkedTo} |
|
201 | 201 |
multi |
202 | 202 |
onChange={e => this.handleSelectChange('succ', e)} |
203 | 203 |
options={existingJobs} |
... | ... |
@@ -213,7 +266,7 @@ const SortableJob = SortableElement( |
213 | 213 |
} |
214 | 214 |
}); |
215 | 215 |
|
216 |
-const SortableList = SortableContainer(({ jobs, existingJobs, prefix, rowIndex }) => ( |
|
216 |
+const SortableList = SortableContainer(({ jobs, existingJobs, prefix, rowIndex, draggingIndex }) => ( |
|
217 | 217 |
<div> |
218 | 218 |
{jobs.map((job, i) => ( |
219 | 219 |
<SortableJob |
... | ... |
@@ -224,6 +277,7 @@ const SortableList = SortableContainer(({ jobs, existingJobs, prefix, rowIndex } |
224 | 224 |
job={job} |
225 | 225 |
prefix={`${prefix}.${i}`} |
226 | 226 |
existingJobs={existingJobs} |
227 |
+ isDragging={draggingIndex === i} |
|
227 | 228 |
/> |
228 | 229 |
))} |
229 | 230 |
</div> |
... | ... |
@@ -234,6 +288,14 @@ class Row extends React.PureComponent { |
234 | 234 |
formik: PropTypes.object |
235 | 235 |
}; |
236 | 236 |
|
237 |
+ state = { |
|
238 |
+ draggingIndex: -1 |
|
239 |
+ }; |
|
240 |
+ |
|
241 |
+ onSortStart = ({ index }) => { |
|
242 |
+ this.setState({ draggingIndex: index }); |
|
243 |
+ }; |
|
244 |
+ |
|
237 | 245 |
onSortEnd = ({ oldIndex, newIndex }) => { |
238 | 246 |
const { prefix, index } = this.props; |
239 | 247 |
const { formik: { setFieldValue, values: { rows }} } = this.context; |
... | ... |
@@ -241,6 +303,7 @@ class Row extends React.PureComponent { |
241 | 241 |
const updatedJobs = arrayMove(rows[index].jobs, oldIndex, newIndex); |
242 | 242 |
|
243 | 243 |
setFieldValue(`${prefix}.jobs`, updatedJobs); |
244 |
+ this.setState({ draggingIndex: -1 }); |
|
244 | 245 |
}; |
245 | 246 |
|
246 | 247 |
findExistingJobs = () => { |
... | ... |
@@ -261,7 +324,7 @@ class Row extends React.PureComponent { |
261 | 261 |
const { index } = this.props; |
262 | 262 |
const { formik: { setFieldValue, values: { rows } } } = this.context; |
263 | 263 |
const newJob = { |
264 |
- id: uuid(), name: 'frontend', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 |
|
264 |
+ id: uuid(), name: 'whatever', t: '', d: '', w: '', succ: [], anc: [], succOrAnc: 0 |
|
265 | 265 |
}; |
266 | 266 |
|
267 | 267 |
const jobs = [...rows[index].jobs, newJob]; |
... | ... |
@@ -269,12 +332,28 @@ class Row extends React.PureComponent { |
269 | 269 |
setFieldValue(`rows.${index}.jobs`, jobs); |
270 | 270 |
}; |
271 | 271 |
|
272 |
+ deleteRow = () => { |
|
273 |
+ const { index, id } = this.props; |
|
274 |
+ const { formik: { setFieldValue, values: { rows } } } = this.context; |
|
275 |
+ |
|
276 |
+ let newRows = remove(index, 1, rows); |
|
277 |
+ |
|
278 |
+ const alsoDelete = filter(propEq('linkedTo', id), rows); |
|
279 |
+ |
|
280 |
+ forEach(row => { |
|
281 |
+ const index = findIndex(propEq('id', row.id), newRows); |
|
282 |
+ newRows = remove(index, 1, newRows); |
|
283 |
+ }, alsoDelete); |
|
284 |
+ |
|
285 |
+ setFieldValue('rows', newRows); |
|
286 |
+ }; |
|
287 |
+ |
|
272 | 288 |
duplicate = () => { |
273 | 289 |
const { id, index, name, preempt, jobs } = this.props; |
274 | 290 |
const { formik: { setFieldValue, values: { rows } } } = this.context; |
275 | 291 |
|
276 | 292 |
const jobsCopy = map(job => ({ ...job }), jobs); |
277 |
- const newRow = { id: uuid(), name: `${name} - kópia`, preempt, linkedTo: id, jobs: jobsCopy }; |
|
293 |
+ const newRow = { id: uuid(), name: `${name} – kópia`, preempt, linkedTo: id, jobs: jobsCopy }; |
|
278 | 294 |
|
279 | 295 |
const updatedRows = insert(index + 1, newRow, rows); |
280 | 296 |
|
... | ... |
@@ -283,21 +362,59 @@ class Row extends React.PureComponent { |
283 | 283 |
|
284 | 284 |
render() { |
285 | 285 |
const { index, prefix, name, preempt, linkedTo, jobs } = this.props; |
286 |
+ const { draggingIndex } = this.state; |
|
287 |
+ |
|
286 | 288 |
const existingJobs = this.findExistingJobs(); |
287 | 289 |
|
288 | 290 |
return ( |
289 |
- <Box flexDirection="row" marginBottom={30}> |
|
290 |
- <Box flexBasis="20%" flexShrink={0}>{name}</Box> |
|
291 |
- <Box flexBasis="60%" flexShrink={0}> |
|
291 |
+ <Box flexDirection="row" marginBottom={30} padding={10} className="row"> |
|
292 |
+ <Box flexBasis="15%" flexShrink={0} paddingRight={10}> |
|
293 |
+ <strong>{name}</strong> |
|
294 |
+ <Box cursor="pointer" onClick={this.deleteRow} color="red">✕</Box> |
|
295 |
+ </Box> |
|
296 |
+ <Box flexBasis="63%" flexShrink={0}> |
|
292 | 297 |
<FieldArray render={() => ( |
293 |
- <SortableList jobs={jobs} onSortStart={this.onSortStart} onSortEnd={this.onSortEnd} useDragHandle={true} existingJobs={existingJobs} prefix={`${prefix}.jobs`} rowIndex={index} /> |
|
298 |
+ <SortableList |
|
299 |
+ helperClass="sorting" |
|
300 |
+ onSortStart={this.onSortStart} |
|
301 |
+ onSortEnd={this.onSortEnd} |
|
302 |
+ jobs={jobs} |
|
303 |
+ useDragHandle={true} |
|
304 |
+ existingJobs={existingJobs} |
|
305 |
+ prefix={`${prefix}.jobs`} |
|
306 |
+ rowIndex={index} |
|
307 |
+ draggingIndex={draggingIndex} |
|
308 |
+ /> |
|
294 | 309 |
)} /> |
295 |
- <Box onClick={this.addJob} style={{ cursor: 'pointer' }}>+ Nová úloha</Box> |
|
310 |
+ {!linkedTo && |
|
311 |
+ <Box onClick={this.addJob} {...theme.buttons.secondary} alignSelf="flex-start"> |
|
312 |
+ + Nová úloha |
|
313 |
+ </Box> |
|
314 |
+ } |
|
296 | 315 |
</Box> |
297 |
- <Box flexBasis="10%" flexShrink={0} alignItems="center"> |
|
298 |
- <Field type="checkbox" name={`${prefix}.preempt`} /> |
|
316 |
+ <Box flexBasis="12%" flexShrink={0}> |
|
317 |
+ <Box as="label" alignItems="center" paddingTop={10}> |
|
318 |
+ <Field type="checkbox" name={`${prefix}.preempt`} disabled={linkedTo} /> |
|
319 |
+ <Box as="em" color="gray" textAlign="center" padding={10} fontSize="0.9em"> |
|
320 |
+ Úlohy pracovníka možno prerušiť |
|
321 |
+ </Box> |
|
322 |
+ </Box> |
|
323 |
+ </Box> |
|
324 |
+ <Box alignItems="flex-end"> |
|
325 |
+ {!linkedTo && |
|
326 |
+ <Box |
|
327 |
+ onClick={this.duplicate} |
|
328 |
+ {...theme.buttons.tertiary} |
|
329 |
+ flexDirection="row" |
|
330 |
+ alignItems="center" |
|
331 |
+ flexWrap="wrap" |
|
332 |
+ justifyContent="center" |
|
333 |
+ paddingVertical={1} |
|
334 |
+ > |
|
335 |
+ <span style={{ fontSize: '1.8em', paddingRight: '0.2em' }}>⩇</span> Duplikovať |
|
336 |
+ </Box> |
|
337 |
+ } |
|
299 | 338 |
</Box> |
300 |
- <Box alignItems="flex-end"><button type="button" onClick={this.duplicate}>Duplikovať a spojiť pracovníka</button></Box> |
|
301 | 339 |
</Box> |
302 | 340 |
) |
303 | 341 |
} |
... | ... |
@@ -61,6 +61,8 @@ class Gannt extends React.PureComponent { |
61 | 61 |
|
62 | 62 |
return ( |
63 | 63 |
<div ref={measureRef}> |
64 |
+ <h1>Ganttov diagram</h1> |
|
65 |
+ |
|
64 | 66 |
<ScatterChart width={width} height={height} data={data[0]} margin={theme.gantt.margin}> |
65 | 67 |
<CartesianGrid |
66 | 68 |
stroke={theme.gantt.grid.stroke} |
... | ... |
@@ -75,7 +77,7 @@ class Gannt extends React.PureComponent { |
75 | 75 |
tickCount={ticksCountX} |
76 | 76 |
allowDecimals={false} |
77 | 77 |
> |
78 |
- <Label offset={-30} position="insideBottom">Time</Label> |
|
78 |
+ <Label offset={-30} position="insideBottom">Čas</Label> |
|
79 | 79 |
</XAxis> |
80 | 80 |
<YAxis |
81 | 81 |
type="number" |
... | ... |
@@ -86,7 +88,7 @@ class Gannt extends React.PureComponent { |
86 | 86 |
domain={[0.5, processors.length + 0.5]} |
87 | 87 |
ticks={processors} |
88 | 88 |
> |
89 |
- <Label position="insideLeft" angle={-90}>Workers</Label> |
|
89 |
+ <Label position="insideLeft" angle={-90}>Pracovníci</Label> |
|
90 | 90 |
</YAxis> |
91 | 91 |
<Brush |
92 | 92 |
dataKey="startTime" |
... | ... |
@@ -8,6 +8,7 @@ export default class Job extends React.PureComponent { |
8 | 8 |
x, |
9 | 9 |
y, |
10 | 10 |
payload: { |
11 |
+ name, |
|
11 | 12 |
formerStartTime, |
12 | 13 |
formerEndTime, |
13 | 14 |
startTime, |
... | ... |
@@ -33,19 +34,31 @@ export default class Job extends React.PureComponent { |
33 | 33 |
const width = (axisWidth / (niceTicks.length - 1)) * duration; |
34 | 34 |
const height = theme.gantt.job.height; |
35 | 35 |
|
36 |
- return <Box x={x + 5} y={y + 5} width={width} height={height} text={formerDuration} /> |
|
36 |
+ return ( |
|
37 |
+ <JobBox |
|
38 |
+ x={x + 5} |
|
39 |
+ y={y + 5} |
|
40 |
+ width={width} |
|
41 |
+ height={height} |
|
42 |
+ duration={formerDuration} |
|
43 |
+ name={name} |
|
44 |
+ /> |
|
45 |
+ ); |
|
37 | 46 |
} |
38 | 47 |
} |
39 | 48 |
|
40 |
-class Box extends React.PureComponent { |
|
49 |
+class JobBox extends React.PureComponent { |
|
41 | 50 |
render() { |
42 |
- const { x, y, width, height, text } = this.props; |
|
51 |
+ const { x, y, width, height } = this.props; |
|
52 |
+ let { duration, name } = this.props; |
|
53 |
+ |
|
43 | 54 |
const { fill, stroke, textColor } = theme.gantt.job; |
44 | 55 |
|
45 | 56 |
return ( |
46 | 57 |
<React.Fragment> |
47 | 58 |
<Rectangle x={x} y={y - (height / 2)} width={width} height={height} fill={fill} stroke={stroke} /> |
48 |
- <text x={x + (width / 2)} y={y} textAnchor="middle" alignmentBaseline="central" fill={textColor}>{text}</text> |
|
59 |
+ <text x={x + 10} y={y - 9} alignmentBaseline="central" fill={textColor}>{duration}</text> |
|
60 |
+ <text x={x + 10} y={y + 9} alignmentBaseline="central" fill={textColor}>{name}</text> |
|
49 | 61 |
</React.Fragment> |
50 | 62 |
); |
51 | 63 |
} |
... | ... |
@@ -1,3 +1,7 @@ |
1 |
+* { |
|
2 |
+ box-sizing: border-box; |
|
3 |
+} |
|
4 |
+ |
|
1 | 5 |
body { |
2 | 6 |
margin: 0; |
3 | 7 |
padding: 0; |
... | ... |
@@ -37,3 +41,22 @@ svg * { |
37 | 37 |
.color5 { |
38 | 38 |
color: #F1D8CB; |
39 | 39 |
} |
40 |
+ |
|
41 |
+.row:hover, |
|
42 |
+.sortable-inactive:hover { |
|
43 |
+ background-color: #f8f9ff; |
|
44 |
+} |
|
45 |
+ |
|
46 |
+.sortable-inactive { |
|
47 |
+ border-bottom: 1px solid #3A4168; |
|
48 |
+} |
|
49 |
+ |
|
50 |
+.sortable-inactive:last-child { |
|
51 |
+ border-bottom: none; |
|
52 |
+} |
|
53 |
+ |
|
54 |
+.sorting { |
|
55 |
+ background-color: white; |
|
56 |
+ border-bottom-color: white !important; |
|
57 |
+ box-shadow: 0 0 10px rgba(0,0,0,0.2) |
|
58 |
+} |
|
40 | 59 |
\ No newline at end of file |
... | ... |
@@ -19,5 +19,24 @@ export default { |
19 | 19 |
color: '#3A4168' |
20 | 20 |
} |
21 | 21 |
}, |
22 |
- |
|
22 |
+ buttons: { |
|
23 |
+ primary: { |
|
24 |
+ backgroundColor: '#1B1B3A', |
|
25 |
+ color: 'white', |
|
26 |
+ cursor: 'pointer', |
|
27 |
+ padding: '10px' |
|
28 |
+ }, |
|
29 |
+ secondary: { |
|
30 |
+ backgroundColor: '#3A4168', |
|
31 |
+ color: 'white', |
|
32 |
+ cursor: 'pointer', |
|
33 |
+ padding: '8px 10px' |
|
34 |
+ }, |
|
35 |
+ tertiary: { |
|
36 |
+ backgroundColor: '#98798F', |
|
37 |
+ color: 'white', |
|
38 |
+ cursor: 'pointer', |
|
39 |
+ padding: '8px 10px' |
|
40 |
+ } |
|
41 |
+ } |
|
23 | 42 |
} |
24 | 43 |
\ No newline at end of file |