-
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.
Merge pull request #107 from OpenSynergic/1-submission-workflow
Submission Workflow
- Loading branch information
Showing
182 changed files
with
9,617 additions
and
1,427 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
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\Actions\SubmissionFiles; | ||
|
||
use App\Models\SubmissionFileType; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class FilesTypePopulateAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle() | ||
{ | ||
foreach ([ | ||
'Abstract', | ||
'Full Paper', | ||
'Pamflet', | ||
'Poster', | ||
] as $type) { | ||
SubmissionFileType::firstOrCreate([ | ||
'name' => $type, | ||
]); | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/Actions/SubmissionFiles/UploadSubmissionFileAction.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace App\Actions\SubmissionFiles; | ||
|
||
use App\Models\Media; | ||
use App\Models\Submission; | ||
use App\Models\SubmissionFileType; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class UploadSubmissionFileAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Submission $submission, Media $file, string $category, SubmissionFileType $type) | ||
{ | ||
return $submission->submissionFiles()->updateOrCreate([ | ||
'media_id' => $file->getKey() | ||
], [ | ||
'media_id' => $file->getKey(), | ||
'submission_file_type_id' => $type->getKey(), | ||
'category' => $category | ||
]); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace App\Actions\Submissions; | ||
|
||
use App\Models\Enums\SubmissionStatus; | ||
use App\Models\Submission; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class AcceptWithdrawalAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Submission $submission) | ||
{ | ||
SubmissionUpdateAction::run(['status' => SubmissionStatus::Withdrawn], $submission); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace App\Actions\Submissions; | ||
|
||
use App\Models\Submission; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
// This actions is used to reject withdrawal request. | ||
class CancelWithdrawalAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Submission $submission) | ||
{ | ||
SubmissionUpdateAction::run(['withdrawn_reason' => null], $submission); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace App\Actions\Submissions; | ||
|
||
use App\Models\Enums\SubmissionStatus; | ||
use App\Models\Submission; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class RequestWithdrawalAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Submission $submission, ?string $reason = null) | ||
{ | ||
SubmissionUpdateAction::run(['withdrawn_reason' => $reason], $submission); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/Actions/Submissions/SubmissionAssignParticipantAction.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace App\Actions\Submissions; | ||
|
||
use App\Models\Role; | ||
use App\Models\Submission; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\DB; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class SubmissionAssignParticipantAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(Submission $submission, User $user, Role $role) | ||
{ | ||
try { | ||
DB::beginTransaction(); | ||
$submissionParticipant = $submission->participants()->updateOrCreate([ | ||
'user_id' => $user->getKey(), | ||
], [ | ||
'user_id' => $user->getKey(), | ||
'role_id' => $role->getKey(), | ||
]); | ||
DB::commit(); | ||
return $submissionParticipant; | ||
} catch (\Throwable $th) { | ||
DB::rollBack(); | ||
throw $th; | ||
} | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace App\Actions\Submissions; | ||
|
||
use App\Models\Enums\SubmissionStage; | ||
use App\Models\Enums\SubmissionStatus; | ||
use App\Models\Submission; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class UnpublishSubmissionAction | ||
{ | ||
use AsAction; | ||
|
||
// When a submission is unpublished, it should be returned to the latest status, which is editing. | ||
public function handle(Submission $submission) | ||
{ | ||
SubmissionUpdateAction::run([ | ||
'stage' => SubmissionStage::Editing, | ||
'status' => SubmissionStatus::Editing, | ||
], $submission); | ||
} | ||
} |
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,47 @@ | ||
<?php | ||
|
||
namespace App\Actions\User; | ||
|
||
use App\Actions\Participants\ParticipantCreateAction; | ||
use App\Models\Enums\UserRole; | ||
use App\Models\Participant; | ||
use App\Models\ParticipantPosition; | ||
use App\Models\User; | ||
use Lorisleiva\Actions\Concerns\AsAction; | ||
|
||
class CreateParticipantFromUserAction | ||
{ | ||
use AsAction; | ||
|
||
public function handle(User $user) | ||
{ | ||
$userData = $user->toArray(); | ||
|
||
$userData['meta'] = $user->meta()->get() | ||
->mapWithKeys( | ||
fn ($meta) => [$meta->key => $meta->value] | ||
) | ||
->toArray(); | ||
|
||
$participant = Participant::where('email', $user->email)->first(); | ||
|
||
if (!$participant) { | ||
$participant = ParticipantCreateAction::run($userData); | ||
} | ||
|
||
foreach ($user->getRoleNames() as $userRole) { | ||
// Only for Author, Reviewer and Editor | ||
$shouldCreateParticipant = match ($userRole) { | ||
UserRole::Author->value, UserRole::Reviewer->value, UserRole::Editor->value => true, | ||
default => false, | ||
}; | ||
if (!$shouldCreateParticipant) { | ||
continue; | ||
} | ||
$position = ParticipantPosition::where('name', $userRole)->first(); | ||
$participant->positions()->detach($position); | ||
$participant->positions()->attach($position); | ||
} | ||
return $participant; | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace App\Constants; | ||
|
||
final class ReviewerStatus | ||
{ | ||
public const ACCEPTED = 'Accepted'; | ||
|
||
public const DECLINED = 'Declined'; | ||
|
||
public const PENDING = 'Pending'; | ||
|
||
public const CANCELED = 'Canceled'; | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace App\Constants; | ||
|
||
final class SubmissionFileCategory | ||
{ | ||
public const ABSTRACT_FILES = 'abstract-files'; | ||
|
||
public const SUPPLEMENTARY_FILES = 'supplementary-files'; | ||
|
||
public const PAPER_FILES = 'paper-files'; | ||
|
||
public const REVIEWER_FILES = 'reviewer-files'; | ||
|
||
public const REVISION_FILES = 'revision-files'; | ||
|
||
public const REVIEWER_ASSIGNED_FILES = 'reviewer-assigned-files'; | ||
|
||
public const EDITING_DRAFT_FILES = 'editing-draft-files'; | ||
|
||
public const EDITED_FILES = 'edited-files'; | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace App\Constants; | ||
|
||
final class SubmissionStatusRecommendation | ||
{ | ||
public const ACCEPT = 'Accept'; | ||
|
||
public const DECLINE = 'Decline'; | ||
|
||
public const REVISION_REQUIRED = "Revision Required"; | ||
|
||
public static function list() | ||
{ | ||
return [ | ||
static::ACCEPT => static::ACCEPT, | ||
static::DECLINE => static::DECLINE, | ||
static::REVISION_REQUIRED => static::REVISION_REQUIRED | ||
]; | ||
} | ||
} |
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,58 @@ | ||
<?php | ||
|
||
namespace App\Mail\Templates; | ||
|
||
use App\Mail\Templates\Traits\CanCustomizeTemplate; | ||
use App\Models\Submission; | ||
|
||
class AcceptAbstractMail extends TemplateMailable | ||
{ | ||
use CanCustomizeTemplate; | ||
|
||
public string $title; | ||
|
||
public string $author; | ||
|
||
public string $loginLink; | ||
|
||
public function __construct(Submission $submission) | ||
{ | ||
$this->title = $submission->getMeta('title'); | ||
$this->author = $submission->user->fullName; | ||
$this->loginLink = route('livewirePageGroup.website.pages.login'); | ||
} | ||
|
||
public static function getDefaultSubject(): string | ||
{ | ||
return 'Abstract Accepted'; | ||
} | ||
|
||
public static function getDefaultDescription(): string | ||
{ | ||
return 'This is an automated notification from System to inform you about a new submission.'; | ||
} | ||
|
||
public static function getDefaultHtmlTemplate(): string | ||
{ | ||
|
||
return <<<'HTML' | ||
<p> This is an automated notification from the Leconfe System to inform you about a new submission.</p> | ||
<p> | ||
Submission Details: | ||
</p> | ||
<table> | ||
<tr> | ||
<td style="width:100px;">Title</td> | ||
<td>:</td> | ||
<td>{{ title }}</td> | ||
</tr> | ||
<tr> | ||
<td style="width:100px;">Author</td> | ||
<td>:</td> | ||
<td>{{ author }}</td> | ||
</tr> | ||
</table> | ||
<p>The submission is now available for your review and can be accessed through the System using your login credentials. Please <a href="{{ loginLink }}">log in</a> to the system to proceed with the evaluation process.</p> | ||
HTML; | ||
} | ||
} |
Oops, something went wrong.