ఈ గైడ్ సమావేశ గదులను బుక్ చేయడానికి ఒక క్యాలెండర్‌ను తయారు చేస్తుంది: ప్రతి గదికీ ఒక వరుస ఉండే టైమ్‌లైన్, లాగి సరైన చోట పెట్టగల బుకింగ్‌లు, ఒకే గది రెండుసార్లు బుక్ కాకుండా చూసే నియమం, బుకింగ్‌ను ఏ క్యాలెండర్‌లోనైనా చేర్చే ఫైల్. ఇది @needless-ui/angular లోని షెడ్యూలర్‌ను వాడుతుంది; మొత్తం Needless UI లాగే అదీ MIT లైసెన్స్ కింద ఉంది, కాబట్టి రిసోర్స్ టైమ్‌లైన్ ఏ యాప్‌కైనా ఉచితం.

గదులు, బుకింగ్‌లు

గదులు రిసోర్స్‌లు: ఒక id, ఒక title, మిగతా ఏదైనా data లో. బుకింగ్‌లు 2026-10-23T09:00 లాంటి సాదా ISO సమయాలతో ఉండే ఈవెంట్‌లు; వాటి గది id resource లో ఉంటుంది. ఒక బుకింగ్‌కు అనేక గదులను, లేదా వ్యక్తులను, జాబితాగా ఇవ్వవచ్చు.

ప్రతి గదికీ ఒక వరుస

రెండింటినీ view="timeline" తో nui-scheduler కు పంపండి. dayStart, dayEnd రోజును గదులు తెరిచి ఉండే గంటలకే పరిమితం చేస్తాయి, snapMinutes బుకింగ్‌లను పావుగంట చొప్పున కదిలిస్తుంది, businessHours గదులు మూసి ఉండే సమయాన్ని మసకగా చూపిస్తుంది. nuiSchedulerResource ప్రతి వరుస హెడర్‌ను గీస్తుంది.

booking.html
<nui-scheduler
[events]="bookings()"
[resources]="rooms"
view="timeline"
dayStart="8"
dayEnd="19"
snapMinutes="15"
[businessHours]="hours"
editable
selectable
[allow]="free"
(slotSelect)="book($event)"
(eventChange)="move($event)"
(rangeChange)="range.set($event)"
>
<ng-template nuiSchedulerResource let-room>{{ room.title }}</ng-template>
</nui-scheduler>
<button nuiButton type="button" (click)="download()">Add to calendar</button>

బుక్ చేయండి, కదిలించండి

షెడ్యూలర్ మీ డేటాను తనంతట తానే ఎప్పుడూ మార్చదు: యూజర్‌లు ఏం చేశారో తెలియజేస్తుంది. గది వరుస మీదుగా లాగితే సమయం ఎంపికవుతుంది, దాన్ని గదితో సహా slotSelect తెలియజేస్తుంది. బుకింగ్‌ను గానీ దాని చివరి అంచును గానీ లాగితే, దాని కొత్త సమయాలను eventChange తెలియజేస్తుంది; వేరే గదికి కదిలితే కొత్త గదిని కూడా. సిగ్నల్‌ను అప్‌డేట్ చేయండి, టైమ్‌లైన్ దాన్ని అనుసరిస్తుంది.

booking.ts
import { Component, signal } from '@angular/core';
import { NuiButton } from '@needless-ui/angular/button';
import {
NuiScheduler,
type NuiSchedulerChange,
type NuiSchedulerEvent,
NuiSchedulerResourceTemplate,
type NuiSchedulerSlot,
} from '@needless-ui/angular/scheduler';
import { downloadIcs } from './booking-ics';

