feat: AfterSales CRM - SOP compliant real-estate customer care system
- Departments + cross-department transfer workflow - Role-based closing (staff→resolved, manager→closed) with proof_of_resolution - Private file storage with collection system + temporary signed URLs - Dashboard: resolved tickets table, stats, handler performance bar chart - Spatie RBAC (admin/manager/staff) - Notifications: TicketTransferred, TicketClosed (database + mail) - Pest tests: 8 tests, 21 assertions - Docker production-ready (Dockerfile + compose + entrypoint)
This commit is contained in:
46
app/Notifications/TicketClosed.php
Normal file
46
app/Notifications/TicketClosed.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Feedback;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class TicketClosed extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public Feedback $feedback,
|
||||
public User $actor,
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Ticket #{id} đã được đóng', ['id' => $this->feedback->id]))
|
||||
->line(__('Ticket: :title', ['title' => $this->feedback->title]))
|
||||
->line(__('Đóng bởi: :name', ['name' => $this->actor->name]))
|
||||
->action(__('Xem Ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
|
||||
}
|
||||
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'message' => __('Ticket #{id} ":title" đã được đóng bởi :actor.', [
|
||||
'id' => $this->feedback->id,
|
||||
'title' => $this->feedback->title,
|
||||
'actor' => $this->actor->name,
|
||||
]),
|
||||
'feedback_id' => $this->feedback->id,
|
||||
'actor_name' => $this->actor->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
51
app/Notifications/TicketTransferred.php
Normal file
51
app/Notifications/TicketTransferred.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Feedback;
|
||||
use App\Models\TicketTransferLog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class TicketTransferred extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public Feedback $feedback,
|
||||
public TicketTransferLog $transferLog,
|
||||
public User $sender,
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject(__('Ticket #{id} đã được chuyển đến phòng của bạn', ['id' => $this->feedback->id]))
|
||||
->line(__('Ticket: :title', ['title' => $this->feedback->title]))
|
||||
->line(__('Người chuyển: :name', ['name' => $this->sender->name]))
|
||||
->line(__('Lý do: :reason', ['reason' => $this->transferLog->reason]))
|
||||
->action(__('Xem Ticket'), url('/admin/feedbacks/' . $this->feedback->id . '/edit'));
|
||||
}
|
||||
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'message' => __('Ticket #{id} ":title" đã được chuyển đến phòng của bạn bởi :sender.', [
|
||||
'id' => $this->feedback->id,
|
||||
'title' => $this->feedback->title,
|
||||
'sender' => $this->sender->name,
|
||||
]),
|
||||
'feedback_id' => $this->feedback->id,
|
||||
'sender_name' => $this->sender->name,
|
||||
'reason' => $this->transferLog->reason,
|
||||
'to_department_id' => $this->transferLog->to_department_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user