assure/Vue/Ajaxlisteprestataireparametrage/prestatairesactifs.php
2025-12-01 19:07:16 +00:00

176 lines
7.1 KiB
PHP

<?php $nbligne = 0; ?>
<div id="div_liste_prestataire">
<?php if (empty($prestataires)): ?>
<div class="alert alert-info text-center">
<small>
<i class="bi bi-info-circle me-2"></i>
<?= _("Aucun prestataire trouvé pour ce filtre") ?>
</small>
</div>
<?php else: ?>
<div class="card-header bg-light py-2 d-flex justify-content-between align-items-center">
<h5 class="mb-0 text-dark">
<i class="fas fa-list me-2"></i>
<span class="hide-on-mobile"><?= _("Liste des prestataires")?></span>
<span class="badge bg-primary view-end"><?= format_N(count($prestataires)).' '._("prestataire(s)") ?> </span>
</h5>
</div>
<div class="d-none d-md-block">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed table-responsive tabspeciale compact" style="font-size:9pt; white-space: nowrap;">
<thead class="table-dark">
<tr>
<th style="text-align:center" > <?= _("Commune") ?> </th>
<th > <?= _("Nom") ?> </th>
<th style="text-align:center" > <?= _("Type") ?> </th>
<th style="text-align:center" > <?= _("Situation") ?> </th>
<th style="text-align:center" > <?= _("Fixe") ?> </th>
<th style="text-align:center" > <?= _("Mobile") ?> </th>
<th style="text-align:center" > <?= _("Convention") ?> </th>
<th style="text-align:center" > <?= _("Action") ?> </th>
</tr>
</thead>
<tbody>
<?php foreach ($prestataires as $prestataire):
$id = $this->nettoyer($prestataire['id']);
$codePrestataire = $this->nettoyer($prestataire['codePrestataire']);
$latitude = $this->nettoyer($prestataire['latitude']);
$longitude = $this->nettoyer($prestataire['longitude']);
$lat = ($latitude === '' || $latitude === '0.0000000000') ? 0.0 : (float) $latitude;
$lon = ($longitude === '' || $longitude === '0.0000000000') ? 0.0 : (float) $longitude;
$conventionne = $this->nettoyer($prestataire['conventionne']);
$nbligne++;
?>
<tr ondblclick="javascript:afficher_prestataire_id(<?= $id ?>);" valign="top">
<td style="text-align:center !important;"><?= $this->nettoyer($prestataire['localite']) ?></td>
<td>
<?php if ($lat == 0.0 || $lon == 0.0): ?>
<?= substr($this->nettoyer($prestataire['libelle']),0,35) ?>
<?php else:?>
<a id="link_maps" href="https://www.google.com/maps?q=<?= $latitude ?>,<?= $longitude ?>"
title="<?= _("Voir sur Google Maps")?>"
>
<i class="fa fa-map-marker-alt me-2"></i>
<?= substr($this->nettoyer($prestataire['libelle']),0,35) ?>
</a>
<?php endif;?>
</td>
<td><?= $this->nettoyer($prestataire['typeprestataire']) ?></td>
<td><?= substr($this->nettoyer($prestataire['adresseGeo']),0,15) ?></td>
<td><?= $this->nettoyer($prestataire['fixe']) ?></td>
<td><?= $this->nettoyer($prestataire['mobile']) ?></td>
<td align='center' data-label="Convention">
<?php if ($conventionne=="1"): ?>
<i class="bi bi-check-circle-fill text-success" title="<?= _("Conventioné")?>"></i>
<?php else: ?>
<i class="bi bi-x-circle-fill text-secondary" title="<?= _("Sans convention")?>"></i>
<?php endif; ?>
</td>
<td>
<input class = "form-control btn btn-info" type="button" value="<?= _("Consulter")?>" onClick="javascript:afficher_prestataire_id(<?= $id ?>);" style='font-size:9pt;' >
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input class="sr-only" type="text" id="nbligne_info" name="nbligne_info" value="<?= $nbligne ?>" >
</div>
</div>
<!-- Affichage mobile (cartes) -->
<div class="d-md-none">
<?php foreach ($prestataires as $prestataire):
$id = $this->nettoyer($prestataire['id']);
$codePrestataire = $this->nettoyer($prestataire['codePrestataire']);
$latitude = $this->nettoyer($prestataire['latitude']);
$longitude = $this->nettoyer($prestataire['longitude']);
$lat = ($latitude === '' || $latitude === '0.0000000000') ? 0.0 : (float) $latitude;
$lon = ($longitude === '' || $longitude === '0.0000000000') ? 0.0 : (float) $longitude;
$conventionne = $this->nettoyer($prestataire['conventionne']);
$nbligne++;
?>
<div class="card mb-4 shadow-sm">
<div class="card-header bg-light d-flex justify-content-between align-items-center py-2">
<div class="d-flex justify-content-between align-items-center">
<span class="fw-bold text-primary">
<?php if ($lat == 0.0 || $lon == 0.0): ?>
<?= substr($this->nettoyer($prestataire['libelle']),0,35) ?>
<?php else:?>
<a id="link_maps" href="https://www.google.com/maps?q=<?= $latitude ?>,<?= $longitude ?>"
title="<?= _("Voir sur Google Maps")?>"
>
<i class="fa fa-map-marker-alt me-2"></i>
<?= substr($this->nettoyer($prestataire['libelle']),0,35) ?>
</a>
<?php endif;?>
</span>
</div>
<small class="text-muted">
<?php if ($conventionne=="1"): ?>
<i class="bi bi-check-circle-fill text-success" title="<?= _("Conventioné")?>"></i>
<?php else: ?>
<i class="bi bi-x-circle-fill text-secondary" title="<?= _("Sans convention")?>"></i>
<?php endif; ?>
</small>
</div>
<div class="card-body py-2">
<div class="row mb-2">
<div class="col-7">
<div class="d-flex justify-content-between align-items-center">
<span class="fw-bold"><?= $this->nettoyer($prestataire['localite']) ?></span>
</div>
</div>
<div class="col-5">
<div class="d-flex justify-content-between align-items-center">
<span class="badge bg-warning text-dark me-2"><?= $this->nettoyer($prestataire['typeprestataire']) ?></span>
</div>
</div>
</div>
<div class="col-12">
<textarea readonly class="message-text w-100"><?= $this->nettoyer($prestataire['adresseGeo']) ?></textarea>
</div>
<div class="col-12">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Fixe") ?></span>
<span class="fw-bold"><?= $this->nettoyer($prestataire['fixe']) ?></span>
</div>
</div>
<div class="col-12">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Mobile") ?></span>
<span class="fw-bold"><?= $this->nettoyer($prestataire['mobile']) ?></span>
</div>
</div>
<div class="col-12">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("E-mail") ?></span>
<span class="fw-bold"><?= $this->nettoyer($prestataire['email']) ?></span>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>