<?php echo HTML::style('packages/bootstrap/css/datepicker3.css' ,array('type' => 'text/css')); ?>
<?php echo HTML::script('packages/bootstrap/js/bootstrap-datepicker.js'); ?>
<?php echo HTML::script('packages/bootstrap/js/locales/bootstrap-datepicker.it.js'); ?>
<?php echo Form::open(array('id'=>'form-questio', 'class'=>'form-inline')); ?>
<?php echo Form::hidden("oldcode", $code, array('class'=>'form-control', 'id'=>"oldcode")); ?>
<?php echo Form::hidden("pid", $patient, array('class'=>'form-control', 'id'=>"pid")); ?>
    <div class="page-header">
        <h2>Dati generali</h2>
    </div>
    <div class="panel panel-info">
        <div class="panel-body">
            <?php if($errors->first("nome")!="" || $errors->first("cognome")!=""): ?>
            <div class="form-group has-error has-feedback">
            <?php else: ?>
            <div class="form-group has-feedback">
            <?php endif; ?>
                <label>Inserire le iniziali del paziente <em>(Nome e cognome)</em>:</label>
                <input maxlength="1" size="1" style="width:40px" type="text" name="nome" id="nome" value="<?php if($patientdata!=null): ?><?php echo $patientdata->nome; ?><?php else: ?><?php echo Input::old('nome'); ?><?php endif; ?>" class="form-control">
                <input maxlength="1" size="1" style="width:40px" type="text" name="cognome" id="cognome" value="<?php if($patientdata!=null): ?><?php echo $patientdata->cognome; ?><?php else: ?><?php echo Input::old('cognome'); ?><?php endif; ?>" class="form-control">
                <?php if($errors->first("nome")!=""): ?>
                <small data-bv-validator="postMessage" data-bv-validator-for="nome" class="help-block"><?php echo $errors->first("nome"); ?></small>
                <?php endif; ?>
                <?php if($errors->first("cognome")!=""): ?>
                <small data-bv-validator="postMessage" data-bv-validator-for="cognome" class="help-block"><?php echo $errors->first("cognome"); ?></small>
                <?php endif; ?>
            </div>
            <div class="clearfix"></div>
            <div class="form-group">
                <label>Sesso:</label>
                <select id="sesso" name="sesso" class="form-control">
                    <option <?php if($patientdata!=null): ?>
                                <?php if ($patientdata->sesso=="M"): ?>
                                     selected
                                <?php endif; ?>
                            <?php else: ?>
                                <?php if (Input::old('sesso')=="M"): ?>
                                    selected
                                <?php endif; ?>
                            <?php endif; ?> value="M">Maschio</option>
                    <option <?php if($patientdata!=null): ?>
                                <?php if ($patientdata->sesso=="F"): ?>
                                     selected
                                <?php endif; ?>
                            <?php else: ?>
                                <?php if (Input::old('sesso')=="F"): ?>
                                     selected
                                <?php endif; ?>
                            <?php endif; ?> value="F">Femmina</option>
                </select>
            </div>
            <div class="clearfix"></div>
            <?php if($errors->first("datanascita")!=""): ?>
            <div class="form-group has-error has-feedback">
            <?php else: ?>
            <div class="form-group has-feedback">
            <?php endif; ?>
                <label>Data di nascita:</label>
                <div style="width:200px" class="date input-group" id="datepicker">
                    <input type="text" class="form-control" name="datanascita" value="<?php if($patientdata!=null): ?> <?php echo $patientdata->data_nascita; ?> <?php else: ?> <?php echo Input::old('datanascita'); ?> <?php endif; ?>"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
                </div>
                <script>
                    $(document).ready(function() {
                        $('.date').datepicker({
                            format: "yyyy-mm-dd",
                            language: "it",
                            autoclose: true,
                            todayHighlight: true
                        });
                    });
                </script>
                <?php if($errors->first("datanascita")!=""): ?>
                <small data-bv-validator="postMessage" data-bv-validator-for="datanascita" class="help-block"><?php echo $errors->first("datanascita"); ?></small>
                <?php endif; ?>
            </div>
        </div>
    </div>
<?php echo Form::close(); ?>