Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
curtisdelicata committed Jul 23, 2024
2 parents 75f4529 + 69e91a0 commit 4372d67
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 1 deletion.
137 changes: 137 additions & 0 deletions app/Filament/Staff/Resources/RentalApplicationResource.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,141 @@

<?php

namespace App\Filament\Staff\Resources;

use App\Filament\Staff\Resources\RentalApplicationResource\Pages;
use App\Models\RentalApplication;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class RentalApplicationResource extends Resource
{
protected static ?string $model = RentalApplication::class;

protected static ?string $navigationIcon = 'heroicon-o-clipboard-document-list';

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('property_id')
->relationship('property', 'title')
->required()
->searchable(),
Forms\Components\Select::make('tenant_id')
->relationship('tenant', 'name')
->required()
->searchable(),
Forms\Components\Select::make('status')
->options([
'pending' => 'Pending',
'approved' => 'Approved',
'rejected' => 'Rejected',
])
->required(),
Forms\Components\Select::make('employment_status')
->options([
'employed' => 'Employed',
'self_employed' => 'Self-employed',
'unemployed' => 'Unemployed',
'student' => 'Student',
])
->required(),
Forms\Components\TextInput::make('annual_income')
->required()
->numeric()
->prefix('$'),
Forms\Components\TextInput::make('ethereum_address')
->required()
->maxLength(255),
Forms\Components\DatePicker::make('lease_start_date')
->required(),
Forms\Components\DatePicker::make('lease_end_date')
->required(),
Forms\Components\Select::make('background_check_status')
->options([
'pending' => 'Pending',
'passed' => 'Passed',
'failed' => 'Failed',
]),
Forms\Components\Select::make('credit_report_status')
->options([
'pending' => 'Pending',
'passed' => 'Passed',
'failed' => 'Failed',
]),
Forms\Components\TextInput::make('smart_contract_address')
->maxLength(255),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('property.title')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('tenant.name')
->searchable()
->sortable(),
Tables\Columns\SelectColumn::make('status')
->options([
'pending' => 'Pending',
'approved' => 'Approved',
'rejected' => 'Rejected',
])
->sortable(),
Tables\Columns\TextColumn::make('employment_status')
->searchable(),
Tables\Columns\TextColumn::make('annual_income')
->money('usd')
->sortable(),
Tables\Columns\TextColumn::make('background_check_status'),
Tables\Columns\TextColumn::make('credit_report_status'),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
Tables\Filters\SelectFilter::make('status')
->options([
'pending' => 'Pending',
'approved' => 'Approved',
'rejected' => 'Rejected',
]),
Tables\Filters\SelectFilter::make('employment_status')
->options([
'employed' => 'Employed',
'self_employed' => 'Self-employed',
'unemployed' => 'Unemployed',
'student' => 'Student',
]),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Tenant/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RecentMaintenanceRequests extends TableWidget
{
protected int | string | array $columnSpan = 'full';

protected function getTableQuery()
protected function getTableQuery(): \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Relations\Relation|null
{
return MaintenanceRequest::where('tenant_id', auth()->id())->latest()->limit(5);
}
Expand Down

0 comments on commit 4372d67

Please sign in to comment.