Site du proximo, utilisé pour gérer le stock.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

stock.php 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. $relativePath = "../";
  3. require_once $relativePath.'classes/dao.php';
  4. $dao = new Dao();
  5. $stock = $dao->get_articles();
  6. $categories = $dao->get_categories();
  7. for ($i = 0; $i < sizeof($stock); $i++) {
  8. $article_categories = $dao->get_article_categories($stock[$i]["id"]);
  9. $stock[$i]["type"] = $article_categories;
  10. }
  11. ob_start();
  12. ?>
  13. <tr>
  14. <th class="name-column">Nom</th>
  15. <th class="description-column">Description</th>
  16. <th class="quantity-column">Quantité</th>
  17. <th class="price-column">Prix</th>
  18. <th class="code-column">Code Barre</th>
  19. <th class="type-column">Type</th>
  20. <th class="image-column">Image</th>
  21. </tr>
  22. <?php
  23. $tableHeader = ob_get_clean();
  24. ob_start();
  25. ?>
  26. <div class="admin-container">
  27. <a href="index.php">
  28. <button class="btn btn-primary btn-large">Retour</button>
  29. </a>
  30. <h1 class="text-center">Gestion des Stocks</h1>
  31. <?php if ($stock): ?>
  32. <h2 class="text-center">Ajouter un article</h2>
  33. <table>
  34. <tbody>
  35. <?= $tableHeader ?>
  36. <tr>
  37. <td>
  38. <input type="text" class="form-control" id="nameInput" placeholder="Nom">
  39. </td>
  40. <td>
  41. <input type="text" class="form-control" id="descriptionInput" placeholder="Description">
  42. </td>
  43. <td>
  44. <input type="number" class="form-control" id="quantityInput" placeholder="Quantité">
  45. </td>
  46. <td>
  47. <input type="text" class="form-control" id="priceInput" placeholder="Prix">
  48. </td>
  49. <td>
  50. <input type="text" class="form-control" id="codeInput" placeholder="Code Barre">
  51. </td>
  52. <td id="typeCheckboxesCell">
  53. </td>
  54. <td>
  55. <input type="text" class="form-control" id="imageInput" placeholder="Lien Image">
  56. </td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. <h2 class="text-center">Liste d'articles</h2>
  61. <table id="stockTable">
  62. <tbody>
  63. <?= $tableHeader ?>
  64. </tbody>
  65. </table>
  66. <div style="display: flex; margin-top: 100px; margin-bottom: 100px">
  67. <button class="btn btn-success btn-lg" style="margin: auto"
  68. onclick="saveDataset()">
  69. Sauvegarder le stock
  70. </button>
  71. </div>
  72. <?php else: ?>
  73. <h2 class="text-center">Fichier de stock V2 non trouvé</h2>
  74. <div style="display: flex; margin-top: 50px; margin-bottom: 50px">
  75. <button class="btn btn-success btn-lg" style="margin: auto"
  76. onclick="AjaxManager.convertToV2()">
  77. Convertir le stock existant en V2
  78. </button>
  79. </div>
  80. <?php endif; ?>
  81. <script type="text/javascript">
  82. let json_dump = {
  83. types:
  84. <?php
  85. if ($categories)
  86. echo json_encode($categories);
  87. else
  88. echo 'undefined';
  89. ?>,
  90. articles:
  91. <?php
  92. if ($stock)
  93. echo json_encode($stock);
  94. else
  95. echo 'undefined';
  96. ?>
  97. }
  98. </script>
  99. </>
  100. <link type="text/css" rel="stylesheet" href="https://cdn.materialdesignicons.com/4.4.95/css/materialdesignicons.min.css"
  101. media="screen,projection"/>
  102. <link type="text/css" rel="stylesheet" href="<?= $relativePath ?>assets/css/admin.css" media="screen,projection"/>
  103. <link type="text/css" rel="stylesheet" href="<?= $relativePath ?>assets/css/stock.css" media="screen,projection"/>
  104. <?php
  105. $pageContent = ob_get_clean();
  106. $pageTitle = "Gestion du stock";
  107. $pageScripts = "<script type=\"text/javascript\" src=\"" . $relativePath . "assets/js/ajaxManager.js\"></script><script type=\"text/javascript\" src=\"" . $relativePath . "assets/js/stock.js\"></script>";
  108. include($relativePath . "includes/template.php");
  109. ?>