Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Oct 30, 2024
1 parent 3a9fe9e commit f99cc4e
Show file tree
Hide file tree
Showing 29 changed files with 1,081 additions and 188 deletions.
12 changes: 6 additions & 6 deletions app/Filament/Admin/Resources/CountryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ public static function form(Form $form): Form
return $form
->schema([
TextInput::make('id')
->label(__('admin.field.id'))
->label(__('app.field.id'))
->unique(ignoreRecord: true)
->required(),

TextInput::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->required(),

TagsInput::make('aliases')
->label(__('admin.field.aliases'))
->label(__('app.field.aliases'))
->columnSpanFull(),
]);
}
Expand All @@ -46,18 +46,18 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('id')
->label(__('admin.field.id'))
->label(__('app.field.id'))
->searchable()
->sortable()
->shrink(),

TextColumn::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->searchable()
->sortable(),

TextColumn::make('aliases')
->label(__('admin.field.aliases'))
->label(__('app.field.aliases'))
->searchable()
->sortable(),
])
Expand Down
8 changes: 4 additions & 4 deletions app/Filament/Admin/Resources/CountyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public static function form(Form $form): Form
return $form
->schema([
TextInput::make('id')
->label(__('admin.field.siruta'))
->label(__('app.field.siruta'))
->unique(ignoreRecord: true)
->required(),

TextInput::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->required(),
]);
}
Expand All @@ -41,12 +41,12 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('id')
->label(__('admin.field.siruta'))
->label(__('app.field.siruta'))
->sortable()
->shrink(),

TextColumn::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->searchable()
->sortable(),
])
Expand Down
36 changes: 18 additions & 18 deletions app/Filament/Admin/Resources/ElectionResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ElectionResource extends Resource

public static function getNavigationGroup(): ?string
{
return __('admin.navigation.admin');
return __('app.navigation.admin');
}

public static function getModelLabel(): string
Expand All @@ -62,31 +62,31 @@ public static function form(Form $form): Form
->columns(2)
->schema([
Select::make('type')
->label(__('admin.field.type'))
->label(__('app.field.type'))
->relationship('type', 'name')
->required(),

TextInput::make('title')
->label(__('admin.field.title'))
->label(__('app.field.title'))
->required(),

TextInput::make('subtitle')
->label(__('admin.field.subtitle'))
->label(__('app.field.subtitle'))
->nullable(),

/*
* @see https://dev.mysql.com/doc/refman/8.4/en/year.html Documentation for the YEAR data type
*/
TextInput::make('year')
->label(__('admin.field.year'))
->label(__('app.field.year'))
->minValue(1901)
->maxValue(2155)
->numeric()
->default(today()->year)
->required(),

Toggle::make('is_live')
->label(__('admin.field.is_live'))
->label(__('app.field.is_live'))
->default(false),

]),
Expand All @@ -103,28 +103,28 @@ public static function infolist(Infolist $infolist): Infolist
->columns(2)
->schema([
TextEntry::make('title')
->label(__('admin.field.title')),
->label(__('app.field.title')),

TextEntry::make('subtitle')
->label(__('admin.field.subtitle')),
->label(__('app.field.subtitle')),

TextEntry::make('year')
->label(__('admin.field.year')),
->label(__('app.field.year')),

IconEntry::make('is_live')
->label(__('admin.field.is_live'))
->label(__('app.field.is_live'))
->boolean(),
]),

Infolists\Components\Section::make()
->columnSpan(1)
->schema([
TextEntry::make('created_at')
->label(__('admin.field.created_at'))
->label(__('app.field.created_at'))
->dateTime(),

TextEntry::make('updated_at')
->label(__('admin.field.updated_at'))
->label(__('app.field.updated_at'))
->dateTime(),
]),

Expand All @@ -136,31 +136,31 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('id')
->label(__('admin.field.id'))
->label(__('app.field.id'))
->sortable()
->shrink(),

TextColumn::make('type.name')
->label(__('admin.field.type'))
->label(__('app.field.type'))
->sortable(),

TextColumn::make('title')
->label(__('admin.field.title'))
->label(__('app.field.title'))
->searchable()
->sortable()
->description(fn (Election $record) => $record->subtitle),

