console.log("ADMIN SCRIPT");

if(document.getElementById("dateForm") && document.getElementById("searchForm")){
    var uzivateleBtn = document.querySelector
    var dateForm = document.getElementById("dateForm");
    var searchForm = document.getElementById("searchForm");
    var deleteDateButton = document.getElementById("deleteDateButton");
    var sluzbaTyp = document.getElementById("sluzbaTyp").value;
    var selectPage;
    switch (sluzbaTyp) {
        case "kadeřnictví":
            selectPage = "kadernictvi.php"
            break;
        case "kosmetika":
            selectPage = "kosmetika.php"
            break;
        case "manikúra":
            selectPage = "manikura.php"
            break;
        case "pedikúra":
            selectPage = "pedikura.php"
            break;
    }
    console.log(sluzbaTyp);
    document.getElementById("dateFormSubmit").addEventListener("change", function () {
        var vybraneDatum = document.getElementById("dateFormSubmit").value;
        dateForm.action = "?vybraneDatum="+vybraneDatum; 
        dateForm.submit();
        searchForm.submit();
        
    });
    
    deleteDateButton.addEventListener("click", function () {
        dateForm.action = selectPage;
        console.log("asd")
        dateForm.submit();
        searchForm.submit();
        
    });

}



