<div class="container-fluid">
  <div class="row">
    <div class="col">
      <form class="" action="" method="post" onsubmit="javascript:listePrescription();return false;">
        <input type="hidden" name="start" id="start" value="<?=$start;?>">
        <input type="hidden" name="nb" id="nb" value="<?=$nb;?>">
        <?=$nbres;?> visite<?=(($nbres>1)?"s":"");?>
        &nbsp;|&nbsp;
        <?php if ($page>1): ?>
          <a href="javascript:direct(<?=(($page-2)*$nb);?>);" title="page precedente" class="icon-arrow-left"></a>
        <?php endif; ?>
        <?php if ($nbpages>0): ?>
          page <?=$page;?>/<?=$nbpages;?>
        <?php endif; ?>
        <?php if ($page<$nbpages): ?>
          <a href="javascript:direct(<?=($page*$nb);?>);" title="page suivante" class="icon-arrow-right"></a>
        <?php endif; ?>
        &nbsp;|&nbsp;
        Tri
        &nbsp;|&nbsp;
        <select class="" id="rech_acte" name="rech_acte" onchange="javascript:listePrescription();">
          <option value="">par acte</option>
          <?php foreach ($actes as $key => $acte): ?>
            <option value="<?=$acte['id'];?>"<?=(($acte['id']==$rech_acte)?" selected":"");?>><?=$acte['libel'];?></option>
          <?php endforeach; ?>
        </select>
        &nbsp;|&nbsp;
        <select class="" id="rech_effectue" name="rech_effectue" onchange="javascript:listePrescription();">
          <option value="">par état</option>
          <option value="1"<?=(($rech_effectue=="1")?" selected":"");?>>Déja effectués</option>
          <option value="0"<?=(($rech_effectue=="0")?" selected":"");?>>Restants</option>
        </select>
        &nbsp;|&nbsp;
        <select class="" id="rech_petit_matin" name="rech_petit_matin" onchange="javascript:listePrescription();">
          <option value="">petit matin</option>
          <option value="1"<?=(($rech_petit_matin=="1")?" selected":"");?>>oui</option>
          <option value="0"<?=(($rech_petit_matin=="0")?" selected":"");?>>non</option>
        </select>
        &nbsp;|&nbsp;
        <select class="" id="rech_mms" name="rech_mms" onchange="javascript:listePrescription();">
          <option value="">matin/midi/soir</option>
          <option value="1"<?=(($rech_mms=="1")?" selected":"");?>>oui</option>
          <option value="0"<?=(($rech_mms=="0")?" selected":"");?>>non</option>
        </select>
        &nbsp;|&nbsp;
        <select class="" id="rech_effectue_par" name="rech_effectue_par" onchange="javascript:listePrescription();">
          <option value="">effectué par</option>
          <?php foreach ($bo_users as $key => $bu): ?>
            <option value="<?=$bu['id'];?>"<?=(($bu['id']==$rech_effectue_par)?" selected":"");?>><?=$bu['prenom'];?> <?=$bu['nom'];?> (<?=$bu['email'];?>)</option>
          <?php endforeach; ?>
        </select>
        &nbsp;|&nbsp;
        du
        <input type="text" class="date_picker" name="rech_du" id="rech_du" value="<?=$rech_du;?>" style="width:100px;">
        &nbsp;|&nbsp;
        au
        <input type="text" class="date_picker" name="rech_au" id="rech_au" value="<?=$rech_au;?>" style="width:100px;">
        <!-- &nbsp;|&nbsp; -->
        <button type="submit" name="button">Ok</button>
      </form>
        <!-- <button type="button" class="btn btn-sm btn-primary icon-plus" data-bs-toggle="modal" data-bs-target="#modalNew"> ajouter</button> -->
        <!-- Modal -->
        <!-- <div class="modal fade" id="modalNew" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Confirmation</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
              </div>
              <div class="modal-body">
                <p> AJOUTER UNE NOUVELLE PRESCRIPTION POUR LE PATIENT "" </p>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annuler</button>
                <button type="button" class="btn btn-primary" onclick="javascript:formPrescription(0);">Confirmer</button>
              </div>
            </div>
          </div>
        </div> -->
        <!-- <a href="javascript:newPrescription();" class="icon-plus"> ajouter</a> -->
    </div>
  </div>

  <div class="row">
    <div class="col">

      <table class="table table-sm table-striped">
        <thead>
          <tr>
            <th><input type="checkbox" class="check_all" id="check_all" name="check_all" onclick="javascript:cocheDecocheTout();"></th>
            <th class="text-center" style="width:100px;">Date</th>
            <th class="text-center"><a href="javascript:modalModifColonne('petit_matin');">Petit matin</a></th>
            <th class="text-center"><a href="javascript:modalModifColonne('mms');">Matin/midi/soir</a></th>
            <th><a href="javascript:modalModifColonne('id_acte');">Acte</a></th>
            <th><a href="javascript:modalModifColonne('id_bo_user');">Effectué par</a></th>
            <!-- <th></th> -->
            <th class="text-center"> <a href="javascript:supSelection();" class="text-warning">sup. séléction</a> </th>
          </tr>
        </thead>
        <tbody>
          <?php if ($rdvs): ?>
            <?php foreach ($rdvs as $key => $rdv): ?>
              <tr>
                <td>
                  <input type="checkbox" class="check_rdv" id="check_rdv_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" value="<?=$rdv['id'];?>">
                </td>
                <td>
                  <input type="text" class="form-control form-control-sm date_picker" name="date" id="date_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" value="<?=$rdv['aff_date'];?>" onchange="javascript:majRdv(this);">
                  <?php if ($rdv['com_effectue']!=""): ?>
                    <div class="form-text m-0 p-0" style="line-height:1.1;">
                      <?=$rdv['com_effectue'];?>                      
                    </div>
                  <?php endif; ?>
                </td>
                <td class="text-center">
                  <input type="checkbox" name="petit_matin" id="petit_matin_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" value="1"<?=(($rdv['petit_matin']>0)?" checked":"");?> onclick="javascript:majRdv(this);">
                </td>
                <td class="text-center">
                  <input type="checkbox" name="mms" id="mms_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" value="1"<?=(($rdv['mms']>0)?" checked":"");?> onclick="javascript:majRdv(this);">
                </td>
                <td>
                  <select class="form-select form-select-sm" name="id_acte" id="id_acte_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" onchange="javascript:majRdv(this);">
                    <?php foreach ($actes as $key_act => $act): ?>
                      <option value="<?=$act['id'];?>"<?=(($act['id']==$rdv['id_acte'])?" selected":"");?>><?=$act['libel'];?></option>
                    <?php endforeach; ?>
                  </select>
                </td>
                <td>
                  <select class="form-select form-select-sm" name="effectue" id="effectue_<?=$rdv['id'];?>" rel="<?=$rdv['id'];?>" onchange="javascript:majRdv(this);">
                    <option value="0">non effectué</option>
                    <?php foreach ($bo_users as $key_bou => $bou): ?>
                      <option value="<?=$bou['id'];?>"<?=(($bou['id']==$rdv['effectue'])?" selected":"");?>>effectué par <?=$bou['prenom'];?> <?=$bou['nom'];?> (<?=$bou['email'];?>)</option>
                    <?php endforeach; ?>
                  </select>
                </td>
                <!-- <td> <button type="button" onclick="javascript:detailsRDV(<?=$rdv['id'];?>);">modifier</button> </td> -->
                <td class="text-center">
                  <a href="javascript:supprimeRdv(<?=$rdv['id'];?>);" class="btn btn-sm btn-link text-danger icon-cross text-decoration-none"></a>
                </td>
              </tr>
            <?php endforeach; ?>
          <?php else: ?>
            <tr>
              <td colspan="7" class="text-center m-5 p-5"> <p>Aucun résultat...</p> </td>
            </tr>
          <?php endif; ?>
        </tbody>

      </table>

    </div>
  </div>

</div>
