mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
subtask.title, timeblock is_finished
This commit is contained in:
1 parent
34514e44c1
commit
f3ed454d6f
5 files changed
+80
-1
No files matched your search
@@ -22,6 +22,7 @@ class SubTaskResource extends JsonResource
|
|||||||
'project_code' => ($this->mastertask->project) ? $this->mastertask->project->code : null,
|
'project_code' => ($this->mastertask->project) ? $this->mastertask->project->code : null,
|
||||||
'master_task_id' => $this->mastertask->id,
|
'master_task_id' => $this->mastertask->id,
|
||||||
'master_task' => $this->mastertask->title,
|
'master_task' => $this->mastertask->title,
|
||||||
|
'title' => $this->title,
|
||||||
'team_id' => ($this->mastertask->team) ? $this->mastertask->team->id : null,
|
'team_id' => ($this->mastertask->team) ? $this->mastertask->team->id : null,
|
||||||
'team' => $this->mastertask->team,
|
'team' => $this->mastertask->team,
|
||||||
'employee_id' => $this->user->id,
|
'employee_id' => $this->user->id,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class TimeblockResource extends JsonResource
|
|||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'start' => $this->start,
|
'start' => $this->start,
|
||||||
'end' => $this->end,
|
'end' => $this->end,
|
||||||
|
'is_finished' => $this->is_finished,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('timeblocks', function (Blueprint $table) {
|
||||||
|
$table->boolean('is_finished')->after('end')->default(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('timeblocks', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('sub_tasks', function (Blueprint $table) {
|
||||||
|
$table->string('title')->after('user_id')->nullable()->default(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('sub_task', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
+14
-1
@@ -13,6 +13,7 @@ use App\Http\Resources\SubTaskCollection;
|
|||||||
use App\Http\Resources\SubTaskResource;
|
use App\Http\Resources\SubTaskResource;
|
||||||
use App\Http\Resources\TeamCollection;
|
use App\Http\Resources\TeamCollection;
|
||||||
use App\Http\Resources\TeamResource;
|
use App\Http\Resources\TeamResource;
|
||||||
|
use App\Http\Resources\TimeblockResource;
|
||||||
use App\Http\Resources\UserCollection;
|
use App\Http\Resources\UserCollection;
|
||||||
use App\Http\Resources\UserResource;
|
use App\Http\Resources\UserResource;
|
||||||
use App\Models\Blocker;
|
use App\Models\Blocker;
|
||||||
@@ -20,6 +21,7 @@ use App\Models\MasterTask;
|
|||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\SubTask;
|
use App\Models\SubTask;
|
||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
|
use App\Models\Timeblock;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -110,7 +112,7 @@ Route::middleware(['auth:sanctum', 'abilities:full-access'])->group(function ()
|
|||||||
$projectIDs = Project::where('name', 'like', '%' . $search . '%')->orWhere('code', 'like', '%' . $search . '%')->get()->pluck('id');
|
$projectIDs = Project::where('name', 'like', '%' . $search . '%')->orWhere('code', 'like', '%' . $search . '%')->get()->pluck('id');
|
||||||
|
|
||||||
$userIDs = User::where('firstname', 'like', '%' . $search . '%')->orWhere('lastname', 'like', '%' . $search . '%')->get()->pluck('id');
|
$userIDs = User::where('firstname', 'like', '%' . $search . '%')->orWhere('lastname', 'like', '%' . $search . '%')->get()->pluck('id');
|
||||||
|
|
||||||
$teams = Team::whereHas('users', function($q) use($userIDs) {
|
$teams = Team::whereHas('users', function($q) use($userIDs) {
|
||||||
$q->whereIn('user_id', $userIDs);
|
$q->whereIn('user_id', $userIDs);
|
||||||
})->orWhere('name', 'like', '%' . $search . '%' )->get();
|
})->orWhere('name', 'like', '%' . $search . '%' )->get();
|
||||||
@@ -125,6 +127,17 @@ Route::middleware(['auth:sanctum', 'abilities:full-access'])->group(function ()
|
|||||||
'subtasks' => new SubTaskCollection($subtasks),
|
'subtasks' => new SubTaskCollection($subtasks),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::put('/v1/timeblocks/{id}', function ($id, Request $request) {
|
||||||
|
$is_finished = $request->all()['data']['is_finished'];
|
||||||
|
|
||||||
|
$timeblock = Timeblock::find($id);
|
||||||
|
|
||||||
|
$timeblock->is_finished = $is_finished;
|
||||||
|
$timeblock->save();
|
||||||
|
|
||||||
|
return new TimeblockResource($timeblock);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum', 'abilities:password-reset'])->group(function () {
|
Route::middleware(['auth:sanctum', 'abilities:password-reset'])->group(function () {
|
||||||
|
|||||||
Reference in new issue
Block a user