You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

331 rivejä
14 KiB

  1. <div class="h-full lg:min-w-full xl:min-w-0" x-data="UI.createTable({db:'{arguments:db}'})">
  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 {arguments:id}" js-text="test" js-do="{alert: 'test'}">{arguments:info}</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. <table class="table">
  137. <thead>
  138. <template
  139. x-for="headerGroup in table.getHeaderGroups()"
  140. :key="headerGroup.id">
  141. <tr>
  142. <template
  143. x-for="header in headerGroup.headers"
  144. :key="header.id">
  145. <th
  146. class="text-[#008EED]",
  147. x-show="!header.isPlaceholder"
  148. x-text="flexRender(header.column.columnDef.header, header.getContext())"></th>
  149. </template>
  150. </tr>
  151. </template>
  152. </thead>
  153. <tbody>
  154. <template x-if="!visibleRows.length">
  155. <tr>
  156. <td
  157. :colspan="columns.length"
  158. class="h-24 text-center">
  159. <p>
  160. No results.
  161. <span
  162. @click="clearFilters"
  163. class="text-primary cursor-pointer hover:underline">
  164. Clear filters
  165. </span>
  166. </p>
  167. </td>
  168. </tr>
  169. </template>
  170. <template x-if="visibleRows.length">
  171. <template
  172. x-for="row in visibleRows"
  173. :key="row.id"
  174. >
  175. <tr>
  176. <template
  177. x-for="cell in getVisibleCells(row)"
  178. :key="cell.id"
  179. >
  180. <td>
  181. <template
  182. x-if="cell.column.id === 'subject'">
  183. <div
  184. class="flex items-center gap-2">
  185. <div>
  186. <p
  187. class="leading-none font-medium"
  188. x-text="cell.row.original.subject"></p>
  189. <p
  190. class="text-base-content/70 mt-0.5 text-xs/none"
  191. x-text="cell.row.original.tracker"></p>
  192. </div>
  193. </div>
  194. </template>
  195. <template
  196. x-if="cell.column.id === 'id'">
  197. <span
  198. class="text-base-content/70 font-mono text-xs uppercase"
  199. x-text="cell.row.original.id"></span>
  200. </template>
  201. <template
  202. x-if="cell.column.id === 'status'">
  203. <span
  204. :class="{
  205. 'badge badge-success badge-sm badge-soft': cell.row.original.status === true,
  206. 'badge badge-ghost badge-sm': [false, null, undefined].includes(cell.row.original.status)
  207. }"
  208. x-text="(cell.row.original.status) ? 'Active' : 'Inactive'"></span>
  209. </template>
  210. <template
  211. x-if="cell.column.id === 'time'">
  212. <p
  213. class="space-x-1 whitespace-nowrap">
  214. <span
  215. x-text="new Date(cell.row.original.time).toLocaleDateString('it-IT', {day: 'numeric', month: 'short', year: '2-digit'})"></span>
  216. <span
  217. class="text-base-content/60 text-xs"
  218. x-text="new Date(cell.row.original.time).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'})"></span>
  219. </p>
  220. </template>
  221. <template
  222. x-if="cell.column.id === 'name'">
  223. <div
  224. class="flex items-center gap-2">
  225. <div>
  226. <p
  227. class="leading-none font-medium"
  228. x-text="cell.row.original.name"></p>
  229. <p
  230. class="text-base-content/70 mt-0.5 text-xs/none"
  231. x-text="cell.row.original.mac"></p>
  232. </div>
  233. </div>
  234. </template>
  235. <template
  236. x-if="cell.column.id === 'model'">
  237. <span
  238. class="text-base font-medium"
  239. x-text="cell.row.original.model"></span>
  240. </template>
  241. <template
  242. x-if="cell.column.id === 'ip'">
  243. <span
  244. class="text-base font-medium"
  245. x-text="cell.row.original.ip"></span>
  246. </template>
  247. <template
  248. x-if="cell.column.id === 'actions'">
  249. <div
  250. class="gap-2 text-right">
  251. <button
  252. aria-label="Show"
  253. class="saveButton btn btn-outline btn-primary"
  254. @click="viewRow(cell.row)"
  255. >Open</button>
  256. <!-- <button
  257. aria-label="Show"
  258. class="btn btn-soft btn-xs btn-square"
  259. @click="viewRow(cell.row)">
  260. <span
  261. class="iconify lucide--eye size-3.5"></span>
  262. </button>
  263. <button
  264. aria-label="Delete"
  265. class="btn btn-soft btn-error btn-xs btn-square"
  266. @click="deleteRow(cell.row)">
  267. <span
  268. class="iconify lucide--trash-2 size-3.5"></span>
  269. </button> -->
  270. </div>
  271. </template>
  272. <template
  273. x-if="!
  274. ['id', 'name', 'status', 'model', 'ip', 'position', 'actions'].includes(cell.column.id)">
  275. <span
  276. x-html="cell.column.columnDef.cell
  277. ? cell.column.columnDef.cell(cell.getContext())
  278. : cell.getValue()"></span>
  279. </template>
  280. </td>
  281. </template>
  282. </tr>
  283. </template>
  284. </template>
  285. </tbody>
  286. </table>
  287. </div>
  288. <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>
  289. </div>
  290. </div>