menu.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /* Copyright (C) - 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/takepos/public/menu.php
  19. * \ingroup takepos
  20. * \brief Public menu for customers
  21. */
  22. if (!defined("NOLOGIN")) {
  23. define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
  24. }
  25. if (!defined('NOIPCHECK')) {
  26. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  27. }
  28. if (!defined('NOBROWSERNOTIF')) {
  29. define('NOBROWSERNOTIF', '1');
  30. }
  31. // Load Dolibarr environment
  32. require '../../main.inc.php';
  33. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  34. if (!$conf->global->TAKEPOS_QR_MENU) {
  35. accessforbidden(); // If Restaurant Menu is disabled never allow NO LOGIN access
  36. }
  37. ?>
  38. <!DOCTYPE html>
  39. <html>
  40. <head>
  41. <meta charset="UTF-8">
  42. <title><?php echo $mysoc->name; ?></title>
  43. <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css'>
  44. <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Khand:400,300,500,600,700'><link rel="stylesheet" href="css/style.css">
  45. <meta name="viewport" content="width=device-width, initial-scale=1">
  46. </head>
  47. <body>
  48. <!-- partial:index.partial.html -->
  49. <body>
  50. <div class="grid-container">
  51. <div class="grid-x grid-padding-x menu2">
  52. <div class="cell small-12">
  53. <h1><?php print $mysoc->name; ?> - <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1>
  54. <?php
  55. $categorie = new Categorie($db);
  56. $categories = $categorie->get_full_arbo('product', (($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
  57. $levelofrootcategory = 0;
  58. if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
  59. foreach ($categories as $key => $categorycursor) {
  60. if ($categorycursor['id'] == $conf->global->TAKEPOS_ROOT_CATEGORY_ID) {
  61. $levelofrootcategory = $categorycursor['level'];
  62. break;
  63. }
  64. }
  65. }
  66. $levelofmaincategories = $levelofrootcategory + 1;
  67. $maincategories = array();
  68. $subcategories = array();
  69. foreach ($categories as $key => $categorycursor) {
  70. if ($categorycursor['level'] == $levelofmaincategories) {
  71. $maincategories[$key] = $categorycursor;
  72. } else {
  73. $subcategories[$key] = $categorycursor;
  74. }
  75. }
  76. $maincategories = dol_sort_array($maincategories, 'label');
  77. foreach ($maincategories as $cat) {
  78. print '<div class="text-center">
  79. <a id="'.$cat['id'].'"></a><h3>'.$cat['label'].'</h3>
  80. </div>
  81. <div class="grid-x grid-padding-x">';
  82. $object = new Categorie($db);
  83. $result = $object->fetch($cat['id']);
  84. $prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC');
  85. foreach ($prods as $pro) {
  86. print '
  87. <div class="cell small-6 medium-4">
  88. <div class="item">
  89. <h4>'.$pro->label.'</h4>
  90. <span class="dots"></span>
  91. <span class="price">'.price($pro->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'</span>
  92. </div>
  93. </div>';
  94. }
  95. print '</div>';
  96. }
  97. ?>
  98. </div>
  99. </div>
  100. </div>
  101. <footer class="footer">
  102. <div class="container">
  103. <p class="text-muted"><?php print $mysoc->name; ?></p>
  104. </div>
  105. </footer>
  106. </body>
  107. <!-- partial -->
  108. <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
  109. <script src='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/js/foundation.min.js'></script><script src="js/script.js"></script>
  110. </body>
  111. </html>