@@ -17,18 +17,12 @@ import {
1717import CheckIcon from '@mui/icons-material/Check'
1818import ArrowBackIcon from '@mui/icons-material/ArrowBack'
1919import { Controller } from 'react-hook-form'
20- import { departments , type StaffSchema } from '@/features/staff/validation'
20+ import { departments } from '@/features/staff/validation'
2121import { useStaffForm } from '@/features/staff/use-staff-form'
2222import { FlugoTextField } from './form/flugo-text-field'
2323import { FlugoSelect } from './form/flugo-select'
2424
25- type StaffFormProps = {
26- staffId ?: string
27- initialValues ?: Partial < StaffSchema >
28- isEdit ?: boolean
29- }
30-
31- export function StaffForm ( { staffId, initialValues, isEdit = false } : StaffFormProps ) {
25+ export function StaffForm ( ) {
3226 const theme = useTheme ( )
3327 const isMobile = useMediaQuery ( theme . breakpoints . down ( 'sm' ) )
3428
@@ -42,7 +36,7 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
4236 handleNext : handleNextHook ,
4337 handleBack,
4438 currentProgress,
45- } = useStaffForm ( staffId , initialValues , isEdit )
39+ } = useStaffForm ( )
4640
4741 const handleNext = async ( e ?: React . FormEvent ) => {
4842 if ( e ) e . preventDefault ( )
@@ -55,25 +49,52 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
5549 const isLastStep = activeStep === steps . length - 1
5650
5751 return (
58- < Box minHeight = "50vh" display = "flex" flexDirection = "column" gap = { isMobile ? 2 : 3 } >
52+ < Box
53+ sx = { {
54+ minHeight : '60vh' ,
55+ display : 'flex' ,
56+ flexDirection : 'column' ,
57+ gap : isMobile ? 3 : 4 ,
58+ p : isMobile ? 1 : 2
59+ } }
60+ >
61+ { /* Barra de Progresso Superior */ }
5962 < Box >
60- < Stack direction = "row" alignItems = "center" gap = { 2 } mb = { 0.5 } >
63+ < Stack direction = "row" alignItems = "center" gap = { 2 } mb = { 1 } >
6164 < LinearProgress
6265 variant = "determinate"
63- value = { currentProgress }
64- sx = { { flex : 1 , height : 6 , borderRadius : 3 } }
66+ value = { currentProgress || ( activeStep === 1 ? 50 : 0 ) }
67+ sx = { {
68+ flex : 1 ,
69+ height : 8 ,
70+ borderRadius : 4 ,
71+ bgcolor : 'grey.100' ,
72+ '& .MuiLinearProgress-bar' : { borderRadius : 4 }
73+ } }
6574 />
66- < Typography variant = "body2" color = "text.secondary" minWidth = { 36 } >
67- { currentProgress } %
75+ < Typography variant = "caption" fontWeight = { 700 } color = "primary" sx = { { minWidth : 40 } } >
76+ { activeStep === 0 ? '0%' : activeStep === 1 ? '50%' : '100%' }
6877 </ Typography >
6978 </ Stack >
79+ < Typography variant = "caption" color = "text.secondary" >
80+ Passo { activeStep + 1 } de { steps . length } : { steps [ activeStep ] }
81+ </ Typography >
7082 </ Box >
7183
72- < Box display = "flex" flexDirection = { isMobile ? 'column' : 'row' } gap = { isMobile ? 3 : 5 } >
84+ < Box
85+ display = "flex"
86+ flexDirection = { isMobile ? 'column' : 'row' }
87+ gap = { isMobile ? 4 : 6 }
88+ sx = { { flex : 1 } }
89+ >
90+ { /* Stepper Lateral/Superior */ }
7391 < Stepper
7492 activeStep = { activeStep }
7593 orientation = { isMobile ? 'horizontal' : 'vertical' }
76- sx = { { minWidth : isMobile ? '100%' : 180 } }
94+ sx = { {
95+ minWidth : isMobile ? '100%' : 200 ,
96+ '& .MuiStepLabel-label' : { fontSize : 13 , fontWeight : 500 }
97+ } }
7798 >
7899 { steps . map ( ( label , index ) => (
79100 < Step key = { label } completed = { activeStep > index } >
@@ -86,7 +107,7 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
86107 width : 24 ,
87108 height : 24 ,
88109 borderRadius : '50%' ,
89- bgcolor : 'primary .main' ,
110+ bgcolor : 'success .main' ,
90111 display : 'flex' ,
91112 alignItems : 'center' ,
92113 justifyContent : 'center' ,
@@ -104,23 +125,29 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
104125 ) ) }
105126 </ Stepper >
106127
107- < Box flex = { 1 } >
108- < Typography variant = "h6" fontWeight = { 600 } color = "text.secondary" mb = { 3 } >
128+ { /* Conteúdo do Formulário */ }
129+ < Box flex = { 1 } sx = { { maxWidth : 600 } } >
130+ < Typography variant = "h6" fontWeight = { 700 } color = "text.primary" mb = { 4 } >
109131 { activeStep === 0 ? 'Informações Básicas' : 'Informações Profissionais' }
110132 </ Typography >
111133
112134 < form onSubmit = { handleNext } >
113- < Box sx = { { display : activeStep === 0 ? 'flex' : 'none' , flexDirection : 'column' , gap : 2 } } >
135+ < Stack
136+ spacing = { 3 }
137+ sx = { { display : activeStep === 0 ? 'flex' : 'none' } }
138+ >
114139 < Controller
115140 name = "name"
116141 control = { form . control }
117142 render = { ( { field, fieldState } ) => (
118143 < FlugoTextField
119144 { ...field }
120- label = "Título"
145+ label = "Nome Completo"
146+ placeholder = "ex: João da Silva"
121147 autoFocus = { activeStep === 0 }
122148 error = { ! ! fieldState . error }
123149 helperText = { fieldState . error ?. message }
150+ fullWidth
124151 />
125152 ) }
126153 />
@@ -130,12 +157,12 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
130157 render = { ( { field, fieldState } ) => (
131158 < FlugoTextField
132159 { ...field }
133- label = "E-mail"
160+ label = "E-mail Corporativo "
134161 type = "email"
135162 placeholder = "ex: joao@empresa.com"
136- disabled = { isEdit }
137163 error = { ! ! fieldState . error }
138164 helperText = { fieldState . error ?. message }
165+ fullWidth
139166 />
140167 ) }
141168 />
@@ -144,7 +171,8 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
144171 control = { form . control }
145172 render = { ( { field } ) => (
146173 < FormControlLabel
147- label = { isEdit ? 'Ativo' : 'Ativar ao criar' }
174+ label = "Ativar colaborador imediatamente"
175+ sx = { { ml : 0 , '& .MuiFormControlLabel-label' : { fontSize : 14 , color : 'text.secondary' } } }
148176 control = {
149177 < Switch
150178 { ...field }
@@ -155,7 +183,7 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
155183 />
156184 ) }
157185 />
158- </ Box >
186+ </ Stack >
159187
160188 < Box sx = { { display : activeStep === 1 ? 'block' : 'none' } } >
161189 < Controller
@@ -164,48 +192,66 @@ export function StaffForm({ staffId, initialValues, isEdit = false }: StaffFormP
164192 render = { ( { field, fieldState } ) => (
165193 < FlugoSelect
166194 { ...field }
167- label = "Departamento"
195+ label = "Selecione o Departamento"
168196 options = { departments }
169197 autoFocus = { activeStep === 1 }
170198 error = { ! ! fieldState . error }
171199 helperText = { fieldState . error ?. message }
200+ fullWidth
172201 />
173202 ) }
174203 />
175204 </ Box >
176205
177- { /* Hidden submit button to enable Enter key across all steps */ }
178206 < button type = "submit" style = { { display : 'none' } } aria-hidden = "true" />
179207 </ form >
180208 </ Box >
181209 </ Box >
182210
183- < Stack direction = "row" justifyContent = "space-between" mt = "auto" pt = { 2 } >
211+ { /* Ações de Navegação */ }
212+ < Stack
213+ direction = "row"
214+ justifyContent = "space-between"
215+ mt = "auto"
216+ pt = { 4 }
217+ sx = { { borderTop : '1px solid' , borderColor : 'divider' } }
218+ >
184219 < Button
185220 variant = "outlined"
186221 onClick = { handleBack }
187222 startIcon = { < ArrowBackIcon /> }
188223 disabled = { isPending }
189- sx = { { borderColor : 'divider' , color : 'text.secondary' } }
224+ sx = { {
225+ borderColor : 'grey.300' ,
226+ color : 'text.secondary' ,
227+ px : 3 ,
228+ '&:hover' : { borderColor : 'grey.400' , bgcolor : 'grey.50' }
229+ } }
190230 >
191- Voltar
231+ { activeStep === 0 ? 'Cancelar' : ' Voltar' }
192232 </ Button >
193233 < Button
194234 variant = "contained"
195235 onClick = { handleNext }
196236 disabled = { isPending }
237+ sx = { { px : 4 , fontWeight : 600 , boxShadow : 0 } }
197238 >
198- { isLastStep ? ( isPending ? 'Salvando...' : isEdit ? 'Salvar' : 'Concluir' ) : 'Próximo' }
239+ { isLastStep ? ( isPending ? 'Salvando...' : 'Finalizar Cadastro' ) : 'Próximo Passo ' }
199240 </ Button >
200241 </ Stack >
201242
202243 < Snackbar
203244 open = { ! ! toast }
204- autoHideDuration = { 3000 }
245+ autoHideDuration = { 4000 }
205246 onClose = { ( ) => setToast ( null ) }
206247 anchorOrigin = { { vertical : 'bottom' , horizontal : 'center' } }
207248 >
208- < Alert severity = { toast ?. severity } onClose = { ( ) => setToast ( null ) } sx = { { width : '100%' } } >
249+ < Alert
250+ severity = { toast ?. severity }
251+ onClose = { ( ) => setToast ( null ) }
252+ variant = "filled"
253+ sx = { { width : '100%' , boxShadow : theme . shadows [ 3 ] } }
254+ >
209255 { toast ?. message }
210256 </ Alert >
211257 </ Snackbar >
0 commit comments