diff --git a/app/Http/Controllers/Dashboard/ObrasController.php b/app/Http/Controllers/Dashboard/ObrasController.php index 38f34bc..c8ee62f 100644 --- a/app/Http/Controllers/Dashboard/ObrasController.php +++ b/app/Http/Controllers/Dashboard/ObrasController.php @@ -9,17 +9,38 @@ class ObrasController extends BaseController { public function Obras(Request $request) { - $query = $request->only(['start', 'end', 'type']); - $query = array_merge(['type' => 'api'], $query); + $query = $request->only(['start', 'end', 'type', 'action']); + $query = array_merge($query, ['action' => 'index', 'type' => 'api'], $query); try { - $response = Http::timeout(5)->get('https://obras-information.comalcalco.gob.mx/api/controller.php?action=getCounters', $query); + $response = Http::timeout(5)->get('https://obras-information.comalcalco.gob.mx/api/controller.php', $query); if (! $response->successful()) { return response()->json(['error' => 'External service error'], $response->status()); } - return response()->json($response->json(), $response->status()) + $mainData = $response->json(); + + $counterQuery = array_merge($query, ['action' => 'getCounters']); + $countersResponse = Http::timeout(5)->get('https://obras-information.comalcalco.gob.mx/api/controller.php', $counterQuery); + + $countersData = []; + if ($countersResponse->successful()) { + $countersData = $countersResponse->json(); + } + + $usersQuery = array_merge($query, ['action' => 'actionsOfSupervisors']); + $userResponse = Http::timeout(5)->get('https://obras-information.comalcalco.gob.mx/api/controller.php', $usersQuery); + + $usersData = []; + if($userResponse->successful()) { + $usersData = $userResponse->json(); + } + + // Combinar ambas respuestas + $combinedData = array_merge($mainData, ['counters' => $countersData, 'users' => $usersData]); + + return response()->json($combinedData, $response->status()) ->header('Content-Type', $response->header('Content-Type', 'application/json')); } catch (\Throwable $e) { Log::error('Proxy error: '.$e->getMessage()); diff --git a/package-lock.json b/package-lock.json index e8c9c45..e292790 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "@googlemaps/js-api-loader": "^1.16.10", "@inertiajs/vue3": "^1.0.0-beta.2", "@soketi/soketi": "^1.6.0", "@vueuse/core": "^9.6.0", @@ -408,6 +409,12 @@ "node": ">=12" } }, + "node_modules/@googlemaps/js-api-loader": { + "version": "1.16.10", + "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.16.10.tgz", + "integrity": "sha512-c2erv2k7P2ilYzMmtYcMgAR21AULosQuUHJbStnrvRk2dG93k5cqptDrh9A8p+ZNlyhiqEOgHW7N9PAizdUM7Q==", + "license": "Apache-2.0" + }, "node_modules/@inertiajs/core": { "version": "1.0.14", "resolved": "https://registry.npmjs.org/@inertiajs/core/-/core-1.0.14.tgz", diff --git a/package.json b/package.json index 1778756..3466eea 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "vue": "^3.2.31" }, "dependencies": { + "@googlemaps/js-api-loader": "^1.16.10", "@inertiajs/vue3": "^1.0.0-beta.2", "@soketi/soketi": "^1.6.0", "@vueuse/core": "^9.6.0", diff --git a/resources/js/Components/Dashboard/Maps.vue b/resources/js/Components/Dashboard/Maps.vue new file mode 100644 index 0000000..022a954 --- /dev/null +++ b/resources/js/Components/Dashboard/Maps.vue @@ -0,0 +1,367 @@ + + + diff --git a/resources/js/Pages/Dashboard/Obras.vue b/resources/js/Pages/Dashboard/Obras.vue index 454b48d..287758b 100644 --- a/resources/js/Pages/Dashboard/Obras.vue +++ b/resources/js/Pages/Dashboard/Obras.vue @@ -1,29 +1,1282 @@ - diff --git a/routes/api.php b/routes/api.php index 4851d4c..5472386 100644 --- a/routes/api.php +++ b/routes/api.php @@ -20,7 +20,7 @@ return $request->user(); }); -Route::middleware(['throttle:60,1'])->get('/reporte-especial', [TramiteController::class, 'tramiteEspecial']); - -Route::middleware(['throttle:60,1'])->get('/reporte-obras', [ObrasController::class, 'Obras']); - +Route::middleware('api')->group(function () { + Route::get('/reporte-obras', [ObrasController::class, 'Obras'])->middleware(['throttle:60,1']); + Route::get('/reporte-especial', [TramiteController::class, 'tramiteEspecial'])->middleware(['throttle:60,1']); +});