2024-05-30 17:56:10 +10:00
|
|
|
<script setup>
|
|
|
|
|
import { inject, ref, onMounted, computed } from 'vue'
|
|
|
|
|
import { initModals } from 'flowbite'
|
2024-06-06 13:04:36 +10:00
|
|
|
import { useRouter } from 'vue-router'
|
|
|
|
|
import { useRequestsStore } from '@/stores/requests'
|
2024-05-30 17:56:10 +10:00
|
|
|
import { storeToRefs } from 'pinia'
|
2024-06-04 17:38:13 +10:00
|
|
|
import CodexImage from '@/components/CodexImage.vue'
|
2024-06-06 15:28:29 +10:00
|
|
|
import StateIndicator from '@/components/StateIndicator.vue'
|
2024-05-30 17:56:10 +10:00
|
|
|
import { shortHex } from '@/utils/ids'
|
2024-06-06 15:28:29 +10:00
|
|
|
import { getStateColour } from '@/utils/requests'
|
2024-05-30 17:56:10 +10:00
|
|
|
|
2024-06-06 13:04:36 +10:00
|
|
|
const requestsStore = useRequestsStore()
|
|
|
|
|
const { requests } = storeToRefs(requestsStore)
|
|
|
|
|
const router = useRouter()
|
2024-05-30 17:56:10 +10:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-06-04 17:38:13 +10:00
|
|
|
<div>
|
2024-05-30 17:56:10 +10:00
|
|
|
<div
|
2024-06-04 17:38:13 +10:00
|
|
|
class="flex items-center justify-between flex-column md:flex-row flex-wrap space-y-4 md:space-y-0 py-4 px-6 bg-white dark:bg-gray-900"
|
2024-05-30 17:56:10 +10:00
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<button
|
|
|
|
|
id="dropdownActionButton"
|
|
|
|
|
data-dropdown-toggle="dropdownAction"
|
|
|
|
|
class="inline-flex items-center text-gray-500 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-3 py-1.5 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700"
|
|
|
|
|
type="button"
|
|
|
|
|
>
|
|
|
|
|
<span class="sr-only">Action button</span>
|
|
|
|
|
Action
|
|
|
|
|
<svg
|
|
|
|
|
class="w-2.5 h-2.5 ms-2.5"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 10 6"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="m1 1 4 4 4-4"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
<!-- Dropdown menu -->
|
|
|
|
|
<div
|
|
|
|
|
id="dropdownAction"
|
|
|
|
|
class="z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 dark:divide-gray-600"
|
|
|
|
|
>
|
|
|
|
|
<ul
|
|
|
|
|
class="py-1 text-sm text-gray-700 dark:text-gray-200"
|
|
|
|
|
aria-labelledby="dropdownActionButton"
|
|
|
|
|
>
|
|
|
|
|
<li>
|
|
|
|
|
<a
|
|
|
|
|
href="#"
|
|
|
|
|
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
|
|
|
>Reward</a
|
|
|
|
|
>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a
|
|
|
|
|
href="#"
|
|
|
|
|
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
|
|
|
>Promote</a
|
|
|
|
|
>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a
|
|
|
|
|
href="#"
|
|
|
|
|
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
|
|
|
|
|
>Activate account</a
|
|
|
|
|
>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="py-1">
|
|
|
|
|
<a
|
|
|
|
|
href="#"
|
|
|
|
|
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
|
>Delete User</a
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<label for="table-search-users" class="sr-only">Search</label>
|
|
|
|
|
<div class="relative">
|
|
|
|
|
<div
|
|
|
|
|
class="absolute inset-y-0 rtl:inset-r-0 start-0 flex items-center ps-3 pointer-events-none"
|
|
|
|
|
>
|
|
|
|
|
<svg
|
|
|
|
|
class="w-4 h-4 text-gray-500 dark:text-gray-400"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
fill="none"
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
>
|
|
|
|
|
<path
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
|
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="table-search-users"
|
|
|
|
|
class="block pt-2 ps-10 text-sm text-gray-900 border border-gray-300 rounded-lg w-80 bg-gray-50 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
|
|
|
placeholder="Search for users"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-06 13:04:36 +10:00
|
|
|
<div
|
|
|
|
|
class="relative overflow-x-auto overflow-y-auto max-h-screen shadow-md sm:rounded-lg border-t border-gray-50"
|
|
|
|
|
>
|
2024-06-04 17:38:13 +10:00
|
|
|
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
2024-06-06 13:04:36 +10:00
|
|
|
<thead
|
|
|
|
|
class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
|
|
|
|
|
>
|
2024-06-04 17:38:13 +10:00
|
|
|
<tr>
|
|
|
|
|
<th scope="col" class="px-6 py-3">RequestID</th>
|
|
|
|
|
<th scope="col" class="px-6 py-3">CID</th>
|
|
|
|
|
<th scope="col" class="px-6 py-3">State</th>
|
|
|
|
|
<th scope="col" class="px-6 py-3">Action</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr
|
2024-06-06 13:04:36 +10:00
|
|
|
v-for="([requestId, { content, state }], idx) in requests"
|
2024-06-04 17:38:13 +10:00
|
|
|
:key="{ requestId }"
|
2024-06-06 13:04:36 +10:00
|
|
|
class="cursor-pointer bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-600"
|
|
|
|
|
@click="router.push(`/request/${requestId}`)"
|
2024-05-30 17:56:10 +10:00
|
|
|
>
|
2024-06-04 17:38:13 +10:00
|
|
|
<th
|
|
|
|
|
scope="row"
|
|
|
|
|
class="flex items-center px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white"
|
2024-05-30 17:56:10 +10:00
|
|
|
>
|
2024-06-04 17:38:13 +10:00
|
|
|
<CodexImage
|
|
|
|
|
:local-only="!['New', 'Fulfilled'].includes(state)"
|
2024-06-06 13:04:36 +10:00
|
|
|
:cid="content.cid"
|
2024-06-04 17:38:13 +10:00
|
|
|
class="w-10 h-10 rounded-full mt-1"
|
|
|
|
|
/>
|
|
|
|
|
<div class="ps-3">
|
|
|
|
|
<div class="text-base font-semibold">{{ shortHex(requestId) }}</div>
|
|
|
|
|
<div class="font-normal text-gray-500">leslie@flowbite.com</div>
|
|
|
|
|
</div>
|
|
|
|
|
</th>
|
2024-06-06 13:04:36 +10:00
|
|
|
<td class="px-6 py-4">{{ shortHex(content.cid) }}</td>
|
2024-06-04 17:38:13 +10:00
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
<div class="flex items-center">
|
2024-06-06 15:28:29 +10:00
|
|
|
<StateIndicator :text="state" :color="getStateColour(state)"></StateIndicator>
|
2024-06-04 17:38:13 +10:00
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="px-6 py-4">
|
|
|
|
|
<!-- Modal toggle -->
|
|
|
|
|
<a
|
|
|
|
|
href="#"
|
|
|
|
|
type="button"
|
|
|
|
|
class="font-medium text-blue-600 dark:text-blue-500 hover:underline"
|
2024-06-06 13:04:36 +10:00
|
|
|
>View details</a
|
2024-06-04 17:38:13 +10:00
|
|
|
>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2024-05-30 17:56:10 +10:00
|
|
|
</div>
|
|
|
|
|
</template>
|