Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions app/Helpers/GetNameInitMonth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Helpers;

use Carbon\Carbon;

class GetNameInitMonth
{
public static function month(): string
{
Carbon::setLocale('id');

$bulan = Carbon::now()->translatedFormat('F'); // Januari
return strtoupper(mb_substr($bulan, 0, 1)); // J
}
}
55 changes: 50 additions & 5 deletions app/Http/Controllers/TaskmanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace App\Http\Controllers;

use App\Helpers\CheckTodaysInRange;
use App\Helpers\GetNumberDate;
use App\Models\MonitorWeekly as ModelWeekly;
use Illuminate\Http\Request;
use App\Models\Taskman as ModelTaskman;
use App\Models\User as ModelUser;
use App\Models\Task as ModelTask;
use App\Models\PlanAgenda as ModelPlan;
use App\Models\LogTask as ModelLogofTask;
use Carbon\Carbon;

class TaskmanController extends Controller
Expand Down Expand Up @@ -42,7 +41,7 @@ public function goals($plan)
}
])
->orderBy('deadline', 'desc')
->paginate(6);
->paginate(10);

$infoPlanAgenda = ModelPlan::findOrFail($plan);

Expand Down Expand Up @@ -272,11 +271,57 @@ public function deleteItemTask(Request $request)

public function listTaskByDate(Request $request)
{
$tasks = ModelTask::whereDate('due', $request->date)
->orderBy('id')
$tasks = ModelTask::with('user') // 👈 eager load user
->whereDate('due', $request->date)
->orderBy('id', 'DESC')
->get();

return response()->json($tasks);

}

public function addWeekly(Request $request)
{
$planAgenda = $request->input('id_plan_agn');
$current_page = $request->input('current_page');

$data = [
'weekly' => $request->input('weeklyinit'),
'start_date' => $request->input('start_date'),
'end_date' => $request->input('end_date')
];

if ($request->input('bufferStatus')) {
$bufferDays = max(0, (int) $request->input('bufferDays', 0));

$startBuffer = Carbon::parse($request->input('end_date'))
->addDay()
->format('Y-m-d');

$endBuffer = Carbon::parse($startBuffer)
->addDays($bufferDays)
->format('Y-m-d');

$data['buffer_start'] = $startBuffer;
$data['buffer_end'] = $endBuffer;
}

if (str_contains(strtolower($request->input('weeklyinit')), 'ext')) {
$data['extention'] = 1;
} else {
$data['extention'] = 0;
}

ModelWeekly::create($data);

return redirect()->route('taskman.goals', [$planAgenda, 'page' => $current_page])->with('success', 'Yay, Data weekly berhasil dibuat.');
}

public function itemDetailTask(Request $request, $id)
{
$dataTask = ModelTask::with('user')->findOrFail($id);
$logTask = ModelLogofTask::where('id_task', $id)->first();

return view('home.taskman.detail_item', compact('dataTask', 'logTask'));
}
}
24 changes: 24 additions & 0 deletions app/Models/AttachmentLogs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AttachmentLogs extends Model
{
protected $table = 'attachment_logs';

protected $fillable = [
'id_log',
'attachments',
'category_of_attachment',
'person_of_updates'
];

public function logsTask()
{
return $this->belongsTo(LogTask::class, 'id_log', 'id');
// 'id_log' = foreign key di attachment logs
// 'id' = primary key di log task
}
}
24 changes: 24 additions & 0 deletions app/Models/LogTask.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class LogTask extends Model
{
protected $table = 'log_taks';

protected $fillable = [
'id_task',
'date_updates',
'detail_updates',
'person_of_updates'
];

public function task()
{
return $this->belongsTo(Task::class, 'id_task', 'id');
// 'id_task' = foreign key di log task
// 'id' = primary key di task
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"app/Helpers/DayLefted.php",
"app/Helpers/GetNumberDate.php",
"app/Helpers/TotalDays.php",
"app/Helpers/CheckTodaysInRange.php"
"app/Helpers/CheckTodaysInRange.php",
"app/Helpers/GetNameInitMonth.php"
]
},
"autoload-dev": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('task', function (Blueprint $table) {
//
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('task', function (Blueprint $table) {
//
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->string('category_evidence')->nullable()->after('detail_task');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropColumn('category_evidence');
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->date('date_of_actual_done')->nullable()->after('due');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropColumn('date_of_actual_done');
});
}
};
Original file line number Diff line number Diff line change
@@ -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.
*/
public function up(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->dateTime('date_of_actual_done')
->nullable()
->change();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('tasks', function (Blueprint $table) {
$table->date('date_of_actual_done')
->nullable()
->change();
});
}
};
31 changes: 31 additions & 0 deletions database/migrations/2026_02_10_015010_create_log_taks_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('log_taks', function (Blueprint $table) {
$table->id();
$table->integer('id_task');
$table->dateTime('date_updates');
$table->string('detail_updates');
$table->integer('person_of_updates');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('log_taks');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('attachment_logs', function (Blueprint $table) {
$table->id();
$table->integer('id_log');
$table->string('attachments');
$table->integer('category_of_attachment');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('attachment_logs');
}
};
28 changes: 28 additions & 0 deletions database/seeders/LogTask.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class LogTask extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$log_of_tasks = [
[
'id_task' => 167,
'date_updates' => now(),
'detail_updates' => 'Task di hold, karena mau mengerjakan task Analisa HR',
'person_of_updates' => 5,
],

];

DB::table('log_taks')->insert($log_of_tasks);
}
}
2 changes: 1 addition & 1 deletion public/css/custom-timeline.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ display: block;
margin-bottom: 20px;
position: relative;
width: 100%;
padding-right: 90px;
padding-right: 20px;
}

.timeline .timeline-wrapper:before {
Expand Down
Loading