| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
- <h2 class="bd-title" id="content">
- <span>Administration : Clients</span>
- </h2>
- </header>
- <?php
- echo core::filAriane(array(
- "current" => "Clients",
- "arbo" => array(
- "Administration" => NULL,
- "Clients" => "/parametres-clients.html"
- )
- ));
- $allClients = clients::getAll();
- ?>
- <table class="table">
- <thead>
- <tr>
- <th scope="col">#</th>
- <th scope="col">Clients</th>
- <th scope="col"></th>
- </tr>
- <tr>
- <form method="post" action="/submit.php">
- <th scope="row"><input type="hidden" name="from" value="parametres-client-add"></th>
- <td><input type="text" name="client" class="form-control form-control-sm" value=""></td>
- <td><button type="submit" class="btn btn-success btn-sm">Ajouter</button></td>
- </form>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach ($allClients as $value) {
- echo " <tr>
- <th scope=\"row\">" . $value["id"] . "</th>
- <td><input type=\"text\" class=\"form-control form-control-sm\" id=\"clients-".$value["id"]."\" value=\"" . $value["label"] . "\"></td>
- <td><button type=\"button\" class=\"btn btn-primary btn-sm\" onclick=\"majClients(".$value["id"].");\">Renommer</button></td>
- </tr>";
- }
- ?>
- </tbody>
- </table>
- <script>
- function majClients(id){
- $.ajax({
- url: '/submit.php',
- type: 'POST',
- data: {
- from: "parametres-client-change",
- id: id,
- value: $('#clients-'+id).val()
- },
- success: function(response) {
- $("#printToastSuccessTxt").html("Le client vient d'être mis à jour");
- $("#printToastSuccess").toast('show');
- },
- error: function(xhr, status, error) {
- $("#printToastErrorTxt").html("Le client n'a pas été mis à jour");
- $("#printToastError").toast('show');
- }
- });
- }
- </script>
|