major ui updates
This commit is contained in:
@@ -11,8 +11,8 @@ class AnalyticsServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'analytics');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'analytics');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class AuditServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'audit');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'audit');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class CarrierManagementServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'carriermanagement');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'carriermanagement');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class ConfigurationServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'configuration');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'configuration');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class DocumentArchiveServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'documentarchive');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'documentarchive');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,13 +21,11 @@ trait HasHelpdeskTickets
|
||||
return $this->hasMany(Ticket::class, 'agent_id');
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function isHelpdeskAgent(): bool
|
||||
{
|
||||
return (bool) (($this->helpdesk_agent ?? false) || ($this->helpdesk_admin ?? false));
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function isHelpdeskAdmin(): bool
|
||||
{
|
||||
return (bool) ($this->helpdesk_admin ?? false);
|
||||
|
||||
@@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||
return [
|
||||
'route_prefix' => env('HELPDESK_ROUTE_PREFIX', 'helpdesk'),
|
||||
'middleware' => ['web', 'auth'],
|
||||
'disk' => env('HELPDESK_ATTACHMENTS_DISK', 'helpdesk'),
|
||||
'disk' => env('HELPDESK_ATTACHMENTS_DISK', 'local'),
|
||||
'max_upload_kb' => (int) env('HELPDESK_MAX_UPLOAD_KB', 10240),
|
||||
'allowed_mimes' => ['md', 'pdf', 'png', 'jpg', 'jpeg', 'webp', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'csv', 'zip'],
|
||||
'allowed_mimes' => ['md','pdf', 'png', 'jpg', 'jpeg', 'webp', 'doc', 'docx', 'xls', 'xlsx', 'txt', 'csv', 'zip'],
|
||||
'default_status_slug' => 'new',
|
||||
'closed_status_slug' => 'closed',
|
||||
];
|
||||
|
||||
+2
-4
@@ -6,11 +6,10 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
@@ -24,5 +23,4 @@ return new class extends Migration {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+2
-3
@@ -6,8 +6,8 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/** @return void */
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('helpdesk_tickets', static function (Blueprint $table): void {
|
||||
@@ -38,5 +38,4 @@ return new class extends Migration {
|
||||
$table->index('last_activity_at');
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+2
-3
@@ -6,8 +6,8 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/** @return void */
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('helpdesk_git_repositories', static function (Blueprint $table): void {
|
||||
@@ -75,5 +75,4 @@ return new class extends Migration {
|
||||
$table->index(['status', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
+2
-3
@@ -6,8 +6,8 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/** @return void */
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('helpdesk_comments', static function (Blueprint $table): void {
|
||||
@@ -37,5 +37,4 @@ return new class extends Migration {
|
||||
$table->index(['ticket_id', 'comment_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/** @return void */
|
||||
public function up(): void
|
||||
{
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'status_id'], 'hdesk_tickets_company_status_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'priority_id'], 'hdesk_tickets_company_priority_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'category_id'], 'hdesk_tickets_company_category_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['company_id', 'team_id'], 'hdesk_tickets_company_team_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['status_id', 'created_at'], 'hdesk_tickets_status_created_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['due_at'], 'hdesk_tickets_due_at_idx');
|
||||
$this->addIndex('helpdesk_tickets', ['archived_at'], 'hdesk_tickets_archived_at_idx');
|
||||
|
||||
$this->addIndex('helpdesk_comments', ['parent_id', 'created_at'], 'hdesk_comments_parent_created_idx');
|
||||
$this->addIndex('helpdesk_comments', ['user_id', 'created_at'], 'hdesk_comments_user_created_idx');
|
||||
|
||||
$this->addIndex('helpdesk_attachments', ['ticket_id'], 'hdesk_attachments_ticket_idx');
|
||||
$this->addIndex('helpdesk_attachments', ['comment_id'], 'hdesk_attachments_comment_idx');
|
||||
$this->addIndex('helpdesk_attachments', ['user_id'], 'hdesk_attachments_user_idx');
|
||||
|
||||
if (Schema::hasTable('helpdesk_projects')) {
|
||||
$this->addIndex('helpdesk_projects', ['company_id', 'archived_at'], 'hdesk_projects_company_archived_idx');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('helpdesk_teams')) {
|
||||
$this->addIndex('helpdesk_teams', ['company_id', 'archived_at'], 'hdesk_teams_company_archived_idx');
|
||||
}
|
||||
|
||||
if (Schema::hasTable('helpdesk_category_user')) {
|
||||
$this->addIndex('helpdesk_category_user', ['category_id', 'user_id'], 'hdesk_category_user_category_user_idx');
|
||||
$this->addIndex('helpdesk_category_user', ['user_id', 'category_id'], 'hdesk_category_user_user_category_idx');
|
||||
}
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function down(): void
|
||||
{
|
||||
foreach ([
|
||||
'helpdesk_tickets' => [
|
||||
'hdesk_tickets_company_status_idx',
|
||||
'hdesk_tickets_company_priority_idx',
|
||||
'hdesk_tickets_company_category_idx',
|
||||
'hdesk_tickets_company_team_idx',
|
||||
'hdesk_tickets_status_created_idx',
|
||||
'hdesk_tickets_due_at_idx',
|
||||
'hdesk_tickets_archived_at_idx',
|
||||
],
|
||||
'helpdesk_comments' => [
|
||||
'hdesk_comments_parent_created_idx',
|
||||
'hdesk_comments_user_created_idx',
|
||||
],
|
||||
'helpdesk_attachments' => [
|
||||
'hdesk_attachments_ticket_idx',
|
||||
'hdesk_attachments_comment_idx',
|
||||
'hdesk_attachments_user_idx',
|
||||
],
|
||||
'helpdesk_projects' => [
|
||||
'hdesk_projects_company_archived_idx',
|
||||
],
|
||||
'helpdesk_teams' => [
|
||||
'hdesk_teams_company_archived_idx',
|
||||
],
|
||||
'helpdesk_category_user' => [
|
||||
'hdesk_category_user_category_user_idx',
|
||||
'hdesk_category_user_user_category_idx',
|
||||
],
|
||||
] as $table => $indexes) {
|
||||
if (! Schema::hasTable($table)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Schema::table($table, function (Blueprint $tableBlueprint) use ($table, $indexes): void {
|
||||
foreach ($indexes as $index) {
|
||||
if ($this->indexExists($table, $index)) {
|
||||
$tableBlueprint->dropIndex($index);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an index only when the table exists and the named index does not exist.
|
||||
*
|
||||
* @param string $table
|
||||
* @param array<int, string> $columns
|
||||
* @param string $index
|
||||
* @return void
|
||||
*/
|
||||
private function addIndex(string $table, array $columns, string $index): void
|
||||
{
|
||||
if (! Schema::hasTable($table) || $this->indexExists($table, $index)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table($table, static function (Blueprint $tableBlueprint) use ($columns, $index): void {
|
||||
$tableBlueprint->index($columns, $index);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether an index exists for the current connection.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $index
|
||||
* @return bool
|
||||
*/
|
||||
private function indexExists(string $table, string $index): bool
|
||||
{
|
||||
if (method_exists(Schema::getFacadeRoot(), 'hasIndex')) {
|
||||
return Schema::hasIndex($table, $index);
|
||||
}
|
||||
|
||||
if (DB::getDriverName() === 'pgsql') {
|
||||
return DB::selectOne(
|
||||
'select 1 from pg_indexes where schemaname = current_schema() and tablename = ? and indexname = ? limit 1',
|
||||
[$table, $index]
|
||||
) !== null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('helpdesk_kanban_boards')) {
|
||||
Schema::create('helpdesk_kanban_boards', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['is_default', 'sort_order']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('helpdesk_kanban_boards');
|
||||
}
|
||||
};
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('helpdesk_kanban_board_statuses')) {
|
||||
Schema::create('helpdesk_kanban_board_statuses', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('board_id')->constrained('helpdesk_kanban_boards')->cascadeOnDelete();
|
||||
$table->foreignId('status_id')->constrained('helpdesk_statuses')->cascadeOnDelete();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['board_id', 'status_id']);
|
||||
$table->index(['board_id', 'sort_order']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('helpdesk_kanban_board_statuses');
|
||||
}
|
||||
};
|
||||
@@ -5,8 +5,10 @@ declare(strict_types=1);
|
||||
namespace Modules\Helpdesk\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Helpdesk\Models\Category;
|
||||
use Modules\Helpdesk\Models\KanbanBoard;
|
||||
use Modules\Helpdesk\Models\Priority;
|
||||
use Modules\Helpdesk\Models\Project;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
@@ -26,7 +28,19 @@ final class HelpdeskDatabaseSeeder extends Seeder
|
||||
$this->seedPriorities();
|
||||
$this->seedCategories();
|
||||
$this->seedTeamsAndProjects();
|
||||
$this->seedKanbanBoards();
|
||||
$this->seedWorkflowTemplates();
|
||||
DB::table('helpdesk_kanban_boards')->updateOrInsert(
|
||||
['slug' => 'default'],
|
||||
[
|
||||
'name' => 'Default Helpdesk Board',
|
||||
'description' => 'Standard support workflow board.',
|
||||
'is_default' => true,
|
||||
'sort_order' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,6 +129,38 @@ final class HelpdeskDatabaseSeeder extends Seeder
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the default configurable Kanban board.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedKanbanBoards(): void
|
||||
{
|
||||
$board = KanbanBoard::query()->updateOrCreate(
|
||||
['slug' => 'standard-support'],
|
||||
[
|
||||
'name' => 'Standard Support',
|
||||
'slug' => 'standard-support',
|
||||
'description' => 'Default Helpdesk workflow board covering new work through closure.',
|
||||
'is_default' => true,
|
||||
'sort_order' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
$statuses = Status::query()
|
||||
->whereIn('slug', ['new', 'open', 'in-progress', 'stalled', 'on-hold', 'closed'])
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
|
||||
$sync = [];
|
||||
|
||||
foreach ($statuses as $index => $status) {
|
||||
$sync[$status->id] = ['sort_order' => ($index + 1) * 10];
|
||||
}
|
||||
|
||||
$board->statuses()->syncWithoutDetaching($sync);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed default professional workflow email templates.
|
||||
*
|
||||
@@ -134,4 +180,7 @@ final class HelpdeskDatabaseSeeder extends Seeder
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Helpdesk\Database\Seeders\HelpdeskDatabaseSeeder as DatabaseHelpdeskDatabaseSeeder;
|
||||
|
||||
final class HelpdeskDatabaseSeeder extends Seeder
|
||||
{
|
||||
/** @return void */
|
||||
public function run(): void
|
||||
{
|
||||
$this->call(DatabaseHelpdeskDatabaseSeeder::class);
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ final class HelpdeskController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display the Helpdesk module landing page inside the application shell.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function __invoke(): View
|
||||
{
|
||||
|
||||
@@ -18,10 +18,6 @@ final class TicketStoreController extends Controller
|
||||
*
|
||||
* This avoids the Livewire update endpoint for ticket creation, which prevents
|
||||
* proxy/hash update-route 404s from blocking ticket creation.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param TicketService $tickets
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function __invoke(Request $request, TicketService $tickets): RedirectResponse
|
||||
{
|
||||
@@ -38,7 +34,7 @@ final class TicketStoreController extends Controller
|
||||
'team_id' => ['nullable', 'integer', Rule::exists('helpdesk_teams', 'id')],
|
||||
'due_at' => ['nullable', 'date'],
|
||||
'attachments' => ['nullable', 'array'],
|
||||
'attachments.*' => ['file', 'max:' . $maxUploadKilobytes, 'mimes:' . implode(',', $allowedMimes)],
|
||||
'attachments.*' => ['file', 'max:'.$maxUploadKilobytes, 'mimes:'.implode(',', $allowedMimes)],
|
||||
]);
|
||||
|
||||
$user = Auth::user();
|
||||
@@ -61,6 +57,6 @@ final class TicketStoreController extends Controller
|
||||
|
||||
return redirect()
|
||||
->route('helpdesk.tickets.index')
|
||||
->with('success', 'Ticket ' . $ticket->reference . ' has been created.');
|
||||
->with('success', 'Ticket '.$ticket->reference.' has been created.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ use Modules\Helpdesk\Models\Ticket;
|
||||
|
||||
final class HelpdeskDashboardWidget extends Component
|
||||
{
|
||||
/** @return View */
|
||||
public function render(): View
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
@@ -8,26 +8,32 @@ use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Component;
|
||||
use Modules\Helpdesk\Models\KanbanBoard as KanbanBoardModel;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
use Modules\Helpdesk\Models\Ticket;
|
||||
use Modules\Helpdesk\Services\WorkflowNotificationService;
|
||||
|
||||
final class KanbanBoard extends Component
|
||||
{
|
||||
public ?int $board_id = null;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->board_id = KanbanBoardModel::query()
|
||||
->where('is_default', true)
|
||||
->orderBy('sort_order')
|
||||
->value('id') ?: KanbanBoardModel::query()->orderBy('sort_order')->value('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a ticket to another workflow status.
|
||||
*
|
||||
* @param int $ticketId
|
||||
* @param int $statusId
|
||||
* @param WorkflowNotificationService $workflow
|
||||
* @return void
|
||||
*/
|
||||
public function moveTicket(int $ticketId, int $statusId, WorkflowNotificationService $workflow): void
|
||||
public function moveTicket(int|string $ticketId, int|string $statusId, WorkflowNotificationService $workflow): void
|
||||
{
|
||||
$ticket = Ticket::query()->visibleTo(Auth::user())->findOrFail($ticketId);
|
||||
$status = Status::query()->findOrFail($statusId);
|
||||
$ticket = Ticket::query()->visibleTo(Auth::user())->findOrFail((int) $ticketId);
|
||||
$status = Status::query()->findOrFail((int) $statusId);
|
||||
|
||||
$oldStatus = $ticket->status?->name;
|
||||
$this->authorize('update', $ticket);
|
||||
|
||||
$ticket->forceFill([
|
||||
'status_id' => $status->id,
|
||||
@@ -36,8 +42,8 @@ final class KanbanBoard extends Component
|
||||
])->save();
|
||||
|
||||
$workflow->dispatch(
|
||||
$ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team']),
|
||||
$status->is_closed ? 'ticket_closed' : 'ticket_updated',
|
||||
$ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team']) ?? $ticket,
|
||||
$status->is_closed ? 'ticket.closed' : 'ticket.updated',
|
||||
Auth::user()
|
||||
);
|
||||
|
||||
@@ -46,13 +52,22 @@ final class KanbanBoard extends Component
|
||||
|
||||
/**
|
||||
* Render the Kanban board.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
$boards = KanbanBoardModel::query()
|
||||
->with('statuses')
|
||||
->orderBy('sort_order')
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
$board = $boards->firstWhere('id', $this->board_id) ?? $boards->first();
|
||||
$statuses = $board?->statuses ?? Status::query()->orderBy('sort_order')->orderBy('name')->get();
|
||||
|
||||
return view('helpdesk::livewire.kanban-board', [
|
||||
'statuses' => Status::query()->orderBy('sort_order')->get(),
|
||||
'boards' => $boards,
|
||||
'board' => $board,
|
||||
'statuses' => $statuses,
|
||||
'ticketsByStatus' => $this->ticketsByStatus(),
|
||||
])->layout('layouts.app');
|
||||
}
|
||||
@@ -68,7 +83,7 @@ final class KanbanBoard extends Component
|
||||
->with(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team'])
|
||||
->visibleTo(Auth::user())
|
||||
->latest('last_activity_at')
|
||||
->limit(200)
|
||||
->limit(300)
|
||||
->get()
|
||||
->groupBy('status_id')
|
||||
->all();
|
||||
|
||||
@@ -42,7 +42,6 @@ final class SettingsManager extends Component
|
||||
/** @var array<string, mixed> */
|
||||
public array $workflowForm = ['id' => null, 'name' => '', 'event' => 'ticket.created', 'subject' => '', 'html_body' => '', 'text_body' => '', 'to_role' => 'requester', 'cc' => '', 'bcc' => '', 'is_active' => true];
|
||||
|
||||
/** @return void */
|
||||
public function saveStatus(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -59,27 +58,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Status saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editStatus(int $id): void
|
||||
{
|
||||
$this->statusForm = Status::query()->findOrFail($id)->only(['id', 'name', 'slug', 'color', 'sort_order', 'is_closed']);
|
||||
$this->section = 'statuses';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteStatus(int $id): void
|
||||
{
|
||||
Status::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Status deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetStatusForm(): void
|
||||
{
|
||||
$this->statusForm = ['id' => null, 'name' => '', 'slug' => '', 'color' => 'zinc', 'sort_order' => 0, 'is_closed' => false];
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function savePriority(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -95,27 +90,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Priority saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editPriority(int $id): void
|
||||
{
|
||||
$this->priorityForm = Priority::query()->findOrFail($id)->only(['id', 'name', 'slug', 'color', 'sort_order']);
|
||||
$this->section = 'priorities';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deletePriority(int $id): void
|
||||
{
|
||||
Priority::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Priority deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetPriorityForm(): void
|
||||
{
|
||||
$this->priorityForm = ['id' => null, 'name' => '', 'slug' => '', 'color' => 'zinc', 'sort_order' => 0];
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function saveCategory(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -132,27 +123,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Category saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editCategory(int $id): void
|
||||
{
|
||||
$this->categoryForm = Category::query()->findOrFail($id)->only(['id', 'company_id', 'name', 'slug', 'color', 'description']);
|
||||
$this->section = 'categories';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteCategory(int $id): void
|
||||
{
|
||||
Category::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Category deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetCategoryForm(): void
|
||||
{
|
||||
$this->categoryForm = ['id' => null, 'company_id' => null, 'name' => '', 'slug' => '', 'color' => 'blue', 'description' => ''];
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function saveTeam(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -169,27 +156,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Team saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editTeam(int $id): void
|
||||
{
|
||||
$this->teamForm = Team::query()->findOrFail($id)->only(['id', 'company_id', 'name', 'slug', 'color', 'description', 'archived_at']);
|
||||
$this->section = 'teams';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteTeam(int $id): void
|
||||
{
|
||||
Team::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Team deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetTeamForm(): void
|
||||
{
|
||||
$this->teamForm = ['id' => null, 'company_id' => null, 'name' => '', 'slug' => '', 'color' => 'indigo', 'description' => '', 'archived_at' => null];
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function saveProject(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -207,28 +190,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Project saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editProject(int $id): void
|
||||
{
|
||||
$this->projectForm = Project::query()->findOrFail($id)->only(['id', 'company_id', 'team_id', 'title', 'slug', 'color', 'description', 'archived_at']);
|
||||
$this->section = 'projects';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteProject(int $id): void
|
||||
{
|
||||
Project::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Project deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetProjectForm(): void
|
||||
{
|
||||
$this->projectForm = ['id' => null, 'company_id' => null, 'team_id' => null, 'title' => '', 'slug' => '', 'color' => 'blue', 'description' => '', 'archived_at' => null];
|
||||
}
|
||||
|
||||
|
||||
/** @return void */
|
||||
public function saveRepository(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -246,28 +224,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Git repository saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editRepository(int $id): void
|
||||
{
|
||||
$this->repositoryForm = GitRepository::query()->findOrFail($id)->only(['id', 'company_id', 'project_id', 'name', 'provider', 'remote_url', 'default_branch', 'webhook_secret']);
|
||||
$this->section = 'git';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteRepository(int $id): void
|
||||
{
|
||||
GitRepository::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Git repository deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetRepositoryForm(): void
|
||||
{
|
||||
$this->repositoryForm = ['id' => null, 'company_id' => null, 'project_id' => null, 'name' => '', 'provider' => 'git', 'remote_url' => '', 'default_branch' => 'main', 'webhook_secret' => ''];
|
||||
}
|
||||
|
||||
|
||||
/** @return void */
|
||||
public function saveWorkflowTemplate(): void
|
||||
{
|
||||
$data = $this->validate([
|
||||
@@ -287,27 +260,23 @@ final class SettingsManager extends Component
|
||||
session()->flash('success', 'Workflow message saved.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function editWorkflowTemplate(int $id): void
|
||||
{
|
||||
$this->workflowForm = WorkflowTemplate::query()->findOrFail($id)->only(['id', 'name', 'event', 'subject', 'html_body', 'text_body', 'to_role', 'cc', 'bcc', 'is_active']);
|
||||
$this->section = 'workflow';
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function deleteWorkflowTemplate(int $id): void
|
||||
{
|
||||
WorkflowTemplate::query()->findOrFail($id)->delete();
|
||||
session()->flash('success', 'Workflow message deleted.');
|
||||
}
|
||||
|
||||
/** @return void */
|
||||
public function resetWorkflowTemplateForm(): void
|
||||
{
|
||||
$this->workflowForm = ['id' => null, 'name' => '', 'event' => 'ticket.created', 'subject' => '', 'html_body' => '', 'text_body' => '', 'to_role' => 'requester', 'cc' => '', 'bcc' => '', 'is_active' => true];
|
||||
}
|
||||
|
||||
/** @return View */
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::livewire.settings-manager', [
|
||||
|
||||
@@ -26,9 +26,6 @@ final class TicketEdit extends Component
|
||||
#[Validate('nullable|integer')]
|
||||
public ?int $company_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:users,id')]
|
||||
public ?int $agent_id = null;
|
||||
|
||||
#[Validate('required|string|max:200')]
|
||||
public string $subject = '';
|
||||
|
||||
@@ -50,19 +47,18 @@ final class TicketEdit extends Component
|
||||
#[Validate('nullable|integer|exists:helpdesk_teams,id')]
|
||||
public ?int $team_id = null;
|
||||
|
||||
#[Validate('nullable|integer|exists:users,id')]
|
||||
public ?int $agent_id = null;
|
||||
|
||||
#[Validate('nullable|date')]
|
||||
public ?string $due_at = null;
|
||||
|
||||
/**
|
||||
* Populate editable ticket state.
|
||||
*/
|
||||
public function mount(Ticket $ticket): void
|
||||
{
|
||||
$this->authorize('update', $ticket);
|
||||
$this->ticket = $ticket->fresh(['status', 'priority', 'category', 'project', 'team', 'agent']) ?? $ticket;
|
||||
|
||||
$this->company_id = $this->ticket->company_id;
|
||||
$this->agent_id = $this->ticket->agent_id;
|
||||
$this->subject = $this->ticket->subject;
|
||||
$this->body = $this->ticket->body;
|
||||
$this->status_id = $this->ticket->status_id;
|
||||
@@ -70,12 +66,10 @@ final class TicketEdit extends Component
|
||||
$this->category_id = $this->ticket->category_id;
|
||||
$this->project_id = $this->ticket->project_id;
|
||||
$this->team_id = $this->ticket->team_id;
|
||||
$this->agent_id = $this->ticket->agent_id;
|
||||
$this->due_at = $this->ticket->due_at?->format('Y-m-d');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save ticket changes.
|
||||
*/
|
||||
public function save(WorkflowNotificationService $workflow): mixed
|
||||
{
|
||||
$this->authorize('update', $this->ticket);
|
||||
@@ -85,7 +79,6 @@ final class TicketEdit extends Component
|
||||
|
||||
$this->ticket->forceFill([
|
||||
'company_id' => $this->company_id,
|
||||
'agent_id' => $this->agent_id,
|
||||
'subject' => $this->subject,
|
||||
'body' => $this->body,
|
||||
'status_id' => $status->id,
|
||||
@@ -93,27 +86,25 @@ final class TicketEdit extends Component
|
||||
'category_id' => $this->category_id,
|
||||
'project_id' => $this->project_id,
|
||||
'team_id' => $this->team_id,
|
||||
'due_at' => $this->due_at ?: null,
|
||||
'agent_id' => $this->agent_id,
|
||||
'due_at' => $this->due_at,
|
||||
'completed_at' => $status->is_closed ? now() : null,
|
||||
'last_activity_at' => now(),
|
||||
])->save();
|
||||
|
||||
$this->ticket = $this->ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team']) ?? $this->ticket;
|
||||
$workflow->dispatch($this->ticket, $status->is_closed ? 'ticket.closed' : 'ticket.updated', Auth::user());
|
||||
$fresh = $this->ticket->fresh(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team']) ?? $this->ticket;
|
||||
$workflow->dispatch($fresh, $status->is_closed ? 'ticket.closed' : 'ticket.updated', Auth::user());
|
||||
|
||||
session()->flash('success', 'Ticket ' . $this->ticket->reference . ' has been updated.');
|
||||
session()->flash('success', 'Ticket ' . $fresh->reference . ' has been updated.');
|
||||
|
||||
return redirect()->route('helpdesk.tickets.show', $this->ticket);
|
||||
return redirect()->route('helpdesk.tickets.show', $fresh);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the ticket edit screen.
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::livewire.ticket-edit', [
|
||||
'statuses' => Status::query()->orderBy('sort_order')->get(),
|
||||
'priorities' => Priority::query()->orderBy('sort_order')->get(),
|
||||
'statuses' => Status::query()->orderBy('sort_order')->orderBy('name')->get(),
|
||||
'priorities' => Priority::query()->orderBy('sort_order')->orderBy('name')->get(),
|
||||
'categories' => Category::query()->orderBy('name')->get(),
|
||||
'companies' => Schema::hasTable('companies') ? DB::table('companies')->select(['id', 'name'])->orderBy('name')->get() : collect(),
|
||||
'teams' => Team::query()->whereNull('archived_at')->orderBy('name')->get(),
|
||||
|
||||
@@ -33,8 +33,6 @@ final class TicketIndex extends Component
|
||||
|
||||
/**
|
||||
* Reset pagination when filters change.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updated(): void
|
||||
{
|
||||
@@ -43,8 +41,6 @@ final class TicketIndex extends Component
|
||||
|
||||
/**
|
||||
* Render the ticket list.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function render(): View
|
||||
{
|
||||
@@ -73,9 +69,9 @@ final class TicketIndex extends Component
|
||||
->when($this->priority !== '', fn (Builder $query): Builder => $query->where('priority_id', (int) $this->priority))
|
||||
->when($this->search !== '', function (Builder $query): Builder {
|
||||
return $query->where(static function (Builder $subQuery): void {
|
||||
$subQuery->where('reference', 'like', '%' . $this->search . '%')
|
||||
->orWhere('subject', 'like', '%' . $this->search . '%')
|
||||
->orWhere('body', 'like', '%' . $this->search . '%');
|
||||
$subQuery->where('reference', 'like', '%'.$this->search.'%')
|
||||
->orWhere('subject', 'like', '%'.$this->search.'%')
|
||||
->orWhere('body', 'like', '%'.$this->search.'%');
|
||||
});
|
||||
})
|
||||
->latest('last_activity_at')
|
||||
|
||||
@@ -12,7 +12,6 @@ use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||
use Livewire\WithFileUploads;
|
||||
use Modules\Helpdesk\Models\Comment;
|
||||
use Modules\Helpdesk\Models\Priority;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
use Modules\Helpdesk\Models\Ticket;
|
||||
@@ -145,36 +144,39 @@ final class TicketShow extends Component
|
||||
'team',
|
||||
'attachments.user',
|
||||
'gitCommits.repository',
|
||||
'comments.attachments',
|
||||
'comments.replies.attachments',
|
||||
'comments.replies.replies.attachments',
|
||||
]) ?? $ticket;
|
||||
|
||||
$comments = Comment::query()
|
||||
->where('ticket_id', $ticket->id)
|
||||
->with(['user', 'attachments'])
|
||||
->oldest()
|
||||
->get();
|
||||
$comments = $ticket->comments
|
||||
->merge($ticket->comments->flatMap->replies)
|
||||
->merge($ticket->comments->flatMap->replies->flatMap->replies);
|
||||
|
||||
$grouped = $comments->groupBy('parent_id');
|
||||
$users = User::query()
|
||||
->whereIn('id', $comments->pluck('user_id')->filter()->unique())
|
||||
->get()
|
||||
->keyBy('id');
|
||||
|
||||
$comments->each(function ($comment) use ($grouped): void {
|
||||
$comment->setRelation('replies', $grouped->get($comment->id, collect()));
|
||||
});
|
||||
|
||||
$ticket->setRelation('comments', $this->buildCommentTree($grouped));
|
||||
$this->attachCommentUsers($ticket->comments, $users);
|
||||
|
||||
return $ticket;
|
||||
}
|
||||
|
||||
private function buildCommentTree($grouped, ?int $parentId = null)
|
||||
|
||||
/**
|
||||
* Attach loaded users to comment hierarchy without triggering lazy loading.
|
||||
*
|
||||
* @param Collection<int, mixed> $comments
|
||||
* @param Collection<int, User> $users
|
||||
*/
|
||||
private function attachCommentUsers(Collection $comments, Collection $users): void
|
||||
{
|
||||
foreach ($comments as $comment) {
|
||||
$comment->setRelation('user', $users->get($comment->user_id));
|
||||
|
||||
return $grouped->get($parentId, collect())->map(function ($comment) use ($grouped) {
|
||||
|
||||
$comment->setRelation('replies', $this->buildCommentTree($grouped, $comment->id));
|
||||
|
||||
return $comment;
|
||||
|
||||
});
|
||||
|
||||
if ($comment->relationLoaded('replies')) {
|
||||
$this->attachCommentUsers($comment->replies, $users);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ final class Attachment extends Model
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function url(): string
|
||||
{
|
||||
return Storage::disk($this->disk)->url($this->path);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
/**
|
||||
* Configurable Helpdesk Kanban board.
|
||||
*/
|
||||
final class KanbanBoard extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'helpdesk_kanban_boards';
|
||||
|
||||
/** @var list<string> */
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'is_default',
|
||||
'sort_order',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
protected $casts = [
|
||||
'is_default' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
|
||||
/** @return BelongsToMany<Status> */
|
||||
public function statuses(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Status::class, 'helpdesk_kanban_board_statuses', 'board_id', 'status_id')
|
||||
->withPivot(['sort_order'])
|
||||
->orderBy('helpdesk_kanban_board_statuses.sort_order')
|
||||
->orderBy('helpdesk_statuses.sort_order')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ namespace Modules\Helpdesk\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
@@ -9,13 +9,11 @@ use Modules\Helpdesk\Models\Ticket;
|
||||
|
||||
final class TicketPolicy
|
||||
{
|
||||
/** @return bool */
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function view(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return (bool) ($user->helpdesk_admin ?? false)
|
||||
@@ -23,25 +21,21 @@ final class TicketPolicy
|
||||
|| (int) $ticket->user_id === (int) $user->id;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function update(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return (bool) ($user->helpdesk_admin ?? false) || (int) $ticket->agent_id === (int) $user->id;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function comment(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return $this->view($user, $ticket);
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function delete(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return (bool) ($user->helpdesk_admin ?? false);
|
||||
|
||||
@@ -24,22 +24,16 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Module name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleName = 'Helpdesk';
|
||||
|
||||
/**
|
||||
* Lowercase module name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleNameLower = 'helpdesk';
|
||||
|
||||
/**
|
||||
* Register module services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
@@ -53,8 +47,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Bootstrap module services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
@@ -71,8 +63,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register Livewire components used by the module.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerLivewireComponents(): void
|
||||
{
|
||||
@@ -86,8 +76,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register policies and gates.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerPolicies(): void
|
||||
{
|
||||
@@ -99,8 +87,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register helpers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerHelpers(): void
|
||||
{
|
||||
@@ -111,8 +97,6 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Dynamically register console commands.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
@@ -127,7 +111,7 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
}
|
||||
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(fn ($file): string => 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension())
|
||||
->map(fn ($file): string => 'Modules\\'.$this->moduleName.'\\Console\\'.$file->getFilenameWithoutExtension())
|
||||
->filter(fn (string $class): bool => class_exists($class))
|
||||
->values()
|
||||
->all();
|
||||
@@ -137,44 +121,38 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register config publishing.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower() . '.php'),
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower().'.php'),
|
||||
], 'config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register module views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
|
||||
$viewPath = resource_path('views/modules/'.ModuleInfo::nameLower());
|
||||
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath,
|
||||
], ['views', ModuleInfo::nameLower() . '-module-views']);
|
||||
], ['views', ModuleInfo::nameLower().'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
|
||||
Blade::componentNamespace('Modules\Helpdesk\View\Components', 'helpdesk');
|
||||
Blade::anonymousComponentPath($sourcePath . '/components', 'helpdesk');
|
||||
Blade::anonymousComponentPath($sourcePath.'/components', 'helpdesk');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
$langPath = resource_path('lang/modules/'.ModuleInfo::nameLower());
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
@@ -195,8 +173,8 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
$paths = [];
|
||||
|
||||
foreach (Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) {
|
||||
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
|
||||
if (is_dir($path.'/modules/'.ModuleInfo::nameLower())) {
|
||||
$paths[] = $path.'/modules/'.ModuleInfo::nameLower();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ final class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Define module routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
@@ -23,8 +21,6 @@ final class RouteServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Define web routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
@@ -36,8 +32,6 @@ final class RouteServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Define API routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div>
|
||||
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Helpdesk workflow</p>
|
||||
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Kanban board</h1>
|
||||
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Drag tickets between configurable status boards. Add, rename and order boards from Helpdesk Settings → Statuses.</p>
|
||||
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Drag tickets between configured board columns. Boards and columns are managed in Helpdesk Settings.</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
@@ -23,132 +23,67 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="flex gap-4 overflow-x-auto pb-4"
|
||||
x-data="{
|
||||
draggedTicketId: null,
|
||||
draggingOverStatusId: null,
|
||||
dragStart(event) {
|
||||
this.draggedTicketId = event.currentTarget.dataset.ticketId;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', this.draggedTicketId);
|
||||
event.currentTarget.classList.add('opacity-60', 'rotate-1', 'scale-[0.99]');
|
||||
},
|
||||
dragEnd(event) {
|
||||
event.currentTarget.classList.remove('opacity-60', 'rotate-1', 'scale-[0.99]');
|
||||
this.draggedTicketId = null;
|
||||
this.draggingOverStatusId = null;
|
||||
},
|
||||
dragOver(event, statusId) {
|
||||
event.preventDefault();
|
||||
this.draggingOverStatusId = String(statusId);
|
||||
event.dataTransfer.dropEffect = 'move';
|
||||
},
|
||||
dragLeave(statusId) {
|
||||
if (this.draggingOverStatusId === String(statusId)) {
|
||||
this.draggingOverStatusId = null;
|
||||
}
|
||||
},
|
||||
drop(event, statusId) {
|
||||
event.preventDefault();
|
||||
const ticketId = event.dataTransfer.getData('text/plain') || this.draggedTicketId;
|
||||
this.draggingOverStatusId = null;
|
||||
<div class="flex flex-col gap-3 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 md:flex-row md:items-center md:justify-between">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">Active board</h2>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">{{ $board?->description ?: 'Use settings to configure which statuses appear on each board.' }}</p>
|
||||
</div>
|
||||
|
||||
if (! ticketId) {
|
||||
return;
|
||||
}
|
||||
<select wire:model.live="board_id" class="min-w-[260px] rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@foreach ($boards as $availableBoard)
|
||||
<option value="{{ $availableBoard->id }}">{{ $availableBoard->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
$wire.moveTicket(parseInt(ticketId, 10), parseInt(statusId, 10));
|
||||
}
|
||||
}"
|
||||
>
|
||||
<div class="flex gap-4 overflow-x-auto pb-4" data-helpdesk-kanban-board>
|
||||
@foreach ($statuses as $status)
|
||||
@php
|
||||
$tickets = $ticketsByStatus[$status->id] ?? collect();
|
||||
$statusColor = match ($status->color) {
|
||||
'sky' => '#0284c7',
|
||||
'blue' => '#2563eb',
|
||||
'amber' => '#d97706',
|
||||
'rose' => '#e11d48',
|
||||
'violet' => '#7c3aed',
|
||||
'emerald' => '#059669',
|
||||
'red' => '#dc2626',
|
||||
'green' => '#16a34a',
|
||||
'purple' => '#9333ea',
|
||||
'indigo' => '#4f46e5',
|
||||
'cyan' => '#0891b2',
|
||||
default => str_starts_with((string) $status->color, '#') ? $status->color : '#64748b',
|
||||
};
|
||||
@endphp
|
||||
@php($tickets = $ticketsByStatus[$status->id] ?? collect())
|
||||
|
||||
<section
|
||||
class="flex min-h-[640px] w-[340px] shrink-0 flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-100 shadow-sm transition dark:border-zinc-700 dark:bg-zinc-950"
|
||||
x-bind:class="draggingOverStatusId === '{{ $status->id }}' ? 'ring-2 ring-blue-500 ring-offset-2 dark:ring-offset-zinc-950' : ''"
|
||||
x-on:dragover="dragOver($event, {{ $status->id }})"
|
||||
x-on:dragleave="dragLeave({{ $status->id }})"
|
||||
x-on:drop="drop($event, {{ $status->id }})"
|
||||
dusk="kanban-column-{{ $status->slug }}"
|
||||
>
|
||||
<section class="flex min-h-[640px] w-[330px] shrink-0 flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-100 shadow-sm dark:border-zinc-700 dark:bg-zinc-950" dusk="kanban-column-{{ $status->slug }}">
|
||||
<header class="border-b border-zinc-200 bg-white px-4 py-4 dark:border-zinc-800 dark:bg-zinc-900">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex h-3 w-3 rounded-full" style="background-color: {{ $statusColor }}"></span>
|
||||
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
|
||||
</div>
|
||||
<h2 class="text-sm font-bold uppercase tracking-wide text-zinc-900 dark:text-zinc-100">{{ $status->name }}</h2>
|
||||
<p class="mt-1 text-xs text-zinc-500">{{ $tickets->count() }} tickets</p>
|
||||
</div>
|
||||
|
||||
@if ($status->is_closed)
|
||||
<span class="rounded-full bg-emerald-100 px-2 py-1 text-xs font-semibold text-emerald-700 dark:bg-emerald-950 dark:text-emerald-200">Closed</span>
|
||||
@endif
|
||||
<span class="inline-flex h-4 w-4 rounded-full ring-4 ring-zinc-100 dark:ring-zinc-800" style="background-color: {{ \Modules\Helpdesk\Support\Color::css($status->color) }}"></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="flex-1 space-y-3 overflow-y-auto p-3">
|
||||
<div
|
||||
class="helpdesk-kanban-column min-h-[560px] flex-1 space-y-3 p-3"
|
||||
data-helpdesk-kanban-column
|
||||
data-status-id="{{ $status->id }}"
|
||||
>
|
||||
@forelse ($tickets as $ticket)
|
||||
@php
|
||||
$priorityColor = match ($ticket->priority?->color) {
|
||||
'red' => '#dc2626',
|
||||
'amber' => '#d97706',
|
||||
'emerald' => '#059669',
|
||||
'blue' => '#2563eb',
|
||||
'rose' => '#e11d48',
|
||||
default => '#64748b',
|
||||
};
|
||||
@endphp
|
||||
|
||||
<article
|
||||
wire:key="kanban-ticket-{{ $ticket->id }}"
|
||||
draggable="true"
|
||||
x-on:dragstart="dragStart($event)"
|
||||
x-on:dragend="dragEnd($event)"
|
||||
class="group cursor-grab rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
|
||||
data-helpdesk-kanban-ticket
|
||||
data-ticket-id="{{ $ticket->id }}"
|
||||
dusk="kanban-ticket-{{ $ticket->id }}"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="font-mono text-xs font-semibold text-blue-700 dark:text-blue-300">{{ $ticket->reference }}</span>
|
||||
<span class="text-xs text-zinc-400">⋮⋮</span>
|
||||
</div>
|
||||
<h3 class="mt-2 line-clamp-3 text-sm font-semibold text-zinc-900 dark:text-zinc-100">{{ $ticket->subject }}</h3>
|
||||
<div class="font-mono text-xs font-semibold text-blue-700 dark:text-blue-300">{{ $ticket->reference }}</div>
|
||||
<h3 class="mt-1 line-clamp-3 text-sm font-semibold leading-5 text-zinc-900 dark:text-zinc-100">{{ $ticket->subject }}</h3>
|
||||
</div>
|
||||
|
||||
@if ($ticket->priority)
|
||||
<span class="shrink-0 rounded-full px-2 py-1 text-xs font-semibold text-white" style="background-color: {{ $priorityColor }}">{{ $ticket->priority->name }}</span>
|
||||
<span class="shrink-0 rounded-full px-2 py-1 text-xs font-bold text-white" style="background-color: {{ \Modules\Helpdesk\Support\Color::css($ticket->priority->color) }}">
|
||||
{{ $ticket->priority->name }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3 space-y-1 text-xs text-zinc-500 dark:text-zinc-400">
|
||||
<div>Owner: {{ $ticket->owner?->name ?? 'Unknown' }}</div>
|
||||
<div>Agent: {{ $ticket->agent?->name ?? 'Unassigned' }}</div>
|
||||
<div class="mt-3 space-y-1.5 text-xs text-zinc-500 dark:text-zinc-400">
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-user w-3" aria-hidden="true"></i> {{ $ticket->owner?->name ?? 'Unknown' }}</div>
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-user-gear w-3" aria-hidden="true"></i> {{ $ticket->agent?->name ?? 'Unassigned' }}</div>
|
||||
@if ($ticket->project)
|
||||
<div>Project: {{ $ticket->project->title }}</div>
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-diagram-project w-3" aria-hidden="true"></i> {{ $ticket->project->title }}</div>
|
||||
@endif
|
||||
@if ($ticket->team)
|
||||
<div>Team: {{ $ticket->team->name }}</div>
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-users w-3" aria-hidden="true"></i> {{ $ticket->team->name }}</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -160,12 +95,66 @@
|
||||
</div>
|
||||
</article>
|
||||
@empty
|
||||
<div class="rounded-xl border border-dashed border-zinc-300 bg-white p-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-900">
|
||||
Drop tickets here to move them to {{ $status->name }}.
|
||||
<div class="rounded-2xl border border-dashed border-zinc-300 bg-white p-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-900">
|
||||
Drop tickets here for {{ $status->name }}.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
@script
|
||||
<script>
|
||||
const initialiseHelpdeskKanban = function () {
|
||||
const boot = function () {
|
||||
if (!window.Sortable) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-helpdesk-kanban-column]').forEach(function (column) {
|
||||
if (column.dataset.sortableReady === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
column.dataset.sortableReady = '1';
|
||||
|
||||
new window.Sortable(column, {
|
||||
group: 'helpdesk-kanban',
|
||||
animation: 180,
|
||||
ghostClass: 'opacity-50',
|
||||
chosenClass: 'ring-2 ring-blue-400',
|
||||
dragClass: 'rotate-1',
|
||||
draggable: '[data-helpdesk-kanban-ticket]',
|
||||
filter: 'a, button, input, select, textarea',
|
||||
preventOnFilter: false,
|
||||
onEnd: function (event) {
|
||||
const ticketId = event.item.dataset.ticketId;
|
||||
const statusId = event.to.dataset.statusId;
|
||||
|
||||
if (!ticketId || !statusId) {
|
||||
return;
|
||||
}
|
||||
|
||||
$wire.moveTicket(ticketId, statusId);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if (!window.Sortable) {
|
||||
const script = document.createElement('script');
|
||||
script.src = 'https://cdn.jsdelivr.net/npm/sortablejs@1.15.2/Sortable.min.js';
|
||||
script.onload = boot;
|
||||
document.head.appendChild(script);
|
||||
return;
|
||||
}
|
||||
|
||||
boot();
|
||||
};
|
||||
|
||||
initialiseHelpdeskKanban();
|
||||
document.addEventListener('livewire:navigated', initialiseHelpdeskKanban);
|
||||
</script>
|
||||
@endscript
|
||||
</div>
|
||||
|
||||
@@ -6,16 +6,15 @@
|
||||
])
|
||||
|
||||
<form wire:submit.prevent="save" enctype="multipart/form-data" class="space-y-6">
|
||||
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<div class="overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="border-b border-zinc-200 bg-zinc-50 px-6 py-4 dark:border-zinc-700 dark:bg-zinc-800/70">
|
||||
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket details</h2>
|
||||
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Capture the request clearly so the support workflow can route and notify correctly.</p>
|
||||
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Mandatory fields are marked with <span class="font-bold text-red-500">*</span>. Rich details and attachments are saved by Livewire.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 p-6 lg:grid-cols-2">
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject <span class="text-red-500">*</span></label>
|
||||
<input id="subject" type="text" wire:model.defer="subject" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-subject">
|
||||
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
@@ -23,7 +22,7 @@
|
||||
@if($companies->isNotEmpty())
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
|
||||
<select id="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<select id="company_id" wire:model.defer="company_id" data-helpdesk-select2 class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select company</option>
|
||||
@foreach ($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@@ -34,8 +33,8 @@
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
|
||||
<select id="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-priority">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority <span class="text-red-500">*</span></label>
|
||||
<select id="priority_id" wire:model.defer="priority_id" data-helpdesk-select2 class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-priority">
|
||||
<option value="">Select priority</option>
|
||||
@foreach ($priorities as $priority)
|
||||
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
|
||||
@@ -46,7 +45,7 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
|
||||
<select id="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<select id="category_id" wire:model.defer="category_id" data-helpdesk-select2 class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select category</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@@ -57,7 +56,7 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
|
||||
<select id="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<select id="project_id" wire:model.defer="project_id" data-helpdesk-select2 class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select project</option>
|
||||
@foreach ($projects as $project)
|
||||
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
|
||||
@@ -68,7 +67,7 @@
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
|
||||
<select id="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<select id="team_id" wire:model.defer="team_id" data-helpdesk-select2 class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">Select team</option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@@ -84,7 +83,8 @@
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<x-helpdesk::html-editor dusk="ticket-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the issue, expected outcome, steps to reproduce and any useful context..." />
|
||||
<x-helpdesk::html-editor dusk="ticket-body-editor" wire:model="body" label="Details *" rows="10" placeholder="Describe the issue, expected outcome, steps to reproduce and any useful context..." />
|
||||
@error('body') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
@@ -95,10 +95,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" class="rounded-xl border border-zinc-300 px-4 py-2 text-sm font-semibold text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800">Cancel</a>
|
||||
<button type="submit" class="rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700" data-dusk="ticket-create-submit">Create Ticket</button>
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 bg-zinc-50 px-6 py-4 dark:border-zinc-700 dark:bg-zinc-800/60">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Cancel</a>
|
||||
<button type="submit" class="rounded-xl bg-emerald-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700" data-dusk="ticket-create-submit">Create Ticket</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@include('helpdesk::partials.select2-loader')
|
||||
</div>
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
<div class="space-y-6" dusk="helpdesk-ticket-edit">
|
||||
@include('helpdesk::partials.page-header', [
|
||||
'eyebrow' => 'Helpdesk',
|
||||
'title' => 'Edit Ticket',
|
||||
'subtitle' => 'Update assignment, workflow status, priority, project, team and ticket content.',
|
||||
])
|
||||
|
||||
<form wire:submit.prevent="save" class="space-y-6">
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Ticket information</h2>
|
||||
<p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Changes are applied to the ticket and workflow notifications are triggered where configured.</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 p-6 lg:grid-cols-2">
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="subject">Subject</label>
|
||||
<input id="subject" type="text" wire:model.defer="subject" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-subject">
|
||||
@error('subject') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
@if($companies->isNotEmpty())
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="company_id">Company</label>
|
||||
<select id="company_id" wire:model.defer="company_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No company</option>
|
||||
@foreach ($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('company_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="agent_id">Assigned agent</label>
|
||||
<select id="agent_id" wire:model.defer="agent_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-agent">
|
||||
<option value="">Unassigned</option>
|
||||
@foreach ($agents as $agent)
|
||||
<option value="{{ $agent->id }}">{{ $agent->name }}{{ $agent->email ? ' — '.$agent->email : '' }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('agent_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="status_id">Status</label>
|
||||
<select id="status_id" wire:model.defer="status_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100" data-dusk="ticket-edit-status">
|
||||
@foreach ($statuses as $status)
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('status_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="priority_id">Priority</label>
|
||||
<select id="priority_id" wire:model.defer="priority_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@foreach ($priorities as $priority)
|
||||
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('priority_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="category_id">Category</label>
|
||||
<select id="category_id" wire:model.defer="category_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No category</option>
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('category_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="project_id">Project</label>
|
||||
<select id="project_id" wire:model.defer="project_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No project</option>
|
||||
@foreach ($projects as $project)
|
||||
<option value="{{ $project->id }}">{{ $project->title ?? $project->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('project_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="team_id">Team</label>
|
||||
<select id="team_id" wire:model.defer="team_id" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
<option value="">No team</option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('team_id') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200" for="due_at">Due date</label>
|
||||
<input id="due_at" type="date" wire:model.defer="due_at" class="mt-2 block w-full rounded-xl border-zinc-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100">
|
||||
@error('due_at') <p class="mt-2 text-sm text-red-600">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<x-helpdesk::html-editor dusk="ticket-edit-body-editor" wire:model="body" label="Details" rows="10" placeholder="Describe the request, steps, expected outcome and current status..." />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate class="rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
|
||||
<button type="submit" class="rounded-xl bg-emerald-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700" data-dusk="ticket-edit-submit">Save Ticket</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -12,9 +12,13 @@
|
||||
<p class="mt-2 text-sm text-blue-100/90">Raised by {{ $ticket->owner?->name ?? 'Unknown user' }} · Assigned to {{ $ticket->agent?->name ?? 'Unassigned' }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="inline-flex items-center rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">Back</a>
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="inline-flex items-center rounded-xl bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700">
|
||||
<i class="fa-solid fa-arrow-left mr-2" aria-hidden="true"></i> Back
|
||||
</a>
|
||||
@can('update', $ticket)
|
||||
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="inline-flex items-center rounded-xl bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700">Edit</a>
|
||||
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate class="inline-flex items-center rounded-xl bg-emerald-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-emerald-700">
|
||||
<i class="fa-solid fa-pen-to-square mr-2" aria-hidden="true"></i> Edit
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
@@ -107,22 +111,12 @@
|
||||
@can('update', $ticket)
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white p-5 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<h2 class="mb-4 text-base font-semibold text-zinc-900 dark:text-white">Agent actions</h2>
|
||||
<flux:select wire:model="agent_id" label="Assigned agent">
|
||||
<option value="">Unassigned</option>
|
||||
@foreach ($agents as $agent)
|
||||
<option value="{{ $agent->id }}">{{ $agent->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
<flux:button dusk="update-agent" wire:click="updateAssignment" class="mt-4 w-full" variant="ghost" icon="user">Update assignment</flux:button>
|
||||
|
||||
<div class="mt-5">
|
||||
<flux:select wire:model="status_id" label="Status">
|
||||
@foreach ($statuses as $status)
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
<flux:button dusk="update-status" wire:click="updateStatus" class="mt-4 w-full" variant="primary" icon="check">Update status</flux:button>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<flux:select wire:model="priority_id" label="Priority">
|
||||
@foreach ($priorities as $priority)
|
||||
|
||||
@@ -2,136 +2,16 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Database\Seeders;
|
||||
namespace Modules\Helpdesk\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Helpdesk\Models\Category;
|
||||
use Modules\Helpdesk\Models\Priority;
|
||||
use Modules\Helpdesk\Models\Project;
|
||||
use Modules\Helpdesk\Models\Status;
|
||||
use Modules\Helpdesk\Models\Team;
|
||||
use Modules\Helpdesk\Models\WorkflowTemplate;
|
||||
use Modules\Helpdesk\Database\Seeders\HelpdeskDatabaseSeeder as DatabaseHelpdeskDatabaseSeeder;
|
||||
|
||||
final class HelpdeskDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the Helpdesk module lookup data and default workflow templates.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
/** @return void */
|
||||
public function run(): void
|
||||
{
|
||||
$this->seedStatuses();
|
||||
$this->seedPriorities();
|
||||
$this->seedCategories();
|
||||
$this->seedTeamsAndProjects();
|
||||
$this->seedWorkflowTemplates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed ticket workflow statuses.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedStatuses(): void
|
||||
{
|
||||
foreach ([
|
||||
['name' => 'New', 'slug' => 'new', 'color' => 'sky', 'sort_order' => 5, 'is_closed' => false],
|
||||
['name' => 'Open', 'slug' => 'open', 'color' => 'blue', 'sort_order' => 10, 'is_closed' => false],
|
||||
['name' => 'In Progress', 'slug' => 'in-progress', 'color' => 'amber', 'sort_order' => 20, 'is_closed' => false],
|
||||
['name' => 'Stalled', 'slug' => 'stalled', 'color' => 'rose', 'sort_order' => 30, 'is_closed' => false],
|
||||
['name' => 'On-Hold', 'slug' => 'on-hold', 'color' => 'violet', 'sort_order' => 40, 'is_closed' => false],
|
||||
['name' => 'Closed', 'slug' => 'closed', 'color' => 'emerald', 'sort_order' => 90, 'is_closed' => true],
|
||||
] as $row) {
|
||||
Status::query()->updateOrCreate(['slug' => $row['slug']], $row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed ticket priorities.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedPriorities(): void
|
||||
{
|
||||
foreach ([
|
||||
['name' => 'High', 'slug' => 'high', 'color' => 'red', 'sort_order' => 10],
|
||||
['name' => 'Medium', 'slug' => 'medium', 'color' => 'amber', 'sort_order' => 20],
|
||||
['name' => 'Low', 'slug' => 'low', 'color' => 'emerald', 'sort_order' => 30],
|
||||
] as $row) {
|
||||
Priority::query()->updateOrCreate(['slug' => $row['slug']], $row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed ticket categories.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedCategories(): void
|
||||
{
|
||||
foreach ([
|
||||
['name' => 'Development', 'color' => 'indigo', 'description' => 'Software changes, enhancements and development work.'],
|
||||
['name' => 'Systems Deployment', 'color' => 'cyan', 'description' => 'Deployment, release, infrastructure and environment requests.'],
|
||||
['name' => 'Concepts', 'color' => 'purple', 'description' => 'Ideas, concepts, design discussion and future improvements.'],
|
||||
['name' => 'Bug', 'color' => 'rose', 'description' => 'Defects, regressions and incorrect behaviour.'],
|
||||
] as $row) {
|
||||
Category::query()->updateOrCreate(
|
||||
['company_id' => null, 'slug' => Str::slug($row['name'])],
|
||||
$row + ['company_id' => null, 'slug' => Str::slug($row['name'])]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the default support team and a default project.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedTeamsAndProjects(): void
|
||||
{
|
||||
$team = Team::query()->updateOrCreate(
|
||||
['company_id' => null, 'slug' => 'support'],
|
||||
[
|
||||
'company_id' => null,
|
||||
'name' => 'Support',
|
||||
'slug' => 'support',
|
||||
'color' => 'blue',
|
||||
'description' => 'Default support team for triage, ownership and ticket routing.',
|
||||
]
|
||||
);
|
||||
|
||||
Project::query()->updateOrCreate(
|
||||
['company_id' => null, 'slug' => 'support-desk'],
|
||||
[
|
||||
'company_id' => null,
|
||||
'team_id' => $team->id,
|
||||
'title' => 'Support Desk',
|
||||
'slug' => 'support-desk',
|
||||
'color' => 'indigo',
|
||||
'description' => 'Default project for operational helpdesk tickets.',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed default professional workflow email templates.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function seedWorkflowTemplates(): void
|
||||
{
|
||||
foreach ([
|
||||
['name' => 'Ticket raised requester notice', 'event' => 'ticket.created', 'subject' => 'Ticket {{ ticket.reference }} has been raised', 'html_body' => '<p>Hello {{ requester.name }},</p><p>Your ticket <strong>{{ ticket.reference }}</strong> has been raised successfully.</p><p><strong>Subject:</strong> {{ ticket.subject }}</p><p><strong>Priority:</strong> {{ ticket.priority }}</p>', 'to_role' => 'requester'],
|
||||
['name' => 'Ticket updated requester notice', 'event' => 'ticket.updated', 'subject' => 'Ticket {{ ticket.reference }} has been updated', 'html_body' => '<p>Hello {{ requester.name }},</p><p>Your ticket <strong>{{ ticket.reference }}</strong> has been updated.</p><p><strong>Status:</strong> {{ ticket.status }}</p><p><strong>Priority:</strong> {{ ticket.priority }}</p>', 'to_role' => 'requester'],
|
||||
['name' => 'Ticket response requester notice', 'event' => 'ticket.commented', 'subject' => 'New response on ticket {{ ticket.reference }}', 'html_body' => '<p>Hello {{ requester.name }},</p><p>A new response has been added to <strong>{{ ticket.reference }}</strong>.</p><p><strong>Subject:</strong> {{ ticket.subject }}</p>', 'to_role' => 'requester'],
|
||||
['name' => 'Ticket closed requester notice', 'event' => 'ticket.closed', 'subject' => 'Ticket {{ ticket.reference }} has been closed', 'html_body' => '<p>Hello {{ requester.name }},</p><p>Your ticket <strong>{{ ticket.reference }}</strong> has been closed.</p><p>Thank you for using the support desk.</p>', 'to_role' => 'requester'],
|
||||
] as $template) {
|
||||
WorkflowTemplate::query()->updateOrCreate(
|
||||
['name' => $template['name'], 'event' => $template['event']],
|
||||
$template + ['text_body' => null, 'cc' => null, 'bcc' => null, 'is_active' => true]
|
||||
);
|
||||
}
|
||||
$this->call(DatabaseHelpdeskDatabaseSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ final class AgentAssignmentService
|
||||
{
|
||||
/**
|
||||
* Select the least-loaded available agent for a category.
|
||||
*
|
||||
* @param int|null $categoryId
|
||||
* @return int|null
|
||||
*/
|
||||
public function selectAgentId(?int $categoryId): ?int
|
||||
{
|
||||
|
||||
@@ -15,17 +15,13 @@ final class AttachmentService
|
||||
/**
|
||||
* Store uploaded files against a ticket and optional comment.
|
||||
*
|
||||
* @param Ticket $ticket
|
||||
* @param array<int, UploadedFile> $files
|
||||
* @param int $userId
|
||||
* @param Comment|null $comment
|
||||
* @return void
|
||||
* @param array<int, UploadedFile> $files
|
||||
*/
|
||||
public function storeMany(Ticket $ticket, array $files, int $userId, ?Comment $comment = null): void
|
||||
{
|
||||
foreach ($files as $file) {
|
||||
$disk = (string) config('helpdesk.disk');
|
||||
$path = $file->store('tickets/' . $ticket->id, $disk);
|
||||
$path = $file->store('tickets/'.$ticket->id, $disk);
|
||||
|
||||
Attachment::query()->create([
|
||||
'ticket_id' => $ticket->id,
|
||||
@@ -42,9 +38,6 @@ final class AttachmentService
|
||||
|
||||
/**
|
||||
* Delete a stored attachment and its backing file.
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @return void
|
||||
*/
|
||||
public function delete(Attachment $attachment): void
|
||||
{
|
||||
|
||||
@@ -10,20 +10,18 @@ final class TicketReferenceService
|
||||
{
|
||||
/**
|
||||
* Build the next human-readable ticket reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function next(): string
|
||||
{
|
||||
$year = now()->format('Y');
|
||||
$prefix = 'HD-' . $year . '-';
|
||||
$prefix = 'HD-'.$year.'-';
|
||||
$last = Ticket::query()
|
||||
->where('reference', 'like', $prefix . '%')
|
||||
->where('reference', 'like', $prefix.'%')
|
||||
->latest('id')
|
||||
->value('reference');
|
||||
|
||||
$next = $last ? ((int) substr((string) $last, -5)) + 1 : 1;
|
||||
|
||||
return $prefix . str_pad((string) $next, 5, '0', STR_PAD_LEFT);
|
||||
return $prefix.str_pad((string) $next, 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,17 @@ final class TicketService
|
||||
public function create(User $user, array $data, array $files = []): Ticket
|
||||
{
|
||||
return DB::transaction(function () use ($user, $data, $files): Ticket {
|
||||
$status = Status::query()
|
||||
->where('slug', config('helpdesk.default_status_slug', 'new'))
|
||||
->first();
|
||||
$defaultStatusSlug = (string) config('helpdesk.default_status_slug', 'new');
|
||||
$status = Status::query()->where('slug', $defaultStatusSlug)->first();
|
||||
|
||||
if (! $status) {
|
||||
$status = Status::query()->create([
|
||||
'name' => 'New',
|
||||
'slug' => config('helpdesk.default_status_slug', 'new'),
|
||||
'slug' => $defaultStatusSlug,
|
||||
'color' => 'sky',
|
||||
'sort_order' => 5,
|
||||
'sort_order' => 1,
|
||||
'is_closed' => false,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/** @var Ticket $ticket */
|
||||
|
||||
@@ -16,11 +16,6 @@ final class WorkflowNotificationService
|
||||
{
|
||||
/**
|
||||
* Send all active workflow messages for the supplied ticket event.
|
||||
*
|
||||
* @param Ticket $ticket
|
||||
* @param string $event
|
||||
* @param User|null $actor
|
||||
* @return void
|
||||
*/
|
||||
public function dispatch(Ticket $ticket, string $event, ?User $actor = null): void
|
||||
{
|
||||
@@ -35,6 +30,7 @@ final class WorkflowNotificationService
|
||||
|
||||
if ($recipient === null || blank($recipient->email ?? null)) {
|
||||
$this->log($template, $ticket, $event, null, 'skipped', 'No recipient email was available.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +59,6 @@ final class WorkflowNotificationService
|
||||
});
|
||||
}
|
||||
|
||||
/** @return User|null */
|
||||
private function recipient(string $role, Ticket $ticket, ?User $actor): ?User
|
||||
{
|
||||
return match ($role) {
|
||||
@@ -95,15 +90,15 @@ final class WorkflowNotificationService
|
||||
private function wrapHtml(string $body, Ticket $ticket): string
|
||||
{
|
||||
return '<div style="font-family:Inter,Arial,sans-serif;background:#f6f8fb;padding:24px">'
|
||||
. '<div style="max-width:720px;margin:0 auto;background:#ffffff;border:1px solid #d8dee8;border-radius:18px;overflow:hidden">'
|
||||
. '<div style="background:#0f172a;color:#ffffff;padding:24px 28px">'
|
||||
. '<div style="font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:#bfdbfe">Helpdesk notification</div>'
|
||||
. '<h1 style="margin:8px 0 0;font-size:22px">' . e($ticket->reference) . '</h1>'
|
||||
. '<p style="margin:8px 0 0;color:#dbeafe">' . e($ticket->subject) . '</p>'
|
||||
. '</div><div style="padding:28px;color:#1f2937;line-height:1.65">'
|
||||
. $body
|
||||
. '<p style="margin-top:28px"><a href="' . e(route('helpdesk.tickets.show', ['ticket' => $ticket->getKey()])) . '" style="display:inline-block;background:#2563eb;color:#ffffff;text-decoration:none;padding:11px 16px;border-radius:10px">Open ticket</a></p>'
|
||||
. '</div></div></div>';
|
||||
.'<div style="max-width:720px;margin:0 auto;background:#ffffff;border:1px solid #d8dee8;border-radius:18px;overflow:hidden">'
|
||||
.'<div style="background:#0f172a;color:#ffffff;padding:24px 28px">'
|
||||
.'<div style="font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:#bfdbfe">Helpdesk notification</div>'
|
||||
.'<h1 style="margin:8px 0 0;font-size:22px">'.e($ticket->reference).'</h1>'
|
||||
.'<p style="margin:8px 0 0;color:#dbeafe">'.e($ticket->subject).'</p>'
|
||||
.'</div><div style="padding:28px;color:#1f2937;line-height:1.65">'
|
||||
.$body
|
||||
.'<p style="margin-top:28px"><a href="'.e(route('helpdesk.tickets.show', ['ticket' => $ticket->getKey()])).'" style="display:inline-block;background:#2563eb;color:#ffffff;text-decoration:none;padding:11px 16px;border-radius:10px">Open ticket</a></p>'
|
||||
.'</div></div></div>';
|
||||
}
|
||||
|
||||
private function log(WorkflowTemplate $template, Ticket $ticket, string $event, ?string $recipient, string $status, ?string $error = null, ?string $subject = null): void
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Helpdesk\Support;
|
||||
|
||||
final class Color
|
||||
{
|
||||
public static function css(?string $color): string
|
||||
{
|
||||
return match ($color) {
|
||||
'red', 'rose' => '#e11d48',
|
||||
'amber', 'yellow' => '#d97706',
|
||||
'emerald', 'green' => '#059669',
|
||||
'blue' => '#2563eb',
|
||||
'sky', 'cyan' => '#0284c7',
|
||||
'indigo' => '#4f46e5',
|
||||
'violet', 'purple' => '#7c3aed',
|
||||
'slate' => '#334155',
|
||||
'zinc', null, '' => '#52525b',
|
||||
default => str_starts_with((string) $color, '#') ? (string) $color : '#52525b',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ use Tests\DuskTestCase;
|
||||
|
||||
final class HelpdeskNavigationBrowserTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function test_helpdesk_dashboard_and_main_pages_render_with_professional_headers(): void
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ use Tests\DuskTestCase;
|
||||
|
||||
final class HelpdeskSettingsBrowserTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function test_settings_tabs_expose_lookup_git_and_workflow_setup_areas(): void
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ use Tests\DuskTestCase;
|
||||
|
||||
final class HelpdeskTicketBrowserTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use DatabaseMigrations;
|
||||
|
||||
public function test_user_can_create_and_view_ticket_in_browser(): void
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ trait BuildsHelpdeskFixtures
|
||||
unset($attributes['owner'], $attributes['agent']);
|
||||
|
||||
return Ticket::query()->create(array_merge([
|
||||
'reference' => 'HD-' . now()->format('Y') . '-' . str_pad((string) random_int(1, 99999), 5, '0', STR_PAD_LEFT),
|
||||
'reference' => 'HD-'.now()->format('Y').'-'.str_pad((string) random_int(1, 99999), 5, '0', STR_PAD_LEFT),
|
||||
'user_id' => $owner->id,
|
||||
'agent_id' => $agent?->id,
|
||||
'status_id' => $this->status()->id,
|
||||
|
||||
@@ -11,8 +11,8 @@ use Tests\TestCase;
|
||||
|
||||
final class AgentAssignmentTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_assignment_selects_least_loaded_agent(): void
|
||||
{
|
||||
|
||||
@@ -15,8 +15,8 @@ use Tests\TestCase;
|
||||
|
||||
final class GitAndAttachmentTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_git_commit_can_be_tracked_against_repository_and_ticket(): void
|
||||
{
|
||||
@@ -32,7 +32,7 @@ final class GitAndAttachmentTest extends TestCase
|
||||
'branch' => 'develop',
|
||||
'author_name' => 'Mark Gregory',
|
||||
'author_email' => 'mark@example.com',
|
||||
'message' => 'Resolve ' . $ticket->reference . ' ticket save redirect',
|
||||
'message' => 'Resolve '.$ticket->reference.' ticket save redirect',
|
||||
'url' => 'https://example.com/commit/b',
|
||||
'committed_at' => now(),
|
||||
]);
|
||||
|
||||
@@ -10,8 +10,8 @@ use Tests\TestCase;
|
||||
|
||||
final class HelpdeskRouteTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_authenticated_user_can_open_dashboard_tickets_create_and_settings_pages(): void
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ use Tests\TestCase;
|
||||
|
||||
final class SettingsCrudTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_settings_manager_creates_updates_and_deletes_statuses(): void
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ use Tests\TestCase;
|
||||
|
||||
final class TicketConversationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_owner_can_add_public_response_to_ticket(): void
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ use Tests\TestCase;
|
||||
|
||||
final class TicketCrudTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_user_can_create_ticket_with_priority_category_team_and_project(): void
|
||||
{
|
||||
@@ -125,7 +125,7 @@ final class TicketCrudTest extends TestCase
|
||||
|
||||
$ticket = Ticket::query()->where('subject', 'Reference check')->firstOrFail();
|
||||
|
||||
self::assertStringStartsWith('HD-' . now()->format('Y') . '-', $ticket->reference);
|
||||
self::assertStringStartsWith('HD-'.now()->format('Y').'-', $ticket->reference);
|
||||
self::assertNotNull($ticket->last_activity_at);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ use Tests\TestCase;
|
||||
|
||||
final class TicketPolicyTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_owner_can_view_and_comment_but_cannot_update_ticket(): void
|
||||
{
|
||||
|
||||
@@ -13,8 +13,8 @@ use Tests\TestCase;
|
||||
|
||||
final class WorkflowNotificationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_workflow_dispatch_sends_active_template_and_logs_it(): void
|
||||
{
|
||||
@@ -50,7 +50,7 @@ final class WorkflowNotificationTest extends TestCase
|
||||
'event' => 'ticket.created',
|
||||
'recipient' => 'requester@example.com',
|
||||
'status' => 'sent',
|
||||
'subject' => 'Ticket ' . $ticket->reference . ' raised for Requester Name',
|
||||
'subject' => 'Ticket '.$ticket->reference.' raised for Requester Name',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ use Tests\TestCase;
|
||||
|
||||
final class ModelRelationshipTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_ticket_loads_company_project_team_category_priority_status_and_git_commits(): void
|
||||
{
|
||||
|
||||
@@ -11,22 +11,22 @@ use Tests\TestCase;
|
||||
|
||||
final class TicketReferenceServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
use BuildsHelpdeskFixtures;
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_it_generates_the_first_reference_for_the_current_year(): void
|
||||
{
|
||||
$reference = app(TicketReferenceService::class)->next();
|
||||
|
||||
self::assertSame('HD-' . now()->format('Y') . '-00001', $reference);
|
||||
self::assertSame('HD-'.now()->format('Y').'-00001', $reference);
|
||||
}
|
||||
|
||||
public function test_it_generates_the_next_reference_after_existing_tickets(): void
|
||||
{
|
||||
$this->ticket(['reference' => 'HD-' . now()->format('Y') . '-00041']);
|
||||
$this->ticket(['reference' => 'HD-'.now()->format('Y').'-00041']);
|
||||
|
||||
$reference = app(TicketReferenceService::class)->next();
|
||||
|
||||
self::assertSame('HD-' . now()->format('Y') . '-00042', $reference);
|
||||
self::assertSame('HD-'.now()->format('Y').'-00042', $reference);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,8 @@ final class LookupTable extends Component
|
||||
public readonly mixed $items,
|
||||
public readonly string $edit,
|
||||
public readonly string $delete,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/** @return View */
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::components.lookup-table');
|
||||
|
||||
@@ -10,5 +10,9 @@ use Illuminate\View\Component;
|
||||
final class ProjectTable extends Component
|
||||
{
|
||||
public function __construct(public readonly mixed $items) {}
|
||||
public function render(): View { return view('helpdesk::components.project-table'); }
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::components.project-table');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,8 @@ final class SettingsSection extends Component
|
||||
public function __construct(
|
||||
public readonly string $title,
|
||||
public readonly string $description,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
/** @return View */
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::components.settings-section');
|
||||
|
||||
@@ -10,5 +10,9 @@ use Illuminate\View\Component;
|
||||
final class TeamTable extends Component
|
||||
{
|
||||
public function __construct(public readonly mixed $items) {}
|
||||
public function render(): View { return view('helpdesk::components.team-table'); }
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('helpdesk::components.team-table');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,23 +43,13 @@ versions:
|
||||
- Corrected the seeder namespace to Modules\\Helpdesk\\Database\\Seeders for PSR-4 module autoloading.
|
||||
- Kept module.json version in sync with changelog.yaml.
|
||||
|
||||
"1.0.7":
|
||||
"1.0.9":
|
||||
changed:
|
||||
- Added ticket edit screen with assignment, status, priority, category, project, team, due date and body editing.
|
||||
- Added green Edit and blue Back actions on the ticket detail page.
|
||||
- Added ticket assignment update support directly from the ticket detail page.
|
||||
- Changed default created ticket status from Open to New.
|
||||
- Rebuilt the Kanban board as a horizontal draggable workflow board using native drag and drop.
|
||||
- Added a Configure boards action that links Kanban users to the existing configurable Statuses setup.
|
||||
- Kept module.json version in sync with changelog.yaml.
|
||||
|
||||
|
||||
"1.0.8":
|
||||
changed:
|
||||
- Fixed Helpdesk module view registration so helpdesk::livewire views resolve from the module folder reliably.
|
||||
- Restored the RouteServiceProvider file expected by the module service provider.
|
||||
- Rebuilt the performance indexes migration to skip indexes already created by earlier Helpdesk migrations.
|
||||
- Kept ticket creation as a pure Livewire form and defaulted newly created tickets to the New status.
|
||||
- Made the Kanban board resilient on empty installs by ensuring default status boards exist.
|
||||
- Improved Kanban board drag/drop styling and colour rendering while preserving configurable statuses.
|
||||
- Added editable tickets with assignment, status, priority, category, team, project, due date and details updates.
|
||||
- Changed the default ticket creation status to New.
|
||||
- Added configurable Kanban boards with status-column assignment and a default Standard Support board.
|
||||
- Rebuilt the Kanban board into a professional drag-and-drop board with SortableJS fallback loading.
|
||||
- Added blue Back and green Edit actions on ticket view pages.
|
||||
- Improved Helpdesk settings styling, blue edit actions, and a dedicated Kanban Boards CRUD section.
|
||||
- Marked mandatory ticket fields and enhanced create/edit ticket forms with Select2-capable dropdowns.
|
||||
- Kept module.json version in sync with changelog.yaml.
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"Modules\\Helpdesk\\Providers\\HelpdeskServiceProvider"
|
||||
],
|
||||
"files": [],
|
||||
"version": "1.0.8"
|
||||
"version": "1.0.9"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class InternalApiServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Route::middleware('api')->prefix('api/internal')->group(__DIR__ . '/../routes/api.php');
|
||||
Route::middleware('api')->prefix('api/internal')->group(__DIR__.'/../routes/api.php');
|
||||
app('router')->aliasMiddleware('internal.signed', VerifyInternalApiSignature::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ class VerifyInternalApiSignature
|
||||
|
||||
$body = $request->getContent();
|
||||
$payloads = array_unique([
|
||||
$timestamp . '.' . $body,
|
||||
$timestamp . '.',
|
||||
$timestamp . '.[]',
|
||||
$timestamp.'.'.$body,
|
||||
$timestamp.'.',
|
||||
$timestamp.'.[]',
|
||||
]);
|
||||
|
||||
foreach ($payloads as $payload) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class InternalApiSignatureTest extends TestCase
|
||||
config(['platform.internal_api_key' => 'testing-secret']);
|
||||
$timestamp = now()->toIso8601String();
|
||||
$body = '';
|
||||
$signature = hash_hmac('sha256', $timestamp . '.' . $body, 'testing-secret');
|
||||
$signature = hash_hmac('sha256', $timestamp.'.'.$body, 'testing-secret');
|
||||
|
||||
$this->withHeaders([
|
||||
'X-WMS-Timestamp' => $timestamp,
|
||||
|
||||
@@ -11,8 +11,8 @@ class InventoryManagementServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'inventorymanagement');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'inventorymanagement');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class M3IntegrationServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'm3integration');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'm3integration');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Modules\Platform\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Platform\app\Http\Middleware\EnsureLicensedTenant;
|
||||
@@ -16,7 +15,7 @@ class PlatformServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__ . '/../config/platform.php', 'platform');
|
||||
$this->mergeConfigFrom(__DIR__.'/../config/platform.php', 'platform');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,10 +23,10 @@ class PlatformServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'platform');
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'platform');
|
||||
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
|
||||
|
||||
Route::middleware('web')->group(__DIR__ . '/../routes/web.php');
|
||||
Route::middleware('web')->group(__DIR__.'/../routes/web.php');
|
||||
|
||||
app('router')->aliasMiddleware('tenant.assigned', EnsureTenantAssigned::class);
|
||||
app('router')->aliasMiddleware('tenant.licensed', EnsureLicensedTenant::class);
|
||||
|
||||
@@ -72,7 +72,7 @@ class PlatformDashboardController extends Controller
|
||||
/**
|
||||
* Build the company usage chart series.
|
||||
*
|
||||
* @param Collection<int, Company> $companies
|
||||
* @param Collection<int, Company> $companies
|
||||
* @return array<int, array{label: string, data: array<int, int>}>
|
||||
*/
|
||||
private function companyUsageChartSeries(Collection $companies): array
|
||||
|
||||
@@ -11,7 +11,6 @@ use Modules\Platform\app\Models\PlatformPrice;
|
||||
|
||||
class PlatformPriceController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* Display the customer-facing platform pricing cards.
|
||||
*/
|
||||
@@ -98,7 +97,7 @@ class PlatformPriceController extends Controller
|
||||
private function validatedPriceData(Request $request, ?PlatformPrice $price = null): array
|
||||
{
|
||||
$data = $request->validate([
|
||||
'code' => ['nullable', 'string', 'max:40', 'unique:platform_prices,code,' . ($price?->id ?? 'NULL')],
|
||||
'code' => ['nullable', 'string', 'max:40', 'unique:platform_prices,code,'.($price?->id ?? 'NULL')],
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'strapline' => ['nullable', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string', 'max:2000'],
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Platform\app\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
@@ -35,7 +36,7 @@ class Company extends Model
|
||||
|
||||
public function users(): HasMany
|
||||
{
|
||||
return $this->hasMany(\App\Models\User::class);
|
||||
return $this->hasMany(User::class);
|
||||
}
|
||||
|
||||
public function licenseKeys(): HasMany
|
||||
|
||||
@@ -28,7 +28,7 @@ class LicenseKey extends Model
|
||||
|
||||
public static function issueFor(Company $company, string $label, string $plan = 'standard', int $maxUsers = 10): string
|
||||
{
|
||||
$plainKey = 'WMS-' . Str::upper(Str::random(32));
|
||||
$plainKey = 'WMS-'.Str::upper(Str::random(32));
|
||||
|
||||
self::create([
|
||||
'company_id' => $company->id,
|
||||
|
||||
@@ -48,7 +48,7 @@ class PlatformPrice extends Model
|
||||
'gbp' => '£',
|
||||
'eur' => '€',
|
||||
'usd' => '$',
|
||||
default => strtoupper($this->currency) . ' ',
|
||||
default => strtoupper($this->currency).' ',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class PlatformPrice extends Model
|
||||
return '—';
|
||||
}
|
||||
|
||||
return $this->currencySymbol() . number_format($amount / 100, 2);
|
||||
return $this->currencySymbol().number_format($amount / 100, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-1
@@ -2,7 +2,6 @@
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
|
||||
@@ -8,7 +8,6 @@ use Modules\Platform\app\Http\Controllers\PlatformDashboardController;
|
||||
use Modules\Platform\app\Http\Controllers\PlatformPriceController;
|
||||
use Modules\Platform\app\Http\Controllers\StripeWebhookController;
|
||||
|
||||
|
||||
Route::middleware(['auth', 'verified', 'tenant.assigned'])
|
||||
->prefix('platform')
|
||||
->name('platform.')
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
return [
|
||||
'name' => 'Pricing',
|
||||
'features' =>
|
||||
[
|
||||
],
|
||||
'features' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Modules\Pricing\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PricingDatabaseSeeder extends Seeder
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Modules\Pricing\Support\ModuleInfo;
|
||||
|
||||
if (! function_exists('pricing_feature_enabled')) {
|
||||
|
||||
@@ -2,41 +2,29 @@
|
||||
|
||||
namespace Modules\Pricing\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Modules\Pricing\Support\ModuleInfo;
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Pricing\Support\ModuleInfo;
|
||||
|
||||
class PricingServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected string $moduleName = 'Pricing';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected string $moduleNameLower = 'pricing';
|
||||
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides():array
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot() : void
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
@@ -48,8 +36,6 @@ class PricingServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
@@ -58,8 +44,6 @@ class PricingServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Register the helpers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerHelpers(): void
|
||||
{
|
||||
@@ -68,71 +52,64 @@ class PricingServiceProvider extends ServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Dynamically Register Commands.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerCommands(): void
|
||||
{
|
||||
if (!$this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
{
|
||||
if (! $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__.'/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\'.$this->moduleName.'\\Console\\'.$file->getFilenameWithoutExtension();
|
||||
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path( ModuleInfo::nameLower(). '.php'),
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower().'.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower()
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
|
||||
$viewPath = resource_path('views/modules/'.ModuleInfo::nameLower());
|
||||
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', ModuleInfo::nameLower() . '-module-views']);
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
$sourcePath => $viewPath,
|
||||
], ['views', ModuleInfo::nameLower().'-module-views']);
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
$langPath = resource_path('lang/modules/'.ModuleInfo::nameLower());
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower());
|
||||
}
|
||||
@@ -140,16 +117,16 @@ class PricingServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Regsiter View Paths
|
||||
* @return array
|
||||
*/
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) {
|
||||
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
|
||||
if (is_dir($path.'/modules/'.ModuleInfo::nameLower())) {
|
||||
$paths[] = $path.'/modules/'.ModuleInfo::nameLower();
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\Pricing\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@ use Illuminate\Http\Request;
|
||||
|
||||
Route::middleware('auth:api')->get('/pricing', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,11 +4,10 @@ namespace Modules\Pricing\Support;
|
||||
|
||||
class ModuleInfo
|
||||
{
|
||||
protected static string $moduleName = 'Pricing';
|
||||
protected static string $moduleName = 'Pricing';
|
||||
|
||||
/**
|
||||
* defines the Module Name
|
||||
* @return string
|
||||
*/
|
||||
public static function name(): string
|
||||
{
|
||||
@@ -17,7 +16,6 @@ class ModuleInfo
|
||||
|
||||
/**
|
||||
* define the lowercase version
|
||||
* @return string
|
||||
*/
|
||||
public static function nameLower(): string
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ class ReplenishmentServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'replenishment');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'replenishment');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class ReportingServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'reporting');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'reporting');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class SecurityServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'security');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'security');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class SentinelIntegrationServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'sentinelintegration');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'sentinelintegration');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'shipping');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'shipping');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,8 @@ class TransportationServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'transportation');
|
||||
$this->loadRoutesFrom(__DIR__.'/../Routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../Resources/views', 'transportation');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,8 +12,8 @@ class WarehouseServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'warehouse');
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
|
||||
Route::middleware('web')->group(__DIR__ . '/../routes/web.php');
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'warehouse');
|
||||
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
|
||||
Route::middleware('web')->group(__DIR__.'/../routes/web.php');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ class CreateNewUser implements CreatesNewUsers
|
||||
/**
|
||||
* Validate and create a newly registered user with an isolated company tenant.
|
||||
*
|
||||
* @param array<string, string> $input
|
||||
* @param array<string, string> $input
|
||||
*/
|
||||
public function create(array $input): User
|
||||
{
|
||||
@@ -29,11 +29,11 @@ class CreateNewUser implements CreatesNewUsers
|
||||
])->validate();
|
||||
|
||||
return DB::transaction(function () use ($input): User {
|
||||
$companyName = $input['company_name'] ?? ($input['name'] . ' Company');
|
||||
$companyName = $input['company_name'] ?? ($input['name'].' Company');
|
||||
|
||||
$company = Company::create([
|
||||
'name' => $companyName,
|
||||
'slug' => Str::slug($companyName . '-' . Str::random(6)),
|
||||
'slug' => Str::slug($companyName.'-'.Str::random(6)),
|
||||
'status' => 'active',
|
||||
'timezone' => 'Europe/London',
|
||||
]);
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Company extends \Modules\Platform\app\Models\Company
|
||||
{
|
||||
}
|
||||
class Company extends \Modules\Platform\app\Models\Company {}
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class LicenseKey extends \Modules\Platform\app\Models\LicenseKey
|
||||
{
|
||||
}
|
||||
class LicenseKey extends \Modules\Platform\app\Models\LicenseKey {}
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Payment extends \Modules\Platform\app\Models\Payment
|
||||
{
|
||||
}
|
||||
class Payment extends \Modules\Platform\app\Models\Payment {}
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Warehouse extends \Modules\Warehouse\app\Models\Warehouse
|
||||
{
|
||||
}
|
||||
class Warehouse extends \Modules\Warehouse\app\Models\Warehouse {}
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class WarehouseValidationRule extends \Modules\Warehouse\app\Models\WarehouseValidationRule
|
||||
{
|
||||
}
|
||||
class WarehouseValidationRule extends \Modules\Warehouse\app\Models\WarehouseValidationRule {}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
@@ -142,7 +143,7 @@ class TenancyServiceProvider extends ServiceProvider
|
||||
];
|
||||
|
||||
foreach (array_reverse($tenancyMiddleware) as $middleware) {
|
||||
$this->app[\Illuminate\Contracts\Http\Kernel::class]->prependToMiddlewarePriority($middleware);
|
||||
$this->app[Kernel::class]->prependToMiddlewarePriority($middleware);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ final class DashboardChartService
|
||||
|
||||
try {
|
||||
$rows = DB::connection('odbc')->select(
|
||||
"SELECT DATE(A5PICKCMTS) AS PICK_DATE, COUNT(*) AS TOTAL
|
||||
'SELECT DATE(A5PICKCMTS) AS PICK_DATE, COUNT(*) AS TOTAL
|
||||
FROM EWDAT.ICM688M2
|
||||
WHERE A5PICKCMTS >= CURRENT DATE - 7 DAYS
|
||||
GROUP BY DATE(A5PICKCMTS)
|
||||
ORDER BY PICK_DATE"
|
||||
ORDER BY PICK_DATE'
|
||||
);
|
||||
|
||||
foreach ($rows as $row) {
|
||||
@@ -171,12 +171,12 @@ final class DashboardChartService
|
||||
|
||||
try {
|
||||
$rows = DB::connection('odbc')->select(
|
||||
"SELECT TRIM(AT9WHS) AS WAREHOUSE, COUNT(*) AS TOTAL
|
||||
'SELECT TRIM(AT9WHS) AS WAREHOUSE, COUNT(*) AS TOTAL
|
||||
FROM EWDAT.ICM709M
|
||||
WHERE AT9QTY <= AT9WRN
|
||||
GROUP BY TRIM(AT9WHS)
|
||||
ORDER BY TOTAL DESC
|
||||
FETCH FIRST 6 ROWS ONLY"
|
||||
FETCH FIRST 6 ROWS ONLY'
|
||||
);
|
||||
|
||||
if (! empty($rows)) {
|
||||
@@ -204,12 +204,12 @@ final class DashboardChartService
|
||||
|
||||
try {
|
||||
$rows = DB::connection('odbc')->select(
|
||||
"SELECT
|
||||
'SELECT
|
||||
SUM(A5RSVQTY) AS RESERVED_QTY,
|
||||
SUM(A5PACKED) AS PACKED_QTY,
|
||||
SUM(A5RSVQTY - A5PACKED) AS REMAINING_QTY
|
||||
FROM EWDAT.ICM688M2
|
||||
WHERE A5RSVQTY > 0"
|
||||
WHERE A5RSVQTY > 0'
|
||||
);
|
||||
|
||||
if (! empty($rows)) {
|
||||
@@ -260,7 +260,7 @@ final class DashboardChartService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, string> $labels
|
||||
* @return array<string, int>
|
||||
*/
|
||||
private function emptySeries(array $labels): array
|
||||
@@ -287,8 +287,8 @@ final class DashboardChartService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function lineChart(array $labels, array $data, string $label): array
|
||||
@@ -305,8 +305,8 @@ final class DashboardChartService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function barChart(array $labels, array $data, string $label): array
|
||||
@@ -322,8 +322,8 @@ final class DashboardChartService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @param array<int, string> $labels
|
||||
* @param array<int, int> $data
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function doughnutChart(array $labels, array $data, string $label): array
|
||||
|
||||
@@ -19,7 +19,7 @@ use Modules\Shipping\Providers\ShippingServiceProvider;
|
||||
use Modules\Transportation\Providers\TransportationServiceProvider;
|
||||
use Modules\Warehouse\Providers\WarehouseServiceProvider;
|
||||
|
||||
$statusesPath = dirname(__DIR__) . '/modules_statuses.json';
|
||||
$statusesPath = dirname(__DIR__).'/modules_statuses.json';
|
||||
$statuses = is_file($statusesPath)
|
||||
? json_decode((string) file_get_contents($statusesPath), true, 512, JSON_THROW_ON_ERROR)
|
||||
: [];
|
||||
|
||||
+22
-17
@@ -4,6 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
use LaravelLang\Config\Constants\RouteName;
|
||||
use LaravelLang\LocaleList\Locale;
|
||||
use LaravelLang\Routes\Middlewares\LocalizationByCookie;
|
||||
use LaravelLang\Routes\Middlewares\LocalizationByHeader;
|
||||
use LaravelLang\Routes\Middlewares\LocalizationByModel;
|
||||
use LaravelLang\Routes\Middlewares\LocalizationByParameterPrefix;
|
||||
use LaravelLang\Routes\Middlewares\LocalizationBySession;
|
||||
|
||||
return [
|
||||
/*
|
||||
@@ -111,10 +116,10 @@ return [
|
||||
|
||||
'names' => [
|
||||
'parameter' => RouteName::Parameter,
|
||||
'header' => RouteName::Header,
|
||||
'cookie' => RouteName::Cookie,
|
||||
'session' => RouteName::Session,
|
||||
'column' => RouteName::Column,
|
||||
'header' => RouteName::Header,
|
||||
'cookie' => RouteName::Cookie,
|
||||
'session' => RouteName::Session,
|
||||
'column' => RouteName::Column,
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -148,20 +153,20 @@ return [
|
||||
// This option contains settings for routes without the prefix of the localization code.
|
||||
|
||||
'default' => [
|
||||
LaravelLang\Routes\Middlewares\LocalizationByCookie::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationByHeader::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationBySession::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationByModel::class,
|
||||
LocalizationByCookie::class,
|
||||
LocalizationByHeader::class,
|
||||
LocalizationBySession::class,
|
||||
LocalizationByModel::class,
|
||||
],
|
||||
|
||||
// This option contains settings for routes with the prefix of the localization code.
|
||||
|
||||
'prefix' => [
|
||||
LaravelLang\Routes\Middlewares\LocalizationByParameterPrefix::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationByCookie::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationByHeader::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationBySession::class,
|
||||
LaravelLang\Routes\Middlewares\LocalizationByModel::class,
|
||||
LocalizationByParameterPrefix::class,
|
||||
LocalizationByCookie::class,
|
||||
LocalizationByHeader::class,
|
||||
LocalizationBySession::class,
|
||||
LocalizationByModel::class,
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -229,14 +234,14 @@ return [
|
||||
'google' => [
|
||||
'translator' => '\LaravelLang\Translator\Integrations\Google',
|
||||
|
||||
'enabled' => (bool) env('TRANSLATION_GOOGLE_ENABLED', true),
|
||||
'enabled' => (bool) env('TRANSLATION_GOOGLE_ENABLED', true),
|
||||
'priority' => (int) env('TRANSLATION_GOOGLE_PRIORITY', 1),
|
||||
],
|
||||
|
||||
'deepl' => [
|
||||
'translator' => '\LaravelLang\Translator\Integrations\Deepl',
|
||||
|
||||
'enabled' => (bool) env('TRANSLATION_DEEPL_ENABLED', false),
|
||||
'enabled' => (bool) env('TRANSLATION_DEEPL_ENABLED', false),
|
||||
'priority' => (int) env('TRANSLATION_DEEPL_PRIORITY', 2),
|
||||
|
||||
'credentials' => [
|
||||
@@ -247,11 +252,11 @@ return [
|
||||
'yandex' => [
|
||||
'translator' => '\LaravelLang\Translator\Integrations\Yandex',
|
||||
|
||||
'enabled' => (bool) env('TRANSLATION_YANDEX_ENABLED', false),
|
||||
'enabled' => (bool) env('TRANSLATION_YANDEX_ENABLED', false),
|
||||
'priority' => (int) env('TRANSLATION_YANDEX_PRIORITY', 3),
|
||||
|
||||
'credentials' => [
|
||||
'key' => (string) env('TRANSLATION_YANDEX_KEY'),
|
||||
'key' => (string) env('TRANSLATION_YANDEX_KEY'),
|
||||
'folder' => (string) env('TRANSLATION_YANDEX_FOLDER_ID'),
|
||||
],
|
||||
],
|
||||
|
||||
+2
-3
@@ -3,7 +3,6 @@
|
||||
use mpba\Modules\Activators\DatabaseActivator;
|
||||
use mpba\Modules\Activators\FileActivator;
|
||||
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
@@ -28,7 +27,7 @@ return [
|
||||
|
||||
'stubs' => [
|
||||
'enabled' => false,
|
||||
'path' => base_path() . '/Vendors/mpba/laravel-modules/src/Commands/stubs',
|
||||
'path' => base_path().'/Vendors/mpba/laravel-modules/src/Commands/stubs',
|
||||
'files' => [
|
||||
'routes/web' => 'Routes/web.php',
|
||||
'routes/api' => 'Routes/api.php',
|
||||
@@ -121,7 +120,7 @@ return [
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'test' => ['path' => 'Tests/Unit', 'generate' => true],
|
||||
'test-feature' => ['path' => 'Tests/Feature', 'generate' => true],
|
||||
'test-browser' => ['path' => 'Tests/Browser', 'generate' => true,],
|
||||
'test-browser' => ['path' => 'Tests/Browser', 'generate' => true],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||
|
||||
+17
-9
@@ -2,12 +2,20 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Bootstrappers\QueueTenancyBootstrapper;
|
||||
use Stancl\Tenancy\Database\Models\Domain;
|
||||
use Stancl\Tenancy\Database\Models\Tenant;
|
||||
use Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager;
|
||||
use Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager;
|
||||
use Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager;
|
||||
use Stancl\Tenancy\UUIDGenerator;
|
||||
|
||||
return [
|
||||
'tenant_model' => Tenant::class,
|
||||
'id_generator' => Stancl\Tenancy\UUIDGenerator::class,
|
||||
'id_generator' => UUIDGenerator::class,
|
||||
|
||||
'domain_model' => Domain::class,
|
||||
|
||||
@@ -28,10 +36,10 @@ return [
|
||||
* To configure their behavior, see the config keys below.
|
||||
*/
|
||||
'bootstrappers' => [
|
||||
Stancl\Tenancy\Bootstrappers\DatabaseTenancyBootstrapper::class,
|
||||
Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper::class,
|
||||
Stancl\Tenancy\Bootstrappers\FilesystemTenancyBootstrapper::class,
|
||||
Stancl\Tenancy\Bootstrappers\QueueTenancyBootstrapper::class,
|
||||
DatabaseTenancyBootstrapper::class,
|
||||
CacheTenancyBootstrapper::class,
|
||||
FilesystemTenancyBootstrapper::class,
|
||||
QueueTenancyBootstrapper::class,
|
||||
// Stancl\Tenancy\Bootstrappers\RedisTenancyBootstrapper::class, // Note: phpredis is needed
|
||||
],
|
||||
|
||||
@@ -58,10 +66,10 @@ return [
|
||||
* TenantDatabaseManagers are classes that handle the creation & deletion of tenant databases.
|
||||
*/
|
||||
'managers' => [
|
||||
'sqlite' => Stancl\Tenancy\TenantDatabaseManagers\SQLiteDatabaseManager::class,
|
||||
'mysql' => Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager::class,
|
||||
'mariadb' => Stancl\Tenancy\TenantDatabaseManagers\MySQLDatabaseManager::class,
|
||||
'pgsql' => Stancl\Tenancy\TenantDatabaseManagers\PostgreSQLDatabaseManager::class,
|
||||
'sqlite' => SQLiteDatabaseManager::class,
|
||||
'mysql' => MySQLDatabaseManager::class,
|
||||
'mariadb' => MySQLDatabaseManager::class,
|
||||
'pgsql' => PostgreSQLDatabaseManager::class,
|
||||
|
||||
/**
|
||||
* Use this database manager for MySQL to have a DB user created for each tenant database.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user