From 604f9989b2421837b3bec4459e95fe59dab49e79 Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:08 +0200
Subject: [PATCH 01/16] Fixed image export
---
app/Http/Controllers/ProfileController.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 41f9036..e10e613 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -180,10 +180,10 @@ public function exportImages()
$zip = new ZipArchive;
- if (true === ($zip->open('storage/profileImages.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
+ if (true === ($zip->open(public_path('storage/profileImages.zip'), ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
foreach (Storage::allFiles('public') as $file) {
$name = basename($file);
- if ($name !== '.gitignore') {
+ if ($name !== '.gitignore' && $name !== 'profileImages.zip') {
$zip->addFile(public_path('storage/' . $name), $name);
}
}
From f86543f505f2accbc6deb8fc4fcaa9553b712193 Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:50 +0200
Subject: [PATCH 02/16] Added user/profile relations to application page
---
.../Resources/ApplicationResource.php | 8 +--
.../ProfileRelationManager.php | 58 +++++++++++++++++
.../RelationManagers/UserRelationManager.php | 64 +++++++++++++++++++
app/Filament/Resources/UserResource.php | 4 +-
app/Models/Application.php | 6 +-
5 files changed, 131 insertions(+), 9 deletions(-)
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
diff --git a/app/Filament/Resources/ApplicationResource.php b/app/Filament/Resources/ApplicationResource.php
index 8480737..a65ca7d 100755
--- a/app/Filament/Resources/ApplicationResource.php
+++ b/app/Filament/Resources/ApplicationResource.php
@@ -10,9 +10,6 @@
use App\Http\Controllers\Applications\ApplicationController;
use App\Models\Application;
use App\Models\TableType;
-use App\Notifications\AcceptedNotification;
-use App\Notifications\OnHoldNotification;
-use App\Notifications\WaitingListNotification;
use Filament\Forms;
use Filament\Notifications\Notification;
use Filament\Resources\Form;
@@ -22,7 +19,6 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Log;
class ApplicationResource extends Resource
{
@@ -241,7 +237,9 @@ public static function getRelations(): array
{
return [
RelationManagers\ChildrenRelationManager::class,
- RelationManagers\ParentRelationManager::class
+ RelationManagers\ParentRelationManager::class,
+ RelationManagers\UserRelationManager::class,
+ RelationManagers\ProfileRelationManager::class,
];
}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
new file mode 100644
index 0000000..634346c
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
@@ -0,0 +1,58 @@
+schema([
+ Forms\Components\TextInput::make('short_desc')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('short_desc'),
+ Tables\Columns\TextColumn::make('website'),
+ Tables\Columns\TextColumn::make('attends_thu'),
+ Tables\Columns\TextColumn::make('attends_fri'),
+ Tables\Columns\TextColumn::make('attends_sat'),
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(Profile $record): string => ProfileResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
new file mode 100644
index 0000000..55f712d
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
@@ -0,0 +1,64 @@
+schema([
+ Forms\Components\TextInput::make('name')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('name'),
+ Tables\Columns\TextColumn::make('reg_id'),
+ Tables\Columns\TextColumn::make('email'),
+
+ Tables\Columns\BadgeColumn::make('packages booked')
+ ->formatStateUsing(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
+ Tables\Columns\BadgeColumn::make('reg status')
+ ->formatStateUsing(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '')
+ ->colors([
+ 'secondary',
+ 'success' => 'paid',
+ 'danger' => 'cancelled',
+ ])
+
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(User $record): string => UserResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index 996644a..b2ae8c6 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -38,9 +38,9 @@ public static function form(Form $form): Form
Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([
Forms\Components\Placeholder::make('packages booked')
- ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? '-'),
+ ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
Forms\Components\Placeholder::make('reg status')
- ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '-'),
+ ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
]),
]);
}
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 0e0ca26..fe21ead 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -7,8 +7,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
-use Illuminate\Validation\ValidationException;
-use Symfony\Component\Console\Helper\Table;
class Application extends Model
{
@@ -119,6 +117,10 @@ public function children()
return $this->hasMany(__CLASS__, 'parent');
}
+ public function profile() {
+ return $this->belongsTo(Profile::class, 'id', 'application_id', 'profiles');
+ }
+
public function getStatus()
{
if (!is_null($this->canceled_at)) {
From 0fd6684ce5681276e982efce74f8f9de5b431ab3 Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:08 +0200
Subject: [PATCH 03/16] Fixed image export
---
app/Http/Controllers/ProfileController.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 41f9036..e10e613 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -180,10 +180,10 @@ public function exportImages()
$zip = new ZipArchive;
- if (true === ($zip->open('storage/profileImages.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
+ if (true === ($zip->open(public_path('storage/profileImages.zip'), ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
foreach (Storage::allFiles('public') as $file) {
$name = basename($file);
- if ($name !== '.gitignore') {
+ if ($name !== '.gitignore' && $name !== 'profileImages.zip') {
$zip->addFile(public_path('storage/' . $name), $name);
}
}
From 891c7ec5bbc966c984fc6d9a901b78d26d94318c Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:50 +0200
Subject: [PATCH 04/16] Added user/profile relations to application page
---
.../Resources/ApplicationResource.php | 5 +-
.../ProfileRelationManager.php | 58 +++++++++++++++++
.../RelationManagers/UserRelationManager.php | 64 +++++++++++++++++++
app/Filament/Resources/UserResource.php | 4 +-
app/Models/Application.php | 6 +-
5 files changed, 131 insertions(+), 6 deletions(-)
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
diff --git a/app/Filament/Resources/ApplicationResource.php b/app/Filament/Resources/ApplicationResource.php
index 49618d4..e3e69e7 100755
--- a/app/Filament/Resources/ApplicationResource.php
+++ b/app/Filament/Resources/ApplicationResource.php
@@ -19,7 +19,6 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Log;
class ApplicationResource extends Resource
{
@@ -237,7 +236,9 @@ public static function getRelations(): array
{
return [
RelationManagers\ChildrenRelationManager::class,
- RelationManagers\ParentRelationManager::class
+ RelationManagers\ParentRelationManager::class,
+ RelationManagers\UserRelationManager::class,
+ RelationManagers\ProfileRelationManager::class,
];
}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
new file mode 100644
index 0000000..634346c
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
@@ -0,0 +1,58 @@
+schema([
+ Forms\Components\TextInput::make('short_desc')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('short_desc'),
+ Tables\Columns\TextColumn::make('website'),
+ Tables\Columns\TextColumn::make('attends_thu'),
+ Tables\Columns\TextColumn::make('attends_fri'),
+ Tables\Columns\TextColumn::make('attends_sat'),
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(Profile $record): string => ProfileResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
new file mode 100644
index 0000000..55f712d
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
@@ -0,0 +1,64 @@
+schema([
+ Forms\Components\TextInput::make('name')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('name'),
+ Tables\Columns\TextColumn::make('reg_id'),
+ Tables\Columns\TextColumn::make('email'),
+
+ Tables\Columns\BadgeColumn::make('packages booked')
+ ->formatStateUsing(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
+ Tables\Columns\BadgeColumn::make('reg status')
+ ->formatStateUsing(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '')
+ ->colors([
+ 'secondary',
+ 'success' => 'paid',
+ 'danger' => 'cancelled',
+ ])
+
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(User $record): string => UserResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index 996644a..b2ae8c6 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -38,9 +38,9 @@ public static function form(Form $form): Form
Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([
Forms\Components\Placeholder::make('packages booked')
- ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? '-'),
+ ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
Forms\Components\Placeholder::make('reg status')
- ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '-'),
+ ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
]),
]);
}
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 82463c3..2604655 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -8,8 +8,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
-use Illuminate\Validation\ValidationException;
-use Symfony\Component\Console\Helper\Table;
class Application extends Model
{
@@ -121,6 +119,10 @@ public function children()
return $this->hasMany(__CLASS__, 'parent');
}
+ public function profile() {
+ return $this->belongsTo(Profile::class, 'id', 'application_id', 'profiles');
+ }
+
public function getStatus()
{
if (!is_null($this->canceled_at)) {
From 73913ecc5b992d92f6f059b853d9f26fa71f4bbc Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Fri, 19 May 2023 21:55:22 +0200
Subject: [PATCH 05/16] Fixed button text.
---
app/Notifications/AlternateTableOfferedNotification.php | 2 +-
app/Notifications/TableOfferedNotification.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Notifications/AlternateTableOfferedNotification.php b/app/Notifications/AlternateTableOfferedNotification.php
index 07a0660..9447732 100644
--- a/app/Notifications/AlternateTableOfferedNotification.php
+++ b/app/Notifications/AlternateTableOfferedNotification.php
@@ -35,7 +35,7 @@ public function toMail(object $notifiable): MailMessage
->line('Unfortunately, we regret to inform you that the table size you have applied for is no longer available. However, we have some alternative table sizes we would like to offer that may be suitable for your needs.')
->line('Currently, the following table size is available:')
->line($this->tableAssigned . ' - ' . $this->price / 100 . ' EUR')
- ->action('Review Dealership Package.', url('/table/confirm'))
+ ->action('Review Dealership Package', url('/table/confirm'))
->line('We understand that this alternative option may not be what you had in mind when applying, but we hope that it will still meet your needs and enable you to participate in the Eurofurence Dealers\' Den. As we have limited space, we will be offering any available table sizes to other applications on the waiting list if we do not receive a response from you within the next seven days. So please let us know within this time frame whether you would like to accept one of the alternative options or decline the offer and be put on the waiting list. To do so, simply reply to this email.')
->line('We apologize for any inconvenience this may have caused you, and we hope to hear back from you soon. Thank you for your understanding and cooperation.')
->salutation(new HtmlString('Best regards,
the Eurofurence Dealers\' Den Team'));
diff --git a/app/Notifications/TableOfferedNotification.php b/app/Notifications/TableOfferedNotification.php
index 9193ac8..e4c8ed2 100644
--- a/app/Notifications/TableOfferedNotification.php
+++ b/app/Notifications/TableOfferedNotification.php
@@ -28,7 +28,7 @@ public function toMail(object $notifiable): MailMessage
->subject(config('ef.con_name') . ' Dealers\' Den - Application Accepted')
->line('We are thrilled to inform you that your application for a dealership at ' . config('ef.con_name') . ' has been accepted! Congratulations!')
->line(new HtmlString('To review and confirm your placement as a dealer at ' . config('ef.con_name') . ', please click on the button below. By accepting the offered table, you are agreeing to the Dealers\' Den\'s terms and conditions, and the payment process will be initiated.'))
- ->action('Review Dealership Package.', url('/table/confirm'))
+ ->action('Review Dealership Package', url('/table/confirm'))
->line(new HtmlString('Once you have confirmed the package, your Eurofurence event registration will be updated to include the fee for the assigned dealership. All payments must be handled through the Eurofurence registration system, available at ' . config('ef.idp_url') . '. Please note that you are required to pay all fees, including the Eurofurence event registration fee, within ' . config('ef.payment_timeframe') . ' of receiving this email to secure your placement as a dealer. If payment is overdue, Dealers\' Den management may void your placement and offer the space to the next dealer on the waiting list.'))
->line('Although all placements may be subject to change until the start of the convention, you will be sent an email containing the preliminary dealership table assignment for information.')
->line(new HtmlString('If you have any questions or concerns regarding the payment or subsequent processes, please contact Dealers\' Den management via ' . config('ef.dealers_email') . '.'))
From 980aec4fd030bae9466e94a64c2ec48d074ce503 Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:08 +0200
Subject: [PATCH 06/16] Fixed image export
---
app/Http/Controllers/ProfileController.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 41f9036..e10e613 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -180,10 +180,10 @@ public function exportImages()
$zip = new ZipArchive;
- if (true === ($zip->open('storage/profileImages.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
+ if (true === ($zip->open(public_path('storage/profileImages.zip'), ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
foreach (Storage::allFiles('public') as $file) {
$name = basename($file);
- if ($name !== '.gitignore') {
+ if ($name !== '.gitignore' && $name !== 'profileImages.zip') {
$zip->addFile(public_path('storage/' . $name), $name);
}
}
From e6806e1d28ce55a9a6366f3bef8b2b1dd0f5df0b Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 17 May 2023 22:35:50 +0200
Subject: [PATCH 07/16] Added user/profile relations to application page
---
.../Resources/ApplicationResource.php | 5 +-
.../ProfileRelationManager.php | 58 +++++++++++++++++
.../RelationManagers/UserRelationManager.php | 64 +++++++++++++++++++
app/Filament/Resources/UserResource.php | 4 +-
app/Models/Application.php | 6 +-
5 files changed, 131 insertions(+), 6 deletions(-)
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
create mode 100644 app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
diff --git a/app/Filament/Resources/ApplicationResource.php b/app/Filament/Resources/ApplicationResource.php
index 49618d4..e3e69e7 100755
--- a/app/Filament/Resources/ApplicationResource.php
+++ b/app/Filament/Resources/ApplicationResource.php
@@ -19,7 +19,6 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Log;
class ApplicationResource extends Resource
{
@@ -237,7 +236,9 @@ public static function getRelations(): array
{
return [
RelationManagers\ChildrenRelationManager::class,
- RelationManagers\ParentRelationManager::class
+ RelationManagers\ParentRelationManager::class,
+ RelationManagers\UserRelationManager::class,
+ RelationManagers\ProfileRelationManager::class,
];
}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
new file mode 100644
index 0000000..634346c
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/ProfileRelationManager.php
@@ -0,0 +1,58 @@
+schema([
+ Forms\Components\TextInput::make('short_desc')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('short_desc'),
+ Tables\Columns\TextColumn::make('website'),
+ Tables\Columns\TextColumn::make('attends_thu'),
+ Tables\Columns\TextColumn::make('attends_fri'),
+ Tables\Columns\TextColumn::make('attends_sat'),
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(Profile $record): string => ProfileResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
new file mode 100644
index 0000000..55f712d
--- /dev/null
+++ b/app/Filament/Resources/ApplicationResource/RelationManagers/UserRelationManager.php
@@ -0,0 +1,64 @@
+schema([
+ Forms\Components\TextInput::make('name')
+ ->required()
+ ->maxLength(255),
+ ]);
+ }
+
+ public static function table(Table $table): Table
+ {
+ return $table
+ ->columns([
+ Tables\Columns\TextColumn::make('name'),
+ Tables\Columns\TextColumn::make('reg_id'),
+ Tables\Columns\TextColumn::make('email'),
+
+ Tables\Columns\BadgeColumn::make('packages booked')
+ ->formatStateUsing(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
+ Tables\Columns\BadgeColumn::make('reg status')
+ ->formatStateUsing(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '')
+ ->colors([
+ 'secondary',
+ 'success' => 'paid',
+ 'danger' => 'cancelled',
+ ])
+
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(User $record): string => UserResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index 02cc1dd..4d126a2 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -38,9 +38,9 @@ public static function form(Form $form): Form
Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([
Forms\Components\Placeholder::make('packages booked')
- ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? '-'),
+ ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
Forms\Components\Placeholder::make('reg status')
- ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? '-'),
+ ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
]),
]);
}
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 4716267..67e5d9b 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -8,8 +8,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;
-use Illuminate\Validation\ValidationException;
-use Symfony\Component\Console\Helper\Table;
class Application extends Model
{
@@ -121,6 +119,10 @@ public function children()
return $this->hasMany(__CLASS__, 'parent');
}
+ public function profile() {
+ return $this->belongsTo(Profile::class, 'id', 'application_id', 'profiles');
+ }
+
public function getStatus()
{
if (!is_null($this->canceled_at)) {
From 166e803f8a6b1dce1134abd48f56c1a69e5f443a Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Fri, 19 May 2023 21:55:22 +0200
Subject: [PATCH 08/16] Fixed button text.
---
app/Notifications/AlternateTableOfferedNotification.php | 2 +-
app/Notifications/TableOfferedNotification.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/Notifications/AlternateTableOfferedNotification.php b/app/Notifications/AlternateTableOfferedNotification.php
index 07a0660..9447732 100644
--- a/app/Notifications/AlternateTableOfferedNotification.php
+++ b/app/Notifications/AlternateTableOfferedNotification.php
@@ -35,7 +35,7 @@ public function toMail(object $notifiable): MailMessage
->line('Unfortunately, we regret to inform you that the table size you have applied for is no longer available. However, we have some alternative table sizes we would like to offer that may be suitable for your needs.')
->line('Currently, the following table size is available:')
->line($this->tableAssigned . ' - ' . $this->price / 100 . ' EUR')
- ->action('Review Dealership Package.', url('/table/confirm'))
+ ->action('Review Dealership Package', url('/table/confirm'))
->line('We understand that this alternative option may not be what you had in mind when applying, but we hope that it will still meet your needs and enable you to participate in the Eurofurence Dealers\' Den. As we have limited space, we will be offering any available table sizes to other applications on the waiting list if we do not receive a response from you within the next seven days. So please let us know within this time frame whether you would like to accept one of the alternative options or decline the offer and be put on the waiting list. To do so, simply reply to this email.')
->line('We apologize for any inconvenience this may have caused you, and we hope to hear back from you soon. Thank you for your understanding and cooperation.')
->salutation(new HtmlString('Best regards,
the Eurofurence Dealers\' Den Team'));
diff --git a/app/Notifications/TableOfferedNotification.php b/app/Notifications/TableOfferedNotification.php
index 9193ac8..e4c8ed2 100644
--- a/app/Notifications/TableOfferedNotification.php
+++ b/app/Notifications/TableOfferedNotification.php
@@ -28,7 +28,7 @@ public function toMail(object $notifiable): MailMessage
->subject(config('ef.con_name') . ' Dealers\' Den - Application Accepted')
->line('We are thrilled to inform you that your application for a dealership at ' . config('ef.con_name') . ' has been accepted! Congratulations!')
->line(new HtmlString('To review and confirm your placement as a dealer at ' . config('ef.con_name') . ', please click on the button below. By accepting the offered table, you are agreeing to the Dealers\' Den\'s terms and conditions, and the payment process will be initiated.'))
- ->action('Review Dealership Package.', url('/table/confirm'))
+ ->action('Review Dealership Package', url('/table/confirm'))
->line(new HtmlString('Once you have confirmed the package, your Eurofurence event registration will be updated to include the fee for the assigned dealership. All payments must be handled through the Eurofurence registration system, available at ' . config('ef.idp_url') . '. Please note that you are required to pay all fees, including the Eurofurence event registration fee, within ' . config('ef.payment_timeframe') . ' of receiving this email to secure your placement as a dealer. If payment is overdue, Dealers\' Den management may void your placement and offer the space to the next dealer on the waiting list.'))
->line('Although all placements may be subject to change until the start of the convention, you will be sent an email containing the preliminary dealership table assignment for information.')
->line(new HtmlString('If you have any questions or concerns regarding the payment or subsequent processes, please contact Dealers\' Den management via ' . config('ef.dealers_email') . '.'))
From ed603448d3a7693dbd4f30d754c60d9c1ef2aa4a Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Mon, 22 May 2023 21:18:17 +0200
Subject: [PATCH 09/16] Fixed case StatusNotificationResult::SharesInvalid
---
.../Resources/ApplicationResource/Pages/EditApplication.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Filament/Resources/ApplicationResource/Pages/EditApplication.php b/app/Filament/Resources/ApplicationResource/Pages/EditApplication.php
index 7e7ee5e..828e8cc 100644
--- a/app/Filament/Resources/ApplicationResource/Pages/EditApplication.php
+++ b/app/Filament/Resources/ApplicationResource/Pages/EditApplication.php
@@ -53,7 +53,7 @@ public function sendStatusNotification()
->body("Notified application {$application->id} of user {$user->name} about being put on the waiting list.")
->success();
break;
- case StatusNotificationResult::SharesInvalid->name:
+ case StatusNotificationResult::SharesInvalid:
$frontendNotification->title('Notification not sent')
->body("Application not notified because some uncanceled shares have not been assigned to the same table number!")
->danger();
From d07dc3b95dde350493d92c5c014d52aa9f064da5 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Wed, 24 May 2023 18:53:36 +0200
Subject: [PATCH 10/16] make users sort- and filterable
---
app/Filament/Resources/UserResource.php | 29 +++++++++++++++----------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index 4d126a2..fce09f0 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -6,7 +6,7 @@
use App\Http\Controllers\Client\RegSysClientController;
use App\Models\User;
use Filament\Forms;
-
+use Filament\Forms\Components\Builder;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
@@ -38,9 +38,9 @@ public static function form(Form $form): Form
Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([
Forms\Components\Placeholder::make('packages booked')
- ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
+ ->content(fn (?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
Forms\Components\Placeholder::make('reg status')
- ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
+ ->content(fn (?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
]),
]);
}
@@ -49,18 +49,25 @@ public static function table(Table $table): Table
{
return $table
->columns([
- Tables\Columns\TextColumn::make('reg_id'),
+ Tables\Columns\TextColumn::make('reg_id')
+ ->searchable()
+ ->sortable(),
Tables\Columns\TextColumn::make('identity_id'),
- Tables\Columns\TextColumn::make('name'),
+ Tables\Columns\TextColumn::make('name')
+ ->searchable()
+ ->sortable(),
Tables\Columns\TextColumn::make('email')
- ->url(fn(?User $record) => "mailto:{$record->email}"),
+ ->url(fn (?User $record) => "mailto:{$record->email}")
+ ->searchable(),
Tables\Columns\TextColumn::make('created_at')
- ->dateTime(),
+ ->dateTime()
+ ->sortable(),
Tables\Columns\TextColumn::make('updated_at')
- ->dateTime(),
+ ->dateTime()
+ ->sortable(),
])
->filters([
- //
+ Tables\Filters\Filter::make('reg_id')->query(fn (Builder $query): Builder => $query->whereNull('reg_id'))->label('Missing Reg ID'),
])
->actions([
Tables\Actions\EditAction::make(),
@@ -84,11 +91,9 @@ public static function table(Table $table): Table
$record->reg_id = null;
}
$record->save();
-
}
}),
- ])
- ;
+ ]);
}
public static function getRelations(): array
From ce60cc309adf2aec4a56b7bdaf237e90452700b7 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Wed, 24 May 2023 20:08:20 +0200
Subject: [PATCH 11/16] Move mapping from Application to ApplicationStatus
---
app/Enums/ApplicationStatus.php | 18 ++++++++++++++++++
app/Models/Application.php | 16 +---------------
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/app/Enums/ApplicationStatus.php b/app/Enums/ApplicationStatus.php
index 0fe3481..a0fbfe4 100644
--- a/app/Enums/ApplicationStatus.php
+++ b/app/Enums/ApplicationStatus.php
@@ -11,4 +11,22 @@ enum ApplicationStatus: string
case TableOffered = 'table_offered';
case TableAccepted = 'table_accepted';
case CheckedIn = 'checked_in';
+
+ static function for(\App\Models\Application $application): ApplicationStatus {
+ if (!is_null($application->canceled_at)) {
+ return ApplicationStatus::Canceled;
+ } elseif (!is_null($application->checked_in_at)) {
+ return ApplicationStatus::CheckedIn;
+ } elseif (!is_null($application->waiting_at)) {
+ return ApplicationStatus::Waiting;
+ } elseif (!is_null($application->offer_accepted_at)) {
+ return ApplicationStatus::TableAccepted;
+ } elseif (!is_null($application->offer_sent_at)) {
+ return ApplicationStatus::TableOffered;
+ } elseif (($application->type !== \App\Enums\ApplicationType::Dealer || !is_null($application->table_type_assigned)) && !empty($application->table_number)) {
+ return ApplicationStatus::TableAssigned;
+ } else {
+ return ApplicationStatus::Open;
+ }
+ }
}
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 67e5d9b..d13a1de 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -125,21 +125,7 @@ public function profile() {
public function getStatus()
{
- if (!is_null($this->canceled_at)) {
- return ApplicationStatus::Canceled;
- } elseif (!is_null($this->checked_in_at)) {
- return ApplicationStatus::CheckedIn;
- } elseif (!is_null($this->waiting_at)) {
- return ApplicationStatus::Waiting;
- } elseif (!is_null($this->offer_accepted_at)) {
- return ApplicationStatus::TableAccepted;
- } elseif (!is_null($this->offer_sent_at)) {
- return ApplicationStatus::TableOffered;
- } elseif (($this->type !== ApplicationType::Dealer || !is_null($this->table_type_assigned)) && !empty($this->table_number)) {
- return ApplicationStatus::TableAssigned;
- } else {
- return ApplicationStatus::Open;
- }
+ return ApplicationStatus::for($this);
}
public function isActive()
From 0975c065c49cbcd86a19c942f6e1fa6d9acfadd5 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Wed, 24 May 2023 20:09:02 +0200
Subject: [PATCH 12/16] make more columns for applications sort- and filterable
---
app/Enums/ApplicationStatus.php | 76 +++++++++-
.../Resources/ApplicationResource.php | 130 +++++++++++++-----
2 files changed, 170 insertions(+), 36 deletions(-)
diff --git a/app/Enums/ApplicationStatus.php b/app/Enums/ApplicationStatus.php
index a0fbfe4..a54e0e3 100644
--- a/app/Enums/ApplicationStatus.php
+++ b/app/Enums/ApplicationStatus.php
@@ -12,7 +12,8 @@ enum ApplicationStatus: string
case TableAccepted = 'table_accepted';
case CheckedIn = 'checked_in';
- static function for(\App\Models\Application $application): ApplicationStatus {
+ static function for(\App\Models\Application $application): ApplicationStatus
+ {
if (!is_null($application->canceled_at)) {
return ApplicationStatus::Canceled;
} elseif (!is_null($application->checked_in_at)) {
@@ -29,4 +30,77 @@ static function for(\App\Models\Application $application): ApplicationStatus {
return ApplicationStatus::Open;
}
}
+
+ function orWhere(\Illuminate\Database\Eloquent\Builder $query)
+ {
+ return match ($this) {
+ ApplicationStatus::Canceled => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '!=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '=', null)
+ ->where('waiting_at', '=', null)
+ ),
+ ApplicationStatus::CheckedIn => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '!=', null)
+ ),
+ ApplicationStatus::Open => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '=', null)
+ ->where('waiting_at', '=', null)
+ ->where(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->orWhere('table_number', '=', null)
+ ->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('table_type_assigned', '=', null)
+ ->where('type', '=', \App\Enums\ApplicationType::Dealer->value)
+ )
+ )
+ ),
+ ApplicationStatus::TableAccepted => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '!=', null)
+ ->where('waiting_at', '=', null)
+ ),
+ ApplicationStatus::TableAssigned => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '=', null)
+ ->where('waiting_at', '=', null)
+ ->where('table_number', '!=', null)
+ ->where(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->orWhere('table_type_assigned', '!=', null)
+ ->orWhere('type', '!=', \App\Enums\ApplicationType::Dealer->value)
+ )
+ ),
+ ApplicationStatus::TableOffered => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '!=', null)
+ ->where('waiting_at', '=', null)
+ ),
+ ApplicationStatus::Waiting => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '=', null)
+ ->where('waiting_at', '!=', null)
+ ),
+ };
+ }
}
diff --git a/app/Filament/Resources/ApplicationResource.php b/app/Filament/Resources/ApplicationResource.php
index e3e69e7..788bd44 100755
--- a/app/Filament/Resources/ApplicationResource.php
+++ b/app/Filament/Resources/ApplicationResource.php
@@ -108,36 +108,66 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('id')->label("ID"),
- Tables\Columns\TextColumn::make('user.name')->searchable(),
- Tables\Columns\BadgeColumn::make('status')->enum(ApplicationStatus::cases())->formatStateUsing(function (Application $record) {
- return $record->status->name;
- })->colors([
- 'secondary',
- 'success' => ApplicationStatus::TableAccepted->value,
- 'danger' => ApplicationStatus::Canceled->value
- ]),
- Tables\Columns\TextColumn::make('requestedTable.name')->icon(fn($record) => $record->type === ApplicationType::Dealer && $record->table_type_requested !== $record->table_type_assigned ? 'heroicon-o-exclamation' : '')->iconPosition('after')->color(fn($record) => $record->type === ApplicationType::Dealer && $record->table_type_requested !== $record->table_type_assigned ? 'warning' : ''),
- Tables\Columns\SelectColumn::make('tableTypeAssignedAutoNull')->label('Assigned table')->options(TableType::pluck('name', 'id')->toArray()),
- Tables\Columns\TextColumn::make('type')->formatStateUsing(function (string $state) {
- return ucfirst($state);
- })->sortable(),
- Tables\Columns\TextInputColumn::make('table_number')->sortable()->searchable(),
- Tables\Columns\IconColumn::make('is_ready')->label('Ready')->getStateUsing(function (Application $record) {
- return $record->isReady();
- })->boolean(),
- Tables\Columns\TextColumn::make('dlrshp')->getStateUsing(function (Application $record) {
- return $record->parent ?: $record->id;
- })->sortable(query: function (Builder $query, string $direction): Builder {
- return $query
- ->orderBy(DB::raw('IF(`type` = \'dealer\', `id`,`parent`)'), $direction);
- })->searchable(query: function (Builder $query, string $search): Builder {
- return $query
- ->where('id', '=', $search)
- ->orWhere('parent', '=', $search);
- }),
- Tables\Columns\TextColumn::make('display_name')->searchable(),
- Tables\Columns\IconColumn::make('wanted_neighbors')->label('N Wanted')->default(false)->boolean(),
- Tables\Columns\IconColumn::make('comment')->default(false)->boolean(),
+ Tables\Columns\TextColumn::make('user.name')
+ ->searchable(),
+ Tables\Columns\BadgeColumn::make('status')
+ ->enum(ApplicationStatus::cases())
+ ->formatStateUsing(function (Application $record) {
+ return $record->status->name;
+ })
+ ->colors([
+ 'secondary',
+ 'success' => ApplicationStatus::TableAccepted->value,
+ 'danger' => ApplicationStatus::Canceled->value
+ ]),
+ Tables\Columns\TextColumn::make('requestedTable.name')
+ ->icon(fn ($record) => $record->type === ApplicationType::Dealer && $record->table_type_requested !== $record->table_type_assigned ? 'heroicon-o-exclamation' : '')
+ ->iconPosition('after')
+ ->color(fn ($record) => $record->type === ApplicationType::Dealer && $record->table_type_requested !== $record->table_type_assigned ? 'warning' : '')
+ ->sortable(),
+ Tables\Columns\SelectColumn::make('tableTypeAssignedAutoNull')
+ ->label('Assigned table')
+ ->options(TableType::pluck('name', 'id')->toArray())
+ ->sortable(query: function (Builder $query, string $direction): Builder {
+ return $query
+ ->orderBy('table_type_assigned', $direction);
+ }),
+ Tables\Columns\TextColumn::make('type')
+ ->formatStateUsing(function (string $state) {
+ return ucfirst($state);
+ })
+ ->sortable(),
+ Tables\Columns\TextInputColumn::make('table_number')
+ ->sortable()
+ ->searchable(),
+ Tables\Columns\IconColumn::make('is_ready')
+ ->label('Ready')
+ ->getStateUsing(function (Application $record) {
+ return $record->isReady();
+ })
+ ->boolean(),
+ Tables\Columns\TextColumn::make('dlrshp')
+ ->getStateUsing(function (Application $record) {
+ return $record->parent ?: $record->id;
+ })
+ ->sortable(query: function (Builder $query, string $direction): Builder {
+ return $query
+ ->orderBy(DB::raw('IF(`type` = \'dealer\', `id`,`parent`)'), $direction);
+ })
+ ->searchable(query: function (Builder $query, string $search): Builder {
+ return $query
+ ->where('id', '=', $search)
+ ->orWhere('parent', '=', $search);
+ }),
+ Tables\Columns\TextColumn::make('display_name')
+ ->searchable(),
+ Tables\Columns\IconColumn::make('wanted_neighbors')
+ ->label('N Wanted')
+ ->default(false)
+ ->boolean(),
+ Tables\Columns\IconColumn::make('comment')
+ ->default(false)
+ ->boolean(),
Tables\Columns\IconColumn::make('is_afterdark')
->label('AD')
->sortable()
@@ -154,11 +184,41 @@ public static function table(Table $table): Table
->dateTime(),
])
->filters([
- Tables\Filters\Filter::make('parent')->query(fn (Builder $query): Builder => $query->where('type', 'dealer'))->label('Only Dealerships'),
- Tables\Filters\Filter::make('assignedTable')->query(fn (Builder $query): Builder => $query->whereNull('table_type_assigned'))->label('Missing assigned table'),
- Tables\Filters\Filter::make('table_number')->query(fn (Builder $query): Builder => $query->whereNull('table_number'))->label('Missing table number'),
- Tables\Filters\Filter::make('is_afterdark')->query(fn (Builder $query): Builder => $query->where('is_afterdark', '=', '1'))->label('Is Afterdark'),
- Tables\Filters\Filter::make('table_assigned')->query(fn (Builder $query): Builder => $query->whereNotNull('offer_sent_at'))->label('Table assigned'),
+ Tables\Filters\Filter::make('parent')
+ ->query(fn (Builder $query): Builder => $query->where('type', 'dealer'))
+ ->label('Only Dealerships'),
+ Tables\Filters\Filter::make('assignedTable')
+ ->query(fn (Builder $query): Builder => $query->whereNull('table_type_assigned'))
+ ->label('Missing assigned table'),
+ Tables\Filters\Filter::make('table_number')
+ ->query(fn (Builder $query): Builder => $query->whereNull('table_number'))
+ ->label('Missing table number'),
+ Tables\Filters\Filter::make('is_afterdark')
+ ->query(fn (Builder $query): Builder => $query->where('is_afterdark', '=', '1'))
+ ->label('Is Afterdark'),
+ Tables\Filters\Filter::make('table_assigned')
+ ->query(fn (Builder $query): Builder => $query->whereNotNull('offer_sent_at'))
+ ->label('Table assigned'),
+ Tables\Filters\SelectFilter::make('requestedTable')
+ ->relationship('requestedTable', 'name')
+ ->multiple(),
+ Tables\Filters\SelectFilter::make('assignedTable')
+ ->relationship('assignedTable', 'name')
+ ->multiple(),
+ Tables\Filters\SelectFilter::make('status')
+ ->options(array_combine(array_column(ApplicationStatus::cases(), 'value'), array_column(ApplicationStatus::cases(), 'name')))
+ ->query(function (Builder $query, array $data) {
+ \Illuminate\Support\Facades\Log::debug(print_r($data, true));
+ if (!key_exists('values', $data)) {
+ return;
+ }
+ $query->where(function (Builder $query) use ($data) {
+ foreach ($data['values'] as $value) {
+ ApplicationStatus::tryFrom($value)?->orWhere($query);
+ }
+ });
+ })
+ ->multiple(),
])
->actions([
Tables\Actions\EditAction::make(),
From dd9bbe1903380770611c4a0b761af46fde2046e9 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Wed, 24 May 2023 20:13:35 +0200
Subject: [PATCH 13/16] fix application status filter by syncing rules
---
app/Enums/ApplicationStatus.php | 48 +++++++++++++++------------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/app/Enums/ApplicationStatus.php b/app/Enums/ApplicationStatus.php
index a54e0e3..2a3fc7f 100644
--- a/app/Enums/ApplicationStatus.php
+++ b/app/Enums/ApplicationStatus.php
@@ -37,47 +37,40 @@ function orWhere(\Illuminate\Database\Eloquent\Builder $query)
ApplicationStatus::Canceled => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '!=', null)
- ->where('checked_in_at', '=', null)
- ->where('offer_accepted_at', '=', null)
- ->where('offer_sent_at', '=', null)
- ->where('waiting_at', '=', null)
),
ApplicationStatus::CheckedIn => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '=', null)
->where('checked_in_at', '!=', null)
),
- ApplicationStatus::Open => $query->orWhere(
+ ApplicationStatus::Waiting => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '=', null)
->where('checked_in_at', '=', null)
- ->where('offer_accepted_at', '=', null)
- ->where('offer_sent_at', '=', null)
- ->where('waiting_at', '=', null)
- ->where(
- fn (\Illuminate\Database\Eloquent\Builder $query) =>
- $query->orWhere('table_number', '=', null)
- ->orWhere(
- fn (\Illuminate\Database\Eloquent\Builder $query) =>
- $query->where('table_type_assigned', '=', null)
- ->where('type', '=', \App\Enums\ApplicationType::Dealer->value)
- )
- )
+ ->where('waiting_at', '!=', null)
),
ApplicationStatus::TableAccepted => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '=', null)
->where('checked_in_at', '=', null)
+ ->where('waiting_at', '=', null)
->where('offer_accepted_at', '!=', null)
+ ),
+ ApplicationStatus::TableOffered => $query->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('canceled_at', '=', null)
+ ->where('checked_in_at', '=', null)
->where('waiting_at', '=', null)
+ ->where('offer_accepted_at', '=', null)
+ ->where('offer_sent_at', '!=', null)
),
ApplicationStatus::TableAssigned => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '=', null)
->where('checked_in_at', '=', null)
+ ->where('waiting_at', '=', null)
->where('offer_accepted_at', '=', null)
->where('offer_sent_at', '=', null)
- ->where('waiting_at', '=', null)
->where('table_number', '!=', null)
->where(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
@@ -85,21 +78,22 @@ function orWhere(\Illuminate\Database\Eloquent\Builder $query)
->orWhere('type', '!=', \App\Enums\ApplicationType::Dealer->value)
)
),
- ApplicationStatus::TableOffered => $query->orWhere(
+ ApplicationStatus::Open => $query->orWhere(
fn (\Illuminate\Database\Eloquent\Builder $query) =>
$query->where('canceled_at', '=', null)
->where('checked_in_at', '=', null)
- ->where('offer_accepted_at', '=', null)
- ->where('offer_sent_at', '!=', null)
->where('waiting_at', '=', null)
- ),
- ApplicationStatus::Waiting => $query->orWhere(
- fn (\Illuminate\Database\Eloquent\Builder $query) =>
- $query->where('canceled_at', '=', null)
- ->where('checked_in_at', '=', null)
->where('offer_accepted_at', '=', null)
->where('offer_sent_at', '=', null)
- ->where('waiting_at', '!=', null)
+ ->where(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->orWhere('table_number', '=', null)
+ ->orWhere(
+ fn (\Illuminate\Database\Eloquent\Builder $query) =>
+ $query->where('table_type_assigned', '=', null)
+ ->where('type', '=', \App\Enums\ApplicationType::Dealer->value)
+ )
+ )
),
};
}
From a5578f7c19c96d2d33ae0754eeb32c884cfaae58 Mon Sep 17 00:00:00 2001
From: Fenrikur <3359222+Fenrikur@users.noreply.github.com>
Date: Wed, 24 May 2023 20:28:04 +0200
Subject: [PATCH 14/16] fix filter users for missing reg id
---
app/Filament/Resources/UserResource.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index fce09f0..f974ba6 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -6,11 +6,11 @@
use App\Http\Controllers\Client\RegSysClientController;
use App\Models\User;
use Filament\Forms;
-use Filament\Forms\Components\Builder;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
+use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
class UserResource extends Resource
From 9a15a01b3e08fc24f5d4b41f69a97799d9454d2c Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 24 May 2023 22:37:04 +0200
Subject: [PATCH 15/16] Added application relation to user and profile
---
app/Filament/Resources/ProfileResource.php | 10 ++--
.../ApplicationRelationManager.php | 55 +++++++++++++++++++
app/Filament/Resources/UserResource.php | 11 ++--
.../ApplicationRelationManager.php | 55 +++++++++++++++++++
4 files changed, 120 insertions(+), 11 deletions(-)
create mode 100644 app/Filament/Resources/ProfileResource/RelationManagers/ApplicationRelationManager.php
create mode 100644 app/Filament/Resources/UserResource/RelationManagers/ApplicationRelationManager.php
diff --git a/app/Filament/Resources/ProfileResource.php b/app/Filament/Resources/ProfileResource.php
index 19fa97b..a65551a 100644
--- a/app/Filament/Resources/ProfileResource.php
+++ b/app/Filament/Resources/ProfileResource.php
@@ -10,8 +10,6 @@
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
-use Illuminate\Database\Eloquent\Builder;
-use Illuminate\Database\Eloquent\SoftDeletingScope;
class ProfileResource extends Resource
{
@@ -47,21 +45,21 @@ public static function form(Form $form): Form
->imageResizeTargetWidth('60')
->imageResizeTargetHeight('60'),
Forms\Components\Textarea::make('short_desc')
- ->maxLength(1024),
+ ->maxLength(1024),
Forms\Components\FileUpload::make('image_artist')
->image()
->imageResizeMode('force')
->imageResizeTargetWidth('400')
->imageResizeTargetHeight('400'),
Forms\Components\Textarea::make('artist_desc')
- ->maxLength(2048),
+ ->maxLength(2048),
Forms\Components\FileUpload::make('image_art')
->image()
->imageResizeMode('force')
->imageResizeTargetWidth('400')
->imageResizeTargetHeight('450'),
Forms\Components\Textarea::make('art_desc')
- ->maxLength(2048),
+ ->maxLength(2048),
]),
]),
@@ -134,7 +132,7 @@ public static function table(Table $table): Table
public static function getRelations(): array
{
return [
- //
+ RelationManagers\ApplicationRelationManager::class
];
}
diff --git a/app/Filament/Resources/ProfileResource/RelationManagers/ApplicationRelationManager.php b/app/Filament/Resources/ProfileResource/RelationManagers/ApplicationRelationManager.php
new file mode 100644
index 0000000..44f6bb3
--- /dev/null
+++ b/app/Filament/Resources/ProfileResource/RelationManagers/ApplicationRelationManager.php
@@ -0,0 +1,55 @@
+columns([
+ Tables\Columns\TextColumn::make('type'),
+ Tables\Columns\BadgeColumn::make('status')->enum(ApplicationStatus::cases())->formatStateUsing(function (Application $record) {
+ return $record->status->name;
+ })->colors([
+ 'secondary',
+ 'success' => ApplicationStatus::TableAccepted->value,
+ 'danger' => ApplicationStatus::Canceled->value
+ ]),
+ Tables\Columns\TextColumn::make('requestedTable.name'),
+ Tables\Columns\TextColumn::make('assignedTable.name'),
+ Tables\Columns\TextColumn::make('table_number')
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(Application $record): string => ApplicationResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/UserResource.php b/app/Filament/Resources/UserResource.php
index f974ba6..0aa49ba 100644
--- a/app/Filament/Resources/UserResource.php
+++ b/app/Filament/Resources/UserResource.php
@@ -3,6 +3,7 @@
namespace App\Filament\Resources;
use App\Filament\Resources\UserResource\Pages;
+use App\Filament\Resources\UserResource\RelationManagers;
use App\Http\Controllers\Client\RegSysClientController;
use App\Models\User;
use Filament\Forms;
@@ -38,9 +39,9 @@ public static function form(Form $form): Form
Forms\Components\Fieldset::make('Reg status')->inlineLabel()->columns(1)->schema([
Forms\Components\Placeholder::make('packages booked')
- ->content(fn (?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
+ ->content(fn(?User $record): string => implode(RegSysClientController::getPackages($record->reg_id)) ?? ''),
Forms\Components\Placeholder::make('reg status')
- ->content(fn (?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
+ ->content(fn(?User $record): string => RegSysClientController::getSingleReg($record->reg_id)['status'] ?? ''),
]),
]);
}
@@ -57,7 +58,7 @@ public static function table(Table $table): Table
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email')
- ->url(fn (?User $record) => "mailto:{$record->email}")
+ ->url(fn(?User $record) => "mailto:{$record->email}")
->searchable(),
Tables\Columns\TextColumn::make('created_at')
->dateTime()
@@ -67,7 +68,7 @@ public static function table(Table $table): Table
->sortable(),
])
->filters([
- Tables\Filters\Filter::make('reg_id')->query(fn (Builder $query): Builder => $query->whereNull('reg_id'))->label('Missing Reg ID'),
+ Tables\Filters\Filter::make('reg_id')->query(fn(Builder $query): Builder => $query->whereNull('reg_id'))->label('Missing Reg ID'),
])
->actions([
Tables\Actions\EditAction::make(),
@@ -99,7 +100,7 @@ public static function table(Table $table): Table
public static function getRelations(): array
{
return [
- // new ChildrenRelationManager()
+ RelationManagers\ApplicationRelationManager::class
];
}
diff --git a/app/Filament/Resources/UserResource/RelationManagers/ApplicationRelationManager.php b/app/Filament/Resources/UserResource/RelationManagers/ApplicationRelationManager.php
new file mode 100644
index 0000000..015fd44
--- /dev/null
+++ b/app/Filament/Resources/UserResource/RelationManagers/ApplicationRelationManager.php
@@ -0,0 +1,55 @@
+columns([
+ Tables\Columns\TextColumn::make('type'),
+ Tables\Columns\BadgeColumn::make('status')->enum(ApplicationStatus::cases())->formatStateUsing(function (Application $record) {
+ return $record->status->name;
+ })->colors([
+ 'secondary',
+ 'success' => ApplicationStatus::TableAccepted->value,
+ 'danger' => ApplicationStatus::Canceled->value
+ ]),
+ Tables\Columns\TextColumn::make('requestedTable.name'),
+ Tables\Columns\TextColumn::make('assignedTable.name'),
+ Tables\Columns\TextColumn::make('table_number')
+ ])
+ ->filters([
+ //
+ ])
+ ->headerActions([
+ ])
+ ->actions([
+ Tables\Actions\Action::make('Show')
+ ->url(fn(Application $record): string => ApplicationResource::getUrl('edit', ['record' => $record])),
+
+ ])
+ ->bulkActions([
+ ]);
+ }
+}
From 75f45dd78d4c7f113488aa18c327cb2698200a85 Mon Sep 17 00:00:00 2001
From: JulSteele <20680187+julsteele@users.noreply.github.com>
Date: Wed, 24 May 2023 23:36:21 +0200
Subject: [PATCH 16/16] Fixed image export, 2nd try
---
app/Http/Controllers/ProfileController.php | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index e10e613..f11ecf2 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -180,16 +180,15 @@ public function exportImages()
$zip = new ZipArchive;
- if (true === ($zip->open(public_path('storage/profileImages.zip'), ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
- foreach (Storage::allFiles('public') as $file) {
+ if (true === ($zip->open('profileImages.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE))) {
+ foreach (Storage::allFiles() as $file) {
$name = basename($file);
if ($name !== '.gitignore' && $name !== 'profileImages.zip') {
- $zip->addFile(public_path('storage/' . $name), $name);
+ $zip->addFile(Storage::path($name), $name);
}
}
$zip->close();
}
-
- return response()->download(public_path('storage/profileImages.zip'), 'profileImages.zip');
+ return Storage::download('profileImages.zip');
}
}