modify the blades
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Exports\V3\RoadObservation\SupervisorCartableReport;
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Facades\Sms\Sms;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\RoadObservation\ModifyRegisterationRequest;
|
||||
use App\Http\Requests\V3\RoadObservation\ReferRequest;
|
||||
use App\Http\Requests\V3\RoadObservation\RegisterRequest;
|
||||
use App\Http\Requests\V3\RoadObservation\RestoreRequest;
|
||||
@@ -64,19 +65,11 @@ class RoadObservationController extends Controller
|
||||
|
||||
public function operatorIndex(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse
|
||||
{
|
||||
if (is_null(auth()->user()->edarate_shahri_id)) {
|
||||
return $this->errorResponse('ادارهای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
return response()->json($roadObservationTableService->operatorCartableIndex($request));
|
||||
}
|
||||
|
||||
public function operatorCartableReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse
|
||||
{
|
||||
if (is_null(auth()->user()->edarate_shahri_id)) {
|
||||
return $this->errorResponse('ادارهای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$name = 'گزارش از کارتابل عملیات واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $roadObservationTableService->operatorCartableIndex($request);
|
||||
return Excel::download(new OperatorCartableReport($data['data']), $name);
|
||||
@@ -117,6 +110,67 @@ class RoadObservationController extends Controller
|
||||
'new_files' => json_encode([])
|
||||
];
|
||||
|
||||
if ($request->rms_status == 1) {
|
||||
|
||||
$files_path = [];
|
||||
|
||||
$roadObserved->files()->where('path', 'like', '%_image_before%')->delete();
|
||||
$roadObserved->files()->where('path', 'like', '%_image_after%')->delete();
|
||||
|
||||
$image_before = FileFacade::save($request->image_before, "road_observeds/{$roadObserved->id}/");
|
||||
$image_after = FileFacade::save($request->image_after, "road_observeds/{$roadObserved->id}/");
|
||||
|
||||
$files_path[0]['path'] = $image_before;
|
||||
$files_path[1]['path'] = $image_after;
|
||||
|
||||
$files = json_encode($files_path);
|
||||
$now_date_time = Carbon::now();
|
||||
|
||||
$roadObservedData['image_after'] = $image_after;
|
||||
$roadObservedData['image_before'] = $image_before;
|
||||
$roadObservedData['rms_start_latlng'] = explode(',', $request->start_point);
|
||||
$roadObservedData['updated_at_fa'] = Verta::instance($now_date_time);
|
||||
$roadObservedData['rms_last_activity_fa'] = Verta::instance($now_date_time);
|
||||
$roadObservedData['rms_last_activity'] = $now_date_time;
|
||||
$roadObservedHistoryData['new_files'] = $files;
|
||||
}
|
||||
|
||||
$roadObserved->problemHistories()->create($roadObservedHistoryData);
|
||||
$roadObserved->update($roadObservedData);
|
||||
|
||||
auth()->user()->addActivityComplete(1142);
|
||||
|
||||
try {
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($request, $roadObserved, json_encode($roadObservedHistoryData['new_files']));
|
||||
}
|
||||
catch (SoapFault $e) {
|
||||
|
||||
$msg = "error in send to nikarayan at" . date("Y-m-d H:i:s") . "\n";
|
||||
$msg .= $e->getMessage();
|
||||
Sms::sendSms(env('RMS_CTO_PHONE_NUMBER'), $msg);
|
||||
}
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function modifyRegistration(ModifyRegisterationRequest $request, RoadObserved $roadObserved, NikarayanService $nikarayanService): JsonResponse
|
||||
{
|
||||
$roadObservedData = [
|
||||
'status' => 0,
|
||||
'status_fa' => 'در حال بررسی',
|
||||
'rms_status' => $request->rms_status ?? $roadObserved->rms_status,
|
||||
'rms_description' => $request->rms_description ?? $roadObserved->rms_description,
|
||||
];
|
||||
|
||||
$roadObservedHistoryData = [
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_rms_status' => $roadObserved->rms_status,
|
||||
'previous_rms_start_latlng' => $roadObserved->rms_start_latlng,
|
||||
'previous_rms_end_latlng' => $roadObserved->rms_end_latlng,
|
||||
'previous_rms_description' => $roadObserved->rms_description,
|
||||
'new_files' => json_encode([])
|
||||
];
|
||||
|
||||
if ($request->rms_status == 1) {
|
||||
|
||||
$files_path = [];
|
||||
@@ -125,12 +179,18 @@ class RoadObservationController extends Controller
|
||||
$roadObserved->files()->where('path', 'like', '%_image_after%')->delete();
|
||||
|
||||
if ($request->has('image_before')) {
|
||||
if ($roadObserved->image_before) {
|
||||
FileFacade::delete($roadObserved->image_before, true);
|
||||
}
|
||||
$image_before = FileFacade::save($request->image_before, "road_observeds/{$roadObserved->id}/");
|
||||
$roadObservedData['image_before'] = $image_before;
|
||||
$files_path[0]['path'] = $image_before;
|
||||
}
|
||||
|
||||
if ($request->has('image_after')) {
|
||||
if ($roadObserved->image_after) {
|
||||
FileFacade::delete($roadObserved->image_after, true);
|
||||
}
|
||||
$image_after = FileFacade::save($request->image_after, "road_observeds/{$roadObserved->id}/");
|
||||
$roadObservedData['image_after'] = $image_after;
|
||||
$files_path[1]['path'] = $image_after;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\RoadObservation;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ModifyRegisterationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'rms_status' => 'required|in:1,2',
|
||||
'rms_description' => 'required_if:rms_status,1|string',
|
||||
'image_before' => 'file|mimes:jpg,jpeg,png',
|
||||
'image_after' => 'file|mimes:jpg,jpeg,png',
|
||||
'start_point' => 'string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,8 @@ class RegisterRequest extends FormRequest
|
||||
return [
|
||||
'rms_status' => 'required|in:1,2',
|
||||
'rms_description' => 'required_if:rms_status,1|string',
|
||||
'image_before' => 'file|mimes:jpg,jpeg,png',
|
||||
'image_after' => 'file|mimes:jpg,jpeg,png',
|
||||
'image_before' => 'required_if:rms_status,1|file|mimes:jpg,jpeg,png',
|
||||
'image_after' => 'required_if:rms_status,1|file|mimes:jpg,jpeg,png',
|
||||
'start_point' => 'string',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -60,49 +60,13 @@ class RoadObservationTableService
|
||||
'edarate_shahri.name_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time'
|
||||
];
|
||||
|
||||
if (auth()->user()->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '!=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->whereNotNull('status')
|
||||
->select($fields);
|
||||
}
|
||||
elseif (auth()->user()->hasPermissionTo('show-fast-react-province')) {
|
||||
if (is_null(auth()->user()->province_id)) {
|
||||
return response()->json([
|
||||
'message' => 'استانی برای شما در سامانه ثبت نشده است!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$query = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_province_id', auth()->user()->province_id)
|
||||
->where('rms_status', '!=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->whereNotNull('status')
|
||||
->select($fields);
|
||||
}
|
||||
elseif (auth()->user()->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||
if (is_null(auth()->user()->edarate_shahri_id)) {
|
||||
return response()->json([
|
||||
'message' => 'اداره ای برای شما در سامانه ثبت نشده است!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$query = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('edarate_shahri_id', auth()->user()->edarate_shahri_id)
|
||||
->where('rms_status', '!=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->whereNotNull('status')
|
||||
->select($fields);
|
||||
}
|
||||
|
||||
// $query = RoadObserved::query()
|
||||
// ->where('rms_status', '!=', 0)
|
||||
// ->whereNotNull('road_observeds.province_id')
|
||||
// ->whereNotNull('status')
|
||||
// ->leftJoin('edarate_shahri', 'road_observeds.edarate_shahri_id', '=', 'edarate_shahri.id')
|
||||
// ->where('edarate_shahri_id', $user->edarate_shahri_id)
|
||||
// ->select($fields);
|
||||
$query = RoadObserved::query()
|
||||
->where('rms_status', '!=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->whereNotNull('status')
|
||||
->leftJoin('edarate_shahri', 'road_observeds.edarate_shahri_id', '=', 'edarate_shahri.id')
|
||||
->where('edarate_shahri_id', $user->edarate_shahri_id)
|
||||
->select($fields);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
|
||||
@@ -38,37 +38,16 @@
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">کد
|
||||
سوانح</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
استان
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
ادارات شهری
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
موضوع گزارش
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
نوع گزارش</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
توضیح گزارش</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
موقعیت مکانی</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
شماره تماس گیرنده</th>
|
||||
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
تاریخ ثبت گزارش</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">کد یکتا</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">کد سوانح</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">استان</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">اداره</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">موضوع گزارش</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">نوع گزارش</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">توضیح گزارش</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">موقعیت مکانی</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">شماره تماس گیرنده</th>
|
||||
<th rowspan="1" style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">تاریخ ثبت</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -76,9 +55,10 @@
|
||||
<tbody>
|
||||
@foreach ($data as $item)
|
||||
<tr>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['id'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['fk_RegisteredEventMessage'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_fa'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['edarate_shahri_name_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['province_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['name_fa'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['Title'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['FeatureTypeTitle'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['Description'] ?? '-' }}</td>
|
||||
|
||||
@@ -40,15 +40,15 @@
|
||||
<tr>
|
||||
<th>کد یکتا</th>
|
||||
<th>کد سوانح</th>
|
||||
<th>استان</th>
|
||||
<th>ادارات شهری</th>
|
||||
<th>موضوع گزارش</th>
|
||||
<th>نوع گزارش</th>
|
||||
<th>توضیح گزارش</th>
|
||||
<th>شماره تماس گیرنده</th>
|
||||
<th>وضعیت</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>تاریخ اقدام</th>
|
||||
<th>توضیحات</th>
|
||||
<th>توضیحات کارشناس</th>
|
||||
<th>توضیح مامور</th>
|
||||
<th>توضیح کارشناس</th>
|
||||
<th>وضعیت</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -57,15 +57,15 @@
|
||||
<tr>
|
||||
<td>{{ $item['id'] ?? '-' }}</td>
|
||||
<td>{{ $item['fk_RegisteredEventMessage'] ?? '-' }}</td>
|
||||
<td>{{ $item['province_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['edarate_shahri_name_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['Title'] ?? '-' }}</td>
|
||||
<td>{{ $item['FeatureTypeTitle'] ?? '-' }}</td>
|
||||
<td>{{ $item['Description'] ?? '-' }}</td>
|
||||
<td>{{ $item['MobileForSendEventSms'] ?? '-' }}</td>
|
||||
<td>{{ $item['status_fa'] ?? '-' }}</td>
|
||||
<td>{{ verta($item['created_at'])->format('Y/n/j') ?? '-' }}</td>
|
||||
<td>{{ $item['rms_last_activity_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['rms_description'] ?? '-' }}</td>
|
||||
<td>{{ $item['supervisor_description'] ?? '-' }}</td>
|
||||
<td>{{ $item['status_fa'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@@ -33,23 +33,24 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||
گزارش کارتابل ارزیابی واکنش سریع
|
||||
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>کد یکتا</th>
|
||||
<th>کد پیگیری</th>
|
||||
<th>کد سوانح</th>
|
||||
<th>استان</th>
|
||||
<th>ادارات شهری</th>
|
||||
<th>اداره</th>
|
||||
<th>موضوع گزارش</th>
|
||||
<th>نوع گزارش</th>
|
||||
<th>توضیح گزارش</th>
|
||||
<th>شماره تماس گیرنده</th>
|
||||
<th>وضعیت</th>
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>تاریخ اقدام</th>
|
||||
<th>توضیحات</th>
|
||||
<th>توضیحات کارشناس</th>
|
||||
<th>توضیح مامور</th>
|
||||
<th>توضیح کارشناس</th>
|
||||
<th>وضعیت</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -59,14 +60,17 @@
|
||||
<td>{{ $item['id'] ?? '-' }}</td>
|
||||
<td>{{ $item['fk_RegisteredEventMessage'] ?? '-' }}</td>
|
||||
<td>{{ $item['province_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['edarate_shahri_name_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['name_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['Title'] ?? '-' }}</td>
|
||||
<td>{{ $item['FeatureTypeTitle'] ?? '-' }}</td>
|
||||
<td>{{ $item['Description'] ?? '-' }}</td>
|
||||
<td>{{ $item['MobileForSendEventSms'] ?? '-' }}</td>
|
||||
<td>{{ $item['status_fa'] ?? '-' }}</td>
|
||||
<td>{{ verta($item['created_at'])->format('Y/n/j') ?? '-' }}</td>
|
||||
<td>{{ $item['rms_last_activity_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['rms_description'] ?? '-' }}</td>
|
||||
<td>{{ $item['supervisor_description'] ?? '-' }}</td>
|
||||
<td>{{ $item['status_fa'] ?? '-' }}</td>
|
||||
<td>{{ $item['rms_last_activity_fa'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user