Add the task calendar, holidays, workflow templates and customer removal
Task calendar (/jobs/calendar) replaces per-unit task Kanban columns (K34): a two-week Gantt of tasks per person. Bars move, resize and change person by dragging or through a keyboard dialog. Each task's estimate is booked evenly over working days into task_bookings, and what exceeds the daily maximum (jobs.daily_capacity_hours, 8 h) moves to the next working day. Tasks get planned_from/planned_to on the form. Holidays (/settings/holidays): Finnish public holidays calculated per year, which the admin can take out of use, plus company days off. Also includes the earlier uncommitted work: workflow templates with adding tasks from a template, and removing customers no module refers to. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Workflow templates (työnkulkupohjat) of work types and their steps, from
|
||||
* which a customer job gets a ready list of tasks.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('workflow_templates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('work_type_id')->constrained()->restrictOnDelete();
|
||||
$table->string('name', 100);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('workflow_template_steps', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('workflow_template_id')->constrained()->cascadeOnDelete();
|
||||
// Null: the step's task gets the template's work type.
|
||||
$table->foreignId('work_type_id')->nullable()->constrained()->restrictOnDelete();
|
||||
$table->string('title');
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('sort_order');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['workflow_template_id', 'sort_order']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('workflow_template_steps');
|
||||
Schema::dropIfExists('workflow_templates');
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
/**
|
||||
* Changes to the calculated Finnish holidays: a holiday taken out of use
|
||||
* (is_holiday false) or the company's own day off (is_holiday true).
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('holiday_overrides', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->date('date')->unique();
|
||||
$table->boolean('is_holiday');
|
||||
$table->string('name', 100)->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('holiday_overrides');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* A task's planned schedule (shown in the task calendar) and the hours
|
||||
* it books from each assignee's days.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->date('planned_from')->nullable()->after('due_on');
|
||||
$table->date('planned_to')->nullable()->after('planned_from');
|
||||
$table->index(['planned_from', 'planned_to']);
|
||||
});
|
||||
|
||||
Schema::create('task_bookings', function (Blueprint $table) {
|
||||
$table->foreignId('task_id')->constrained('tasks')->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->date('day');
|
||||
$table->unsignedInteger('minutes');
|
||||
$table->primary(['task_id', 'user_id', 'day']);
|
||||
$table->index(['user_id', 'day']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('task_bookings');
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropIndex(['planned_from', 'planned_to']);
|
||||
$table->dropColumn(['planned_from', 'planned_to']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user