function deleteText(text,url) { bootbox.confirm(text, function(result) { if (result) location.href=url; }); } function deleteItem(url) { deleteText("Bent u zeker?",url); } function capitaliseFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } function datePicker(name, onlyafter) { $('#'+name).datepicker({weekStart: 1}).on('changeDate', function(ev) { $('#'+name).datepicker('hide'); $('#'+name).blur(); }).on('show', function(ev) { date = $('#'+name).val(); if (date == "00-00-0000") { var d = new Date(); var month = d.getMonth()+1; var day = d.getDate(); var output = (day<10 ? '0' : '') + day + '-' + (month<10 ? '0' : '') + month + '-' + d.getFullYear(); $('#'+name).datepicker('setValue', output); } }).on('changeDate', function(ev) { if (onlyafter) { var nowTemp = new Date(); var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0); if (ev.date.valueOf() < now) { bootbox.alert("Opgelet, dit is een datum die al voorbij is!"); $('#'+name).datepicker('setValue',nowTemp.getDate()+"-"+(nowTemp.getMonth()+1)+"-"+nowTemp.getFullYear()); } } }); } function split( val ) { return val.split( /,\s*/ ); } function extractLast( term ) { return split( term ).pop(); } function ccList(id, url, prepopulate) { list[id] = { }; $("#"+id).tokenInput(url, { theme: "facebook", hintText: "CC toevoegen.", noResultsText: "Niet gevonden.", searchingText: "Zoeken...", onAdd: function (item) { list[id][item.id] = item.id; setList(id); }, onDelete: function (item) { delete list[id][item.id]; setList(id); }, prePopulate: prepopulate, resultsFormatter: function(item){ return "
  • " + "
    " + item.name + "
  • " }, }); } function ccListParticipants(id, url, prepopulate) { list[id] = {}; $("#"+id).tokenInput(url, { theme: "facebook", hintText: "CC toevoegen.", noResultsText: "Niet gevonden.", searchingText: "Zoeken...", onAdd: function (item) { list[id][item.id + "::" + item.type] = item.id + "::" + item.type; setList(id); }, onDelete: function (item) { delete list[id][item.id + "::" + item.type]; setList(id); }, prePopulate: prepopulate, resultsFormatter: function(item){ //var color = "style='background-color: #18ab18'"; var color = ""; if (item.type == "dep"){ return "
  • " + "
    " + item.name + "
  • " } else{ return "
  • " + "
    " + item.name + "
  • " } }, tokenFormatter: function(item){ if (item.type == "dep"){ return "
  • " + item.name + "

  • "; } else return "
  • " + item.name + "

  • "; } }); } function setList(id) { $("#"+id+"List").val(JSON.stringify(list[id])); } function makeFixedAction(form) { scrollAction(form); $(window).scroll(function() { scrollAction(form); }); } function scrollAction(form) { t = $(form).offset(); t = (t.top+180); s = $(window).scrollTop(); d = t-s; if (d >= 0) { $(form+" .form-fixed").addClass('fixed'); }else{ $(form+" .form-fixed").removeClass('fixed'); } } function makeFixedModalAction(form) { makeFixedAction(form); /*$(".modal-scrollable").scroll(function() { t = $(form).offset(); t = t.top; s = $(".modal-scrollable").scrollTop(); d = t-s; if (d >= 0) { $(form+" .form-actions").addClass('fixed'); }else{ $(form+" .form-actions").removeClass('fixed'); } });*/ } $(window).scroll(function(){ $(".form-action-float").stop().animate({"bottom": -($(window).scrollTop()-($(window).height()*0.5)) + "px"}, "slow" ); });