Initial commit: Horux Strategy Platform
- Laravel 11 backend with API REST - React 18 + TypeScript + Vite frontend - Multi-parser architecture for accounting systems (CONTPAQi, Aspel, SAP) - 27+ financial metrics calculation - PDF report generation with Browsershot - Complete documentation (10 documents) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
71
backend/app/Http/Controllers/Admin/ReglaMapeeoController.php
Normal file
71
backend/app/Http/Controllers/Admin/ReglaMapeeoController.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ReglaMapeo;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ReglaMapeeoController extends Controller
|
||||
{
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$query = ReglaMapeo::with(['reporteContable', 'categoriaContable']);
|
||||
|
||||
if ($request->has('sistema_origen')) {
|
||||
$query->where('sistema_origen', $request->sistema_origen);
|
||||
}
|
||||
|
||||
return response()->json($query->orderBy('prioridad', 'desc')->get());
|
||||
}
|
||||
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'sistema_origen' => 'required|string|max:50',
|
||||
'cuenta_padre_codigo' => 'nullable|string|max:20',
|
||||
'rango_inicio' => 'nullable|string|max:20',
|
||||
'rango_fin' => 'nullable|string|max:20',
|
||||
'patron_regex' => 'nullable|string|max:255',
|
||||
'reporte_contable_id' => 'required|exists:reportes_contables,id',
|
||||
'categoria_contable_id' => 'required|exists:categorias_contables,id',
|
||||
'prioridad' => 'integer',
|
||||
'activo' => 'boolean',
|
||||
]);
|
||||
|
||||
$regla = ReglaMapeo::create($validated);
|
||||
|
||||
return response()->json($regla->load(['reporteContable', 'categoriaContable']), 201);
|
||||
}
|
||||
|
||||
public function show(ReglaMapeo $reglaMapeo): JsonResponse
|
||||
{
|
||||
return response()->json($reglaMapeo->load(['reporteContable', 'categoriaContable']));
|
||||
}
|
||||
|
||||
public function update(Request $request, ReglaMapeo $reglaMapeo): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'sistema_origen' => 'string|max:50',
|
||||
'cuenta_padre_codigo' => 'nullable|string|max:20',
|
||||
'rango_inicio' => 'nullable|string|max:20',
|
||||
'rango_fin' => 'nullable|string|max:20',
|
||||
'patron_regex' => 'nullable|string|max:255',
|
||||
'reporte_contable_id' => 'exists:reportes_contables,id',
|
||||
'categoria_contable_id' => 'exists:categorias_contables,id',
|
||||
'prioridad' => 'integer',
|
||||
'activo' => 'boolean',
|
||||
]);
|
||||
|
||||
$reglaMapeo->update($validated);
|
||||
|
||||
return response()->json($reglaMapeo->load(['reporteContable', 'categoriaContable']));
|
||||
}
|
||||
|
||||
public function destroy(ReglaMapeo $reglaMapeo): JsonResponse
|
||||
{
|
||||
$reglaMapeo->delete();
|
||||
return response()->json(['message' => 'Regla de mapeo eliminada']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user