diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 8241a1edf..2a662166c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -284,6 +284,10 @@ const routes = [ { path: 'task-detail-header', loadChildren: () => import('./shared/gabinete-digital/generic/task-detail-header/task-detail-header.module').then( m => m.TaskDetailHeaderPageModule) + }, + { + path: 'ask-modal', + loadChildren: () => import('./modals/ask-modal/ask-modal.module').then( m => m.AskModalPageModule) } diff --git a/src/app/modals/ask-modal/ask-modal-routing.module.ts b/src/app/modals/ask-modal/ask-modal-routing.module.ts new file mode 100644 index 000000000..b4ba392ed --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import { AskModalPage } from './ask-modal.page'; + +const routes: Routes = [ + { + path: '', + component: AskModalPage + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class AskModalPageRoutingModule {} diff --git a/src/app/modals/ask-modal/ask-modal.module.ts b/src/app/modals/ask-modal/ask-modal.module.ts new file mode 100644 index 000000000..d9366c587 --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; + +import { IonicModule } from '@ionic/angular'; + +import { AskModalPageRoutingModule } from './ask-modal-routing.module'; + +import { AskModalPage } from './ask-modal.page'; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + AskModalPageRoutingModule + ], + declarations: [AskModalPage] +}) +export class AskModalPageModule {} diff --git a/src/app/modals/ask-modal/ask-modal.page.html b/src/app/modals/ask-modal/ask-modal.page.html new file mode 100644 index 000000000..ce4601c08 --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal.page.html @@ -0,0 +1,20 @@ + + + + +
+
+

{{ title }}

+ +
+
+
+

{{ description }}

