SPARK jqxScheduler AI

Run the schedule in plain language

Search, create and understand appointments with natural language - every action is validated against real resources, statuses and dates before it touches the schedule; it never runs model output. Provider-agnostic (Claude / OpenAI / your backend); running here with an offline mock.

Search the schedule

Try:

Schedule with AI

Try:

Ask, summarize, explain, classify

Click an appointment in the scheduler above, then use Explain.

Production: drop the mock and set aiKey for a quick trial, or aiProxyUrl / aiSendRequest to keep your key on the server.

jQuery Scheduler: AI Assistant

jqxScheduler AI assistant - search, schedule, summarize and classify appointments with plain language.

A live JavaScript/jQuery example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 45 jqxScheduler demos for jQuery.

jqxScheduler API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxScheduler shows the setup step by step.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxdata.js, jqxdate.js, jqxscheduler.js, jqxscheduler.api.js, jqxdatetimeinput.js, jqxmenu.js, jqxcalendar.js, jqxtooltip.js, jqxwindow.js, jqxcheckbox.js, jqxlistbox.js, jqxdropdownlist.js, jqxnumberinput.js, jqxradiobutton.js, jqxinput.js, jqxwidgets.ai.js, jqxscheduler.ai.js.

It also loads helper scripts of this demo site, which are not part of the library: scheduler-ai-mock.js.

script.js

