Add rank management feature with CRUD and UI

Introduces a new rank management system including the Rank model, migrations for the ranks table and user IP address, Livewire components for managing and displaying ranks, and related Blade views. Updates navigation and routes to include the new 'Gestión Rangos' section, and enhances the ShareCodeComponent with user data. Also adds a reusable input field component for forms.
This commit is contained in:
Juan Felipe Duarte
2025-10-23 20:28:47 -05:00
parent aa67099449
commit a558e393f2
17 changed files with 522 additions and 6 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()
{
Schema::table('users', function (Blueprint $table) {
$table->string('ip_address')->nullable();
});
}
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('ip_address');
});
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('ranks', function (Blueprint $table) {
$table->id();
$table->string('nombre'); // Bronce, Plata, Oro, Diamante
$table->string('logo')->nullable();
$table->decimal('cashback', 5, 2)->default(0); // % de cashback personal
$table->decimal('bono_equipo', 5, 2)->default(0); // % de bono sobre ventas del equipo
$table->integer('tope_bono_equipo')->default(0); // límite máximo del bono
// Requisitos
$table->integer('compra_personal_min')->default(0);
$table->integer('directos_activos_min')->default(0);
$table->integer('niveles_min')->default(0);
$table->integer('volumen_equipo_min')->default(0);
// Valor mínimo por nivel (ej: cada nivel >= 300.000)
$table->integer('volumen_por_nivel_min')->default(0);
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('ranks');
}
};