feat: branch betos — propiedades, oferta de proveedores, chat en contratos y flujo de postulacion renovado

- Sistema de propiedades: tabla, modelo, CRUD API para que el cliente guarde direcciones nombradas
- Postulacion renovada: cliente elige propiedad sin precio ni fecha, sube fotos a GCS/S3
- Proveedores ofertan date_1, date_2 y amount al postularse via pivot; sort por fecha/monto/membresia
- Contratacion: selected_date recibe date_1 o date_2, amount desde pivot (depreca minimun_fee)
- Cancelacion/repostulacion: archive con status=perdido, related_postulation_id para vincular
- Chat en contratos activos: tabla contract_comments, controller, rutas web+API, vista panel, notificaciones bilingues
- PaymentIntent calcula amount desde pivot en vez de recibirlo del front
- getpendingcontracts: sin filtro de tiempo, filtra por status=active, agrega time_created
- Expiracion de postulaciones reducida a 1000 min

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 11:26:10 -06:00
parent 0ed98c96ee
commit 700ddafba4
21 changed files with 944 additions and 180 deletions

View File

@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePropertiesTable extends Migration
{
public function up()
{
Schema::create('properties', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->string('name');
$table->string('address');
$table->string('int_number')->nullable();
$table->decimal('lat', 10, 7);
$table->decimal('lng', 10, 7);
$table->enum('icon', ['casa', 'oficina'])->default('casa');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
public function down()
{
Schema::dropIfExists('properties');
}
}

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterPostulationsAddPropertyNullableAmount extends Migration
{
public function up()
{
Schema::table('postulations', function (Blueprint $table) {
$table->unsignedBigInteger('property_id')->nullable()->after('category_id');
$table->json('photos')->nullable()->after('details');
$table->float('amount')->nullable()->change();
$table->foreign('property_id')->references('id')->on('properties')->onDelete('set null');
});
}
public function down()
{
Schema::table('postulations', function (Blueprint $table) {
$table->dropForeign(['property_id']);
$table->dropColumn(['property_id', 'photos']);
$table->float('amount')->nullable(false)->change();
});
}
}

View File

@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterPostulationsSuppliersAddOfferFields extends Migration
{
public function up()
{
Schema::table('postulations_suppliers', function (Blueprint $table) {
$table->timestamp('date_1')->nullable()->after('suppliers_id');
$table->timestamp('date_2')->nullable()->after('date_1');
$table->float('amount')->nullable()->after('date_2');
});
}
public function down()
{
Schema::table('postulations_suppliers', function (Blueprint $table) {
$table->dropColumn(['date_1', 'date_2', 'amount']);
});
}
}

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractCommentsTable extends Migration
{
public function up()
{
Schema::create('contract_comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contract_id');
$table->unsignedBigInteger('user_id')->nullable();
$table->text('comment')->nullable();
$table->timestamps();
$table->foreign('contract_id')->references('id')->on('current_contracts')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
});
}
public function down()
{
Schema::dropIfExists('contract_comments');
}
}

View File

@@ -0,0 +1,27 @@
<?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('postulations', function (Blueprint $table) {
$table->string('status')->default('active')->after('photos');
$table->unsignedBigInteger('related_postulation_id')->nullable()->after('status');
$table->foreign('related_postulation_id')
->references('id')->on('postulations')
->onDelete('set null');
});
}
public function down(): void
{
Schema::table('postulations', function (Blueprint $table) {
$table->dropForeign(['related_postulation_id']);
$table->dropColumn(['status', 'related_postulation_id']);
});
}
};