Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148779 | Nov 4,2019 10:49 AM UTC | Jan 6,2021 01:30 PM UTC | Angular - EJ 2 | 5 |
![]() |
Tags: Schedule |
onActionBegin(args: ActionEventArgs): void {
let isEventChange: boolean = (args.requestType === 'eventChange');
if ((args.requestType === 'eventCreate' && (<Object[]>args.data).length > 0) || isEventChange) {
let eventData: { [key: string]: Object } = (isEventChange) ? args.data as { [key: string]: Object } :
args.data[0] as { [key: string]: Object };
let eventField: EventFieldsMapping = this.scheduleObj.eventFields;
let startDate: Date = eventData[eventField.startTime] as Date;
let endDate: Date = eventData[eventField.endTime] as Date;
let resourceIndex: number = [1, 2, 3].indexOf(eventData.DoctorId as number);
args.cancel = !this.isValidateTime(startDate, endDate, resourceIndex);
if (!args.cancel) {
args.cancel = !this.scheduleObj.isSlotAvailable(startDate, endDate, resourceIndex);
}
}
} |
<ejs-schedule
#scheduleObj
width="100%"
cssClass="timeline-resource-grouping"
height="650px"
[selectedDate]="selectedDate"
[group]="group"
>
<e-resources>
<e-resource
field="TaskId"
title="Category"
[dataSource]="categoryDataSource"
[allowMultiple]="allowMultiple"
name="Categories"
textField="text"
idField="id"
groupIDField="groupId"
colorField="color"
workDaysField="workDays"
startHourField="startHour"
endHourField="endHour"
>
</e-resource>
</e-resources>
<e-views>
<e-view option="TimelineDay"></e-view>
<e-view option="TimelineWeek"></e-view>
<e-view option="TimelineWorkWeek"></e-view>
<e-view option="TimelineMonth"></e-view>
<e-view option="Agenda"></e-view>
</e-views>
</ejs-schedule> |
public categoryDataSource: Object[] = [
{
text: "Nancy",
id: 1,
groupId: 1,
color: "#df5286",
startHour: "08:00",
endHour: "16:00",
workDays: [1, 2, 3, 4, 5, 6]
},
{
text: "Steven",
id: 2,
groupId: 1,
color: "#7fa900",
startHour: "10:00",
endHour: "15:00",
workDays: [1, 2, 3, 4, 5, 6]
},
{
text: "Robert",
id: 3,
groupId: 2,
color: "#ea7a57",
startHour: "12:00",
endHour: "14:00",
workDays: [1, 2, 3, 4, 5, 6]
},
{
text: "Smith",
id: 4,
groupId: 2,
color: "#5978ee",
startHour: "06:00",
endHour: "12:00",
workDays: [1, 2, 3, 4, 5, 6]
},
{
text: "Micheal",
id: 5,
groupId: 3,
color: "#df5286",
startHour: "07:00",
endHour: "18:00",
workDays: [1, 2, 3, 4, 5, 6]
},
{
text: "Root",
id: 6,
groupId: 3,
color: "#00bdae",
startHour: "08:00",
endHour: "20:00",
workDays: [1, 2, 3, 4, 5, 6]
}
]; |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.