add confirm and reject api
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\V3\Dashboard;
|
||||
|
||||
use App\Enums\AxisTypes;
|
||||
use App\Enums\SafetyAndPrivacyStatus;
|
||||
use App\Exports\V3\SafetyAndPrivacy\CartableReport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Facades\File\FileFacade;
|
||||
@@ -18,10 +19,8 @@ use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use App\Services\NominatimService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Throwable;
|
||||
@@ -33,9 +32,9 @@ class SafetyAndPrivacyController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
public function operatorIndex(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->datatable($request));
|
||||
return response()->json($safetyAndPrivacyTableService->operatorDatatable($request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +43,7 @@ class SafetyAndPrivacyController extends Controller
|
||||
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $safetyAndPrivacyTableService->datatable($request);
|
||||
$data = $safetyAndPrivacyTableService->operatorDatatable($request);
|
||||
return Excel::download(new CartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
@@ -78,7 +77,8 @@ class SafetyAndPrivacyController extends Controller
|
||||
'axis_type_id' => $request->axis_type_id,
|
||||
'axis_type_name' => AxisTypes::name($request->axis_type_id),
|
||||
'step' => 1,
|
||||
'step_fa' => 'گام اول (شناسایی)'
|
||||
'step_fa' => 'گام اول (شناسایی)',
|
||||
'is_finished' => false
|
||||
]);
|
||||
|
||||
$safety_and_privacy->recognize_picture = $request->has('recognize_picture') ?
|
||||
@@ -197,4 +197,39 @@ class SafetyAndPrivacyController extends Controller
|
||||
allowedSelects: ['id', 'lat', 'lon', 'step']
|
||||
));
|
||||
}
|
||||
|
||||
public function confirm(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$safetyAndPrivacy->update([
|
||||
'status' => SafetyAndPrivacyStatus::CONFIRM->value,
|
||||
'supervisor_description' => $request->supervisor_description
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function reject(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$safetyAndPrivacy->update([
|
||||
'status' => SafetyAndPrivacyStatus::REJECT->value,
|
||||
'supervisor_description' => $request->supervisor_description
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function finish(Request $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$safetyAndPrivacy->update([
|
||||
'is_finished' => $request->is_finished,
|
||||
'final_description' => $request->final_description
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function supervisorIndex(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user