
<div class="">
  <button type="button" class="btn btn-sm btn-secondary icon-arrow-left mx-1" onclick="javascript:liste();"> Retour liste</button>
  <button type="button" class="btn btn-sm btn-primary icon-floppy-disk mx-1" onclick="javascript:traitForm();"> Enregistrer</button>
</div>

<div class="d-flex flex-row m-2">
  <div class="me-1">
    <label for="nom" class="form-label">Nom</label>
    <input type="text" name="nom" id="nom" class="form-control form-control-sm" value="<?=$patient['nom'];?>">
  </div>
  <div class="me-1">
    <label for="prenom" class="form-label">Prénom</label>
    <input type="text" name="prenom" id="prenom" class="form-control form-control-sm" value="<?=$patient['prenom'];?>">
  </div>
  <div class="ms-auto">
      <?php if ($patient['id']>0): ?>
        Patient n°<b><?=$patient['id'];?></b>
      <?php else: ?>
        Nouveau patient
      <?php endif; ?>
  </div>
</div>

<ul class="nav nav-tabs mt-3" id="myTab" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Infos</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Suivi</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link" id="snap-tab" data-bs-toggle="tab" data-bs-target="#snap" type="button" role="tab" aria-controls="snap" aria-selected="false">Documents</button>
  </li>
</ul>
<div class="tab-content" id="myTabContent">
  <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">

    <form class="ps-2" action="" method="post" onsubmit="javascript:traitForm();return false;">


    <div class="container-fluid">
      <?php if ($patient): ?>
        <div class="row">
          <div class="col">
              <input type="hidden" name="action" id="action" value="save">
              <input type="hidden" name="id" id="id" value="<?=$patient['id'];?>">

              <div class="">
                <label for="dn" class="form-label">Date de naissance</label>
                <input type="text" name="dn" id="dn" class="form-control form-control-sm date_picker" value="<?=$patient['aff_dn'];?>">
              </div>
              <div class="">
                <label for="adresse" class="form-label">Adresse</label>
                <input type="text" name="adresse" id="adresse" class="form-control form-control-sm" value="<?=$patient['adresse'];?>">
              </div>
              <div class="">
                <label for="complement" class="form-label">Complément</label>
                <input type="text" name="complement" id="complement" class="form-control form-control-sm" value="<?=$patient['complement'];?>">
              </div>
              <div class="">
                <label for="cp" class="form-label">Code postal</label>
                <input type="text" name="cp" id="cp" class="form-control form-control-sm" value="<?=$patient['cp'];?>" onkeyup="javascript:listeVille();">
              </div>
              <div class="" id="div_ville"> <input type="hidden" name="id_ville" id="id_ville" value="<?=intval($patient['id_ville']);?>"> </div>
              <div class="">
                <label for="tel" class="form-label">Téléphone</label>
                <input type="text" name="tel" id="tel" class="form-control form-control-sm" value="<?=$patient['tel'];?>">
              </div>
              <div class="">
                <label for="memo" class="form-label">Champ texte mémo</label>
                <textarea name="memo" id="memo" class="form-control form-control-sm"><?=$patient['memo'];?></textarea>
              </div>
          </div>
        </div>
      <?php else: ?>
        <div class="row">
          <div class="col">
            <p>Aucun patient...</p>
          </div>
        </div>
      <?php endif; ?>
    </div>
  </form>
  </div>
  <div class="tab-pane fade p-0 pt-1" id="profile" role="tabpanel" aria-labelledby="profile-tab">
  </div>
  <div class="tab-pane fade p-0 pt-1" id="snap" role="tabpanel" aria-labelledby="snap-tab">
  </div>
</div>
