Skip to content

Commit 644acef

Browse files
authored
Merge branch '26_1' into 26_1_chat_main_action_button
2 parents 5e45675 + f052695 commit 644acef

15 files changed

Lines changed: 85 additions & 71 deletions

File tree

apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</dx-scheduler>
7171
<div class="options">
7272
<div class="option">
73-
<span>Overlapping Rule</span>
73+
<span>Allow Overlapping Appointments</span>
7474
<dx-select-box
7575
[items]="overlappingRuleItems"
7676
valueExpr="value"

apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export class AppComponent {
4545
assignees: Assignee[] = assignees;
4646

4747
overlappingRuleItems = [
48-
{ value: 'sameResource', text: 'Allow across resources' },
49-
{ value: 'allResources', text: 'Disallow all overlaps' },
48+
{ value: 'sameResource', text: 'Different Resources' },
49+
{ value: 'allResources', text: 'Never' },
5050
];
5151

5252
assigneeIdEditorOptions = {
@@ -163,7 +163,7 @@ export class AppComponent {
163163
);
164164
}
165165

166-
private alertConflictIfNeeded(
166+
private handleConflict(
167167
e: DxSchedulerTypes.AppointmentAddingEvent | DxSchedulerTypes.AppointmentUpdatingEvent,
168168
appointmentData: Appointment,
169169
): void {
@@ -195,11 +195,11 @@ export class AppComponent {
195195
}
196196

197197
onAppointmentAdding(e: DxSchedulerTypes.AppointmentAddingEvent): void {
198-
this.alertConflictIfNeeded(e, e.appointmentData as Appointment);
198+
this.handleConflict(e, e.appointmentData as Appointment);
199199
}
200200

201201
onAppointmentUpdating(e: DxSchedulerTypes.AppointmentUpdatingEvent): void {
202-
this.alertConflictIfNeeded(e, { ...e.oldData, ...e.newData } as Appointment);
202+
this.handleConflict(e, { ...e.oldData, ...e.newData } as Appointment);
203203
}
204204

205205
onOverlappingRuleChanged(e: DxSelectBoxTypes.ValueChangedEvent): void {

apps/demos/Demos/Scheduler/ResolveTimeConflicts/React/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const currentDate = new Date(2026, 1, 10);
2222
const views: SchedulerTypes.ViewType[] = ['day', 'week', 'workWeek', 'month'];
2323

2424
const overlappingRuleItems = [
25-
{ value: 'sameResource', text: 'Allow across resources' },
26-
{ value: 'allResources', text: 'Disallow all overlaps' },
25+
{ value: 'sameResource', text: 'Different Resources' },
26+
{ value: 'allResources', text: 'Never' },
2727
];
2828

2929
function getNextDay(date: Date): Date {
@@ -112,7 +112,7 @@ const App = () => {
112112
formRef.current?.option('elementAttr.class', show ? '' : 'hide-informer');
113113
}, []);
114114

115-
const alertConflictIfNeeded = useCallback((
115+
const handleConflict = useCallback((
116116
e: SchedulerTypes.AppointmentAddingEvent | SchedulerTypes.AppointmentUpdatingEvent,
117117
appointmentData: Appointment,
118118
) => {
@@ -144,12 +144,12 @@ const App = () => {
144144
}, [setConflictError]);
145145

146146
const onAppointmentAdding = useCallback((e: SchedulerTypes.AppointmentAddingEvent) => {
147-
alertConflictIfNeeded(e, e.appointmentData as Appointment);
148-
}, [alertConflictIfNeeded]);
147+
handleConflict(e, e.appointmentData as Appointment);
148+
}, [handleConflict]);
149149

150150
const onAppointmentUpdating = useCallback((e: SchedulerTypes.AppointmentUpdatingEvent) => {
151-
alertConflictIfNeeded(e, { ...e.oldData, ...e.newData } as Appointment);
152-
}, [alertConflictIfNeeded]);
151+
handleConflict(e, { ...e.oldData, ...e.newData } as Appointment);
152+
}, [handleConflict]);
153153

154154
const popupOptions = useMemo(() => ({
155155
onInitialized: (e: PopupTypes.InitializedEvent) => {
@@ -254,7 +254,7 @@ const App = () => {
254254

255255
<div className="options">
256256
<div className="option">
257-
<span>Overlapping Rule</span>
257+
<span>Allow Overlapping Appointments</span>
258258
<SelectBox
259259
items={overlappingRuleItems}
260260
valueExpr="value"

apps/demos/Demos/Scheduler/ResolveTimeConflicts/ReactJs/App.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { data, assignees } from './data.js';
1010
const currentDate = new Date(2026, 1, 10);
1111
const views = ['day', 'week', 'workWeek', 'month'];
1212
const overlappingRuleItems = [
13-
{ value: 'sameResource', text: 'Allow across resources' },
14-
{ value: 'allResources', text: 'Disallow all overlaps' },
13+
{ value: 'sameResource', text: 'Different Resources' },
14+
{ value: 'allResources', text: 'Never' },
1515
];
1616
function getNextDay(date) {
1717
const next = new Date(date);
@@ -80,7 +80,7 @@ const App = () => {
8080
showConflictErrorRef.current = show;
8181
formRef.current?.option('elementAttr.class', show ? '' : 'hide-informer');
8282
}, []);
83-
const alertConflictIfNeeded = useCallback(
83+
const handleConflict = useCallback(
8484
(e, appointmentData) => {
8585
if (!detectConflict(e.component, appointmentData, overlappingRuleRef.current)) {
8686
setConflictError(false);
@@ -113,15 +113,15 @@ const App = () => {
113113
);
114114
const onAppointmentAdding = useCallback(
115115
(e) => {
116-
alertConflictIfNeeded(e, e.appointmentData);
116+
handleConflict(e, e.appointmentData);
117117
},
118-
[alertConflictIfNeeded],
118+
[handleConflict],
119119
);
120120
const onAppointmentUpdating = useCallback(
121121
(e) => {
122-
alertConflictIfNeeded(e, { ...e.oldData, ...e.newData });
122+
handleConflict(e, { ...e.oldData, ...e.newData });
123123
},
124-
[alertConflictIfNeeded],
124+
[handleConflict],
125125
);
126126
const popupOptions = useMemo(
127127
() => ({
@@ -238,7 +238,7 @@ const App = () => {
238238

239239
<div className="options">
240240
<div className="option">
241-
<span>Overlapping Rule</span>
241+
<span>Allow Overlapping Appointments</span>
242242
<SelectBox
243243
items={overlappingRuleItems}
244244
valueExpr="value"

apps/demos/Demos/Scheduler/ResolveTimeConflicts/Vue/App.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272

7373
<div class="options">
7474
<div class="option">
75-
<span>Overlapping Rule</span>
75+
<span>Allow Overlapping Appointments</span>
7676
<DxSelectBox
7777
:items="overlappingRuleItems"
7878
value-expr="value"
@@ -114,8 +114,8 @@ const views: DxSchedulerTypes.ViewType[] = ['day', 'week', 'workWeek', 'month'];
114114
const formElementAttr = { class: 'hide-informer', id: 'form' };
115115
116116
const overlappingRuleItems = [
117-
{ value: 'sameResource', text: 'Allow across resources' },
118-
{ value: 'allResources', text: 'Disallow all overlaps' },
117+
{ value: 'sameResource', text: 'Different Resources' },
118+
{ value: 'allResources', text: 'Never' },
119119
];
120120
121121
function getNextDay(date: Date): Date {
@@ -189,7 +189,7 @@ const popupOptions = {
189189
},
190190
};
191191
192-
const alertConflictIfNeeded = (
192+
const handleConflict = (
193193
e: DxSchedulerTypes.AppointmentAddingEvent | DxSchedulerTypes.AppointmentUpdatingEvent,
194194
appointmentData: Appointment,
195195
) => {
@@ -221,11 +221,11 @@ const alertConflictIfNeeded = (
221221
};
222222
223223
const onAppointmentAdding = (e: DxSchedulerTypes.AppointmentAddingEvent) => {
224-
alertConflictIfNeeded(e, e.appointmentData as Appointment);
224+
handleConflict(e, e.appointmentData as Appointment);
225225
};
226226
227227
const onAppointmentUpdating = (e: DxSchedulerTypes.AppointmentUpdatingEvent) => {
228-
alertConflictIfNeeded(e, { ...e.oldData, ...e.newData } as Appointment);
228+
handleConflict(e, { ...e.oldData, ...e.newData } as Appointment);
229229
};
230230
231231
const onFormInitialized = (e: DxFormTypes.InitializedEvent) => {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
This example prevents appointment time conflicts in DevExtreme Scheduler. Use the **Allow Overlapping Appointments** select-box to select a time conflict resolution mode.
2+
<!--split-->
3+
4+
### Detect Conflicts
5+
6+
Handle the [onAppointmentAdding](/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/#onAppointmentAdding) and [onAppointmentUpdating](/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/#onAppointmentUpdating) events to check if a new or updated appointment creates a time conflict. Set `e.cancel = true` to block the operation if necessary.
7+
8+
Call [getOccurrences](/Documentation/ApiReference/UI_Components/dxScheduler/Methods/#getOccurrences) to expand [recurring appointments](/Documentation/Guide/UI_Components/Scheduler/Appointments/Appointment_Types/#Recurring_Appointments) into individual occurrences within the target range. Check for overlapping time ranges.
9+
10+
### Conflict Detection Modes
11+
12+
The demo supports two modes:
13+
14+
- **Different Resources**: appointments assigned to different resources (assignees) can overlap.
15+
- **Never**: overlapping appointments are not allowed, regardless of resource assignment.
16+
17+
To implement resource-aware checks, access appointments and compare their `assigneeId` field values.
18+
19+
### Display Errors
20+
21+
When a conflict is detected, the demo displays the error in the following ways:
22+
23+
- A message box.
24+
- An inline validation message (if an appointment edit form is active).
25+
26+
To display inline validation, configure a custom form item inside [editing.form](/Documentation/ApiReference/UI_Components/dxScheduler/Configuration/editing/form/) and use the `customizeItem` function to attach custom `validationRules` to the time editors.

apps/demos/Demos/Scheduler/ResolveTimeConflicts/jQuery/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div id="scheduler"></div>
1919
<div class="options">
2020
<div class="option">
21-
<span>Overlapping Rule</span>
21+
<span>Allow Overlapping Appointments</span>
2222
<div id="overlapping-rule"></div>
2323
</div>
2424
</div>

apps/demos/Demos/Scheduler/ResolveTimeConflicts/jQuery/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ $(() => {
109109
},
110110
},
111111
onAppointmentAdding(e) {
112-
alertConflictIfNeeded(e, e.appointmentData);
112+
handleConflict(e, e.appointmentData);
113113
},
114114
onAppointmentUpdating(e) {
115-
alertConflictIfNeeded(e, e.newData);
115+
handleConflict(e, e.newData);
116116
},
117117
}).dxScheduler('instance');
118118

@@ -121,7 +121,7 @@ $(() => {
121121
form?.option('elementAttr.class', show ? '' : 'hide-informer');
122122
}
123123

124-
function alertConflictIfNeeded(e, appointmentData) {
124+
function handleConflict(e, appointmentData) {
125125
if (!detectConflict(appointmentData)) {
126126
setConflictError(false);
127127
return;
@@ -198,8 +198,8 @@ $(() => {
198198

199199
$('#overlapping-rule').dxSelectBox({
200200
items: [
201-
{ value: 'sameResource', text: 'Allow across resources' },
202-
{ value: 'allResources', text: 'Disallow all overlaps' },
201+
{ value: 'sameResource', text: 'Different Resources' },
202+
{ value: 'allResources', text: 'Never' },
203203
],
204204
valueExpr: 'value',
205205
displayExpr: 'text',
1.07 KB
Loading
1.4 KB
Loading

0 commit comments

Comments
 (0)