
function rutDarFormato() {
    $('#txt_rut').val(darformatoRut($('#txt_rut').val()));
}

$(document).ready(function() {
    var v_hoy = new Date();
    $("#txt_filtroFecha").datetimepicker({
        locale: 'es',
        format: "dd-mm-yyyy",
        autoclose: true,
        todayBtn: true,
        minView: 2,
        pickerPosition: "bottom",
        startDate: "01-01-2020",
        //endDate: v_hoy
    });

    $('#txt_rut').keyup(function () {
		rutDarFormato();
	});


    $( '#txt_filtroFecha, #cmb_filtroBodega' ).change(function() {
        //$('#div_gestionReservasinformacion').html( '' );    
        cabeceraModificarBorrarResultados();
    });  

    $("#frm_reservaModificar").validate({
        rules: {
            cmb_clienteTipo: {
                required: true
            },
            txt_numero: {
                required: true
            },
            cmb_tipoCarga: {
                required: true
            },
            txt_cantidad: {
                required: true
            },
            txt_nombreCliente: {
                required: true
            },
            txt_rut: {
                required: true
            },
            txt_filtroFecha: {
                required: true
            }
        },
        submitHandler: function(form) {
            cabeceraModificarFiltroAplicar();
        },
        highlight: function(element) {
            $(element).closest('div').addClass('has-error');
        },
        unhighlight: function(element) {
            $(element).closest('div').removeClass('has-error');
        },
        errorElement: 'span',
        errorClass: 'help-block'
    });  

    gestionReservasClienteTipoChange();
});
