64 lines
1.6 KiB
JavaScript
64 lines
1.6 KiB
JavaScript
(function(context,$) {
|
|
|
|
"use strict";
|
|
context.JK = context.JK || {};
|
|
context.JK.RsvpCreateSlotDialog = function(app, sessionId, instrumentIds, rsvpRequesterName, createSlotsCallback) {
|
|
var EVENTS = context.JK.EVENTS;
|
|
var logger = context.JK.logger;
|
|
var rest = context.JK.Rest();
|
|
var $dialog = null;
|
|
var dialogId = 'rsvp-create-slot-dialog';
|
|
var $btnSave = null;
|
|
|
|
function beforeShow(data) {
|
|
}
|
|
|
|
function afterShow(data) {
|
|
var instructions = "All RSVP slots for the instruments below have already been filled. Would you like to open up a new RSVP slot for " + rsvpRequesterName + " so that they can join your session too?";
|
|
var instruments = instrumentIds.join("<br/>");
|
|
|
|
$('.instructions', $dialog).html(instructions);
|
|
$('.instruments', $dialog).html(instruments);
|
|
}
|
|
|
|
function afterHide() {
|
|
}
|
|
|
|
function showDialog() {
|
|
return app.layout.showDialog(dialogId);
|
|
}
|
|
|
|
function events() {
|
|
$btnSave.unbind('click');
|
|
$btnSave.click(function(e) {
|
|
e.preventDefault();
|
|
|
|
if (createSlotsCallback) {
|
|
createSlotsCallback();
|
|
app.layout.closeDialog(dialogId);
|
|
}
|
|
});
|
|
}
|
|
|
|
function initialize() {
|
|
|
|
var dialogBindings = {
|
|
'beforeShow' : beforeShow,
|
|
'afterShow' : afterShow,
|
|
'afterHide': afterHide
|
|
};
|
|
|
|
app.bindDialog(dialogId, dialogBindings);
|
|
|
|
$dialog = $('[layout-id="' + dialogId + '"]');
|
|
$btnSave = $dialog.find('.btnSave');
|
|
|
|
events();
|
|
}
|
|
|
|
this.initialize = initialize;
|
|
this.showDialog = showDialog;
|
|
}
|
|
|
|
return this;
|
|
})(window,jQuery); |