<?php session_start(); ?>
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>Gestión de usuarios</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../static/style.css" type="text/css" media="screen" />
    <script src="validate_report.js"></script>
</head>
<body>
    <?php include 'navbar.php' ?>
    <?php
    include '../database.php';

    $pdo = connectDatabase();
    $doctors = listDoctors($pdo);
    $patients = fetchPatients($pdo);
    ?>
    <form name="create_form" method="post" action="../report_management.php" onsubmit="return validateReport();">
        <div class="input-group">
            <label>Titulo</label>
            <input type="text" name="titulo" value="">
        </div>
        <div class="input-group">
            <label>fecha</label>
            <input type="date" name="fecha" value="">
        </div>
        <div class="input-group">
            <label>hora</label>
            <input type="time" name="hora" value="">
        </div>
        <div class="input-group">
            <select id="paciente" name="paciente">
                <option>Seleccione un paciente</option>
                <?php foreach($patients as $row) : ?>
                    <option value="<?php echo $row[0]; ?>"><?php echo $row[1]; ?></option>
                <?php endforeach ?>
            </select>
        </div>
        <div class="input-group">
            <select id="medico" name="medico">
                <option>Seleccione un médico</option>
                <?php foreach($doctors as $row) : ?>
                    <option value="<?php echo $row[0]; ?>"><?php echo $row[1]; ?></option>
                <?php endforeach ?>
            </select>
        </div>
        <div class="input-group">
            <label>contenido</label>
            <input type="text" name="contenido" value="">
        </div>
        <div class="input-group">
            <button class="btn" type="submit" name="create" >Guardar</button>
        </div>
        <input type="button" value="Imprimir" onClick="window.print()">
    </form>
    <?php closeDatabase($pdo); ?>
</body>
