mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Add calendar timeline
This commit is contained in:
Generated
+33
@@ -3081,6 +3081,11 @@
|
|||||||
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/date-fns": {
|
||||||
|
"version": "0.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/date-fns/-/date-fns-0.0.2.tgz",
|
||||||
|
"integrity": "sha1-px0uCyq1e7jegchD5ez24WF3m4w="
|
||||||
|
},
|
||||||
"@types/glob": {
|
"@types/glob": {
|
||||||
"version": "7.1.3",
|
"version": "7.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
|
||||||
@@ -3531,6 +3536,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"angular2-calendar": {
|
||||||
|
"version": "0.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/angular2-calendar/-/angular2-calendar-0.3.7.tgz",
|
||||||
|
"integrity": "sha1-1hrZoQWNbjdrpOWs5C3QDaoNVb4=",
|
||||||
|
"requires": {
|
||||||
|
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.0",
|
||||||
|
"@types/date-fns": "0.0.2",
|
||||||
|
"calendar-utils": "0.0.35",
|
||||||
|
"date-fns": "^1.3.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ng-bootstrap/ng-bootstrap": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@ng-bootstrap/ng-bootstrap/-/ng-bootstrap-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-lPB4WdFk3s4k1OMKiZsmbxSE3r8qBFapov0HudEVi8HYkm6LBxZmWqy9I6KAC9NnhVUVIYnCixvRSNwOQvIwwA=="
|
||||||
|
},
|
||||||
|
"calendar-utils": {
|
||||||
|
"version": "0.0.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/calendar-utils/-/calendar-utils-0.0.35.tgz",
|
||||||
|
"integrity": "sha1-BqlQdhAFRFyH8YpotAMhZIkcV5s="
|
||||||
|
},
|
||||||
|
"date-fns": {
|
||||||
|
"version": "1.30.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz",
|
||||||
|
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"ansi": {
|
"ansi": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz",
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
"@ng-bootstrap/ng-bootstrap": "^9.0.1",
|
"@ng-bootstrap/ng-bootstrap": "^9.0.1",
|
||||||
"angular-calendar": "^0.28.22",
|
"angular-calendar": "^0.28.22",
|
||||||
"angular-tag-cloud-module": "^5.2.2",
|
"angular-tag-cloud-module": "^5.2.2",
|
||||||
|
"angular2-calendar": "^0.3.7",
|
||||||
"cordova-ios": "6.1.0",
|
"cordova-ios": "6.1.0",
|
||||||
"cordova-plugin-camera": "^5.0.1",
|
"cordova-plugin-camera": "^5.0.1",
|
||||||
"cordova-plugin-file": "^6.0.2",
|
"cordova-plugin-file": "^6.0.2",
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ import { PipesModule } from './pipes/pipes.module';
|
|||||||
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
|
|
||||||
import { CalendarModule, DateAdapter } from 'angular-calendar';
|
import { CalendarModule, DateAdapter } from 'angular-calendar';
|
||||||
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
||||||
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -36,7 +38,7 @@ import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
CalendarModule.forRoot({
|
CalendarModule.forRoot({
|
||||||
provide: DateAdapter,
|
provide: DateAdapter,
|
||||||
useFactory: adapterFactory,
|
useFactory: adapterFactory
|
||||||
}),
|
}),
|
||||||
IonicModule.forRoot(),
|
IonicModule.forRoot(),
|
||||||
IonicStorageModule.forRoot(),
|
IonicStorageModule.forRoot(),
|
||||||
|
|||||||
@@ -16,12 +16,20 @@ import { registerLocaleData } from '@angular/common';
|
|||||||
import localeDe from '@angular/common/locales/pt';
|
import localeDe from '@angular/common/locales/pt';
|
||||||
import { CalendarComponent } from 'src/app/components/calendar/calendar.component';
|
import { CalendarComponent } from 'src/app/components/calendar/calendar.component';
|
||||||
registerLocaleData(localeDe);
|
registerLocaleData(localeDe);
|
||||||
|
|
||||||
|
|
||||||
|
import { CalendarModule, DateAdapter } from 'angular-calendar';
|
||||||
|
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
IonicModule,
|
IonicModule,
|
||||||
/* ComponentsModule, */
|
/* ComponentsModule, */
|
||||||
|
CalendarModule.forRoot({
|
||||||
|
provide: DateAdapter,
|
||||||
|
useFactory: adapterFactory
|
||||||
|
}),
|
||||||
AgendaPageRoutingModule,
|
AgendaPageRoutingModule,
|
||||||
NgCalendarModule,
|
NgCalendarModule,
|
||||||
CalModalPageModule,
|
CalModalPageModule,
|
||||||
|
|||||||
@@ -17,20 +17,7 @@
|
|||||||
<ion-toolbar class="bg-blue">
|
<ion-toolbar class="bg-blue">
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="end">
|
<!-- <ion-segment [(ngModel)]="segment">
|
||||||
<!-- customized TOGGLE button -->
|
|
||||||
<div class="toggleBox">
|
|
||||||
<div (click)="changeProfile()" class="toggle">
|
|
||||||
<input type="checkbox">
|
|
||||||
<label for="" class="onbtn">PR</label>
|
|
||||||
<label for="" class="ofbtn">MDGPR</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ion-buttons>
|
|
||||||
<ion-title class="header-title">Agenda</ion-title>
|
|
||||||
</ion-toolbar>
|
|
||||||
<ion-toolbar>
|
|
||||||
<ion-segment [(ngModel)]="segment">
|
|
||||||
<ion-segment-button value="Combinada">
|
<ion-segment-button value="Combinada">
|
||||||
Combinada
|
Combinada
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
@@ -41,7 +28,7 @@
|
|||||||
Pessoal
|
Pessoal
|
||||||
</ion-segment-button>
|
</ion-segment-button>
|
||||||
</ion-segment>
|
</ion-segment>
|
||||||
|
-->
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</div>
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
@@ -209,6 +196,7 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ion-fab vertical="bottom" horizontal="end" slot="fixed" (click)="openCalModal()">
|
<ion-fab vertical="bottom" horizontal="end" slot="fixed" (click)="openCalModal()">
|
||||||
<ion-fab-button>
|
<ion-fab-button>
|
||||||
<ion-icon name="add" ></ion-icon>
|
<ion-icon name="add" ></ion-icon>
|
||||||
@@ -216,28 +204,35 @@
|
|||||||
</ion-fab>
|
</ion-fab>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mwl-demo-utils-calendar-header [(view)]="view" [(viewDate)]="viewDate">
|
<div *ngIf="showTimeline">
|
||||||
</mwl-demo-utils-calendar-header>
|
<mwl-demo-utils-calendar-header class="timeline"
|
||||||
|
[(view)]="view"
|
||||||
<div [ngSwitch]="view">
|
[(viewDate)]="viewDate"
|
||||||
<mwl-calendar-month-view
|
[dayStartHour]="9"
|
||||||
*ngSwitchCase="'month'"
|
[dayEndHour]="17">
|
||||||
[viewDate]="viewDate"
|
</mwl-demo-utils-calendar-header>
|
||||||
[events]="events"
|
|
||||||
>
|
<div [ngSwitch]="view">
|
||||||
</mwl-calendar-month-view>
|
<mwl-calendar-month-view
|
||||||
<mwl-calendar-week-view
|
*ngSwitchCase="'month'"
|
||||||
*ngSwitchCase="'week'"
|
[viewDate]="viewDate"
|
||||||
[viewDate]="viewDate"
|
[events]="events"
|
||||||
[events]="events"
|
>
|
||||||
>
|
</mwl-calendar-month-view>
|
||||||
</mwl-calendar-week-view>
|
<mwl-calendar-week-view
|
||||||
<mwl-calendar-day-view
|
*ngSwitchCase="'week'"
|
||||||
*ngSwitchCase="'day'"
|
[viewDate]="viewDate"
|
||||||
[viewDate]="viewDate"
|
[events]="events"
|
||||||
[events]="events"
|
>
|
||||||
>
|
</mwl-calendar-week-view>
|
||||||
</mwl-calendar-day-view>
|
<mwl-calendar-day-view
|
||||||
|
*ngSwitchCase="'day'"
|
||||||
|
[viewDate]="viewDate"
|
||||||
|
[events]="events"
|
||||||
|
>
|
||||||
|
</mwl-calendar-day-view>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
border-right: 3px solid #f05d5e;
|
border-right: 3px solid #f05d5e;
|
||||||
color: black;
|
color: black;
|
||||||
|
margin: 0px auto;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,4 +270,16 @@ label{
|
|||||||
|
|
||||||
.segment {
|
.segment {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Timeline */
|
||||||
|
|
||||||
|
.cal-hour-segment {
|
||||||
|
border-bottom: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cal-current-time-marker {
|
||||||
|
background-color: #42b9fe !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,38 +8,69 @@ import { Event } from '../../models/event.model';
|
|||||||
import { Router, NavigationEnd } from '@angular/router';
|
import { Router, NavigationEnd } from '@angular/router';
|
||||||
import { AlertService } from 'src/app/services/alert.service';
|
import { AlertService } from 'src/app/services/alert.service';
|
||||||
|
|
||||||
import { CalendarEvent, CalendarView } from 'angular-calendar';
|
// showTimeline
|
||||||
import { setHours, setMinutes } from 'date-fns';
|
import { setHours, setMinutes } from 'date-fns';
|
||||||
|
import {
|
||||||
|
CalendarDateFormatter,
|
||||||
|
CalendarEvent,
|
||||||
|
CalendarView,
|
||||||
|
DAYS_OF_WEEK,
|
||||||
|
} from 'angular-calendar';
|
||||||
|
import { CustomDateFormatter } from './custom-date-formatter.provider';
|
||||||
|
import { async } from '@angular/core/testing';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-agenda',
|
selector: 'app-agenda',
|
||||||
templateUrl: './agenda.page.html',
|
templateUrl: './agenda.page.html',
|
||||||
styleUrls: ['./agenda.page.scss'],
|
styleUrls: ['./agenda.page.scss'],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: CalendarDateFormatter,
|
||||||
|
useClass: CustomDateFormatter,
|
||||||
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class AgendaPage implements OnInit {
|
export class AgendaPage implements OnInit {
|
||||||
|
|
||||||
|
title = 'my-dream-app';
|
||||||
|
|
||||||
view: CalendarView = CalendarView.Day;
|
view: CalendarView = CalendarView.Day;
|
||||||
|
|
||||||
viewDate: Date = new Date();
|
viewDate: Date = new Date();
|
||||||
|
|
||||||
|
weekStartsOn: number = DAYS_OF_WEEK.MONDAY;
|
||||||
|
|
||||||
|
weekendDays: number[] = [DAYS_OF_WEEK.FRIDAY, DAYS_OF_WEEK.SATURDAY];
|
||||||
|
|
||||||
|
CalendarView = CalendarView;
|
||||||
|
|
||||||
|
setView(view: CalendarView) {
|
||||||
|
this.view = view;
|
||||||
|
}
|
||||||
|
|
||||||
|
showTimeline: boolean= false;
|
||||||
|
|
||||||
|
|
||||||
events: CalendarEvent[] = [
|
events: CalendarEvent[] = [
|
||||||
{
|
/* {
|
||||||
title: 'No event end date',
|
title: '123',
|
||||||
start: setHours(setMinutes(new Date(), 0), 3),
|
start: setHours(setMinutes(new Date(), 0), 3),
|
||||||
color: {
|
color: {
|
||||||
primary: 'red',
|
primary: 'red',
|
||||||
secondary: 'rellow'
|
secondary: 'yellow'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'No event end date',
|
title: '123123',
|
||||||
start: setHours(setMinutes(new Date(), 0), 5),
|
start: setHours(setMinutes(new Date(), 0), 5),
|
||||||
color: {
|
color: {
|
||||||
primary: 'red',
|
primary: 'red',
|
||||||
secondary: 'rellow'
|
secondary: 'yellow'
|
||||||
},
|
},
|
||||||
},
|
}, */
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* List of events of our calendar */
|
/* List of events of our calendar */
|
||||||
eventSource = [];
|
eventSource = [];
|
||||||
@@ -84,7 +115,14 @@ export class AgendaPage implements OnInit {
|
|||||||
private eventService: EventsService,
|
private eventService: EventsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private alertCrontroller: AlertService
|
private alertCrontroller: AlertService
|
||||||
) {}
|
) {
|
||||||
|
setTimeout(()=>{
|
||||||
|
// console.log(JSON.stringify(this.events));
|
||||||
|
// console.log(this.events);
|
||||||
|
},5000)
|
||||||
|
|
||||||
|
// console.log(setHours(setMinutes(new Date(), 0), 12))
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.profile = "mdgpr";
|
this.profile = "mdgpr";
|
||||||
@@ -165,6 +203,7 @@ export class AgendaPage implements OnInit {
|
|||||||
allDay: false,
|
allDay: false,
|
||||||
event: postEvent
|
event: postEvent
|
||||||
});
|
});
|
||||||
|
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||||
@@ -172,7 +211,8 @@ export class AgendaPage implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadRangeEvents(startTime: Date, endTime: Date){
|
loadRangeEvents(startTime: Date, endTime: Date){
|
||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
switch (this.segment)
|
switch (this.segment)
|
||||||
{
|
{
|
||||||
@@ -180,10 +220,12 @@ export class AgendaPage implements OnInit {
|
|||||||
//Inicializa o array eventSource
|
//Inicializa o array eventSource
|
||||||
this.eventSource=[];
|
this.eventSource=[];
|
||||||
if(this.profile == "mdgpr"){
|
if(this.profile == "mdgpr"){
|
||||||
this.eventService.getAllMdEvents(formatDate(startTime, 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(endTime, 'yyyy-MM-dd HH:mm:ss', 'pt')).subscribe(
|
this.eventService.getAllMdEvents(formatDate(startTime, 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(endTime, 'yyyy-MM-dd HH:mm:ss', 'pt')).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.eventsList = response;
|
this.eventsList = response;
|
||||||
|
// loop
|
||||||
this.eventsList.forEach(element => {
|
this.eventsList.forEach(element => {
|
||||||
|
|
||||||
this.eventSource.push({
|
this.eventSource.push({
|
||||||
title: element.Subject,
|
title: element.Subject,
|
||||||
startTime: new Date(element.StartDate),
|
startTime: new Date(element.StartDate),
|
||||||
@@ -191,11 +233,31 @@ export class AgendaPage implements OnInit {
|
|||||||
allDay: false,
|
allDay: false,
|
||||||
event: element
|
event: element
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let hours = formatDate(new Date(element.EndDate), 'HH', 'pt');
|
||||||
|
|
||||||
|
this.events.push({
|
||||||
|
title: element.Subject,
|
||||||
|
start: setHours(setMinutes(new Date(element.EndDate), 0), parseInt(hours)),
|
||||||
|
color: {
|
||||||
|
primary: 'red',
|
||||||
|
secondary: 'yellow'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
|
this.showTimeline = true;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.eventService.getAllPrEvents(formatDate(startTime, 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(endTime, 'yyyy-MM-dd HH:mm:ss', 'pt')).subscribe(
|
this.eventService.getAllPrEvents(formatDate(startTime, 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(endTime, 'yyyy-MM-dd HH:mm:ss', 'pt')).subscribe(
|
||||||
@@ -293,6 +355,7 @@ export class AgendaPage implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+17
-1
@@ -29,7 +29,7 @@
|
|||||||
td.monthview-current{
|
td.monthview-current{
|
||||||
color: white;
|
color: white;
|
||||||
/* border-radius: 89px; */
|
/* border-radius: 89px; */
|
||||||
background: red !important;
|
background: lightskyblue !important;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
/* display: flex; */
|
/* display: flex; */
|
||||||
@@ -56,5 +56,21 @@ td.monthview-selected {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Timeline */
|
||||||
|
|
||||||
|
.cal-hour-segment {
|
||||||
|
border-bottom: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cal-current-time-marker {
|
||||||
|
background-color: #42b9fe !important;
|
||||||
|
}
|
||||||
|
.timeline .cal-event, .cal-event{
|
||||||
|
background-color: white !important;
|
||||||
|
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.07) !important;
|
||||||
|
border: solid 1px #e9e9e9 !important;
|
||||||
|
border-left: 5px solid #ffb703 !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* angular-cli file: src/styles.css */
|
/* angular-cli file: src/styles.css */
|
||||||
@import "../node_modules/angular-calendar/css/angular-calendar.css";
|
@import "../node_modules/angular-calendar/css/angular-calendar.css";
|
||||||
Reference in New Issue
Block a user