Kanban / timesheet update
This commit is contained in:
@@ -26,9 +26,18 @@ class TimeEntryFactory extends Factory
|
||||
'work_type_id' => fn (array $attributes) => TaskModel::query()->findOrFail($attributes['task_id'])->work_type_id,
|
||||
'worked_on' => now()->toDateString(),
|
||||
'hours' => 2,
|
||||
'note' => fake()->sentence(3),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* An entry without a billing note, which keeps its week from being approved.
|
||||
*/
|
||||
public function withoutNote(): static
|
||||
{
|
||||
return $this->state(['note' => null]);
|
||||
}
|
||||
|
||||
public function approved(?User $by = null): static
|
||||
{
|
||||
return $this->state(fn (array $attributes): array => [
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* The entry's laskutusperuste (fixed / hourly / non_billable, null follows
|
||||
* the job) and an internal comment. The existing note is the billing note.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
$table->string('billing_model', 20)->nullable()->after('note');
|
||||
$table->text('internal_comment')->nullable()->after('billing_model');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('time_entries', function (Blueprint $table) {
|
||||
$table->dropColumn(['billing_model', 'internal_comment']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
/**
|
||||
* Tasks a user has pinned to the "Lukitut työt" part of their time
|
||||
* sheet; they stay from week to week until unpinned.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('time_pinned_tasks', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('task_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamp('pinned_at');
|
||||
$table->unique(['user_id', 'task_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('time_pinned_tasks');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user