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:
@@ -218,6 +218,13 @@ class PostulationController extends Controller
|
||||
$time_limit = (9900 - Carbon::now()->diffInMinutes($time_created));
|
||||
$supplier = Suppliers::where('user_id', $user->id)->first();
|
||||
|
||||
if (!$supplier) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'No tienes un perfil de proveedor registrado'
|
||||
], 400);
|
||||
}
|
||||
|
||||
if ($time_limit > 0) {
|
||||
if (in_array($postulation->category_id, $supplier->categories->pluck('id')->toArray())) {
|
||||
/*if($supplier->membership == 1) {
|
||||
@@ -282,6 +289,14 @@ class PostulationController extends Controller
|
||||
|
||||
public function getfinishedpostulations(Request $request) {
|
||||
$user = Auth::user();
|
||||
|
||||
if (!$user->suppliers) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'No tienes un perfil de proveedor registrado'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$postulations = FinishedContracts::where('supplier_id', $user->suppliers->id)->orderBy('created_at', 'DESC')->get();
|
||||
$finishedpostulations = array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user