feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods - Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args - Wrap Section::make()/Fieldset::make()/Notification::make()->title() args - Fix RelationManagers::getTitle() signature to match parent (Model, string) - Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static) - Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest - Remove duplicate getters in 5 resources that had manual getModelLabel already All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,12 @@ class AiAssistant extends Page
|
||||
|
||||
protected static ?int $navigationSort = 71;
|
||||
|
||||
protected static ?string $title = 'Asistent AI';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Asistent AI');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.ai-assistant';
|
||||
|
||||
|
||||
@@ -23,7 +23,12 @@ class ApiTokens extends Page
|
||||
|
||||
protected static ?int $navigationSort = 95;
|
||||
|
||||
protected static ?string $title = 'API Tokens';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('API Tokens');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.api-tokens';
|
||||
|
||||
@@ -46,13 +51,13 @@ class ApiTokens extends Page
|
||||
{
|
||||
return [
|
||||
Actions\Action::make('create')
|
||||
->label('Generează token')
|
||||
->label(__('Generează token'))
|
||||
->icon('heroicon-m-plus')
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Nume (descriere)')
|
||||
->label(__('Nume (descriere)'))
|
||||
->required()
|
||||
->placeholder('ex: app-mobil, integrare-erp'),
|
||||
->placeholder(__('ex: app-mobil, integrare-erp')),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$u = auth()->user();
|
||||
@@ -60,8 +65,8 @@ class ApiTokens extends Page
|
||||
$token = $u->createToken($data['name']);
|
||||
$this->newToken = $token->plainTextToken;
|
||||
Notification::make()
|
||||
->title('Token generat!')
|
||||
->body('Copiază token-ul ACUM — nu va mai fi afișat.')
|
||||
->title(__('Token generat!'))
|
||||
->body(__('Copiază token-ul ACUM — nu va mai fi afișat.'))
|
||||
->success()
|
||||
->persistent()
|
||||
->send();
|
||||
|
||||
@@ -24,7 +24,12 @@ class Backup extends Page
|
||||
|
||||
protected static ?int $navigationSort = 96;
|
||||
|
||||
protected static ?string $title = 'Backup & Export date';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Backup & Export date');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.backup';
|
||||
|
||||
|
||||
@@ -27,7 +27,12 @@ class CalendarBoard extends Page
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
protected static ?string $title = 'Calendar vizual';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Calendar vizual');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.calendar';
|
||||
|
||||
@@ -290,7 +295,7 @@ class CalendarBoard extends Page
|
||||
}
|
||||
$a->date = $toDate;
|
||||
$a->save();
|
||||
Notification::make()->title('Programare mutată')->body($a->title . ' → ' . $toDate)->success()->send();
|
||||
Notification::make()->title(__('Programare mutată'))->body($a->title . ' → ' . $toDate)->success()->send();
|
||||
}
|
||||
|
||||
public function openEvent(int $id): void
|
||||
@@ -330,7 +335,7 @@ class CalendarBoard extends Page
|
||||
{
|
||||
Appointment::where('id', $id)->delete();
|
||||
$this->openEventId = null;
|
||||
Notification::make()->title('Programare ștearsă')->success()->send();
|
||||
Notification::make()->title(__('Programare ștearsă'))->success()->send();
|
||||
}
|
||||
|
||||
public function openNewForm(int $rowId = 0, string $date = ''): void
|
||||
@@ -372,7 +377,7 @@ class CalendarBoard extends Page
|
||||
{
|
||||
$name = trim($this->newPost['name'] ?? '');
|
||||
if ($name === '') {
|
||||
Notification::make()->title('Numele este obligatoriu')->danger()->send();
|
||||
Notification::make()->title(__('Numele este obligatoriu'))->danger()->send();
|
||||
return;
|
||||
}
|
||||
Post::create([
|
||||
@@ -384,7 +389,7 @@ class CalendarBoard extends Page
|
||||
'sort_order' => 100,
|
||||
]);
|
||||
$this->showNewPostForm = false;
|
||||
Notification::make()->title('Spațiu de lucru adăugat')->success()->send();
|
||||
Notification::make()->title(__('Spațiu de lucru adăugat'))->success()->send();
|
||||
}
|
||||
|
||||
/** Inline rename + reassign default master from row label click. */
|
||||
@@ -409,7 +414,7 @@ class CalendarBoard extends Page
|
||||
'default_master_id' => $this->renamingPostMasterId ?: null,
|
||||
]);
|
||||
$this->renamingPostId = null;
|
||||
Notification::make()->title('Post actualizat')->success()->send();
|
||||
Notification::make()->title(__('Post actualizat'))->success()->send();
|
||||
}
|
||||
|
||||
/** Generate PDF for all appointments in the visible period. */
|
||||
@@ -467,7 +472,7 @@ class CalendarBoard extends Page
|
||||
{
|
||||
$d = $this->newAppt;
|
||||
if (empty($d['title']) || empty($d['date'])) {
|
||||
Notification::make()->title('Subiect și data sunt obligatorii')->danger()->send();
|
||||
Notification::make()->title(__('Subiect și data sunt obligatorii'))->danger()->send();
|
||||
return;
|
||||
}
|
||||
Appointment::create([
|
||||
@@ -483,7 +488,7 @@ class CalendarBoard extends Page
|
||||
'status' => 'scheduled',
|
||||
]);
|
||||
$this->showNewForm = false;
|
||||
Notification::make()->title('Programare adăugată')->success()->send();
|
||||
Notification::make()->title(__('Programare adăugată'))->success()->send();
|
||||
}
|
||||
|
||||
public function getMasterOptions(): array
|
||||
|
||||
@@ -27,7 +27,12 @@ class ExcelImportWizard extends Page
|
||||
|
||||
protected static ?int $navigationSort = 65;
|
||||
|
||||
protected static ?string $title = 'Import factură Excel/CSV';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Import factură Excel/CSV');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.excel-import-wizard';
|
||||
|
||||
@@ -62,11 +67,11 @@ class ExcelImportWizard extends Page
|
||||
public function goToStep2(): void
|
||||
{
|
||||
if (! $this->supplierId) {
|
||||
Notification::make()->title('Selectează furnizorul')->danger()->send();
|
||||
Notification::make()->title(__('Selectează furnizorul'))->danger()->send();
|
||||
return;
|
||||
}
|
||||
if (! $this->upload) {
|
||||
Notification::make()->title('Încarcă fișierul Excel sau CSV')->danger()->send();
|
||||
Notification::make()->title(__('Încarcă fișierul Excel sau CSV'))->danger()->send();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,7 +101,7 @@ class ExcelImportWizard extends Page
|
||||
$this->previewSummary = $result['summary'];
|
||||
|
||||
if (empty($this->previewRows)) {
|
||||
Notification::make()->title('Nu am găsit linii valide — verifică maparea coloanelor')->warning()->send();
|
||||
Notification::make()->title(__('Nu am găsit linii valide — verifică maparea coloanelor'))->warning()->send();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,12 @@ class Finance extends Page
|
||||
|
||||
protected static ?int $navigationSort = 49;
|
||||
|
||||
protected static ?string $title = 'Finanțe';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Finanțe');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.finance';
|
||||
|
||||
|
||||
@@ -22,7 +22,12 @@ class Integrations extends Page
|
||||
|
||||
protected static ?int $navigationSort = 63;
|
||||
|
||||
protected static ?string $title = 'Integrări externe';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Integrări externe');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.integrations';
|
||||
|
||||
@@ -54,7 +59,7 @@ class Integrations extends Page
|
||||
'integrations' => $this->config,
|
||||
]),
|
||||
]);
|
||||
Notification::make()->title('Integrări salvate')->success()->send();
|
||||
Notification::make()->title(__('Integrări salvate'))->success()->send();
|
||||
}
|
||||
|
||||
public function integrations(): array
|
||||
|
||||
@@ -28,7 +28,12 @@ class MechanicBoard extends Page
|
||||
|
||||
protected static ?int $navigationSort = 25;
|
||||
|
||||
protected static ?string $title = 'Atelierul meu';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Atelierul meu');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.mechanic-board';
|
||||
|
||||
@@ -46,25 +51,25 @@ class MechanicBoard extends Page
|
||||
return [
|
||||
[
|
||||
'key' => 'in_work',
|
||||
'label' => 'În lucru',
|
||||
'label' => __('În lucru'),
|
||||
'color' => '#f59e0b',
|
||||
'items' => $all->where('status', 'in_work')->values(),
|
||||
],
|
||||
[
|
||||
'key' => 'awaiting_parts',
|
||||
'label' => 'Așteaptă piese',
|
||||
'label' => __('Așteaptă piese'),
|
||||
'color' => '#8b5cf6',
|
||||
'items' => $all->whereIn('status', ['awaiting_parts'])->values(),
|
||||
],
|
||||
[
|
||||
'key' => 'ready',
|
||||
'label' => 'Gata',
|
||||
'label' => __('Gata'),
|
||||
'color' => '#10b981',
|
||||
'items' => $all->where('status', 'ready')->values(),
|
||||
],
|
||||
[
|
||||
'key' => 'recent',
|
||||
'label' => 'Recente / restul',
|
||||
'label' => __('Recente / restul'),
|
||||
'color' => '#64748b',
|
||||
'items' => $all->whereIn('status', ['done', 'approved', 'diagnosis'])
|
||||
->take(20)
|
||||
@@ -119,7 +124,7 @@ class MechanicBoard extends Page
|
||||
return;
|
||||
}
|
||||
$work->block($this->blockReason, trim($this->blockNote) ?: null);
|
||||
Notification::make()->title('Lucrare blocată')->body($work->name . ' · ' . WorkOrderWork::BLOCK_REASONS[$this->blockReason])->warning()->send();
|
||||
Notification::make()->title(__('Lucrare blocată'))->body($work->name . ' · ' . WorkOrderWork::BLOCK_REASONS[$this->blockReason])->warning()->send();
|
||||
$this->blockingWorkId = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,12 @@ class MechanicKpi extends Page
|
||||
|
||||
protected static ?int $navigationSort = 28;
|
||||
|
||||
protected static ?string $title = 'KPI mecanici';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('KPI mecanici');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.mechanic-kpi';
|
||||
|
||||
|
||||
@@ -19,7 +19,12 @@ class Onboarding extends Page
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
protected static ?string $title = 'Bun venit în AutoCRM!';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Bun venit în AutoCRM!');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.onboarding';
|
||||
|
||||
@@ -54,18 +59,18 @@ class Onboarding extends Page
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Schemas\Components\Section::make('Pas 1 — Datele afacerii')
|
||||
Schemas\Components\Section::make(__('Pas 1 — Datele afacerii'))
|
||||
->visible(fn () => $this->step === 1)
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('display_name')
|
||||
->label('Denumire afișată')->required()->maxLength(120),
|
||||
->label(__('Denumire afișată'))->required()->maxLength(120),
|
||||
Forms\Components\TextInput::make('city')
|
||||
->label('Oraș')->maxLength(60),
|
||||
->label(__('Oraș'))->maxLength(60),
|
||||
Forms\Components\TextInput::make('phone')
|
||||
->label('Telefon principal')->tel()->maxLength(40),
|
||||
->label(__('Telefon principal'))->tel()->maxLength(40),
|
||||
Forms\Components\Select::make('currency')
|
||||
->label('Monedă')
|
||||
->label(__('Monedă'))
|
||||
->options([
|
||||
'MDL' => 'MDL — Leu moldovenesc',
|
||||
'EUR' => 'EUR — Euro',
|
||||
@@ -78,28 +83,28 @@ class Onboarding extends Page
|
||||
->required()
|
||||
->searchable(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Pas 2 — Brand & limbă')
|
||||
Schemas\Components\Section::make(__('Pas 2 — Brand & limbă'))
|
||||
->visible(fn () => $this->step === 2)
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('language')
|
||||
->label('Limbă')
|
||||
->label(__('Limbă'))
|
||||
->options(['ro' => 'Română', 'ru' => 'Русский', 'en' => 'English'])
|
||||
->required(),
|
||||
Forms\Components\ColorPicker::make('theme_color')
|
||||
->label('Culoare brand'),
|
||||
->label(__('Culoare brand')),
|
||||
Forms\Components\FileUpload::make('logo')
|
||||
->label('Logo (opțional)')
|
||||
->label(__('Logo (opțional)'))
|
||||
->image()->imageEditor()->disk('public')
|
||||
->directory('tmp-uploads')->visibility('public')
|
||||
->maxSize(2048),
|
||||
]),
|
||||
Schemas\Components\Section::make('Pas 3 — Tarif & terminat')
|
||||
Schemas\Components\Section::make(__('Pas 3 — Tarif & terminat'))
|
||||
->visible(fn () => $this->step === 3)
|
||||
->columns(1)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('labor_rate')
|
||||
->label('Tarif normo-oră (poți schimba oricând)')
|
||||
->label(__('Tarif normo-oră (poți schimba oricând)'))
|
||||
->numeric()->required(),
|
||||
]),
|
||||
])
|
||||
@@ -147,8 +152,8 @@ class Onboarding extends Page
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('🎉 Bun venit în AutoCRM!')
|
||||
->body('Setările au fost salvate. Hai să adăugăm primul client.')
|
||||
->title(__('🎉 Bun venit în AutoCRM!'))
|
||||
->body(__('Setările au fost salvate. Hai să adăugăm primul client.'))
|
||||
->success()
|
||||
->send();
|
||||
|
||||
|
||||
@@ -27,7 +27,12 @@ class PipelineBoard extends Page
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
protected static ?string $title = 'Pipeline';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Pipeline');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.pipeline-board';
|
||||
|
||||
|
||||
@@ -23,7 +23,12 @@ class Recommendations extends Page
|
||||
|
||||
protected static ?int $navigationSort = 72;
|
||||
|
||||
protected static ?string $title = 'Recomandări — clienți de urmărit';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Recomandări — clienți de urmărit');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.recommendations';
|
||||
|
||||
|
||||
@@ -30,7 +30,12 @@ class Reports extends Page
|
||||
|
||||
protected static ?int $navigationSort = 70;
|
||||
|
||||
protected static ?string $title = 'Rapoarte';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Rapoarte');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.reports';
|
||||
|
||||
|
||||
@@ -33,7 +33,12 @@ class Scanner extends Page
|
||||
|
||||
protected static ?int $navigationSort = 39;
|
||||
|
||||
protected static ?string $title = 'Scaner cod QR / Bare';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Scaner cod QR / Bare');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.scanner';
|
||||
|
||||
|
||||
@@ -27,7 +27,12 @@ class Settings extends Page
|
||||
|
||||
protected static ?int $navigationSort = 90;
|
||||
|
||||
protected static ?string $title = 'Setări companie';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Setări companie');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.settings';
|
||||
|
||||
@@ -81,23 +86,23 @@ class Settings extends Page
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Schemas\Components\Section::make('Brand & contact')
|
||||
Schemas\Components\Section::make(__('Brand & contact'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('display_name')->label('Denumire afișată')->maxLength(120),
|
||||
Forms\Components\TextInput::make('city')->label('Oraș')->maxLength(60),
|
||||
Forms\Components\TextInput::make('phone')->label('Telefon')->tel()->maxLength(40),
|
||||
Forms\Components\TextInput::make('display_name')->label(__('Denumire afișată'))->maxLength(120),
|
||||
Forms\Components\TextInput::make('city')->label(__('Oraș'))->maxLength(60),
|
||||
Forms\Components\TextInput::make('phone')->label(__('Telefon'))->tel()->maxLength(40),
|
||||
Forms\Components\TextInput::make('email')->email()->maxLength(120),
|
||||
]),
|
||||
Schemas\Components\Section::make('Localizare & monedă')
|
||||
Schemas\Components\Section::make(__('Localizare & monedă'))
|
||||
->columns(3)
|
||||
->schema([
|
||||
Forms\Components\Select::make('language')
|
||||
->label('Limbă default')
|
||||
->label(__('Limbă default'))
|
||||
->options(['ro' => 'Română', 'ru' => 'Русский', 'en' => 'English'])
|
||||
->required(),
|
||||
Forms\Components\Select::make('currency')
|
||||
->label('Monedă')
|
||||
->label(__('Monedă'))
|
||||
->options([
|
||||
'MDL' => 'MDL — Leu moldovenesc',
|
||||
'EUR' => 'EUR — Euro',
|
||||
@@ -108,133 +113,133 @@ class Settings extends Page
|
||||
])
|
||||
->required()
|
||||
->searchable(),
|
||||
Forms\Components\ColorPicker::make('theme_color')->label('Culoare brand'),
|
||||
Forms\Components\ColorPicker::make('theme_color')->label(__('Culoare brand')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Servicii & tarif')
|
||||
Schemas\Components\Section::make(__('Servicii & tarif'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('labor_rate')->label('Tarif normo-oră')->numeric()->required(),
|
||||
Forms\Components\TextInput::make('labor_rate')->label(__('Tarif normo-oră'))->numeric()->required(),
|
||||
]),
|
||||
Schemas\Components\Section::make('Marjă internă (nu TVA)')
|
||||
->description('Procent implicit aplicat la manopere. Se scade din prețul de manoperă pentru a determina baza salariului mecanicului. Vizibilă doar rolurilor cu drept „finance.view_internal_margin".')
|
||||
Schemas\Components\Section::make(__('Marjă internă (nu TVA)'))
|
||||
->description(__('Procent implicit aplicat la manopere. Se scade din prețul de manoperă pentru a determina baza salariului mecanicului. Vizibilă doar rolurilor cu drept „finance.view_internal_margin".'))
|
||||
->columns(2)
|
||||
->visible(fn () => auth()->user()?->canDo(\App\Auth\Permissions::FINANCE_VIEW_INTERNAL_MARGIN) ?? false)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('default_internal_margin_pct')
|
||||
->label('% marjă implicit')
|
||||
->label(__('% marjă implicit'))
|
||||
->numeric()
|
||||
->step(0.01)
|
||||
->minValue(0)
|
||||
->maxValue(90)
|
||||
->suffix('%')
|
||||
->placeholder('Ex: 20')
|
||||
->helperText('Fallback când mecanicul nu are marja proprie setată. Lasă gol = 0%.'),
|
||||
->placeholder(__('Ex: 20'))
|
||||
->helperText(__('Fallback când mecanicul nu are marja proprie setată. Lasă gol = 0%.')),
|
||||
Forms\Components\Toggle::make('show_internal_margin_details')
|
||||
->label('Afișează detalii marjă la procesele calculate')
|
||||
->helperText('On = arată „Bază salariu: X · marjă Y%" sub Total în tabelul Manopere. Off = doar Total (util când review-uiești o Fișă cu clientul de față).')
|
||||
->label(__('Afișează detalii marjă la procesele calculate'))
|
||||
->helperText(__('On = arată „Bază salariu: X · marjă Y%" sub Total în tabelul Manopere. Off = doar Total (util când review-uiești o Fișă cu clientul de față).'))
|
||||
->default(true),
|
||||
]),
|
||||
Schemas\Components\Section::make('Liste configurabile')
|
||||
Schemas\Components\Section::make(__('Liste configurabile'))
|
||||
->columns(1)
|
||||
->schema([
|
||||
Forms\Components\Textarea::make('services')
|
||||
->label('Servicii oferite (separate prin virgulă)')
|
||||
->label(__('Servicii oferite (separate prin virgulă)'))
|
||||
->rows(2),
|
||||
Forms\Components\Textarea::make('cars')
|
||||
->label('Mărci auto suportate (separate prin virgulă)')
|
||||
->label(__('Mărci auto suportate (separate prin virgulă)'))
|
||||
->rows(2),
|
||||
]),
|
||||
Schemas\Components\Section::make('Logo & favicon')
|
||||
Schemas\Components\Section::make(__('Logo & favicon'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\FileUpload::make('logo')
|
||||
->label('Logo')
|
||||
->label(__('Logo'))
|
||||
->image()
|
||||
->imageEditor()
|
||||
->disk('public')
|
||||
->directory('tmp-uploads')
|
||||
->visibility('public')
|
||||
->maxSize(2048)
|
||||
->helperText('PNG/SVG, max 2 MB. Apare în sidebar.'),
|
||||
->helperText(__('PNG/SVG, max 2 MB. Apare în sidebar.')),
|
||||
Forms\Components\FileUpload::make('favicon')
|
||||
->label('Favicon')
|
||||
->label(__('Favicon'))
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('tmp-uploads')
|
||||
->visibility('public')
|
||||
->maxSize(512)
|
||||
->helperText('PNG/ICO, max 512 KB.'),
|
||||
->helperText(__('PNG/ICO, max 512 KB.')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Notificări')
|
||||
->description('Activează / dezactivează notificările auto către clienți. Telegram are prioritate dacă clientul are cont legat.')
|
||||
Schemas\Components\Section::make(__('Notificări'))
|
||||
->description(__('Activează / dezactivează notificările auto către clienți. Telegram are prioritate dacă clientul are cont legat.'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('notify_wo_ready')->label('Mașina e gata de ridicat')->default(true),
|
||||
Forms\Components\Toggle::make('notify_payment')->label('Confirmare plată primită')->default(true),
|
||||
Forms\Components\Toggle::make('notify_appointment')->label('Programare confirmată')->default(true),
|
||||
Forms\Components\Toggle::make('notify_reminder')->label('Reminder ITP / revizie')->default(true),
|
||||
Forms\Components\Toggle::make('notify_wo_ready')->label(__('Mașina e gata de ridicat'))->default(true),
|
||||
Forms\Components\Toggle::make('notify_payment')->label(__('Confirmare plată primită'))->default(true),
|
||||
Forms\Components\Toggle::make('notify_appointment')->label(__('Programare confirmată'))->default(true),
|
||||
Forms\Components\Toggle::make('notify_reminder')->label(__('Reminder ITP / revizie'))->default(true),
|
||||
]),
|
||||
Schemas\Components\Section::make('Telegram bot')
|
||||
->description('Creează un bot la @BotFather, lipește token-ul aici și apasă „Setează webhook". Clienții îți scriu la bot, partajează telefonul, iar codul se leagă automat de fișa lor.')
|
||||
Schemas\Components\Section::make(__('Telegram bot'))
|
||||
->description(__('Creează un bot la @BotFather, lipește token-ul aici și apasă „Setează webhook". Clienții îți scriu la bot, partajează telefonul, iar codul se leagă automat de fișa lor.'))
|
||||
->columns(1)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('telegram_bot_token')
|
||||
->label('Bot token')
|
||||
->label(__('Bot token'))
|
||||
->password()
|
||||
->revealable()
|
||||
->placeholder('123456:ABC-XYZ...')
|
||||
->placeholder(__('123456:ABC-XYZ...'))
|
||||
->helperText(fn () => 'Webhook URL: ' .
|
||||
app(\App\Services\Notifications\TelegramService::class)
|
||||
->webhookUrlFor(app(\App\Tenancy\TenantManager::class)->current())),
|
||||
]),
|
||||
Schemas\Components\Section::make('Reminder service auto')
|
||||
Schemas\Components\Section::make(__('Reminder service auto'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('reminder_after_days')
|
||||
->label('Trimite reminder după X zile fără vizită')
|
||||
->label(__('Trimite reminder după X zile fără vizită'))
|
||||
->numeric()
|
||||
->minValue(30)
|
||||
->default(365),
|
||||
Forms\Components\TextInput::make('reminder_cooldown_days')
|
||||
->label('Nu re-trimite mai des de X zile')
|
||||
->label(__('Nu re-trimite mai des de X zile'))
|
||||
->numeric()
|
||||
->minValue(7)
|
||||
->default(30),
|
||||
]),
|
||||
Schemas\Components\Section::make('Magazin online')
|
||||
->description('Activează magazinul public la <slug>.service.mir.md/shop. Piesele apar doar dacă sunt marcate „Publicat".')
|
||||
Schemas\Components\Section::make(__('Magazin online'))
|
||||
->description(__('Activează magazinul public la <slug>.service.mir.md/shop. Piesele apar doar dacă sunt marcate „Publicat".'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Toggle::make('shop_enabled')->label('Magazin activ')->columnSpanFull(),
|
||||
Forms\Components\Toggle::make('shop_enabled')->label(__('Magazin activ'))->columnSpanFull(),
|
||||
Forms\Components\CheckboxList::make('shop_delivery_methods')
|
||||
->label('Metode de livrare')
|
||||
->label(__('Metode de livrare'))
|
||||
->options(\App\Models\Tenant\OnlineOrder::DELIVERY)
|
||||
->default(['pickup'])
|
||||
->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('shop_delivery_fee')->label('Taxă livrare')->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('shop_free_delivery_over')->label('Livrare gratuită peste')->numeric()->default(0)->helperText('0 = dezactivat'),
|
||||
Forms\Components\TextInput::make('shop_delivery_fee')->label(__('Taxă livrare'))->numeric()->default(0),
|
||||
Forms\Components\TextInput::make('shop_free_delivery_over')->label(__('Livrare gratuită peste'))->numeric()->default(0)->helperText(__('0 = dezactivat')),
|
||||
]),
|
||||
Schemas\Components\Section::make('Asistent AI')
|
||||
->description('Adaugă chei API ca să activezi asistentul. Cheile rămân la voi — nu sunt partajate.')
|
||||
Schemas\Components\Section::make(__('Asistent AI'))
|
||||
->description(__('Adaugă chei API ca să activezi asistentul. Cheile rămân la voi — nu sunt partajate.'))
|
||||
->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Select::make('ai_default_provider')
|
||||
->label('Provider implicit')
|
||||
->label(__('Provider implicit'))
|
||||
->options(['claude' => 'Claude (Anthropic)', 'gpt' => 'ChatGPT (OpenAI)', 'gemini' => 'Gemini (Google)'])
|
||||
->default('claude'),
|
||||
Forms\Components\TextInput::make('ai_claude_key')->label('Claude API Key')->password()->revealable()->placeholder('sk-ant-...'),
|
||||
Forms\Components\TextInput::make('ai_claude_key')->label(__('Claude API Key'))->password()->revealable()->placeholder('sk-ant-...'),
|
||||
Forms\Components\Select::make('ai_model_claude')
|
||||
->label('Model Claude')
|
||||
->label(__('Model Claude'))
|
||||
->options(\App\Services\Ai\AiAssistantService::MODEL_OPTIONS['claude'])
|
||||
->default(\App\Services\Ai\AiAssistantService::MODEL_DEFAULTS['claude']),
|
||||
Forms\Components\TextInput::make('ai_gpt_key')->label('OpenAI API Key')->password()->revealable()->placeholder('sk-proj-...'),
|
||||
Forms\Components\TextInput::make('ai_gpt_key')->label(__('OpenAI API Key'))->password()->revealable()->placeholder('sk-proj-...'),
|
||||
Forms\Components\Select::make('ai_model_gpt')
|
||||
->label('Model OpenAI')
|
||||
->label(__('Model OpenAI'))
|
||||
->options(\App\Services\Ai\AiAssistantService::MODEL_OPTIONS['gpt'])
|
||||
->default(\App\Services\Ai\AiAssistantService::MODEL_DEFAULTS['gpt']),
|
||||
Forms\Components\TextInput::make('ai_gemini_key')->label('Gemini API Key')->password()->revealable(),
|
||||
Forms\Components\TextInput::make('ai_gemini_key')->label(__('Gemini API Key'))->password()->revealable(),
|
||||
Forms\Components\Select::make('ai_model_gemini')
|
||||
->label('Model Gemini')
|
||||
->label(__('Model Gemini'))
|
||||
->options(\App\Services\Ai\AiAssistantService::MODEL_OPTIONS['gemini'])
|
||||
->default(\App\Services\Ai\AiAssistantService::MODEL_DEFAULTS['gemini']),
|
||||
]),
|
||||
@@ -247,7 +252,7 @@ class Settings extends Page
|
||||
$data = $this->form->getState();
|
||||
$company = app(TenantManager::class)->current();
|
||||
if (! $company) {
|
||||
Notification::make()->title('Tenant not resolved')->danger()->send();
|
||||
Notification::make()->title(__('Tenant not resolved'))->danger()->send();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -312,22 +317,22 @@ class Settings extends Page
|
||||
}
|
||||
}
|
||||
|
||||
Notification::make()->title('Setări salvate')->success()->send();
|
||||
Notification::make()->title(__('Setări salvate'))->success()->send();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\Action::make('push_test')
|
||||
->label('Test notificare push')
|
||||
->label(__('Test notificare push'))
|
||||
->icon('heroicon-m-bell-alert')
|
||||
->color('gray')
|
||||
->action(function () {
|
||||
$svc = app(\App\Services\Notifications\WebPushService::class);
|
||||
if (! $svc->configured()) {
|
||||
Notification::make()
|
||||
->title('Web Push neconfigurat')
|
||||
->body('Rulează `php artisan push:vapid` și adaugă cheile în .env.')
|
||||
->title(__('Web Push neconfigurat'))
|
||||
->body(__('Rulează `php artisan push:vapid` și adaugă cheile în .env.'))
|
||||
->warning()->send();
|
||||
return;
|
||||
}
|
||||
@@ -344,7 +349,7 @@ class Settings extends Page
|
||||
->send();
|
||||
}),
|
||||
Actions\Action::make('telegram_test')
|
||||
->label('Testează bot Telegram')
|
||||
->label(__('Testează bot Telegram'))
|
||||
->icon('heroicon-m-bolt')
|
||||
->color('gray')
|
||||
->action(function () {
|
||||
@@ -353,7 +358,7 @@ class Settings extends Page
|
||||
$r = app(TelegramService::class)->getMe($company);
|
||||
if (! ($r['ok'] ?? false)) {
|
||||
Notification::make()
|
||||
->title('Bot Telegram nu răspunde')
|
||||
->title(__('Bot Telegram nu răspunde'))
|
||||
->body($r['error'] ?? 'Verifică token-ul.')
|
||||
->danger()->send();
|
||||
return;
|
||||
@@ -364,24 +369,24 @@ class Settings extends Page
|
||||
->success()->send();
|
||||
}),
|
||||
Actions\Action::make('telegram_webhook')
|
||||
->label('Setează webhook')
|
||||
->label(__('Setează webhook'))
|
||||
->icon('heroicon-m-link')
|
||||
->color('primary')
|
||||
->requiresConfirmation()
|
||||
->modalDescription('Telegram va trimite mesajele primite la URL-ul webhook de mai jos.')
|
||||
->modalDescription(__('Telegram va trimite mesajele primite la URL-ul webhook de mai jos.'))
|
||||
->action(function () {
|
||||
$company = app(TenantManager::class)->current();
|
||||
if (! $company) return;
|
||||
$r = app(TelegramService::class)->setWebhook($company);
|
||||
if (! ($r['ok'] ?? false)) {
|
||||
Notification::make()
|
||||
->title('Webhook eșuat')
|
||||
->title(__('Webhook eșuat'))
|
||||
->body($r['error'] ?? json_encode($r['response'] ?? []))
|
||||
->danger()->send();
|
||||
return;
|
||||
}
|
||||
Notification::make()
|
||||
->title('Webhook setat — botul e gata')
|
||||
->title(__('Webhook setat — botul e gata'))
|
||||
->success()->send();
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -23,7 +23,12 @@ class VinSearch extends Page
|
||||
|
||||
protected static ?int $navigationSort = 41;
|
||||
|
||||
protected static ?string $title = 'VIN căutare & piese';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('VIN căutare & piese');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.vin-search';
|
||||
|
||||
|
||||
@@ -23,7 +23,12 @@ class Workload extends Page
|
||||
|
||||
protected static ?int $navigationSort = 73;
|
||||
|
||||
protected static ?string $title = 'Încărcare service';
|
||||
protected static ?string $title = null;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return __('Încărcare service');
|
||||
}
|
||||
|
||||
protected string $view = 'filament.tenant.pages.workload';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user