Merge branch 'bryam' of https://github.com/BryamE/ProyectoLauck into giane

This commit is contained in:
gianella
2026-03-13 11:37:52 -03:00
46 changed files with 2310 additions and 368 deletions
+8 -7
View File
@@ -19,23 +19,24 @@ class ProductFactory extends Factory
$brands = ['Shimano', 'Venzo', 'Trek', 'Specialized', 'Maxxis', 'Sram', 'Raleigh'];
$bikeModels = ['Loki', 'Marlin 5', 'Chisel', 'Talon 3', 'Aspect 950'];
$accessories = ['Guantes Grip', 'Calco Reflectora', 'Coderas', 'Rodilleras', 'Casco MTB', 'Luz Delantera USB', 'Cubierta Kevlar'];
// PARA DESPUES
$spareParts = ['Manubrio', 'Pedales Aluminio', 'Cámara 29"', 'Rayos x50', 'Disco de Freno', 'Cable de Freno', 'Asiento Goma', 'Cadena 9v'];
$type = $this->faker->randomElement(['bike', 'accessory', 'service']);
$cats = ['Pro', 'Basic', 'Comp', 'Elite'];
$type = $this->faker->randomElement(['bike', 'accessory', 'clothing', 'spare']);
// Generar nombre según el tipo
if ($type === 'bike') {
$name = $this->faker->randomElement($brands) . ' ' . $this->faker->randomElement($bikeModels);
} elseif ($type === 'accessory') {
$name = $this->faker->randomElement($accessories) . ' ' . $this->faker->randomElement(['Pro', 'Basic', 'Comp', 'Elite']);
$name = $this->faker->randomElement($accessories) .' '. $this->faker->randomElement($cats);
} elseif ($type === 'clothing') {
$name = $this->faker->randomElement(['Remera', 'Pantalon', 'Casco', 'Coderas', 'Guantes']).' '.$this->faker->randomElement($cats);
} else {
$name = $this->faker->randomElement(['Service General', 'Ajuste Cambios', 'Centrado de Rueda', 'Lavado y Engrase']);
$name = $this->faker->randomElement($spareParts) .' '. $this->faker->randomElement($cats);
}
// Lógica de Precios
$price = $this->faker->numberBetween(5000, 800000);
$cost = $price * $this->faker->randomFloat(2, 0.5, 0.7);
$price = $this->faker->numberBetween(5000, 200000);
$cost = $price * $this->faker->randomFloat(2, 0.1, 0.8);
return [
'name' => $name,
@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->enum('role', ['admin', 'employee'])->default('employee')->after('email');
$table->enum('role', ['admin', 'employee', 'guest'])->default('guest')->after('email');
});
}
@@ -24,8 +24,8 @@ return new class extends Migration
$table->integer('stock_quantity')->default(0);
$table->integer('min_stock_alert'); // Alerta
$table->string('rolled')->nullable(); // Solo para bicis
$table->enum('type', ['bike', 'accessory', 'clothing', 'spare']); // Tipo de producto
$table->string('serial_number')->nullable(); // Solo para bicis
$table->foreignId('suppliers_id')->constrained()->default(1);
$table->timestamps();
@@ -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::table('appointments', function (Blueprint $table) {
// Repuestos estimados (texto simple por ahora)
$table->text('parts_needed')->nullable()->after('problem_description');
// Costo (Presupuesto)
$table->decimal('estimated_cost', 10, 2)->nullable()->after('parts_needed');
// Teléfono de contacto rápido (por si es distinto al del cliente registrado)
$table->string('contact_phone')->nullable()->after('client_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('appointments', function (Blueprint $table) {
$table->dropColumn(['parts_needed', 'estimated_cost', 'contact_phone']);
});
}
};
+5 -3
View File
@@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder
{
//Crear el Super Admin
User::factory()->create([
'name' => 'Jose Admin',
'name' => 'Sergio Lauck',
'email' => 'admin@lauck.com',
'password' => bcrypt('password'), // Cambiar en producción
'role' => 'admin',
@@ -60,9 +60,9 @@ class DatabaseSeeder extends Seeder
'suppliers_id' => 1
]);
// Generar 10 productos aleatorios más
// Generar 50 productos aleatorios más
Product::factory(50)->create();
// Clientes y Turnos
$client = Client::create([
'name' => 'Juan Perez',
@@ -77,5 +77,7 @@ class DatabaseSeeder extends Seeder
'problem_description' => 'Service completo y ajuste de cambios',
'status' => 'pending'
]);
$this->call(ProductSeeder::class);
}
}
+299
View File
@@ -0,0 +1,299 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Product;
class ProductSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Productos del Excel
$products = [
// 1. BICICLETAS
[
'name' => 'Bicicleta R12 nena-varon rueda maciza',
'sku' => 'BIC-001',
'price' => 148000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 con rayos varon',
'sku' => 'BIC-002',
'price' => 175000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 reina flecos canasto',
'sku' => 'BIC-003',
'price' => 999,
'cost' => 111,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 topmega nena',
'sku' => 'BIC-004',
'price' => 250000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 topmega varon',
'sku' => 'BIC-005',
'price' => 250000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 Max SLP',
'sku' => 'BIC-006',
'price' => 250000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R12 Max SLP rueda megnesio',
'sku' => 'BIC-007',
'price' => 268000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R12 SLP dolphin',
'sku' => 'BIC-008',
'price' => 250000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Camicleta SLP varon',
'sku' => 'BIC-009',
'price' => 139000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Camicleta SLP ruedas macizas',
'sku' => 'BIC-010',
'price' => 138000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Camicleta SLP rayos',
'sku' => 'BIC-011',
'price' => 185000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Camicleta Economica ruedas macizas rosa',
'sku' => 'BIC-012',
'price' => 100000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R14 Cross varon',
'sku' => 'BIC-013',
'price' => 228000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R14 Full nena',
'sku' => 'BIC-014',
'price' => 228000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R16 Peretti nena canasto',
'sku' => 'BIC-015',
'price' => 239000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R16 Firebird',
'sku' => 'BIC-016',
'price' => 269000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R16 Full nena',
'sku' => 'BIC-017',
'price' => 239000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike', // bike, accessory, clothing, spare
],
[
'name' => 'Bicicleta R16 dolphin/zest nena',
'sku' => 'BIC-018',
'price' => 269000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R16 Cross estabilizadores',
'sku' => 'BIC-019',
'price' => 230000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R16 Peretti Cross',
'sku' => 'BIC-020',
'price' => 235000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R16 Max SLP',
'sku' => 'BIC-021',
'price' => 268000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R16 Cross Peretti cromada',
'sku' => 'BIC-022',
'price' => 240000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R16 Cross Topmega',
'sku' => 'BIC-023',
'price' => 240000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R20 Cross',
'sku' => 'BIC-024',
'price' => 245000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R20 Peretti Cross varon',
'sku' => 'BIC-025',
'price' => 245000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R20 Max SLP varon',
'sku' => 'BIC-026',
'price' => 298000,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
[
'name' => 'Bicicleta R20 Firebird',
'sku' => 'BIC-027',
'price' => 1,
'cost' => 100000,
'stock_quantity' => 5,
'min_stock_alert' => 2,
'type' => 'bike',
],
// 2. ACCESORIOS
[
'name' => 'Cámara 29 Valvula Auto',
'sku' => 'CAM-29-A',
'price' => 5000,
'cost' => 2500,
'stock_quantity' => 50,
'min_stock_alert' => 10,
'type' => 'accessory',
],
[
'name' => 'Servicio de Lavado',
'sku' => 'SRV-LAV',
'price' => 3000,
'cost' => 0,
'stock_quantity' => 999,
'min_stock_alert' => 0,
'type' => 'clothing',
],
];
// BUCLE DE CARGA
foreach ($products as $item) {
Product::updateOrCreate(
['sku' => $item['sku']],
[
'name' => $item['name'],
'price' => $item['price'],
'cost' => $item['cost'] ?? 0,
'stock_quantity' => $item['stock_quantity'] ?? 0,
'min_stock_alert' => $item['min_stock_alert'] ?? 5,
'type' => $item['type'] ?? 'accessory',
'description' => $item['description'] ?? null,
]
);
}
}
}