From 05662cf62b78a16e1dc38b11846187bff5a47809 Mon Sep 17 00:00:00 2001
From: baasje85 {% trans "Ritaanpassing" %}
{% endif %}
'+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); + } + } +} + +function check_for_active_lines(line_id, begintime, endtime) { + count = 0; + cancelledLines.filter(measure => { + if (measure.id === line_id || measure.id === null) { + if (measure.begintime === null && measure.endtime === null) { + count += 1; + } else if (measure.begintime === null && measure.endtime > begintime) { + count += 1; + } else if (measure.begintime <= begintime && measure.endtime === null) { + count += 1; + } else if (measure.begintime <= begintime && measure.endtime >= begintime) { + count += 1; + } + } + }); + return count; +} + /* TIME FUNCTIONS */ function convertSecondsToTime(seconds) { var hours = Math.floor(seconds / 3600); @@ -549,3 +622,9 @@ function padTime(i) { return '00'; } } + +function stringToTime(timestring) { + timestring = timestring.split(/:/); + var time = timestring[0] * 3600 + timestring[1] * 60; + return time; +} From 88a1c787d14c6edfe240a4134c949bf8e39e5610 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); + } + } +} + /* TIME FUNCTIONS */ function checkMessageTime(event, ui) { var starttime = parseDate($("#id_messagestarttime").val()); From e4d72a0228d9f6ffdfe911370161af5fd3769215 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); + } + } +} + + /* TIME FUNCTIONS */ function checkMessageTime(event, ui) { var starttime = parseDate($("#id_messagestarttime").val()); From f8abde4cda5d304292d2fdb81b8df088981571e9 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); + } + } + } + }); + } // TODO: else validate scenariomessage } From 7016e32d3d996f683ed29a22b65c3f75947bb143 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); - }); - if ($("#error_list").hasClass('hidden')) { - $("#error_list").removeClass('hidden'); - } + validationdata = {'messagecontent': $('#id_messagecontent').val().trim(), + 'messagetype': $("input[name='messagetype']:checked").val(), + 'haltes': $('#haltes').val()} } - */ - var pathname = window.location.pathname; - if (pathname.indexOf('scenario') == -1) { - $.ajax({url: '/bericht/validatie.json', - data: {'messagestarttime': $('#id_messagestarttime').val().trim(), - 'messageendtime': $('#id_messageendtime').val().trim(), - 'messagecontent': $('#id_messagecontent').val().trim(), - 'messagetype': $("input[name='messagetype']:checked").val(), - 'haltes': $('#haltes').val(), - }, - success : function(result) { - var validationerrors = result.object; - if (validationerrors.length == 0) { - $(".form").submit(); - } else { - if (!$("#error_list").hasClass('hidden')) { - $("#error_list").empty(); - } - $.each(validationerrors, function(i, error) { - $("#error_list").append(''+error+'
'); - }); - if ($("#error_list").hasClass('hidden')) { - $("#error_list").removeClass('hidden'); - } + $.ajax({url: '/bericht/validatie.json', + data: validationdata, + success : function(result) { + var validationerrors = result.object; + if (validationerrors.length == 0) { + $(".form").submit(); + } else { + if (!$("#error_list").hasClass('hidden')) { + $("#error_list").empty(); + } + $.each(validationerrors, function(i, error) { + $("#error_list").append(''+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); } } - }); - } // TODO: else validate scenariomessage + } + }); } From 7ba3d67491e572de901e9a8c07f81276db10d698 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); - }); - if ($("#error_list").hasClass('hidden')) { - $("#error_list").removeClass('hidden'); - } - } -} - -function check_for_active_lines(line_id, begintime, endtime) { - count = 0; - cancelledLines.filter(measure => { - if (measure.id === line_id || measure.id === null) { - if (measure.begintime === null && measure.endtime === null) { - count += 1; - } else if (measure.begintime === null && measure.endtime > begintime) { - count += 1; - } else if (measure.begintime <= begintime && measure.endtime === null) { - count += 1; - } else if (measure.begintime <= begintime && measure.endtime >= begintime) { - count += 1; + $.ajax({url: '/ritaanpassing/validatie.json', + data: {'operatingday': $('#id_operatingday').val(), + 'lines': $('#lines').val(), + 'journeys': $('#journeys').val(), + 'begintime': $('#id_begintime_part').val(), + 'endtime': $('#id_endtime_part').val(), + }, + success : function(result) { + var validationerrors = result.object; + if (validationerrors.length == 0) { + $(".form").submit(); + } else { + if (validationerrors.length == 0) { + $(".form").submit(); + } else { + if (!$("#error_list").hasClass('hidden')) { + $("#error_list").empty(); + } + $.each(validationerrors, function(i, error) { + $("#error_list").append(''+error+'
'); + }); + if ($("#error_list").hasClass('hidden')) { + $("#error_list").removeClass('hidden'); + } + } + } } - } }); - return count; } /* TIME FUNCTIONS */ From 04e3b5261968ccadb8fdd07dbe8f861129430be9 Mon Sep 17 00:00:00 2001 From: baasje85'+error+'
'); - }); - if ($("#error_list").hasClass('hidden')) { - $("#error_list").removeClass('hidden'); - } - } -} - function formValidation() { validationerrors = [] From d0c8fdb742ca5841c0a353b74b682e2df8ad375d Mon Sep 17 00:00:00 2001 From: baasje85