$(document).ready(function () {
    $("#filter_user").select2({
        theme: "bootstrap-5",
        placeholder: "انتخاب کاربر",
        allowClear: false,
        language: "fa",
        width: "100%",
    });
});

document.addEventListener("DOMContentLoaded", function () {
    const newUserDiv = document.getElementById("newUserDiv");
    const editUserDiv = document.getElementById("editUserDiv");

    newUserDiv.addEventListener("click", function () {
        if (editUserDiv.classList.contains("active")) {
            editUserDiv.classList.remove("active");
        }

        if (!newUserDiv.classList.contains("active")) {
            newUserDiv.classList.add("active");
        }

        document.getElementById("newUserFormDiv").style.display = "block";
        document.getElementById("editUserFormDiv").style.display = "none";
    });

    editUserDiv.addEventListener("click", function () {
        if (newUserDiv.classList.contains("active")) {
            newUserDiv.classList.remove("active");
        }

        if (!editUserDiv.classList.contains("active")) {
            editUserDiv.classList.add("active");
        }

        document.getElementById("newUserFormDiv").style.display = "none";
        document.getElementById("editUserFormDiv").style.display = "block";
    });

});