Skip to content

Commit 533a827

Browse files
committed
Ticket statuses!
1 parent b0b098c commit 533a827

File tree

9 files changed

+297
-7
lines changed

9 files changed

+297
-7
lines changed

app/Models/SupportTicket.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace App\Models;
44

55
use App\Models\SupportTicket\Reply;
6+
use App\SupportTicket\Status;
7+
use Illuminate\Database\Eloquent\Casts\Attribute;
68
use Illuminate\Database\Eloquent\Factories\HasFactory;
79
use Illuminate\Database\Eloquent\Model;
810
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -21,6 +23,10 @@ class SupportTicket extends Model
2123
'status',
2224
];
2325

26+
protected $casts = [
27+
'status' => Status::class,
28+
];
29+
2430
protected static function booted()
2531
{
2632
static::creating(function ($ticket) {

app/SupportTicket/Status.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace App\SupportTicket;
4+
5+
enum Status: string
6+
{
7+
case OPEN = 'open';
8+
case IN_PROGRESS = 'in_progress';
9+
case ON_HOLD = 'on_hold';
10+
case RESPONDED = 'responded';
11+
case CLOSED = 'closed';
12+
13+
public function translated(): string
14+
{
15+
return __('account.support_ticket.status.' . $this->value);
16+
}
17+
}

lang/en/account.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
return [
4+
'support_ticket' => [
5+
'status' => [
6+
'open' => 'Open',
7+
'in_progress' => 'In Progress',
8+
'on_hold' => 'On Hold',
9+
'responded' => 'Responded',
10+
'closed' => 'Closed',
11+
],
12+
],
13+
];

lang/en/auth.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Authentication Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines are used during authentication for various
11+
| messages that we need to display to the user. You are free to modify
12+
| these language lines according to your application's requirements.
13+
|
14+
*/
15+
16+
'failed' => 'These credentials do not match our records.',
17+
'password' => 'The provided password is incorrect.',
18+
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
19+
20+
];

lang/en/pagination.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Pagination Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines are used by the paginator library to build
11+
| the simple pagination links. You are free to change them to anything
12+
| you want to customize your views to better match your application.
13+
|
14+
*/
15+
16+
'previous' => '&laquo; Previous',
17+
'next' => 'Next &raquo;',
18+
19+
];

lang/en/passwords.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Password Reset Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines are the default lines which match reasons
11+
| that are given by the password broker for a password update attempt
12+
| has failed, such as for an invalid token or invalid new password.
13+
|
14+
*/
15+
16+
'reset' => 'Your password has been reset.',
17+
'sent' => 'We have emailed your password reset link.',
18+
'throttled' => 'Please wait before retrying.',
19+
'token' => 'This password reset token is invalid.',
20+
'user' => "We can't find a user with that email address.",
21+
22+
];

