3911012c65
Broad sweep across the whole codebase:
- Blade views (39 files, 315 wraps): tag-text and title/placeholder/alt
attributes wrapped with {{ __() }}. Excludes scripts, styles, @php,
@verbatim, {{ }}, {!! !!}, comments to avoid touching interpolations.
- PHP (54 files, 179 wraps): array 'key' => 'RO value' patterns and
list items with diacritics wrapped with __(). Reverted __() inside
const arrays (PHP disallows non-constant expressions).
- Added 269 new keys to lang/{ru,en}.json (identity fallback for
unknowns → 161 human RU + 163 EN translations added for the most
common enums, stages, roles, statuses, payment methods, vehicle
categories, warehouse, portal, form actions.
Missing translations fall back to RO so the UI never breaks. All 306
tests pass; view cache compiles cleanly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
131 lines
4.7 KiB
PHP
131 lines
4.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tenant\Pages;
|
|
|
|
use App\Tenancy\TenantManager;
|
|
use Filament\Notifications\Notification;
|
|
use Filament\Pages\Page;
|
|
|
|
class Integrations extends Page
|
|
{
|
|
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-puzzle-piece';
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return __('nav.label.Integrări');
|
|
}
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return __('nav.group.Marketing');
|
|
}
|
|
|
|
protected static ?int $navigationSort = 63;
|
|
|
|
protected static ?string $title = null;
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return __('Integrări externe');
|
|
}
|
|
|
|
protected string $view = 'filament.tenant.pages.integrations';
|
|
|
|
public array $config = [];
|
|
|
|
public function mount(): void
|
|
{
|
|
$tenant = app(TenantManager::class)->current();
|
|
$this->config = (array) ($tenant?->settings['integrations'] ?? []);
|
|
}
|
|
|
|
public function setStatus(string $key, bool $enabled): void
|
|
{
|
|
$this->config[$key]['enabled'] = $enabled;
|
|
$this->save();
|
|
}
|
|
|
|
public function updateField(string $key, string $field, ?string $value): void
|
|
{
|
|
$this->config[$key][$field] = $value;
|
|
}
|
|
|
|
public function save(): void
|
|
{
|
|
$tenant = app(TenantManager::class)->current();
|
|
if (! $tenant) return;
|
|
$tenant->update([
|
|
'settings' => array_merge((array) $tenant->settings, [
|
|
'integrations' => $this->config,
|
|
]),
|
|
]);
|
|
Notification::make()->title(__('Integrări salvate'))->success()->send();
|
|
}
|
|
|
|
public function integrations(): array
|
|
{
|
|
return [
|
|
'telegram_bot' => [
|
|
'name' => 'Telegram Bot',
|
|
'icon' => '✈️',
|
|
'color' => '#229ED9',
|
|
'description' => __('Primește cereri din canalul Telegram + trimite confirmări automate.'),
|
|
'fields' => [
|
|
'bot_token' => ['label' => 'Bot Token', 'type' => 'password', 'placeholder' => 'din @BotFather'],
|
|
'chat_id' => ['label' => 'Channel/Chat ID', 'type' => 'text', 'placeholder' => '@psauto_md'],
|
|
],
|
|
],
|
|
'whatsapp_business' => [
|
|
'name' => 'WhatsApp Business',
|
|
'icon' => '💬',
|
|
'color' => '#25D366',
|
|
'description' => __('Trimite mesaje template către clienți (programări, confirmări).'),
|
|
'fields' => [
|
|
'phone_id' => ['label' => 'Phone Number ID', 'type' => 'text'],
|
|
'token' => ['label' => 'Permanent Access Token', 'type' => 'password'],
|
|
],
|
|
],
|
|
'google_ads' => [
|
|
'name' => 'Google Ads',
|
|
'icon' => '🔍',
|
|
'color' => '#EA4335',
|
|
'description' => 'Tracking conversii — leadurile generate de campanii Google.',
|
|
'fields' => [
|
|
'customer_id' => ['label' => 'Customer ID', 'type' => 'text', 'placeholder' => '123-456-7890'],
|
|
'conversion_id' => ['label' => 'Conversion ID', 'type' => 'text'],
|
|
],
|
|
],
|
|
'facebook' => [
|
|
'name' => 'Facebook / Instagram Lead Ads',
|
|
'icon' => '📘',
|
|
'color' => '#1877F2',
|
|
'description' => __('Importă lead-uri direct din Lead Ads forms.'),
|
|
'fields' => [
|
|
'page_id' => ['label' => 'Page ID', 'type' => 'text'],
|
|
'access_token' => ['label' => 'Access Token', 'type' => 'password'],
|
|
],
|
|
],
|
|
'sms_gateway' => [
|
|
'name' => 'SMS Gateway',
|
|
'icon' => '📱',
|
|
'color' => '#6366F1',
|
|
'description' => __('Trimite SMS-uri prin gateway local (Moldcell/Orange API).'),
|
|
'fields' => [
|
|
'provider' => ['label' => 'Provider', 'type' => 'text', 'placeholder' => 'moldcell / orange / twilio'],
|
|
'api_key' => ['label' => 'API Key', 'type' => 'password'],
|
|
'sender_id' => ['label' => 'Sender ID', 'type' => 'text'],
|
|
],
|
|
],
|
|
'webhook_in' => [
|
|
'name' => __('Webhook intrări (formulare site)'),
|
|
'icon' => '🪝',
|
|
'color' => '#8B5CF6',
|
|
'description' => __('URL secret pentru POST direct cu lead-uri din site-ul tău.'),
|
|
'fields' => [
|
|
'secret' => ['label' => 'Secret token', 'type' => 'text', 'placeholder' => 'random string'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
}
|