Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/calendar

This commit is contained in:
2021-02-02 11:05:10 +01:00
190 changed files with 76044 additions and 29889 deletions
-4
View File
@@ -28,10 +28,6 @@
<ion-icon class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-label>Chat</ion-label>
</ion-tab-button>
<ion-tab-button tab="search">
<ion-icon name="search"></ion-icon>
<ion-label>Pesquisa</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
+152 -28
View File
@@ -3,10 +3,16 @@ import { EventsService } from '../services/events.service';
import { formatDate } from '@angular/common';
import { Event } from '../models/event.model';
import { ProcessesService } from '../services/processes.service';
import { StorageService } from 'src/app/services/storage.service';
import { ModalController } from '@ionic/angular';
import { PublicationDetailPage } from '../../app/pages/publications/view-publications/publication-detail/publication-detail.page';
import { ViewPublicationsPage } from '../../app/pages/publications/view-publications/view-publications.page';
import { Plugins, PushNotification,PushNotificationToken,PushNotificationActionPerformed} from '@capacitor/core';
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core';
import { Router } from '@angular/router';
import { MethodCall } from '@angular/compiler';
const { PushNotifications } = Plugins;
const { PushNotifications, LocalNotifications } = Plugins;
@Component({
selector: 'app-home',
@@ -18,61 +24,179 @@ export class HomePage implements OnInit {
prEventList: Event[];
mdEventList: Event[];
totalEvent=0;
totalExpediente=0;
profile:string;
totalEvent = 0;
totalExpediente = 0;
profile: string;
constructor(private eventService: EventsService, private processesbackend:ProcessesService) { }
constructor(private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
ngOnInit() {
//Initialize profile as mdgpr
this.profile = "mdgpr";
if(this.profile == "mdgpr"){
if (this.profile == "mdgpr") {
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
this.eventsList = res;
this.totalEvent = this.eventsList.length;
});
});
}
else{
else {
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
this.eventsList = res;
this.totalEvent = this.eventsList.length;
});
});
}
this.processesbackend.GetTasksList("Expediente", true).subscribe(result =>{
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
this.totalExpediente = result;
});
/*
(PushNotifications as any).requestPermission().then(result => {
PushNotifications.register();
});
PushNotifications.addListener(
'registration',
(token: PushNotificationToken) => {
alert('Push registration success, token: ' + token.value);
console.log('FIREBASE: ', token.value)
this.storageService.store(this.username,token.value);
},
);
console.log(this.storageService.get(this.username)) */
(PushNotifications as any).requestPermission().then(result => {
PushNotifications.register();
});
PushNotifications.addListener(
'registration',
(token: PushNotificationToken) => {
/* alert('Push registration success, token: ' + token.value); */
console.log('FIREBASE: ', token.value)
},
);
PushNotifications.addListener('registrationError', (error: any) => {
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener(
'pushNotificationReceived',
(notification: PushNotification) => {
alert('Push received: ' + JSON.stringify(notification));
//alert('Push received: ' + JSON.stringify(notification));
//this.localNotificationPresent(notification);
},
);
PushNotifications.addListener(
'pushNotificationActionPerformed',
(notification: PushNotificationActionPerformed) => {
alert('Push action performed: ' + JSON.stringify(notification));
let service = notification.notification.data.service;
let object = notification.notification.data.object;
let idObject = notification.notification.data.idObject;
let folder = notification.notification.data.folder;
let publicationId = notification.notification.data.publicationId;
let processId = notification.notification.data.processId;
console.log('FOLDER PROCESS', folder.ProcessId)
if (service != null) {
if (service === "events") {
this.router.navigate(['/home/', service, idObject, 'home']);
} else if (service === "agenda") {
this.router.navigate(['/home/', service, idObject, 'home']);
} else if (service === "gabinete-digital") {
this.router.navigate(['/home/', service]);
} else if (service === "gabinete-digital-expediente") {
this.router.navigate(['/home/gabinete-digital/', object, idObject]);
}
} else {
if (processId || publicationId != null) {
this.viewPublicationDetail(processId, publicationId)
}
if (notification.notification.data.folder.ProcessId != null) {
this.viewPublications(folder)
}
}
/*switch (service) {
case "events":
this.router.navigate(['/home/', service, idObject, 'home']);
break;
case "agenda":
this.router.navigate(['/home/', service, idObject, 'home']);
break;
case "gabinete-digital":
this.router.navigate(['/home/', service]);
break;
case "gabinete-digital-expediente":
this.router.navigate(['/home/gabinete-digital/', object, idObject, 'home']);
break;
case "": {
if(publicationId && processId != null) {
this.viewPublicationDetail(publicationId,processId)
}
if (folder.ProcessId != null) {
this.viewPublications(folder)
}
}
default:
this.router.navigate(['/home/']);
}*/
},
);
}
}
async localNotificationPresent(notification) {
LocalNotifications.schedule({
notifications: [
{
title: notification.title,
body: notification.body,
id: 1,
schedule: { at: new Date(Date.now() + 1000) },
sound: null,
attachments: null,
actionTypeId: "",
extra: null
}
]
});
}
async viewPublicationDetail(processId: string, publicationId: string) {
const modal = await this.modalController.create({
component: PublicationDetailPage,
componentProps: {
publicationId: publicationId,
folderId: processId,
},
cssClass: 'publication-detail',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
async viewPublications(folder) {
const modal = await this.modalController.create({
component: ViewPublicationsPage,
/* enterAnimation,
leaveAnimation, */
componentProps: {
item: folder,
},
cssClass: 'new-action',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
}
+6
View File
@@ -0,0 +1,6 @@
export class Token {
UserId: number;
TokenId: string;
Status: number;
Service: number
}
+6 -4
View File
@@ -35,10 +35,12 @@
</ion-row>
<ion-row class="ion-align-items-center">
<ion-icon *ngIf="profile == 'mdgpr' " (click)="changeProfile()" class="right-icons" src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
<ion-icon *ngIf="profile == 'pr' " (click)="changeProfile()" class="right-icons" src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
<ion-icon class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon class="right-icons" src="assets/images/icons-add-new-event.svg" (click)="openCalModal()" ></ion-icon>
<div class="arrow">
<ion-icon *ngIf="profile == 'mdgpr' " (click)="changeProfile()" class="right-icons" slot="icon-only"src="assets/images/icons-profile-calendar-md.svg"></ion-icon>
<ion-icon *ngIf="profile == 'pr' " (click)="changeProfile()" class="right-icons" slot="icon-only"src="assets/images/icons-profile-calendar-pr.svg"></ion-icon>
</div>
<ion-icon (click)="viewEventsToApprove()" class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon (click)="openAddEvent()" class="right-icons" src="assets/images/icons-add-new-event.svg" ></ion-icon>
</ion-row>
</ion-row>
+17 -2
View File
@@ -19,6 +19,8 @@ import {
DAYS_OF_WEEK,
} from 'angular-calendar';
import { CustomDateFormatter } from './custom-date-formatter.provider';
import { ApproveEventModalPage } from './approve-event-modal/approve-event-modal.page';
import { EventListPage } from '../gabinete-digital/event-list/event-list.page';
@Component({
selector: 'app-agenda',
@@ -129,7 +131,6 @@ export class AgendaPage implements OnInit {
private router: Router,
private alertCrontroller: AlertService
) {
this.timelineDate = formatDate(new Date,'dd MMMM yyyy', 'pt');
setTimeout(()=>{
@@ -238,8 +239,10 @@ export class AgendaPage implements OnInit {
// Show information of the event for timeline
eventClicked({ event }: { event: CalendarEvent }): void {
console.log('Event clicked', event);
this.eventSelectedDate = event.start;
this.router.navigate(["/home/agenda", event.id, 'agenda']);
this.viewEventDetail(event.id);
/* this.router.navigate(["/home/agenda", event.id, 'agenda']); */
}
//Show information of the event
@@ -589,6 +592,18 @@ export class AgendaPage implements OnInit {
});
}
async viewEventsToApprove(){
const modal = await this.modalCtrl.create({
component: EventListPage,
componentProps:{
},
cssClass: 'modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
}
@@ -37,7 +37,7 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class">
<ion-select placeholder="Selecione agenda"
<ion-select disabled placeholder="Selecione agenda"
selectedText="{{postEvent.CalendarName}}"
[(ngModel)]="postEvent.CalendarName"
interface="action-sheet" Cancel-text="Cancelar"
@@ -56,8 +56,8 @@
</div>
<div class="ion-input-class">
<ion-select placeholder="Selecione tipo"
[(ngModel)]="postEvent.EventType"
selectedText="{{postEvent.EventType}}"
[(ngModel)]="postEvent.Categories[0]"
selectedText="{{postEvent.Categories[0]}}"
interface="action-sheet"
Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">Reunião</ion-select-option>
@@ -56,7 +56,7 @@
</div>
<div class="ion-input-class">
<ion-select placeholder="Selecione tipo"
[(ngModel)]="postEvent.EventType"
[(ngModel)]="postEvent.Categories[0]"
interface="action-sheet"
Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">Reunião</ion-select-option>
@@ -62,7 +62,7 @@ export class NewEventPage implements OnInit {
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Categories: null,
Categories: ['Reunião'],
HasAttachments: false,
};
}
@@ -83,7 +83,7 @@ export class NewEventPage implements OnInit {
AppointmentState: 0,
TimeZone: '',
Organizer: '',
Categories: null,
Categories: ['Reunião'],
HasAttachments: false,
};
}
@@ -58,7 +58,8 @@
<ion-list>
<h3>Documentos Anexados</h3>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label *ngFor="let attach of loadedAttachments">
<ion-label *ngFor="let attach of loadedAttachments"
(click)="viewDocument()">
<p class="attach-title-item">{{attach.SourceName}}</p>
<p><span class="span-left">{{attach.Stakeholders}}</span><span class="span-right">{{ attach.CreateDate | date: 'dd-MM-yy' }}</span></p>
</ion-label>
@@ -7,6 +7,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { EventsService } from 'src/app/services/events.service';
import { Event } from '../../../models/event.model';
import { EditEventPage } from '../edit-event/edit-event.page';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
selector: 'app-view-event',
@@ -39,6 +40,7 @@ export class ViewEventPage implements OnInit {
private eventsService: EventsService,
private attachmentsService: AttachmentsService,
public alertController: AlertController,
private iab: InAppBrowser,
)
{
this.profile = this.navParams.get('profile');
@@ -118,6 +120,11 @@ export class ViewEventPage implements OnInit {
}
});
}
viewDocument(){
const url: string = this.loadedAttachments.DocumentURL.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
}
+3 -1
View File
@@ -75,7 +75,9 @@
<div class="content">
<ul>
<li *ngFor = "let task of taskslist"
[routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]">
(click)="viewExpedientDetail(task.SerialNumber)">
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
>
<div class="d-flex">
<div class="schedule-date">
<div class="time-end">{{task.CreateDate | date: 'd/M/yy'}}</div>
+3 -2
View File
@@ -16,6 +16,7 @@ import { ProcessesService } from '../../services/processes.service';
import { DailyWorkTask } from '../../models/dailyworktask.model';
import { ViewEventPage } from '../agenda/view-event/view-event.page';
import { ExpedientePage } from '../gabinete-digital/expediente/expediente.page';
import { ExpedienteDetailPage } from '../gabinete-digital/expediente/expediente-detail/expediente-detail.page';
@Component({
selector: 'app-events',
@@ -317,11 +318,11 @@ export class EventsPage implements OnInit {
});
}
async viewExpedient(serialNumber:any) {
async viewExpedientDetail(serialNumber:any) {
console.log(this.profile);
const modal = await this.modalController.create({
component: ExpedientePage,
component: ExpedienteDetailPage,
componentProps:{
serialNumber: serialNumber,
profile: this.profile,
@@ -50,7 +50,7 @@
<ion-datetime
placeholder="Início"
[(ngModel)]="postData.StartDate"
displayFormat="D H:mm"
displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
min="2018"
@@ -7,12 +7,14 @@ import { IonicModule } from '@ionic/angular';
import { ExpedienteDetailPageRoutingModule } from './expediente-detail-routing.module';
import { ExpedienteDetailPage } from './expediente-detail.page';
import { SharedModule } from 'src/app/shared/shared.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SharedModule,
ExpedienteDetailPageRoutingModule
],
declarations: [ExpedienteDetailPage]
@@ -1,17 +1,21 @@
<ion-header>
<ion-toolbar class="bg-blue">
<div class="div-top-header">
<div class="div-search">
<ion-icon src='assets/images/icons-search.svg'></ion-icon>
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content">
<app-btn-modal-dismiss></app-btn-modal-dismiss>
<div class="middle">
<ion-label class="title">Detalhes do Expediente</ion-label>
</div>
<div class="div-icon">
<ion-menu-button autoHide="false">
<ion-icon name="ellipsis-vertical-outline"></ion-icon>
</ion-menu-button>
</div>
</div>
</div>
<div class="div-logo">
<img src='assets/images/logo-no-bg.png' alt='logo'>
</div>
<div class="div-profile">
<ion-icon src='assets/images/icons-profile.svg'></ion-icon>
</div>
</div>
</ion-toolbar>
</ion-toolbar>
</ion-header>
<!-- <ion-header>
<ion-toolbar class="bg-blue">
<ion-buttons slot="start">
<ion-back-button defaultHref="/expediente"></ion-back-button>
@@ -23,7 +27,7 @@
</ion-menu-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
</ion-header> -->
<ion-menu autoHide="false" side="end" content-id="main-content">
<ion-header>
@@ -80,7 +84,7 @@
<ion-label position="stacked">Data</ion-label>
<ion-input disabled="true" value=''>{{ task.CreateDate | date: 'dd-MM-yy | hh:mm'}}</ion-input>
</ion-item>
<ion-button class="btn-ok-no-width" fill="clear" color="#fff" (click)="viewDocument()" shape="round" expand="block">
<ion-button (click)="viewDocument()" class="btn-ok-no-width" fill="clear" color="#fff" shape="round" expand="block">
<ion-icon name="attach" slot="start"></ion-icon>
Ver documento
</ion-button>
@@ -121,9 +125,12 @@
<ion-list>
<div *ngIf="eventsList">
<ion-item-sliding>
<ion-item class="Rectangle" lines="none"
*ngFor="let event of eventsList"
[routerLink]="['/home/events', event.EventId, 'events']">
<ion-item
class="Rectangle" lines="none"
*ngFor="let event of eventsList"
(click)="viewEventDetail(event.EventId)"
>
<!-- [routerLink]="['/home/events', event.EventId, 'events']" -->
<div class="content-{{profile}}-{{event.CalendarName}}">
<div class="approve-event-time">
<p>{{event.StartDate | date: 'hh:mm'}}</p>
@@ -1,3 +1,82 @@
@import '~src/function.scss';
.header-toolbar{
--background:transparent;
--opacity: 1;
.main-header{
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
.header-top{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.middle{
padding: 0!important;
float: left;
width: 280px;
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
float: right;
font-size: 25px;
color: #0782c9;
margin: 5px 0 0 0;
}
}
.header-bottom{
width: 310px;
overflow: auto;
margin: 0 auto;
.header-bottom-icon{
width: 30px;
font-size: 25px;
float: left;
padding: 2px;
}
.header-bottom-contacts{
width: 275px;
font-size: 15px;
color: #797979;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
float: left;
padding: 5px;
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
float: left;
}
.div-icon{
width: 40px;
float: right;
font-size: 35px;
overflow: auto;
padding: 1px;
}
}
}
ion-item-group{
margin: 15px;
}
@@ -7,10 +7,11 @@ import { DailyWorkTask } from '../../../../models/dailyworktask.model';
import { ActivatedRoute, Router } from '@angular/router';
import { formatDate } from '@angular/common';
import { Event } from '../../../../models/event.model';
import { MenuController, ModalController } from '@ionic/angular';
import { MenuController, ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { ExpedientTaskModalPage } from '../expedient-task-modal/expedient-task-modal.page';
import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.page';
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
@Component({
selector: 'app-expediente-detail',
@@ -19,6 +20,12 @@ import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.p
})
export class ExpedienteDetailPage implements OnInit {
task: any;
fulltask:any;
eventsList: Event[];
serialnumber:string;
profile: string;
constructor(private activateRoute: ActivatedRoute,
private processes:ProcessesService,
private iab: InAppBrowser,
@@ -27,13 +34,11 @@ export class ExpedienteDetailPage implements OnInit {
private menu: MenuController,
private router:Router,
private modalController: ModalController,
private alertService: AlertService) { }
task: any;
fulltask:any;
eventsList: Event[];
serialnumber:string;
profile: string;
private navParams: NavParams,
private alertService: AlertService) {
this,this.serialnumber = this.navParams.get('serialNumber');
this,this.profile = this.navParams.get('profile');
}
ngOnInit() {
this.profile = "mdgpr";
@@ -45,6 +50,8 @@ export class ExpedienteDetailPage implements OnInit {
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
});
this.LoadTaskDetail(this.serialnumber);
this.LoadRelatedEvents(this.serialnumber);
}
@@ -127,4 +134,23 @@ export class ExpedienteDetailPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
async viewEventDetail(eventId:any) {
console.log(this.profile);
const modal = await this.modalController.create({
component: ViewEventPage,
componentProps:{
eventId: eventId,
profile: this.profile,
},
cssClass: 'modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res)=>{
if(res){
}
});
}
}
@@ -7,12 +7,14 @@ import { IonicModule } from '@ionic/angular';
import { ExpedientePageRoutingModule } from './expediente-routing.module';
import { ExpedientePage } from './expediente.page';
import { SharedModule } from 'src/app/shared/shared.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SharedModule,
ExpedientePageRoutingModule
],
declarations: [ExpedientePage],
@@ -1,22 +1,13 @@
<ion-header>
<ion-toolbar class="bg-blue">
<div class="div-top-header">
<div class="div-search">
<ion-icon src='assets/images/icons-search.svg'></ion-icon>
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content">
<app-btn-modal-dismiss></app-btn-modal-dismiss>
<div class="middle">
<ion-label class="title">Gabinete Digital</ion-label>
</div>
</div>
</div>
<div class="div-logo">
<img src='assets/images/logo-no-bg.png' alt='logo'>
</div>
<div class="div-profile">
<ion-icon src='assets/images/icons-profile.svg'></ion-icon>
</div>
</div>
</ion-toolbar>
<ion-toolbar class="bg-blue">
<ion-buttons slot="start">
<ion-back-button defaultHref="/gabinete-digital"></ion-back-button>
</ion-buttons>
<ion-title>Gabinete Digital</ion-title>
</ion-toolbar>
<ion-toolbar>
<ion-segment [(ngModel)]="segment">
@@ -55,8 +46,13 @@
</div>
</ion-item> -->
<ion-item class="expediente" lines="none" *ngFor = "let task of taskslist"
[routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]">
<ion-item
class="expediente"
lines="none"
*ngFor = "let task of taskslist"
(click)="viewExpedientDetail(task.SerialNumber)"
>
<!-- [routerLink]="['/home/gabinete-digital/expediente',task.SerialNumber]" -->
<div class="Rectangle">
<div class="exp-top-detail">
<div class="exp-date">
@@ -1,3 +1,82 @@
@import '~src/function.scss';
.header-toolbar{
--background:transparent;
--opacity: 1;
.main-header{
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
.header-top{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.middle{
padding: 0!important;
float: left;
width: 280px;
margin: 2.5px 0 0 5px;
display: flex;
align-items: center;
}
.right{
padding: 0!important;
float: right;
font-size: 25px;
color: #0782c9;
margin: 5px 0 0 0;
}
}
.header-bottom{
width: 310px;
overflow: auto;
margin: 0 auto;
.header-bottom-icon{
width: 30px;
font-size: 25px;
float: left;
padding: 2px;
}
.header-bottom-contacts{
width: 275px;
font-size: 15px;
color: #797979;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
float: left;
padding: 5px;
margin: 1px;
}
}
.title{
font-size: 25px;
overflow: auto;
float: left;
}
.div-icon{
width: 40px;
float: right;
font-size: 35px;
overflow: auto;
padding: 1px;
}
}
}
/* CONTENT */
.item-list-small{
font-size: 11px;
@@ -1,12 +1,13 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { ModalController, NavParams } from '@ionic/angular';
import { CalendarComponent } from 'ionic2-calendar';
import { DailyWorkTask } from '../../../models/dailyworktask.model';
import { ProcessesService } from 'src/app/services/processes.service';
import { formatDate } from '@angular/common';
import { LoadingService } from 'src/app/services/loading.service';
import { ModalController, NavParams } from '@ionic/angular';
import { ExpedienteDetailPage } from './expediente-detail/expediente-detail.page';
@Component({
selector: 'app-expediente',
@@ -16,6 +17,7 @@ import { LoadingService } from 'src/app/services/loading.service';
export class ExpedientePage implements OnInit {
segment:string;
profile:string;
@ViewChild(CalendarComponent) myCal: CalendarComponent;
@@ -23,10 +25,11 @@ export class ExpedientePage implements OnInit {
serialNumber:string;
constructor(
private modalCtrl: ModalController,
private processes:ProcessesService,
private modalController: ModalController,
private navParams: NavParams,
private processes:ProcessesService) {
this.serialNumber = this.navParams.get('serialNumber');
) {
this.profile = this.navParams.get('profile');
}
ngOnInit() {
@@ -61,5 +64,23 @@ export class ExpedientePage implements OnInit {
}, 2000);
}
async viewExpedientDetail(serialNumber:any) {
console.log(this.profile);
const modal = await this.modalController.create({
component: ExpedienteDetailPage,
componentProps:{
serialNumber: serialNumber,
profile: this.profile,
},
cssClass: 'modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then((res)=>{
});
}
}
@@ -49,7 +49,9 @@
<p>{{count_ev_md+count_ev_pr}} Documentos</p>
</div>
</div>
<div class="exp-card" [routerLink]="['/home/gabinete-digital/expediente']">
<div class="exp-card"
(click)="openExpedientList()"
>
<div class="exp-card-icon">
<ion-icon src="assets/images/icons-correspondencia.svg"></ion-icon>
</div>
@@ -80,7 +80,7 @@ ion-content{
.title-content{
width: 360px;
margin: 0px auto;
overflow: auto;
overflow: hidden;
padding: 0 !important;
background: #ecf8ff;
}
@@ -4,6 +4,7 @@ import { AlertService } from 'src/app/services/alert.service';
import { EventsService } from 'src/app/services/events.service';
import { ModalController } from '@ionic/angular';
import { EventListPage } from './event-list/event-list.page';
import { ExpedientePage } from './expediente/expediente.page';
@Component({
selector: 'app-gabinete-digital',
@@ -14,6 +15,7 @@ export class GabineteDigitalPage implements OnInit {
segment:string;
showLoader: boolean;
public profile:string;
constructor(
private processesbackend:ProcessesService,
@@ -41,6 +43,8 @@ export class GabineteDigitalPage implements OnInit {
count_ev_md=0;
ngOnInit() {
//Initialize profile as mdgpr
this.profile = "mdgpr";
this.LoadCounts();
/* this.eventService.getAllMdEvents.subscribe(res=>{
console.log(res);
@@ -100,4 +104,17 @@ this.processesbackend.GetActionsList().subscribe(res=>{
modal.onDidDismiss();
}
async openExpedientList(){
const modal = await this.modalController.create({
component: ExpedientePage,
componentProps:{
profile: this.profile,
},
cssClass: 'modal',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
}
+87 -42
View File
@@ -8,6 +8,14 @@ import { AlertController } from '@ionic/angular';
import { StorageService } from 'src/app/services/storage.service';
import { AuthConnstants } from 'src/app/config/auth-constants';
import { PhotoService } from 'src/app/services/photo.service';
import { NotificationsService } from 'src/app/services/notifications.service';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Token } from '../../models/token.model';
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
const { PushNotifications } = Plugins;
@Component({
@@ -23,7 +31,9 @@ export class LoginPage implements OnInit {
userattempt: User;
constructor(
private router: Router,
private http: HttpClient,
private notificatinsservice: NotificationsService,
private router: Router,
private authService: AuthService,
private storageService: StorageService,
private toastService: ToastService,
@@ -31,17 +41,17 @@ export class LoginPage implements OnInit {
public alertController: AlertController) { }
ngOnInit() {
}
//Function to validade the login inputs
validateInput(){
validateInput() {
return (
this.username.trim().length > 0
this.username.trim().length > 0
&& this.password.trim().length > 0
);
);
}
async presentAlert(message:string) {
async presentAlert(message: string) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Mensagem do sistema',
@@ -52,54 +62,89 @@ export class LoginPage implements OnInit {
await alert.present();
}
loginRocketChat(user:any){
loginRocketChat(user: any) {
let postData = {
"user": user.username,
"password": user.password,
}
this.authService.loginChat(postData).subscribe((res: any) =>{
this.authService.loginChat(postData).subscribe((res: any) => {
console.log(res.data);
this.storageService.store(AuthConnstants.AUTH, res.data);
console.log('Login to Rocket chat OK');
},(error:any) =>{
}, (error: any) => {
console.log('Network error');
this.presentAlert('Network error '+error);
this.presentAlert('Network error ' + error);
});
}
async Login(){
try {
//Go to our home in home/feed.
//this.router.navigate(['/home/events']);
if(this.validateInput()){
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)){
console.log(this.userattempt);
this.loginRocketChat(this.userattempt);
this.router.navigate(['/home/events']);
}
else
{
//this.toastService.presentToast('Não foi possível fazer login"');
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
}
storeUserIdANdToken() {
(PushNotifications as any).requestPermission().then(result => {
PushNotifications.register();
});
PushNotifications.addListener(
'registration',
(token: PushNotificationToken) => {
console.log('FIREBASE TOKEN', token.value)
this.storageService.store(this.username, token.value);
this.storageService.get(this.username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
const body = { UserId: res,
TokenId: token.value,
Status: 1,
Service: 1 };
this.http.post<Token>('https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/notifications/token', body,{headers}).subscribe(data => {
console.log('TOKEN USER MIDLE', data);
})
/*this.http.get<Token>('http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/notifications/user/'+res).subscribe(data => {
console.log('TOKEN USER MIDLE',data);
})*/
});
});
},
);
};
async Login() {
/* try { */
//Go to our home in home/feed.
//this.router.navigate(['/home/events']);
if (this.validateInput()) {
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)) {
/* this.loginRocketChat(); */
this.storeUserIdANdToken()
this.router.navigate(['/home/events']);
}
else {
//this.toastService.presentToast('Não foi possível fazer login"');
this.presentAlert('O nome de utilizador e palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar.');
}
else{
//this.toastService.presentToast('Preencha todos campos');
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
}
} catch (error) {
error
this.presentAlert('Ocorreu um erro ao fazer login. Contacte o administrador de sistema. ');
}
else {
//this.toastService.presentToast('Preencha todos campos');
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
}
/* } catch (error) {
error
this.presentAlert('Ocorreu um erro ao fazer login. Contacte o administrador de sistema. '+ error);
} */
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { NotificationsService } from './notifications.service';
describe('NotificationsService', () => {
let service: NotificationsService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(NotificationsService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+30
View File
@@ -0,0 +1,30 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { Token } from '../models/token.model';
@Injectable({
providedIn: 'root'
})
export class NotificationsService {
constructor(private http: HttpClient,) { }
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
return this.http.get<Token[]>(`${geturl}`);
}
postToken(userId, token) {
const geturl = environment.apiURL + 'notifications/token';
let data = {
UserId: userId,
TokenId: token,
Status: 1,
Service: 2
}
return this.http.post<Token[]>(`${geturl}`,data);
}
}