Lots of changes

This commit is contained in:
Simon Pocrnjič
2024-11-13 22:11:07 +01:00
parent 90a5858320
commit 953ff38d64
76 changed files with 2822 additions and 427 deletions
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Action>
*/
class ActionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Activity>
*/
class ActivityFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ClientCase>
*/
class ClientCaseFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Client>
*/
class ClientFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Decision>
*/
class DecisionFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Event>
*/
class EventFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
@@ -15,7 +15,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -24,7 +24,8 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->string('color_tag', 50)->nullable();
$table->softDeletes();
$table->timestamps();
});
@@ -33,7 +34,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -42,7 +43,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -62,7 +63,7 @@ public function up(): void
$table->foreignId('group_id')->references('id')->on('person_groups');
$table->foreignId('type_id')->references('id')->on('person_types');
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->foreignIdFor(\App\Models\User::class);
$table->timestamps();
});
@@ -75,7 +76,7 @@ public function up(): void
$table->string('description',125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->foreignIdFor(\App\Models\User::class);
$table->timestamps();
@@ -89,7 +90,7 @@ public function up(): void
$table->string('description',125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->foreignIdFor(\App\Models\User::class);
$table->timestamps();
@@ -15,7 +15,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -27,7 +27,7 @@ public function up(): void
$table->foreignIdFor(\App\Models\Contract::class);
$table->foreignId('type_id')->references('id')->on('account_types');
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
@@ -15,7 +15,7 @@ public function up(): void
$table->id();
$table->string('name',50)->unique();
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -34,7 +34,7 @@ public function up(): void
$table->foreignId('account_id')->references('id')->on('accounts');
$table->foreignId('type_id')->references('id')->on('debt_types');
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
@@ -16,7 +16,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -30,7 +30,7 @@ public function up(): void
$table->foreignId('debt_id')->references('id')->on('debts');
$table->foreignId('type_id')->references('id')->on('payment_types');
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->foreignIdFor(\App\Models\User::class);
$table->timestamps();
});
@@ -15,7 +15,7 @@ public function up(): void
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
@@ -27,11 +27,10 @@ public function up(): void
$table->date('start_date');
$table->date('end_date')->nullable();
$table->string('description', 255)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class, 'client_id');
$table->foreignIdFor(\App\Models\Person\Person::class, 'debtor_id');
$table->foreignIdFor(\App\Models\ClientCase::class);
$table->foreignId('type_id')->references('id')->on('contract_types');
$table->unsignedTinyInteger('active')->default(1);
$table->unsignedTinyInteger('deleted')->default(0);
$table->softDeletes();
$table->timestamps();
});
}
@@ -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('clients', function (Blueprint $table) {
$table->id();
$table->uuid()->unique();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('clients');
}
};
@@ -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('client_cases', function (Blueprint $table) {
$table->id();
$table->uuid()->unique();
$table->foreignIdFor(\App\Models\Client::class);
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('client_cases');
}
};
@@ -0,0 +1,35 @@
<?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('activities', function (Blueprint $table) {
$table->id();
$table->date('due_date')->nullable();
$table->decimal('amount', 4)->nullable();
$table->text('note')->default('');
$table->foreignIdFor(\App\Models\Action::class);
$table->foreignIdFor(\App\Models\Decision::class);
$table->foreignIdFor(\App\Models\ClientCase::class);
$table->foreignIdFor(\App\Models\Contract::class)->nullable();
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('activities');
}
};
@@ -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('actions', function (Blueprint $table) {
$table->id();
$table->string('name', 125);
$table->string('color_tag', 55)->nullable();
$table->foreignIdFor(\App\Models\Segment::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('actions');
}
};
@@ -0,0 +1,29 @@
<?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('decisions', function (Blueprint $table) {
$table->id();
$table->string('name', 125);
$table->string('color_tag', 55)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('decisions');
}
};
@@ -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('events', function (Blueprint $table) {
$table->id();
$table->string('name', 55);
$table->string('description', 125)->nullable();
$table->jsonb('options');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('events');
}
};
@@ -0,0 +1,29 @@
<?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('decision_events', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Decision::class);
$table->foreignIdFor(\App\Models\Event::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('decision_events');
}
};
@@ -0,0 +1,29 @@
<?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('action_decision', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Action::class);
$table->foreignIdFor(\App\Models\Decision::class);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActivitySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientCaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DecisionSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class EventSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+18 -42
View File
@@ -2,14 +2,12 @@
namespace Database\Seeders;
use App\Models\Contract;
use App\Models\ContractType;
use App\Models\Person\AddressType;
use App\Models\Person\Person;
use App\Models\Person\PersonGroup;
use App\Models\Person\PersonType;
use App\Models\Person\PhoneType;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PersonSeeder extends Seeder
@@ -26,8 +24,8 @@ public function run(): void
];
$personGroups = [
[ 'name' => 'client', 'description' => ''],
[ 'name' => 'debtor', 'description' => '']
[ 'name' => 'client', 'description' => '', 'color_tag' => 'blue-400'],
[ 'name' => 'client case', 'description' => '', 'color_tag' => 'red-400']
];
$phoneTypes = [
@@ -80,7 +78,7 @@ public function run(): void
'group_id' => 1,
'type_id' => 1,
'user_id' => 1
]);
])->client()->create();
//debtors
Person::create([
@@ -96,6 +94,8 @@ public function run(): void
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
])->clientCase()->create([
'client_id' => 1
]);
Person::create([
@@ -111,6 +111,8 @@ public function run(): void
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
])->clientCase()->create([
'client_id' => 1
]);
//client
@@ -127,7 +129,7 @@ public function run(): void
'group_id' => 1,
'type_id' => 1,
'user_id' => 1
]);
])->client()->create();
//debtors
Person::create([
@@ -143,7 +145,11 @@ public function run(): void
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
]);
])->clientCase()->create(
[
'client_id' => 4
]
);
Person::create([
'nu' => rand(100000,200000),
@@ -158,41 +164,11 @@ public function run(): void
'group_id' => 2,
'type_id' => 1,
'user_id' => 1
]);
])->clientCase()->create(
[
'client_id' => 4
]
);
//contract
Contract::create([
'reference' => '111111222',
'start_date' => date('Y-m-d'),
'client_id' => 1,
'debtor_id' => 2,
'type_id' => 1
]);
Contract::create([
'reference' => '111111224',
'start_date' => date('Y-m-d'),
'client_id' => 1,
'debtor_id' => 3,
'type_id' => 1
]);
Contract::create([
'reference' => '211111222',
'start_date' => date('Y-m-d'),
'client_id' => 4,
'debtor_id' => 5,
'type_id' => 1
]);
Contract::create([
'reference' => '211111224',
'start_date' => date('Y-m-d'),
'client_id' => 4,
'debtor_id' => 6,
'type_id' => 1
]);
}
}