fix actions bug

This commit is contained in:
tiago.kayaya
2021-07-22 14:36:29 +01:00
parent 405e7e12e6
commit f0a928ef95
5 changed files with 62 additions and 57 deletions
+25 -21
View File
@@ -25,6 +25,7 @@ export class PublicationsPage implements OnInit {
publication: Publication;
publicationsEventFolderList: PublicationFolder[];
actionsListStorage: PublicationFolder[] = new Array();
publicationsTravelFolderList: PublicationFolder[];
theDate:any;
@@ -35,7 +36,7 @@ export class PublicationsPage implements OnInit {
publicationEventFolderStorage = PublicationEventFolderStorage
publicationTravelFolderService = PublicationTravelFolderStore
desktopComponent: any = {
showViewPublication: false,
showAddNewPublication: false,
@@ -55,7 +56,7 @@ export class PublicationsPage implements OnInit {
showSlidingOptions = true;
constructor(
private router: Router,
private router: Router,
private modalController: ModalController,
private animationController: AnimationController,
private publications: PublicationsService,
@@ -68,14 +69,14 @@ export class PublicationsPage implements OnInit {
ngOnInit() {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == pathname) {
this.getActions();
}
});
this.hideRefreshButton();
this.hideRefreshButton();
}
hideRefreshButton(){
@@ -104,7 +105,7 @@ export class PublicationsPage implements OnInit {
this.getActions();
}, 1500);
}
doRefresh(event) {
this.getActions();
@@ -117,6 +118,11 @@ export class PublicationsPage implements OnInit {
return window.innerWidth
}
getDate(date) {
this.theDate = new Date(date);
return this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear()
}
getActions() {
this.showLoader = true;
this.publications.GetPublicationFolderList().subscribe(res=>{
@@ -125,14 +131,12 @@ export class PublicationsPage implements OnInit {
this.publicationsTravelFolderList = new Array();
res.forEach(data => {
this.theDate = new Date(data.DateBegin);
this.theEndDate = new Date(data.DateEnd);
let folder: PublicationFolder = {
ProcessId: data.ProcessId,
Description: data.Description,
Detail: data.Detail,
DateBegin: this.theDate.getDate() +" de " + ( this.months[this.theDate.getMonth()])+" de " +this.theDate.getFullYear(),
DateEnd: this.theEndDate.getDate() +" de " + ( this.months[this.theEndDate.getMonth()])+" de " +this.theEndDate.getFullYear(),
DateBegin: data.DateBegin,
DateEnd: data.DateEnd,
ActionType: data.ActionType,
}
@@ -145,7 +149,7 @@ export class PublicationsPage implements OnInit {
this.showLoader = false;
this.publicationEventFolderStorage.reset(this.publicationsEventFolderList)
this.publicationTravelFolderService.reset(this.publicationsTravelFolderList)
this.publicationTravelFolderService.reset(this.publicationsEventFolderList)
});
@@ -186,7 +190,7 @@ export class PublicationsPage implements OnInit {
}
async AddPublicationFolder(item?:any) {
this.closeDesktopComponent();
if(window.innerWidth <= 1024) {
@@ -216,7 +220,7 @@ export class PublicationsPage implements OnInit {
} else {
this.closeDesktopComponent();
this.folderId = folderId
this.desktopComponent.showViewPublication = true;
this.desktopComponent.showViewPublication = true;
}
}
@@ -246,7 +250,7 @@ export class PublicationsPage implements OnInit {
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
this.closeDesktopComponent();
@@ -269,12 +273,12 @@ export class PublicationsPage implements OnInit {
} else {
// open angular component
this.folderId = folderId
this.desktopComponent.showViewPublication = true;
this.desktopComponent.showViewPublication = true;
}
}
// called from publications details
// called from publications details
// Emittter
goBackToViewPublications(){
@@ -308,16 +312,16 @@ export class PublicationsPage implements OnInit {
if (folderId != undefined) {
this.folderId = folderId;
}
this.publication = publication;
this.desktopComponent.showAddNewPublication = true;
}
async openPublicationDetails(publicationId: string){
this.publicationId = publicationId;
this.closeDesktopComponent();
this.desktopComponent.showPublicationDetail = true;
@@ -326,7 +330,7 @@ export class PublicationsPage implements OnInit {
async updateDesktopComponent(e?:any){
this.getActions();
}
async closeDesktopComponent (xx?: any){
this.desktopComponent = {
@@ -387,4 +391,4 @@ export class PublicationsPage implements OnInit {
});
}
}
}