@Component({
selector: 'app-bookings',
imports: [NuiButton, NuiScheduler, NuiSchedulerResourceTemplate],
templateUrl: './booking.html',
})
export class Bookings {
/** Rooms are resources; bookings are events, with their room in `resource`. */
protected readonly rooms = [
{ id: 'atlas', title: 'Atlas' },
{ id: 'boreal', title: 'Boreal' },
];
protected readonly bookings = signal<NuiSchedulerEvent[]>([]);
/** Open on weekdays from 8:00 to 19:00: other time is shaded. */
protected readonly hours = [{ days: [1, 2, 3, 4, 5], start: '08:00', end: '19:00' }];
/** The days on screen: load their bookings when it changes. */
protected readonly range = signal<{ start: string; end: string } | null>(null);

protected book({ start, end, resource }: NuiSchedulerSlot): void {
const booking = { id: crypto.randomUUID(), title: 'New booking', start, end, resource };
this.bookings.update((all) => [...all, booking]);
}

protected move({ event, start, end, resource }: NuiSchedulerChange): void {
this.bookings.update((all) =>
all.map((b) =>
b.id === event.id ? { ...b, start, end, resource: resource ?? b.resource } : b,
),
);
}

/** A room holds one booking at a time. */
protected readonly free = (time: NuiSchedulerChange | NuiSchedulerSlot): boolean => {
const id = 'event' in time ? time.event.id : null;
const room = 'event' in time ? (time.resource ?? time.event.resource) : time.resource;
return !this.bookings().some(
(b) => b.id !== id && b.resource === room && b.start < time.end && b.end > time.start,
);
};

protected download(): void {
downloadIcs(this.bookings(), 'bookings');
}
}

డబుల్ బుకింగ్‌లు ఉండవు

బుకింగ్ చేసే ముందు, కదిలించే ముందు షెడ్యూలర్ allow ను అడుగుతుంది. అది false ఇస్తే, లాగుతున్నది ఎరుపులో కనిపిస్తుంది, వదిలినా ఏమీ జరగదు; కీబోర్డ్‌తో అయితే, ఆ సమయం అందుబాటులో లేదని షెడ్యూలర్ చెబుతుంది. ఉదాహరణ ఆ గది ఇతర బుకింగ్‌లను తనిఖీ చేస్తుంది; తుది నిర్ణయం మీ సర్వర్‌దే, కాబట్టి అక్కడ మళ్లీ తనిఖీ చేయండి.

స్క్రీన్‌పై ఉన్న రోజులను లోడ్ చేయండి

rangeChange చూపించే మొదటి, చివరి రోజులను తెలియజేస్తుంది: మొదట్లో ఒకసారి, యూజర్‌లు పేజీ మార్చిన ప్రతిసారీ మళ్లీ. కాబట్టి ఆ బుకింగ్‌లను మాత్రమే httpResource తో గానీ మీకు నచ్చిన ఏ రిక్వెస్ట్‌తో గానీ తెచ్చుకోవచ్చు.

క్యాలెండర్‌కు జోడించండి

nuiSchedulerToIcs() బుకింగ్‌లను iCalendar ఫైల్‌గా రాస్తుంది; Google Calendar, Outlook, Apple Calendar దాన్ని ఇంపోర్ట్ చేస్తాయి. nuiSchedulerFromIcs() అలాంటి ఫైల్‌ను తిరిగి చదువుతుంది, ఇతర టైమ్ జోన్‌ల సమయాలను యూజర్ టైమ్ జోన్‌కు మారుస్తుంది.

booking-ics.ts
import { type NuiSchedulerEvent, nuiSchedulerToIcs } from '@needless-ui/angular/scheduler';

/** Saves events as an .ics file, which Google Calendar, Outlook and Apple Calendar import. */
export function downloadIcs(events: readonly NuiSchedulerEvent[], name: string): void {
const file = new Blob([nuiSchedulerToIcs(events, { name })], { type: 'text/calendar' });
const link = document.createElement('a');
link.href = URL.createObjectURL(file);
link.download = `${name}.ics`;
link.click();
URL.revokeObjectURL(link.href);
}

కీబోర్డ్, స్క్రీన్ రీడర్‌లు

ఇదంతా మౌస్ లేకుండానే పనిచేస్తుంది. టైమ్‌లైన్ ఒకే ట్యాబ్ స్టాప్: బాణం కీలు సమయాలు, గదుల మధ్య కదులుతాయి, Shift తో బాణాలు సమయాన్ని ఎంచుకుంటాయి, Enter దాన్ని బుక్ చేస్తుంది. బుకింగ్‌పై, Alt తో బాణాలు దాన్ని వేరే సమయానికి లేదా గదికి కదిలిస్తాయి. ప్రతి బుకింగ్ దాని టైటిల్, గది, రోజు, సమయమే పేరుగా ఉన్న బటన్.

ఒక రోజులో పక్కపక్కనే గదులు, పునరావృత బుకింగ్‌లు, మిగతా అన్ని ఆప్షన్‌ల కోసం షెడ్యూలర్ పేజీ, దాని API చూడండి.