page.list.php 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. global $myFirm;
  3. User::check_access('example','read');
  4. require_once(__DIR__.SLASH.'Contact.class.php');
  5. $defaultFilters = filters_default(array(
  6. "jean",
  7. array(
  8. 'birth' => "17/09/1998",
  9. 'join' => 'or'
  10. ),
  11. array(
  12. 'phone:like' => "9754"
  13. )
  14. ));
  15. ?>
  16. <div class="row">
  17. <div class="col-md-8">
  18. <!--
  19. voir filter.component.js pour la documentation
  20. -->
  21. <select id="filters" data-type="filter" data-slug="contact-search" data-default='<?php echo json_encode($defaultFilters); ?>' data-label="Trouver un contact" data-function="contact_search">
  22. <!-- pour une recherche simple, ne pas spécifier d'options dans cette liste -->
  23. <option value="birth" data-filter-type="date">Date de naissance</option>
  24. <option value="label" data-filter-type="text">Libellé</option>
  25. <option value="author" data-filter-type="user">Auteur</option>
  26. <option value="phone" data-filter-type="text">Téléphone</option>
  27. <option value="vehicle" data-filter-type="dictionnary" data-slug="vehicles" data-depth="3" data-disable-label>Véhicule</option>
  28. <option value="login" data-filter-type="dictionnary" data-filter-source='<?php echo json_encode(array('nigol'=>'Nigol','pouet'=>'Pouet')); ?>'>Ma liste custom</option>
  29. <option value="myNumber" data-filter-type="number">Un nombre</option>
  30. <option value="mycheckbox1" data-filter-type="boolean">Ma checkbox 1</option>
  31. </select>
  32. </div>
  33. <div class="col-md-4">
  34. <?php if($myUser->can('example', 'edit')) : ?>
  35. <a href="index.php?module=example&page=sheet" class="btn btn-success right"><i class="fas fa-plus"></i> Ajouter un contact</a>
  36. <?php endif; ?>
  37. <?php if($myUser->can('export', 'read') && $myFirm->has_plugin('fr.sys1.export')) : ?>
  38. <div class="right mr-2 d-inline-block" data-type="export-model" data-default="xlsx2" data-pre-callback="contact_export_pre_callback" data-post-callback="contact_export_post_callback" data-parameters='<?php echo stripslashes(json_encode(array("plugin"=>"example","dataset"=>"contact-list"))); ?>'>
  39. <div class="btn btn-primary"><i class="far fa-file"></i> Export modèle</div>
  40. </div>
  41. <?php endif; ?>
  42. </div>
  43. </div>
  44. <h4 class="results-count"><span></span> Résultat(s) <div class="btn btn-dark btn-small" onclick="contact_search(null,true)"><i class="far fa-file-excel"></i> Exporter</div></h4>
  45. <div class="row">
  46. <div class="col-xl-12">
  47. <!-- Résultats -->
  48. <table id="contacts" class="table table-striped">
  49. <thead>
  50. <tr>
  51. <th>#</th>
  52. <th></th>
  53. <th data-sortable="label">Libellé</th>
  54. <th data-sortable="phone">Téléphone</th>
  55. <th>Date de naissance</th>
  56. <th>Auteur</th>
  57. <th>Horodatage</th>
  58. <th></th>
  59. </tr>
  60. </thead>
  61. <tbody>
  62. <tr data-id="{{id}}" class="hidden">
  63. <td>{{id}}</td>
  64. <td><img data-src="{{picture}}" class="avatar-mini avatar-rounded"></td>
  65. <td><a href="index.php?module=example&page=sheet&id={{id}}">{{label}}</a></td>
  66. <td>{{phone}}</td>
  67. <td>{{birth}}</td>
  68. <td>{{author}}</td>
  69. <td><small class="text-muted">Créé le {{created}} par {{creator}} <br/> Modifié le {{updated}} par {{updater}}</small></td>
  70. <td class="text-right">
  71. <div class="btn-group btn-group-sm" role="group">
  72. <a class="btn btn-info" href="index.php?module=example&page=sheet&id={{id}}"><i class="fas fa-pencil-alt"></i></a>
  73. <div class="btn btn-danger" onclick="contact_delete(this);"><i class="far fa-trash-alt"></i></div>
  74. </div>
  75. </td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. <!-- Pagination (data-range définit le nombre de pages max affichées avant et après la page courante) -->
  80. <ul class="pagination justify-content-center" data-range="3">
  81. <li class="page-item hidden" data-value="{{value}}" title="Voir la page {{label}}" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');contact_search()">
  82. <span class="page-link">{{label}}</span>
  83. </li>
  84. </ul>
  85. </div>
  86. </div>