status priority
This commit is contained in:
parent
de082f8bca
commit
5c8cfeb854
@ -42,6 +42,7 @@ class TaskController extends Controller
|
|||||||
{
|
{
|
||||||
$data['title'] = 'Create Task';
|
$data['title'] = 'Create Task';
|
||||||
$data['status'] = Task::STATUS;
|
$data['status'] = Task::STATUS;
|
||||||
|
$data['priority'] = Task::PRIORITY;
|
||||||
$data['categoryList'] = Task::CATEGORY;
|
$data['categoryList'] = Task::CATEGORY;
|
||||||
$data['projectList'] = $this->projectRepository->pluck();
|
$data['projectList'] = $this->projectRepository->pluck();
|
||||||
$data['memberList'] = $this->employeeRepository->pluck();
|
$data['memberList'] = $this->employeeRepository->pluck();
|
||||||
@ -83,6 +84,7 @@ class TaskController extends Controller
|
|||||||
$data['title'] = 'Edit Task';
|
$data['title'] = 'Edit Task';
|
||||||
$data['task'] = $this->taskRepository->getTaskById($id);
|
$data['task'] = $this->taskRepository->getTaskById($id);
|
||||||
$data['status'] = Task::STATUS;
|
$data['status'] = Task::STATUS;
|
||||||
|
$data['priority'] = Task::PRIORITY;
|
||||||
$data['categoryList'] = Task::CATEGORY;
|
$data['categoryList'] = Task::CATEGORY;
|
||||||
$data['projectList'] = $this->projectRepository->pluck();
|
$data['projectList'] = $this->projectRepository->pluck();
|
||||||
$data['memberList'] = $this->employeeRepository->pluck();
|
$data['memberList'] = $this->employeeRepository->pluck();
|
||||||
|
@ -5,6 +5,7 @@ namespace Modules\PMS\Models;
|
|||||||
use App\Traits\CreatedUpdatedBy;
|
use App\Traits\CreatedUpdatedBy;
|
||||||
use App\Traits\StatusTrait;
|
use App\Traits\StatusTrait;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\Employee\Models\Employee;
|
||||||
|
|
||||||
class Project extends Model
|
class Project extends Model
|
||||||
{
|
{
|
||||||
@ -19,4 +20,14 @@ class Project extends Model
|
|||||||
11 => 'Laravel',
|
11 => 'Laravel',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function client()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Client::class, 'client_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function members()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Employee::class, 'members_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,9 @@ namespace Modules\PMS\Models;
|
|||||||
|
|
||||||
use App\Traits\CreatedUpdatedBy;
|
use App\Traits\CreatedUpdatedBy;
|
||||||
use App\Traits\StatusTrait;
|
use App\Traits\StatusTrait;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Modules\Employee\Models\Employee;
|
||||||
|
|
||||||
class Task extends Model
|
class Task extends Model
|
||||||
{
|
{
|
||||||
@ -12,11 +14,50 @@ class Task extends Model
|
|||||||
|
|
||||||
protected $table = 'tbl_tasks';
|
protected $table = 'tbl_tasks';
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
protected $appends = ['status_name'];
|
protected $appends = ['status_name', 'priority_status'];
|
||||||
|
|
||||||
const CATEGORY = [
|
const CATEGORY = [
|
||||||
10 => 'Vue',
|
10 => 'Vue',
|
||||||
11 => 'Laravel',
|
11 => 'Laravel',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const PRIORITY = [
|
||||||
|
10 => 'High',
|
||||||
|
11 => 'Meduim',
|
||||||
|
12 => 'Low',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function priorityStatus(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: function (mixed $value, array $attributes) {
|
||||||
|
switch ($attributes['priority']) {
|
||||||
|
case '10':
|
||||||
|
return '<span class="badge bg-danger">' . self::PRIORITY[$attributes['priority']] . '</span>';
|
||||||
|
break;
|
||||||
|
case '11':
|
||||||
|
return '<span class="badge bg-info">' . self::PRIORITY[$attributes['priority']] . '</span>';
|
||||||
|
break;
|
||||||
|
case '12':
|
||||||
|
return '<span class="badge bg-primary">' . self::PRIORITY[$attributes['priority']] . '</span>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
set: fn($value) => $value,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function project()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Project::class, 'project_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assigned()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Employee::class, 'assigned_id');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<td>{{ $project->members_id }}</td>
|
<td>{{ $project->members_id }}</td>
|
||||||
<td>{{ $project->start_date }}</td>
|
<td>{{ $project->start_date }}</td>
|
||||||
<td class="text-danger">{{ $project->end_date }}</td>
|
<td class="text-danger">{{ $project->end_date }}</td>
|
||||||
<td>{{ $project->client_id }}</td>
|
<td>{{ optional($project->client)->client_name }}</td>
|
||||||
<td>{!! $project->status_name !!}</td>
|
<td>{!! $project->status_name !!}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="hstack flex-wrap gap-3">
|
<div class="hstack flex-wrap gap-3">
|
||||||
|
@ -37,11 +37,11 @@
|
|||||||
<td>{{ $key + 1 }}</td>
|
<td>{{ $key + 1 }}</td>
|
||||||
<td>{{ $task->title }}</td>
|
<td>{{ $task->title }}</td>
|
||||||
<td>{{ $task->task_category_id }}</td>
|
<td>{{ $task->task_category_id }}</td>
|
||||||
<td>{{ $task->project_id }}</td>
|
<td>{{ optional($task->project)->project_name }}</td>
|
||||||
<td>{{ $task->start_date }}</td>
|
<td>{{ $task->start_date }}</td>
|
||||||
<td class="text-danger">{{ $task->due_date }}</td>
|
<td class="text-danger">{{ $task->due_date }}</td>
|
||||||
<td>{{ $task->assigned_id }}</td>
|
<td>{{ optional($task->assigned)->full_name }}</td>
|
||||||
<td>{{ $task->priority }}</td>
|
<td>{!! $task->priority_status !!}</td>
|
||||||
<td>{!! $task->status_name !!}</td>
|
<td>{!! $task->status_name !!}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="hstack flex-wrap gap-3">
|
<div class="hstack flex-wrap gap-3">
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{{ html()->label('Priority')->class('form-label') }}
|
{{ html()->label('Priority')->class('form-label') }}
|
||||||
{{ html()->select('priority', $status)->class('form-control')->required() }}
|
{{ html()->select('priority', $priority)->class('form-control')->required() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
Loading…
Reference in New Issue
Block a user