cms.parametres-comptes.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
  2. <h2 class="bd-title" id="content">
  3. <span>Administration : Comptes Bancaires</span>
  4. </h2>
  5. </header>
  6. <?php
  7. echo core::filAriane(array(
  8. "current" => "Comptes Bancaires",
  9. "arbo" => array(
  10. "Administration" => NULL,
  11. "Comptes Bancaires" => "/parametres-comptes.html"
  12. )
  13. ));
  14. $allBank = banque::getAll();
  15. $onglets = $form = [];
  16. foreach($allBank as $value){
  17. $onglets[$value["id"]] = $value["label"];
  18. $form[$value["id"]] = $value;
  19. }
  20. $onglets["add"] = "Nouveau compte";
  21. $form["add"] = NULL;
  22. ?>
  23. <ul class="nav nav-tabs" id="tab-parametres-compte" role="tablist" style="margin-bottom:20px;">
  24. <?php
  25. $first = true;
  26. foreach ($onglets as $id => $label) {
  27. $activeClass = $first ? 'active' : '';
  28. echo '<li class="nav-item">';
  29. echo '<a class="nav-link ' . $activeClass . '" data-bs-toggle="tab" href="#parametres-compte-' . $id . '">' . $label . '</a>';
  30. echo '</li>';
  31. $first = false;
  32. }
  33. ?>
  34. </ul>
  35. <div class="tab-content">
  36. <?php
  37. $first = true;
  38. foreach ($onglets as $id => $label) {
  39. $activeClass = $first ? 'show active' : '';
  40. echo '<div id="parametres-compte-' . $id . '" class="tab-pane fade ' . $activeClass . '">';
  41. banque::printFormCompte($form[$id]);
  42. echo '</div>';
  43. $first = false;
  44. }
  45. ?>
  46. </div>
  47. <script>
  48. $(document).ready(function() {
  49. var fragment = window.location.hash;
  50. var tmpOnglet = fragment ? fragment.substring(1) : '';
  51. var onglet = "#" + tmpOnglet;
  52. if (tmpOnglet !== "" && $(onglet).length) {
  53. $('#tab-parametres-compte a[href="' + onglet + '"]').tab('show');
  54. }
  55. $("#tab-parametres-compte a").click(function(e){
  56. e.preventDefault();
  57. $(this).tab('show');
  58. history.replaceState(null, null, $(this).attr('href'));
  59. });
  60. $('#tab-parametres-compte a').on('shown.bs.tab', function(event){
  61. var x = $(event.target).text();
  62. var y = $(event.relatedTarget).text();
  63. });
  64. });
  65. </script>