Skip to content

Commit

Permalink
Changes to files: Classes/Realestate.php
Browse files Browse the repository at this point in the history
Models/.gitkeep
Models/Building.php
Models/BuildingUnitSetup.php
Models/Data/Building.php
Models/Data/Estate.php
Models/Data/Region.php
Models/Data/Town.php
Models/Estate.php
Models/ReadingElectricity.php
Models/ReadingGas.php
Models/ReadingWater.php
Models/Region.php
Models/Tenancy.php
Models/TenancyInvoice.php
Models/TenancyService.php
Models/Town.php
Models/Unit.php
Models/UnitSetup.php
Tests/Feature/.gitkeep
Tests/Unit/.gitkeep
composer.json
  • Loading branch information
dedanirungu committed Aug 12, 2024
1 parent c4bf1c1 commit 3aef409
Show file tree
Hide file tree
Showing 78 changed files with 2,280 additions and 4 deletions.
File renamed without changes.
127 changes: 127 additions & 0 deletions app/Filament/Resources/BuildingResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?php

namespace Modules\Realestate\Filament\Resources;

use Modules\Realestate\Filament\Resources\BuildingResource\Pages;
use Modules\Realestate\Filament\Resources\BuildingResource\RelationManagers;
use Modules\Realestate\Models\Building;
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 BuildingResource extends Resource
{
protected static ?string $model = Building::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->maxLength(255)
->default(null),
Forms\Components\TextInput::make('slug')
->maxLength(255)
->default(null),
Forms\Components\TextInput::make('estate_id')
->required()
->numeric(),
Forms\Components\TextInput::make('type'),
Forms\Components\Textarea::make('description')
->columnSpanFull(),
Forms\Components\TextInput::make('units')
->numeric()
->default(null),
Forms\Components\TextInput::make('default_deposit')
->numeric()
->default(null),
Forms\Components\TextInput::make('default_goodwill')
->numeric()
->default(null),
Forms\Components\TextInput::make('default_amount')
->numeric()
->default(null),
Forms\Components\Toggle::make('is_full'),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
Tables\Columns\TextColumn::make('slug')
->searchable(),
Tables\Columns\TextColumn::make('estate_id')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('type'),
Tables\Columns\TextColumn::make('units')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('default_deposit')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('default_goodwill')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('default_amount')
->numeric()
->sortable(),
Tables\Columns\IconColumn::make('is_full')
->boolean(),
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\TrashedFilter::make(),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}

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

public static function getPages(): array
{
return [
'index' => Pages\ListBuildings::route('/'),
'create' => Pages\CreateBuilding::route('/create'),
'edit' => Pages\EditBuilding::route('/{record}/edit'),
];
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}
12 changes: 12 additions & 0 deletions app/Filament/Resources/BuildingResource/Pages/CreateBuilding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateBuilding extends CreateRecord
{
protected static string $resource = BuildingResource::class;
}
21 changes: 21 additions & 0 deletions app/Filament/Resources/BuildingResource/Pages/EditBuilding.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditBuilding extends EditRecord
{
protected static string $resource = BuildingResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}
19 changes: 19 additions & 0 deletions app/Filament/Resources/BuildingResource/Pages/ListBuildings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListBuildings extends ListRecords
{
protected static string $resource = BuildingResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
102 changes: 102 additions & 0 deletions app/Filament/Resources/BuildingUnitSetupResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace Modules\Realestate\Filament\Resources;

use Modules\Realestate\Filament\Resources\BuildingUnitSetupResource\Pages;
use Modules\Realestate\Filament\Resources\BuildingUnitSetupResource\RelationManagers;
use Modules\Realestate\Models\BuildingUnitSetup;
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 BuildingUnitSetupResource extends Resource
{
protected static ?string $model = BuildingUnitSetup::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->maxLength(255)
->default(null),
Forms\Components\TextInput::make('slug')
->maxLength(255)
->default(null),
Forms\Components\TextInput::make('amount')
->numeric()
->default(null),
Forms\Components\TextInput::make('building_id')
->required()
->numeric(),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title')
->searchable(),
Tables\Columns\TextColumn::make('slug')
->searchable(),
Tables\Columns\TextColumn::make('amount')
->numeric()
->sortable(),
Tables\Columns\TextColumn::make('building_id')
->numeric()
->sortable(),
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\TrashedFilter::make(),
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
]);
}

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

public static function getPages(): array
{
return [
'index' => Pages\ListBuildingUnitSetups::route('/'),
'create' => Pages\CreateBuildingUnitSetup::route('/create'),
'edit' => Pages\EditBuildingUnitSetup::route('/{record}/edit'),
];
}

public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingUnitSetupResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingUnitSetupResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateBuildingUnitSetup extends CreateRecord
{
protected static string $resource = BuildingUnitSetupResource::class;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingUnitSetupResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingUnitSetupResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditBuildingUnitSetup extends EditRecord
{
protected static string $resource = BuildingUnitSetupResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Modules\Realestate\Filament\Resources\BuildingUnitSetupResource\Pages;

use Modules\Realestate\Filament\Resources\BuildingUnitSetupResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListBuildingUnitSetups extends ListRecords
{
protected static string $resource = BuildingUnitSetupResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}
Loading

0 comments on commit 3aef409

Please sign in to comment.