Fix create event

This commit is contained in:
Peter Maquiran
2021-09-03 12:19:21 +01:00
parent 5d4a238a57
commit 745b634123
30 changed files with 125 additions and 724 deletions
+2 -1
View File
@@ -12,13 +12,14 @@
<ion-icon class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button>
<ion-tab-button tab="gabinete-digital">
<ion-tab-button (click)="goto('/home/gabinete-digital')">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-badge color="danger" *ngIf="!p.userRole(['PR'])" >{{ documentCounterService.mdTotalDocument }}</ion-badge>
<ion-badge color="danger" *ngIf="p.userRole(['PR'])" >{{ documentCounterService.prTotalDocument }}</ion-badge>
<ion-label>Gabinete</ion-label>
</ion-tab-button>
<ion-tab-button tab="publications">
<ion-icon class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Ações</ion-label>
+3 -1
View File
@@ -82,7 +82,6 @@ export class HomePage implements OnInit {
document.querySelectorAll('ion-modal').forEach((e: any) => e.remove())
});
window['platform'] = platform
window['inactivity/function'] = () => {
@@ -97,6 +96,9 @@ export class HomePage implements OnInit {
}
goto(url) {
this.router.navigate([url])
}
refreshing() {}
+5 -4
View File
@@ -180,15 +180,15 @@
<div class="ss-timeline timeline-mobile flex-grow-1 d-md-none text-black height-100 width-100 overflow-y-auto" >
<div *ngFor="let events of TimelineMDList | keyvalue;" >
<div class="EventListBox-container" *ngIf="CalendarCurrentDay <= events.key">
<div class="day mt-10" *ngIf="shoeEventDay(events.value)">
<div class="EventListBox-container" >
<div class="day mt-10" >
{{ TimelineDayEvent(events.key)}}
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event) && showEventBox(event)">
*ngIf="viewEventMonth <= dateMonth(event) ">
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
@@ -229,7 +229,8 @@
</div>
<div *ngFor="let event of events.value" class="EventListBox" >
<div class="d-flex content-mdgpr-{{event.event.CalendarName}} mt-10 cursor-pointer item-hover" (click)="eventClicked(event)">
<div class="d-flex content-mdgpr-{{event.event.CalendarName}} mt-10 cursor-pointer item-hover" (click)="eventClicked(event)"
>
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
<div *ngIf="!event.endMany && !event.middle" class="time-start">{{event.event.StartDate | date: 'HH:mm'}}</div>
-9
View File
@@ -1069,15 +1069,6 @@ export class AgendaPage implements OnInit {
}
async showEventBox(event) {
if ( event.event.CalendarName == this.segment || this.segment == 'Combinado') {
return true
}
return false
}
shoeEventDay(events: any[]) {
-6
View File
@@ -1,15 +1,9 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { EventsPageRoutingModule } from './events-routing.module';
import { EventsPage } from './events.page';
// import { SharedModule } from 'src/app/shared/shared.module';
import { HeaderNoSearchPageModule } from 'src/app/shared/headers/header-no-search/header-no-search.module';
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { PdfViewerModule } from 'ng2-pdf-viewer';
+1 -1
View File
@@ -95,7 +95,7 @@
<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 expedienteGdStore.list"
(click)="goToExpediente(task.serialNumber)">
(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>
+1 -1
View File
@@ -351,7 +351,7 @@ export class EventsPage implements OnInit {
this.router.navigate(['/home/events', eventId, 'events']);
}
goToExpediente(SerialNumber:any){
goToExpediente(SerialNumber:any) {
if(this.loggeduser.Profile == 'MDGPR'){
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
}
+1
View File
@@ -86,6 +86,7 @@ export class LoginPage implements OnInit {
this.authService.loginChat(this.userattempt);
this.getToken();
SessionStore.setInativity(true)
this.goback()
} else {
SessionStore.delete()
+8
View File
@@ -0,0 +1,8 @@
import { ParticipantsPipe } from './participants.pipe';
describe('ParticipantsPipe', () => {
it('create an instance', () => {
const pipe = new ParticipantsPipe();
expect(pipe).toBeTruthy();
});
});
+24
View File
@@ -0,0 +1,24 @@
import { Pipe, PipeTransform } from '@angular/core';
import { EventPerson } from 'src/app/models/eventperson.model'
@Pipe({
name: 'participants'
})
export class ParticipantsPipe implements PipeTransform {
transform(EventPerson: EventPerson[]): any {
let taskParticipants = [];
let taskParticipantsCc = [];
EventPerson.forEach(e =>{
if(e.IsRequired) {
taskParticipants.push(e);
} else {
taskParticipantsCc.push(e);
}
})
return {taskParticipants, taskParticipantsCc}
}
}
+2 -1
View File
@@ -5,10 +5,11 @@ import { CustomTaskPipe } from './custom-task.pipe';
import { EventPipe } from './event.pipe';
import { PublicationPipe } from './publication.pipe';
import { ExpedienteTaskPipe } from './expediente-task.pipe';
import { ParticipantsPipe } from './participants.pipe';
@NgModule({
declarations: [FilterPipe, SearchDocumentPipe, CustomTaskPipe, EventPipe, PublicationPipe, ExpedienteTaskPipe],
declarations: [FilterPipe, SearchDocumentPipe, CustomTaskPipe, EventPipe, PublicationPipe, ExpedienteTaskPipe, ParticipantsPipe],
exports: [FilterPipe],
imports: []
})
+35 -21
View File
@@ -35,10 +35,11 @@ export class ListBoxService {
list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) {
// filter range
if(selectedDate) {
eventSource = eventSource.filter(data =>
data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') &&
data.startTime.getMonth() == selectedDate.getMonth()
data.startTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt') &&
data.endTime.toLocaleDateString('pt')>= selectedDate.toLocaleDateString('pt')
)
}
@@ -50,8 +51,6 @@ export class ListBoxService {
eventSource = this.filterProfile(eventSource, profile)
}
eventSource = this.getEventInsideRange(eventSource, rangeStartDate, randEndDate)
let newStracture:CustomCalendarEvent[];
if(profile == 'md') {
@@ -60,10 +59,10 @@ export class ListBoxService {
newStracture = this.encapsulation(eventSource, 'pr');
}
return this.display(newStracture)
return this.display(newStracture, profile, selectedDate)
}
display(list: CustomCalendarEvent[]) {
display(list: CustomCalendarEvent[], profile, selectedDate) {
let days = {};
list.forEach( (event:CustomCalendarEvent, index)=> {
@@ -75,7 +74,7 @@ export class ListBoxService {
endTime: event.end
})
const day = (((new Date (event.start)).getDate())).toString().padStart(2,'0')
const day = this.dateService.getDay(event.start)
event['manyDays'] = false
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
@@ -88,23 +87,23 @@ export class ListBoxService {
const diffDays = this.dateService.deferenceBetweenDays(endDate, startDate)
if (diffDays <= 150 && !event.event.IsAllDayEvent ) {
if (diffDays <= 150 && !event.event.IsAllDayEvent ) {
if (diffDays >= 1) {
const StartEvent = this.transForm(event, {startMany: true,endMany: false, middle: false})
const StartEvent = this.transForm(event, {startMany: true,endMany: false, middle: false, profile})
days[day].push(StartEvent)
if(this.push(event, selectedDate)) days[day].push(StartEvent)
let i = 1;
// create event between date
while (startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) {
const newDate = startDate.setDate(startDate.getDate()+ i)
let otherDays = (((new Date (newDate)).getDate())).toString().padStart(2,'0')
let otherDays = this.dateService.getDay(newDate)
event['other'] = true
@@ -119,32 +118,47 @@ export class ListBoxService {
startDate.getDate() != endDate.getDate())) {
// last push
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: false})
days[otherDays].push(EndEvent)
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: false, profile})
if(this.push(event, selectedDate)) days[otherDays].push(EndEvent)
} else {
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true})
days[otherDays].push(EndEvent)
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true, profile})
if(this.push(event, selectedDate)) days[otherDays].push(EndEvent)
}
}
} else {
days[day].push(event)
if(this.push(event, selectedDate)) days[day].push(event)
}
} else {
days[day].push(event)
if(this.push(event, selectedDate)) days[day].push(event)
}
}
days[day].push(event)
if(this.push(event, selectedDate)) days[day].push(event)
})
// remove days that haven't event
Object.entries(days).forEach(([index, value]) => {
const _value: any = value
if(_value.length == 0) {
delete days[index]
}
})
return days
}
push(event: any, selectedDate: Date) {
return new Date(event.start).getMonth() == selectedDate.getMonth()
}
encapsulation(eventsList:EventListStore[], profile): CustomCalendarEvent[] {
// remove all event
@@ -165,12 +179,12 @@ export class ListBoxService {
}
transForm(event: CustomCalendarEvent, {startMany, endMany, middle}) {
transForm(event: CustomCalendarEvent, {startMany, endMany, middle, profile}) {
return Object.assign({}, {
start: event.start,
end: event.end,
id: event.id,
profile: event,
profile: profile,
event: {
Subject: event.event.Subject,
StartDate: event.event.StartDate,
+6
View File
@@ -37,4 +37,10 @@ export class DateService {
return new Date(endTime)
}
}
getDay(date) {
return (((new Date (date)).getDate())).toString().padStart(2,'0')
}
}
+2 -2
View File
@@ -4,7 +4,7 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
import { LoginUserRespose } from '../models/user.model';
import { LoginUserRespose, UserSession } from '../models/user.model';
import { EventList } from '../models/agenda/AgendaEventList';
@@ -14,7 +14,7 @@ import { EventList } from '../models/agenda/AgendaEventList';
export class EventsService {
authheader = {};
loggeduser: LoginUserRespose;
loggeduser: UserSession;
headers: HttpHeaders;
headersPrOficial: HttpHeaders;
+22 -8
View File
@@ -14,7 +14,7 @@ import { ToastService } from '../services/toast.service';
import { Optional } from '@angular/core';
import { JsonStore } from './jsonStore.service';
import { synchro } from './socket/synchro.service';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
})
@@ -27,10 +27,11 @@ export class NotificationsService {
callbacks: {
type: string,
funx: Function
id: string
}[] = []
constructor(
private http: HttpClient,
private http: HttpClient,
private storageService: StorageService,
private modalController: ModalController,
public modalCtrl: AlertController,
@@ -51,15 +52,28 @@ export class NotificationsService {
}
registerCallback(type: string, funx: Function, object: any = {} ) {
registerCallback(type: string, funx: Function, object: any = {} ) {
this.callbacks.push({type, funx})
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
synchro.registerCallback('Notification',funx, type)
}
const id = uuidv4()
this.callbacks.push({type, funx, id})
if(!object.hasOwnProperty('desktop') && object['desktop'] != false) {
synchro.registerCallback('Notification',funx, type)
}
return id;
}
deleteCallback(id) {
this.callbacks.forEach((e, index)=>{
if(e.id == id) {
if (index > -1) {
this.callbacks.splice(index, 1);
}
}
})
}
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
@@ -12,6 +12,7 @@ import { Attachment } from 'src/app/models/attachment.model';
import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import * as moment from 'moment';
import { ParticipantsPipe } from 'src/app/pipes/participants.pipe';
@Component({
selector: 'app-edit-event',
@@ -34,8 +35,6 @@ export class EditEventPage implements OnInit {
recurringTypes = [];
selectedRecurringType: any;
public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh"));
public date: any;
public disabled = false;
public showSpinners = true;
@@ -86,19 +85,19 @@ export class EditEventPage implements OnInit {
public stepMinutes = [1, 5, 10, 15, 20, 25];
public stepSeconds = [1, 5, 10, 15, 20, 25];
private participantsPipe = new ParticipantsPipe()
constructor(
private modalController: ModalController,
private eventsService: EventsService,
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private toastService: ToastService ) {
private toastService: ToastService,
) {
}
ngOnInit() {
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence));
this.postEvent.EventRecurrence.Type = '-1'
if(!this.restoreTemporaryData()) {
// clear
@@ -111,16 +110,9 @@ export class EditEventPage implements OnInit {
}
}
// attendees list
if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{
if(e.IsRequired) {
this.taskParticipants.push(e);
} else {
this.taskParticipantsCc.push(e);
}
})
}
const result = this.participantsPipe.transform(this.postEvent.Attendees)
this.taskParticipants = result.taskParticipants
this.taskParticipantsCc = result.taskParticipantsCc
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
@@ -142,6 +134,7 @@ export class EditEventPage implements OnInit {
this.getRecurrenceTypes();
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
setTimeout(() => {
this.postEvent.EventRecurrence.Type = this.postEvent.EventRecurrence.Type.toString();
console.log( this.postEvent.EventRecurrence.Type);
@@ -250,9 +243,10 @@ export class EditEventPage implements OnInit {
if(!this.postEvent.EventRecurrence.hasOwnProperty('Type')) {
this.postEvent.EventRecurrence.Type = '-1'
} else {
}
//
if(this.postEvent.EventRecurrence.Type == undefined) {
this.postEvent.EventRecurrence.Type = '-1'
}
@@ -26,6 +26,7 @@
</ion-header>
<ion-content>
<div class="main-content">
<div class="upper-content">
<div class="content-location">
@@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HeaderNoSearchPage } from './header-no-search.page';
const routes: Routes = [
{
path: '',
component: HeaderNoSearchPage
},
{
path: 'profile',
loadChildren: () => import('./profile/profile.module').then( m => m.ProfilePageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
@@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { HeaderNoSearchPageRoutingModule } from './header-no-search-routing.module';
import { HeaderNoSearchPage } from './header-no-search.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
HeaderNoSearchPageRoutingModule
],
exports: [HeaderNoSearchPage],
declarations: [HeaderNoSearchPage]
})
export class HeaderNoSearchPageModule {}
@@ -1,69 +0,0 @@
<div class=" pb-10 ion-toolbar text-white">
<div class="mobile d-flex div-top-header justify-space-between">
<div class="div-search">
<!-- <ion-icon src='assets/images/icons-search.svg'></ion-icon> -->
</div>
<div class="div-logo height-fit-content">
<img src='assets/images/logo-no-bg.png' alt='logo'>
</div>
<div class="div-profile cursor-pointer" (click)="openProfile()">
<ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-label class="profile-text">{{loggeduser.Profile}}</ion-label>
</div>
</div>
<div class="desktop mx-20">
<div class="d-flex justify-space-between align-center">
<div tab="events" class="div-logo height-fit-content">
<img src='assets/images/logo-no-bg.png' alt='logo'>
</div>
<div class="d-flex flex-1 pr-20 pl-50">
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/events')" [class.active]="locationPathname() == '/home/events'">
<ion-icon class="font-40" src='assets/images/icons-nav-home-active.svg'></ion-icon>
<span>Início</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/agenda')" [class.active]="locationPathname() == '/home/agenda'">
<ion-icon class="font-40" src='assets/images/icons-nav-agenda-inactive.svg'></ion-icon>
<span>Agenda</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/gabinete-digital')" [class.active]="locationPathname() == '/home/gabinete-digital'">
<ion-icon class="font-40" src='assets/images/icons-nav-home-dk.svg'></ion-icon>
<span>Gabinete</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/publications')" [class.active]="locationPathname() == '/home/publications'">
<ion-icon class="font-40" src='assets/images/icons-nav-a-es-inactive.svg'></ion-icon>
<span>Acções</span>
</div>
<div class="tab mr-20 d-flex align-center cursor-pointer" (click)="changeRoute('/home/chat')" [class.active]="locationPathname() == '/home/chat'">
<ion-icon class="font-40" src='assets/images/icons-nav-grupos-inactive-dk-white.svg'></ion-icon>
<span>Chat</span>
</div>
</div>
<div class="d-flex">
<!-- <div (click)="openSearch()" class="div-search mr-10">
<ion-icon src='assets/images/icons-search.svg'></ion-icon>
</div> -->
<div class="div-profile d-flex cursor-pointer" (click)="openProfile()">
<ion-icon class="icon" src='assets/images/icons-profile.svg'></ion-icon>
<ion-label class="profile-text">{{profileLabel(loggeduser.Profile)}}</ion-label>
</div>
</div>
</div>
</div>
</div>
@@ -1,67 +0,0 @@
@import '~src/function.scss';
.div-top-header{
margin: 0 em(20px);
// background-color: #0782c9;
padding-top: em(15px);
border: 0!important;
}
.div-logo{
background: transparent;
width: em(140px);
justify-content: center;
display: flex;
}
.div-logo img{
width: 100%;
margin: 0px auto;
}
.div-profile{
width: 45px;
height: 45px;
font-size: 45px;
justify-content: flex-end;
display: flex;
background-color: transparent;
justify-content: center;
align-items: center;
overflow: hidden;
.icon{
position: relative;
border: none !important;
}
.profile-text{
font-size: 20px;
font-weight: 300;
width: fit-content;
position: absolute;
}
}
.desktop{
display: none;
}
@media only screen and (min-width: 1366px) {
.mobile{
display: none !important;
}
.desktop{
display: block;
}
}
.tab{
height: 65px;
cursor: pointer;
user-select: none;
}
.active{
border-top: 7px solid white;
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { HeaderNoSearchPage } from './header-no-search.page';
describe('HeaderNoSearchPage', () => {
let component: HeaderNoSearchPage;
let fixture: ComponentFixture<HeaderNoSearchPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HeaderNoSearchPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(HeaderNoSearchPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,85 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController } from '@ionic/angular';
import { Router } from '@angular/router';
import { LoginUserRespose } from 'src/app/models/user.model';
import { ProfilePage } from 'src/app/modals/profile/profile.page';
import { SessionStore } from 'src/app/store/session.service';
@Component({
selector: 'app-header-no-search',
templateUrl: './header-no-search.page.html',
styleUrls: ['./header-no-search.page.scss'],
})
export class HeaderNoSearchPage implements OnInit {
loggeduser: LoginUserRespose;
SessionStore = SessionStore
constructor(private modalController: ModalController,
private animationController: AnimationController,
private router: Router) {
this.loggeduser = SessionStore.user;
}
ngOnInit() {
}
async openProfile() {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: ProfilePage,
cssClass: 'model profile-modal',
componentProps: {
}
});
return await modal.present();
}
changeRoute(path){
this.router.navigateByUrl(path)
}
locationPathname(): string {
return window.location.pathname
}
profileLabel(text) {
if (text == 'MDGPR') {
return 'MD'
} else if (text=='PR') {
return text
} else {
return 'UN'
}
}
}
@@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProfileComponent } from './profile.page';
const routes: Routes = [
{
path: '',
component: ProfileComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ProfilePageRoutingModule {}
@@ -1,20 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ProfilePageRoutingModule } from './profile-routing.module';
import { ProfileComponent } from './profile.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ProfilePageRoutingModule
],
declarations: [ProfileComponent]
})
export class ProfilePageModule {}
@@ -1,82 +0,0 @@
<ion-content class=" bg-blue">
<div class="profile-content">
<div class="d-flex justify-space-between align-center">
<div class="go-back d-flex align-center" (click)="close()">
<ion-icon class="icon" src="assets/images/icons-calendar-arrow-left.svg"></ion-icon> <div>Perfil</div>
</div>
<!-- <div class="d-flex " (click)="close()">
<ion-icon class="icon" src="assets/images/icons-search-close.svg"></ion-icon>
</div> -->
</div>
<div >
<div class="d-flex align-center">
<ion-icon class="profile-pic" name="add-circle-outline"></ion-icon>
</div>
</div>
<div class="profile-info">
<div class="label-text">Dados Perfil</div>
<div class="user-role">{{loggeduser.RoleDescription}}</div>
<div class="email">{{loggeduser.Email}}</div>
</div>
<div class="login-preference" (mouseover)="checkState()" (click)="checkState()">
<div class="preference">Preferência Login</div>
<ion-row>
<ion-col class="align-center d-flex">
<div class="d-flex align-center" (click)="LoginPreferenceMethod('pin')">
<ion-checkbox [checked]="userLoginPreference=='pin' " class="checkBox" ></ion-checkbox>
PIN
</div>
</ion-col>
<ion-col class="align-center d-flex">
<div (click)="addFingerprint()" class="d-flex align-center">
<ion-checkbox class="checkBox" [checked]="false"></ion-checkbox>
Impressão Digital
</div>
</ion-col>
</ion-row>
</div>
<div class="d-flex justify-center mt-10">
<ion-buttons slot="start" class="buttonSize" (click)="logout()" >
<button class="btn-cancel buttonSize" fill="clear" style="background:#ffe0e0;" >
<ion-label style="color:#d30a0a;">Terminar sessão</ion-label>
</button>
</ion-buttons>
</div>
<div class="d-flex justify-center mt-10">
<button (click)="addPin()" class="btn-ok buttonSize" fill="clear" color="#fff" >
<ion-label>Alterar PIN</ion-label>
</button>
</div>
</div>
</ion-content>
<!-- <ion-footer class=" footer-container ion-no-border bg-blue">
<div class="d-flex justify-space-between">
<ion-buttons slot="start" (click)="close()">
<ion-button class="btn-cancel" fill="clear" color="#061b52" >
<ion-label>Cancelar</ion-label>
</ion-button>
</ion-buttons>
<ion-buttons slot="end" (click)="close()">
<ion-button class="btn-ok" fill="clear" color="#fff" >
<ion-label>Gravar</ion-label>
</ion-button>
</ion-buttons>
</div>
</ion-footer> -->
@@ -1,64 +0,0 @@
.profile-content{
padding: 20px 20px;
}
.icon{
font-size: 35px;
}
.go-back{
font-family: Roboto;
font-size: 25px;
.icon{
margin-right: 7px;
}
}
.profile-pic{
width: 200px;
height: 200px;
border-radius: 20px;
margin: 0px auto;
}
.profile-info{
.label-text{
font-size: 15px;
font-weight: bold;
color: white;
margin-bottom: 10px;
}
.user-role{
background-color: white;
border-radius: 5px;
padding: 12px;
font-family: Roboto;
font-size: 13px;
color: black;
text-align: center;
}
.email {
margin-top: 15px;
}
}
.login-preference{
margin-top: 44px;
.preference{
font-family: Roboto;
font-size: 15px;
margin-bottom: 20px;
font-weight: bold;
}
.checkBox{
margin-right: 10px;
}
}
.buttonSize {
width: 100% !important;
}
@@ -1,24 +0,0 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ProfileComponent } from './profile.page';
describe('ProfilePage', () => {
let component: ProfileComponent;
let fixture: ComponentFixture<ProfileComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ProfileComponent ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ProfileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,158 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AnimationController, ModalController } from '@ionic/angular';
import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page';
import { PinPage } from 'src/app/shared/pin/pin.page';
import { LocalstoreService } from 'src/app/store/localstore.service';
@Component({
selector: 'app-profile',
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
})
export class ProfileComponent implements OnInit {
loggeduser: LoginUserRespose;
userLoginPreference = ''
constructor(private modalController:ModalController,
private authService: AuthService,
private animationController: AnimationController,
private router: Router,
private localstoreService: LocalstoreService
) {
this.loggeduser = authService.ValidatedUser;
// console.log(this.loggeduser.RoleDescription)
this.checkState()
}
ngOnInit() {}
close() {
this.modalController.dismiss();
}
async addPin() {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: PinPage,
cssClass: 'model profile-modal',
componentProps: {
}
});
modal.present();
}
async addFingerprint() {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: FingerprintPage,
cssClass: 'model profile-modal',
componentProps: {
}
});
modal.present();
}
logout() {
// clear local storage
window.localStorage.clear();
setTimeout(()=> {
this.router.navigateByUrl('/', { replaceUrl: true });
},100)
}
LoginPreferenceMethod(type: string) {
let userData = this.localstoreService.get('UserData', {})
if (userData.hasOwnProperty('loginPreference')) {
if (userData.loginPreference != type) {
if (type) {
userData.loginPreference = type
}
} else {
userData.loginPreference = 'none'
}
} else {
userData.loginPreference = 'none'
}
this.localstoreService.set('UserData', userData)
}
checkState() {
let userData = this.localstoreService.get('UserData', {})
if (userData.hasOwnProperty('loginPreference')) {
this.userLoginPreference = userData.loginPreference
} else {
this.userLoginPreference = ''
}
}
}
+1
View File
@@ -58,6 +58,7 @@ class SessionService {
setInativity(value: boolean) {
this._user.Inactivity = value
this._user.UrlBeforeInactivity = ''
this.save()
}