Implement package limit notification system
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
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::table('event_packages', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
|
||||
$table->timestamp('gallery_warning_sent_at')->nullable()->after('gallery_expires_at');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
|
||||
$table->timestamp('gallery_expired_notified_at')->nullable()->after('gallery_warning_sent_at');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('event_packages', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
|
||||
$table->dropColumn('gallery_warning_sent_at');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
|
||||
$table->dropColumn('gallery_expired_notified_at');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
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::table('tenants', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('tenants', 'notification_preferences')) {
|
||||
$table->json('notification_preferences')->nullable()->after('settings');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenants', 'credit_warning_sent_at')) {
|
||||
$table->timestamp('credit_warning_sent_at')->nullable()->after('notification_preferences');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenants', 'credit_warning_threshold')) {
|
||||
$table->unsignedInteger('credit_warning_threshold')->nullable()->after('credit_warning_sent_at');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
foreach ([
|
||||
'credit_warning_threshold',
|
||||
'credit_warning_sent_at',
|
||||
'notification_preferences',
|
||||
] as $column) {
|
||||
if (Schema::hasColumn('tenants', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
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::table('tenant_packages', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('tenant_packages', 'event_warning_sent_at')) {
|
||||
$table->timestamp('event_warning_sent_at')->nullable()->after('used_events');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenant_packages', 'event_warning_threshold')) {
|
||||
$table->decimal('event_warning_threshold', 5, 2)->nullable()->after('event_warning_sent_at');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenant_packages', 'event_limit_notified_at')) {
|
||||
$table->timestamp('event_limit_notified_at')->nullable()->after('event_warning_threshold');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenant_packages', 'expiry_warning_sent_at')) {
|
||||
$table->timestamp('expiry_warning_sent_at')->nullable()->after('event_limit_notified_at');
|
||||
}
|
||||
|
||||
if (! Schema::hasColumn('tenant_packages', 'expired_notified_at')) {
|
||||
$table->timestamp('expired_notified_at')->nullable()->after('expiry_warning_sent_at');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tenant_packages', function (Blueprint $table) {
|
||||
foreach ([
|
||||
'expired_notified_at',
|
||||
'expiry_warning_sent_at',
|
||||
'event_limit_notified_at',
|
||||
'event_warning_threshold',
|
||||
'event_warning_sent_at',
|
||||
] as $column) {
|
||||
if (Schema::hasColumn('tenant_packages', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -14,8 +14,28 @@ class InviteLayoutSeeder extends Seeder
|
||||
$reflection = new ReflectionClass(JoinTokenLayoutRegistry::class);
|
||||
$layoutsConst = $reflection->getReflectionConstant('LAYOUTS');
|
||||
$fallbackLayouts = $layoutsConst ? $layoutsConst->getValue() : [];
|
||||
$qrSizeOverrides = [
|
||||
'evergreen-vows' => 640,
|
||||
'midnight-gala' => 640,
|
||||
'garden-brunch' => 660,
|
||||
'sparkler-soiree' => 680,
|
||||
'confetti-bash' => 680,
|
||||
];
|
||||
$defaultQrSize = 640;
|
||||
$targetSvgWidth = 1240;
|
||||
$targetSvgHeight = 1754;
|
||||
|
||||
foreach ($fallbackLayouts as $layout) {
|
||||
$layoutId = $layout['id'] ?? null;
|
||||
$forcedQrSize = $qrSizeOverrides[$layoutId] ?? $defaultQrSize;
|
||||
$existingQrSize = (int) ($layout['qr']['size_px'] ?? $layout['qr_size_px'] ?? 0);
|
||||
$qrSize = max($existingQrSize, $forcedQrSize);
|
||||
|
||||
$existingSvgWidth = (int) ($layout['svg']['width'] ?? $layout['svg_width'] ?? 0);
|
||||
$existingSvgHeight = (int) ($layout['svg']['height'] ?? $layout['svg_height'] ?? 0);
|
||||
$svgWidth = max($existingSvgWidth, $targetSvgWidth);
|
||||
$svgHeight = max($existingSvgHeight, $targetSvgHeight);
|
||||
|
||||
$preview = [
|
||||
'background' => $layout['background'] ?? null,
|
||||
'background_gradient' => $layout['background_gradient'] ?? null,
|
||||
@@ -23,8 +43,8 @@ class InviteLayoutSeeder extends Seeder
|
||||
'secondary' => $layout['secondary'] ?? null,
|
||||
'text' => $layout['text'] ?? null,
|
||||
'badge' => $layout['badge'] ?? null,
|
||||
'qr' => $layout['qr'] ?? ['size_px' => 500],
|
||||
'svg' => $layout['svg'] ?? ['width' => 1240, 'height' => 1754],
|
||||
'qr' => ['size_px' => $qrSize],
|
||||
'svg' => ['width' => $svgWidth, 'height' => $svgHeight],
|
||||
];
|
||||
|
||||
$options = [
|
||||
|
||||
Reference in New Issue
Block a user