page.list.client.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. global $myUser,$myFirm;
  3. if(!$myUser->can('clientmap','read')) throw new Exception("Permission non accordée");
  4. Plugin::need('client/Client');
  5. $filters = array();
  6. Plugin::callHook('client_filter',array(&$filters));
  7. Plugin::callHook('client_search_view',array(&$columns));
  8. //Filtres && colonne tableau en fonction des champs dynamiques
  9. if($myFirm->has_plugin('fr.core.dynamicform') || ($myFirm->id==-1 && Plugin::is_active('fr.core.dynamicform')) ){
  10. Plugin::need('dynamicform/DynamicForm');
  11. $options = array();
  12. if(!empty($_['firm']) && is_numeric($_['firm'])) $options['firm'] = $_['firm'];
  13. //Récuperation des champs custom
  14. $fields = Dynamicform::list('client-sheet-custom',$options);
  15. //Ajout des champs custom en filtres
  16. $filters = array_merge($filters,Dynamicform::get_filters($fields));
  17. //Ajout des champs custom en colonnes dynamiques
  18. $columns = array_merge($columns,Dynamicform::get_dynamic_columns($fields));
  19. }
  20. ?>
  21. <div class="plugin-clientmap">
  22. <div class="map-panel shadow-sm">
  23. <div class="col-md-12 map-panel-box noPrint pt-3" style="height: inherit;">
  24. <select id="filters" data-type="filter" data-label="Recherche" data-autosearch="false" data-function="client_map_search">
  25. <?php foreach ($filters as $filter): echo $filter; endforeach; ?>
  26. </select>
  27. <div class="btn btn-link btn-return hidden w-100 my-3" onclick="client_map_edit_cancel()">RETOUR RECHERCHE</div>
  28. <div class="client-list-container">
  29. <ul id="clients"
  30. data-type="search-table"
  31. data-slug="client-search-table"
  32. data-entity-search="client_map_search"
  33. data-checkbox-action=".btn-checkbox-action"
  34. class="" >
  35. <li data-id="{{id}}" class="hidden client-state-{{state}} client-item" onclick="client_map_edit(this)">
  36. <div>
  37. <img class="client-logo-mini avatar-rounded left mr-2 mt-2 map-client-avatar" data-src="{{logo}}">
  38. <div class="map-client-label" title="{{{label}}} ({{type.label}})">
  39. {{{label}}} ({{type.label}}) {{#pseudonym}}<small class="text-muted">({{{pseudonym}}})</small>{{/pseudonym}}
  40. {{#job}}<br/><div class="text-muted client-job" title="{{{job}}}">{{{job}}}</div>{{/job}}
  41. </div>
  42. <div class="clear"></div>
  43. </div>
  44. {{#address}}
  45. {{#address.city}}
  46. <div class="my-2">
  47. <i class="fas fa-map-marker-alt text-icon"></i> {{address.street}} {{address.complement}} {{#address.zip}}
  48. <small class="text-muted d-block">
  49. {{address.city}} ({{address.zip}})
  50. </small>
  51. {{/address.zip}}
  52. </div>
  53. {{/address.city}}
  54. {{/address}}
  55. <div class="client-details">
  56. <hr/>
  57. {{#mail}}<div class="my-2"><i class="far fa-envelope-open text-icon"></i> <a href="mailto:{{mail}}">{{mail}}</a></div>{{/mail}}
  58. {{#phone}}<div class="my-2"><i class="fas fa-mobile-alt text-icon"></i> {{phone}}</div>{{/phone}}
  59. {{#client-sheet-custom_site-internet}}<div class="my-2"><a href="{{meta.website}}" target="_blank"><i class="fas fa-globe-europe text-icon"></i> {{{client-sheet-custom_site-internet}}}</a></div>{{/client-sheet-custom_site-internet}}
  60. <a class="btn btn-primary w-100 text-white my-3" title="Afficher sur Google Map" target="_blank" href="{{address.mapurl}}"><i class="fas fa-map-marked-alt ml-2 pointer"></i> VOIR SUR GOOGLE</a>
  61. </div>
  62. <a class="external-link" href="index.php?module=client&page=sheet.client&id={{id}}" target="_blank">
  63. <i class="fas fa-external-link-alt"></i>
  64. </a>
  65. </li>
  66. </ul>
  67. </div><br>
  68. <ul class="pagination justify-content-center noPrint" data-range="5">
  69. <li class="page-item hidden" data-value="{{value}}" title="Voir la page {{label}}" onclick="$(this).parent().find('li').removeClass('active');$(this).addClass('active');client_map_search();">
  70. <span class="page-link">{{label}}</span>
  71. </li>
  72. </ul>
  73. </div>
  74. </div>
  75. <div id="map-panel-button" class="d-sm-flex d-md-none rounded-right" onclick="collapseMapPanel()">
  76. <i class="fas fa-caret-right"></i>
  77. </div>
  78. <!-- search results -->
  79. <div class="map-container"></div>
  80. <div id="client-map-no-points" class="client-map-no-points p-3 bg-white shadow-sm">Aucun résultat(s) pour ce(s) critère(s)</div>
  81. <!-- marker tooltip template -->
  82. <template id="map-tooltip"><img class="client-logo-mini avatar-rounded left mr-2" src="{{client.logo}}">
  83. <a href="index.php?module=client&page=sheet.client&id={{client.id}}" data-id="{{client.id}}" class="pointer text-info font-weight-bold mb-1 d-block">{{client.label}}</a><small class="text-muted">{{client.job}}</small>
  84. <div class="text-center mt-2">{{client.address.street}} {{client.address.zip}} {{client.address.city}}</div>
  85. </template>
  86. <!-- Pagination (data-range définit le nombre de pages max affichées avant et après la page courante) -->
  87. <div class="hidden" id="customFields"><?php
  88. global $conf;
  89. echo $conf->get('clientmap_custom_fields'); ?></div>
  90. </div>