HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/hours.komma.pro/resources/assets/js/createFilterParams.js
//get url params by name
$.urlParam = function (name) {
    var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
    return results[1] || 0;
};

//make new url by chosen begin date


// function updateQueryString(key, value) {
//     if (window.location.search.indexOf(key + '=') > -1) {
//         $current = $.urlParam(key);
//         if ($current == 0) {
//             $url = window.location.href;
//             $split = $url.split(key + '=');
//             $url = $split[0] + key + "=" + value + $split[1];
//         }
//         else {
//             $url = window.location.href.replace($current, value);
//         }
//     } else {
//         if (!window.location.search) {
//             $url = window.location.href + '?' + key + '=' + value;
//         }
//         else {
//             $url = window.location.href + '&' + key + '=' + value;
//         }
//     }
//     window.location.assign($url);
// }


$(document).on( "change", "#begin", function () {
    updateQueryString('begin', $(this).val())
});


$(document).on( "change", "#end", function () {
    updateQueryString('end', $(this).val())
});


$(document).on( "change", "select#projectWorker", function () {
    console.log("#projectWorker changed");
    updateQueryString('user', $(this).val())
});


   console.log("init FilterParams.js");