fix actions and draft data object

This commit is contained in:
Peter Maquiran
2024-01-17 10:25:16 +01:00
parent 69ee75b039
commit 4314ae1bff
35 changed files with 556 additions and 305 deletions
+37
View File
@@ -12,6 +12,26 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service'
import { z } from "zod";
const Bodyschema = z.object({
SerialNumber: z.string(),
DispatchDocId: z.number(),
FolderID: z.any(),
Subject: z.string(),
Comment: z.string().optional(),
DelegatedUserEmail: z.string().email(),
UserId: z.any(),
DraftIds: z.string(),
})
const ProsSchema = z.object({
DraftIds: z.string(),
})
@Component({
selector: 'app-delegar',
@@ -64,6 +84,19 @@ export class DelegarPage implements OnInit {
/* this.postData.EndDate = new Date(selectedEndDate.setMinutes(new Date().getMinutes() + 30)); */
this.hideThisFeature = this.navParams.get('showAttachmentBtn');
const result = ProsSchema.safeParse(this.task);
if(!result.success) {
console.log(result)
console.log("result")
console.log(result["error"])
} else {
console.log(result.data)
}
}
ngOnInit() {
@@ -86,6 +119,7 @@ export class DelegarPage implements OnInit {
else if(this.taskParticipants.length > 1){
this.toastService._badRequest("Selecione apenas um destinatário");
}
else {
let body = {
"SerialNumber": this.task.SerialNumber,
@@ -94,8 +128,11 @@ export class DelegarPage implements OnInit {
"Subject": this.task.Folio,
"Comment": this.note,
"DelegatedUserEmail": this.taskParticipants[0].EmailAddress,
"DraftIds": this.task.DraftIds,
"UserId": this.taskParticipants[0].Id
}
const loader = this.toastService.loading()
this.processes.DelegateTask(body).subscribe(res=>{