55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\V2\Dashboard;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Carbon\Carbon;
|
|
use Hekmatinasser\Verta\Verta;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\RoadObservationHistory;
|
|
use App\Models\RoadObserved;
|
|
use App\Models\City;
|
|
use App\Models\User;
|
|
use App\Models\EdarateShahri;
|
|
use App\Models\Contractor;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use App\Models\SafetyAndPrivacy;
|
|
use App\Models\InfoItem;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use App\Exports\V2\SafetyAndPrivacy\SafetyAndPrivacyTable\AllSheets as SafetyAndPrivacyTable;
|
|
|
|
class SafetyAndPrivacyReportController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
return view('version2.dashboard_pages.safety_and_privacy.report');
|
|
}
|
|
|
|
public function safetyAndPrivacyData(Request $request): JsonResponse
|
|
{
|
|
|
|
return response()->json([
|
|
'status' => 'succeed',
|
|
'message' => '',
|
|
'data' => SafetyAndPrivacy::provinceData($request->from_date, $request->date_to),
|
|
], 200);
|
|
|
|
}
|
|
|
|
function totalGroupProvinceCity(Request $request) : JsonResponse
|
|
{
|
|
return response()->json(SafetyAndPrivacy::EdareData($request->from_date, $request->date_to, $request->province_id), 200);
|
|
}
|
|
|
|
|
|
public function safetyAndPrivacyExcel(Request $request)
|
|
{
|
|
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
|
return Excel::download(new SafetyAndPrivacyTable($request->from_date, $request->date_to), $name);
|
|
}
|
|
}
|