$(document).ready( function () {
    $('form[name="CrearConsulta"] input[name="txt_fecha"]').val(moment().format('YYYY-MM-DD'))
    $('form[name="CrearConsulta"] input[name="fechaconsulta"]').val(moment().format('YYYY-MM-DD'))
    $('form[name="CrearConsulta"] input[name="fecha"]').val(moment().format('YYYY-MM-DD'))
    $('form[name="CrearEvolucion"] input[name="txt_fechaEvolucion"]').val(moment().format('YYYY-MM-DD'))
    //EditarConsulta
    $("#pacienteFotoEvolucion").on("show.bs.modal", function(event) {
        var button = $(event.relatedTarget);
        var recipient = button.data("image");
        var modal = $(this);
        modal.find(".paciente-evaluacion").attr("src", recipient);
    });

    $('.btn_nombremedico').click(function () {
        $('form[name="CrearConsulta"] input[name="txt_idmedico"]').val($(this).data('id'))
        $('form[name="CrearConsulta"] input[name="txt_medico"]').val($(this).data('name'))

        $('form[name="EditarConsulta"] input[name="txt_idmedico"]').val($(this).data('id'))
        $('form[name="EditarConsulta"] input[name="txt_medico"]').val($(this).data('name'))
        $('#modaldoctor').modal('toggle')
    });
    $('#consultaPaciente, #medicoConsulta, #consultaEditarPaciente').DataTable({
        "paging"      : true,
        "lengthChange": false,
        "ordering"    : true,
        "info"        : false,
        "autoWidth"   : true,
        "orderMulti"  : true,
        "responsive"  : true,
        "dom"         : '<"search"f><"top"l>rt<"bottom"ip><"clear">',
        "language": {
            "search": "Buscar",
            "emptyTable"  : "No hay registros",
        }
    });
} );