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:
52
app/Filament/Resources/Feedback/Pages/CreateFeedback.php
Normal file
52
app/Filament/Resources/Feedback/Pages/CreateFeedback.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Feedback\Pages;
|
||||
|
||||
use App\Filament\Resources\Feedback\FeedbackResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class CreateFeedback extends CreateRecord
|
||||
{
|
||||
protected static string $resource = FeedbackResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
if (($data['is_general'] ?? false) === true) {
|
||||
$data['customer_product_id'] = null;
|
||||
}
|
||||
unset($data['is_general'], $data['attachment_collection']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
$feedback = $this->getRecord();
|
||||
$attachments = $this->data['attachments'] ?? [];
|
||||
$collection = $this->data['attachment_collection'] ?? 'general';
|
||||
|
||||
$feedback->interactions()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'type' => 'note',
|
||||
'content' => 'Feedback created via ' . ($feedback->feedbackChannel?->name ?? 'unknown channel'),
|
||||
'changes' => ['status' => ['old' => null, 'new' => $feedback->status]],
|
||||
]);
|
||||
|
||||
if (! empty($attachments)) {
|
||||
$disk = Storage::disk('local');
|
||||
foreach ($attachments as $path) {
|
||||
$feedback->attachments()->create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'user_id' => auth()->id(),
|
||||
'name' => basename($path),
|
||||
'path' => $path,
|
||||
'disk' => 'local',
|
||||
'collection' => $collection,
|
||||
'mime_type' => $disk->mimeType($path),
|
||||
'size' => $disk->size($path),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user