User company addded
This commit is contained in:
@@ -3,21 +3,27 @@
|
||||
namespace App\Filament\Resources\Company;
|
||||
|
||||
use App\Filament\Resources\Company\UserCompanyResource\Pages;
|
||||
use App\Modules\Bank\Repositories\BankRepository;
|
||||
use App\Modules\UserCompany\Models\UserCompany;
|
||||
use App\Modules\UserCompany\Types\CompanyType;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UserCompanyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UserCompany::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-briefcase';
|
||||
protected static ?string $navigationGroup = 'Company';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-building-office';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
@@ -30,6 +36,9 @@ class UserCompanyResource extends Resource
|
||||
->default(CompanyType::default())
|
||||
->required(),
|
||||
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
|
||||
TextInput::make('ssb')
|
||||
->label('Şahsy salgyt belgisi')
|
||||
->unique(ignoreRecord: true)
|
||||
@@ -41,10 +50,15 @@ class UserCompanyResource extends Resource
|
||||
->required(),
|
||||
|
||||
Select::make('bank_id')
|
||||
->relationship(name: 'bank', titleAttribute: 'name')
|
||||
->label('Bank')
|
||||
->native(false)
|
||||
->options(BankRepository::make()->options())
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
|
||||
Toggle::make('default')
|
||||
->default(false)
|
||||
->label('Is default'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -54,14 +68,20 @@ class UserCompanyResource extends Resource
|
||||
->columns([
|
||||
TextColumn::make('company_type')
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state): string => CompanyType::options()[$state])
|
||||
->formatStateUsing(fn (string $state): string => CompanyType::option($state))
|
||||
->color(fn (string $state): string => CompanyType::statusClass($state)),
|
||||
// 'ssb'
|
||||
// 'hb'
|
||||
// 'bank_id'
|
||||
|
||||
TextColumn::make('ssb')
|
||||
->label('Şahsy salgyt belgisi')
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('hb')
|
||||
->label('HB'),
|
||||
|
||||
ToggleColumn::make('default'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
Filter::make('default'),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
|
||||
Reference in New Issue
Block a user