This commit is contained in:
Eudes Inácio
2022-06-14 10:12:26 +01:00
13 changed files with 55 additions and 12 deletions
+4 -2
View File
@@ -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();
+6 -1
View File
@@ -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(['/']);
}
}
}
@@ -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,
@@ -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']
}
@@ -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;
}
+3 -3
View File
@@ -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
}
}
}
@@ -118,6 +118,7 @@
[(ngModel)]="postEvent.StartDate"
[max]="maxDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -146,6 +147,7 @@
[(ngModel)]="postEvent.EndDate"
[max]="maxDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -48,6 +48,7 @@ export class EditEventPage implements OnInit {
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
currentDate = new Date();
Form: FormGroup;
validateFrom = false
@@ -128,6 +128,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -159,6 +160,7 @@
placeholder="Choose a date"
[(ngModel)]="postEvent.EndDate"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -63,6 +63,7 @@ export class NewEventPage implements OnInit {
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
currentDate = new Date();
public color: ThemePalette = 'primary';
recurringTypes = []
selectedRecurringType: any;
@@ -46,6 +46,7 @@
placeholder="Choose a date*"
[(ngModel)]="folder.DateBegin"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -82,6 +83,7 @@
placeholder="Choose a date*"
[(ngModel)]="folder.DateEnd"
[disabled]="disabled"
[min]="currentDate"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker2"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker2
@@ -25,6 +25,7 @@ export class NewActionPage implements OnInit {
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
currentDate = new Date();
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
Form: FormGroup;
@@ -53,10 +53,10 @@ export class ViewPublicationsPage implements OnInit {
this.folderId = this.folderId['ProcessId']
}
this.getPublicationsIds();
this.getPublicationDetail();
//this.getPublicationsIds();
window['app-view-publications-page-doRefresh'] = this.doRefresh
this.getPublicationDetail();
}
ngOnChanges(changes: any): void {
@@ -196,6 +196,7 @@ export class ViewPublicationsPage implements OnInit {
}
async openEditPublication(folderId?:any){
if( window.innerWidth < 701) {
const modal = await this.modalController.create({
component: EditActionPage,