Skip to content

Commit

Permalink
refactor(ticket): Improve ticket message list ordered by desc
Browse files Browse the repository at this point in the history
  • Loading branch information
gnovaro committed Mar 20, 2024
1 parent 41e5e47 commit 35b304c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
10 changes: 6 additions & 4 deletions app/Models/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use App\Models\Ticket\Message;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Log;
Expand Down Expand Up @@ -47,7 +49,7 @@ class Ticket extends Model
#[OAT\Property(property: 'priority', type: 'string', example: 'medium')]
#[OAT\Property(property: 'order_id', type: 'int', example: 1)]
#[OAT\Property(property: 'status', type: 'string', example: 'new')]
public function customer()
public function customer(): BelongsTo
{
return $this->belongsTo(Customer::class);
}
Expand Down Expand Up @@ -82,12 +84,12 @@ public function statuses(): array
return ['new', 'assigned', 'duplicated', 'closed'];
}

public function messages()
public function messages(): HasMany
{
return $this->hasMany(Message::class);
return $this->hasMany(Message::class)->orderBy('created_at', 'desc');
}

public function company()
public function company(): BelongsTo
{
return $this->belongsTo(Company::class);
}
Expand Down
8 changes: 7 additions & 1 deletion lang/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
"Category" : "Categoría",
"Categories" : "Categorías",
"Cancel" : "Cancelar",
"Choose" : "Seleccionar",
"City" : "Ciudad",
"Close" : "Cerrar",
"Closed" : "Cerrado",
"Cold call": "Llamada en frío",
"Confirm" : "Confirmar",
"Confirm password" : "Confirmar constraseña",
"Contacts" : "Contactos",
Expand All @@ -37,6 +39,7 @@
"Country" : "País",
"Created at" : "Fecha alta",
"Currency" : "Moneda",
"Currencies" : "Monedas",
"Customer" : "Cliente",
"Customer deleted successfully" : "Cliente eliminado exitosamente",
"Customer :name successfully saved": "Cliente :name guardado con éxito",
Expand Down Expand Up @@ -69,6 +72,7 @@
"In progress" : "En progreso",
"In_progress" : "En progreso",
"Industry" : "Industria",
"Insurance" : "Seguros",
"Import" : "Importar",
"Job title" : "Puesto",
"Language" : "Idioma",
Expand Down Expand Up @@ -99,9 +103,9 @@
"Open" : "Abierto",
"Order" : "Pedido",
"Orders" : "Pedidos",
"Password" : "Contraseña",
"Permission": "Permiso",
"Permissions": "Permisos",
"Password" : "Contraseña",
"Phone" : "Teléfono",
"Photo" : "Foto",
"Preview" : "Vista previa",
Expand Down Expand Up @@ -142,9 +146,11 @@
"Taxes" : "Impuestos",
"to": "a",
"To" : "Para",
"Time zone" : "Huso horario",
"Title" : "Título",
"Today" : "Hoy",
"Type" : "Tipo",
"Type to search" : "Escribe para buscar",
"Update" : "Actualizar",
"Updated at" : "Fecha modificación",
"User" : "Usuario",
Expand Down
8 changes: 6 additions & 2 deletions resources/views/permissions/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<tr>
<th><button type="submit" class="btn btn-success">{{ __('Save') }}</button></th>
@foreach ($roles as $role)
<th scope="col">{{ $role->name }}</th>
<th scope="col">{{ __($role->name) }}</th>
@endforeach
</tr>
</thead>
Expand All @@ -23,7 +23,11 @@
@foreach ($roles as $role)
<th scope="col">
<div class="form-check">
<input name="roles[{{ $role->id }}][{{ $permission->id }}]" class="form-check-input" type="checkbox" value="{{ $permission->id }}" id="flexCheckChecked" @if($role->hasPermissionTo($permission->name)) checked @endif>
<input type="checkbox" name="roles[{{ $role->id }}][{{ $permission->id }}]"
class="form-check-input"
value="{{ $permission->id }}"
id="flexCheckChecked"
@if($role->hasPermissionTo($permission->name)) checked @endif>
</div>
</th>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion resources/views/ticket/ticket.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<tr>
<td>{{ $message->author->first_name }}</td>
<td>{{ $message->body }}</td>
<td>{{ $message->created_at->format('Y-m-d h:m') }}</td>
<td>{{ $message->created_at->format('d/m/Y h:m') }}</td>
</tr>
@endforeach
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

const APP_VERSION = '3.9.0';
const APP_VERSION = '3.9.1';

0 comments on commit 35b304c

Please sign in to comment.