TextColumn::make('year')
->label(__('admin.field.year'))
->label(__('app.field.year'))
->sortable(),

IconColumn::make('is_live')
->label(__('admin.field.is_live'))
->label(__('app.field.is_live'))
->boolean(),
])
->filters([
SelectFilter::make('type')
->label(__('admin.field.type'))
->label(__('app.field.type'))
->relationship('type', 'name'),
])
->filtersLayout(FiltersLayout::AboveContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function form(Form $form): Form
return $form
->schema([
Select::make('job')
->label(__('admin.field.job'))
->label(__('app.field.job'))
->options(function () {
ClassFinder::disablePSR4Vendors();

Expand All @@ -40,27 +40,30 @@ public function form(Form $form): Form
}),

Select::make('cron')
->label(__('admin.field.cron'))
->label(__('app.field.cron'))
->options(Cron::options())
->enum(Cron::class)
->required(),

Fieldset::make('source')
->label('Source')
->columns(4)
->schema([
TextInput::make('source_url')
->label(__('admin.field.source_url'))
->columnSpanFull(),
->label(__('app.field.source_url'))
->columnSpan(3),

TextInput::make('source_part')
->label(__('admin.field.source_part')),
->label(__('app.field.source_part')),

TextInput::make('source_username')
->label(__('admin.field.source_username')),
->label(__('app.field.source_username'))
->columnSpan(2),

TextInput::make('source_password')
->label(__('admin.field.source_password'))
->password(),
->label(__('app.field.source_password'))
->password()
->columnSpan(2),
]),
]);
}
Expand All @@ -71,19 +74,19 @@ public function table(Table $table): Table
->recordTitleAttribute('job')
->columns([
ToggleColumn::make('is_enabled')
->label(__('admin.field.is_enabled'))
->label(__('app.field.is_enabled'))
->shrink(),

TextColumn::make('job')
->label(__('admin.field.job'))
->label(__('app.field.job'))
->description(fn (string $state) => $state, 'above')
->formatStateUsing(fn (string $state) => $state::name()),

TextColumn::make('cron')
->label(__('admin.field.cron')),
->label(__('app.field.cron')),

TextColumn::make('last_run_at')
->label(__('admin.field.last_run_at'))
->label(__('app.field.last_run_at'))
->since(),
])
->filters([
Expand Down
6 changes: 3 additions & 3 deletions app/Filament/Admin/Resources/ElectionTypeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ElectionTypeResource extends Resource

public static function getNavigationGroup(): ?string
{
return __('admin.navigation.admin');
return __('app.navigation.admin');
}

public static function getModelLabel(): string
Expand All @@ -43,7 +43,7 @@ public static function form(Form $form): Form
return $form
->schema([
TextInput::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->unique(ignoreRecord: true)
->required(),
]);
Expand All @@ -54,7 +54,7 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('name')
->label(__('admin.field.name')),
->label(__('app.field.name')),

TextColumn::make('elections_count')
->counts('elections')
Expand Down
8 changes: 4 additions & 4 deletions app/Filament/Admin/Resources/LocalityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public static function table(Table $table): Table
return $table
->columns([
TextColumn::make('id')
->label(__('admin.field.siruta'))
->label(__('app.field.siruta'))
->sortable(),

TextColumn::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->searchable()
->sortable(),

Expand All @@ -73,15 +73,15 @@ public static function table(Table $table): Table
->sortable(),

TextColumn::make('county.name')
->label(__('admin.field.county'))
->label(__('app.field.county'))
->searchable()
->sortable(),

])
->filters([
SelectFilter::make('county')
->relationship('county', 'name')
->label(__('admin.field.county')),
->label(__('app.field.county')),
])
->actions([
Tables\Actions\EditAction::make(),
Expand Down
4 changes: 2 additions & 2 deletions app/Filament/Admin/Resources/PartyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public static function table(Table $table): Table
->shrink(),

ColorColumn::make('color')
->label(__('admin.field.color'))
->label(__('app.field.color'))
->shrink(),

TextColumn::make('name')
->label(__('admin.field.name'))
->label(__('app.field.name'))
->description(fn (Party $record) => $record->acronym)
->searchable()
->sortable(),
Expand Down
Loading

0 comments on commit f99cc4e

Please sign in to comment.