Skip to content

Commit

Permalink
Translation files added
Browse files Browse the repository at this point in the history
  • Loading branch information
afsakar committed May 28, 2023
1 parent e450dee commit 04dbc28
Show file tree
Hide file tree
Showing 82 changed files with 1,665 additions and 282 deletions.
38 changes: 30 additions & 8 deletions app/Filament/Resources/AccountResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
namespace App\Filament\Resources;

use App\Filament\Resources\AccountResource\Pages;
use App\Filament\Resources\AccountResource\RelationManagers;
use App\Models\Account;
use App\Models\AccountType;
use Filament\Tables\Actions\Action;
use App\Models\Currency;
use Filament\Forms;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Filament\Resources\Form;
use Filament\Resources\Resource;
Expand All @@ -36,24 +34,27 @@ public static function form(Form $form): Form
'sm' => 2,
])->schema([
Forms\Components\Select::make('account_type_id')
->label('Account Type')
->label(__('accounts.account_type'))
->options(AccountType::all()->pluck('name', 'id'))
->searchable()
->required(),
Forms\Components\Select::make('currency_id')
->label('Currency')
->label(__('accounts.currency'))
->options(Currency::all()->pluck('name', 'id'))
->searchable()
->required(),
Forms\Components\TextInput::make('name')
->label(__('accounts.account_name'))
->unique(ignoreRecord: true)
->required()
->maxLength(255),
Forms\Components\TextInput::make('starting_balance')
->label(__('accounts.starting_balance'))
->required(),
]),
Grid::make(1)->schema([
Forms\Components\Textarea::make('description')
->label(__('accounts.description'))
->rows(2)
->maxLength(255),
])
Expand All @@ -65,17 +66,23 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('accounts.account_name'))
->searchable(),
Tables\Columns\TextColumn::make('accountType.name'),
Tables\Columns\TextColumn::make('currency.code'),
Tables\Columns\TextColumn::make('balance'),
Tables\Columns\TextColumn::make('accountType.name')
->label(__('accounts.account_type'))
->searchable(),
Tables\Columns\TextColumn::make('currency.code')
->label(__('accounts.currency'))
->searchable(),
Tables\Columns\TextColumn::make('balance')
->label(__('accounts.balance')),
])
->filters([
Tables\Filters\TrashedFilter::make(),
])
->actions([
Action::make('detail')
->label('Detail')
->label(__('accounts.detail'))
->color('blue')
->icon('heroicon-s-document')
->url(function ($record) {
Expand All @@ -99,6 +106,21 @@ public static function getPages(): array
];
}

public static function getModelLabel(): string
{
return __('accounts.account');
}

public static function getNavigationLabel(): string
{
return __('accounts.accounts');
}

public static function getPluralModelLabel(): string
{
return __('accounts.accounts');
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public function mount($record)
protected function getActions(): array
{
return [
Actions\Action::make('Go Back')
Actions\Action::make('back')
->label(__('general.go_back'))
->icon('heroicon-o-arrow-left')
->url(route('filament.resources.accounts.index'))
];
Expand Down
17 changes: 17 additions & 0 deletions app/Filament/Resources/AccountTypeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static function form(Form $form): Form
->schema([
Grid::make(1)->schema([
Forms\Components\TextInput::make('name')
->label(__('account_types.account_type_name'))
->unique(ignoreRecord: true)
->required()
->maxLength(255)
Expand All @@ -38,6 +39,7 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label(__('account_types.account_type_name'))
->searchable(),
])
->filters([
Expand All @@ -61,6 +63,21 @@ public static function getPages(): array
];
}

public static function getModelLabel(): string
{
return __('account_types.account_type');
}

public static function getNavigationLabel(): string
{
return __('account_types.account_types');
}

public static function getPluralModelLabel(): string
{
return __('account_types.account_types');
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
Expand Down
39 changes: 33 additions & 6 deletions app/Filament/Resources/AgreementResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static function form(Form $form): Form
Grid::make(1)->schema([
Card::make()->columns(1)->schema([
Forms\Components\RichEditor::make('content')
->label(__('agreements.agreement_content'))
->disableToolbarButtons([
'attachFiles',
'codeBlock',
Expand All @@ -38,26 +39,30 @@ public static function form(Form $form): Form
Card::make()->columns(1)->schema([
Grid::make(2)->schema([
Forms\Components\TextInput::make('name')
->label(__('agreements.agreement_name'))
->required()
->maxLength(255),
Forms\Components\DatePicker::make('date')->displayFormat('d/m/Y'),
Forms\Components\DatePicker::make('date')
->label(__('agreements.date'))
->displayFormat('d/m/Y'),
]),
Forms\Components\Select::make('company_id')
->label('Company')
->label(__('agreements.company_name'))
->reactive()
->options(\App\Models\Company::where('id', session()->get('company_id'))->pluck('name', 'id'))
->searchable()
->default(session()->get('company_id'))
->disabled(),
Forms\Components\Select::make('corporation_id')
->label('Corporation')
->label(__('agreements.corporation'))
->options(\App\Models\Corporation::all()->pluck('name', 'id'))
->searchable()
->required(),
]),
Card::make()->columns(1)->schema([
Grid::make(1)->schema([
SpatieMediaLibraryFileUpload::make('Files')
->label(__('agreements.files'))
->collection('agreement')
->rules([
'mimes:pdf,doc,docx,xls,xlsx,png,jpg,jpeg,svg',
Expand All @@ -73,11 +78,18 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('date')
->label(__('agreements.date'))
->sortable()
->dateTime('d/m/Y'),
Tables\Columns\TextColumn::make('company.name'),
Tables\Columns\TextColumn::make('corporation.name'),
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('company.name')
->label(__('agreements.company_name'))
->searchable(),
Tables\Columns\TextColumn::make('corporation.name')
->label(__('agreements.corporation'))
->searchable(),
Tables\Columns\TextColumn::make('name')
->label(__('agreements.agreement_name'))
->searchable(),
])
->filters([
Tables\Filters\TrashedFilter::make(),
Expand Down Expand Up @@ -106,6 +118,21 @@ public static function getPages(): array
];
}

public static function getModelLabel(): string
{
return __('agreements.agreement');
}

public static function getNavigationLabel(): string
{
return __('agreements.agreements');
}

public static function getPluralModelLabel(): string
{
return __('agreements.agreements');
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ protected function getActions(): array
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
Actions\Action::make('Go Back')
Actions\Action::make('back')
->label(__('general.go_back'))
->icon('heroicon-o-arrow-left')
->url(route('filament.resources.agreements.index'))
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ protected function getActions(): array
return [
Actions\EditAction::make()
->color('secondary'),
Actions\Action::make('Go Back')
Actions\Action::make('back')
->label(__('general.go_back'))
->icon('heroicon-o-arrow-left')
->url(route('filament.resources.agreements.index'))
];
Expand Down
Loading

0 comments on commit 04dbc28

Please sign in to comment.