-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
228 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
<?php | ||
|
||
namespace App\Tasks; | ||
|
||
use App\Models\Task; | ||
|
||
abstract class TaskTypes | ||
{ | ||
protected $name; | ||
protected $icon; | ||
|
||
public function __construct() | ||
{ | ||
$this->name = $this->getName(); | ||
$this->icon = $this->getIcon(); | ||
} | ||
|
||
public function onCreated(){ | ||
// Default logic for creating a task | ||
} | ||
|
||
public function onCompleted(){ | ||
// Default logic for completing a task | ||
} | ||
|
||
public function onDeclined(){ | ||
// Default logic for declining a task | ||
} | ||
|
||
abstract public function getName(); | ||
abstract public function getIcon(); | ||
abstract public function getText(Task $model); | ||
abstract public function getLink(Task $model); | ||
|
||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace App\Tasks\Types; | ||
|
||
use App\Tasks\TaskTypes; | ||
use App\Models\Task; | ||
|
||
class CustomRequest extends TaskTypes | ||
{ | ||
public function getName() { | ||
return 'Custom Request'; | ||
} | ||
|
||
public function getIcon() { | ||
return 'fa-message'; | ||
} | ||
|
||
public function getText(Task $model) { | ||
return $model->message; | ||
} | ||
|
||
public function getLink(Task $model){ | ||
return false; | ||
} | ||
|
||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace App\Tasks\Types; | ||
|
||
use App\Models\Task; | ||
use App\Models\User; | ||
use App\Models\Training; | ||
use App\Tasks\TaskTypes; | ||
|
||
class RatingUpgrade extends TaskTypes | ||
{ | ||
public function getName() { | ||
return 'Rating Upgrade'; | ||
} | ||
|
||
public function getIcon() { | ||
return 'fa-circle-arrow-up'; | ||
} | ||
|
||
public function getText(Task $model) { | ||
return 'Upgrade rating to ' . Training::find($model->reference_training_id)->getInlineRatings(); | ||
} | ||
|
||
public function getLink(Task $model){ | ||
$user = User::find($model->reference_user_id); | ||
$userEud = $user->division == 'EUD'; | ||
|
||
if($userEud){ | ||
return 'https://www.atsimtest.com/index.php?cmd=admin&sub=memberdetail&memberid=' . $model->reference_user_id; | ||
} | ||
|
||
return false; | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace App\Tasks\Types; | ||
|
||
use App\Tasks\TaskTypes; | ||
use App\Models\Task; | ||
use App\Models\User; | ||
use App\Models\Training; | ||
|
||
class SoloEndorsement extends TaskTypes | ||
{ | ||
public function getName() { | ||
return 'Solo Endorsement'; | ||
} | ||
|
||
public function getIcon() { | ||
return 'fa-clock'; | ||
} | ||
|
||
public function getText(Task $model) { | ||
return 'Grant solo endorsement'; | ||
} | ||
|
||
public function getLink(Task $model){ | ||
return route('endorsements.create.id', $model->reference_user_id); | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace App\Tasks\Types; | ||
|
||
use App\Tasks\TaskTypes; | ||
use App\Models\Task; | ||
use App\Models\User; | ||
use App\Models\Training; | ||
|
||
class TheoreticalExam extends TaskTypes | ||
{ | ||
public function getName() { | ||
return 'Theoretical Exam Access'; | ||
} | ||
|
||
public function getIcon() { | ||
return 'fa-key'; | ||
} | ||
|
||
public function getText(Task $model) { | ||
return 'Grant theoretical exam access'; | ||
} | ||
|
||
public function getLink(Task $model){ | ||
$user = User::find($model->reference_user_id); | ||
$userEud = $user->division == 'EUD'; | ||
|
||
if($userEud){ | ||
return 'https://www.atsimtest.com/index.php?cmd=admin&sub=memberdetail&memberid=' . $model->reference_user_id; | ||
} | ||
|
||
return false; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<tr> | ||
<td>{{ $task->id }}</td> | ||
<td><span data-bs-toggle="tooltip" data-bs-placement="top" title="{{ $task->created_at->toEuropeanDateTime() }}">{{ $task->created_at->diffForHumans() }}</span></td> | ||
<td><a href="{{ route('user.show', $task->reference_user_id) }}">{{ \App\Models\User::find($task->reference_user_id)->name }} ({{ $task->reference_user_id }})</a></td> | ||
<td> | ||
<i class="fas {{ $task->type()->getIcon() }}" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ $task->type()->getName() }}"></i> | ||
|
||
@if($task->type()->getLink($task)) | ||
<a href="{{ $task->type()->getLink($task) }}" target="_blank" class="link-offset-1 dotted-underline">{{ $task->type()->getText($task) }}</a> | ||
@else | ||
{{ $task->type()->getText($task) }} | ||
@endif | ||
</td> | ||
<td> | ||
@isset($task->sender_user_id) | ||
<a href="{{ route('user.show', $task->sender_user_id) }}">{{ \App\Models\User::find($task->sender_user_id)->name }} ({{ $task->sender_user_id }})</a> | ||
@else | ||
System | ||
@endisset | ||
</td> | ||
|
||
<td> | ||
<a href="" class="btn btn-sm btn-outline-success"><i class="fas fa-check"></i> Complete</a> | ||
<a href="" class="btn btn-sm btn-outline-danger"><i class="fas fa-xmark"></i> Decline</a> | ||
</td> | ||
</tr> |