+
+
+ +
+ + +
+
diff --git a/src/app/modals/ask-modal/ask-modal.page.scss b/src/app/modals/ask-modal/ask-modal.page.scss new file mode 100644 index 000000000..65c741602 --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal.page.scss @@ -0,0 +1,29 @@ +@import '~src/function.scss'; + +ion-content{ + --padding-top:15px; + --padding-start: 15px; + --padding-end: 15px; + } +.header-content{ + overflow: hidden; + margin: 0 auto; + align-items: center; + justify-content: center; +} +.header-title{ + font-family: Roboto; + font-size: rem(20); + color:#000; + margin: 0 5px 0 5px; +} +.header-body{ + margin: 0 5px 0 5px; +} + +.buttons{ + display: flex; + justify-content: space-between; + padding: 15px 0 15px 0; +} + \ No newline at end of file diff --git a/src/app/modals/ask-modal/ask-modal.page.spec.ts b/src/app/modals/ask-modal/ask-modal.page.spec.ts new file mode 100644 index 000000000..f8c6916b3 --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal.page.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { AskModalPage } from './ask-modal.page'; + +describe('AskModalPage', () => { + let component: AskModalPage; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ AskModalPage ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(AskModalPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modals/ask-modal/ask-modal.page.ts b/src/app/modals/ask-modal/ask-modal.page.ts new file mode 100644 index 000000000..71cafaab1 --- /dev/null +++ b/src/app/modals/ask-modal/ask-modal.page.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController, NavParams } from '@ionic/angular'; + +@Component({ + selector: 'app-ask-modal', + templateUrl: './ask-modal.page.html', + styleUrls: ['./ask-modal.page.scss'], +}) +export class AskModalPage implements OnInit { + + title = '' + description = '' + + constructor( + private modalController: ModalController, + private navParams: NavParams + ) { + + this.title = this.navParams.get('title'); + this.description = this.navParams.get('description'); + } + + ngOnInit() { + } + + close() { + this.modalController.dismiss('No'); + } + + save() { + this.modalController.dismiss('Yes'); + } +} diff --git a/src/app/modals/eliminate-event/eliminate-event.page.ts b/src/app/modals/eliminate-event/eliminate-event.page.ts index 1e03c2dab..fce8edc62 100644 --- a/src/app/modals/eliminate-event/eliminate-event.page.ts +++ b/src/app/modals/eliminate-event/eliminate-event.page.ts @@ -8,16 +8,16 @@ import { ModalController } from '@ionic/angular'; }) export class EliminateEventPage implements OnInit { - constructor(private modalController: ModalController,) { } + constructor(private modalController: ModalController) { } ngOnInit() { } - close(){ + close() { this.modalController.dismiss('No'); } - save(){ + save() { this.modalController.dismiss('Yes'); } diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.html b/src/app/modals/profile/edit-profile/edit-profile.page.html index af76e36d1..32b1c8201 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -37,7 +37,7 @@ -
+
-
+ -
-
+ --> diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index 5dce1dd93..d1367e163 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -24,7 +24,7 @@ -
+
-
+
diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index ae30cade3..0b043777d 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -1009,29 +1009,60 @@ $font-size: rem(15); @media only screen and (min-width: 100px) { - .calendar-title-container { - font-size: 14px; + .week-5 { + .calendar-title-container { + font-size: 14px; + } + .height-75 { + height: 75px; + } + + .height-356 { + height: 324px; + } } - .height-75 { - height: 75px; - } - - .height-356 { - height: 324px; + + .week-6 { + .calendar-title-container { + font-size: 14px; + } + .height-75 { + height: 75px; + } + + .height-356 { + height: 360px; + } } + } @media only screen and (min-width: 500px) { - - .calendar-title-container { - font-size: 16px; + .week-5 { + .calendar-title-container { + font-size: 16px; + } + .height-75 { + height: 75px; + } + + .height-356 { + height: 356px; + } } - .height-75 { - height: 75px; + + .week-6 { + .calendar-title-container { + font-size: 16px; + } + .height-75 { + height: 75px; + } + + .height-356 { + height: 395px; + } } - .height-356 { - height: 356px; - } } diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 1d8038959..5d792d7db 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -287,6 +287,34 @@ export class AgendaPage implements OnInit { }, 1000) } + weeksToShow = [] + + weekToShow() { + let num = 0; + + function Week(a) { + for(let b of a.querySelectorAll('td')) { + if(!b.className.includes('text-muted')) { + num++; + return true + } + } + } + + for (let a of document.querySelectorAll('.monthview-container .swiper-container .swiper-slide-active table tbody tr') as any ){ + Week(a) + } + + if(num <= 5) { + + this.weeksToShow = ["week-5"] + } else { + + this.weeksToShow = ["week-6"] + } + + + } setCalendarByDefault() { if(!this.CalendarName) { @@ -514,6 +542,8 @@ export class AgendaPage implements OnInit { loadRequestHistory: any = {} loadRangeEvents(startTime: Date, endTime: Date) { + this.weekToShow() + if(!this.eventService.hasAnyCalendar) { return false } diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index c07a26a4f..12c4759c4 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -9,7 +9,6 @@
- {{ TaskService.showLoaderNum }}
diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 7a3950dfc..e9de88f65 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -17,6 +17,7 @@ import { Storage } from '@ionic/storage'; // import { ActionModel } from 'src/app/models/beast-orm'; + @Component({ selector: 'app-publications', templateUrl: './publications.page.html', diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts index c89e9efea..e521db697 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts @@ -10,6 +10,9 @@ import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { RouteService } from 'src/app/services/route.service'; import { PermissionService } from 'src/app/services/permission.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; + + @Component({ selector: 'app-publication-detail', @@ -31,7 +34,8 @@ export class PublicationDetailPage implements OnInit { private RouteService: RouteService, public ThemeService: ThemeService, public p:PermissionService, - private httpErrorHandle: HttpErrorHandle + private httpErrorHandle: HttpErrorHandle, + public publicationFolderService: PublicationFolderService ) { this.activatedRoute.paramMap.subscribe(params => { @@ -90,8 +94,13 @@ export class PublicationDetailPage implements OnInit { } this.showLoader = false; }, (error) => { - this.httpErrorHandle.httpStatusHandle(error) + + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) + } + this.goBack(); + this.httpErrorHandle.httpStatusHandle(error) }); } @@ -120,8 +129,12 @@ export class PublicationDetailPage implements OnInit { window['app-view-publications-page-doRefresh']() } + this.publicationFolderService.deletePost(this.folderId, this.publicationId) this.goBack(); } catch (error) { + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) + } this.httpErrorHandle.httpStatusHandle(error) } finally { loader.remove() diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index 6e79976c9..187cfe43f 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -7,12 +7,12 @@
-
-

{{publicationItem[folderId].Description}}

-

{{publicationItem[folderId].Detail}}

- +
+

{{publicationFolderService.FolderDetails[folderId].Description}}

+

{{publicationFolderService.FolderDetails[folderId].Detail}}

+
-
+
@@ -29,8 +29,8 @@
- - + diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 66a61a629..fd11fdd61 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -7,14 +7,15 @@ import { PublicationPipe } from 'src/app/pipes/publication.pipe'; import { PublicationsService } from 'src/app/services/publications.service'; import { NewPublicationPage } from '../new-publication/new-publication.page'; import { PublicationDetailPage } from './publication-detail/publication-detail.page'; -import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ThemeService } from 'src/app/services/theme.service' -import { forkJoin } from 'rxjs'; import { ToastService } from 'src/app/services/toast.service'; import { PermissionService } from 'src/app/services/permission.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { Storage } from '@ionic/storage'; +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; + + @Component({ selector: 'app-view-publications', templateUrl: './view-publications.page.html', @@ -24,8 +25,6 @@ export class ViewPublicationsPage implements OnInit { showLoader = true; loading: any; - publicationList: {[key: string]: Publication[] } = {}; - publicationItem: {[key: string]: PublicationFolder } = {}; defaultImage = "/assets/icon/icon-no-image.svg"; folderId: string; @@ -47,7 +46,8 @@ export class ViewPublicationsPage implements OnInit { private toastService: ToastService, public p: PermissionService, private httpErroHandle: HttpErrorHandle, - private storage: Storage,) { + private storage: Storage, + public publicationFolderService: PublicationFolderService,) { this.createPublicationList() @@ -100,11 +100,11 @@ export class ViewPublicationsPage implements OnInit { createPublicationList(folderId = this.folderId) { - if(!this.publicationList[folderId]) { - this.publicationList[folderId] = [] + if(!this.publicationFolderService.publicationList[folderId]) { + this.publicationFolderService.publicationList[folderId] = [] } - if(!this.publicationItem[folderId]) { - this.publicationItem[folderId] = new PublicationFolder(); + if(!this.publicationFolderService.FolderDetails[folderId]) { + this.publicationFolderService.FolderDetails[folderId] = new PublicationFolder(); } } @@ -133,7 +133,7 @@ export class ViewPublicationsPage implements OnInit { const folderId = this.folderId this.publications.GetPresidentialAction(folderId).subscribe(res =>{ - this.publicationItem[folderId] = res + this.publicationFolderService.FolderDetails[folderId] = res this.storage.set(folderId+"name", res) }, (error) => { this.showLoader = false; @@ -143,12 +143,7 @@ export class ViewPublicationsPage implements OnInit { getFromDB() { const folderId = this.folderId - this.storage.get(folderId).then((viewPublications) => { - this.publicationList[folderId] = viewPublications - }) - this.storage.get(folderId+"name").then((viewPublications) => { - this.publicationItem[folderId] = viewPublications - }) + this.publicationFolderService.getFromDB(folderId) } async getPublicationsIds() { @@ -177,8 +172,8 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = false; - this.storage.set(folderId, this.publicationList[folderId]); - this.getpublication = this.publicationList[folderId]; + this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]); + this.getpublication = this.publicationFolderService.publicationList[folderId]; } catch(error) { this.showLoader = false; } @@ -186,13 +181,13 @@ export class ViewPublicationsPage implements OnInit { } publicationIsPresent(publicationId, folderId) { - return this.publicationList[folderId].find( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId ) } publicationFind(publicationId, folderId) { - return this.publicationList[folderId].find( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId ) } publicationFindIndex(publicationId, folderId) { - return this.publicationList[folderId].findIndex( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].findIndex( e => e.DocumentId == publicationId ) } async loadPublication(publicationId, folderId) { @@ -202,9 +197,9 @@ export class ViewPublicationsPage implements OnInit { const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { - this.publicationList[folderId].push(publicationDetails) + this.publicationFolderService.publicationList[folderId].push(publicationDetails) } else { - this.publicationList[folderId][findIndex] = publicationDetails + this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails } } diff --git a/src/app/services/task.service.ts b/src/app/services/task.service.ts index 488548e6a..a975234d4 100644 --- a/src/app/services/task.service.ts +++ b/src/app/services/task.service.ts @@ -107,6 +107,11 @@ export class TaskService { if(!isoDateString) { return false } + + const deadline = new Date(isoDateString) + const plusOneDeadline = deadline.getDate() + 1 + deadline.setDate(plusOneDeadline) + return momentG(new Date(), 'dd MMMM yyyy') == momentG(new Date(isoDateString), 'dd MMMM yyyy') } diff --git a/src/app/shared/publication/new-publication/new-publication.page.html b/src/app/shared/publication/new-publication/new-publication.page.html index 673dc8885..410bce0d0 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.html +++ b/src/app/shared/publication/new-publication/new-publication.page.html @@ -28,7 +28,10 @@
-
+ {{ capturedImage }} + {{ publication | json }} + +
image
@@ -41,9 +44,9 @@
-
+
Fotografia Anexada - + diff --git a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts index 1fdb2a264..7bf88c525 100644 --- a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts @@ -8,7 +8,8 @@ import { ThemeService } from 'src/app/services/theme.service' import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { PermissionService } from 'src/app/services/permission.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; - +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; +import { AskModalPage } from 'src/app/modals/ask-modal/ask-modal.page' @Component({ selector: 'app-publication-detail-shared', templateUrl: './publication-detail.page.html', @@ -31,7 +32,9 @@ export class PublicationDetailPage implements OnInit { private toastService: ToastService, public ThemeService: ThemeService, public p:PermissionService, - private httpErrorHandle: HttpErrorHandle + private httpErrorHandle: HttpErrorHandle, + public publicationFolderService: PublicationFolderService, + public AskModalPage: AskModalPage ) { /* this.folderId = this.navParams.get('folderIdId'); */ @@ -62,9 +65,9 @@ export class PublicationDetailPage implements OnInit { }, 2000); } - getPublicationDetail(){ + getPublicationDetail() { this.showLoader = true; - this.publications.GetPublicationById(this.publicationId).subscribe(res=>{ + this.publications.GetPublicationById(this.publicationId).subscribe(res => { this.publication = { DateIndex: res.DateIndex, @@ -78,10 +81,12 @@ export class PublicationDetailPage implements OnInit { FileExtension: 'jpeg', } this.showLoader = false; - },(error) => { - if(window['_deletePublication']) { - window['_deletePublication'](this.folderId, this.publicationId) + }, (error) => { + + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) } + this.goBack(); this.httpErrorHandle.httpStatusHandle(error) }); @@ -99,9 +104,7 @@ export class PublicationDetailPage implements OnInit { await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); this.httpErrorHandle.httpsSucessMessagge('Eliminar publicação') - if(window['_deletePublication']) { - window['_deletePublication'](this.folderId, this.publicationId) - } + this.publicationFolderService.deletePost(this.folderId, this.publicationId) if(window['app-view-publications-page-doRefresh']) { window['app-view-publications-page-doRefresh']() @@ -109,6 +112,11 @@ export class PublicationDetailPage implements OnInit { this.goBackToViewPublications.emit(); } catch (error) { + + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) + } + this.httpErrorHandle.httpStatusHandle(error) } finally { laoder.remove() diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 45b94bf0e..4fbf31dde 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -1,18 +1,18 @@
-
+
- {{publicationItem[folderId].Description}} + {{publicationFolderService.FolderDetails[folderId].Description}}
- -
-
-

{{publicationItem[folderId].Detail}}

- +
+

{{publicationFolderService.FolderDetails[folderId].Detail}}

+
@@ -35,8 +35,8 @@ -
- +
@@ -57,7 +57,7 @@
- - + + diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index 57f37396f..5c32d81ea 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -12,7 +12,8 @@ import { EditActionPage } from 'src/app/pages/publications/edit-action/edit-acti import { Storage } from '@ionic/storage'; import { PermissionService } from 'src/app/services/permission.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; -// import { PublicationDetailsModel } from 'src/app/models/beast-orm'; +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; +import { AskModalPage } from 'src/app/modals/ask-modal/ask-modal.page'; @Component({ selector: 'app-view-publications', @@ -23,8 +24,6 @@ export class ViewPublicationsPage implements OnInit { showLoader: boolean; loading: any; - publicationList: {[key: string]: Publication[] } = {}; - publicationItem: {[key: string]: PublicationFolder } = {}; error: any; oldpublicationIds = [] @@ -46,10 +45,11 @@ export class ViewPublicationsPage implements OnInit { private toastService: ToastService, private storage: Storage, public p:PermissionService, - private httpErrorHandle: HttpErrorHandle + private httpErrorHandle: HttpErrorHandle, + public publicationFolderService: PublicationFolderService ) { this.createPublicationList() - } + } ngOnInit() { if(typeof(this.folderId) == 'object') { @@ -64,6 +64,7 @@ export class ViewPublicationsPage implements OnInit { } this.getFromDB(); + } ngOnChanges(changes: any): void { @@ -72,8 +73,8 @@ export class ViewPublicationsPage implements OnInit { this.folderId = this.folderId['ProcessId'] } - if(!this.publicationList[this.folderId]) { - this.publicationItem[this.folderId] = new PublicationFolder(); + if(!this.publicationFolderService.publicationList[this.folderId]) { + this.publicationFolderService.FolderDetails[this.folderId] = new PublicationFolder(); } this.createPublicationList() @@ -88,11 +89,11 @@ export class ViewPublicationsPage implements OnInit { createPublicationList(folderId = this.folderId) { - if(!this.publicationList[this.folderId]) { - this.publicationList[this.folderId] = [] + if(!this.publicationFolderService.publicationList[this.folderId]) { + this.publicationFolderService.publicationList[this.folderId] = [] } - if(!this.publicationItem[this.folderId]) { - this.publicationItem[this.folderId] = new PublicationFolder(); + if(!this.publicationFolderService.FolderDetails[this.folderId]) { + this.publicationFolderService.FolderDetails[this.folderId] = new PublicationFolder(); } } @@ -112,7 +113,7 @@ export class ViewPublicationsPage implements OnInit { this.publications.GetPresidentialAction(folderId).subscribe(res=>{ // PublicationDetailsModel.create(res) - this.publicationItem[folderId] = res + this.publicationFolderService.FolderDetails[folderId] = res this.storage.set(folderId+"name", res) }, (error) => { this.showLoader = false; @@ -127,7 +128,6 @@ export class ViewPublicationsPage implements OnInit { try { const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise(); - this.publicationList[folderId] = [] this.createPublicationList(folderId) let loadLater = [] @@ -147,7 +147,7 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = false; - this.storage.set(folderId, this.publicationList[folderId]); + this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]); this.oldpublicationIds = publicationIds } catch(error) { @@ -158,20 +158,20 @@ export class ViewPublicationsPage implements OnInit { _deletePublication = (folderId, publicationId) => { - this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != publicationId) + this.publicationFolderService.publicationList[folderId] = this.publicationFolderService.publicationList[folderId].filter( e => e.DocumentId != publicationId) - console.log('this.publicationList[folderId]', this.publicationList[folderId].length) + console.log('this.publicationFolderService.publicationList[folderId]', this.publicationFolderService.publicationList[folderId].length) } publicationIsPresent(publicationId, folderId) { - return this.publicationList[folderId].find( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId ) } publicationFind(publicationId, folderId) { - return this.publicationList[folderId].find( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].find( e => e.DocumentId == publicationId ) } publicationFindIndex(publicationId, folderId) { - return this.publicationList[folderId].findIndex( e => e.DocumentId == publicationId ) + return this.publicationFolderService.publicationList[folderId].findIndex( e => e.DocumentId == publicationId ) } async loadPublication(publicationId, folderId) { @@ -181,52 +181,20 @@ export class ViewPublicationsPage implements OnInit { const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { - this.publicationList[folderId].push(publicationDetails) + this.publicationFolderService.publicationList[folderId].push(publicationDetails) // PublicationModel.create(publicationDetails) } else { - this.publicationList[folderId][findIndex] = publicationDetails + this.publicationFolderService.publicationList[folderId][findIndex] = publicationDetails } } getFromDB() { const folderId = this.folderId - this.storage.get(folderId).then((viewPublications) => { - this.publicationList[folderId] = viewPublications - }) - this.storage.get(folderId+"name").then((viewPublications) => { - this.publicationItem[folderId] = viewPublications - }) + + this.publicationFolderService.getFromDB(folderId) } - // getPublications() { - // this.showLoader = true; - // const folderId = this.folderId - // this.publicationList = new Array(); - // this.publications.GetPublications(folderId).subscribe(async res=> { - - // res.forEach(element => { - // let item: Publication = this.publicationPipe.itemList(element) - // this.publicationList.push(item); - // }); - - // this.showLoader = false; - // await this.storage.remove(folderId); - // await this.storage.set(folderId, this.publicationList); - // //this.getFromDB(); - - // }, - // (error)=>{ - // if(error.status == '404') { - // this.error = 'Sem publicações disponíveis!'; - // this.publicationList= []; - // } - - // this.showLoader = false; - - // }) - - // } async AddPublication(publicationType:any, folderId:any) { @@ -278,41 +246,40 @@ export class ViewPublicationsPage implements OnInit { } async deletePublication(folderId?:any) { - const loader = this.toastService.loading(); - try { - await this.publications.DeletePresidentialAction(folderId).toPromise(); - this.httpErrorHandle.httpsSucessMessagge('Eliminar Acção') - } catch (error) { - this.httpErrorHandle.httpStatusHandle(error) - } - finally { - loader.remove() - } - this.close(); - this.getActions.emit(); + + const modal = await this.modalController.create({ + component: AskModalPage, + cssClass: 'discart-expedient-modal', + backdropDismiss: true, + componentProps: { + title: 'Deseja arquivar este acção?', + description: 'Nota: Ao Efetuar esta operação, o tratamento deste acção não poderá ser realizado a partir da lista de acções' + }, + }); + + modal.onDidDismiss().then((res) => { + if(res.data == 'Yes') { + const loader = this.toastService.loading(); + try { + this.publications.DeletePresidentialAction(folderId).toPromise(); + this.httpErrorHandle.httpsSucessMessagge('Eliminar Acção') + } catch (error) { + this.httpErrorHandle.httpStatusHandle(error) + } + finally { + loader.remove() + } + this.close(); + this.getActions.emit(); + } + // Do nothing + }); + await modal.present(); + } async viewPublicationDetail(publicationId:string) { - - // if( window.innerWidth <= 1024) { - // const modal = await this.modalController.create({ - // component: PublicationDetailPage, - // componentProps:{ - // publicationId: publicationId, - // }, - // cssClass: 'publication-detail modal modal-desktop', - // //backdropDismiss: false - // }); - // await modal.present(); - // modal.onDidDismiss().then(()=>{ - // this.doRefresh(event); - // }); - // } else { - // // open publication details - // this.openPublicationDetails.emit(publicationId); - // } - this.openPublicationDetails.emit(publicationId); } diff --git a/src/app/store/publication-folder.service.ts b/src/app/store/publication-folder.service.ts index 0c67847db..0597856c2 100644 --- a/src/app/store/publication-folder.service.ts +++ b/src/app/store/publication-folder.service.ts @@ -11,6 +11,8 @@ export class PublicationFolderService { publicationList: {[key: string]: Publication[] } = {}; FolderDetails: {[key: string]: PublicationFolder } = {}; + restoreFolder: {} = {} + keyName: string constructor( @@ -18,21 +20,29 @@ export class PublicationFolderService { ) {} - getFromDB(folderId: any) { - + createPublicationList(folderId) { if(!this.publicationList[folderId]) { this.publicationList[folderId] = [] } if(!this.FolderDetails[folderId]) { this.FolderDetails[folderId] = new PublicationFolder(); } + } - this.storage.get(folderId).then((viewPublications) => { - this.publicationList[folderId] = viewPublications - }) - this.storage.get(folderId+"name").then((viewPublications) => { - this.FolderDetails[folderId] = viewPublications - }) + getFromDB(folderId: any) { + + if(!this.restoreFolder[folderId]) { + + this.storage.get(folderId).then((viewPublications) => { + this.publicationList[folderId] = viewPublications + }) + + this.storage.get(folderId+"name").then((viewPublications) => { + this.FolderDetails[folderId] = viewPublications + }) + } + + this.restoreFolder[folderId] = true } updateFolderDetails(folderId, res) { @@ -68,15 +78,16 @@ export class PublicationFolderService { } } - deletePost(publicationId: any, folderId) { - - for (let i = 0; i <= this.publicationList[folderId].length; i++) { - if(this.publicationList[folderId][i].DocumentId == publicationId) { - this.publicationList[folderId].splice(i, 1) - } - } + deletePost(folderId: any, publicationId: any) { + if(this.publicationList[folderId]) { + + this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != publicationId) + + this.save(folderId) + } } + } diff --git a/version/git-version.ts b/version/git-version.ts index 7e7dd91e5..b6855ef68 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "8b3989de3", - "SHA": "8b3989de3beea56ec3168c107af73145f41aba8b", + "shortSHA": "19ddb1814", + "SHA": "19ddb18148a87d4cb7cd755d8c05190a2b0031e9", "branch": "developer-bug", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Wed Aug 9 10:00:39 2023 +0100'", + "lastCommitTime": "'Thu Aug 10 16:46:55 2023 +0100'", "lastCommitMessage": "fix", - "lastCommitNumber": "5144", - "change": "", - "changeStatus": "On branch developer-bug\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: angular.json\n\tdeleted: firebase-messaging-sw.js\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/pages/chat/messages/messages.page.scss\n\tmodified: src/app/pages/events/events.page.html\n\tmodified: src/app/pages/events/events.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/pages/publications/edit-action/edit-action.page.scss\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/shared/event/attendee-modal/attendee-modal.page.ts\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.html\n\tmodified: src/app/shared/gabinete-digital/all-processes/all-processes.page.ts\n\tmodified: src/app/shared/gabinete-digital/despachos/despachos.page.ts\n\tmodified: src/app/shared/publication/edit-action/edit-action.page.scss\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tnew file: src/app/store/publication-folder.service.spec.ts\n\tnew file: src/app/store/publication-folder.service.ts\n\tmodified: src/combined-sw.js\n\tmodified: src/plugin/src/models/model.d.ts\n\tmodified: src/plugin/src/models/model.js\n\tmodified: src/plugin/src/models/model.reader.d.ts\n\tmodified: src/plugin/src/models/register-model.d.ts\n\tmodified: src/plugin/src/models/register-model.js\n\tmodified: src/plugin/src/tsconfig.tsbuildinfo", + "lastCommitNumber": "5145", + "change": "diff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\nindex 18ad65e3a..d0f7f1af9 100644\n--- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n+++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n@@ -47,7 +47,7 @@\n \n
\n \n- \n+ \n \n
\n {{header}}\ndiff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\nindex 373b5c612..a53da800b 100644\n--- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\n+++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\n@@ -66,7 +66,7 @@ export class GroupContactsPage implements OnInit {\n headers: this.headers,\n };\n this.chatService.getAllUsers().subscribe((res:any)=>{\n- if(this.members){\n+ if(this.members) {\n this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));\n }\n else{\n@@ -149,6 +149,18 @@ export class GroupContactsPage implements OnInit {\n \n onChange(event){\n this.textSearch = event.detail.value;\n+\n+ this.users = this.contacts.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())).sort((a,b) => {\n+ if(a.name < b.name){\n+ return -1;\n+ }\n+ if(a.name > b.name){\n+ return 1;\n+ }\n+ return 0;\n+ });\n+ \n+\n }\n clicked(){\n \ndiff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\nindex d582861b3..6e820fa0b 100644\n--- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n+++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n@@ -49,7 +49,7 @@\n \n
\n \n- \n+ \n \n
\n {{header}}\ndiff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\nindex 436b4eccf..77e4c4d77 100644\n--- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n+++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n@@ -237,6 +237,18 @@ export class GroupContactsPage implements OnInit {\n \n onChange(event){\n this.textSearch = event.detail.value;\n+\n+ this.users = this.contacts.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())).sort((a,b) => {\n+ if(a.name < b.name){\n+ return -1;\n+ }\n+ if(a.name > b.name){\n+ return 1;\n+ }\n+ return 0;\n+ });\n+\n+ \n }\n \n clicked(){\ndiff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts\nindex 3a0f85821..72362b081 100644\n--- a/src/app/shared/popover/chat-popover/chat-popover.page.ts\n+++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts\n@@ -116,12 +116,12 @@ export class ChatPopoverPage implements OnInit {\n \n if(this.room.t === 'p') {\n this.chatService.deleteGroup(body).subscribe(res=>{\n- // this.ChatSystemService.deleteRoom(this.roomId)\n+ this.ChatSystemService.deleteRoom(this.roomId)\n });\n }\n else {\n this.chatService.deleteChannel(body).subscribe(res=>{\n- // this.ChatSystemService.deleteRoom(this.roomId)\n+ this.ChatSystemService.deleteRoom(this.roomId)\n });\n }\n });", + "changeStatus": "On branch developer-bug\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/app-routing.module.ts\n\tnew file: src/app/modals/ask-modal/ask-modal-routing.module.ts\n\tnew file: src/app/modals/ask-modal/ask-modal.module.ts\n\tnew file: src/app/modals/ask-modal/ask-modal.page.html\n\tnew file: src/app/modals/ask-modal/ask-modal.page.scss\n\tnew file: src/app/modals/ask-modal/ask-modal.page.spec.ts\n\tnew file: src/app/modals/ask-modal/ask-modal.page.ts\n\tmodified: src/app/modals/eliminate-event/eliminate-event.page.ts\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.scss\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/publications/publications.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.html\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.html\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.ts\n\tmodified: src/app/store/publication-folder.service.ts\n\nChanges not staged for commit:\n (use \"git add ...\" to update what will be committed)\n (use \"git restore ...\" to discard changes in working directory)\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/shared/popover/chat-popover/chat-popover.page.ts", "changeAuthor": "peter.maquiran" } \ No newline at end of file