Skip to content

Commit 3faf133

Browse files
committed
Support Ticket Listings
1 parent 3526a8c commit 3faf133

5 files changed

Lines changed: 75 additions & 88 deletions

File tree

database/factories/SupportTicketFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class SupportTicketFactory extends Factory
1414
public function definition(): array
1515
{
1616
return [
17-
'mask' => $this->faker->word(),
18-
'subject' => $this->faker->word(),
19-
'message' => $this->faker->word(),
20-
'status' => $this->faker->word(),
17+
'mask' => 'NATIVE-' . $this->faker->numberBetween(1000, 9999),
18+
'subject' => $this->faker->sentence(),
19+
'message' => $this->faker->paragraph(),
20+
'status' => 'open',
2121
'created_at' => Carbon::now(),
2222
'updated_at' => Carbon::now(),
2323

database/seeders/DatabaseSeeder.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ public function run(): void
1818
'email' => 'test@example.com',
1919
'password' => Hash::make('password'),
2020
]);
21+
22+
$this->call([
23+
SupportTicketSeeder::class,
24+
]);
2125
}
2226
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use App\Models\SupportTicket;
6+
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
7+
use Illuminate\Database\Seeder;
8+
9+
class SupportTicketSeeder extends Seeder
10+
{
11+
/**
12+
* Run the database seeds.
13+
*/
14+
public function run(): void
15+
{
16+
SupportTicket::factory()
17+
->count(10)
18+
->create([
19+
'user_id' => 1,
20+
'status' => 'open',
21+
]);
22+
}
23+
}

resources/views/support/tickets/index.blade.php

Lines changed: 24 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -37,78 +37,32 @@
3737
</tr>
3838
</thead>
3939
<tbody class="divide-y divide-gray-200 dark:divide-gray-700 bg-white dark:bg-gray-900">
40-
<tr>
41-
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
42-
#TKT-1001
43-
</td>
44-
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
45-
Installation issue on Windows 11
46-
</td>
47-
<td class="whitespace-nowrap px-6 py-4 text-sm">
40+
@forelse(auth()->user()->supportTickets as $ticket)
41+
<tr>
42+
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
43+
<a href="#" class="text-violet-600">#{{ $ticket->mask }}</a>
44+
</td>
45+
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
46+
{{ $ticket->subject }}
47+
</td>
48+
<td class="whitespace-nowrap px-6 py-4 text-sm">
4849
<span class="inline-flex rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800 dark:bg-green-900/30 dark:text-green-300">
49-
Open
50-
</span>
51-
</td>
52-
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
53-
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
54-
View
55-
</a>
56-
</td>
57-
</tr>
58-
<tr>
59-
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
60-
#TKT-1002
61-
</td>
62-
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
63-
API integration with third-party service
64-
</td>
65-
<td class="whitespace-nowrap px-6 py-4 text-sm">
66-
<span class="inline-flex rounded-full bg-yellow-100 px-2.5 py-0.5 text-xs font-medium text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300">
67-
In Progress
50+
{{ $ticket->status }}
6851
</span>
69-
</td>
70-
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
71-
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
72-
View
73-
</a>
74-
</td>
75-
</tr>
76-
<tr>
77-
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
78-
#TKT-1003
79-
</td>
80-
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
81-
Feature request: dark mode toggle
82-
</td>
83-
<td class="whitespace-nowrap px-6 py-4 text-sm">
84-
<span class="inline-flex rounded-full bg-blue-100 px-2.5 py-0.5 text-xs font-medium text-blue-800 dark:bg-blue-900/30 dark:text-blue-300">
85-
Responded
86-
</span>
87-
</td>
88-
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
89-
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
90-
View
91-
</a>
92-
</td>
93-
</tr>
94-
<tr>
95-
<td class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
96-
#TKT-1004
97-
</td>
98-
<td class="whitespace-nowrap px-6 py-4 text-sm text-gray-700 dark:text-gray-300">
99-
Database migration error
100-
</td>
101-
<td class="whitespace-nowrap px-6 py-4 text-sm">
102-
<span class="inline-flex rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-300">
103-
Closed
104-
</span>
105-
</td>
106-
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
107-
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
108-
View
109-
</a>
110-
</td>
111-
</tr>
52+
</td>
53+
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
54+
<a href="#" class="rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm hover:bg-violet-700 dark:bg-violet-700 dark:hover:bg-violet-600 transition duration-200">
55+
View
56+
</a>
57+
</td>
58+
</tr>
59+
@empty
60+
<tr>
61+
<td colspan="4" class="whitespace-nowrap px-6 py-4 text-sm font-medium text-gray-900 dark:text-white">
62+
No tickets found.
63+
</td>
64+
</tr>
65+
@endforelse
11266
</tbody>
11367
</table>
11468
</div>

routes/web.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use App\Http\Controllers\Account\AuthController;
44
use App\Http\Controllers\ShowDocumentationController;
5-
use Illuminate\Support\Facades\Auth;
65
use Illuminate\Support\Facades\Route;
76
use Illuminate\Support\Str;
87

@@ -58,19 +57,26 @@
5857
Route::get('/order/{checkoutSessionId}', App\Livewire\OrderSuccess::class)->name('order.success');
5958

6059
// Support
61-
Route::prefix('/support')->group(function () {
62-
Route::get('/', function () {
63-
return view('support.index');
64-
})->name('support.index');
65-
66-
Route::prefix('/tickets')
67-
->middleware(['auth:web'])
68-
->group(function () {
69-
Route::get('/', function () {
70-
return view('support.tickets.index');
71-
})->name('support.tickets');
72-
});
73-
});
60+
Route::prefix('/support')
61+
->middleware('auth:web')
62+
->group(function () {
63+
Route::get('/', function () {
64+
return view('support.index');
65+
})
66+
->withoutMiddleware(['auth:web'])
67+
->name('support.index');
68+
69+
Route::prefix('/tickets')
70+
->group(function () {
71+
Route::get('/', function () {
72+
return view('support.tickets.index');
73+
})->name('support.tickets');
74+
75+
Route::get('/{ticketMask}', function ($ticketMask) {
76+
return view('support.tickets.show', ['ticket' => $ticketMask]);
77+
})->name('support.tickets.show');
78+
});
79+
});
7480

7581
// Account
7682
Route::prefix('/account')

0 commit comments

Comments
 (0)