Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

323 wiersze
14 KiB

  1. <div class="h-full lg:min-w-full xl:min-w-0">
  2. <div class="border-base-200 flex items-center justify-between px-5 mb-[10px] space-x-3">
  3. <div>
  4. <span class="text-2xl text-[#008EED] leading-[80px]">{arguments:db}s</span>
  5. </div>
  6. <div role="alert" class="alert alert-info alert-soft hidden lg:flex">
  7. <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info h-6 w-6 shrink-0 stroke-[#008EED]">
  8. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  9. </svg>
  10. <span class="text-[#008EED]" js-data="texts tables info track">This is the log of the events related to trackers with their latest status</span>
  11. </div>
  12. <div class="flex items-center gap-2">
  13. <label class="input input-primary w-[200px]">
  14. <span
  15. class="iconify lucide--search text-base-content/70 size-4.5 "></span>
  16. <input
  17. class="text-base placeholder:text-sm"
  18. type="search"
  19. x-model="search"
  20. @input="updateSearch"
  21. placeholder="Search" />
  22. </label>
  23. <!-- <div class="dropdown dropdown-bottom dropdown-end">
  24. <div
  25. tabindex="0"
  26. role="button"
  27. class="btn btn-outline btn-primary">
  28. <span
  29. class="iconify lucide--columns-3-cog size-4"></span>
  30. </div>
  31. <div tabindex="0" class="dropdown-content bg-base-100 rounded-box w-44 shadow">
  32. <ul class="menu w-full">
  33. <template
  34. x-for="column in allLeafColumns"
  35. :key="column.id">
  36. <li @click="toggleColumn(column)">
  37. <div
  38. class="group gap-2.5"
  39. :data-visible="isColumnVisible(column) ? true : null">
  40. <span
  41. class="iconify lucide--check size-4 scale-50 opacity-0 transition-all duration-300 group-data-visible:scale-100 group-data-visible:opacity-100"></span>
  42. <span
  43. class="font-medium"
  44. x-text="column.columnDef.header"></span>
  45. </div>
  46. </li>
  47. </template>
  48. </ul>
  49. </div>
  50. </div> -->
  51. <div class="dropdown dropdown-bottom dropdown-end">
  52. <div
  53. aria-label="More actions"
  54. tabindex="0"
  55. role="button"
  56. class="btn btn-outline btn-primary">
  57. <span
  58. class="iconify lucide--ellipsis-vertical size-4"></span>
  59. </div>
  60. <div
  61. tabindex="0"
  62. class="dropdown-content bg-base-100 rounded-box w-44 shadow">
  63. <ul class="menu w-full">
  64. <li>
  65. <div>
  66. <span
  67. class="iconify lucide--refresh-cw size-4"></span>
  68. Refresh Data
  69. </div>
  70. </li>
  71. <li>
  72. <div>
  73. <span
  74. class="iconify lucide--download size-4"></span>
  75. Export
  76. </div>
  77. </li>
  78. </ul>
  79. </div>
  80. </div>
  81. <button type="submit" class="btn btn-outline btn-primary" style="cursor: pointer;" onclick="js.part({'do':'{arguments:new}',arguments:{db:'{arguments:db}'}})">Add</button>
  82. </div>
  83. </div>
  84. <div class="flex w-full px-[30px]">
  85. <div class=" max-h-[calc(100vh-260px)] overflow-y-scroll overflow-x-auto w-full border-solid border-1 border-[#008EED] rounded-none">
  86. <div class="min-w-[480px] px-[20px] py-[20px] border-base-200 flex flex-wrap items-center justify-between gap-2">
  87. <div class="join border-solid border-1 border-[#008EED] rounded-md">
  88. <button
  89. class="btn btn-square btn-sm btn-outline border-base-300 join-item"
  90. aria-label="Pagination controls"
  91. :disabled="!table.getCanPreviousPage()"
  92. @click="prevPage()">
  93. <span class="iconify lucide--arrow-left"></span>
  94. </button>
  95. <input
  96. aria-label="Page number"
  97. min="1"
  98. :max="table.getPageCount()"
  99. :value="pageIndex + 1"
  100. @input="setPageIndex($event.target.value - 1)"
  101. class="input input-sm join-item w-10 text-center border-0" />
  102. <button
  103. class="btn btn-square btn-sm btn-outline border-base-300 join-item"
  104. aria-label="Pagination controls"
  105. :disabled="!table.getCanNextPage()"
  106. @click="nextPage()">
  107. <span class="iconify lucide--arrow-right"></span>
  108. </button>
  109. </div>
  110. <p class="text-base-content/70 text-sm max-md:hidden">
  111. <span
  112. class="text-base-content font-medium"
  113. x-text="`${start}–${end}`"></span>
  114. out of
  115. <span
  116. class="text-base-content font-medium"
  117. x-text="rowCount"></span>
  118. </p>
  119. <div class="flex items-center gap-2">
  120. <p class="text-base-content/70 text-sm max-md:hidden">
  121. Per page
  122. </p>
  123. <select
  124. aria-label="Items per page"
  125. class="select select-sm w-16 border-solid border-1 border-[#008EED]"
  126. @change="changePageSize(Number($event.target.value))">
  127. <template x-for="size in pageSizes" :key="size">
  128. <option
  129. :value="size"
  130. :selected="size === pageSize"
  131. x-text="size"></option>
  132. </template>
  133. </select>
  134. </div>
  135. </div>
  136. <div class="tableContainer">
  137. <table class="table" x-data="UI.createTable({db:'{arguments:db}'})">
  138. <thead>
  139. <template
  140. x-for="headerGroup in table.getHeaderGroups()"
  141. :key="headerGroup.id">
  142. <tr>
  143. <template
  144. x-for="header in headerGroup.headers"
  145. :key="header.id">
  146. <th
  147. class="text-[#008EED]",
  148. x-show="!header.isPlaceholder"
  149. x-text="flexRender(header.column.columnDef.header, header.getContext())"></th>
  150. </template>
  151. </tr>
  152. </template>
  153. </thead>
  154. <tbody>
  155. <template x-if="!visibleRows.length">
  156. <tr>
  157. <td
  158. :colspan="columns.length"
  159. class="h-24 text-center">
  160. <p>
  161. No results.
  162. <span
  163. @click="clearFilters"
  164. class="text-primary cursor-pointer hover:underline">
  165. Clear filters
  166. </span>
  167. </p>
  168. </td>
  169. </tr>
  170. </template>
  171. <template x-if="visibleRows.length">
  172. <template
  173. x-for="row in visibleRows"
  174. :key="row.id"
  175. >
  176. <tr>
  177. <template
  178. x-for="cell in getVisibleCells(row)"
  179. :key="cell.id"
  180. >
  181. <td>
  182. <template
  183. x-if="cell.column.id === 'subject'">
  184. <div
  185. class="flex items-center gap-2">
  186. <div>
  187. <p
  188. class="leading-none font-medium"
  189. x-text="cell.row.original.subject"></p>
  190. <p
  191. class="text-base-content/70 mt-0.5 text-xs/none"
  192. x-text="cell.row.original.trackerMac"></p>
  193. </div>
  194. </div>
  195. </template>
  196. <template
  197. x-if="cell.column.id === 'id'">
  198. <span
  199. class="text-base-content/70 font-mono text-xs uppercase"
  200. x-text="cell.row.original.id"></span>
  201. </template>
  202. <template
  203. x-if="cell.column.id === 'status'">
  204. <span
  205. :class="{
  206. 'badge badge-success badge-sm badge-soft': cell.row.original.status === 'detected',
  207. 'badge badge-info badge-sm badge-soft': cell.row.original.status === 'help',
  208. 'badge badge-error badge-sm badge-soft': cell.row.original.status === 'away',
  209. 'badge badge-ghost badge-sm': ['lost', null, undefined].includes(cell.row.original.status)
  210. }"
  211. x-text="cell.row.original.status.charAt(0).toUpperCase() + cell.row.original.status.slice(1)"></span>
  212. </template>
  213. <template
  214. x-if="cell.column.id === 'time'">
  215. <p
  216. class="space-x-1 whitespace-nowrap">
  217. <span
  218. x-text="new Date(cell.row.original.time).toLocaleDateString('it-IT', {day: 'numeric', month: 'short', year: '2-digit'})"></span>
  219. <span
  220. class="text-base-content/60 text-xs"
  221. x-text="new Date(cell.row.original.time).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit', second: '2-digit'})"></span>
  222. </p>
  223. </template>
  224. <template
  225. x-if="cell.column.id === 'gateway'">
  226. <div
  227. class="flex items-center gap-2">
  228. <div>
  229. <p
  230. class="leading-none font-medium"
  231. x-text="cell.row.original.gatewayName"></p>
  232. <p
  233. class="text-base-content/70 mt-0.5 text-xs/none"
  234. x-text="cell.row.original.gatewayMac"></p>
  235. </div>
  236. </div>
  237. </template>
  238. <template
  239. x-if="cell.column.id === 'model'">
  240. <span
  241. class="text-base font-medium"
  242. x-text="cell.row.original.model"></span>
  243. </template>
  244. <template
  245. x-if="cell.column.id === 'signal'">
  246. <span
  247. class="text-base font-medium"
  248. x-text="cell.row.original.signal + '%'"></span>
  249. </template>
  250. <template
  251. x-if="cell.column.id === 'actions'">
  252. <div
  253. class="gap-2 text-right">
  254. <button
  255. aria-label="Show"
  256. class="saveButton btn btn-outline btn-primary"
  257. @click="viewRow(cell.row)"
  258. >Open</button>
  259. </div>
  260. </template>
  261. <template
  262. x-if="!
  263. ['id', 'time', 'subject', 'gateway', 'status', 'signal', 'actions'].includes(cell.column.id)">
  264. <span
  265. x-html="cell.column.columnDef.cell
  266. ? cell.column.columnDef.cell(cell.getContext())
  267. : cell.getValue()"></span>
  268. </template>
  269. </td>
  270. </template>
  271. </tr>
  272. </template>
  273. </template>
  274. </tbody>
  275. </table>
  276. </div>
  277. </div>
  278. <div class="post min-w-[400px] max-w-[600px] max-h-[calc(100vh-260px)] overflow-y-scroll border-solid border-1 border-[#008EED] rounded-none post{arguments:id} ml-[30px] mb-[30px] hidden"></div>
  279. </div>
  280. </div>