Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
secondary: '#D1E8FF'
},
yellow: {
primary: '#e3bc08',
secondary: '#FDF1BA'
}
};
@Component({
selector: 'app-home',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './schedule.component.html',
styleUrls: ['./schedule.component.scss']
})
export class ScheduleComponent implements OnInit, AfterViewInit, OnDestroy {
view: CalendarView = CalendarView.Day;
CalendarView = CalendarView;
refresh: Subject = new Subject();
viewDate: Date = new Date();
events: CalendarEvent[] = [];
minHour = 8;
maxHour = 20;
constructor(private storageService: StorageService) {
}
ngOnInit() {
const calendarEvents = this.storageService.getItem('inception.calendar');
if (!isEmpty(calendarEvents)) {
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < calendarEvents.length; i++) {
MatDialogModule,
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatListModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSidenavModule,
MatToolbarModule,
MatTooltipModule,
ReactiveFormsModule,
OwlDateTimeModule,
OwlNativeDateTimeModule,
// angular-calendar stuff
CommonModule,
CalendarModule.forRoot({
provide: DateAdapter,
useFactory: adapterFactory
})
],
entryComponents: [
CalendarEditorDialogComponent,
CalendarSettingsDialogComponent,
ColorSelectorDialogComponent,
DeleteConfirmationDialogComponent,
EventEditorDialogComponent,
ImportDialogComponent,
],
providers: [
CalendarService,
],
bootstrap: [CalendarAppComponent]
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None, // hack to get the styles to apply locally
templateUrl: 'template.html',
// you should really include this CSS in your global stylesheet
styles: [
`
.my-custom-class span {
color: #ff3d7f !important;
}
`
]
})
export class DemoComponent {
view: CalendarView = CalendarView.Month;
viewDate: Date = new Date();
events: CalendarEvent[] = [
{
title: 'Has custom class',
color: colors.yellow,
start: new Date(),
cssClass: 'my-custom-class'
}
];
}
// weekStartsOn option is ignored when using moment, as it needs to be configured globally for the moment locale
moment.updateLocale('en', {
week: {
dow: DAYS_OF_WEEK.MONDAY,
doy: 0
}
});
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html'
})
export class DemoComponent {
view: CalendarView = CalendarView.Month;
viewDate: Date = new Date();
events: CalendarEvent[] = [];
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
providers: [{
provide: CalendarDateFormatter,
useClass: SchedulerDateFormatter
}]
})
export class AppComponent implements OnInit {
title = 'Angular Calendar Scheduler Demo';
CalendarView = CalendarView;
view: CalendarView = CalendarView.Week;
viewDate: Date = new Date();
refresh: Subject = new Subject();
locale: string = 'en';
weekStartsOn: number = 1;
startsWithToday: boolean = true;
activeDayIsOpen: boolean = true;
excludeDays: number[] = []; // [0];
dayStartHour: number = 6;
dayEndHour: number = 22;
minDate: Date = new Date();
maxDate: Date = endOfDay(addMonths(new Date(), 1));
dayModifier: Function;
hourModifier: Function;
segmentModifier: Function;
eventModifier: Function;
import { Subject } from 'rxjs';
import { addDays } from 'date-fns';
import {
CalendarEvent,
CalendarEventTimesChangedEvent,
CalendarView
} from 'angular-calendar';
import { colors } from '../demo-utils/colors';
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html'
})
export class DemoComponent {
view: CalendarView = CalendarView.Week;
viewDate: Date = new Date();
events: CalendarEvent[] = [
{
title: 'Resizable event',
color: colors.yellow,
start: new Date(),
end: addDays(new Date(), 1), // an end date is always required for resizable events to work
resizable: {
beforeStart: true, // this allows you to configure the sides the event is resizable from
afterEnd: true
}
},
{
title: 'A non resizable event',
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { CalendarEvent, CalendarView, DAYS_OF_WEEK } from 'angular-calendar';
import moment from 'moment';
// weekStartsOn option is ignored when using moment, as it needs to be configured globally for the moment locale
moment.updateLocale('en', {
week: {
dow: DAYS_OF_WEEK.MONDAY,
doy: 0
}
});
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html'
})
export class DemoComponent {
view: CalendarView = CalendarView.Month;
viewDate: Date = new Date();
events: CalendarEvent[] = [];
}
title: 'One day excluded event',
color: colors.red,
allDay: true
},
{
start: new Date('2016-01-01'),
end: new Date('2016-01-09'),
title: 'Multiple weeks event',
allDay: true
}
];
// exclude weekends
excludeDays: number[] = [0, 6];
weekStartsOn = DAYS_OF_WEEK.SUNDAY;
CalendarView = CalendarView;
}
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { CalendarEvent, CalendarView } from 'angular-calendar';
import { colors } from '../demo-utils/colors';
@Component({
selector: 'mwl-demo-component',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: 'template.html'
})
export class DemoComponent {
view: CalendarView = CalendarView.Month;
viewDate: Date = new Date();
events: CalendarEvent[] = [
{
title: 'Editable event',
color: colors.yellow,
start: new Date(),
actions: [
{
label: '<i class="fa fa-fw fa-pencil"></i>',
onClick: ({ event }: { event: CalendarEvent }): void => {
console.log('Edit event', event);
}
}
]
}
};
@Component({
selector: 'app-calendar',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './calendar.component.html',
styleUrls: ['./calendar.component.css'],
encapsulation: ViewEncapsulation.None
})
export class CalendarComponent implements OnInit {
private appointmentId: string;
@ViewChild('modalContent', {static: false}) modalContent: TemplateRef;
view: CalendarView = CalendarView.Month;
CalendarView = CalendarView;
viewDate: Date = new Date();
actions: CalendarEventAction[] = [];
refresh: Subject = new Subject();
events: CalendarEvent[] = [];
activeDayIsOpen = false;
constructor(private modal: NgbModal, private appointmentService: AppointmentService, private router: Router
, private doctorAuthService: DoctorAuthService) {
}
ngOnInit() {
this.appointmentService.getAppointmentListByDoctorId().subscribe(res => {
res.forEach((appointment) => {
let timeEpisode = new Date(appointment.startDateTime);
this.events.push({