This commit is contained in:
Peter Maquiran
2021-07-26 15:19:03 +01:00
parent 3f007be25e
commit 85f6df2f0e
16 changed files with 852 additions and 197 deletions
@@ -102,6 +102,6 @@
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Adicionar Nota</button>
<button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
<button hidden class="btn-delete" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Rejeitar</button>
<button class="btn-delete" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Rejeitar</button>
</div>
</ion-footer>
@@ -18,7 +18,7 @@ import { ToastService } from 'src/app/services/toast.service';
export class ApproveEventPage implements OnInit {
event: Event;
loadedEvent:any;
@Input() loadedEvent:any;
loadedAttachments:any;
customDate:any;
today:any;
@@ -28,6 +28,8 @@ export class ApproveEventPage implements OnInit {
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
@Input() serialNumber:string;
@Input() showComponent:string;
@Input() componentTransparent: any
@Input() InstanceId:string;
@Input() showAside:boolean;
@@ -58,7 +60,11 @@ export class ApproveEventPage implements OnInit {
ngOnInit() {
this.getTask();
this.getAttachments();
}
ngOnChanges() {
this.getTask();
this.getAttachments();
}
notImplemented() {
@@ -94,6 +100,7 @@ export class ApproveEventPage implements OnInit {
} catch (error) {
this.toastService.badRequest()
} finally {
this.close()
loader.remove()
}
@@ -121,8 +128,9 @@ export class ApproveEventPage implements OnInit {
this.toastService.successMessage('Evento rejeitado')
} catch (error) {
this.toastService.badRequest('Processo não efectuado')
} finally {
} finally {
loader.remove()
this.close()
}
}
@@ -247,14 +247,14 @@ export class EditEventToApprovePage implements OnInit {
// Validators.required
// ]),
participantes: new FormControl(this.taskParticipants, [
Validators.required
// Validators.required
]),
})
}
save() {
async save() {
this.injectValidation()
this.runValidation()
@@ -263,6 +263,8 @@ export class EditEventToApprovePage implements OnInit {
// set dates to eventProcess object
this.getDatepickerData()
this.taskParticipantsCc.forEach( e => {
e.IsRequired = false
})
@@ -300,24 +302,28 @@ export class EditEventToApprovePage implements OnInit {
console.log(event);
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
try {
await this.eventsService.postEventToApproveEdit(event).toPromise()
this.close()
this.toastService.successMessage('Evento editado');
}, error =>{
this.toastService.badRequest('Evento não editado');
})
} catch(e) {
this.toastService.badRequest('Evento não editado');
}
this.loadedAttachments.forEach((document:any)=>{
if(document['action'] == 'add') {
delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
this.toastService.successMessage();
// this.toastService.successMessage();
}, error =>{
this.toastService.badRequest();
});
} else if(document['action'] == 'delete') {
delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
this.toastService.successMessage()
// this.toastService.successMessage()
}, error =>{
this.toastService.badRequest()
})
@@ -325,8 +331,6 @@ export class EditEventToApprovePage implements OnInit {
})
this.modalController.dismiss();
}
// setIntervenient(data){
@@ -27,6 +27,7 @@ export class EventListPage implements OnInit {
segment:string;
@Input() profile:string;
@Input() showComponent:string;
@Output() cloneAllmobileComponent = new EventEmitter<any>();
@Output() approveEventDismiss = new EventEmitter<any>();
@@ -55,6 +56,10 @@ export class EventListPage implements OnInit {
});
}
ngOnChanges() {
this.LoadToApproveEvents();
}
segmentChanged(ev: any) {
this.LoadToApproveEvents();
}
@@ -140,7 +140,7 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [
Validators.required,
// Validators.required,
// Validators.minLength(4)
]),
Message: new FormControl(this.pub.Message, [
@@ -158,11 +158,10 @@ export class NewPublicationPage implements OnInit {
if(this.Form.invalid) return false
if(this.publicationType == '3') {
alert('3')
if(this.capturedImage != '') {
alert('2')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -180,7 +179,6 @@ export class NewPublicationPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
@@ -193,7 +191,7 @@ export class NewPublicationPage implements OnInit {
}
else if (!this.publication.OriginalFileName) {
alert('1')
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -219,15 +217,42 @@ export class NewPublicationPage implements OnInit {
loader.remove()
}
} else {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
ProcessId:this.publication.ProcessId,
Title: this.pub.Title,
Message: this.pub.Message,
DatePublication: this.publication.DatePublication,
OriginalFileName: this.capturedImageTitle,
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
console.log('Edit change image');
console.log(this.publication);
const loader = this.toastService.loading()
try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
this.goBack();
} catch (error) {
this.toastService.badRequest("Publicação não criado")
} finally {
loader.remove()
}
}
}
else {
let time = new Date()
this.publication = {
DateIndex: time,
DocumentId:null,
DocumentId: null,
ProcessId:this.folderId,
Title: this.pub.Title,
Message: this.pub.Message,