var selectedDepartmentId = null;

function setDepartment($el, id) {
    selectedDepartmentId = id;
    $('li', $el.parent('ul')).removeClass('active');
    $el.addClass('active');
}

function openModalSelectDepartment() {
    showMsgBox({
        header: "Wybierz swój sklep",
        content: listHtml,
        callback: function () {
            $.ajax({
                url: "ajax/ax_execute.php?operation=setDepartment",
                type: "post",
                dataType: "json",
                data: {
                    model: "department",
                    department: selectedDepartmentId
                },
                success: function(response){
                    window.location.reload(true);
                }
            })
        },
        cancel_show: true,
        ok_btn: "Wybierz",
        cancel_btn: "Anuluj"
    });
}