mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/tickme.git
synced 2026-08-19 04:23:56 +00:00
changes related to activating the create task module
This commit is contained in:
@@ -58,7 +58,7 @@ class UpdateTaskControllerLogic extends AbstractControllerLogic
|
||||
{
|
||||
try {
|
||||
|
||||
$object = new TaskObject($request->input('milestone_id'), $request->input('type_id'), $request->input('title'), $request->input('description'), $request->input('status'), $request->input('active'));
|
||||
$object = new TaskObject($request->input('type_id'), $request->input('title'), $request->input('description'), $request->input('status'), $request->input('active'), $request->input('milestone_id'));
|
||||
|
||||
$this->canUpdateTask->passes($object);
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@ use App\Classes\Interfaces\DataTransferObject;
|
||||
class TaskObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var int */
|
||||
private $milestoneId;
|
||||
|
||||
/** @var int */
|
||||
private $typeId;
|
||||
|
||||
@@ -25,31 +22,26 @@ class TaskObject implements DataTransferObject
|
||||
/** @var bool */
|
||||
private $isActive;
|
||||
|
||||
/** @var int|null */
|
||||
private $milestoneId;
|
||||
|
||||
/**
|
||||
* TaskObject constructor.
|
||||
* @param int $milestoneId
|
||||
* @param int $typeId
|
||||
* @param string $title
|
||||
* @param string $description
|
||||
* @param int $status
|
||||
* @param bool $isActive
|
||||
* @param int $typeId
|
||||
* @param string $title
|
||||
* @param string $description
|
||||
* @param int $status
|
||||
* @param bool $isActive
|
||||
* @param int|null $milestoneId
|
||||
*/
|
||||
public function __construct(int $milestoneId, int $typeId, string $title, string $description, int $status, bool $isActive)
|
||||
public function __construct(int $typeId, string $title, string $description, int $status, bool $isActive, ?int $milestoneId)
|
||||
{
|
||||
$this->milestoneId = $milestoneId;
|
||||
$this->typeId = $typeId;
|
||||
$this->title = $title;
|
||||
$this->description = $description;
|
||||
$this->status = $status;
|
||||
$this->isActive = $isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMilestoneId(): int
|
||||
{
|
||||
return $this->milestoneId;
|
||||
$this->milestoneId = $milestoneId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,11 +79,18 @@ class TaskObject implements DataTransferObject
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsActive(): bool
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getMilestoneId(): ?int
|
||||
{
|
||||
return $this->milestoneId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -47,25 +47,27 @@ class TimeTrackerController
|
||||
$task->status = 12;
|
||||
$task->save();
|
||||
|
||||
$milestone = ProjectMilestone::find($task->milestone_id);
|
||||
$milestonPendingTasks = Task::where('milestone_id', $task->milestone_id)->where('status', '!=', 12);
|
||||
if($task->milestone_id) {
|
||||
$milestone = ProjectMilestone::find($task->milestone_id);
|
||||
$milestonPendingTasks = Task::where('milestone_id', $task->milestone_id)->where('status', '!=', 12);
|
||||
|
||||
if(!$milestonPendingTasks->exists()){
|
||||
$milestone->complete = true;
|
||||
$milestone->save();
|
||||
}
|
||||
if(!$milestonPendingTasks->exists()){
|
||||
$milestone->complete = true;
|
||||
$milestone->save();
|
||||
}
|
||||
|
||||
$project = $milestone->project->first();
|
||||
$projectPendingTasks = $project->tasks->where('status', '!=', 12);
|
||||
$project = $milestone->project->first();
|
||||
$projectPendingTasks = $project->tasks->where('status', '!=', 12);
|
||||
|
||||
if(!$projectPendingTasks->count()){
|
||||
$project->status = 12;
|
||||
$project->save();
|
||||
} else {
|
||||
$nextTask = $projectPendingTasks->first();
|
||||
$nextTask->status = 7;
|
||||
$nextTask->active = true;
|
||||
$nextTask->save();
|
||||
if(!$projectPendingTasks->count()){
|
||||
$project->status = 12;
|
||||
$project->save();
|
||||
} else {
|
||||
$nextTask = $projectPendingTasks->first();
|
||||
$nextTask->status = 7;
|
||||
$nextTask->active = true;
|
||||
$nextTask->save();
|
||||
}
|
||||
}
|
||||
|
||||
return (new ApiResponseObject('Task Completed Successfully',
|
||||
|
||||
@@ -28,7 +28,7 @@ class TaskResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'milestone' => new ProjectMilestoneResource($this->milestone),
|
||||
'business_service' => new ModularTypeResource($this->milestone->project->projectType),
|
||||
'business_service' => $this->milestone ? new ModularTypeResource($this->milestone->project->projectType): null,
|
||||
'type_id' => $this->type_id,
|
||||
'task_type' => new ModularTypeResource($this->taskType),
|
||||
'title' => $this->title,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row no-margin" v-if="!pagination">
|
||||
<div class="row no-margin" v-if="pagination">
|
||||
<div class="col">
|
||||
<ul class="pagination justify-content-center mb-0" v-if="pagination.last_page !== 1">
|
||||
<li class="page-item " :class="[{'disabled': pagination.current_page === 1 && pageNumbers().includes(1)}]" @click="callPage(1)">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small>{{task.business_service.name}}</small>
|
||||
<small>{{task.business_service? task.business_service.name:'Miscellaneous'}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -86,7 +86,7 @@
|
||||
<div class="col-4 bg-dark p-4">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row mb-5">
|
||||
<div class="row mb-5" v-if="task.milestone">
|
||||
<div class="col">
|
||||
<div class="row mb-2">
|
||||
<div class="col">
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row mb-3" v-if="task.milestone">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -142,7 +142,7 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small class="text-warning d-block" v-if="!task.assignees.departments.length">No department assigned for this task</small>
|
||||
<small class="text-warning d-block mt-2" v-if="!task.assignees.departments.length">No department assigned for this task</small>
|
||||
<div class="row mt-3" v-if="task.assignees.departments.length">
|
||||
<div class="col">
|
||||
<div class="mr-2 mb-1 d-inline-block text-center assignee-avatar" v-for="assignee in task.assignees.departments">
|
||||
@@ -156,7 +156,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-3">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -167,14 +167,10 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small class="text-warning d-block" v-if="!task.assignees.users.length">No department assigned for this task</small>
|
||||
<div class="row mt-3" v-if="task.assignees.users.length">
|
||||
<div class="col">
|
||||
<div class="mr-2 mb-1 d-inline-block text-center assignee-avatar" v-for="assignee in task.assignees.users">
|
||||
<avatar :size="30" :username="assignee.name"></avatar>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<small class="toggleAssignList mt-2 d-block pointer" v-if="!task.milestone">Assign task to employee <i class="iconsminds-arrow-down float-right"></i></small>
|
||||
<task-assignee-form-component section="taskSection" :assignable="{assignment_id: task.id, assignee_type: 'User'}" v-if="!task.milestone"></task-assignee-form-component>
|
||||
<small class="text-warning d-block" v-if="!task.assignees.users.length">No employee assigned for this task</small>
|
||||
<task-assignee-component section="taskSection" v-if="task.assignees.users.length" :data="task.assignees.users" :assignable="{assignment_id: task.id, assignee_type: 'User'}" :manageable="!task.milestone"></task-assignee-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -192,7 +188,7 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small class="text-warning d-block" v-if="!task.time_tracker.length">No one has worked on this task yet</small>
|
||||
<small class="text-warning d-block mt-2" v-if="!task.time_tracker.length">No one has worked on this task yet</small>
|
||||
<div class="row mt-3" v-if="task.time_tracker.length">
|
||||
<div class="col">
|
||||
<div class="row mb-2 align-items-center" v-for="tracker in task.time_tracker">
|
||||
|
||||
@@ -3,18 +3,10 @@
|
||||
<div class="col">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.milestone_id">
|
||||
<selectable-component :endpoint="route('api.project_milestone.list')" section="projectMilestoneSection" valueColumn="id" labelColumn="name" v-model="parameters.milestone_id"></selectable-component>
|
||||
<span>milestone</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.type_id">
|
||||
<selectable-component :endpoint="route('api.modular_type.list')" section="modularTypeSection" valueColumn="id" labelColumn="name" v-model="parameters.type_id"></selectable-component>
|
||||
<selectable-component :endpoint="route('api.modular_type.list', 'task')" section="modularTypeSection" valueColumn="id" labelColumn="name" v-model="parameters.type_id"></selectable-component>
|
||||
<span>type</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
@@ -35,14 +27,6 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.status">
|
||||
<selectable-component :endpoint="route('api.modular_type.list')" section="modularTypeSection" valueColumn="id" labelColumn="name" v-model="parameters.status"></selectable-component>
|
||||
<span>status</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
@@ -80,11 +64,12 @@
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
milestone_id: '',
|
||||
milestone_id: null,
|
||||
type_id: '',
|
||||
title: '',
|
||||
description: '',
|
||||
status: ''
|
||||
status: 7,
|
||||
active: true
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -1,88 +1,64 @@
|
||||
<template>
|
||||
<div class="card mb-3 parentContainer">
|
||||
<div class="row pt-3 pb-3 pr-4 pl-4">
|
||||
<div class="col">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-3">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class=" mb-1 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block text-muted text-small text-uppercase" style=" font-size: 9px !important; ">assignee_id</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="ist-item-heading truncate mb-0 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block">{{taskAssignee.assignee_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class=" mb-1 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block text-muted text-small text-uppercase" style=" font-size: 9px !important; ">assignee_type</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-small mb-0 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block">{{taskAssignee.assignee_type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class=" mb-1 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block text-muted text-small text-uppercase" style=" font-size: 9px !important; ">assignment_id</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="text-small mb-0 w-xs-100 mt-0">
|
||||
<span class="align-middle d-inline-block">{{taskAssignee.assignment_id}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-outline-secondary icon-button mr-3 requestModal" data-type="editModal"><i class="iconsminds-pen-2"></i></button>
|
||||
<button type="button" class="btn btn-outline-danger icon-button requestModal" data-type="deleteModal"><i class="simple-icon-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: -8px;">
|
||||
<div class="col">
|
||||
<div class="mr-2 mb-1 d-inline-block text-center assignee-avatar" v-for="assignee in assignees">
|
||||
<avatar :size="30" :username="assignee.name"></avatar>
|
||||
<i class="iconsminds-close d-block mt-1 delete-icon pointer text-danger" v-if="manageable" @click="deleteAssignee(assignee.id)"></i>
|
||||
</div>
|
||||
</div>
|
||||
<form-component section="taskAssigneeSection" :data="taskAssignee">
|
||||
<template slot="form" slot-scope="{section, data}">
|
||||
<task-assignee-form-component :section="section" :data="data"></task-assignee-form-component>
|
||||
</template>
|
||||
</form-component>
|
||||
<delete-component section="taskAssigneeSection" :requestRoute="route('api.task_assignee.delete', taskAssignee.id)" name="task-assignee"></delete-component>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
section: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
assignable: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
manageable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'data': function() {
|
||||
this.assignees = this.data;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
taskAssignee: this.data,
|
||||
}
|
||||
assignees: this.data,
|
||||
parameters: {
|
||||
assignee_id: '',
|
||||
assignee_type: this.assignable.assignee_type,
|
||||
assignment_id: this.assignable.assignment_id,
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'data': function() {
|
||||
this.taskAssignee = this.data;
|
||||
}
|
||||
methods:{
|
||||
deleteAssignee(id){
|
||||
this.parameters.assignee_id = id;
|
||||
this.submit(this.route('api.task_assignee.delete'), 'delete', null, true, true)
|
||||
},
|
||||
successHandler(){
|
||||
this.updateList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.delete-icon {
|
||||
visibility: hidden;
|
||||
}
|
||||
.assignee-avatar:hover .delete-icon {
|
||||
visibility: visible;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,45 +1,7 @@
|
||||
<template>
|
||||
<div class="row" v-on:keyup.enter="submitForm()">
|
||||
<div class="col">
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.assignee_id">
|
||||
<input v-model="parameters.assignee_id" type="text" class="form-control">
|
||||
<span>assignee_id</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.assignee_type">
|
||||
<input v-model="parameters.assignee_type" type="text" class="form-control">
|
||||
<span>assignee_type</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3 animated fadeInDown fast">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.assignment_id">
|
||||
<input v-model="parameters.assignment_id" type="text" class="form-control">
|
||||
<span>assignment_id</span>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-outline-dark float-left" @click="closeModal()">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @click="submitForm()">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<selectable-component v-if="parameters.assignee_type === 'Department'" v-on:change="submitForm()" :endpoint="route('api.department.list')" section="departmentSection" valueColumn="id" labelColumn="name" v-model="parameters.assignee_id"></selectable-component>
|
||||
<selectable-component v-if="parameters.assignee_type === 'User'" v-on:change="submitForm()" :endpoint="route('api.account.user.list')" section="userSection" valueColumn="id" labelColumn="name" v-model="parameters.assignee_id"></selectable-component>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -47,12 +9,16 @@
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
type: String,
|
||||
required: true
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
assignable: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -65,8 +31,8 @@
|
||||
return {
|
||||
parameters: {
|
||||
assignee_id: '',
|
||||
assignee_type: '',
|
||||
assignment_id: ''
|
||||
assignee_type: this.assignable.assignee_type,
|
||||
assignment_id: this.assignable.assignment_id,
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -77,13 +43,17 @@
|
||||
assignment_id: { required }
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'parameters.assignee_id': function() {
|
||||
this.submitForm();
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
this.submit((this.data ? this.route('api.task_assignee.update', this.data.id) : this.route('api.task_assignee.create')), (this.data ? 'put' : 'post'), this.section+'.form', true, true)
|
||||
this.submit(this.route('api.task_assignee.create'),'post', null, true, true)
|
||||
},
|
||||
successHandler(){
|
||||
this.crudSuccess();
|
||||
this.updateList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<list-component key="2" section="projectSection" endpoint="{{ route('api.project.list') }}">
|
||||
<list-component key="2" section="projectSection" endpoint="{{ route('api.project.list') }}" :options="{status: 7}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<project-component :data="data"></project-component>
|
||||
</template>
|
||||
|
||||
@@ -8,9 +8,17 @@
|
||||
<h3 class="text-uppercase m-0">Tasks</h3>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="top-right-button-container parentContainer">
|
||||
<button type="button" class="btn btn-primary btn-lg top-right-button mr-1 requestModal" data-type="createModal">ADD NEW</button>
|
||||
<form-component section="taskSection">
|
||||
<template slot="form" slot-scope="{section}">
|
||||
<task-form-component :section="section"></task-form-component>
|
||||
</template>
|
||||
</form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<list-component key="2" section="taskSection" endpoint="{{ route('api.task.list') }}" :options="{order_by: {column: 'id', DESC: false}, active: true}" >
|
||||
<list-component key="2" section="taskSection" endpoint="{{ route('api.task.list') }}" :options="{status: 7, order_by: {column: 'id', DESC: false}, active: true}" >
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<task-component :data="data"></task-component>
|
||||
</template>
|
||||
|
||||
@@ -64,17 +64,13 @@
|
||||
<div class="user d-inline-block">
|
||||
<button class="btn btn-empty p-0" type="button" data-toggle="dropdown" aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<span class="name">Sarah Kortney</span>
|
||||
<span class="name"></span>
|
||||
<span>
|
||||
<i class="simple-icon-options text-white ml-2" style="font-size: 8px;"></i>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div class="dropdown-menu dropdown-menu-right mt-3">
|
||||
<a class="dropdown-item" href="#">Account</a>
|
||||
<a class="dropdown-item" href="#">Features</a>
|
||||
<a class="dropdown-item" href="#">History</a>
|
||||
<a class="dropdown-item" href="#">Support</a>
|
||||
<a class="dropdown-item" href="#">Sign out</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ Route::group(['prefix' => 'task_assignee', 'as' => 'task_assignee.', 'namespace'
|
||||
|
||||
Route::put('/update/{id}', 'UpdateTaskAssigneeController@update')->name('update');
|
||||
|
||||
Route::delete('/delete/{id}', 'DeleteTaskAssigneeController@destroy')->name('delete');
|
||||
Route::delete('/delete', 'DeleteTaskAssigneeController@destroy')->name('delete');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user