lang/en/validation.php

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Validation Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines contain the default error messages used by
11+
| the validator class. Some of these rules have multiple versions such
12+
| as the size rules. Feel free to tweak each of these messages here.
13+
|
14+
*/
15+
16+
'accepted' => 'The :attribute field must be accepted.',
17+
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
18+
'active_url' => 'The :attribute field must be a valid URL.',
19+
'after' => 'The :attribute field must be a date after :date.',
20+
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
21+
'alpha' => 'The :attribute field must only contain letters.',
22+
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
23+
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
24+
'array' => 'The :attribute field must be an array.',
25+
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
26+
'before' => 'The :attribute field must be a date before :date.',
27+
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
28+
'between' => [
29+
'array' => 'The :attribute field must have between :min and :max items.',
30+
'file' => 'The :attribute field must be between :min and :max kilobytes.',
31+
'numeric' => 'The :attribute field must be between :min and :max.',
32+
'string' => 'The :attribute field must be between :min and :max characters.',
33+
],
34+
'boolean' => 'The :attribute field must be true or false.',
35+
'can' => 'The :attribute field contains an unauthorized value.',
36+
'confirmed' => 'The :attribute field confirmation does not match.',
37+
'current_password' => 'The password is incorrect.',
38+
'date' => 'The :attribute field must be a valid date.',
39+
'date_equals' => 'The :attribute field must be a date equal to :date.',
40+
'date_format' => 'The :attribute field must match the format :format.',
41+
'decimal' => 'The :attribute field must have :decimal decimal places.',
42+
'declined' => 'The :attribute field must be declined.',
43+
'declined_if' => 'The :attribute field must be declined when :other is :value.',
44+
'different' => 'The :attribute field and :other must be different.',
45+
'digits' => 'The :attribute field must be :digits digits.',
46+
'digits_between' => 'The :attribute field must be between :min and :max digits.',
47+
'dimensions' => 'The :attribute field has invalid image dimensions.',
48+
'distinct' => 'The :attribute field has a duplicate value.',
49+
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
50+
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
51+
'email' => 'The :attribute field must be a valid email address.',
52+
'ends_with' => 'The :attribute field must end with one of the following: :values.',
53+
'enum' => 'The selected :attribute is invalid.',
54+
'exists' => 'The selected :attribute is invalid.',
55+
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
56+
'file' => 'The :attribute field must be a file.',
57+
'filled' => 'The :attribute field must have a value.',
58+
'gt' => [
59+
'array' => 'The :attribute field must have more than :value items.',
60+
'file' => 'The :attribute field must be greater than :value kilobytes.',
61+
'numeric' => 'The :attribute field must be greater than :value.',
62+
'string' => 'The :attribute field must be greater than :value characters.',
63+
],
64+
'gte' => [
65+
'array' => 'The :attribute field must have :value items or more.',
66+
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
67+
'numeric' => 'The :attribute field must be greater than or equal to :value.',
68+
'string' => 'The :attribute field must be greater than or equal to :value characters.',
69+
],
70+
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
71+
'image' => 'The :attribute field must be an image.',
72+
'in' => 'The selected :attribute is invalid.',
73+
'in_array' => 'The :attribute field must exist in :other.',
74+
'integer' => 'The :attribute field must be an integer.',
75+
'ip' => 'The :attribute field must be a valid IP address.',
76+
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
77+
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
78+
'json' => 'The :attribute field must be a valid JSON string.',
79+
'lowercase' => 'The :attribute field must be lowercase.',
80+
'lt' => [
81+
'array' => 'The :attribute field must have less than :value items.',
82+
'file' => 'The :attribute field must be less than :value kilobytes.',
83+
'numeric' => 'The :attribute field must be less than :value.',
84+
'string' => 'The :attribute field must be less than :value characters.',
85+
],
86+
'lte' => [
87+
'array' => 'The :attribute field must not have more than :value items.',
88+
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
89+
'numeric' => 'The :attribute field must be less than or equal to :value.',
90+
'string' => 'The :attribute field must be less than or equal to :value characters.',
91+
],
92+
'mac_address' => 'The :attribute field must be a valid MAC address.',
93+
'max' => [
94+
'array' => 'The :attribute field must not have more than :max items.',
95+
'file' => 'The :attribute field must not be greater than :max kilobytes.',
96+
'numeric' => 'The :attribute field must not be greater than :max.',
97+
'string' => 'The :attribute field must not be greater than :max characters.',
98+
],
99+
'max_digits' => 'The :attribute field must not have more than :max digits.',
100+
'mimes' => 'The :attribute field must be a file of type: :values.',
101+
'mimetypes' => 'The :attribute field must be a file of type: :values.',
102+
'min' => [
103+
'array' => 'The :attribute field must have at least :min items.',
104+
'file' => 'The :attribute field must be at least :min kilobytes.',
105+
'numeric' => 'The :attribute field must be at least :min.',
106+
'string' => 'The :attribute field must be at least :min characters.',
107+
],
108+
'min_digits' => 'The :attribute field must have at least :min digits.',
109+
'missing' => 'The :attribute field must be missing.',
110+
'missing_if' => 'The :attribute field must be missing when :other is :value.',
111+
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
112+
'missing_with' => 'The :attribute field must be missing when :values is present.',
113+
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
114+
'multiple_of' => 'The :attribute field must be a multiple of :value.',
115+
'not_in' => 'The selected :attribute is invalid.',
116+
'not_regex' => 'The :attribute field format is invalid.',
117+
'numeric' => 'The :attribute field must be a number.',
118+
'password' => [
119+
'letters' => 'The :attribute field must contain at least one letter.',
120+
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
121+
'numbers' => 'The :attribute field must contain at least one number.',
122+
'symbols' => 'The :attribute field must contain at least one symbol.',
123+
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
124+
],
125+
'present' => 'The :attribute field must be present.',
126+
'present_if' => 'The :attribute field must be present when :other is :value.',
127+
'present_unless' => 'The :attribute field must be present unless :other is :value.',
128+
'present_with' => 'The :attribute field must be present when :values is present.',
129+
'present_with_all' => 'The :attribute field must be present when :values are present.',
130+
'prohibited' => 'The :attribute field is prohibited.',
131+
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
132+
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
133+
'prohibits' => 'The :attribute field prohibits :other from being present.',
134+
'regex' => 'The :attribute field format is invalid.',
135+
'required' => 'The :attribute field is required.',
136+
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
137+
'required_if' => 'The :attribute field is required when :other is :value.',
138+
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
139+
'required_unless' => 'The :attribute field is required unless :other is in :values.',
140+
'required_with' => 'The :attribute field is required when :values is present.',
141+
'required_with_all' => 'The :attribute field is required when :values are present.',
142+
'required_without' => 'The :attribute field is required when :values is not present.',
143+
'required_without_all' => 'The :attribute field is required when none of :values are present.',
144+
'same' => 'The :attribute field must match :other.',
145+
'size' => [
146+
'array' => 'The :attribute field must contain :size items.',
147+
'file' => 'The :attribute field must be :size kilobytes.',
148+
'numeric' => 'The :attribute field must be :size.',
149+
'string' => 'The :attribute field must be :size characters.',
150+
],
151+
'starts_with' => 'The :attribute field must start with one of the following: :values.',
152+
'string' => 'The :attribute field must be a string.',
153+
'timezone' => 'The :attribute field must be a valid timezone.',
154+
'unique' => 'The :attribute has already been taken.',
155+
'uploaded' => 'The :attribute failed to upload.',
156+
'uppercase' => 'The :attribute field must be uppercase.',
157+
'url' => 'The :attribute field must be a valid URL.',
158+
'ulid' => 'The :attribute field must be a valid ULID.',
159+
'uuid' => 'The :attribute field must be a valid UUID.',
160+
161+
/*
162+
|--------------------------------------------------------------------------
163+
| Custom Validation Language Lines
164+
|--------------------------------------------------------------------------
165+
|
166+
| Here you may specify custom validation messages for attributes using the
167+
| convention "attribute.rule" to name the lines. This makes it quick to
168+
| specify a specific custom language line for a given attribute rule.
169+
|
170+
*/
171+
172+
'custom' => [
173+
'attribute-name' => [
174+
'rule-name' => 'custom-message',
175+
],
176+
],
177+
178+
/*
179+
|--------------------------------------------------------------------------
180+
| Custom Validation Attributes
181+
|--------------------------------------------------------------------------
182+
|
183+
| The following language lines are used to swap our attribute placeholder
184+
| with something more reader friendly such as "E-Mail Address" instead
185+
| of "email". This simply helps us make our message more expressive.
186+
|
187+
*/
188+
189+
'attributes' => [],
190+
191+
];

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
Submit a new request
1818
</a>
1919
</div>
20-
<div class="overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700 mb-10 pb-5">
21-
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 mb-5">
20+
<div class="overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-700 mb-10">
21+
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
2222
<thead class="bg-gray-50 dark:bg-gray-800">
2323
<tr>
2424
<th scope="col" class="px-6 py-3 text-left text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400">
@@ -46,7 +46,7 @@
4646
</td>
4747
<td class="whitespace-nowrap px-6 py-4 text-sm">
4848
<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-
{{ $ticket->status }}
49+
{{ $ticket->status->translated() }}
5050
</span>
5151
</td>
5252
<td class="whitespace-nowrap px-6 py-4 text-right text-sm font-medium">
@@ -65,9 +65,11 @@
6565
</tbody>
6666
</table>
6767

68-
<div class="px-5">
69-
{{ $supportTickets->links() }}
70-
</div>
68+
@if ($supportTickets->hasPages())
69+
<div class="p-5">
70+
{{ $supportTickets->links() }}
71+
</div>
72+
@endif
7173
</div>
7274
{{-- Additional Support Information --}}
7375
<div class="mt-20 rounded-xl bg-gradient-to-br from-[#FFF0DC] to-[#E8EEFF] p-8 dark:from-blue-900/10 dark:to-[#4c407f]/25">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222
<p class="text-gray-700 dark:text-gray-300">
2323
Ticket ID: <strong>#{{ $supportTicket->mask }}</strong><br>
24-
Status: <strong>{{ $supportTicket->status }}</strong><br>
24+
Status: <strong>{{ $supportTicket->status->translated() }}</strong><br>
2525
Created At: <strong>{{ $supportTicket->created_at->format('d M Y, H:i') }}</strong><br>
2626
Updated At: <strong>{{ $supportTicket->updated_at->format('d M Y, H:i') }}</strong>
2727
</p>

0 commit comments

Comments
 (0)