<?php
$content = file_get_contents('/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/resources/views/filament/widgets/dashboard/tenant-dashboard-overview.blade.php');

$search = <<<SEARCH
                            <div class="min-w-0">
                                <div class="text-sm font-medium text-gray-900 dark:text-white">{{ \$card['title'] }}</div>
                                <div class="mt-1 text-xs text-gray-500 dark:text-gray-400">{{ \$card['subtitle'] }}</div>
                            </div>
                            <x-filament::badge :color="\$card['tone']">{{ \$card['status'] }}</x-filament::badge>
                        </div>
                        @if (filled(\$card['summary'] ?? null))
                            <p class="mt-3 text-sm text-gray-600 dark:text-gray-400">{{ \$card['summary'] }}</p>
                        @endif
                        @if (filled(\$card['actionUrl'] ?? null))
                            <div class="mt-4">
                                <x-filament::link :href="\$card['actionUrl']" size="sm" class="font-medium">
                                    {{ \$card['actionLabel'] ?? 'View' }}
                                </x-filament::link>
                            </div>
                        @endif
SEARCH;

$replace = <<<REPLACE
                            <div class="min-w-0">
                                <div class="text-sm font-medium text-gray-500 dark:text-gray-400">{{ \$card['title'] }}</div>
                                <div class="mt-1 text-base font-semibold text-gray-950 dark:text-white">{{ \$card['status'] }}</div>
                            </div>
                            <x-filament::badge :color="\$card['tone']">{{ \$card['status'] }}</x-filament::badge>
                        </div>
                        <p class="mt-3 text-sm leading-6 text-gray-600 dark:text-gray-400">{{ \$card['body'] }}</p>

                        @if (filled(\$card['actionLabel'] ?? null))
                            <div class="mt-4">
                                @if (filled(\$card['actionUrl'] ?? null))
                                    <x-filament::button tag="a" :href="\$card['actionUrl']" size="sm" color="gray" outlined>
                                        {{ \$card['actionLabel'] }}
                                    </x-filament::button>
                                @else
                                    <x-filament::button size="sm" color="gray" disabled>
                                        {{ \$card['actionLabel'] }}
                                    </x-filament::button>
                                @endif
                            </div>
                        @endif
REPLACE;

$newContent = str_replace($search, $replace, $content);
file_put_contents('/Users/ahmeddarrazi/Documents/projects/wt-plattform/apps/platform/resources/views/filament/widgets/dashboard/tenant-dashboard-overview.blade.php', $newContent);
echo "Replaced readiness card\n";
