style updates
This commit is contained in:
@@ -66,10 +66,10 @@ final class KanbanBoard extends Component
|
||||
$workflow->dispatch(
|
||||
$freshTicket,
|
||||
$status->is_closed ? 'ticket.closed' : 'ticket.updated',
|
||||
Auth::user()
|
||||
Auth::user(),
|
||||
);
|
||||
|
||||
$message = 'Ticket '.$freshTicket->reference.' moved from '.$oldStatusName.' to '.$status->name.'.';
|
||||
$message = 'Ticket ' . $freshTicket->reference . ' moved from ' . $oldStatusName . ' to ' . $status->name . '.';
|
||||
session()->flash('success', $message);
|
||||
|
||||
$this->refreshBoard();
|
||||
@@ -112,7 +112,7 @@ final class KanbanBoard extends Component
|
||||
$fresh = $ticket->fresh(['status', 'priority', 'category', 'project', 'team', 'board']) ?? $ticket;
|
||||
$workflow->dispatch($fresh, 'ticket.updated', Auth::user());
|
||||
|
||||
$message = 'Ticket '.$fresh->reference.' moved from '.$oldBoardName.' to '.$board->name.'.';
|
||||
$message = 'Ticket ' . $fresh->reference . ' moved from ' . $oldBoardName . ' to ' . $board->name . '.';
|
||||
session()->flash('success', $message);
|
||||
|
||||
$this->refreshBoard();
|
||||
@@ -213,7 +213,7 @@ final class KanbanBoard extends Component
|
||||
/**
|
||||
* Resolve the selected board from an already-loaded board collection.
|
||||
*
|
||||
* @param Collection<int, KanbanBoardModel> $boards
|
||||
* @param Collection<int, KanbanBoardModel> $boards
|
||||
*/
|
||||
private function resolveSelectedBoard(Collection $boards): ?KanbanBoardModel
|
||||
{
|
||||
@@ -241,7 +241,7 @@ final class KanbanBoard extends Component
|
||||
{
|
||||
DB::table('helpdesk_kanban_board_statuses')->updateOrInsert(
|
||||
['board_id' => $boardId, 'status_id' => $statusId],
|
||||
['sort_order' => 999, 'updated_at' => now(), 'created_at' => now()]
|
||||
['sort_order' => 999, 'updated_at' => now(), 'created_at' => now()],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ final class KanbanBoard extends Component
|
||||
'sort_order' => ($index + 1) * 10,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Modules\Helpdesk\Livewire;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -824,9 +826,11 @@ final class SettingsManager extends Component
|
||||
* which made every new Helpdesk settings CRUD form appear to do nothing.
|
||||
*
|
||||
* @template TModel of \Illuminate\Database\Eloquent\Model
|
||||
* @param class-string<TModel> $modelClass
|
||||
* @param int|string|null $id
|
||||
* @param array<string, mixed> $data
|
||||
*
|
||||
* @param class-string<TModel> $modelClass
|
||||
* @param int|string|null $id
|
||||
* @param array<string, mixed> $data
|
||||
*
|
||||
* @return TModel
|
||||
*/
|
||||
private function persistSettingModel(string $modelClass, int|string|null $id, array $data): object
|
||||
@@ -847,7 +851,7 @@ final class SettingsManager extends Component
|
||||
$model = $modelClass::query()->create($data);
|
||||
|
||||
return $model;
|
||||
} catch (\Illuminate\Database\QueryException $exception) {
|
||||
} catch (QueryException $exception) {
|
||||
throw ValidationException::withMessages([
|
||||
'settings' => 'The record could not be saved. Check the slug is unique for this section/company and try again.',
|
||||
]);
|
||||
@@ -857,7 +861,7 @@ final class SettingsManager extends Component
|
||||
/**
|
||||
* Clear the default flag on every other record without generating invalid null-id SQL.
|
||||
*
|
||||
* @param class-string<\Illuminate\Database\Eloquent\Model> $modelClass
|
||||
* @param class-string<Model> $modelClass
|
||||
*/
|
||||
private function clearOtherDefaults(string $modelClass, int|string|null $currentId, int|string|null $companyId = null): void
|
||||
{
|
||||
@@ -867,7 +871,7 @@ final class SettingsManager extends Component
|
||||
$query->whereKeyNot((int) $currentId);
|
||||
}
|
||||
|
||||
if (Schema::hasColumn((new $modelClass())->getTable(), 'company_id')) {
|
||||
if (Schema::hasColumn((new $modelClass)->getTable(), 'company_id')) {
|
||||
$query->where('company_id', filled($companyId) ? (int) $companyId : null);
|
||||
}
|
||||
|
||||
@@ -881,7 +885,7 @@ final class SettingsManager extends Component
|
||||
* nullable integer and exists rules expect a real null, so normalising here
|
||||
* keeps every settings CRUD form usable from the browser.
|
||||
*
|
||||
* @param array<int, string> $keys
|
||||
* @param array<int, string> $keys
|
||||
*/
|
||||
private function normalizeNullableFormValues(string $formProperty, array $keys): void
|
||||
{
|
||||
@@ -906,7 +910,8 @@ final class SettingsManager extends Component
|
||||
/**
|
||||
* Remove is_default before save when the database has not been migrated yet.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $data
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function guardDefaultColumn(string $table, array $data): array
|
||||
|
||||
@@ -52,7 +52,6 @@ final class TicketCreate extends Component
|
||||
|
||||
public bool $isSaving = false;
|
||||
|
||||
|
||||
/**
|
||||
* Validation rules are intentionally evaluated only when the user submits
|
||||
* the form, not while rich-text/select widgets are synchronising.
|
||||
@@ -77,8 +76,8 @@ final class TicketCreate extends Component
|
||||
'attachments' => ['array'],
|
||||
'attachments.*' => [
|
||||
'file',
|
||||
'max:'.config('helpdesk.max_upload_kb'),
|
||||
'mimes:'.implode(',', config('helpdesk.allowed_mimes')),
|
||||
'max:' . config('helpdesk.max_upload_kb'),
|
||||
'mimes:' . implode(',', config('helpdesk.allowed_mimes')),
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -121,7 +120,7 @@ final class TicketCreate extends Component
|
||||
'tag_ids' => $this->tag_ids,
|
||||
], $this->attachments);
|
||||
|
||||
session()->flash('success', 'Ticket '.$ticket->reference.' has been created.');
|
||||
session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.');
|
||||
|
||||
return $this->redirectRoute('helpdesk.tickets.index', navigate: true);
|
||||
} finally {
|
||||
|
||||
@@ -109,7 +109,7 @@ final class TicketEdit extends Component
|
||||
$this->validate();
|
||||
$this->validate([
|
||||
'attachments' => 'array',
|
||||
'attachments.*' => 'file|max:'.config('helpdesk.max_upload_kb', 10240).'|mimes:'.implode(',', config('helpdesk.allowed_mimes', ['jpg', 'jpeg', 'png', 'pdf', 'txt', 'log', 'zip'])),
|
||||
'attachments.*' => 'file|max:' . config('helpdesk.max_upload_kb', 10240) . '|mimes:' . implode(',', config('helpdesk.allowed_mimes', ['jpg', 'jpeg', 'png', 'pdf', 'txt', 'log', 'zip'])),
|
||||
'tag_ids.*' => 'integer|exists:helpdesk_tags,id',
|
||||
]);
|
||||
|
||||
@@ -142,7 +142,7 @@ final class TicketEdit extends Component
|
||||
$fresh = $this->freshTicket($this->ticket);
|
||||
$workflow->dispatch($fresh, $status->is_closed ? 'ticket.closed' : 'ticket.updated', Auth::user());
|
||||
|
||||
session()->flash('success', 'Ticket '.$fresh->reference.' has been updated.');
|
||||
session()->flash('success', 'Ticket ' . $fresh->reference . ' has been updated.');
|
||||
|
||||
return redirect()->route('helpdesk.tickets.show', $fresh);
|
||||
}
|
||||
@@ -276,7 +276,7 @@ final class TicketEdit extends Component
|
||||
}
|
||||
|
||||
$disk = (string) config('helpdesk.disk', 'local');
|
||||
$path = $upload->store('tickets/'.$this->ticket->id, $disk);
|
||||
$path = $upload->store('tickets/' . $this->ticket->id, $disk);
|
||||
$this->ticket->attachments()->create($this->attachmentPayload($upload, $path, $disk));
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,9 @@ final class TicketIndex extends Component
|
||||
->when($this->priority !== '', fn (Builder $query): Builder => $query->where('priority_id', (int) $this->priority))
|
||||
->when($search !== '', static function (Builder $query) use ($search): Builder {
|
||||
return $query->where(static function (Builder $subQuery) use ($search): void {
|
||||
$subQuery->where('reference', 'like', '%'.$search.'%')
|
||||
->orWhere('subject', 'like', '%'.$search.'%')
|
||||
->orWhere('body', 'like', '%'.$search.'%');
|
||||
$subQuery->where('reference', 'like', '%' . $search . '%')
|
||||
->orWhere('subject', 'like', '%' . $search . '%')
|
||||
->orWhere('body', 'like', '%' . $search . '%');
|
||||
});
|
||||
})
|
||||
->latest('last_activity_at')
|
||||
|
||||
@@ -92,7 +92,7 @@ final class TicketShow extends Component
|
||||
|
||||
$this->validate([
|
||||
'commentBody' => ['required', 'string', 'min:2'],
|
||||
'attachments.*' => 'file|max:'.config('helpdesk.max_upload_kb', 10240).'|mimes:'.implode(',', config('helpdesk.allowed_mimes', ['jpg', 'jpeg', 'png', 'pdf', 'txt', 'log', 'zip'])),
|
||||
'attachments.*' => 'file|max:' . config('helpdesk.max_upload_kb', 10240) . '|mimes:' . implode(',', config('helpdesk.allowed_mimes', ['jpg', 'jpeg', 'png', 'pdf', 'txt', 'log', 'zip'])),
|
||||
]);
|
||||
|
||||
$tickets->comment($this->ticket, Auth::user(), $this->commentBody, $this->internal, $this->attachments);
|
||||
@@ -120,7 +120,6 @@ final class TicketShow extends Component
|
||||
$this->dispatch('helpdesk-reply-added');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refresh ticket aggregates and the time-log modal after the timer component starts or stops.
|
||||
*/
|
||||
@@ -143,7 +142,7 @@ final class TicketShow extends Component
|
||||
->findOrFail($this->canned_response_id);
|
||||
|
||||
$rendered = $renderer->render($response->body, $this->ticket, Auth::user());
|
||||
$this->commentBody = trim($this->commentBody."\n\n".$rendered);
|
||||
$this->commentBody = trim($this->commentBody . "\n\n" . $rendered);
|
||||
$this->dispatch('helpdesk-canned-response-applied', body: $this->commentBody);
|
||||
}
|
||||
|
||||
@@ -211,7 +210,7 @@ final class TicketShow extends Component
|
||||
$this->closureInternal,
|
||||
[],
|
||||
null,
|
||||
'Closure comment'
|
||||
'Closure comment',
|
||||
);
|
||||
|
||||
$this->reset(['closureComment', 'closureInternal']);
|
||||
@@ -221,7 +220,7 @@ final class TicketShow extends Component
|
||||
|
||||
$workflow->dispatch($this->ticket, $status->is_closed ? 'ticket.closed' : 'ticket.updated', Auth::user());
|
||||
|
||||
session()->flash('ticket-action-updated', 'Status updated to '.$this->ticket->status?->name.'.');
|
||||
session()->flash('ticket-action-updated', 'Status updated to ' . $this->ticket->status?->name . '.');
|
||||
$this->dispatch('helpdesk-status-updated', statusId: $this->status_id);
|
||||
}
|
||||
|
||||
@@ -254,7 +253,7 @@ final class TicketShow extends Component
|
||||
|
||||
$workflow->dispatch($this->ticket, 'ticket.updated', Auth::user());
|
||||
|
||||
session()->flash('ticket-action-updated', 'Priority updated to '.$this->ticket->priority?->name.'.');
|
||||
session()->flash('ticket-action-updated', 'Priority updated to ' . $this->ticket->priority?->name . '.');
|
||||
$this->dispatch('helpdesk-priority-updated', priorityId: $this->priority_id);
|
||||
}
|
||||
|
||||
@@ -291,7 +290,7 @@ final class TicketShow extends Component
|
||||
|
||||
session()->flash('ticket-action-updated', $this->agent_id === null
|
||||
? 'Ticket is now unassigned.'
|
||||
: 'Ticket assigned to '.$this->ticket->agent?->name.'.');
|
||||
: 'Ticket assigned to ' . $this->ticket->agent?->name . '.');
|
||||
|
||||
$this->dispatch('helpdesk-agent-updated', agentId: $this->agent_id);
|
||||
}
|
||||
@@ -305,7 +304,7 @@ final class TicketShow extends Component
|
||||
|
||||
$this->validate([
|
||||
'supportingFiles' => ['required', 'array', 'min:1'],
|
||||
'supportingFiles.*' => ['file', 'max:'.$maxUploadKilobytes, 'mimes:'.$allowedMimes],
|
||||
'supportingFiles.*' => ['file', 'max:' . $maxUploadKilobytes, 'mimes:' . $allowedMimes],
|
||||
]);
|
||||
|
||||
$user = Auth::user();
|
||||
@@ -398,7 +397,6 @@ final class TicketShow extends Component
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the first-response SLA headline for the SLA panel.
|
||||
*/
|
||||
@@ -421,14 +419,14 @@ final class TicketShow extends Component
|
||||
public function firstResponseSlaDetail(): string
|
||||
{
|
||||
if ($this->ticket->first_response_at !== null) {
|
||||
return 'Responded in '.$this->formatDurationBetween($this->ticket->created_at, $this->ticket->first_response_at);
|
||||
return 'Responded in ' . $this->formatDurationBetween($this->ticket->created_at, $this->ticket->first_response_at);
|
||||
}
|
||||
|
||||
if ($this->ticket->sla_first_response_due_at === null) {
|
||||
return 'No first-response target is set.';
|
||||
}
|
||||
|
||||
return 'Due '.$this->ticket->sla_first_response_due_at->format('d M Y H:i');
|
||||
return 'Due ' . $this->ticket->sla_first_response_due_at->format('d M Y H:i');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -489,14 +487,14 @@ final class TicketShow extends Component
|
||||
public function resolutionSlaDetail(): string
|
||||
{
|
||||
if ($this->ticket->completed_at !== null) {
|
||||
return 'Resolved in '.$this->formatDurationBetween($this->ticket->created_at, $this->ticket->completed_at);
|
||||
return 'Resolved in ' . $this->formatDurationBetween($this->ticket->created_at, $this->ticket->completed_at);
|
||||
}
|
||||
|
||||
if ($this->ticket->sla_resolution_due_at === null) {
|
||||
return 'No resolution target is set.';
|
||||
}
|
||||
|
||||
return 'Due '.$this->ticket->sla_resolution_due_at->format('d M Y H:i');
|
||||
return 'Due ' . $this->ticket->sla_resolution_due_at->format('d M Y H:i');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,7 +537,7 @@ final class TicketShow extends Component
|
||||
$seconds = max(0, $start->diffInSeconds($end));
|
||||
|
||||
if ($seconds < 60) {
|
||||
return $seconds.' seconds';
|
||||
return $seconds . ' seconds';
|
||||
}
|
||||
|
||||
return CarbonInterval::seconds($seconds)
|
||||
|
||||
Reference in New Issue
Block a user