This commit is contained in:
Peter Maquiran
2021-08-09 16:48:25 +01:00
parent 1393b4f595
commit ca32bc3808
2 changed files with 20 additions and 34 deletions
@@ -3,30 +3,21 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { DailyWorkTask } from '../../../../models/dailyworktask.model';
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { formatDate } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { Event } from '../../../../models/event.model';
import { AnimationController, MenuController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AnimationController, MenuController, ModalController, PopoverController } from '@ionic/angular';
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
import { momentG } from 'src/plugin/momentG'
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
import { ExpedientTaskModalPage } from '../../expediente/expedient-task-modal/expedient-task-modal.page';
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
import { OptsExpedientePrPage } from 'src/app/shared/popover/opts-expediente-pr/opts-expediente-pr.page';
import { ToastService } from 'src/app/services/toast.service';
import { SearchPage } from 'src/app/pages/search/search.page';
import { Attachment } from 'src/app/models/attachment.model';
import { SearchDocument } from 'src/app/models/search-document';
import { Location } from '@angular/common';
import { PedidoService } from 'src/app/Rules/pedido.service';
@Component({
selector: 'app-expediente-pr',
@@ -87,15 +78,10 @@ export class ExpedientePrPage implements OnInit {
if (!paramMap.has('SerialNumber')) {
return;
}
/* this.serialnumber = paramMap.get('SerialNumber'); */
this.LoadTaskDetail(this.serialnumber);
//this.LoadRelatedEvents(this.serialnumber);
//this.getAttachments(this.serialnumber);
});
this.LoadTaskDetail(this.serialnumber);
this.getAttachments(this.serialnumber);
//this.LoadRelatedEvents(this.serialnumber);
}
@@ -239,7 +225,7 @@ export class ExpedientePrPage implements OnInit {
}
}
viewDocument(){
viewDocument() {
this.processes.GetDocumentUrl(this.task.DocId, this.task.FsId).subscribe(res=>{
console.log(res);
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
@@ -249,7 +235,7 @@ export class ExpedientePrPage implements OnInit {
});
}
attachDocument(){
attachDocument() {
console.log('HERE');
this.getDoc();
@@ -435,10 +421,10 @@ export class ExpedientePrPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado');
// this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
// this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
}
@@ -462,7 +448,7 @@ export class ExpedientePrPage implements OnInit {
modal.onDidDismiss().then( async (res)=>{
console.log(res['data']);
if(body == 'descartar'){
if(body == 'descartar') {
if(res['data']== 'Yes'){
let otherbody = {
"serialNumber": this.task.SerialNumber,
@@ -490,24 +476,24 @@ export class ExpedientePrPage implements OnInit {
//Do nothing
}
}
else{
if(res['data']== 'Yes'){
else {
if(res['data']== 'Yes') {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise();
this.toastService.successMessage('Processo descartado');
// this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
this.toastService.badRequest('Processo não descartado')
// this.toastService.badRequest('Processo não descartado')
} finally {
loader.remove()
}
this.goBack();
}
else if(res['data'] == 'No'){
else if(res['data'] == 'No') {
console.log('Update');
const loader = this.toastService.loading()
@@ -180,11 +180,11 @@ export class NewPublicationPage implements OnInit {
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.toastService.successMessage()
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
this.toastService.badRequest()
} finally {
loader.remove()
}
@@ -207,11 +207,11 @@ export class NewPublicationPage implements OnInit {
try {
console.log(this.publication);
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.toastService.successMessage()
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
this.toastService.badRequest()
} finally {
loader.remove()
}
@@ -235,11 +235,11 @@ export class NewPublicationPage implements OnInit {
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.toastService.successMessage()
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
this.toastService.badRequest()
} finally {
loader.remove()
}
@@ -266,11 +266,11 @@ export class NewPublicationPage implements OnInit {
try {
console.log(this.publication);
await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.toastService.successMessage()
this.goBackToViewPublications.emit();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
this.toastService.badRequest()
} finally {
loader.remove()
}