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:
22
app/Models/ContractComment.php
Normal file
22
app/Models/ContractComment.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ContractComment extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'contract_id', 'user_id', 'comment',
|
||||
];
|
||||
|
||||
public function contract()
|
||||
{
|
||||
return $this->belongsTo(CurrentContracts::class, 'contract_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Models\Suppliers;
|
||||
use App\Models\Coupon;
|
||||
use App\Models\Status;
|
||||
use App\Models\Technician;
|
||||
use App\Models\ContractComment;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
||||
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
||||
@@ -68,4 +69,8 @@ class CurrentContracts extends Model
|
||||
return $this->belongsTo(Technician::class, 'technical_id');
|
||||
}
|
||||
|
||||
public function contractComments()
|
||||
{
|
||||
return $this->hasMany(ContractComment::class, 'contract_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\User;
|
||||
use App\Models\Categories;
|
||||
use App\Models\Suppliers;
|
||||
use App\Models\Status;
|
||||
use App\Models\Property;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use TarfinLabs\LaravelSpatial\Casts\LocationCast;
|
||||
use TarfinLabs\LaravelSpatial\Traits\HasSpatial;
|
||||
@@ -18,17 +19,22 @@ class Postulations extends Model
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'category_id',
|
||||
'property_id',
|
||||
'address',
|
||||
'int_number',
|
||||
'references',
|
||||
'appointment',
|
||||
'amount',
|
||||
'details',
|
||||
'photos',
|
||||
'status',
|
||||
'related_postulation_id',
|
||||
'status_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'location' => LocationCast::class
|
||||
'location' => LocationCast::class,
|
||||
'photos' => 'array',
|
||||
];
|
||||
|
||||
public function user()
|
||||
@@ -44,7 +50,19 @@ class Postulations extends Model
|
||||
|
||||
public function suppliers()
|
||||
{
|
||||
return $this->belongsToMany(Suppliers::class, 'postulations_suppliers', 'postulations_id', 'suppliers_id')->withTimestamps();
|
||||
return $this->belongsToMany(Suppliers::class, 'postulations_suppliers', 'postulations_id', 'suppliers_id')
|
||||
->withPivot('date_1', 'date_2', 'amount')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function property()
|
||||
{
|
||||
return $this->belongsTo(Property::class);
|
||||
}
|
||||
|
||||
public function relatedPostulation()
|
||||
{
|
||||
return $this->belongsTo(Postulations::class, 'related_postulation_id');
|
||||
}
|
||||
|
||||
public function status()
|
||||
|
||||
17
app/Models/Property.php
Normal file
17
app/Models/Property.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Property extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id', 'name', 'address', 'int_number', 'lat', 'lng', 'icon',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,9 @@ class Suppliers extends Model
|
||||
|
||||
public function postulations()
|
||||
{
|
||||
return $this->belongsToMany(Postulations::class, 'postulations_suppliers', 'suppliers_id', 'postulations_id')->withTimestamps();
|
||||
return $this->belongsToMany(Postulations::class, 'postulations_suppliers', 'suppliers_id', 'postulations_id')
|
||||
->withPivot('date_1', 'date_2', 'amount')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function payments()
|
||||
|
||||
@@ -8,6 +8,8 @@ use App\Models\Suppliers;
|
||||
use App\Models\Postulations;
|
||||
use App\Models\Report;
|
||||
use App\Models\ReportComment;
|
||||
use App\Models\Property;
|
||||
use App\Models\ContractComment;
|
||||
use App\Models\CurrentContracts;
|
||||
use App\Models\FinishedContracts;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
@@ -82,6 +84,16 @@ class User extends Authenticatable
|
||||
return $this->hasMany(ReportComment::class);
|
||||
}
|
||||
|
||||
public function properties()
|
||||
{
|
||||
return $this->hasMany(Property::class);
|
||||
}
|
||||
|
||||
public function contractcomments()
|
||||
{
|
||||
return $this->hasMany(ContractComment::class);
|
||||
}
|
||||
|
||||
public function roles()
|
||||
{
|
||||
return $this->belongsTo(Role::class, 'role_id');
|
||||
|
||||
Reference in New Issue
Block a user