Improve agenda

This commit is contained in:
Peter Maquiran
2021-07-15 11:53:16 +01:00
parent ab298b30e8
commit 77a59e5128
7 changed files with 173 additions and 40 deletions
+2 -1
View File
@@ -19,7 +19,8 @@ module.exports = {
defaultViewport: {
width:1200,
height:1080
}
},
executablePath: ''
},
browserContext: 'default',
+1 -1
View File
@@ -14,7 +14,7 @@
<ion-progress-bar class="calendar-progress-bar" type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div>
<!-- Calendar is here -->
<div [ngSwitch]="segment">
<div class="calendar-segment-{{profile}}">
<div class="calendar-container" [style.height]="calendarHeight">
<ion-row class="ion-justify-content-between calendar-tool-tip">
+99 -11
View File
@@ -479,14 +479,22 @@ export class AgendaPage implements OnInit {
//Inicializa o array eventSource
//this.eventSource=[];
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR' ) {
this.eventService.getAllMdEvents( momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59') ).then(
(response:any) => {
// calendar
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsList = response;
// loop
@@ -532,7 +540,16 @@ export class AgendaPage implements OnInit {
(response:any) => {
// calendar
this.eventSource=[];
//this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList = response;
@@ -578,7 +595,16 @@ export class AgendaPage implements OnInit {
(response:any) => {
// calendar
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList = response;
@@ -625,7 +651,17 @@ export class AgendaPage implements OnInit {
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsListPessoal= [];
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
@@ -665,7 +701,16 @@ export class AgendaPage implements OnInit {
}
else{
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((response:any) => {
this.eventSource=[];
//this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsListPessoal = response.filter(data => data.CalendarName == "Pessoal");
this.eventsListPessoal.forEach(element => {
@@ -708,7 +753,19 @@ export class AgendaPage implements OnInit {
if(this.profile == "mdgpr" && this.loggeduser.Profile == 'MDGPR') {
this.eventService.getAllMdEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((res:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
@@ -742,7 +799,18 @@ export class AgendaPage implements OnInit {
})
} else {
this.eventService.getAllPrEvents(momentG(new Date(startTime),'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime),'yyyy-MM-dd 23:59:59')).then((res:any) => {
this.eventSource=[];
// this.eventSource=[];
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsListOficial = res.filter(data => data.CalendarName == "Oficial");
this.eventsListOficial.forEach(element => {
this.eventSource.push({
@@ -797,7 +865,15 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource= this.eventSource.filter(e => e.profile != 'md');
// clear the current month only
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'md') {
return false
}
return true
})
// loop
this.eventsList.forEach((element, eventIndex) => {
@@ -853,7 +929,13 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList.forEach((element, eventIndex) => {
@@ -909,7 +991,13 @@ export class AgendaPage implements OnInit {
this.eventsList = response;
}
this.eventSource = this.eventSource.filter(e => e.profile != 'pr');
this.eventSource = this.eventSource.filter((e)=> {
if(new Date(startTime).getTime() <= new Date(e.StartDate).getTime() &&
new Date(endTime).getTime() >= new Date(e.EndDate).getTime() && e.profile != 'pr') {
return false
}
return true
})
this.eventsList.forEach((element, eventIndex) => {
@@ -20,6 +20,7 @@ export class ViewPublicationsPage implements OnInit {
publicationList: Publication[];
item: PublicationFolder;
folderId:string;
error: any;
constructor(
private loadingController: LoadingService,
@@ -100,6 +101,15 @@ export class ViewPublicationsPage implements OnInit {
});
console.log(this.publicationList);
this.showLoader = false;
},
(error)=>{
if(error.status == '404'){
this.error = 'Sem publicações disponíveis!';
this.publicationList=null;
}
this.showLoader = false;
});
}
@@ -104,9 +104,10 @@ export class ViewPublicationsPage implements OnInit {
if(error.status == '404'){
this.error = 'Sem publicações disponíveis!';
this.publicationList=null;
this.showLoader = false;
}
this.showLoader = false;
});
}
+21
View File
@@ -1061,3 +1061,24 @@ ngx-mat-datetime-content{
}
}
}
@media only screen and (max-width: 1024px) {
.calendar-segment-mdgpr {
.calendar-pr-event-type-Oficial {
border-right: 3px solid transparent !important;
}
.calendar-pr-event-type-Pessoal {
border-bottom: 3px solid transparent !important;
}
}
.calendar-segment-pr {
.calendar-mdgpr-event-type-Pessoal {
border-top: 3px solid transparent !important;
}
.calendar-mdgpr-event-type-Oficial {
border-left: 3px solid transparent !important;
}
}
}
+34 -22
View File
@@ -4,6 +4,15 @@ import * as faker from 'faker';
faker.locale = "pt_PT";
function sleep(milliseconds) {
const date = Date.now();
let currentDate = null;
do {
currentDate = Date.now();
} while (currentDate - date < milliseconds);
}
describe('Puppeteer tests', () => {
beforeAll(async () => {
@@ -48,37 +57,39 @@ describe('Puppeteer tests', () => {
await page.waitForSelector('app-new-event')
// subject
await page.type('app-new-event .ion-item-container input', faker.commerce.productDescription() )
sleep(1000);
// Location
await page.type('app-new-event .container-div:nth-child(2) input', faker.address.state()+" "+faker.address.city() )
sleep(1000);
// Select Calendar
await page.click('app-new-event .container-div:nth-child(3) .mat-form-field-flex')
await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
// await page.click('app-new-event .container-div:nth-child(3) .mat-form-field-flex')
// await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
// await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
// select event type
await page.click('app-new-event .container-div:nth-child(4) .mat-form-field-flex')
await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
// await page.click('app-new-event .container-div:nth-child(4) .mat-form-field-flex')
// await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
// await page.click('.cdk-overlay-connected-position-bounding-box mat-option')
sleep(1000);
// select start day
await page.click('app-new-event .container-div:nth-child(5) button')
await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
await page.click('.mat-calendar-next-button')
let selectedFDay = Math.floor(Math.random()*(25-1+1)+1);
let days = await page.$$(` .mat-calendar-body-cell `)
await days[selectedFDay].click()
await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
// await page.click('app-new-event .container-div:nth-child(5) button')
// await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
// await page.click('.mat-calendar-next-button')
// let selectedFDay = Math.floor(Math.random()*(25-1+1)+1);
// let days = await page.$$(` .mat-calendar-body-cell `)
// await days[selectedFDay].click()
// await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
// select end day
await page.click('app-new-event .container-div:nth-child(6) button')
await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
await page.click('.mat-calendar-next-button')
days = await page.$$(` .mat-calendar-body-cell `)
await days[selectedFDay+1].click()
await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
// await page.click('app-new-event .container-div:nth-child(6) button')
// await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
// await page.click('.mat-calendar-next-button')
// days = await page.$$(` .mat-calendar-body-cell `)
// await days[selectedFDay+1].click()
// await page.click('.cdk-overlay-connected-position-bounding-box .actions button')
// await page.click('app-new-event .container-div:nth-child(7) .mat-form-field-flex')
// await page.waitForSelector('.cdk-overlay-connected-position-bounding-box')
@@ -90,6 +101,7 @@ describe('Puppeteer tests', () => {
// save
await page.click('app-attendee-modal ion-footer ion-buttons:nth-child(2)')
// save
sleep(4000);
let buttons = await page.$$('app-new-event ion-footer ion-buttons')
buttons[1].click()
@@ -97,7 +109,7 @@ describe('Puppeteer tests', () => {
expect(3 + 2).toBe(5);
},30000);
},60000);
});