This commit is contained in:
tiago.kayaya
2021-07-09 14:44:17 +01:00
28 changed files with 234 additions and 77 deletions
+3
View File
@@ -183,7 +183,10 @@ export class AgendaPage implements OnInit {
ngOnInit() {
this.profile = "mdgpr";
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == "/home/agenda") {
if (this.segment == null){
this.segment = "Combinado";
@@ -256,23 +256,24 @@
</ion-label>
</div>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments" >
<ion-list class="width-100 list">
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
<ion-list class="width-100 list" *ngIf="!document.remove">
<ion-item class="width-100 ion-no-border ion-no-padding">
<ion-label class="width-100">
<p class="p-item-title d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="close-button text-black" (click)="deleteAttachment(document.Id)" >
<span class="close-button text-black" (click)="deleteAttachment(document.Id, i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
<p><span class="span-left">{{document.Stakeholders}}</span></p>
<!-- <p *ngIf="document.Stakeholders" ><span class="span-left" >{{document.Stakeholders}}</span></p> -->
<p>
<span class="app-name span-left" *ngIf="document.ApplicationId == 8"> Correspondência </span>
<span class="app-name span-left" *ngIf="document.ApplicationId == 386"> Acções Presidenciais </span>
<span class="app-name span-left" *ngIf="document.ApplicationId == 361 "> Arquivo Despacho Electrónico </span>
<span class="span-right"> {{document.CreateDate | date: 'dd-MM-yy'}} </span></p>
<!-- <span class="span-right" *ngIf="document.CreateDate"> {{document.CreateDate | date: 'dd-MM-yy'}} </span> -->
</p>
</ion-label>
</ion-item>
</ion-list>
@@ -40,7 +40,7 @@ export class EditEventPage implements OnInit {
selectedRecurringType: any;
loadedEventAttachments: Attachment[];
loadedEventAttachments: Attachment[] = [];
taskParticipants: any = [];
taskParticipantsCc: any = [];
adding: "intervenient" | "CC" = "intervenient";
@@ -212,6 +212,40 @@ export class EditEventPage implements OnInit {
this.toastService.badRequest()
}
this.saveDocument()
}
saveDocument() {
this.loadedEventAttachments.forEach((e)=>{
const id: any = e.Id
const remove = e['remove']
if ( id == 'add') {
//data.selected
const DocumentToSave = {
SourceTitle: e.SourceName,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: e.SourceId,
ApplicationId: e.ApplicationId.toString(),
Id: '0',
Link: '',
SerialNumber: '',
};
this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
this.getAttachments(this.postEvent.EventId);
});
} else if(remove) {
this.attachmentsService.deleteEventAttachmentById(e.Id).subscribe( res=> {})
}
})
}
async openAttendees() {
@@ -281,12 +315,17 @@ export class EditEventPage implements OnInit {
});
}
deleteAttachment(attachmentID: string) {
deleteAttachment(attachmentID: string, index) {
this.attachmentsService.deleteEventAttachmentById(attachmentID).subscribe(
res=>{
this.loadedEventAttachments = this.loadedEventAttachments.filter(e=> e.Id.toString() != attachmentID);
})
const id: any = this.loadedEventAttachments[index].Id
if(id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e,i)=> i!=index)
} else {
this.loadedEventAttachments[index]['remove'] = true
}
}
async getDoc() {
@@ -300,27 +339,30 @@ export class EditEventPage implements OnInit {
}
});
await modal.present();
modal.onDidDismiss().then( async (res)=>{
if(res){
modal.onDidDismiss().then( async (res)=> {
if(res) {
const data = res.data;
//data.selected
const DocumentToSave = {
SourceTitle: data.selected.Assunto,
const ApplicationIdDocumentToSave: any = {
SourceName: data.selected.Assunto,
ParentId: this.postEvent.EventId,
Source: '1',
SourceId: data.selected.Id,
Stakeholders: false,
ApplicationId: data.selected.ApplicationType.toString(),
Id: '0',
CreateDate: false,
// needed to attach this document
Id: 'add',
SourceTitle: data.selected.Assunto,
Source: '1',
Link: '',
SerialNumber: '',
};
}
await this.attachmentsService.setEventAttachmentById(DocumentToSave).subscribe(()=>{
this.getAttachments(this.postEvent.EventId);
});
console.log( this.loadedEventAttachments)
this.loadedEventAttachments.push(ApplicationIdDocumentToSave)
}
});
})
}
}
@@ -14,14 +14,13 @@ import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AttachmentsPage } from '../attachments/attachments.page';
@Component({
selector: 'app-edit-event',
templateUrl: './edit-event.page.html',
styleUrls: ['./edit-event.page.scss'],
})
export class EditEventPage implements OnInit {
export class EditEventPage implements OnInit {
loadedEvent: Event;
loadedEventAttachments: Attachment[];
+3 -1
View File
@@ -97,8 +97,10 @@ export class EventsPage implements OnInit {
this.showGreeting();
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.RefreshEvents();
this.LoadList();
}
@@ -64,8 +64,11 @@ export class DespachosPrPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.LoadList();
}
});
@@ -39,8 +39,11 @@ constructor(
}
ngOnInit() {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
}
});
@@ -36,8 +36,10 @@ export class EventListPage implements OnInit {
this.LoadToApproveEvents();
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.LoadToApproveEvents();
}
});
@@ -40,8 +40,11 @@ export class ExpedientePage implements OnInit {
ngOnInit() {
this.LoadList();
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.LoadList();
}
});
@@ -40,8 +40,11 @@ export class ExpedientesPrPage implements OnInit {
}
ngOnInit() {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
}
});
@@ -98,7 +98,6 @@ export class GabineteDigitalPage implements OnInit {
}
};
this.checkRoutes();
this.checkUser();
}
@@ -112,9 +111,15 @@ export class GabineteDigitalPage implements OnInit {
ngOnInit() {
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.checkRoutes();
this.LoadCounts();
console.log('yes', pathname)
} else {
console.log('not')
}
});
@@ -189,7 +194,7 @@ export class GabineteDigitalPage implements OnInit {
this.selectedElement='DiplomasAssinar';
}
else{
this.checkRoutes();
this.checkUser();
}
}
@@ -38,8 +38,10 @@ export class PendentesPage implements OnInit {
ngOnInit() {
//Inicializar segment
this.segment = "despachos";
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.refreshing();
}
});
@@ -67,8 +67,11 @@ export class PublicationsPage implements OnInit {
}
ngOnInit() {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
if(event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
+8 -10
View File
@@ -463,15 +463,15 @@ export class SearchPage implements OnInit {
}
}
clearInputRemetente() {
clearInputRemetente(){
this.searchSender = "";
}
clearInputDocumentDate() {
clearInputDocumentDate(){
this.searchDocumentDate = "";
}
clearInputOrganicEntity() {
clearInputOrganicEntity(){
this.searchOrganicEntiry = "";
}
@@ -531,10 +531,10 @@ export class SearchPage implements OnInit {
}
async filterDocList(categoryName:string) {
async filterDocList(categoryName:string){
// show all category
if(this. showCategory == categoryName ) {
if(this. showCategory == categoryName ){
this.showSearchDocuments = this.searchDocuments;
@@ -562,12 +562,12 @@ export class SearchPage implements OnInit {
const ApplicationType = searchDocument.ApplicationType.toString()
const Id = searchDocument.Id
if(this.select == false) {
if(this.select == false){
if(this.type == "Agenda") {
const modal = await this.modalCtrl.create({
component: ViewEventPage,
componentProps: {
componentProps:{
eventId: Id
},
cssClass: 'modal modal-desktop',
@@ -575,7 +575,7 @@ export class SearchPage implements OnInit {
await modal.present();
modal.onDidDismiss().then((res)=>{});
} else if(this.type == "AccoesPresidenciais") {
} else if(this.type == "AccoesPresidenciais"){
this.viewPublicationDetail(Id);
}
@@ -585,8 +585,6 @@ export class SearchPage implements OnInit {
}
} else {
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.select)
}
}