diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fadb07747..14ab0d183 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -12,7 +12,8 @@ import { SqliteService } from 'src/app/services/sqlite.service'; import { BackgroundService } from 'src/app/services/background.service'; import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx'; import { StorageService } from 'src/app/services/storage.service'; -import { MessageModel } from './models/beast-orm' +import { MessageModel } from './models/beast-orm'; +import { InativityService } from "src/app/services/inativity.service"; const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -43,7 +44,8 @@ export class AppComponent { private screenOrientation: ScreenOrientation, private sqliteservice: SqliteService, private backgroundservice: BackgroundService, - private storageservice: StorageService + private storageservice: StorageService, + private InativityService: InativityService ) { // this.createCacheFolder() this.initializeApp(); diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 732fc50af..6e0f74a4d 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -118,7 +118,12 @@ export class HomePage implements OnInit { const pathname = window.location.pathname SessionStore.setUrlBeforeInactivity(pathname) - this.router.navigate(['/inactivity']); + + if (this.platform.is('mobileweb')) { + this.router.navigate(['/inactivity']); + }else{ + this.router.navigate(['/']); + } } } diff --git a/src/app/pages/publications/edit-action/edit-action.page.ts b/src/app/pages/publications/edit-action/edit-action.page.ts index 7e582fff8..59517d6af 100644 --- a/src/app/pages/publications/edit-action/edit-action.page.ts +++ b/src/app/pages/publications/edit-action/edit-action.page.ts @@ -22,13 +22,14 @@ export class EditActionPage implements OnInit { public showSeconds = false; public touchUi = false; public enableMeridian = false; - public minDate = new Date().toISOString().slice(0,10) + public minDate = new Date().toISOString() public maxDate: any; public stepHour = 1; public stepMinute = 5; public stepSecond = 5; public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); + currentDate = new Date(); folder: PublicationFolder; folderId: string; @@ -64,8 +65,15 @@ export class EditActionPage implements OnInit { } get dateValid() { + var validado: boolean; + if (window.innerWidth <= 800) { - return this.folder.DateBegin < this.folder.DateEnd? ['ok']: [] + if ((this.folder.DateBegin < this.folder.DateEnd) && (new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime())) { + validado = true; + }else{ + validado = false; + } + return validado == true ? ['ok']: []; } else { return ['ok'] } @@ -89,6 +97,11 @@ export class EditActionPage implements OnInit { } async save() { + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + let body = { ProcessId: this.folderId, Description: this.folder.Description, diff --git a/src/app/pages/publications/new-action/new-action.page.ts b/src/app/pages/publications/new-action/new-action.page.ts index 6e086e615..34c7f3dd9 100644 --- a/src/app/pages/publications/new-action/new-action.page.ts +++ b/src/app/pages/publications/new-action/new-action.page.ts @@ -43,13 +43,14 @@ export class NewActionPage implements OnInit { public showSeconds = false; public touchUi = false; public enableMeridian = false; - public minDate = new Date().toISOString().slice(0,10) + public minDate = new Date().toISOString() public endMinDate = new Date(new Date().getTime() + 15 * 60000); public stepHour = 1; public stepMinute = 5; public stepSecond = 5; public dateControlStart = new FormControl(moment("DD MM YYYY hh")); public dateControlEnd = new FormControl(moment("DD MM YYYY hh")); + currentDate = new Date(); showLoader = false @@ -94,8 +95,15 @@ export class NewActionPage implements OnInit { } get dateValid() { + var validado: boolean; + if (window.innerWidth <= 800) { - return this.folder.DateBegin < this.folder.DateEnd? ['ok']: [] + if ((this.folder.DateBegin < this.folder.DateEnd) && (new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime())) { + validado = true; + }else{ + validado = false; + } + return validado == true ? ['ok']: []; } else { return ['ok'] } diff --git a/src/app/pages/publications/publications.page.ts b/src/app/pages/publications/publications.page.ts index 10ef64bf8..345388407 100644 --- a/src/app/pages/publications/publications.page.ts +++ b/src/app/pages/publications/publications.page.ts @@ -401,6 +401,7 @@ export class PublicationsPage implements OnInit { goBackToViewPublications() { this.closeDesktopComponent(); + this.idSelected = this.folderId; this.desktopComponent.showViewPublication = true; } @@ -408,6 +409,7 @@ export class PublicationsPage implements OnInit { // Emitters goBackToPubications() { this.closeDesktopComponent(); + this.idSelected = this.folderId; this.desktopComponent.showViewPublication = true; } @@ -429,6 +431,7 @@ export class PublicationsPage implements OnInit { // edit publication will send null if (folderId != undefined) { this.folderId = folderId; + this.idSelected = this.folderId; } this.publication = publication; @@ -437,6 +440,7 @@ export class PublicationsPage implements OnInit { async editPublication(foolderId: string) { this.closeDesktopComponent(); + this.idSelected = this.folderId; this.desktopComponent.showEditActions = true; } @@ -445,6 +449,7 @@ export class PublicationsPage implements OnInit { this.publicationId = publicationId; this.closeDesktopComponent(); + this.idSelected = this.folderId; this.desktopComponent.showPublicationDetail = true; } diff --git a/src/app/services/inativity.service.ts b/src/app/services/inativity.service.ts index 1ea52ceca..a4892dd1d 100644 --- a/src/app/services/inativity.service.ts +++ b/src/app/services/inativity.service.ts @@ -11,7 +11,7 @@ export class InativityService { private router: Router, ) { - var t; + var time; window.onload = resetTimer; window.onmousemove = resetTimer; window.onmousedown = resetTimer; // catches touchscreen presses as well @@ -28,8 +28,8 @@ export class InativityService { } function resetTimer() { - clearTimeout(t); - t = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds + clearTimeout(time); + time = setTimeout(userIsNotActive, 60000 * 5); // time is in milliseconds } } } diff --git a/src/app/shared/agenda/edit-event/edit-event.page.html b/src/app/shared/agenda/edit-event/edit-event.page.html index 00c2e0949..f533c3b11 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -118,6 +118,7 @@ [(ngModel)]="postEvent.StartDate" [max]="maxDate" [disabled]="disabled" + [min]="currentDate" >