fuelPriceService = $fuelPriceService; } public function onDemand() { $response = $this->fuelPriceService->getCurrentPrices(); if (!$response['success']) { return back()->with('error', $response['message']); } return view('pages.fuel-price-on-demand', [ 'prices' => $response['data'] ]); } public function updateOnDemand(Request $request) { $response = $this->fuelPriceService->updatePrices($request->all()); if (!$response['success']) { return back()->withInput()->with('error', $response['message']); } return redirect()->route('fuel-price.on-demand') ->with('success', 'Fuel prices updated successfully'); } public function schedule() { $response = $this->fuelPriceService->getScheduledUpdates(); if (!$response['success']) { return back()->with('error', $response['message']); } return view('pages.fuel-price-schedule', [ 'schedules' => $response['data'] ]); } public function storeSchedule(Request $request) { $response = $this->fuelPriceService->createSchedule($request->all()); if (!$response['success']) { return back()->withInput()->with('error', $response['message']); } return redirect()->route('fuel-price.schedule') ->with('success', 'Price update scheduled successfully'); } public function updateSchedule(Request $request, $id) { $response = $this->fuelPriceService->updateSchedule($id, $request->all()); if (!$response['success']) { return back()->withInput()->with('error', $response['message']); } return redirect()->route('fuel-price.schedule') ->with('success', 'Schedule updated successfully'); } public function deleteSchedule($id) { $response = $this->fuelPriceService->deleteSchedule($id); if (!$response['success']) { return back()->with('error', $response['message']); } return redirect()->route('fuel-price.schedule') ->with('success', 'Schedule deleted successfully'); } public function logs() { $response = $this->fuelPriceService->getUpdateLogs(); if (!$response['success']) { return back()->with('error', $response['message']); } return view('pages.fuel-price-update-logs', [ 'logs' => $response['data'] ]); } public function importPrices(Request $request) { $response = $this->fuelPriceService->importPrices($request->file('csv_file')); if (!$response['success']) { return back()->withInput()->with('error', $response['message']); } return redirect()->route('fuel-price.on-demand') ->with('success', 'Fuel prices imported successfully'); } public function exportPrices() { return $this->fuelPriceService->exportPrices(); } }