2021-05-03 20:02:07 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2021-08-06 09:02:51 +01:00
|
|
|
import { AnimationController, ModalController, NavParams } from '@ionic/angular';
|
2021-05-19 12:03:00 +01:00
|
|
|
import { SearchDocument } from 'src/app/models/search-document';
|
|
|
|
|
import { SearchPage } from 'src/app/pages/search/search.page';
|
2021-05-03 20:02:07 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-add-note',
|
|
|
|
|
templateUrl: './add-note.page.html',
|
|
|
|
|
styleUrls: ['./add-note.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class AddNotePage implements OnInit {
|
2021-05-19 12:03:00 +01:00
|
|
|
note: string = '';
|
|
|
|
|
documents:SearchDocument[] = [];
|
|
|
|
|
loadedAttachments:any;
|
2021-08-05 15:37:00 +01:00
|
|
|
hideThisFeature: boolean = true;
|
2021-05-03 20:02:07 +01:00
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
|
private modalController: ModalController,
|
2021-06-08 15:59:06 +01:00
|
|
|
private animationController: AnimationController,
|
2021-08-06 09:02:51 +01:00
|
|
|
private navParams: NavParams,
|
2021-05-03 20:02:07 +01:00
|
|
|
) {
|
2021-05-19 12:03:00 +01:00
|
|
|
this.note = '';
|
2021-08-06 09:02:51 +01:00
|
|
|
this.hideThisFeature = this.navParams.get('showAttachmentBtn');
|
2021-05-03 20:02:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
2021-08-06 09:02:51 +01:00
|
|
|
console.log( this.navParams);
|
|
|
|
|
|
|
|
|
|
console.log(this.hideThisFeature);
|
|
|
|
|
|
2021-05-03 20:02:07 +01:00
|
|
|
}
|
2021-08-06 09:02:51 +01:00
|
|
|
|
2021-08-19 16:19:29 +01:00
|
|
|
close() {
|
2021-05-03 20:02:07 +01:00
|
|
|
this.modalController.dismiss('');
|
|
|
|
|
}
|
2021-08-06 09:02:51 +01:00
|
|
|
|
2021-08-19 16:19:29 +01:00
|
|
|
save() {
|
2021-05-19 12:03:00 +01:00
|
|
|
let body = {
|
|
|
|
|
"note":this.note,
|
|
|
|
|
"documents":this.documents,
|
|
|
|
|
}
|
|
|
|
|
this.modalController.dismiss(body);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-25 13:38:46 +01:00
|
|
|
async getDoc() {
|
|
|
|
|
|
2021-05-19 12:03:00 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: SearchPage,
|
|
|
|
|
cssClass: 'modal-width-100-width-background modal',
|
|
|
|
|
componentProps: {
|
|
|
|
|
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
|
|
|
|
showSearchInput: true,
|
|
|
|
|
select: true
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss().then((res)=>{
|
|
|
|
|
if(res){
|
|
|
|
|
const data = res.data;
|
|
|
|
|
this.documents.push(data.selected);
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-05-25 13:38:46 +01:00
|
|
|
|
2021-05-19 12:03:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeAttachment(index: number){
|
|
|
|
|
|
|
|
|
|
this.documents = this.documents.filter( (e, i) => index != i);
|
2021-05-25 13:38:46 +01:00
|
|
|
}
|
|
|
|
|
|
2021-05-03 20:02:07 +01:00
|
|
|
|
2021-08-05 15:37:00 +01:00
|
|
|
}
|