templates/base.html.twig line 1

Open in your IDE?
  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <link rel="apple-touch-icon" sizes="76x76" href="{{ asset('assets/imgs/favicon/apple-touch-icon.png') }}">
  8. <link rel="icon" type="image/png" sizes="32x32" href="{{ asset('assets/imgs/favicon/favicon-32x32.png') }}">
  9. <link rel="icon" type="image/png" sizes="16x16" href="{{ asset('assets/imgs/favicon/favicon-16x16.png') }}">
  10. <link rel="manifest" href="{{ asset('assets/imgs/favicon/site.webmanifest') }}">
  11. <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v6.0.0-beta2/css/all.css">
  12. <link rel="mask-icon" href="{{ asset('assets/imgs/favicon/safari-pinned-tab.svg') }}" color="#5bbad5">
  13. <meta name="msapplication-TileColor" content="#00aba9">
  14. <meta name="theme-color" content="#ffffff">
  15. {% block meta %}{% endblock %}
  16. <title>{% block title %}Nibuco{% endblock %}</title>
  17. {% block canonical %}{% endblock %}
  18. <link rel="apple-touch-icon" sizes="76x76" href="{{ asset('assets/imgs/favicon/apple-touch-icon.png') }}">
  19. <link rel="icon" type="image/x-icon" href="{{ asset('assets/imgs/nibuco/favicon.ico') }}">
  20. <link rel="icon" type="image/png" sizes="32x32" href="{{ asset('assets/imgs/favicon/favicon-32x32.png') }}">
  21. <link rel="icon" type="image/png" sizes="16x16" href="{{ asset('assets/imgs/favicon/favicon-16x16.png') }}">
  22. <link rel="manifest" href="{{ asset('assets/imgs/favicon/site.webmanifest') }}">
  23. <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v6.0.0-beta2/css/all.css">
  24. <link rel="mask-icon" href="{{ asset('assets/imgs/favicon/safari-pinned-tab.svg') }}" color="#5bbad5">
  25. {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
  26. {% block stylesheets %}{{ encore_entry_link_tags('app') }}{% endblock %}
  27. {% block javascripts %}
  28. {{ encore_entry_script_tags('app') }}
  29. <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
  30. <script src="https://code.jquery.com/jquery-3.7.0.js"></script>
  31. {% endblock %}
  32. </head>
  33. <body class="document-body" id="document-body">
  34. {% set route = app.request.attributes.get('_route') %}
  35. <!-- Begin Header -->
  36. {% include('_header.html.twig') %}
  37. <!-- End Header -->
  38. {% block body %}{% endblock %}
  39. <!-- Begin Footer -->
  40. {% include('_footer.html.twig') %}
  41. <!-- End Footer -->
  42. {% block javascript %}{% endblock %}
  43. {% block mercure %}
  44. {% if app.user %}
  45. <script type="application/javascript">
  46. const eventSource = new EventSource("{{ mercure([
  47. 'http://nibuco/deliveryman/' ~app.user.id,
  48. 'http://nibuco/recipient/' ~app.user.id,
  49. 'http://nibuco/sender/' ~app.user.id,
  50. ])| escape('js') }}");
  51. $(document).ready(function () {
  52. eventSource.onmessage = event => {
  53. // Will be called every time an update is published by the server
  54. var data = JSON.parse(event.data);
  55. if (data.to == 'deliveryman') {
  56. switch (data.type) {
  57. case 'delivery man scanned':
  58. showElementJs('#course-header #barcode', true);
  59. break;
  60. case 'delivery man rated':
  61. showElementJs('#status #buttons #Enlevé', true);
  62. break;
  63. default:
  64. //TODO notif count
  65. $('.icon-delivery').addClass("notification");
  66. }
  67. // if (data.type == 'delivery man scanned') {
  68. // showElementJs('#course-header #barcode', true);
  69. // } else {
  70. // //TODO notif count
  71. // $('.icon-delivery').addClass("notification");
  72. // }
  73. }
  74. if (data.to == 'sender') {
  75. if (typeof data.nextPost !== 'undefined') {
  76. axios.post(data.nextPost)
  77. .then(function (response) {
  78. $('#course').html(response.data);
  79. })
  80. .catch(function (error) {
  81. console.warn(error);
  82. })
  83. } else if (typeof data.nextGet !== 'undefined') {
  84. window.location.replace(data.nextGet);
  85. } else if (data.type !== 'undefined' && data.type == 'course status changed') {
  86. updateStatus(data.message.status);
  87. } else {
  88. console.log('update status' + data.message);
  89. }
  90. }
  91. if (data.to == 'recipient') {
  92. //TODO recipient action
  93. }
  94. }
  95. });
  96. </script>
  97. {% endif %}
  98. {% endblock %}
  99. </body>
  100. </html>