-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleaned up messy code in the conference block
- Loading branch information
Showing
38 changed files
with
664 additions
and
1,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Conference\Blocks; | ||
|
||
use App\Livewire\Block; | ||
use App\Models\Participant; | ||
|
||
class CommitteeBlock extends Block | ||
{ | ||
protected ?string $view = 'conference.blocks.committe-block'; | ||
|
||
protected ?int $sort = 4; | ||
|
||
protected string $name = 'Committee Block'; | ||
|
||
protected ?string $position = 'right'; | ||
|
||
public function getViewData(): array | ||
{ | ||
$participants = Participant::with('positions') | ||
->whereHas('positions', function ($query) { | ||
// Filter participants to include only those with 'committee' type positions. | ||
$query->where('type', 'committee'); | ||
}) | ||
->orderBy('order_column') // Order the retrieved data by the 'order_column'. | ||
->take(3) // Limit the query to retrieve only 3 participants. | ||
->get(); | ||
|
||
|
||
|
||
return [ | ||
// Return the organized data with committee positions as keys and arrays of participants as values. | ||
'participants' => $participants | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/Website/Blocks/MenuBlock.php → app/Conference/Blocks/MenuBlock.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Conference\Blocks; | ||
|
||
use App\Livewire\Block; | ||
use App\Models\Conference; | ||
use App\Models\Enums\ConferenceStatus; | ||
|
||
class PreviousBlock extends Block | ||
{ | ||
protected ?string $view = 'conference.blocks.previous-block'; | ||
|
||
protected ?int $sort = 3; | ||
|
||
protected string $name = 'Previous Block'; | ||
|
||
protected ?string $position = 'left'; | ||
|
||
public function getViewData(): array | ||
{ | ||
return [ | ||
'archives' => Conference::where('status', ConferenceStatus::Archived)->get() | ||
]; | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
app/Website/Blocks/SubmitBlock.php → app/Conference/Blocks/SubmitBlock.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Conference\Pages; | ||
|
||
use App\Models\Participant; | ||
use Rahmanramsi\LivewirePageGroup\Pages\Page; | ||
|
||
class Committe extends Page | ||
{ | ||
protected static string $view = 'conference.pages.committe'; | ||
|
||
public function mount() | ||
{ | ||
// | ||
} | ||
|
||
public function getBreadcrumbs(): array | ||
{ | ||
return []; | ||
} | ||
|
||
protected function getViewData(): array | ||
{ | ||
// Retrieve participants with their associated committee positions. | ||
$participants = Participant::with('positions') | ||
->whereHas('positions', function ($query) { | ||
// Filter participants to include only those with 'committee' type positions. | ||
$query->where('type', 'committee'); | ||
}) | ||
->orderBy('order_column') // Order the retrieved data by the 'order_column'. | ||
->get(); | ||
|
||
// Initialize an empty associative array to store organized data. | ||
$groupedData = []; | ||
|
||
// Iterate through each participant and their associated committee positions. | ||
foreach ($participants as $participant) { | ||
foreach ($participant->positions as $position) { | ||
$positionName = $position->name; | ||
if (!isset($groupedData[$positionName])) { | ||
// Create an array for the committee position if it doesn't exist in $groupedData. | ||
$groupedData[$positionName] = []; | ||
} | ||
// Add the participant to the respective committee position in $groupedData. | ||
$groupedData[$positionName][] = $participant; | ||
} | ||
} | ||
|
||
return [ | ||
// Return the organized data with committee positions as keys and arrays of participants as values. | ||
'groupedCommittes' => $groupedData | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Conference\Pages; | ||
|
||
use App\Models\Timeline as ConferenceTimeline; | ||
use Rahmanramsi\LivewirePageGroup\Pages\Page; | ||
|
||
class Timeline extends Page | ||
{ | ||
protected static string $view = 'conference.pages.timeline'; | ||
|
||
public function mount() | ||
{ | ||
// | ||
} | ||
|
||
public function getBreadcrumbs(): array | ||
{ | ||
return []; | ||
} | ||
|
||
protected function getViewData(): array | ||
{ | ||
return [ | ||
'events' => ConferenceTimeline::with('conference') | ||
->where('conference_id', app()->getCurrentConference()?->getKey())->get() | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.