This commit is contained in:
tiago.kayaya
2021-09-03 15:43:38 +01:00
30 changed files with 125 additions and 724 deletions
@@ -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 = ''
}
}
}