Fix: Correcciones panel admin y API frontend

## Panel de Administración

### FormBuilder personalizado (Laravel 11)
- Creado app/Support/FormBuilder.php como reemplazo de laravelcollective/html
- Creado app/Support/Facades/Form.php para el facade
- Registrado en AppServiceProvider y config/app.php
- Soporta: text, email, password, file, textarea, select, checkbox, radio, etc.
- Manejo de valores null en todos los parámetros

### Configuración de sesión
- Cambiado same_site de "none" a "lax" para compatibilidad HTTP
- Corrige error 419 Page Expired en login

### Status CRUD
- Agregado campo en_name al formulario (español/inglés)
- Actualizado StatusController create/update para manejar en_name

### Dependencias
- Instalado spatie/laravel-google-cloud-storage para driver GCS

## API Frontend

### Validaciones de perfil de proveedor
Agregadas validaciones en endpoints que requieren perfil de proveedor:

- SupplierController::getpostulation - Retorna error 400 si no hay perfil
- SupplierController::getcontractedpostulation - Retorna error 400 si no hay perfil
- PostulationController::postulate - Retorna error 400 si no hay perfil
- PostulationController::getfinishedpostulations - Retorna error 400 si no hay perfil
- ContractController::startcontract - Retorna error 400 si no hay perfil

### Null safety en contratos
- ContractController::getcurrentcontracts - Manejo seguro de supplier/category null
- ContractController::getfinishedcontracts - Manejo seguro de supplier/category/status null

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-18 23:16:34 +00:00
parent 46469deaa8
commit 5e3b203f84
12 changed files with 469 additions and 13 deletions

View File

@@ -639,12 +639,12 @@ class ContractController extends Controller
$day_limit = Carbon::parse($ccontract->created_at);
$currentcontractinfo = array(
'id' => $ccontract->id,
'phone' => $supplier->user->phone,
'category' => $category->name,
'en_category' => $category->en_name,
'phone' => $supplier ? ($supplier->user ? $supplier->user->phone : null) : null,
'category' => $category ? $category->name : null,
'en_category' => $category ? $category->en_name : null,
'address' => $ccontract->address,
'date' => $ccontract->appointment,
'supplier' => $supplier->company_name,
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
'status' => $ccontract->status_id,
'amount' => $ccontract->amount,
'code' => $ccontract->code,
@@ -778,6 +778,14 @@ class ContractController extends Controller
$user = Auth::user();
$supplier = $user->suppliers;
if (!$supplier) {
return response()->json([
'success' => false,
'message' => 'No tienes un perfil de proveedor registrado'
], 400);
}
$ccontract = CurrentContracts::where('code', $request->contract_pin)->where('supplier_id', $supplier->id)->first();
if($ccontract) {
@@ -969,16 +977,16 @@ class ContractController extends Controller
$day_limit = Carbon::parse($fcontract->created_at);
$finishedcontractinfo = array(
'id' => $fcontract->id,
'category' => $category->name,
'en_category' => $category->en_name,
'category' => $category ? $category->name : null,
'en_category' => $category ? $category->en_name : null,
'address' => $fcontract->address,
'date' => $fcontract->appointment,
'date_difference' => $time_limit->diff(Carbon::now(), false)->days,
'supplier' => $supplier->company_name,
'supplier' => $supplier ? $supplier->company_name : 'Proveedor no disponible',
'amount' => $fcontract->amount,
'scored' => $fcontract->scored_at,
'parent' => $fcontract->parent_contract_id,
'status' => $fcontract->status->name
'status' => $fcontract->status ? $fcontract->status->name : null
);
$finishedcontracts[] = $finishedcontractinfo;
}