teste mobile done!

This commit is contained in:
Eudes Inácio
2024-06-04 09:38:11 +01:00
parent 9265622e65
commit 9fcf116102
19 changed files with 468 additions and 281 deletions
@@ -95,7 +95,7 @@
*ngFor="let attachment of loadedAttachments"
(click)="viewDocument(attachment.DocId, attachment)">
<ion-label>
<p class="attach-title-item d-block">{{attachment.Description || 'Sem título'}}</p>
<p class="attach-title-item d-block">{{attachment.sourceName || attachment.Description || 'Sem título'}}</p>
<p><span class="span-left">{{attachment.Stakeholders}}</span><span class="span-right">{{ attachment.CreateDate | date: 'dd-MM-yyyy HH:mm' }}</span></p>
</ion-label>
</ion-item>
@@ -95,15 +95,16 @@ export class ApproveEventPage implements OnInit {
}
async getTask () {
async getTask() {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
if(res.isOk()) {
console.log(res)
if (res.isOk()) {
this.loadedEvent = res.value;
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
//
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
this.loadedAttachments = res.value.Attachments
} else {
console.log(res.error.status)
this.httpErrorHandle.httpStatusHandle(res.error)
@@ -117,10 +118,18 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.TaskService.loadEventosParaAprovacao();
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Approved').subscribe(async (value) => {
await this.processes.PostTaskAction(body).toPromise()
this.goBack();
this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.TaskService.loadEventosParaAprovacao();
}, ((error) => {
console.log('aprove event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
@@ -147,7 +156,7 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss()
.then(async (res) => {
if(res.data.option == 'save') {
if (res.data.option == 'save') {
let body = {
"serialNumber": serialNumber,
@@ -161,14 +170,17 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Revision').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.goBack();
}, ((error) => {
console.log('send event to revision error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
this.offlineManager.storeRequestData('event-listRever', body);
});
this.httpErrorHandle.httpsSucessMessagge('Rever')
this.TaskService.loadEventosParaAprovacao();
this.goBack();
}));
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
} finally {
@@ -181,7 +193,7 @@ export class ApproveEventPage implements OnInit {
console.log(error)
});
await modal.present();
await modal.present();
}
@@ -190,10 +202,15 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.TaskService.loadEventosParaAprovacao();
this.goBack();
/* await this.processes.PostTaskAction(body).toPromise(); */
this.AgendaDataRepositoryService.eventToaprovalStatus(serialNumber, 'Declined').subscribe((value) => {
this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.TaskService.loadEventosParaAprovacao();
this.goBack();
}, ((error) => {
console.log('reject event error: ', error)
this.httpErrorHandle.httpStatusHandle(error)
}))
} catch (error) {
this.httpErrorHandle.httpStatusHandle(error)
}
@@ -262,7 +279,7 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss().then(async (res) => {
if(res.data.option == 'save') {
if (res.data.option == 'save') {
let body = {
"serialNumber": serialNumber,
@@ -337,7 +354,7 @@ export class ApproveEventPage implements OnInit {
this.loadedAttachments = await this.attachmentsService.getAttachmentsById(this.loadedEvent.workflowInstanceDataFields.InstanceId).toPromise();
console.log(this.loadedAttachments)
} catch (error) {
console.error('getAttchaments',error)
console.error('getAttchaments', error)
}
@@ -173,6 +173,7 @@ export class EventListPage implements OnInit {
}
async LoadToApproveEvents() {
console.log('aprove event')
this.showLoader = true;
this.skeletonLoader = true