<div class="d-flex flex-row align-items-center mb-3">
  <div class="p-1 mx-3">
    Nouveau : 
    <iframe src="<?=base_url();?>/patient/if_doc/<?=$patient['id'];?>" style="border:0px;width:32px;height:32px;"></iframe>
  </div>
  <div class="p-1 mx-3">
    <button type="button" class="btn btn-primary icon-camera m-0" onclick="javascript:scanDoc(<?=$patient['id'];?>);"></button>
  </div>
</div>
<div id="div_erreur_upload"></div>

<?php if (null==$snaps): ?>
  <p> Aucun document... </p>
<?php else: ?>
  <div class="d-flex flex-row flex-wrap align-items-center">
    <?php foreach ($snaps as $key => $snap): ?>
      <?php if ($snap!="." && $snap!=".."): ?>
        <?php
          $tmp = explode(".",$snap) ;
          $ext = $tmp[count($tmp)-1] ;
          $ext_img = ["JPG","JPEG","PNG","GIF"] ;
          if(in_array(mb_strtoupper($ext),$ext_img)){
            ?>
            <div class="mx-2 text-center div_snap" style="position:relative;" rel="<?=$key;?>">
              <div class="isnap" id="div_isnap_<?=$key;?>" style="position:absolute;right:0px;top:0px;display:none;"> <a href="javascript:supprimeSnap(<?=$patient['id'];?>,'<?=addslashes($snap);?>');" class="btn btn-sm btn-link text-decoration-none text-danger icon-cross"></a> </div>
              <a href="<?=base_url();?>/assets/fichiers/patient/<?=$patient['id'];?>/<?=$snap;?>" data-fancybox="gallery" data-caption=""> <img class="img-fluid" style="max-height:150px;" src="<?=base_url();?>/assets/fichiers/patient/<?=$patient['id'];?>/<?=$snap;?>"> </a>
            </div>
            <?php
          }
          else{
            ?>
            <div class="mx-2 text-center border rounded div_snap" style="position:relative;height:150px;width:200px;line-height:150px;vertical-align:middle;" rel="<?=$key;?>">
              <div class="isnap" id="div_isnap_<?=$key;?>" style="position:absolute;right:0px;top:0px;display:none;"> <a href="javascript:supprimeSnap(<?=$patient['id'];?>,'<?=addslashes($snap);?>');" class="btn btn-sm btn-link text-decoration-none text-danger icon-cross"></a> </div>
              <a href="<?=base_url();?>/assets/fichiers/patient/<?=$patient['id'];?>/<?=$snap;?>" target="_blank">
                <span class="icon-file-empty"> <?=$snap;?></span>
              </a>
            </div>
            <?php
          }
        ?>

      <?php endif; ?>
    <?php endforeach; ?>
  </div>
<?php endif; ?>
