<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
  <!-- Content Header (Page header) -->
  <section class="content-header">
    <h1>
      Paramètres
      <small>utilisateur</small>
    </h1>
    <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Accueil</a></li>
      <li class="active">Paramètres</li>
    </ol>
  </section>

  <!-- Main content -->
  <section class="content">
    <!-- Small boxes (Stat box) -->
    <div class="row">
      <div class="col-md-12 col-xs-12">


        <?php if (session()->getFlashdata('success')): ?>
          <div class="alert alert-success alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <?php echo session()->getFlashdata('success'); ?>
          </div>
        <?php elseif (session()->getFlashdata('error')): ?>
          <div class="alert alert-error alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <?php echo session()->getFlashdata('error'); ?>
          </div>
        <?php endif; ?>

        <div class="box">
          <div class="box-header">
            <h3 class="box-title">Mettre à jour les informations</h3>
          </div>
          <!-- /.box-header -->
          <form role="form" action="<?php base_url('users/setting') ?>" method="post">
            <div class="box-body">
              <!-- Validation errors -->
              <?php if (!empty($validation)): ?>
                <div class="alert alert-danger">
                  <ul>
                    <?php foreach ($validation as $error): ?>
                      <li><?= esc($error) ?></li>
                    <?php endforeach; ?>
                  </ul>
                </div>
              <?php endif; ?>

              <div class="form-group">
                <label for="username">Nom d'utilisateur</label>
                <input type="text" class="form-control" id="username" name="username" placeholder="Nom d'utilisateur" value="<?php echo $user_data['username'] ?>" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="email">Email</label>
                <input type="email" class="form-control" id="email" name="email" placeholder="Email" value="<?php echo $user_data['email'] ?>" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="fname">Nom</label>
                <input type="text" class="form-control" id="fname" name="fname" placeholder="Nom" value="<?php echo $user_data['firstname'] ?>" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="lname">Prénom</label>
                <input type="text" class="form-control" id="lname" name="lname" placeholder="Prénom" value="<?php echo $user_data['lastname'] ?>" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="phone">Téléphone</label>
                <input type="text" class="form-control" id="phone" name="phone" placeholder="Téléphone" value="<?php echo $user_data['phone'] ?>" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="gender">Genre</label>
                <div class="radio">
                  <label>
                    <input type="radio" name="gender" id="male" value="1" <?php if ($user_data['gender'] == 1) {
                                                                            echo "checked";
                                                                          } ?>>
                    Homme
                  </label>
                  <label>
                    <input type="radio" name="gender" id="female" value="2" <?php if ($user_data['gender'] == 2) {
                                                                              echo "checked";
                                                                            } ?>>
                    Femme
                  </label>
                </div>
              </div>

              <div class="form-group">
                <div class="alert alert-info alert-dismissible" role="alert">
                  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                  Laissez le champ du mot de passe vide si vous ne souhaitez pas le modifier.
                </div>
              </div>

              <div class="form-group">
                <label for="password">Mot de passe</label>
                <input type="text" class="form-control" id="password" name="password" placeholder="Mot de passe" autocomplete="off">
              </div>

              <div class="form-group">
                <label for="cpassword">Confirmation de mot de passe</label>
                <input type="password" class="form-control" id="cpassword" name="cpassword" placeholder="Confirmation de mot de passe" autocomplete="off">
              </div>

            </div>
            <!-- /.box-body -->

            <div class="box-footer">
              <button type="submit" class="btn btn-primary">Enregistrer</button>
              <a href="<?php echo base_url('users/') ?>" class="btn btn-warning">Retour</a>
            </div>
          </form>
        </div>
        <!-- /.box -->
      </div>

    </div>
    <!-- /.row -->


  </section>
  <!-- /.content -->
</div>
<!-- /.content-wrapper -->