page.edit_report.php 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. global $myUser;
  3. User::check_access('statistic','configure');
  4. require_once(__DIR__.SLASH.'StatisticReport.class.php');
  5. require_once(__DIR__.SLASH.'Connection.class.php');
  6. require_once(__DIR__.SLASH.'Filter.class.php');
  7. require_once(__DIR__.SLASH.'View.class.php');
  8. $report = StatisticReport::provide();
  9. if($report->id==0){
  10. $report->label = 'Nouveau rapport';
  11. $report->color = '#8bc34a';
  12. $report->icon = 'fas fa-chart-bar';
  13. }
  14. ?>
  15. <div class="row" id="report" data-id="<?php echo empty($report->id)?'0':$report->id; ?>">
  16. <div class="col-xl-12">
  17. <div class="tab-content" id="statsTabContent">
  18. <div class="tab-pane show active" id="global" role="tabpanel" aria-labelledby="global-tab">
  19. <div class="row">
  20. <div class="col-xl-10">
  21. <div class="input-group">
  22. <span class="icon-chooser" id="basic-addon-icon-statistic">
  23. <input id="icon" data-type="icon" name="icon" class="form-control" placeholder="" value="<?php echo $report->icon==''? 'fas fa-question': $report->icon; ?>" type="text">
  24. </span>
  25. <input type="text" class="form-control" id="label" value="<?php echo $report->label; ?>">
  26. <input type="text" data-type="color" class="form-control" value="<?php echo $report->color; ?>" id="color">
  27. <div class="input-group-append">
  28. <div class="btn btn-small btn-dark right" title="Permissions sur le rapport" data-tooltip data-placement='bottom' data-type="right"
  29. data-scope = 'statistic_report',
  30. data-uid = <?php echo $report->id; ?>
  31. ><i class="fas fa-user-lock"></i></div>
  32. </div>
  33. <div class="input-group-append">
  34. <div class="btn btn-success" onclick="stats_save_report()"><i class="fas fa-check"></i> Enregistrer</div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="col-xl-2">
  39. <a class="btn btn-dark m-auto right edit-only btn-open" href="index.php?module=statistic&page=report&id=<?php echo $report->id; ?>" role="tab" aria-controls="filters" aria-selected="false"><i class="fas fa-book-reader"></i> Ouvrir le rapport</a>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="edit-only">
  44. <hr/>
  45. <div id="filters">
  46. <legend><i class="fas fa-filter"></i> Filtres du rapport</legend>
  47. <div class="row" id="filter-form" class="filter-form">
  48. <div class="col-xl-4">
  49. <label>Libellé :</label>
  50. <input class="form-control" id="filterLabel" type="text">
  51. </div>
  52. <div class="col-xl-4">
  53. <label>Type :</label>
  54. <select class="form-control" onchange="stats_change_filter_type()" id="filterType">
  55. <?php foreach(Filter::types() as $uid=>$type): ?>
  56. <option data-placeholder="<?php echo isset($type['placeholder'])?$type['placeholder']:''; ?>" value="<?php echo $uid; ?>" <?php echo $type['datasource']?'data-source="true"':''; ?>><?php echo $type['label']; ?></option>
  57. <?php endforeach; ?>
  58. </select>
  59. </div>
  60. <div class="col-xl-4">
  61. <label>Valeur par défaut <a href="index.php?module=statistic&page=documentation">(?)</a> :</label>
  62. <div class="input-group">
  63. <input class="form-control" type="text" id="filterDefault">
  64. <div class="btn btn-success ml-2" onclick="stats_add_filter();"><i class="fas fa-check"></i></div>
  65. </div>
  66. </div>
  67. <div class="col-xl-12 filter-source-container hidden"><br>
  68. <label>Source de données :</label>
  69. <textarea id="filterDataSource" class="form-control" placeholder="id:<<id>>
  70. query:<<query>>
  71. plain:
  72. key1:value1
  73. key2:value2"></textarea>
  74. </div>
  75. </div>
  76. <div class="row">
  77. <div class="col-xl-12"><br>
  78. <table class="table table-stripped" id="filterTable">
  79. <thead>
  80. <tr>
  81. <th>Libellé <small>(affiché dans l'interface)</small></th>
  82. <th>Slug <small>(à utiliser dans la requête)</small></th>
  83. <th>Type</th>
  84. <th>Valeur par défaut</th>
  85. <th class="text-right"></th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <tr class="hidden" data-id="{{id}}">
  90. <td>{{label}}</td>
  91. <td><input type="text" readonly="readonly" class="form-control" value="{{slug}}" onclick="$(this).select();"></td>
  92. <td>{{type}}</td>
  93. <td>{{default}}</td>
  94. <td class="text-right">
  95. <div class="btn btn-mini btn-dark" title="Permissions sur le filtre" data-tooltip data-tpl-type="right"
  96. data-scope = 'statistic_filter'
  97. data-uid = "{{id}}"
  98. data-firm = "0"
  99. data-read = "false"
  100. data-delete = "false"
  101. ><i class="fas fa-user-lock"></i></div>
  102. <div class="btn btn-mini pointer text-muted btn-move"><i class="fas fa-arrows-alt"></i></div>
  103. <div class="btn btn-info btn-squarred btn-mini pointer" onclick="stats_edit_filter(this);"><i class="fas fa-pencil-alt"></i></div>
  104. <div class="btn btn-danger btn-squarred btn-mini pointer" onclick="stats_delete_filter(this, event);"><i class="fas fa-times"></i></div>
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. </div>
  110. </div>
  111. Consultez <a href="index.php?module=statistic&page=documentation">la documentation</a> pour savoir comment utiliser les filtres.
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>