Skip to content

mep | merge develop into main #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0f44358
feat:[lar-163] translate page and remove unused files
cybersoldattech Dec 27, 2024
10654ce
fix:[lar-163] restore feeds file
cybersoldattech Dec 27, 2024
6cec17e
feat:[lar-163] translate page and remove unused files (#282)
cybersoldattech Dec 27, 2024
c602a48
feat:[lar-156] Add lazy loading in img
cybersoldattech Dec 30, 2024
baa04d2
feat:[lar-156] Add lazy loading in img
cybersoldattech Dec 30, 2024
082a20b
fix: (LAR-154) fixing bug when displaying user thread suscription
StevyMarlino Dec 30, 2024
e74d1f4
chore(deps): bump stefanzweifel/git-auto-commit-action from 4 to 5 (#…
dependabot[bot] Dec 30, 2024
8086d59
chore(deps): bump actions/checkout from 3 to 4 (#284)
dependabot[bot] Dec 30, 2024
441ee73
feat:[lar-156] Add lazy loading in img (#286)
cybersoldattech Dec 30, 2024
aa3ab10
fix: (LAR-154) fixing bug when displaying user thread suscription (#287)
StevyMarlino Dec 30, 2024
56b789d
feat: (LAR-157) add bulk deletion for banned user
StevyMarlino Dec 31, 2024
d9074e8
feat: [LAR-164] add filament mails logger (#288)
mckenziearts Dec 31, 2024
87133d0
feat:[lar-158] add creation date in article resouce
cybersoldattech Jan 1, 2025
b45ebac
feat: [LAR-164] add filament mails logger (#288)
mckenziearts Dec 31, 2024
5d1f6b9
feat:[lar-158] add creation date in article resource (#290)
cybersoldattech Jan 1, 2025
abf60ae
feat: [LAR-150] add forum leaderboard page (#289)
mckenziearts Jan 1, 2025
4599c9a
chore: [LAR-168] fix layout of leaderboard when user is guest (#291)
mckenziearts Jan 1, 2025
16991c1
fix: (LAR-157) fixing lint
StevyMarlino Jan 2, 2025
0b8de84
Feature/lar 157 admin rajouter un bulk banned users (#294)
StevyMarlino Jan 2, 2025
53ff277
fix: [LAR-172] article and discussion single page preview for seo (#295)
mckenziearts Jan 2, 2025
e9b058f
fix: [LAR-177] current locale bug (#299)
mckenziearts Jan 3, 2025
a1e797b
feat: update composer.lock
mckenziearts Jan 3, 2025
17ee875
Merge branch 'main' into develop
mckenziearts Jan 3, 2025
2d9791f
chore: update composer lock file
mckenziearts Jan 3, 2025
5037ff7
fix:[lar-169] mail bug for ThreadConverted
cybersoldattech Jan 4, 2025
36f1939
fix:[lar-179] hash password in register and add wire loading (#304)
cybersoldattech Jan 4, 2025
6116ca4
feat:(LAR-171) BO add Stat in dashboard
StevyMarlino Jan 4, 2025
3305f12
fix:(LAR-171) fixing composer fail error
StevyMarlino Jan 4, 2025
94f0a7c
fix:[lar-169] mail bug for ThreadConverted (#303)
cybersoldattech Jan 5, 2025
2640c3c
refact: (LAR-171) refactoring of lang en => fr
StevyMarlino Jan 5, 2025
970a351
feat:(LAR-171) BO add Stat in dashboard (#306)
StevyMarlino Jan 5, 2025
c2be337
feat:[LAR-171] limit number of article
StevyMarlino Jan 5, 2025
c59da67
feat:[LAR-171] add option to display graph
StevyMarlino Jan 5, 2025
4b7fd78
feat:[LAR-171] limit number of article (#307)
StevyMarlino Jan 5, 2025
ba0e460
fix:[lar-181] fix article mobile view
cybersoldattech Jan 5, 2025
8b44f21
fix:[lar-181] fix article mobile view (#308)
cybersoldattech Jan 5, 2025
0e2ccaa
feat: (LAR-157) add bulk deletion for banned user
StevyMarlino Dec 31, 2024
e4ef545
fix: (LAR-157) fixing lint
StevyMarlino Jan 2, 2025
8fe268b
feat [lar-159] format status column in article
cybersoldattech Jan 2, 2025
4137364
feature:(LAR-159) display badge in colum status
StevyMarlino Jan 5, 2025
83ce90f
feat:(LAR-159) BO add badge status to approbation
StevyMarlino Jan 5, 2025
3006d75
feat [lar-159] format status column in article (#296)
StevyMarlino Jan 5, 2025
96ab635
fix:[lar-183] Detele thread in dashboard
cybersoldattech Jan 7, 2025
aaf76d4
fix:[lar-183] Detele thread in dashboard (#311)
StevyMarlino Jan 7, 2025
f5b692c
feat:(LAR-180) ajout des reaction et scroll sur article
StevyMarlino Jan 7, 2025
81f3e9f
feat:(LAR-180) update paginate article
StevyMarlino Jan 8, 2025
b46c1c1
feat:(LAR-180) ajout des réactions et scroll sur article (#312)
StevyMarlino Jan 8, 2025
c84a93d
feat:(LAR-165) add filter to thread
StevyMarlino Jan 8, 2025
d2e7a73
feat:(LAR-165) add filter for popular topics (#314)
StevyMarlino Jan 8, 2025
8892e5e
feat:[lar-152] send Sponsoring Thanks Mail
cybersoldattech Jan 8, 2025
e49229e
feat:[lar-152] remove attachment function and refactor php doc variable
cybersoldattech Jan 8, 2025
0efc64d
Feature/lar 152 sponsoring thanks mail (#313)
cybersoldattech Jan 8, 2025
af32481
fix:lar-178 profile link
cybersoldattech Jan 9, 2025
f722650
fix:lar-178 profile link (#316)
cybersoldattech Jan 9, 2025
1f209f7
chore(deps): update doctrine/dbal requirement from ^3.6.4 to ^4.2.1 (…
dependabot[bot] Jan 11, 2025
b7b50b3
Feature/add security header (#319)
mckenziearts Jan 11, 2025
b30679b
chore: update dependencies
mckenziearts Jan 11, 2025
aabc17a
chore: delete package-lock and remove composer.lock from .gitignore
mckenziearts Jan 11, 2025
c90229c
chore(deps): bump vormkracht10/filament-mails from 1.0.5 to 2.0.1 (#301)
dependabot[bot] Jan 11, 2025
f2203f4
fix:[lar-180] fix style in profile questions tabs (#317)
cybersoldattech Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions app/Filament/Resources/ArticleResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use App\Actions\Article\ApprovedArticleAction;
use App\Filament\Resources\ArticleResource\Pages;
use App\Models\Article;
use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;
use Filament\Resources\Resource;
use Filament\Support\Enums\MaxWidth;
use Filament\Tables;
Expand Down Expand Up @@ -67,16 +69,38 @@ public static function table(Table $table): Table
->label('Soumission')
->placeholder('N/A')
->date(),
Tables\Columns\TextColumn::make('approved_at')
->label('Approbation')
->placeholder('N/A')
->date()
->toggleable(),
Tables\Columns\TextColumn::make('declined_at')
->label('Décliner')
->placeholder('N/A')
->date()
->toggleable(isToggledHiddenByDefault: true),
BadgeableColumn::make('status')
->label('Statut')
->getStateUsing(function ($record) {
if ($record->approved_at) {
return $record->approved_at->format('d/m/Y');
}

if ($record->declined_at) {
return $record->declined_at->format('d/m/Y');
}

return '';
})
->prefixBadges(function ($record) {
if ($record->approved_at) {
return [
Badge::make('Approuvé')
->color('success'),
];
}

if ($record->declined_at) {
return [
Badge::make('Décliné')
->color('danger'),
];
}

return '';
})
->searchable()
->sortable(),
])
->actions([
ActionGroup::make([
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ArticleResource\Widgets;

use App\Models\Article;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Flowframe\Trend\Trend;
use Flowframe\Trend\TrendValue;

final class ArticleStatsOverview extends BaseWidget
{
protected static ?string $pollingInterval = null;

protected ?string $heading = 'Article';

protected function getColumns(): int
{
return 2;
}

protected function getStats(): array
{
$currentWeekStart = now()->startOfWeek();
$currentWeekEnd = now()->endOfWeek();

return [
Stat::make('Total Article', Article::query()->published()->count())
->icon('heroicon-o-newspaper')
->chart(
Trend::query(Article::query()->published())
->between(
start: $currentWeekStart,
end: $currentWeekEnd,
)->perDay()
->count()
->map(fn (TrendValue $value) => $value->aggregate)->toArray()
)->description(__('Total des articles postés')),

Stat::make(
'Article récent publié',
Article::query()
->recent()
->whereBetween('created_at', [
$currentWeekStart,
$currentWeekEnd,
])->count()
)
->chart(
Trend::query(Article::query())
->between(
start: $currentWeekStart,
end: $currentWeekEnd,
)
->perDay()
->count()
->map(fn (TrendValue $value) => $value->aggregate)
->toArray()
)->icon('heroicon-o-newspaper')
->color('primary')
->description('Total des articles Postés de la semaine'),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ArticleResource\Widgets;

use App\Models\Article;
use Filament\Widgets\ChartWidget;
use Illuminate\Support\Str;

final class MostLikedPostsChart extends ChartWidget
{
protected static ?string $heading = 'Article le plus aimé';

protected static ?string $maxHeight = '200px';

protected int|string|array $columnSpan = 'full';

protected int $titleLength = 30;

protected function getData(): array
{
$articles = Article::published()
->popular()
->limit(10)
->get();

return [
'datasets' => [
[
'label' => 'Total aimé',
'data' => $articles->pluck('reactions_count')->toArray(),
],
],
'labels' => $articles->pluck('title')
->map(fn ($title) => Str::limit($title, $this->titleLength, '...'))
->toArray(),
];
}

protected function getType(): string
{
return 'bar';
}

protected function getOptions(): array
{
return [
'scales' => [
'y' => [
'beginAtZero' => true,
],
],
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\ArticleResource\Widgets;

use App\Models\Article;
use CyrildeWit\EloquentViewable\Support\Period;
use Filament\Widgets\ChartWidget;
use Illuminate\Support\Str;

final class MostViewedPostsChart extends ChartWidget
{
protected static ?string $heading = 'Article le plus vu cette semaine';

protected static ?string $maxHeight = '200px';

protected int|string|array $columnSpan = 'full';

protected int $titleLength = 10;

protected function getData(): array
{
$articles = Article::withViewsCount(Period::create(now()->startOfWeek(), now()->endOfWeek())) // @phpstan-ignore-line
->published()
->orderByDesc('views_count')
->orderByDesc('published_at')
->limit(10)
->get();

return [
'datasets' => [
[
'label' => 'Article le plus vu',
'data' => $articles->pluck('views_count')->toArray(),
],
],
'labels' => $articles->pluck('title')
->map(fn ($title) => Str::limit($title, $this->titleLength, '...'))
->toArray(),
];
}

protected function getType(): string
{
return 'bar';
}
}
34 changes: 33 additions & 1 deletion app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function table(Table $table): Table
->placeholder('N/A')
->date(),
Tables\Columns\TextColumn::make(name: 'created_at')
->label(__('use.inscription'))
->label(__('user.inscription'))
->date(),
])
->filters([
Expand Down Expand Up @@ -115,6 +115,38 @@ public static function table(Table $table): Table
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\BulkAction::make('delete_banned')
->label(__('Supprimer les utilisateurs bannis'))
->icon('heroicon-o-trash')
->color('danger')
->action(function ($records): void {

$bannedUsers = $records->whereNotNull('banned_at');

if ($bannedUsers->isEmpty()) {
Notification::make()
->warning()
->title(__('actions.delete_none'))
->duration(5000)
->body(__('actions.delete_none_description'))
->send();

return;
}

$bannedUsers->each(function (User $user): void {
$user->delete();
});

Notification::make()
->success()
->title(__('actions.delete_success'))
->duration(5000)
->body(__('actions.delete_success_description'))
->send();
})
->requiresConfirmation()
->deselectRecordsAfterCompletion(),
]);
}

Expand Down
2 changes: 0 additions & 2 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public function getTabs(): array
'all' => Tab::make(__('global.all')),
'banned' => Tab::make(__('global.banned'))
->modifyQueryUsing(fn ($query) => $query->isBanned()),
'unbanned' => Tab::make(__('global.unbanned'))
->modifyQueryUsing(fn ($query) => $query->isNotBanned()),
];
}
}
58 changes: 58 additions & 0 deletions app/Filament/Resources/UserResource/Widgets/UserActivityWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

declare(strict_types=1);

namespace App\Filament\Resources\UserResource\Widgets;

use App\Models\User;
use Filament\Widgets\ChartWidget;
use Illuminate\Database\Eloquent\Builder;

final class UserActivityWidget extends ChartWidget
{
protected static ?string $heading = 'Les utilisateurs les plus actifs cette semaine';

protected int|string|array $columnSpan = 'full';

protected static ?string $maxHeight = '200px';

protected function getData(): array
{
$users = User::with('activities')
->withCount('activities')
->verifiedUsers()
->whereHas('activities', fn (Builder $query) => $query->whereBetween('created_at', [
now()->startOfWeek(),
now()->endOfWeek(),
]))
->orderByDesc('activities_count')
->limit(10)
->get();

return [
'datasets' => [
[
'label' => 'Total des activités',
'data' => $users->pluck('activities_count')->toArray(),
],
],
'labels' => $users->pluck('name')->toArray(),
];
}

protected function getType(): string
{
return 'bar';
}

protected function getOptions(): array
{
return [
'scales' => [
'y' => [
'beginAtZero' => true,
],
],
];
}
}
Loading
Loading