暫無描述

base.html 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {% load static tailwind_tags %}
  2. {% load django_browser_reload %}
  3. {% load legacy_filters %}
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  9. <title>{% block title %}My Django App{% endblock %}</title>
  10. <!-- TailwindCSS -->
  11. <!--
  12. <script src="https://cdn.tailwindcss.com"></script> -->
  13. {% tailwind_css %}
  14. <link href="{% static "font-awesome/css/font-awesome.css" %}" rel="stylesheet" />
  15. <script type="text/javascript" defer src="{% static "alpinejs/dist/cdn.min.js" %}"></script>
  16. <link href="https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.css" rel="stylesheet" />
  17. <script type="text/javascript" src="{% static "js/main.js" %}"></script>
  18. </head>
  19. <body class="bg-gray-100 text-gray-800">
  20. <!-- Navbar -->
  21. <nav class="fixed top-0 z-50 w-full bg-white border-b border-gray-200 dark:bg-gray-800 dark:border-gray-700">
  22. <div class="px-3 py-3 lg:px-5 lg:pl-3">
  23. <div class="flex items-center justify-between">
  24. <div class="flex items-center justify-start">
  25. <button data-drawer-target="logo-sidebar" data-drawer-toggle="logo-sidebar" aria-controls="logo-sidebar" type="button" class="inline-flex items-center p-2 text-sm text-gray-500 rounded-lg sm:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600">
  26. <span class="sr-only">Open sidebar</span>
  27. <svg class="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
  28. <path clip-rule="evenodd" fill-rule="evenodd" d="M2 4.75A.75.75 0 012.75 4h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 4.75zm0 10.5a.75.75 0 01.75-.75h7.5a.75.75 0 010 1.5h-7.5a.75.75 0 01-.75-.75zM2 10a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 10z"></path>
  29. </svg>
  30. </button>
  31. <a href="/" class="flex items-center ml-2">
  32. <img src="https://flowbite.com/docs/images/logo.svg" class="h-8 mr-3" alt="Logo" />
  33. <span class="self-center text-xl font-semibold dark:text-white">My App</span>
  34. </a>
  35. </div>
  36. <div class="flex items-center space-x-4">
  37. {% if user.is_authenticated %}
  38. <!-- Logged-in User -->
  39. <span class="text-gray-600 dark:text-gray-300">Hello, {{ user.username }}</span>
  40. <a href="{% url 'sysadmin:logout' %}" class="text-blue-500 hover:underline">Logout</a>
  41. {% else %}
  42. <!-- Guest User -->
  43. <a href="{% url 'sysadmin:login' %}" class="text-blue-500 hover:underline">Login</a>
  44. <a href="{% url 'sysadmin:register' %}" class="text-blue-500 hover:underline">Register</a>
  45. {% endif %}
  46. <div class="ml-3">
  47. <button type="button" class="flex text-sm bg-gray-800 rounded-full focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600">
  48. <span class="sr-only">Open user menu</span>
  49. <img class="w-8 h-8 rounded-full" src="https://flowbite.com/docs/images/people/profile-picture-5.jpg" alt="User">
  50. </button>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </nav>
  56. <!-- Sidebar -->
  57. {% if not hide_sidebar %}
  58. <aside id="logo-sidebar" class="fixed top-0 left-0 z-40 w-64 h-screen pt-20 transition-transform -translate-x-full bg-white border-r border-gray-200 sm:translate-x-0 dark:bg-gray-800 dark:border-gray-700">
  59. <div class="h-full px-3 pb-4 overflow-y-auto">
  60. <ul class="space-y-2">
  61. <li><a href="/dashboard/" class="flex items-center p-2 text-gray-900 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white"><span class="ml-3">Dashboard</span></a></li>
  62. <li><a href="{% url "report:index" %}" class="flex items-center p-2 text-gray-900 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white"><span class="ml-3">Reports</span></a></li>
  63. <li>
  64. <button type="button" class="flex items-center w-full p-2 text-base text-gray-900 transition duration-75 rounded-lg group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700" aria-controls="dropdown-example" data-collapse-toggle="dropdown-example">
  65. <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
  66. <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 6c0 1.657-3.134 3-7 3S5 7.657 5 6m14 0c0-1.657-3.134-3-7-3S5 4.343 5 6m14 0v6M5 6v6m0 0c0 1.657 3.134 3 7 3s7-1.343 7-3M5 12v6c0 1.657 3.134 3 7 3s7-1.343 7-3v-6"/>
  67. </svg>
  68. <span class="flex-1 ms-3 text-left rtl:text-right whitespace-nowrap">Data Tables</span>
  69. <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
  70. <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
  71. </svg>
  72. </button>
  73. <ul id="dropdown-example" class="hidden py-2 space-y-2">
  74. <li>
  75. <a href="{% url "legacy:data-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Data</a>
  76. </li>
  77. <li>
  78. <a href="{% url "legacy:datams-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Measurement</a>
  79. </li>
  80. <li>
  81. <a href="{% url "legacy:fg-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Fg Press Info</a>
  82. </li>
  83. <li>
  84. <a href="{% url "legacy:ls-list" %}" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Lot Summary</a>
  85. </li>
  86. <li>
  87. <a href="#" class="flex items-center w-full p-2 text-gray-900 transition duration-75 rounded-lg pl-11 group hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700">Invoice</a>
  88. </li>
  89. </ul>
  90. </li>
  91. <li><a href="/settings/" class="flex items-center p-2 text-gray-900 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-white"><span class="ml-3">Settings</span></a></li>
  92. </ul>
  93. </div>
  94. </aside>
  95. {% endif %}
  96. <!-- Main Content -->
  97. <div class="flex flex-col min-h-screen">
  98. <!-- Content Area -->
  99. <div class="flex-grow p-4 sm:ml-64">
  100. <div class="mt-14">
  101. {% if messages %}
  102. <div class="container mx-auto px-4 py-4">
  103. {% for message in messages %}
  104. <div id="message-alert"
  105. class="p-4 mb-4 text-white rounded-lg bg-green-500 transition-opacity duration-500"
  106. style="opacity: 1;">
  107. {{ message }}
  108. </div>
  109. {% endfor %}
  110. </div>
  111. {% endif %}
  112. {% render_breadcrumbs bs %}
  113. {% block content %}{% endblock %}
  114. </div>
  115. </div>
  116. <!-- Footer -->
  117. <footer class="bg-gray-200 py-4 text-center">
  118. <p class="text-sm text-gray-600">&copy; 2024 My Django App. All rights reserved.</p>
  119. </footer>
  120. <script type="text/javascript" src="{% static "underscore/underscore-min.js" %}"></script>
  121. <script src="https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.js"></script>
  122. {% django_browser_reload_script %}
  123. <script>
  124. // Auto-hide the message after 5 seconds
  125. setTimeout(() => {
  126. const alert = document.getElementById('message-alert');
  127. if (alert) {
  128. alert.style.opacity = '0'; // Fade out
  129. setTimeout(() => alert.remove(), 500); // Remove after fade-out
  130. }
  131. }, 5000); // 5 seconds
  132. </script>
  133. </body>
  134. </html>