feat: Add notification services for Email, Telegram, and WhatsApp

- Implement EmailNotifier for sending batch and test notifications via email.
- Implement TelegramNotifier for sending batch and test notifications via Telegram.
- Implement WahaNotifier for sending batch and test notifications via WhatsApp using WAHA API.
- Create migration for client_categories table and update clients table to include category_id.
- Create migration for notification_settings table to manage notification configurations.
- Add ClientCategorySeeder to populate default client categories.
- Create manifest.json for PWA support.
- Implement service worker (sw.js) for caching static assets and offline support.
- Add edit event view for modifying scheduled events.
- Create search results view for displaying search queries.
- Develop notification settings view for configuring notification channels and triggers.
This commit is contained in:
I-Fun
2026-04-01 12:46:58 +07:00
parent 1126877ef5
commit d3c35ad730
29 changed files with 1849 additions and 96 deletions

View File

@@ -0,0 +1,50 @@
<?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
{
Schema::create('client_categories', function (Blueprint $table): void {
$table->id();
$table->string('name');
$table->string('slug')->unique();
$table->unsignedBigInteger('parent_id')->nullable();
$table->string('icon')->default('🏷️');
$table->string('color')->default('#FFB7C5');
$table->string('description')->nullable();
$table->boolean('is_system')->default(false);
$table->unsignedInteger('sort_order')->default(0);
$table->timestamps();
$table->foreign('parent_id')
->references('id')
->on('client_categories')
->onDelete('set null');
});
// Add category_id to clients table
Schema::table('clients', function (Blueprint $table): void {
$table->unsignedBigInteger('category_id')->nullable()->after('status');
$table->foreign('category_id')
->references('id')
->on('client_categories')
->onDelete('set null');
});
}
public function down(): void
{
Schema::table('clients', function (Blueprint $table): void {
$table->dropForeign(['category_id']);
$table->dropColumn('category_id');
});
Schema::dropIfExists('client_categories');
}
};

View File

@@ -0,0 +1,29 @@
<?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
{
Schema::create('notification_settings', function (Blueprint $table): void {
$table->id();
$table->string('name'); // e.g. "My Telegram Bot"
$table->string('channel'); // email | telegram | whatsapp
$table->json('config'); // channel-specific credentials
$table->json('triggers')->nullable(); // array: upcoming_event, invoice_due, content_due
$table->boolean('is_enabled')->default(true);
$table->integer('notify_before_hours')->default(24); // hours before event to notify
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('notification_settings');
}
};