$(document).ready(function () {
    // the appointments are in the current week, Monday (6) to Friday (10)
    var monday = new Date(); monday.setHours(0, 0, 0, 0); monday.setDate(monday.getDate() - (monday.getDay() + 6) % 7);
    function d(day, hour, minute) { var dt = new Date(monday); dt.setDate(monday.getDate() + day - 6); dt.setHours(hour, minute || 0, 0, 0); return dt; }

    var appointments = [
        { id: 'a1', subject: 'Quarterly Review', place: 'Main hall', calendar: 'Room 1', start: d(6, 9, 0), end: d(6, 10, 30), description: 'Review Q2 numbers with leadership.', status: 'busy' },
        { id: 'a2', subject: 'Design Sync', place: '', calendar: 'Room 2', start: d(6, 11, 0), end: d(6, 12, 0), description: 'Weekly design review.', status: 'tentative' },
        { id: 'a3', subject: 'Urgent Customer Escalation', place: '', calendar: 'Room 1', start: d(7, 8, 30), end: d(7, 9, 0), description: 'Critical account at risk.', status: 'busy' },
        { id: 'a4', subject: '1:1 with Priya', place: '', calendar: 'Room 3', start: d(7, 13, 0), end: d(7, 13, 30), description: 'Monthly check-in.', status: 'free' },
        { id: 'a5', subject: 'Product Roadmap Planning', place: '', calendar: 'Room 2', start: d(8, 10, 0), end: d(8, 12, 0), description: 'Plan next quarter.', status: 'busy' },
        { id: 'a6', subject: 'Interview - Senior Engineer', place: '', calendar: 'Room 1', start: d(8, 15, 0), end: d(8, 16, 0), description: 'Onsite interview loop.', status: 'tentative' },
        { id: 'a7', subject: 'All Hands', place: '', calendar: 'Room 3', start: d(9, 9, 0), end: d(9, 10, 0), description: 'Company-wide update.', status: 'busy' },
        { id: 'a8', subject: 'Vendor Contract Review', place: '', calendar: 'Room 2', start: d(10, 14, 0), end: d(10, 15, 0), description: 'Legal + procurement.', status: 'free' }
    ];

    var source = {
        dataType: 'array',
        dataFields: [
            { name: 'id', type: 'string' }, { name: 'subject', type: 'string' }, { name: 'description', type: 'string' },
            { name: 'place', type: 'string' }, { name: 'calendar', type: 'string' },
            { name: 'start', type: 'date' }, { name: 'end', type: 'date' }, { name: 'status', type: 'string' }
        ],
        id: 'id', localData: appointments
    };
    var resourcesSource = {
        dataType: 'array',
        dataFields: [{ name: 'calendar', type: 'string' }],
        localData: [{ calendar: 'Room 1' }, { calendar: 'Room 2' }, { calendar: 'Room 3' }]
    };

    $('#scheduler').jqxScheduler({
        theme: 'tailwind', width: '100%', height: 500,
        source: new $.jqx.dataAdapter(source),
        view: 'weekView',
        views: [{ type: 'weekView', days: 7 }],
        date: new $.jqx.date(monday.getFullYear(), monday.getMonth() + 1, monday.getDate()),
        resources: { colorScheme: 'scheme05', dataField: 'calendar', source: new $.jqx.dataAdapter(resourcesSource) },
        appointmentDataFields: {
            from: 'start', to: 'end', id: 'id', description: 'description',
            location: 'place', subject: 'subject', resourceId: 'calendar', status: 'status'
        },
        aiSendRequest: jqxSchedulerAIMock,
        ready: function () {
            // the day starts at the working day
            $('#scheduler').jqxScheduler('scrollToTime', 8);
        }
    });

    function tagClass(t) {
        if (t === 'cleared') { return 'clear'; }
        if (t.indexOf('date range') === 0) { return 'sort'; }
        return 'filter';
    }
    function showResult(panel, title, body) {
        $(panel).html('<div class="ai-avatar">' + ICON.spark + '</div><div class="ai-result-body">' +
            '<div class="ai-result-title">' + title + '</div>' + body + '</div>').show();
    }
    function working(panel) {
        $(panel).html('<div class="ai-avatar">' + ICON.spark + '</div><div class="ai-result-body">' +
            '<div class="ai-result-title">Working</div><div class="ai-dots"><span></span><span></span><span></span></div></div>').show();
    }

    // ---- 1) command bar: natural language -> search filter ----
    function runCommand() {
        var q = document.getElementById('q').value;
        if (!q.trim()) { return; }
        working('#result-command');
        $('#scheduler').jqxScheduler('aiCommand', q, function (err, res) {
            if (err) { showResult('#result-command', 'Error', '<span class="ai-hint">' + err.message + '</span>'); return; }
            var applied = (res.applied && res.applied.length) ? res.applied : ['(no matching appointments)'];
            var tags = applied.map(function (t) { return '<span class="ai-tag ' + tagClass(t) + '">' + t + '</span>'; }).join('');
            showResult('#result-command', 'Applied to the schedule', '<div class="ai-tags">' + tags + '</div>');
        });
    }

    // ---- 2) schedule bar: natural language -> new appointment ----
    function runSchedule() {
        var q = document.getElementById('sq').value;
        if (!q.trim()) { return; }
        working('#result-schedule');
        $('#scheduler').jqxScheduler('aiScheduleAppointment', q, function (err, res) {
            if (err) { showResult('#result-schedule', 'Error', '<span class="ai-hint">' + err.message + '</span>'); return; }
            var a = res.appointment;
            var body = '<div class="ai-answer-text"><b>' + a.subject + '</b><br>' +
                new Date(a.from).toLocaleString() + ' &ndash; ' + new Date(a.to).toLocaleString() +
                (a.resourceId ? ('<br>Resource: ' + a.resourceId) : '') + '</div>';
            showResult('#result-schedule', 'Appointment created', body);
        });
    }

    // ---- 3) ask / summarize / explain / classify ----
    function runAsk() {
        var q = document.getElementById('aq').value;
        if (!q.trim()) { return; }
        working('#result-utility');
        $('#scheduler').jqxScheduler('aiAsk', q, function (err, res) {
            if (err) { showResult('#result-utility', 'Error', '<span class="ai-hint">' + err.message + '</span>'); return; }
            showResult('#result-utility', 'Answer', '<div class="ai-answer-text">' + res.answer + '</div>');
        });
    }
    function runSummarize() {
        working('#result-utility');
        $('#scheduler').jqxScheduler('aiSummarize', function (err, res) {
            if (err) { showResult('#result-utility', 'Error', '<span class="ai-hint">' + err.message + '</span>'); return; }
            showResult('#result-utility', 'Summary (' + res.count + ' appointments)', '<div class="ai-answer-text">' + res.summary + '</div>');
        });
    }
    function runExplain() {
        working('#result-utility');
        $('#scheduler').jqxScheduler('aiExplainAppointment', $('#scheduler').data('selectedAppointmentKey'), function (err, res) {
            if (err) { showResult('#result-utility', 'Error', '<span class="ai-hint">' + err.message + ' - click an appointment first.</span>'); return; }
            showResult('#result-utility', 'Explanation', '<div class="ai-answer-text">' + res.explanation + '</div>');
        });
    }
    function runClassify() {
        working('#result-utility');
        $('#scheduler').jqxScheduler('aiClassifyAppointments', { datafield: 'urgency', categories: ['Urgent', 'Tentative', 'Standard'] }, function (err, res) {
            if (err) { showResult('#result-utility', 'Error', '<span class="ai-hint">' + err.message + '</span>'); return; }
            showResult('#result-utility', 'Classified ' + res.written + ' appointments', '<span class="ai-hint">Open the browser console and call <code>$(\'#scheduler\').jqxScheduler(\'getAppointmentProperty\', key, \'urgency\')</code> to inspect a label.</span>');
        });
    }

    $('#scheduler').on('appointmentClick', function (event) {
        $('#scheduler').data('selectedAppointmentKey', event.args.appointment.id);
    });

    $('#run-command').jqxButton({ theme: 'tailwind', width: 96, height: 46 }).addClass('jqx-primary');
    $('#run-command').on('click', runCommand);
    $('#q').on('keydown', function (e) { if (e.keyCode === 13) { runCommand(); } });
    $('.ai-chip-btn.command').jqxButton({ theme: 'tailwind' });
    $('.ai-chip-btn.command').on('click', function () { document.getElementById('q').value = $(this).text().trim(); runCommand(); });

    $('#run-schedule').jqxButton({ theme: 'tailwind', width: 96, height: 46 }).addClass('jqx-primary');
    $('#run-schedule').on('click', runSchedule);
    $('#sq').on('keydown', function (e) { if (e.keyCode === 13) { runSchedule(); } });
    $('.ai-chip-btn.schedule').jqxButton({ theme: 'tailwind' });
    $('.ai-chip-btn.schedule').on('click', function () { document.getElementById('sq').value = $(this).text().trim(); runSchedule(); });

    $('#run-ask').jqxButton({ theme: 'tailwind', width: 96, height: 46 }).addClass('jqx-primary');
    $('#run-ask').on('click', runAsk);
    $('#aq').on('keydown', function (e) { if (e.keyCode === 13) { runAsk(); } });
    $('#run-summarize').jqxButton({ theme: 'tailwind', width: 175, height: 38 });
    $('#run-summarize').on('click', runSummarize);
    $('#run-explain').jqxButton({ theme: 'tailwind', width: 215, height: 38 });
    $('#run-explain').on('click', runExplain);
    $('#run-classify').jqxButton({ theme: 'tailwind', width: 175, height: 38 });
    $('#run-classify').on('click', runClassify);
});

