page.list.contact.person.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. global $myUser;
  3. User::check_access('contact','read');
  4. $civilities = array();
  5. foreach (ContactPerson::civilities() as $key => $civility) {
  6. $civilities[$key] = $civility['label'];
  7. }
  8. ?>
  9. <div class="plugin-contact">
  10. <div class="row">
  11. <div class="col-md-12">
  12. <div class="d-flex my-2 w-100">
  13. <h4 class="d-inline-block my-auto mx-0 text-uppercase">Liste des contacts</h4>
  14. <div class="text-left ml-3 d-inline-block noPrint">
  15. <div onclick="window.print();" class="btn btn-info rounded-0 btn-squarred" title="Imprimer la page"><i class="fas fa-print"></i></div>
  16. <div onclick="contact_contact_person_search(null,true);" id="export-contacts-btn" class="btn btn-info rounded-0 btn-squarred ml-1" title="Exporter les résultats"><i class="fas fa-file-export"></i></div>
  17. </div>
  18. <div class="my-auto ml-auto mr-0 noPrint">
  19. <?php if($myUser->can('contact', 'edit')) : ?>
  20. <a href="index.php?module=contact&page=sheet.contact.person" class="btn btn-success right"><i class="fas fa-plus"></i> Ajouter</a>
  21. <?php endif; ?>
  22. </div>
  23. </div>
  24. <div class="clear noPrint"></div>
  25. </div>
  26. <div class="col-md-12">
  27. <select id="filters" data-type="filter" data-label="Recherche" data-function="contact_contact_person_search">
  28. <option value="label" data-filter-type="text">Libellé</option>
  29. <option value="name" data-filter-type="text">Nom</option>
  30. <option value="firstname" data-filter-type="text">Prénom</option>
  31. <option value="job" data-filter-type="text">Métier</option>
  32. <option value="civility" data-operator-delete='["in","not in"]' data-filter-type="list" data-values='<?php echo json_encode($civilities); ?>' >Civilité</option>
  33. <option value="state" data-operator-delete='["in","not in"]' data-filter-type="list" data-values='{"<?php echo ContactPerson::ACTIVE; ?>":"Actif","<?php echo ContactPerson::INACTIVE; ?>":"Inactif"}' >Etat</option>
  34. <option value="scope" data-filter-type="text">Module</option>
  35. <option value="tag" data-operator-delete='["in","not in"]' data-filter-type="tag">Etiquettes</option>
  36. <option value="comment" data-filter-type="text">Commentaire</option>
  37. <?php
  38. //Champs dynamiques
  39. global $myFirm;
  40. /*if($myFirm->has_plugin('fr.core.dynamicform')):
  41. Plugin::need('dynamicform/DynamicForm');
  42. $fields = Dynamicform::get_fields(array('slug'=>'contact-form'));
  43. foreach ($fields as $k => $field): ?>
  44. <option value="<?php echo $field['slug'] ?>" data-filter-type="text"><?php echo $field['label'] ?></option>
  45. <?php
  46. endforeach;
  47. endif; */
  48. //todo a décommenter et implémenter avec la feature de JN pour les recherches sur dynamic field
  49. //lorsqu'elle sera terminée.
  50. ?>
  51. </select>
  52. </div>
  53. </div>
  54. <h5 class="results-count"><span></span> Résultat(s)</h5>
  55. <div class="row">
  56. <!-- search results -->
  57. <div class="col-xl-12">
  58. <table id="contact-persons" class="table table-striped " data-entity-search="contact_contact_person_search">
  59. <thead>
  60. <tr>
  61. <th >Contact</th>
  62. <th data-sortable="job">Métier</th>
  63. <th data-sortable="civility">Civilité</th>
  64. <th data-sortable="phone">Téléphone</th>
  65. <th data-sortable="mail">Email</th>
  66. <th>Commentaire</th>
  67. <th></th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. <tr data-id="{{id}}" class="hidden item-line">
  72. <td class="align-middle"><div class="contact-avatar left mr-2"><img class="avatar-rounded" src="{{avatar}}"></div> {{{fullname}}}</td>
  73. <td class="align-middle">{{{job}}}
  74. {{#hasTag}}
  75. <div>
  76. {{#tag}}
  77. <span class="badge badge-secondary">{{.}}</span>
  78. {{/tag}}
  79. </div>
  80. {{/hasTag}}
  81. </td>
  82. <td class="align-middle">{{civility.label}}</td>
  83. <td class="align-middle"><ul class="contact-phones">{{#phones}}
  84. <li>{{label}} {{value}}</li>
  85. {{/phones}}</ul></td>
  86. <td class="align-middle"><ul class="contact-mails">{{#mails}}
  87. <li>{{value}}</li>
  88. {{/mails}}</ul></td>
  89. <td class="align-middle">{{comment}}{{^comment}}-{{/comment}}</td>
  90. <td class="align-middle text-right">
  91. <div class="btn-group btn-group-sm noPrint" role="group">
  92. <div class="btn" title="Envoyer par mail" onclick='sendmail_preview({"origin" : "fr.core.contact","subject" : "Information contact {{fullname}}","message" : "<h3>{{civility.label}} {{fullname}}</h3><h5>{{job}}</h5><br>Tel: {{phone}}<br>Email: {{mail}}"});'><i class="fas fa-paper-plane"></i></div>
  93. <a class="btn text-info" title="Éditer contact_person" href="index.php?module=contact&page=sheet.contact.person&id={{id}}"><i class="fas fa-pencil-alt"></i></a>
  94. <div class="btn text-danger" title="Supprimer contact_person" onclick="contact_contact_person_delete(this);"><i class="far fa-trash-alt"></i></div>
  95. </div>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table><br>
  100. <!-- Pagination (data-range définit le nombre de pages max affichées avant et après la page courante) -->
  101. <ul class="pagination justify-content-center noPrint" data-range="5">
  102. <li class="page-item hidden" data-value="{{value}}" title="Voir la page {{label}}" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');contact_contact_person_search();">
  103. <span class="page-link">{{label}}</span>
  104. </li>
  105. </ul>
  106. </div>
  107. </div>
  108. </div>