Adding delay and penalty calculations

This commit is contained in:
2026-07-22 14:10:05 +03:30
parent 28bf82cde9
commit e1f86e6ffe
21 changed files with 1285 additions and 99 deletions
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->date('birthday')->nullable()->after('number');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('birthday');
});
}
};
@@ -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
{
public function up(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->unsignedInteger('late_minutes')->default(0);
$table->unsignedInteger('daily_fine_minutes')->default(0);
$table->unsignedInteger('daily_fine_amount')->default(0);
});
Schema::create('late_period_fines', function (Blueprint $table) {
$table->id();
$table->string('user_identity');
$table->string('period_type'); // weekly | monthly
$table->date('period_start');
$table->date('period_end');
$table->unsignedInteger('late_minutes')->default(0);
$table->unsignedInteger('allowance_minutes')->default(0);
$table->unsignedInteger('fine_minutes')->default(0);
$table->unsignedInteger('fine_amount')->default(0);
$table->unsignedInteger('daily_fine_amount')->default(0);
$table->unsignedInteger('weekly_fine_amount')->default(0);
$table->unsignedInteger('total_fine_amount')->default(0);
$table->timestamps();
$table->unique(['user_identity', 'period_type', 'period_start', 'period_end'], 'late_period_unique');
$table->index(['period_type', 'period_start']);
});
}
public function down(): void
{
Schema::dropIfExists('late_period_fines');
Schema::table('attendances', function (Blueprint $table) {
$table->dropColumn(['late_minutes', 'daily_fine_minutes', 'daily_fine_amount']);
});
}
};