Commit 1f207f9b authored by RenanMontenegro3's avatar RenanMontenegro3

fix: correção no erro relacionado ao envio de comentário no status "em...

fix: correção no erro relacionado ao envio de comentário no status "em processamento " em aceite-edit
parent 22b7ffcc
......@@ -573,10 +573,14 @@ selectedCategoriaNome: string = '';
this.empForm.get('status')?.setValue(value);
// Lógica adicional (opcional)
if (value === 'aceito') {
this.empForm.get('motivoNegacao')?.reset(); // Limpa o campo de motivo
} else if (value === 'negado') {
this.empForm.get('bercos')?.reset(); // Limpa o campo de berços
// Se for 'N' (Em Processamento), limpar observações/comentários
if (value === 'N') {
this.empForm.get('obs')?.setValue('');
this.empForm.get('restricoes')?.setValue('');
} else if (value === 'Y') {
// exemplo: quando aceito, não mexer
} else if (value === 'NE') {
// exemplo: quando negado, não mexer
}
}
......@@ -607,9 +611,14 @@ selectedCategoriaNome: string = '';
onFormSubmit() {
console.log(JSON.stringify(this.empForm.value));
if (this.empForm.valid) {
const payload: any = { ...this.empForm.value };
if (payload.status === 'N') {
payload.obs = '';
payload.restricoes = '';
}
if (this.selectedFile) {
this._empService.updateAceite(this.data.id, this.empForm.value, this.selectedFile).subscribe({
this._empService.updateAceite(this.data.id, payload, this.selectedFile).subscribe({
next: () => {
this._dialogRef.close(true);
this.toastService.success('Aceite editado com sucesso');
......@@ -619,7 +628,7 @@ selectedCategoriaNome: string = '';
},
});
} else {
this._empService.updateAceite(this.data.id, this.empForm.value, null).subscribe({
this._empService.updateAceite(this.data.id, payload, null).subscribe({
next: () => {
this._dialogRef.close(true);
this.toastService.success('Aceite editado com sucesso');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment