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

        if(!valid.valid)
            e.preventDefault();
    });
})