This commit is contained in:
Peter Maquiran
2023-02-17 15:23:43 +01:00
parent 7d79128ffd
commit 83be7ac807
23 changed files with 227 additions and 189 deletions
@@ -191,39 +191,41 @@ export class ApproveEventModalPage implements OnInit {
await modal.present();
modal.onDidDismiss().then( async (res) => {
if(res.data.note !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
if(res.data.option == 'save') {
if(res.data.note !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
}
}
}
//
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
//
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
this.router.navigate(['/home/gabinete-digital/event-list']);
}
finally {
loader.remove()
}
this.router.navigate(['/home/gabinete-digital/event-list']);
}
finally {
loader.remove()
}
}
else {
//this.alertService.presentAlert('Operação cancelada!');
}
}
else {
this.toastService._badRequest('É necessário adicionar uma nota');
}
}
});
}
@@ -16,6 +16,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
import config from 'capacitor.config';
@Component({
selector: 'app-approve-event',
@@ -117,10 +118,14 @@ export class ApproveEventPage implements OnInit {
this.loadedEvent = event
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
try {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
} catch(error) {
console.log(this.loadedEvent)
throw(error)
}
this.loadedAttachments = this.loadedEvent.Documents;
})
@@ -178,11 +183,15 @@ export class ApproveEventPage implements OnInit {
this.loadedEvent = task
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
this.loadedAttachments = this.loadedEvent.Documents;
try {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
} catch(error) {
console.log(this.loadedEvent)
throw(error)
}
})
})
@@ -194,12 +203,17 @@ export class ApproveEventPage implements OnInit {
async getTask() {
this.processes.GetTask(this.serialNumber).subscribe(async res => {
this.loadedEvent = await this.processes.GetTask(this.serialNumber).toPromise();
this.loadedEvent = res
this.addProcessToDB(this.loadedEvent)
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
try {
this.today = new Date(this.loadedEvent.workflowInstanceDataFields.StartDate);
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
} catch(error) {
console.log(this.loadedEvent)
throw(error)
}
}, (error) => {
this.getProcessFromDB();
@@ -247,40 +261,42 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss()
.then(async (res) => {
if (res.data !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
if(res.data.option == 'save') {
if (res.data !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
}
}
}
const loader = this.toastService.loading()
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
try {
await this.processes.PostTaskAction(body).toPromise()
.catch(() => {
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Evento enviado para revisão');
this.goBack();
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.offlineManager.storeRequestData('event-listRever', body);
});
this.toastService._successMessage('Evento enviado para revisão');
this.goBack();
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally {
loader.remove()
}
} finally {
loader.remove()
}
}
else {
}
else {
this.toastService._badRequest('É necessário adicionar uma nota');
}
}
});
@@ -362,39 +378,44 @@ export class ApproveEventPage implements OnInit {
modal.onDidDismiss().then(async (res) => {
if (res.data.note !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
if(res.data.option == 'save') {
if (res.data.note !== '') {
let body = {
"serialNumber": serialNumber,
"action": "Emendar",
"dataFields": {
"ReviewUserComment": res.data,
}
}
}
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
const loader = this.toastService.loading()
try {
await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage();
this.goBack();
this.toastService._successMessage('Evento enviado para revisão');
} catch (error) {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally {
loader.remove()
}
} finally {
loader.remove()
}
else {
this.toastService._badRequest('É necessário adicionar uma nota');
}
} else {
}
else {
//this.alertService.presentAlert('Operação cancelada!');
}
});
}
@@ -256,7 +256,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class-no-height width-100">
<ion-textarea [(ngModel)]="postData.Body.Text" placeholder="Detalhes" rows="6" cols="20"></ion-textarea>
<ion-textarea class="heigh-200" autoGrow="true" [(ngModel)]="postData.Body.Text" placeholder="Detalhes" rows="6" cols="20"></ion-textarea>
</div>
</div>
</div>
@@ -32,7 +32,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom || validateField ">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" class="add-border" placeholder="Descrição*" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea>
<ion-textarea autoGrow="true" autocomplete="on" autocorrect="on" spellcheck="true" class="add-border heigh-200" placeholder="Descrição*" [(ngModel)]="postData.DispatchFolder.Message"></ion-textarea>
</div>
</div>
</div>
@@ -31,7 +31,6 @@
.ion-item-class-2{
//width: 360px;
margin: 0px auto;
overflow: auto;
}
.ion-icon-class{
width: 45px;