client.widget.php 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. require_once(__DIR__.SLASH.'Client.class.php');
  3. $max = $widget->data('client_number');
  4. $max = $max =="" ? 5 : $max ;
  5. $last5 = Client::staticQuery('SELECT * FROM {{table}} WHERE state = ? ORDER BY `created` DESC LIMIT '.$max,array(Client::ACTIVE),true);
  6. $number = Client::staticQuery('SELECT count(id) results FROM {{table}} WHERE state=? AND parent IS NOT NULL',array(Client::ACTIVE))->fetch();
  7. ?>
  8. <div class="client-container">
  9. <a href="index.php?module=client&title=Client" class="pt-1 pb-1 pl-2 pr-2 d-block text-center">
  10. <h2><span class="text-white"><?php echo $number['results']; ?></span> Clients</h2>
  11. </a>
  12. <div class="client-search m-2">Accès rapide <input type="text" onchange="widget_client_search(this);" class="form-control" data-type="client"></div>
  13. <hr class="mt-0">
  14. <h5 class="ml-2 mb-3 mt-3"><?php echo $max>0 ? $max.' dernier'.($max>1?'s':'').' client'.($max>1?'s':'') : 'Aucun nouveau client'; ?></h5>
  15. <div class="last-clients">
  16. <ul class="list-unstyled clients text-center mb-0 pb-4">
  17. <?php foreach($last5 as $client): ?>
  18. <!-- @TODO: Mettre le logo client en background de chaque li -->
  19. <li class="m-3">
  20. <a href="index.php?module=client&page=sheet.client&id=<?php echo $client->id; ?>" target="_blank" class="text-center">
  21. <div>
  22. <i class="far fa-user fa-2x d-block pt-2 pb-1"></i>
  23. <span class="d-block text-center" title="<?php echo htmlentities($client->label); ?>"><?php echo $client->label; ?></span>
  24. </div>
  25. </a>
  26. </li>
  27. <?php endforeach; ?>
  28. </ul>
  29. </div>
  30. </div>