123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- $relativePath = "../";
- require_once $relativePath.'classes/dao.php';
-
- $dao = new Dao();
-
- $stock = $dao->get_articles();
- $categories = $dao->get_categories();
-
- for ($i = 0; $i < sizeof($stock); $i++) {
- $article_categories = $dao->get_article_categories($stock[$i]["id"]);
- $stock[$i]["type"] = $article_categories;
- }
-
- ob_start();
- ?>
- <tr>
- <th class="name-column">Nom</th>
- <th class="description-column">Description</th>
- <th class="quantity-column">Quantité</th>
- <th class="price-column">Prix</th>
- <th class="code-column">Code Barre</th>
- <th class="type-column">Type</th>
- <th class="image-column">Image</th>
- </tr>
- <?php
- $tableHeader = ob_get_clean();
- ob_start();
- ?>
- <div class="admin-container">
-
- <a href="index.php">
- <button class="btn btn-primary btn-large">Retour</button>
- </a>
-
- <h1 class="text-center">Gestion des Stocks</h1>
- <?php if ($stock): ?>
- <h2 class="text-center">Ajouter un article</h2>
- <table>
- <tbody>
- <?= $tableHeader ?>
- <tr>
- <td>
- <input type="text" class="form-control" id="nameInput" placeholder="Nom">
- </td>
- <td>
- <input type="text" class="form-control" id="descriptionInput" placeholder="Description">
- </td>
- <td>
- <input type="number" class="form-control" id="quantityInput" placeholder="Quantité">
- </td>
- <td>
- <input type="text" class="form-control" id="priceInput" placeholder="Prix">
- </td>
- <td>
- <input type="text" class="form-control" id="codeInput" placeholder="Code Barre">
- </td>
- <td id="typeCheckboxesCell">
-
- </td>
- <td>
- <input type="text" class="form-control" id="imageInput" placeholder="Lien Image">
- </td>
- </tr>
- </tbody>
- </table>
-
- <h2 class="text-center">Liste d'articles</h2>
- <table id="stockTable">
- <tbody>
- <?= $tableHeader ?>
- </tbody>
- </table>
-
- <div style="display: flex; margin-top: 100px; margin-bottom: 100px">
- <button class="btn btn-success btn-lg" style="margin: auto"
- onclick="saveDataset()">
- Sauvegarder le stock
- </button>
- </div>
- <?php else: ?>
- <h2 class="text-center">Fichier de stock V2 non trouvé</h2>
- <div style="display: flex; margin-top: 50px; margin-bottom: 50px">
- <button class="btn btn-success btn-lg" style="margin: auto"
- onclick="AjaxManager.convertToV2()">
- Convertir le stock existant en V2
- </button>
- </div>
- <?php endif; ?>
- <script type="text/javascript">
- let json_dump = {
- types:
- <?php
- if ($categories)
- echo json_encode($categories);
- else
- echo 'undefined';
- ?>,
- articles:
- <?php
- if ($stock)
- echo json_encode($stock);
- else
- echo 'undefined';
- ?>
- }
- </script>
-
-
- </>
-
- <link type="text/css" rel="stylesheet" href="https://cdn.materialdesignicons.com/4.4.95/css/materialdesignicons.min.css"
- media="screen,projection"/>
- <link type="text/css" rel="stylesheet" href="<?= $relativePath ?>assets/css/admin.css" media="screen,projection"/>
- <link type="text/css" rel="stylesheet" href="<?= $relativePath ?>assets/css/stock.css" media="screen,projection"/>
-
-
- <?php
- $pageContent = ob_get_clean();
- $pageTitle = "Gestion du stock";
- $pageScripts = "<script type=\"text/javascript\" src=\"" . $relativePath . "assets/js/ajaxManager.js\"></script><script type=\"text/javascript\" src=\"" . $relativePath . "assets/js/stock.js\"></script>";
- include($relativePath . "includes/template.php");
- ?>
|