This commit is contained in:
Peter Maquiran
2022-12-21 16:19:06 +01:00
parent a1c5856089
commit 7168788b3c
5 changed files with 211 additions and 368 deletions
+3
View File
@@ -0,0 +1,3 @@
require('child_process').exec('git rev-parse HEAD', function(err, stdout) {
console.log('Last commit hash on this branch is:', stdout);
});
+2 -2
View File
@@ -24,7 +24,7 @@ export class LoginGuard implements CanActivate {
// enter app
this.router.navigate(['/home/events']);
return false
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && SessionStore.forceToLoginWithForceToLogInWithPassword && !this.platform.is('desktop') && !this.platform.is('mobileweb')) {
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && SessionStore.forceToLoginWithForceToLogInWithPassword && this.platform.is('mobile')) {
// login with password while has pin
SessionStore.forceToLoginWithForceToLogInWithPassword = false
return true
@@ -32,7 +32,7 @@ export class LoginGuard implements CanActivate {
// go to pin page
this.router.navigate(['/pin']);
return false
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && !this.platform.is('desktop') && !this.platform.is('mobileweb')) {
} else if(SessionStore.exist && !SessionStore.user.Inactivity && SessionStore.user.LoginPreference == 'Pin' && this.platform.is('mobile')) {
this.router.navigate(['/inactivity']);
return false
} else {
-141
View File
@@ -1,144 +1,3 @@
<ion-header class="ion-no-border">
<app-header></app-header>
</ion-header>
<!-- <ion-header class="ion-no-border init-event-header"> -->
<ion-header class="ion-no-border">
<ion-label>
<p class="time ion-text-center">{{customDate}}</p>
</ion-label>
<ion-label>
<p *ngIf="totalEvent==1" class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> evento agendado para hoje</p>
<p *ngIf="totalEvent!=1"class="event-number p-small ion-text-center"> <strong>{{totalEvent}}</strong> eventos agendados para hoje</p>
</ion-label>
<div class="next-meeting">
<div class="meeting-time" *ngIf="currentHoursMinutes">{{currentHoursMinutes | date: 'HH:mm'}}</div>
<div class="meeting-description" *ngIf="currentEvent"> "{{currentEvent}}"</div>
</div>
</ion-header>
<!-- <ion-content class="main " ng-controller="AppController"> -->
<ion-content ng-controller="AppController">
<ion-refresher slot="fixed" (ionRefresh)="doRefresh()">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="conteiner-box px-20 height-100" ng-swipe-up="swipe($event)">
<div *ngIf="p.userPermission([p.permissionList.Agenda.access])" class="schedule height-100">
<ion-progress-bar type="indeterminate" *ngIf="showAgendaLoader"></ion-progress-bar>
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-default-agenda.svg" ></ion-icon>
<div class="text">A sua Agenda</div>
</div>
<button title="Ir para a sua Agenda" class="btn-no-color" [routerLink]="['/home/agenda']">
<ion-icon
*ngIf="ThemeService.currentTheme == 'default' "
class="icon-next"
slot="end"
src="assets/images/icons-arrow-circle-arrow-right.svg"
></ion-icon>
<ion-icon
*ngIf="ThemeService.currentTheme == 'gov' "
class="icon-next"
slot="end"
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
></ion-icon>
<ion-icon
*ngIf="ThemeService.currentTheme == 'doneIt' "
class="icon-next"
slot="end"
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
></ion-icon>
</button>
</div>
<div class="content overflow-y-auto flex-grow-1 height-100">
<ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor="let event of listToPresent"
(click)="goToEvent(event)"
>
<div class="d-flex content-{{sessoStore.user.Profile}}-{{event.CalendarName}}">
<div class="schedule-time">
<div *ngIf="!event.IsAllDayEvent" class="time-start">{{event.StartDate | date: 'HH:mm'}}</div>
<div *ngIf="!event.IsAllDayEvent" class="time-end">{{event.EndDate | date: 'HH:mm'}}</div>
<div *ngIf="event.IsAllDayEvent" class="time-start"> Todo </div>
<div *ngIf="event.IsAllDayEvent" class="time-end text-center"> o dia </div>
<div></div>
</div>
<div class="schedule-details">
<div class="location">{{event.Location}}</div>
<div class="description">
<p>{{event.Subject}}</p>
</div>
</div>
</div>
</ion-item>
</ion-list>
</div>
</div>
<div *ngIf="p.userPermission([p.permissionList.Gabinete.access])" class="schedule height-100">
<ion-progress-bar type="indeterminate" *ngIf="showCorrespondenciasLoader"></ion-progress-bar>
<div class="schedule-header">
<div class="title">
<ion-icon class="icon" slot="end" src="assets/images/icons-correspondencias.svg"></ion-icon>
<div class="text">Correspondência por ler</div>
</div>
<button title="Ir para o Gabinete Digital" (click)="viewExpedientListPage()" class="btn-no-color cursor-pointer">
<ion-icon
*ngIf="ThemeService.currentTheme == 'default' "
class="icon-next"
slot="end"
src="assets/images/icons-arrow-circle-arrow-right.svg"
></ion-icon>
<ion-icon
*ngIf="ThemeService.currentTheme == 'gov' "
class="icon-next"
slot="end"
src="assets/images/theme/gov/icons-arrow-circle-arrow-right.svg"
></ion-icon>
<ion-icon
*ngIf="ThemeService.currentTheme == 'doneIt' "
class="icon-next"
slot="end"
src="assets/images/theme/doneIt/icons-arrow-circle-arrow-right.svg"
></ion-icon>
</button>
</div>
<div class="content overflow-y-auto flex-grow-1 height-100">
<ion-list>
<ion-item class="item-hover cursor-pointer" lines="none" *ngFor = "let task of listToPresentexpediente"
(click)="goToExpediente(task.SerialNumber)">
<div class="item-exp d-flex">
<div class="schedule-date">
<div class="time-end">{{task.taskStartDate | date: 'dd-MM-yyyy'}}</div>
<div class="time-start">{{task.taskStartDate | date: 'HH:mm'}}</div>
</div>
<div class="schedule-details pointer">
<div class="description">{{ task.Subject }}</div>
<div class="location">{{ task.Senders }}</div>
</div>
</div>
</ion-item>
</ion-list>
</div>
</div>
</div>
<!-- <iframe id="home-iframe" style="width: 100%;" src="/assets/www/pdfjs/web/viewer.html?file=/assets/www/pdfjs/web/compressed.tracemonkey-pldi-09.pdf.pdf"></iframe> -->
</ion-content>
+205 -221
View File
@@ -5,7 +5,6 @@ import { ActivatedRoute, NavigationEnd } from '@angular/router';
import { ModalController, Platform } from '@ionic/angular';
import { EventDetailPage } from './event-detail/event-detail.page';
import { ProcessesService } from '../../services/processes.service';
import { LoginUserRespose } from 'src/app/models/user.model';
import { ToDayEventStorage } from 'src/app/store/to-day-event-storage.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
@@ -62,7 +61,6 @@ export class EventsPage implements OnInit {
@Output() openExpedientListPage: EventEmitter<any> = new EventEmitter<any>();
loggeduser: LoginUserRespose;
sessoStore = SessionStore;
showAgendaLoader = false
@@ -83,268 +81,259 @@ export class EventsPage implements OnInit {
private changeProfileService: ChangeProfileService,
) {
this.loggeduser = SessionStore.user;
// window['zipPhoneCallback'] = function (zipphone) {
// var frame = document.getElementById('home-iframe');
// if(frame) {
// frame['contentWindow']['postMessage']({call:'cookies', value: { cookies: {} }});
// }
// }
this.platform.resize.subscribe(async () => {
//
//
// this.changeProfileService.registerCallback(() => {
});
window['zipPhoneCallback'] = function (zipphone) {
var frame = document.getElementById('home-iframe');
if(frame) {
frame['contentWindow']['postMessage']({call:'cookies', value: { cookies: {} }});
}
}
this.changeProfileService.registerCallback(() => {
this.listToPresent = [];
this.listToPresentexpediente = []
})
// this.listToPresent = [];
// this.listToPresentexpediente = []
// })
}
ngOnInit() {
this.showGreeting();
// this.showGreeting();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/events') {
this.RefreshEvents();
setTimeout(() => {
this.LoadList();
}, 1500)
}
});
this.hideSearch();
// this.router.events.forEach((event) => {
// if (event instanceof NavigationEnd && event.url == '/home/events') {
// this.RefreshEvents();
// setTimeout(() => {
// this.LoadList();
// }, 1500)
// }
// });
// this.hideSearch();
this.backgroundservice.registerBackService('Online', () => {
this.showGreeting();
this.RefreshEvents();
this.LoadList();
this.hideSearch();
});
// this.backgroundservice.registerBackService('Online', () => {
// this.showGreeting();
// this.RefreshEvents();
// this.LoadList();
// this.hideSearch();
// });
}
hideSearch() {
if (this.router.url == '/home/events') {
this.hideSearchBtn = true;
}
// if (this.router.url == '/home/events') {
// this.hideSearchBtn = true;
// }
}
doRefresh() {
this.RefreshEvents();
this.LoadList();
// this.RefreshEvents();
// this.LoadList();
}
onSegmentChange() {
this.doRefresh();
// this.doRefresh();
}
async RefreshEvents() {
this.currentEvent = "";
this.showLoader = true;
this.showAgendaLoader = true;
// this.currentEvent = "";
// this.showLoader = true;
// this.showAgendaLoader = true;
let date = new Date();
let month = date.getMonth() + 1;
let start = date.getFullYear() + "-" + month + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
let end = date.getFullYear() + "-" + month + "-" + date.getDate() + " 23:59:59";
if(SessionStore.user) {
let onwEvent:any = await this.eventService.getAllOwnEvents(start, end).catch((error) => {
this.showAgendaLoader = false;
console.error(error)
})
this.listToPresent = onwEvent;
this.totalEvent = onwEvent.length;
this.showLoader = false;
this.showAgendaLoader = false;
} else {
// let date = new Date();
// let month = date.getMonth() + 1;
// let start = date.getFullYear() + "-" + month + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
// let end = date.getFullYear() + "-" + month + "-" + date.getDate() + " 23:59:59";
// if(SessionStore.user) {
// let onwEvent:any = await this.eventService.getAllOwnEvents(start, end).catch((error) => {
// this.showAgendaLoader = false;
// console.error(error)
// })
// this.listToPresent = onwEvent;
// this.totalEvent = onwEvent.length;
// this.showLoader = false;
// this.showAgendaLoader = false;
// } else {
}
// }
}
addEventToDb(list) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('events', list).then(() => {
//
})
} else {
if (list.length > 0) {
list.forEach(element => {
this.sqliteservice.addEvent(element)
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.set('events', list).then(() => {
// //
// })
// } else {
// if (list.length > 0) {
// list.forEach(element => {
// this.sqliteservice.addEvent(element)
this.sqliteservice.getAllEvents().then((event: any[] = []) => {
let todayEvents = new Array()
event.forEach((element) => {
let eventObject = {
AppointmentState: element.AppointmentState,
Attachments: element.Attachments,
Attendees: element.Attendees,
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
Category: element.Category,
EndDate: element.EndDate,
EventId: element.EventId,
EventRecurrence: element.EventRecurrence,
EventType: element.EventType,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
IsMeeting: element.IsMeeting,
IsRecurring: element.IsRecurring,
Location: element.Location,
Organizer: element.Organizer,
Profile: element.Profile,
StartDate: element.StartDate,
Subject: element.Subject
}
todayEvents.push(eventObject);
})
// this.sqliteservice.getAllEvents().then((event: any[] = []) => {
// let todayEvents = new Array()
// event.forEach((element) => {
// let eventObject = {
// AppointmentState: element.AppointmentState,
// Attachments: element.Attachments,
// Attendees: element.Attendees,
// CalendarId: element.CalendarId,
// CalendarName: element.CalendarName,
// Category: element.Category,
// EndDate: element.EndDate,
// EventId: element.EventId,
// EventRecurrence: element.EventRecurrence,
// EventType: element.EventType,
// HasAttachments: element.HasAttachments,
// HumanDate: element.HumanDate,
// IsAllDayEvent: element.IsAllDayEvent,
// IsMeeting: element.IsMeeting,
// IsRecurring: element.IsRecurring,
// Location: element.Location,
// Organizer: element.Organizer,
// Profile: element.Profile,
// StartDate: element.StartDate,
// Subject: element.Subject
// }
// todayEvents.push(eventObject);
// })
})
});
}
}
// })
// });
// }
// }
}
addProcessToDb(list) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.set('process', list).then(() => {
//
})
} else {
if (list.length > 0) {
list.forEach(element => {
this.sqliteservice.addProcess(element)
});
}
}
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.set('process', list).then(() => {
// //
// })
// } else {
// if (list.length > 0) {
// list.forEach(element => {
// this.sqliteservice.addProcess(element)
// });
// }
// }
}
getEventsFromLocalDb() {
let date = new Date();
let month = date.getMonth() + 1;
//date.setMonth(date.getMonth() + 1);
let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
// ('dateeeeee', dateToday)
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storage.get('events').then((events: any[] = []) => {
//
let todayEvents = new Array()
this.listToPresent = events
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
//
})
// let date = new Date();
// let month = date.getMonth() + 1;
// //date.setMonth(date.getMonth() + 1);
// let dateToday = date.getFullYear() + "-" + month + "-" + date.getDate();
// // ('dateeeeee', dateToday)
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
// this.storage.get('events').then((events: any[] = []) => {
// //
// let todayEvents = new Array()
// this.listToPresent = events
// this.totalEvent = this.listToPresent.length
// this.currentEvent = this.listToPresent[0].Subject
// this.currentHoursMinutes = this.listToPresent[0].StartDate
// //
// })
this.storage.get('process').then((process: any[] = []) => {
//
const ExpedienteTask = process.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
})
// this.storage.get('process').then((process: any[] = []) => {
// //
// const ExpedienteTask = process.map(e => this.expedienteTaskPipe.transform(e))
// this.listToPresentexpediente = ExpedienteTask;
// })
this.showLoader = false;
// this.showLoader = false;
} else {
this.sqliteservice.getAllEvents().then((event: any[] = []) => {
let todayEvents = new Array()
event.forEach((element) => {
let eventObject = {
AppointmentState: element.AppointmentState,
Attachments: element.Attachments,
Attendees: element.Attendees,
CalendarId: element.CalendarId,
CalendarName: element.CalendarName,
Category: element.Category,
EndDate: element.EndDate,
EventId: element.EventId,
EventRecurrence: element.EventRecurrence,
EventType: element.EventType,
HasAttachments: element.HasAttachments,
HumanDate: element.HumanDate,
IsAllDayEvent: element.IsAllDayEvent,
IsMeeting: element.IsMeeting,
IsRecurring: element.IsRecurring,
Location: element.Location,
Organizer: element.Organizer,
Profile: element.Profile,
StartDate: element.StartDate,
Subject: element.Subject
}
let starteDate = momentG(new Date(element.StartDate), 'yyyy-MM-dd');
//
if (dateToday == starteDate) {
todayEvents.push(eventObject);
}
})
this.listToPresent = todayEvents
this.totalEvent = this.listToPresent.length
this.currentEvent = this.listToPresent[0].Subject
this.currentHoursMinutes = this.listToPresent[0].StartDate
//
})
// } else {
// this.sqliteservice.getAllEvents().then((event: any[] = []) => {
// let todayEvents = new Array()
// event.forEach((element) => {
// let eventObject = {
// AppointmentState: element.AppointmentState,
// Attachments: element.Attachments,
// Attendees: element.Attendees,
// CalendarId: element.CalendarId,
// CalendarName: element.CalendarName,
// Category: element.Category,
// EndDate: element.EndDate,
// EventId: element.EventId,
// EventRecurrence: element.EventRecurrence,
// EventType: element.EventType,
// HasAttachments: element.HasAttachments,
// HumanDate: element.HumanDate,
// IsAllDayEvent: element.IsAllDayEvent,
// IsMeeting: element.IsMeeting,
// IsRecurring: element.IsRecurring,
// Location: element.Location,
// Organizer: element.Organizer,
// Profile: element.Profile,
// StartDate: element.StartDate,
// Subject: element.Subject
// }
// let starteDate = momentG(new Date(element.StartDate), 'yyyy-MM-dd');
// //
// if (dateToday == starteDate) {
// todayEvents.push(eventObject);
// }
// })
// this.listToPresent = todayEvents
// this.totalEvent = this.listToPresent.length
// this.currentEvent = this.listToPresent[0].Subject
// this.currentHoursMinutes = this.listToPresent[0].StartDate
// //
// })
this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[] = []) => {
// this.sqliteservice.getprocessByworkflow("Expediente").then((process: any[] = []) => {
//
// //
if (process.length > 0 || process != undefined) {
// if (process.length > 0 || process != undefined) {
var expedientlist: any = new Array();
process.forEach((element) => {
if(JSON.parse(element.workflowInstanceDataFields).TaskMessage || JSON.parse(element.workflowInstanceDataFields).Note) {
// var expedientlist: any = new Array();
// process.forEach((element) => {
// if(JSON.parse(element.workflowInstanceDataFields).TaskMessage || JSON.parse(element.workflowInstanceDataFields).Note) {
let task = {
activityInstanceName: element.activityInstanceName,
deadline: null,
serialNumber: element.serialNumber,
taskStartDate: element.taskStartDate,
totalDocuments: element.totalDocuments,
workflowDisplayName: element.workflowDisplayName,
workflowInstanceDataFields: JSON.parse(element.workflowInstanceDataFields)
}
expedientlist.push(task);
// let task = {
// activityInstanceName: element.activityInstanceName,
// deadline: null,
// serialNumber: element.serialNumber,
// taskStartDate: element.taskStartDate,
// totalDocuments: element.totalDocuments,
// workflowDisplayName: element.workflowDisplayName,
// workflowInstanceDataFields: JSON.parse(element.workflowInstanceDataFields)
// }
// expedientlist.push(task);
}
})
// }
// })
//
const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
this.listToPresentexpediente = ExpedienteTask;
// //
// const ExpedienteTask = expedientlist.map(e => this.expedienteTaskPipe.transform(e))
// this.listToPresentexpediente = ExpedienteTask;
}
// }
this.showLoader = false;
})
}
// });
// this.showLoader = false;
// })
// }
// // });
}
showGreeting() {
if (this.today.getHours() >= 6 && this.today.getHours() < 12) {
this.greetting = this.grettings[0];
}
else if (this.today.getHours() >= 12 && this.today.getHours() < 18) {
this.greetting = this.grettings[1];
}
else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */ {
this.greetting = this.grettings[2];
}
// if (this.today.getHours() >= 6 && this.today.getHours() < 12) {
// this.greetting = this.grettings[0];
// }
// else if (this.today.getHours() >= 12 && this.today.getHours() < 18) {
// this.greetting = this.grettings[1];
// }
// else /* if(this.today.getHours() < 6 && this.today.getHours() >= 18) */ {
// this.greetting = this.grettings[2];
// }
}
gotTo() {
@@ -352,21 +341,16 @@ export class EventsPage implements OnInit {
}
changeProfile() {
if (this.profile == "mdgpr") {
//
this.profile = "pr";
this.RefreshEvents();
}
else {
//
this.profile = "mdgpr";
this.RefreshEvents();
}
}
logout() {
SessionStore.user.BasicAuthKey = "";
this.router.navigate(['/home/login']);
// if (this.profile == "mdgpr") {
// //
// this.profile = "pr";
// this.RefreshEvents();
// }
// else {
// //
// this.profile = "mdgpr";
// this.RefreshEvents();
// }
}
async openEventDetail1(id: any) {
@@ -438,7 +422,7 @@ export class EventsPage implements OnInit {
viewExpedientListPage() {
if (this.loggeduser.Profile == 'PR') {
if (this.sessoStore.user.Profile == 'PR') {
if (window.innerWidth < 701) {
this.router.navigate(['/home/gabinete-digital/expedientes-pr']);
}
+1 -4
View File
@@ -16,8 +16,6 @@ import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-co
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ChatService } from 'src/app/services/chat.service';
import { Platform } from '@ionic/angular';
import { SqliteService } from 'src/app/services/sqlite.service';
@Component({
@@ -54,7 +52,6 @@ export class LoginPage implements OnInit {
public ChatSystemService: ChatSystemService,
private ChatService: ChatService,
private platform: Platform,
private sqliteservice: SqliteService,
) {}
ngOnInit() {
@@ -172,7 +169,7 @@ export class LoginPage implements OnInit {
}
} else {
this.router.navigateByUrl('/home/events');
this.router.navigate(['/home/events']);
}