|
1 | 1 | <template>
|
2 |
| - <div> |
3 |
| - <AppLayout title="Users"> |
| 2 | + <AppLayout title="Users"> |
4 | 3 |
|
5 |
| - <div class="py-12"> |
| 4 | + <template #header> |
| 5 | + <h2 class="flex justify-between text-xl font-semibold leading-tight text-gray-800"> |
| 6 | + Users |
6 | 7 |
|
7 |
| - <div class="mx-auto max-w-7xl sm:px-6 lg:px-8"> |
8 |
| - <div class="overflow-hidden bg-white shadow-xl sm:rounded-lg"> |
9 |
| - <div class="flex justify-end mt-3"> |
10 |
| - <div class="mb-3 xl:w-96"> |
11 |
| - <div class="relative flex items-stretch w-4/5 mb-3 input-group"> |
| 8 | + <inertia-link href="users/create"> |
| 9 | + <a |
| 10 | + class="px-4 py-2 mr-3 text-sm text-green-600 transition border border-green-300 rounded-full hover:bg-green-600 hover:text-white hover:border-transparent">Create |
| 11 | + user</a> |
| 12 | + </inertia-link> |
12 | 13 |
|
13 |
| - <input id="search" type='text' v-model="term" @keyup="search" |
14 |
| - class="outline-none focus:ring-0 rounded-r-none form-control relative min-w-0 block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0" |
15 |
| - placeholder="Search..."> |
| 14 | + </h2> |
| 15 | + </template> |
16 | 16 |
|
17 |
| - <button |
18 |
| - class="rounded-l-none btn px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out flex items-center" |
19 |
| - type="button" id="button-addon2"> |
20 |
| - <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" |
21 |
| - class="w-4" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> |
22 |
| - <path fill="currentColor" |
23 |
| - d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"> |
24 |
| - </path> |
25 |
| - </svg> |
26 |
| - </button> |
27 |
| - </div> |
| 17 | + <div class="py-12"> |
| 18 | + |
| 19 | + <div class="mx-auto max-w-7xl sm:px-6 lg:px-8"> |
| 20 | + <div class="overflow-hidden bg-white shadow-xl sm:rounded-lg"> |
| 21 | + <div class="flex justify-end mt-3"> |
| 22 | + <div class="mb-3 xl:w-96"> |
| 23 | + <div class="relative flex items-stretch w-4/5 mb-3 input-group"> |
| 24 | + |
| 25 | + <input id="search" type='text' v-model="term" @keyup="search" |
| 26 | + class="outline-none focus:ring-0 rounded-r-none form-control relative min-w-0 block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0" |
| 27 | + placeholder="Search..."> |
| 28 | + |
| 29 | + <button |
| 30 | + class="rounded-l-none btn px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out flex items-center" |
| 31 | + type="button" id="button-addon2"> |
| 32 | + <svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" |
| 33 | + class="w-4" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> |
| 34 | + <path fill="currentColor" |
| 35 | + d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"> |
| 36 | + </path> |
| 37 | + </svg> |
| 38 | + </button> |
28 | 39 | </div>
|
29 | 40 | </div>
|
30 |
| - <table class="min-w-full divide-y divide-gray-200"> |
31 |
| - <thead class="bg-gray-50"> |
32 |
| - <tr> |
33 |
| - <th scope="col" |
34 |
| - class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
35 |
| - Name |
36 |
| - </th> |
37 |
| - <th scope="col" |
38 |
| - class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
39 |
| - Email |
40 |
| - </th> |
41 |
| - <th scope="col" |
42 |
| - class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
43 |
| - Role |
44 |
| - </th> |
45 |
| - <th scope="col" |
46 |
| - class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
47 |
| - Created at |
48 |
| - </th> |
49 |
| - <th scope="col" class="relative px-6 py-3"> |
50 |
| - <span class="sr-only">Edit</span> |
51 |
| - </th> |
52 |
| - </tr> |
53 |
| - </thead> |
54 |
| - <tbody class="bg-white divide-y divide-gray-200"> |
55 |
| - <tr v-for="user in users" :key="user.id"> |
56 |
| - <td class="px-6 py-4 whitespace-nowrap"> |
57 |
| - <div class="flex items-center justify-center"> |
58 |
| - <div class="ml-4"> |
59 |
| - <div class="text-sm font-medium text-gray-900"> |
60 |
| - <inertia-link class="transition hover:text-blue-500" |
61 |
| - :href="`users/${user.id}`">{{ user.name }}</inertia-link> |
62 |
| - </div> |
| 41 | + </div> |
| 42 | + <table class="min-w-full divide-y divide-gray-200"> |
| 43 | + <thead class="bg-gray-50"> |
| 44 | + <tr> |
| 45 | + <th scope="col" |
| 46 | + class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
| 47 | + Name |
| 48 | + </th> |
| 49 | + <th scope="col" |
| 50 | + class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
| 51 | + Email |
| 52 | + </th> |
| 53 | + <th scope="col" |
| 54 | + class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
| 55 | + Role |
| 56 | + </th> |
| 57 | + <th scope="col" |
| 58 | + class="px-6 py-3 text-xs font-medium tracking-wider text-center text-gray-500 uppercase"> |
| 59 | + Created at |
| 60 | + </th> |
| 61 | + <th scope="col" class="relative px-6 py-3"> |
| 62 | + <span class="sr-only">Edit</span> |
| 63 | + </th> |
| 64 | + </tr> |
| 65 | + </thead> |
| 66 | + <tbody class="bg-white divide-y divide-gray-200"> |
| 67 | + <tr v-for="user in users" :key="user.id"> |
| 68 | + <td class="px-6 py-4 whitespace-nowrap"> |
| 69 | + <div class="flex items-center justify-center"> |
| 70 | + <div class="ml-4"> |
| 71 | + <div class="text-sm font-medium text-gray-900"> |
| 72 | + <inertia-link class="transition hover:text-blue-500" |
| 73 | + :href="`users/${user.id}`">{{ user.name }}</inertia-link> |
63 | 74 | </div>
|
64 | 75 | </div>
|
65 |
| - </td> |
66 |
| - <td class="px-6 py-4 whitespace-nowrap"> |
67 |
| - <div class="text-sm text-center text-gray-900"> |
68 |
| - <!-- Clickable user email address --> |
69 |
| - <a :href="'mailto:' + user.email">{{ user.email }}</a> |
70 |
| - </div> |
71 |
| - </td> |
72 |
| - <td class="px-6 py-4 whitespace-nowrap"> |
73 |
| - <div class="text-sm text-center text-gray-900"> |
74 |
| - <!-- Covering the case when there is no role --> |
75 |
| - {{ user.role ? user.role.name : 'Not available' }} |
76 |
| - </div> |
77 |
| - </td> |
78 |
| - <td class="px-6 py-4 text-center whitespace-nowrap"> |
79 |
| - <span |
80 |
| - class="inline-flex px-2 text-xs font-semibold leading-5 text-green-800 bg-green-100 rounded-full"> |
81 |
| - <!-- Formatted from user model appends propety --> |
82 |
| - {{ user.formatted_created_at }} |
83 |
| - </span> |
84 |
| - </td> |
85 |
| - <td class="px-6 py-4 text-sm font-medium text-right whitespace-nowrap"> |
| 76 | + </div> |
| 77 | + </td> |
| 78 | + <td class="px-6 py-4 whitespace-nowrap"> |
| 79 | + <div class="text-sm text-center text-gray-900"> |
| 80 | + <a :href="'mailto:' + user.email">{{ user.email }}</a> |
| 81 | + </div> |
| 82 | + </td> |
| 83 | + <td class="px-6 py-4 whitespace-nowrap"> |
| 84 | + <div class="text-sm text-center text-gray-900"> |
| 85 | + {{ user.role ? user.role.name : 'Not available' }} |
| 86 | + </div> |
| 87 | + </td> |
| 88 | + <td class="px-6 py-4 text-center whitespace-nowrap"> |
| 89 | + <span |
| 90 | + class="inline-flex px-2 text-xs font-semibold leading-5 text-green-800 bg-green-100 rounded-full"> |
| 91 | + {{ user.formatted_created_at }} |
| 92 | + </span> |
| 93 | + </td> |
| 94 | + <td class="px-6 py-4 text-sm font-medium text-right whitespace-nowrap"> |
86 | 95 |
|
87 |
| - <inertia-link :href="`/users/${user.id}/edit`" |
88 |
| - class="float-left px-4 py-2 text-green-400 duration-100 rounded hover:text-green-600"> |
89 |
| - <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" |
90 |
| - viewBox="0 0 24 24" stroke="currentColor"> |
91 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" |
92 |
| - d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" /> |
93 |
| - </svg></inertia-link> |
| 96 | + <inertia-link :href="`/users/${user.id}/edit`" |
| 97 | + class="float-left px-4 py-2 text-green-400 duration-100 rounded hover:text-green-600"> |
| 98 | + <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" |
| 99 | + viewBox="0 0 24 24" stroke="currentColor"> |
| 100 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" |
| 101 | + d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" /> |
| 102 | + </svg></inertia-link> |
94 | 103 |
|
95 |
| - <a href="#" @click="deleteUser(user)" |
96 |
| - class="float-left px-4 py-2 ml-2 text-red-400 duration-100 rounded hover:text-red-600"> |
97 |
| - <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" |
98 |
| - viewBox="0 0 24 24" stroke="currentColor"> |
99 |
| - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" |
100 |
| - d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /> |
101 |
| - </svg> |
102 |
| - </a> |
103 |
| - </td> |
104 |
| - </tr> |
105 |
| - </tbody> |
106 |
| - </table> |
107 |
| - <Pagination class="mt-6" :links="users.links" /> |
108 |
| - </div> |
| 104 | + <a href="#" @click="deleteUser(user)" |
| 105 | + class="float-left px-4 py-2 ml-2 text-red-400 duration-100 rounded hover:text-red-600"> |
| 106 | + <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" fill="none" |
| 107 | + viewBox="0 0 24 24" stroke="currentColor"> |
| 108 | + <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" |
| 109 | + d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" /> |
| 110 | + </svg> |
| 111 | + </a> |
| 112 | + </td> |
| 113 | + </tr> |
| 114 | + </tbody> |
| 115 | + </table> |
| 116 | + <!-- <Pagination class="mt-6" :links="users.links" /> --> |
109 | 117 | </div>
|
110 | 118 | </div>
|
111 |
| - |
112 |
| - </AppLayout> |
113 |
| - </div> |
| 119 | + </div> |
| 120 | + </AppLayout> |
114 | 121 | </template>
|
115 | 122 |
|
116 | 123 | <script>
|
|
0 commit comments