@@ -33,17 +33,15 @@ const Etapes = ({initialValue, etapes, handleEtapes, canBeDisponible}) => {
33
33
}
34
34
35
35
const addStep = ( ) => {
36
- if ( startDate ) {
37
- const currentStepIndex = statusKeys . indexOf ( statutInput )
38
- const nextStepIndex = statusKeys . indexOf ( statutInput ) + 1
36
+ const currentStepIndex = statusKeys . indexOf ( statutInput )
37
+ const nextStepIndex = statusKeys . indexOf ( statutInput ) + 1
39
38
40
- etapes [ currentStepIndex ] . date_debut = startDate
39
+ etapes [ currentStepIndex ] . date_debut = startDate
41
40
42
- handleEtapes ( [ ...etapes , { statut : statusKeys [ nextStepIndex ] , date_debut : '' } ] )
41
+ handleEtapes ( [ ...etapes , { statut : statusKeys [ nextStepIndex ] , date_debut : '' } ] )
43
42
44
- setStatutInput ( statusKeys [ nextStepIndex ] )
45
- setStartDate ( '' )
46
- }
43
+ setStatutInput ( statusKeys [ nextStepIndex ] )
44
+ setStartDate ( '' )
47
45
}
48
46
49
47
const onDelete = ( etape , index ) => {
@@ -99,17 +97,18 @@ const Etapes = ({initialValue, etapes, handleEtapes, canBeDisponible}) => {
99
97
)
100
98
) }
101
99
102
- { ( startDate && etapes . length < statusKeys . length ) && (
103
- < Button
104
- label = 'Ajouter une étape'
105
- icon = 'add-circle-fill'
106
- iconSide = 'left'
107
- disabled = { ! canBeDisponible && etapes . at ( - 1 ) . statut === 'realise' }
108
- onClick = { addStep }
109
- >
110
- Ajouter l’étape suivante
111
- </ Button >
112
- ) }
100
+ < Button
101
+ label = 'Ajouter une étape'
102
+ icon = 'add-circle-fill'
103
+ iconSide = 'left'
104
+ disabled = {
105
+ ( ! canBeDisponible && etapes . at ( - 1 ) . statut === 'realise' )
106
+ || etapes . at ( - 1 ) . statut === 'obsolete'
107
+ }
108
+ onClick = { addStep }
109
+ >
110
+ Ajouter l’étape suivante
111
+ </ Button >
113
112
114
113
< style jsx > { `
115
114
.delete-button {
0 commit comments