<template>
<div>
<DxScheduler
time-zone="America/Los_Angeles"
:data-source="dataSource"
:current-date="currentDate"
:views="views"
:height="600"
:start-day-hour="9"
:first-day-of-week="1"
current-view="workWeek"
>
<DxResource
:data-source="rooms"
:use-color-as-default="currentResource === 'Room'"
field-expr="roomId"
label="Room"
icon="conferenceroomoutline"
/>
<DxResource
:data-source="priorities"
:use-color-as-default="currentResource === 'Priority'"
field-expr="priorityId"
label="Priority"
icon="tags"
/>
<DxResource
:data-source="assignees"
:use-color-as-default="currentResource === 'Assignee'"
field-expr="assigneeId"
label="Assignee"
:allow-multiple="true"
icon="user"
/>
<DxEditing>
<DxSchedulerForm>
<DxItem name="mainGroup">
<DxItem name="subjectGroup"/>
<DxItem name="dateGroup"/>
<DxItem name="repeatGroup"/>
<DxItem name="resourcesGroup">
<DxItem
:col-count="3"
:col-count-by-screen="{ xs: 3 }"
name="roomIdGroup"
>
<DxItem name="roomIdIcon"/>
<DxItem name="roomIdEditor"/>
<DxItem name="priorityIdEditor"/>
</DxItem>
<DxItem name="assigneeIdGroup"/>
</DxItem>
<DxItem name="descriptionGroup"/>
</DxItem>
<DxItem name="recurrenceGroup"/>
</DxSchedulerForm>
</DxEditing>
</DxScheduler>
<div class="options">
<div class="caption">Use colors of:</div>
<div class="option">
<DxRadioGroup
:items="resources"
:value="currentResource"
:on-value-changed="onRadioGroupValueChanged"
layout="horizontal"
/>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import DxScheduler, {
DxResource,
DxEditing,
DxForm as DxSchedulerForm,
type DxSchedulerTypes,
} from 'devextreme-vue/scheduler';
import { DxItem } from 'devextreme-vue/form';
import DxRadioGroup, { type DxRadioGroupTypes } from 'devextreme-vue/radio-group';
import {
resourcesList, data, priorities, assignees, rooms,
} from './data.ts';
const views: DxSchedulerTypes.ViewType[] = ['workWeek'];
const currentDate = new Date(2021, 3, 27);
const currentResource = ref('Assignee');
const dataSource = data;
const resources = resourcesList;
function onRadioGroupValueChanged(e: DxRadioGroupTypes.ValueChangedEvent) {
currentResource.value = e.value;
}
</script>
<style>
.options {
padding: 20px;
background-color: rgba(191, 191, 191, 0.15);
margin-top: 20px;
}
.caption {
font-size: 18px;
font-weight: 500;
}
.option {
margin-top: 10px;
display: inline-block;
}
</style>
export const resourcesList = ['Assignee', 'Room', 'Priority'];
export const data = [
{
text: 'Website Re-Design Plan',
assigneeId: [4],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-26T16:30:00.000Z'),
endDate: new Date('2021-04-26T18:30:00.000Z'),
}, {
text: 'Book Flights to San Fran for Sales Trip',
assigneeId: [2],
roomId: 2,
priorityId: 1,
startDate: new Date('2021-04-26T19:00:00.000Z'),
endDate: new Date('2021-04-26T20:00:00.000Z'),
allDay: true,
}, {
text: 'Install New Router in Dev Room',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-26T21:30:00.000Z'),
endDate: new Date('2021-04-26T22:30:00.000Z'),
}, {
text: 'Approve Personal Computer Upgrade Plan',
assigneeId: [3],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-27T17:00:00.000Z'),
endDate: new Date('2021-04-27T18:00:00.000Z'),
}, {
text: 'Final Budget Review',
assigneeId: [1],
roomId: 1,
priorityId: 1,
startDate: new Date('2021-04-27T19:00:00.000Z'),
endDate: new Date('2021-04-27T20:35:00.000Z'),
}, {
text: 'New Brochures',
assigneeId: [4],
roomId: 3,
priorityId: 2,
startDate: new Date('2021-04-27T21:30:00.000Z'),
endDate: new Date('2021-04-27T22:45:00.000Z'),
}, {
text: 'Install New Database',
assigneeId: [2],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-28T16:45:00.000Z'),
endDate: new Date('2021-04-28T18:15:00.000Z'),
}, {
text: 'Approve New Online Marketing Strategy',
assigneeId: [4],
roomId: 2,
priorityId: 1,
startDate: new Date('2021-04-28T19:00:00.000Z'),
endDate: new Date('2021-04-28T21:00:00.000Z'),
}, {
text: 'Upgrade Personal Computers',
assigneeId: [2],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-28T22:15:00.000Z'),
endDate: new Date('2021-04-28T23:30:00.000Z'),
}, {
text: 'Customer Workshop',
assigneeId: [3],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T19:00:00.000Z'),
allDay: true,
}, {
text: 'Prepare 2021 Marketing Plan',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-29T18:00:00.000Z'),
endDate: new Date('2021-04-29T20:30:00.000Z'),
}, {
text: 'Brochure Design Review',
assigneeId: [4],
roomId: 1,
priorityId: 1,
startDate: new Date('2021-04-29T21:00:00.000Z'),
endDate: new Date('2021-04-29T22:30:00.000Z'),
}, {
text: 'Create Icons for Website',
assigneeId: [3],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-30T17:00:00.000Z'),
endDate: new Date('2021-04-30T18:30:00.000Z'),
}, {
text: 'Upgrade Server Hardware',
assigneeId: [4],
roomId: 2,
priorityId: 2,
startDate: new Date('2021-04-30T21:30:00.000Z'),
endDate: new Date('2021-04-30T23:00:00.000Z'),
}, {
text: 'Submit New Website Design',
assigneeId: [1],
roomId: 1,
priorityId: 2,
startDate: new Date('2021-04-30T23:30:00.000Z'),
endDate: new Date('2021-05-01T01:00:00.000Z'),
}, {
text: 'Launch New Website',
assigneeId: [2],
roomId: 3,
priorityId: 1,
startDate: new Date('2021-04-30T19:20:00.000Z'),
endDate: new Date('2021-04-30T21:00:00.000Z'),
},
];
export const assignees = [
{
text: 'Samantha Bright',
id: 1,
color: '#C2185B',
}, {
text: 'John Heart',
id: 2,
color: '#1564C0',
}, {
text: 'Todd Hoffman',
id: 3,
color: '#2E7D32',
}, {
text: 'Sandra Johnson',
id: 4,
color: '#7B1FA2',
},
];
export const rooms = [
{
text: 'Room 1',
id: 1,
color: '#00af2c',
}, {
text: 'Room 2',
id: 2,
color: '#2E7D32',
}, {
text: 'Room 3',
id: 3,
color: '#8ecd3c',
},
];
export const priorities = [
{
text: 'High',
id: 1,
color: '#C62828',
}, {
text: 'Low',
id: 2,
color: '#DD2C00',
},
];
import { createApp } from 'vue';
import App from './App.vue';
createApp(App).mount('#app');
<!DOCTYPE html>
<html lang="en">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" />
<link rel="stylesheet" type="text/css" href="./bundle.css" />
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="app"> </div>
</div>
<script src="bundles/vendor/vue.vendor.js"></script>
<script src="./bundle.js"></script>
</body>
</html>