$(document).ready(function(){
    /**
     * 
     * @returns 
     */
    $.fn.validations = function(){
        return [
            {
                "name":"noEmpty",
                "message":window.translations["create-area"].fieldRequired,
                "run":function (field){
                    if((field.key === "date") || (field.key === "especiality_id")) 
                        return true;
                    return ((field.value != undefined) && (field.value.trim() !== "")); 
                }
            }
        ];
    }
    $("#Especiality").on("submit",function(e){
        let form    = document.querySelector("#Especiality");
        let data    = $.fn.getDataForm.call(this,form);
        let valid   = $.fn.runValidations(data,$.fn.validations());
        if(!valid.valid)
            e.preventDefault();
    });
})