Fix multiple issues and enhance templates

This commit is contained in:
DariusIII
2025-10-26 22:12:10 +01:00
parent 4f5b3bacc2
commit 1c5d75f104
76 changed files with 3043 additions and 918 deletions
@@ -3,7 +3,6 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\BasePageController;
use App\Jobs\SendAccountChangedEmail;
use App\Models\Invitation;
use App\Models\User;
use Illuminate\Http\RedirectResponse;
@@ -153,12 +152,18 @@ class AdminUserController extends BasePageController
if ($request->input('password') !== null) {
User::updatePassword($editedUser->id, $request->input('password'));
}
if ($request->input('rolechangedate') !== null) {
User::updateUserRoleChangeDate($editedUser->id, $request->input('rolechangedate'));
// Handle rolechangedate - update if has value, clear if empty
if ($request->has('rolechangedate')) {
$roleChangeDate = $request->input('rolechangedate');
if (! empty($roleChangeDate)) {
User::updateUserRoleChangeDate($editedUser->id, $roleChangeDate);
} else {
// Clear the rolechangedate if empty string is provided
$editedUser->update(['rolechangedate' => null]);
}
}
if ($request->input('role') !== null) {
$editedUser->refresh();
SendAccountChangedEmail::dispatch($editedUser)->onQueue('emails');
}
}