Files
c-cms-legacy/public/js/plugins/schedule/editor.js
2019-12-21 18:40:01 -05:00

38 lines
1.2 KiB
JavaScript
Vendored

function initScheduleEditor(id, periode, niveau)
{
$.ajax({
type: 'GET',
url: '/api/schedule/editor/init?api_token='+api_token,
success: function (template) {
$("#"+id).html(template);
for (let pniveau = 1; pniveau <= 3; pniveau++) {
for (let pperiode = 1; pperiode <= 3; pperiode++) {
loadCourse(pniveau,pperiode);
}
}
initAutoComplete("AutoComplete");
},
error: function () {
showNotification('error','Impossible d\'initialiser l\'éditeur d\'horaire ...','top', 'center')
}
})
}
function loadTemplate(id)
{
$.get('/api/schedule/editor/init?api_token='+api_token, function ( data ) {$("#"+id).html(data);});
}
function loadCourse(periode,niveau)
{
$.ajax({
type: 'GET',
url: '/api/schedule/editor/course/'+niveau+'/'+periode+'?api_token='+api_token,
success: function (course) {
$("#container-"+niveau+"-"+periode).html(course);
},
error: function () {
showNotification('error','Impossible de charger les cours ...','top', 'center')
}
})
}