feat: Phase 1 bootstrap — adapt BukidBountyApp as BarangaySystem
- Replace UserTypes with barangay roles (super_admin, punong_barangay, kagawad, secretary, treasurer, sk_chairperson, sk_councilor, tanod, bhw, daycare_worker, staff, resident, audit) - Replace UserActions with barangay-specific permissions (residents, households, blotters, documents, fee payments, projects, budget) - Replace modules config with barangay modules (residents, households, blotters, documents, certificates, projects, budget, announcements, accounting, chapters, qr_payment, subscriptions, landing_pages) - Update app name, seeders, and landing page to barangay defaults - Add new enums: DocumentStatus, BlotterStatus, PaymentStatus - Add 6 new migrations: residents, households, blotters, document requests, projects, budget - Add RequestTypeSeeder with default certificate fee schedule - Update README with BarangaySystem stack, roles, and remotes
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayResidentsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_residents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('firstname');
|
||||
$table->string('middlename')->nullable();
|
||||
$table->string('lastname');
|
||||
$table->string('suffix')->nullable();
|
||||
$table->date('dob')->nullable();
|
||||
$table->string('birthplace')->nullable();
|
||||
$table->enum('gender', ['MALE', 'FEMALE', 'OTHER'])->nullable();
|
||||
$table->enum('civil_status', ['SINGLE', 'MARRIED', 'WIDOWED', 'SEPARATED', 'ANNULLED'])->nullable();
|
||||
$table->string('citizenship')->nullable()->default('Filipino');
|
||||
$table->string('religion')->nullable();
|
||||
$table->string('occupation')->nullable();
|
||||
$table->decimal('monthly_income', 12, 2)->nullable();
|
||||
$table->string('blood_type')->nullable();
|
||||
$table->boolean('voter_status')->default(false);
|
||||
$table->string('registered_voter_id')->nullable();
|
||||
$table->string('voter_precinct')->nullable();
|
||||
$table->boolean('head_of_household')->default(false);
|
||||
// Address
|
||||
$table->string('purok')->nullable();
|
||||
$table->string('street')->nullable();
|
||||
$table->string('barangay')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->string('province')->nullable();
|
||||
$table->string('region')->nullable();
|
||||
// Government IDs
|
||||
$table->string('philhealth_id')->nullable();
|
||||
$table->string('sss_id')->nullable();
|
||||
$table->string('gsis_id')->nullable();
|
||||
$table->string('tin')->nullable();
|
||||
// Emergency contact
|
||||
$table->string('emergency_contact_name')->nullable();
|
||||
$table->string('emergency_contact_phone')->nullable();
|
||||
$table->string('emergency_contact_address')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_residents');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayHouseholdsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_households', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('household_no')->unique()->nullable();
|
||||
$table->unsignedBigInteger('head_resident_id')->nullable()->index();
|
||||
$table->string('address')->nullable();
|
||||
$table->string('purok')->nullable();
|
||||
$table->string('barangay')->nullable();
|
||||
$table->string('city')->nullable();
|
||||
$table->string('province')->nullable();
|
||||
$table->unsignedInteger('member_count')->default(0);
|
||||
$table->enum('ownership_type', ['OWNED', 'RENTED', 'SHARED'])->nullable();
|
||||
$table->decimal('monthly_rental', 10, 2)->nullable();
|
||||
$table->boolean('has_electricity')->default(false);
|
||||
$table->boolean('has_water')->default(false);
|
||||
$table->string('housing_material')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('barangay_household_members', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('household_id')->index();
|
||||
$table->unsignedBigInteger('resident_id')->index();
|
||||
$table->string('relationship_to_head')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_household_members');
|
||||
Schema::dropIfExists('barangay_households');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayBlottersTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_blotters', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('blotter_no')->unique()->nullable();
|
||||
$table->unsignedBigInteger('complainant_user_id')->nullable()->index();
|
||||
$table->string('complainant_name');
|
||||
$table->string('complainant_contact')->nullable();
|
||||
$table->unsignedBigInteger('respondent_user_id')->nullable()->index();
|
||||
$table->string('respondent_name')->nullable();
|
||||
$table->string('respondent_contact')->nullable();
|
||||
$table->enum('incident_type', ['AMICABLE', 'UNLAWFUL', 'MINOR', 'OTHER'])->default('AMICABLE');
|
||||
$table->date('incident_date')->nullable();
|
||||
$table->string('incident_location')->nullable();
|
||||
$table->text('narrative')->nullable();
|
||||
$table->enum('status', ['FILED', 'FOR_HEARING', 'SETTLED', 'RESOLVED', 'DISMISSED', 'ENDORSED'])->default('FILED');
|
||||
$table->timestamp('complaint_date')->nullable();
|
||||
$table->unsignedBigInteger('filed_by')->nullable();
|
||||
$table->unsignedBigInteger('assigned_officer_id')->nullable()->index();
|
||||
$table->text('resolution')->nullable();
|
||||
$table->string('settlement_type')->nullable();
|
||||
$table->string('endorsed_to')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('barangay_blotter_hearings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('blotter_id')->index();
|
||||
$table->timestamp('hearing_date')->nullable();
|
||||
$table->enum('status', ['SCHEDULED', 'HELD', 'POSTPONED'])->default('SCHEDULED');
|
||||
$table->unsignedBigInteger('officer_id')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->text('resolution')->nullable();
|
||||
$table->timestamp('next_hearing_date')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_blotter_hearings');
|
||||
Schema::dropIfExists('barangay_blotters');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayDocumentRequestsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_request_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('name');
|
||||
$table->string('code')->unique();
|
||||
$table->text('description')->nullable();
|
||||
$table->decimal('base_fee', 10, 2)->default(0);
|
||||
$table->unsignedInteger('processing_days')->default(1);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->boolean('requires_clearance')->default(false);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('barangay_document_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('request_no')->unique()->nullable();
|
||||
$table->unsignedBigInteger('resident_user_id')->nullable()->index();
|
||||
$table->unsignedBigInteger('request_type_id')->index();
|
||||
$table->text('purpose')->nullable();
|
||||
$table->decimal('fee_amount', 10, 2)->default(0);
|
||||
$table->enum('payment_status', ['PENDING', 'PAID', 'REFUNDED', 'WAIVED'])->default('PENDING');
|
||||
$table->enum('payment_method', ['CASH', 'GCASH', 'QRPH', 'BANK', 'WAIVED'])->nullable();
|
||||
$table->string('payment_ref')->nullable();
|
||||
$table->text('qrph_code')->nullable();
|
||||
$table->enum('status', ['DRAFT', 'PENDING_PAYMENT', 'PAID', 'PROCESSING', 'READY', 'CLAIMED', 'CANCELLED'])->default('DRAFT');
|
||||
$table->unsignedBigInteger('requested_by')->nullable();
|
||||
$table->unsignedBigInteger('processed_by')->nullable();
|
||||
$table->timestamp('claimed_at')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
|
||||
Schema::create('barangay_request_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('request_id')->index();
|
||||
$table->decimal('amount', 10, 2);
|
||||
$table->enum('method', ['CASH', 'GCASH', 'QRPH', 'BANK', 'WAIVED']);
|
||||
$table->string('reference')->nullable();
|
||||
$table->text('qrph_raw')->nullable();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->unsignedBigInteger('verified_by')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_request_payments');
|
||||
Schema::dropIfExists('barangay_document_requests');
|
||||
Schema::dropIfExists('barangay_request_types');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayProjectsTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_projects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('project_name');
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('type', ['INFRASTRUCTURE', 'LIVELIHOOD', 'HEALTH', 'EDUCATION', 'ENVIRONMENT', 'OTHERS'])->default('INFRASTRUCTURE');
|
||||
$table->decimal('budget', 15, 2)->nullable();
|
||||
$table->enum('fund_source', ['GENERAL_FUND', 'SK', 'PROVINCE', 'NATIONAL', 'OTHERS'])->default('GENERAL_FUND');
|
||||
$table->date('start_date')->nullable();
|
||||
$table->date('end_date')->nullable();
|
||||
$table->enum('status', ['PLANNED', 'ONGOING', 'COMPLETED', 'SUSPENDED', 'CANCELLED'])->default('PLANNED');
|
||||
$table->string('implementing_office')->nullable();
|
||||
$table->string('contractor')->nullable();
|
||||
$table->string('location')->nullable();
|
||||
$table->unsignedInteger('beneficiaries_count')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_projects');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Hyperf\Database\Schema\Blueprint;
|
||||
use Hyperf\Database\Schema\Schema;
|
||||
use Hyperf\Database\Migrations\Migration;
|
||||
|
||||
class CreateBarangayBudgetTable extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('barangay_budget', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('hashkey')->unique()->nullable();
|
||||
$table->string('fiscal_year', 4);
|
||||
$table->enum('category', ['INCOME', 'EXPENSE']);
|
||||
$table->string('source');
|
||||
$table->decimal('amount', 15, 2);
|
||||
$table->text('description')->nullable();
|
||||
$table->date('date')->nullable();
|
||||
$table->string('reference')->nullable();
|
||||
$table->unsignedBigInteger('encoded_by')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('barangay_budget');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user