var ICON = {
    spark: '<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2l1.7 4.6L18.3 8.3 13.7 10 12 14.6 10.3 10 5.7 8.3 10.3 6.6z"/></svg>',
    search: '<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4-4"/></svg>'
};
document.querySelector('.ai-badge').innerHTML = ICON.spark + ' jqxScheduler AI';
document.querySelectorAll('.ai-lead').forEach(function (el) { el.innerHTML = ICON.search; });

body.html

<div class="ai-wrap">
    <div class="ai-hero">
        <span class="ai-badge">SPARK jqxScheduler AI</span>
        <h1>Run the schedule in plain language</h1>
        <p>Search, create and understand appointments with natural language - every action is <b>validated</b> against real resources, statuses and dates before it touches the schedule; it never runs model output. Provider-agnostic (Claude / OpenAI / your backend); running here with an offline mock.</p>
    </div>

    <div class="ai-card">
        <h3 style="margin-top:0;">Search the schedule</h3>
        <div class="ai-row">
            <div class="ai-inputbar"><span class="ai-lead"></span>
                <input id="q" type="text" placeholder="e.g. 'Room 1 appointments' or 'urgent'">
            </div>
            <input type="button" id="run-command" value="Run">
        </div>
        <div class="ai-chips">
            <span class="ai-chips-label">Try:</span>
            <button class="ai-chip-btn command" type="button">Room 1</button>
            <button class="ai-chip-btn command" type="button">tentative</button>
            <button class="ai-chip-btn command" type="button">"urgent"</button>
            <button class="ai-chip-btn command" type="button">clear</button>
        </div>
        <div id="result-command" class="ai-result" style="display:none;"></div>
    </div>

    <div class="ai-card"><div id="scheduler"></div></div>

    <div class="ai-card">
        <h3 style="margin-top:0;">Schedule with AI</h3>
        <div class="ai-row">
            <div class="ai-inputbar"><span class="ai-lead"></span>
                <input id="sq" type="text" placeholder="e.g. 'Book Design Sync tomorrow at 2pm in Room 2'">
            </div>
            <input type="button" id="run-schedule" value="Run">
        </div>
        <div class="ai-chips">
            <span class="ai-chips-label">Try:</span>
            <button class="ai-chip-btn schedule" type="button">Schedule "Budget Review" tomorrow at 3pm in Room 1</button>
            <button class="ai-chip-btn schedule" type="button">Book a call with legal on Friday at 10am</button>
        </div>
        <div id="result-schedule" class="ai-result" style="display:none;"></div>
    </div>

    <div class="ai-card">
        <h3 style="margin-top:0;">Ask, summarize, explain, classify</h3>
        <div class="ai-row">
            <div class="ai-inputbar"><span class="ai-lead"></span>
                <input id="aq" type="text" placeholder="e.g. 'which resource is busiest?'">
            </div>
            <input type="button" id="run-ask" value="Ask">
        </div>
        <p class="ai-hint">Click an appointment in the scheduler above, then use Explain.</p>
        <input type="button" id="run-summarize" value="Summarize schedule">
        <input type="button" id="run-explain" value="Explain selected appointment" style="margin-left:8px;">
        <input type="button" id="run-classify" value="Classify by urgency" style="margin-left:8px;">
        <div id="result-utility" class="ai-result" style="display:none; margin-top:14px;"></div>
    </div>

    <p class="ai-foot"><strong>Production:</strong> drop the mock and set <code>aiKey</code> for a quick trial, or <code>aiProxyUrl</code> / <code>aiSendRequest</code> to keep your key on the server.</p>
</div>

Learn more

More jQuery Scheduler demos