|
|
@ -6,7 +6,7 @@ use Carbon\Carbon; |
|
|
|
use App\Models\Task; |
|
|
|
use App\Models\Work; |
|
|
|
use App\Models\TagTask; |
|
|
|
use App\Rules\maxBound; |
|
|
|
use App\Rules\MaxBound; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
use Illuminate\Http\Response; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
@ -30,20 +30,20 @@ class TaskController extends Controller |
|
|
|
return $request->filled('group') ? |
|
|
|
$tasks->get()->groupBy($request->group) |
|
|
|
->map(function ($q) { return $q->keyBy('status_id'); }) |
|
|
|
: /*response()->json(collect(['now' => Carbon::now()->toDateString()])->merge(*/new TaskCollection($tasks->paginate($per_page));//));
|
|
|
|
: new TaskCollection($tasks->paginate($per_page)); |
|
|
|
} |
|
|
|
|
|
|
|
public function indexValidation($request) |
|
|
|
{ |
|
|
|
$bound = 10; |
|
|
|
$this->validate($request, [ |
|
|
|
'filter.project_id' => [new maxBound($bound)] , |
|
|
|
'filter.creator_id' => [new maxBound($bound)] , |
|
|
|
'filter.assignee_id' => [new maxBound($bound)] , |
|
|
|
'filter.system_id' => [new maxBound($bound)] , |
|
|
|
'filter.workflow_id' => [new maxBound($bound)] , |
|
|
|
'filter.status_id' => [new maxBound($bound)] , |
|
|
|
'filter.approver_id' => [new maxBound($bound)] , |
|
|
|
'filter.project_id' => [new MaxBound($bound)] , |
|
|
|
'filter.creator_id' => [new MaxBound($bound)] , |
|
|
|
'filter.assignee_id' => [new MaxBound($bound)] , |
|
|
|
'filter.system_id' => [new MaxBound($bound)] , |
|
|
|
'filter.workflow_id' => [new MaxBound($bound)] , |
|
|
|
'filter.status_id' => [new MaxBound($bound)] , |
|
|
|
'filter.approver_id' => [new MaxBound($bound)] , |
|
|
|
'filter.priority_min' => 'nullable|numeric|between:1,10' , |
|
|
|
'filter.priority_max' => 'nullable|numeric|between:1,10' , |
|
|
|
'filter.ready_to_test' => 'nullable|boolean' , |
|
|
@ -55,7 +55,7 @@ class TaskController extends Controller |
|
|
|
{ |
|
|
|
$query = Task::where('business_id', $business); |
|
|
|
$taskQ = QueryBuilder::for($query) |
|
|
|
->with('tagTask') |
|
|
|
// ->with('tags')
|
|
|
|
->select(DB::raw('tasks.* , (spent_time - estimated_time) as over_spent')) |
|
|
|
->allowedFilters([ |
|
|
|
AllowedFilter::exact('project_id'), |
|
|
@ -140,7 +140,7 @@ class TaskController extends Controller |
|
|
|
|
|
|
|
public function store($business, $project, Request $request) |
|
|
|
{ |
|
|
|
// permit('projectTasks', ['project_id' => $project]);
|
|
|
|
permit('projectTasks', ['project_id' => $project]); |
|
|
|
|
|
|
|
$task = Task::create($request->merge( |
|
|
|
['business_id' => $business, 'project_id' => $project, 'creator_id' => \auth()->id()] |
|
|
@ -167,7 +167,7 @@ class TaskController extends Controller |
|
|
|
* 1) guest's only can see self task |
|
|
|
* 2) user is active in project |
|
|
|
*/ |
|
|
|
public function show($business, $task, $project =null) |
|
|
|
public function show($business, $project, $task) |
|
|
|
{ |
|
|
|
$task = Task::findOrFail($task); |
|
|
|
$project = $task->project_id; |
|
|
|