Skip to content

Commit

Permalink
Revert "Added Event model"
Browse files Browse the repository at this point in the history
This reverts commit 9512591.
  • Loading branch information
afsakar committed Jun 14, 2023
1 parent 9512591 commit 2e04de1
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 378 deletions.
2 changes: 0 additions & 2 deletions app/Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Pages;

use App\Filament\Resources\RevenueResource\Widgets\RevenueWidget;
use App\Filament\Widgets\CalendarWidget;
use Closure;
use Filament\Facades\Filament;
use Filament\Pages\Page;
Expand Down Expand Up @@ -35,7 +34,6 @@ protected function getWidgets(): array
{
return [
AccountWidget::class,
CalendarWidget::class,
// RevenueWidget::class,
];
}
Expand Down
17 changes: 5 additions & 12 deletions app/Filament/Resources/CheckResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use App\Filament\Resources\CheckResource\RelationManagers;
use App\Models\Account;
use App\Models\Check;
use App\Models\Event;
use Carbon\Carbon;
use Closure;
use Filament\Forms;
Expand Down Expand Up @@ -190,7 +189,7 @@ public static function table(Table $table): Table
->sortable()
->label(__('checks.number')),
Tables\Columns\TextColumn::make('amount')
->formatStateUsing(fn($record, $state) => $record->corporation->currency->position == 'left' ? $record->corporation->currency->symbol . number_format($state, 2) : number_format($state, 2) . $record->corporation->currency->symbol)
->formatStateUsing(fn ($record, $state) => $record->corporation->currency->position == 'left' ? $record->corporation->currency->symbol . number_format($state, 2) : number_format($state, 2) . $record->corporation->currency->symbol)
->label(__('checks.amount')),
Tables\Columns\TextColumn::make('account.name')
->label(__('checks.account')),
Expand Down Expand Up @@ -220,11 +219,11 @@ public static function table(Table $table): Table
return $query
->when(
$data['min_amount'],
fn(Builder $query, $amount): Builder => $query->where('amount', '>=', $amount),
fn (Builder $query, $amount): Builder => $query->where('amount', '>=', $amount),
)
->when(
$data['max_amount'],
fn(Builder $query, $amount): Builder => $query->where('amount', '<=', $amount),
fn (Builder $query, $amount): Builder => $query->where('amount', '<=', $amount),
);
}),
])
Expand All @@ -235,7 +234,7 @@ public static function table(Table $table): Table
->action(function ($record) {
return response()->download($record->getMedia('checks')[0]->getPath(), Carbon::parse($record->due_date)->format('d-m-Y') . " " . $record->corporation->name);
})
->hidden(fn($record) => !$record->getMedia() || !$record->getMedia('checks')->count()),
->hidden(fn ($record) => !$record->getMedia() || !$record->getMedia('checks')->count()),
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make()
->after(function ($record, Request $request) {
Expand All @@ -246,16 +245,10 @@ public static function table(Table $table): Table
}),
Tables\Actions\DeleteAction::make()
->before(function ($record) {
$event = Event::where('check_id', $record->id)->first();

if ($record->image != null) {
Storage::disk('public')->delete($record->image);
}

if ($event) {
$event->delete();
}
})
}),
])
->bulkActions([
FilamentExportBulkAction::make('export')
Expand Down
10 changes: 0 additions & 10 deletions app/Filament/Resources/CheckResource/Pages/ManageChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Filament\Resources\CheckResource\Pages;

use App\Filament\Resources\CheckResource;
use App\Models\Event;
use Filament\Pages\Actions;
use Filament\Resources\Pages\ManageRecords;

Expand All @@ -20,15 +19,6 @@ protected function getActions(): array
$record->paid_date = null;
$record->save();
}

Event::create([
'title' => 'Check Payment',
'description' => $record->number . ' - ' . $record->corporation->name,
'start' => $record->due_date,
'end' => null,
'reminder' => true,
'check_id' => $record->id,
]);
}),
];
}
Expand Down
106 changes: 0 additions & 106 deletions app/Filament/Resources/EventResource.php

This file was deleted.

19 changes: 0 additions & 19 deletions app/Filament/Resources/EventResource/Pages/ManageEvents.php

This file was deleted.

29 changes: 0 additions & 29 deletions app/Filament/Widgets/CalendarWidget.php

This file was deleted.

30 changes: 0 additions & 30 deletions app/Models/Event.php

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"livewire/livewire": "^2.12",
"malzariey/filament-daterangepicker-filter": "^1.2",
"marjose123/filament-lockscreen": "^1.1",
"saade/filament-fullcalendar": "^1.7",
"webbingbrasil/filament-datefilter": "^1.1"
},
"require-dev": {
Expand Down
80 changes: 1 addition & 79 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2e04de1

Please sign in to comment.