Merge branch 'develop' into 'main'
Develop See merge request witelgroup/rms_v2!125
This commit is contained in:
@@ -28,8 +28,8 @@ services:
|
||||
|
||||
before_script:
|
||||
- apk update
|
||||
- coman=$(ls && pwd)
|
||||
- echo "'$coman'"
|
||||
- command=$(ls && pwd)
|
||||
- echo "'$command'"
|
||||
- cp .env.example .env
|
||||
- composer install
|
||||
- php artisan key:generate
|
||||
@@ -49,7 +49,7 @@ test:
|
||||
- sed -i "s/DB_PASSWORD=/DB_PASSWORD=$MYSQL_ROOT_PASSWORD/" .env.testing
|
||||
- cat .env.testing
|
||||
- php artisan key:generate --env=testing
|
||||
- php artisan migrate --env=testing --force
|
||||
- php artisan migrate --path=/database/old_migrations/ --path=database/migrations --env=testing --force
|
||||
- php artisan test
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||
@@ -71,21 +71,21 @@ test:
|
||||
when: always
|
||||
allow_failure: true
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
script:
|
||||
- apt-get update && add --no-cache openssh-client
|
||||
- chmod og-rwx $ID_RSA
|
||||
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "
|
||||
echo -e '$SHECAN_DNS' | sudo tee /etc/resolv.conf &&
|
||||
dns=\$(cat /etc/resolv.conf) &&
|
||||
echo \"\$dns\" &&
|
||||
cd $PROJECT_PATH &&
|
||||
git checkout $TARGET_BRANCH_NAME &&
|
||||
ssh -T git@gitlab.com &&
|
||||
git pull ssh-origin $TARGET_BRANCH_NAME &&
|
||||
echo -e '$DEFAULT_DNS' | sudo tee /etc/resolv.conf"
|
||||
resource_group: develop_deploy
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "develop"'
|
||||
#deploy:
|
||||
# stage: deploy
|
||||
# script:
|
||||
# - apt-get update && add --no-cache openssh-client
|
||||
# - chmod og-rwx $ID_RSA
|
||||
# - ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "
|
||||
# echo -e '$SHECAN_DNS' | sudo tee /etc/resolv.conf &&
|
||||
# dns=\$(cat /etc/resolv.conf) &&
|
||||
# echo \"\$dns\" &&
|
||||
# cd $PROJECT_PATH &&
|
||||
# git checkout $TARGET_BRANCH_NAME &&
|
||||
# ssh -T git@gitlab.com &&
|
||||
# git pull ssh-origin $TARGET_BRANCH_NAME &&
|
||||
# echo -e '$DEFAULT_DNS' | sudo tee /etc/resolv.conf"
|
||||
# resource_group: develop_deploy
|
||||
# rules:
|
||||
# - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == "develop"'
|
||||
|
||||
|
||||
@@ -129,8 +129,8 @@ class RoadObservationProblems extends Command
|
||||
'rms_city_id' => NikarayanComplaints::mapCities((int) $value->fk_Town) ?? null,
|
||||
'observed_way_id' => $nominatimService->get_way_id_from_nominatim($value->XGeo, $value->YGeo) ?? null,
|
||||
|
||||
'province_id' => $city ? $city['province_id'] : null,
|
||||
'city_id' => $city ? $city['city_id'] : null,
|
||||
'province_id' => $cityModel->province()->first()->id,
|
||||
'city_id' => $cityModel->id,
|
||||
// 'handler_type' => EdarateShahri::class,
|
||||
'edarate_shahri_id' => $cityModel->edarateShahri()->first()->id,
|
||||
'province_fa' => (isset($city['province_id']) ? Province::find($city['province_id'])->name_fa : null),
|
||||
@@ -147,7 +147,7 @@ class RoadObservationProblems extends Command
|
||||
return $result;
|
||||
}
|
||||
echo 'done at: ' . date("Y-m-d H:i:s") . "\n";
|
||||
$this->info("{$affectedRows} row's affected");
|
||||
echo "{$affectedRows} row's affected";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,17 +26,19 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('webservice:roadobserved')
|
||||
->everyFiveMinutes()->appendOutputTo(storage_path('logs/nikarayan.log'));
|
||||
->everyTenMinutes()->appendOutputTo(storage_path('logs/nikarayan.log'));
|
||||
|
||||
$schedule->command('command:sendcontractsmsnotification')
|
||||
// ->everyMinute()->appendOutputTo(storage_path('logs/contractSms.log'));
|
||||
->dailyAt('10:00')->appendOutputTo(storage_path('logs/contractSms.log'));
|
||||
|
||||
$schedule->command('reports:rms-summary')
|
||||
->dailyAt('00:00')->appendOutputTo(storage_path('logs/report_summary.log'));
|
||||
|
||||
$schedule->command("webservice:roadobserved --daily-mode")
|
||||
->dailyAt('00:15')->appendOutputTo(storage_path('logs/nikarayan.log'));
|
||||
->dailyAt('00:05')->appendOutputTo(storage_path('logs/nikarayan.log'));
|
||||
|
||||
$schedule->command("webservice:roadobserved --daily-mode")
|
||||
->dailyAt('00:45')->appendOutputTo(storage_path('logs/nikarayan.log'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
27
app/Enums/MissionStates.php
Normal file
27
app/Enums/MissionStates.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum MissionStates: int
|
||||
{
|
||||
case REQUEST_CREATED= 1;
|
||||
case PENDING_CONFIRMATION = 2;
|
||||
case START_MISSION = 3;
|
||||
case END_MISSION = 4;
|
||||
case REJECT_BY_TRANSPORTATION = 5;
|
||||
case CANCELLED = 6;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => 'درخواست ایجاد شد و در حال بررسی توسط واحد نقلیه است',
|
||||
2 => 'خودرو اختصاص داده شد و درخواست توسط واحد کنترل در حال بررسی است',
|
||||
3 => 'درخواست توسط واحد کنترل تایید شد و ماموریت آغاز می شود',
|
||||
4 => 'اتمام ماموریت',
|
||||
5 => 'عدم تخصیص خودرو توسط واحد نقلیه و بازگشت درخواست به کارتابل کاربر',
|
||||
6 => 'ماموریت لغو شد',
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
}
|
||||
}
|
||||
@@ -38,10 +38,10 @@ class PendingComplaintsExport implements FromView, ShouldAutoSize, WithEvents, W
|
||||
return $query->where('road_observeds.province_id', $province_id);
|
||||
})
|
||||
->when(($fromDate && $toDate), function ($query) use ($fromDate, $toDate) {
|
||||
return $query->whereBetween('road_observeds.created_at', [$fromDate, $toDate]);
|
||||
return $query->whereBetween('road_observeds.StartTime_DateTime', [$fromDate, $toDate]);
|
||||
})
|
||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status,
|
||||
road_observeds.StartTime_DateTime, rms_last_activity, rms_last_activity_fa, status,
|
||||
status_fa, supervisor_description, rms_description, province_fa, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng')
|
||||
->orderBy('status')
|
||||
->orderBy('road_observeds.id', 'desc')
|
||||
@@ -60,10 +60,10 @@ class PendingComplaintsExport implements FromView, ShouldAutoSize, WithEvents, W
|
||||
->where('rms_status', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->when(($fromDate && $toDate), function ($query) use ($fromDate, $toDate) {
|
||||
return $query->whereBetween('road_observeds.created_at', [$fromDate, $toDate]);
|
||||
return $query->whereBetween('road_observeds.StartTime_DateTime', [$fromDate, $toDate]);
|
||||
})
|
||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status,
|
||||
road_observeds.StartTime_DateTime, rms_last_activity, rms_last_activity_fa, status,
|
||||
status_fa, supervisor_description, rms_description, province_fa, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng')
|
||||
->orderBy('status')
|
||||
->orderBy('road_observeds.id', 'desc')
|
||||
@@ -81,10 +81,10 @@ class PendingComplaintsExport implements FromView, ShouldAutoSize, WithEvents, W
|
||||
->where('rms_status', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->when(($fromDate && $toDate), function ($query) use ($fromDate, $toDate) {
|
||||
return $query->whereBetween('road_observeds.created_at', [$fromDate, $toDate]);
|
||||
return $query->whereBetween('road_observeds.StartTime_DateTime', [$fromDate, $toDate]);
|
||||
})
|
||||
->selectRaw('fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms,
|
||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status,
|
||||
road_observeds.StartTime_DateTime, rms_last_activity, rms_last_activity_fa, status,
|
||||
status_fa, supervisor_description, rms_description, province_fa, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng')
|
||||
->orderBy('status')
|
||||
->orderBy('road_observeds.id', 'desc')
|
||||
|
||||
@@ -61,7 +61,7 @@ class ComplaintsReport implements FromView, WithEvents, ShouldAutoSize, WithDraw
|
||||
$drawing2->setHeight(50);
|
||||
$drawing2->setOffsetX(5);
|
||||
$drawing2->setOffsetY(5);
|
||||
$drawing2->setCoordinates('q1');
|
||||
$drawing2->setCoordinates('J1');
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard;
|
||||
namespace App\Http\Controllers\V3\Dashboard\Accident;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Exports\V3\AccidentReceipt\DataTableReport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Facades\Sms\Sms;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -22,10 +22,10 @@ use App\Services\NominatimService;
|
||||
use App\Services\PaymentService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Throwable;
|
||||
|
||||
class AccidentReceiptController extends Controller
|
||||
{
|
||||
@@ -61,6 +61,7 @@ class AccidentReceiptController extends Controller
|
||||
$city = City::query()->where('id', '=', $request->city_id)->first();
|
||||
|
||||
$accidentData = [
|
||||
'is_foreign' => $request->is_foreign,
|
||||
'province_id' => $province->id,
|
||||
'province_fa' => $province->name_fa,
|
||||
'city_id' => $city->id,
|
||||
@@ -79,11 +80,8 @@ class AccidentReceiptController extends Controller
|
||||
'accident_type_fa' => DailyAccidentSettings::query()->where('type', 'accident_type')->where('name', $request->accident_type)->first()->value,
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim($request->lat, $request->lng),
|
||||
'report_base' => $request->report_base,
|
||||
'police_file' => $request->report_base ? null : FileFacade::save($request->file('police_file'), 'receipts_files/'),
|
||||
'police_serial' => $request->police_serial ?? null,
|
||||
'police_file_date' => $request->police_file_date ?? null,
|
||||
'damage_picture1' => FileFacade::save($request->file('damage_picture1'), 'receipts_files/'),
|
||||
'damage_picture2' => FileFacade::save($request->file('damage_picture2'), 'receipts_files/'),
|
||||
'status' => AccidentStates::BEDON_EGHDAM->value,
|
||||
'status_fa' => AccidentStates::name(AccidentStates::BEDON_EGHDAM->value),
|
||||
];
|
||||
@@ -108,6 +106,10 @@ class AccidentReceiptController extends Controller
|
||||
$accidentData['sum'] = $sum;
|
||||
|
||||
$accident = Accident::query()->create($accidentData);
|
||||
$accident->damage_picture1 = FileFacade::save($request->file('damage_picture1'), "receipts_files/{$accident->id}");
|
||||
$accident->damage_picture2 = FileFacade::save($request->file('damage_picture2'), "receipts_files/{$accident->id}");
|
||||
$accident->police_file = $request->report_base ? null : FileFacade::save($request->file('police_file'), "receipts_files/{$accident->id}");
|
||||
$accident->save();
|
||||
|
||||
$accident->damages()->attach($damageData);
|
||||
|
||||
@@ -130,6 +132,7 @@ class AccidentReceiptController extends Controller
|
||||
$city = City::query()->where('id', '=', $request->city_id)->first();
|
||||
|
||||
$accidentData = [
|
||||
'is_foreign' => $request->is_foreign,
|
||||
'province_id' => $province->id,
|
||||
'province_fa' => $province->name_fa,
|
||||
'city_id' => $city->id,
|
||||
@@ -156,8 +159,8 @@ class AccidentReceiptController extends Controller
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
}
|
||||
|
||||
if (!$request->report_base && $request->has('police_file')) {
|
||||
FileFacade::delete($accident->police_file, true);
|
||||
if ($request->has('police_file')) {
|
||||
if ($accident->police_file) {FileFacade::delete($accident->police_file, true);}
|
||||
$accidentData['police_file'] = FileFacade::save($request->file('police_file'), "receipts_files/{$accident->id}/");
|
||||
}
|
||||
|
||||
@@ -200,9 +203,14 @@ class AccidentReceiptController extends Controller
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function destroy(Accident $accident): JsonResponse
|
||||
{
|
||||
FileFacade::deleteDirectory('receipts_files/'.$accident->id);
|
||||
throw_if($accident->status != AccidentStates::BEDON_EGHDAM->value, new ProhibitedAction('قابلیت حذف در این مرحله وجود ندارد'));
|
||||
|
||||
FileFacade::deleteDirectory("receipts_files/{$accident->id}");
|
||||
|
||||
DB::transaction(function () use ($accident) {
|
||||
|
||||
@@ -254,13 +262,14 @@ class AccidentReceiptController extends Controller
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function submitInvoice(Accident $accident, PaymentService $paymentService): JsonResponse
|
||||
{
|
||||
$final_amount = $accident->sum - ($accident->deposit_insurance_amount + $accident->deposit_daghi_amount);
|
||||
|
||||
if ($final_amount < 0) {
|
||||
return $this->errorResponse('error');
|
||||
}
|
||||
throw_if($final_amount < 0, new ProhibitedAction('مبالغ داغی و بیمه از مبلغ کل بیشتر می باشد.'));
|
||||
|
||||
$bill_code = $paymentService->invoiceBillApi($accident->driver_national_code, $final_amount);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
namespace App\Http\Controllers\V3\Dashboard\Accident;
|
||||
|
||||
use App\Exports\V3\AccidentReceipt\ProvinceReport;
|
||||
use App\Exports\V3\AccidentReceipt\CountryReport;
|
||||
use App\Exports\V3\AccidentReceipt\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Cartables\Mission\ControlUnitService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ControlUnitController extends Controller
|
||||
{
|
||||
public function index(Request $request, ControlUnitService $controlUnitService): JsonResponse
|
||||
{
|
||||
return response()->json($controlUnitService->datatable($request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DetailController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function machines(Mission $mission): JsonResponse
|
||||
{
|
||||
return $this->successResponse($mission->machines()->get(['cmms_machines.id', 'cmms_machines.machine_code', 'cmms_machines.car_name', 'cmms_machines.plak_number']));
|
||||
}
|
||||
|
||||
public function rahdaran(Mission $mission): JsonResponse
|
||||
{
|
||||
return $this->successResponse($mission->rahdaran()->get(['rahdaran.id', 'rahdaran.name', 'rahdaran.code']));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\StoreRequest;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use App\Services\Cartables\Mission\RequestPortalService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RequestPortalController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request, RequestPortalService $requestPortalService): JsonResponse
|
||||
{
|
||||
return response()->json($requestPortalService->datatable($request));
|
||||
}
|
||||
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request) {
|
||||
$user = auth()->user();
|
||||
$state = MissionStates::REQUEST_CREATED->value;
|
||||
$mission = Mission::query()->create([
|
||||
'user_id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'edare_shahri_id' => $user->edare_shahri_id ?? null,
|
||||
'edare_shahri_name' => $user->edare_shahri_name ?? null,
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'requested_machines' => json_encode($request->requested_machines),
|
||||
'type' => $request->type,
|
||||
'start_date' => $request->start_date,
|
||||
'end_date' => $request->end_date,
|
||||
'request_date' => now(),
|
||||
'description' => $request->description,
|
||||
'end_point' => $request->end_point,
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->attach($request->rahdaran);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function show(Mission $mission): JsonResponse
|
||||
{
|
||||
return $this->successResponse($mission);
|
||||
}
|
||||
|
||||
public function update(UpdateRequest $request,Mission $mission): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($mission, $request) {
|
||||
$state = MissionStates::REQUEST_CREATED->value;
|
||||
$mission->update([
|
||||
'state_id' =>$state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'requested_machines' => json_encode($request->requested_machines),
|
||||
'type' => $request->type,
|
||||
'start_date' => $request->start_date,
|
||||
'end_date' => $request->end_date,
|
||||
'request_date' => $request->request_date,
|
||||
'description' => $request->description,
|
||||
'end_point' => $request->end_point,
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->sync($request->rahdaran);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function destroy(Mission $mission): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($mission) {
|
||||
$mission->rahdaran()->detach();
|
||||
$mission->delete();
|
||||
});
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Mission\TransportaionUnit\AllocateRequest;
|
||||
use App\Http\Requests\V3\Mission\TransportaionUnit\DeallocateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use App\Services\Cartables\Mission\TransportationUnitService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TransportationUnitController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request, TransportationUnitService $transportationUnitService): JsonResponse
|
||||
{
|
||||
return response()->json($transportationUnitService->dataTable($request));
|
||||
}
|
||||
|
||||
public function allocate(AllocateRequest $request, Mission $mission): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $mission) {
|
||||
$mission->machines()->attach($request->machines);
|
||||
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name
|
||||
]);
|
||||
|
||||
$state = MissionStates::PENDING_CONFIRMATION->value;
|
||||
$mission->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function deallocate(DeallocateRequest $request, Mission $mission): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $mission) {
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name,
|
||||
'user_description' => $request->description
|
||||
]);
|
||||
|
||||
$state = MissionStates::REJECT_BY_TRANSPORTATION->value;
|
||||
|
||||
$mission->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'description' => $request->description
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function rahdaran(Mission $mission): JsonResponse
|
||||
{
|
||||
return $this->successResponse($mission->rahdaran()->get(['rahdaran.id', 'rahdaran.name', 'rahdaran.code']));
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
|
||||
use App\Exports\V2\RoadObservation\ReportComplaintsExport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Services\Cartables\RoadObservationTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class RoadObservationReportController extends Controller
|
||||
{
|
||||
public function index(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse
|
||||
{
|
||||
$data = $roadObservationTableService->reportIndex($request);
|
||||
return response()->json($data['data']);
|
||||
}
|
||||
|
||||
public function excelReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش رسیدگی به شکایات واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $roadObservationTableService->reportIndex($request);
|
||||
return Excel::download(new ReportComplaintsExport($data), $name);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Reports;
|
||||
|
||||
use App\Exports\V3\SafetyAndPrivacy\CountryActivityReport;
|
||||
use App\Exports\V3\SafetyAndPrivacy\ProvinceActivityReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class SafetyAndPrivacyReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'provinces' => Province::all(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CountryActivityReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceActivityReport($data, $request), $name);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard;
|
||||
namespace App\Http\Controllers\V3\Dashboard\RoadObservation;
|
||||
|
||||
use App\Exports\V3\RoadObservation\ComplaintsReport;
|
||||
use App\Exports\V3\RoadObservation\OperatorCartableReport;
|
||||
use App\Exports\V3\RoadObservation\SupervisorCartableReport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
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;
|
||||
use App\Http\Requests\V3\RoadObservation\VerifyBySupervisorRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\Province;
|
||||
use App\Models\RoadObservationHistory;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Models\User;
|
||||
use App\Services\Cartables\RoadObservation\OperatorService;
|
||||
use App\Services\NikarayanService;
|
||||
use Carbon\Carbon;
|
||||
use Hekmatinasser\Verta\Verta;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Services\Cartables\RoadObservationTableService;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use SoapFault;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Throwable;
|
||||
|
||||
class RoadObservationController extends Controller
|
||||
class OperatorController
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function supervisorIndex(Request $request,RoadObservationTableService $roadObservationTableService ): JsonResponse
|
||||
public function cartableIndex(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
return response()->json($roadObservationTableService->supervisorCartableIndex($request));
|
||||
return response()->json($operatorService->cartableIndex($request));
|
||||
}
|
||||
|
||||
public function verifyBySupervisor(VerifyBySupervisorRequest $request, RoadObserved $roadObserved): JsonResponse
|
||||
{
|
||||
$statusFa = $request->verify == 1 ? 'تایید شده' : 'عدم تایید';
|
||||
|
||||
$roadObserved->update([
|
||||
'status' => $request->verify,
|
||||
'status_fa' => $statusFa,
|
||||
'supervisor_id' => auth()->user()->id,
|
||||
'supervisor_name' => auth()->user()->name,
|
||||
'supervisor_description' => $request->description,
|
||||
'supervising_time' => now(),
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1138);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function supervisorCartableReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از کارتابل ارزیابی واکنش سریع '. verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $roadObservationTableService->supervisorCartableIndex($request);
|
||||
|
||||
return Excel::download(new SupervisorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
public function operatorIndex(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse
|
||||
{
|
||||
return response()->json($roadObservationTableService->operatorCartableIndex($request));
|
||||
}
|
||||
|
||||
public function operatorCartableReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse
|
||||
public function cartableReport(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از کارتابل عملیات واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $roadObservationTableService->operatorCartableIndex($request);
|
||||
$data = $operatorService->cartableIndex($request);
|
||||
return Excel::download(new OperatorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
public function complaintsIndex(Request $request, RoadObservationTableService $roadObservationTableService): JsonResponse
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function complaintsIndex(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
return response()->json($roadObservationTableService->complaintsIndex($request));
|
||||
return response()->json($operatorService->complaintsIndex($request));
|
||||
}
|
||||
|
||||
public function complaintsReport(Request $request, RoadObservationTableService $roadObservationTableService): BinaryFileResponse
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function complaintsReport(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از رسیدگی به شکایات واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $roadObservationTableService->complaintsIndex($request);
|
||||
$data = $operatorService->complaintsIndex($request);
|
||||
return Excel::download(new ComplaintsReport($data['data']), $name);
|
||||
}
|
||||
|
||||
@@ -144,7 +114,6 @@ class RoadObservationController extends Controller
|
||||
auth()->user()->addActivityComplete(1142);
|
||||
|
||||
$nikarayanService->updateRoadObservedInfoByNikarayan($request, $roadObserved, json_encode($roadObservedHistoryData['new_files']));
|
||||
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
@@ -219,24 +188,26 @@ class RoadObservationController extends Controller
|
||||
{
|
||||
$province = Province::query()->find($request->province_id);
|
||||
|
||||
RoadObservationHistory::query()->create([
|
||||
'id' => $roadObserved->id,
|
||||
'user_id' => auth()->user()->id,
|
||||
'action' => 'refer',
|
||||
'description' => $request->refer_description,
|
||||
'from_edareh' => $roadObserved->edarate_shahri_id,
|
||||
'to_edareh' => $request->edarate_shahri_id,
|
||||
'from_province' => $roadObserved->province_id,
|
||||
'to_province' => $province->id
|
||||
]);
|
||||
DB::transaction(function () use ($roadObserved, $request, $province) {
|
||||
RoadObservationHistory::query()->create([
|
||||
'id' => $roadObserved->id,
|
||||
'user_id' => auth()->user()->id,
|
||||
'action' => 'refer',
|
||||
'description' => $request->refer_description,
|
||||
'from_edareh' => $roadObserved->edarate_shahri_id,
|
||||
'to_edareh' => $request->edarate_shahri_id,
|
||||
'from_province' => $roadObserved->province_id,
|
||||
'to_province' => $province->id
|
||||
]);
|
||||
|
||||
$roadObserved->update([
|
||||
'edarate_shahri_id' => $request->edarate_shahri_id,
|
||||
'province_id' => $province->id,
|
||||
'province_fa' => $province->name_fa,
|
||||
]);
|
||||
$roadObserved->update([
|
||||
'edarate_shahri_id' => $request->edarate_shahri_id,
|
||||
'province_id' => $province->id,
|
||||
'province_fa' => $province->name_fa,
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1037);
|
||||
auth()->user()->addActivityComplete(1037);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
@@ -262,49 +233,4 @@ class RoadObservationController extends Controller
|
||||
}
|
||||
return $this->successResponse($data);
|
||||
}
|
||||
|
||||
public function restore(RestoreRequest $request, RoadObserved $roadObserved): JsonResponse
|
||||
{
|
||||
if ($roadObserved->image_before) {
|
||||
FileFacade::delete($roadObserved->image_before);
|
||||
}
|
||||
|
||||
if ($roadObserved->image_after) {
|
||||
FileFacade::delete($roadObserved->image_after);
|
||||
}
|
||||
|
||||
$roadObserved->update([
|
||||
'image_before' => null,
|
||||
'image_after' => null,
|
||||
'rms_last_activity' => null,
|
||||
'rms_last_activity_fa' => null,
|
||||
'updated_at_fa' => null,
|
||||
'updated_at' => null,
|
||||
'rms_status' => 0,
|
||||
'status' => null,
|
||||
'status_fa' => null,
|
||||
]);
|
||||
|
||||
RoadObservationHistory::query()->create([
|
||||
'id' => $roadObserved->id,
|
||||
'user_id' => auth()->user()->id,
|
||||
'action' => 'restore',
|
||||
'description' => $request->restore_description,
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1141);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function map(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json(DataTableFacade::run(
|
||||
RoadObserved::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id', 'lat', 'lng', 'status']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\RoadObservation;
|
||||
|
||||
use App\Exports\V2\RoadObservation\ReportComplaintsExport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Services\Cartables\RoadObservation\ReportService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportController
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request, ReportService $reportService): JsonResponse
|
||||
{
|
||||
$data = $reportService->index($request);
|
||||
return response()->json($data['data']);
|
||||
}
|
||||
|
||||
public function excel(Request $request, ReportService $reportService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش رسیدگی به شکایات واکنش سریع ' . verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $reportService->index($request);
|
||||
return Excel::download(new ReportComplaintsExport($data), $name);
|
||||
}
|
||||
|
||||
public function map(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json(DataTableFacade::run(
|
||||
RoadObserved::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id', 'lat', 'lng', 'status']
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\RoadObservation;
|
||||
|
||||
use App\Exports\V3\RoadObservation\SupervisorCartableReport;
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Http\Requests\V3\RoadObservation\RestoreRequest;
|
||||
use App\Http\Requests\V3\RoadObservation\VerifyBySupervisorRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\RoadObservationHistory;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Services\Cartables\RoadObservation\SupervisorService;
|
||||
use App\Services\Cartables\RoadObservationTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class SupervisorController
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request, SupervisorService $supervisorService): JsonResponse
|
||||
{
|
||||
return response()->json($supervisorService->index($request));
|
||||
}
|
||||
|
||||
public function verify(VerifyBySupervisorRequest $request, RoadObserved $roadObserved): JsonResponse
|
||||
{
|
||||
$statusFa = $request->verify == 1 ? 'تایید شده' : 'عدم تایید';
|
||||
|
||||
DB::transaction(function () use ($request, $statusFa, $roadObserved) {
|
||||
$roadObserved->update([
|
||||
'status' => $request->verify,
|
||||
'status_fa' => $statusFa,
|
||||
'supervisor_id' => auth()->user()->id,
|
||||
'supervisor_name' => auth()->user()->name,
|
||||
'supervisor_description' => $request->description,
|
||||
'supervising_time' => now(),
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1138);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function report(Request $request, SupervisorService $supervisorService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از کارتابل ارزیابی واکنش سریع '. verta()->now()->format('Y-m-d H:i') . '.xlsx';
|
||||
$data = $supervisorService->index($request);
|
||||
|
||||
return Excel::download(new SupervisorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
public function restore(RestoreRequest $request, RoadObserved $roadObserved): JsonResponse
|
||||
{
|
||||
if ($roadObserved->image_before) {
|
||||
FileFacade::delete($roadObserved->image_before, true);
|
||||
}
|
||||
|
||||
if ($roadObserved->image_after) {
|
||||
FileFacade::delete($roadObserved->image_after, true);
|
||||
}
|
||||
|
||||
DB::transaction(function () use ($request, $roadObserved) {
|
||||
$roadObserved->update([
|
||||
'image_before' => null,
|
||||
'image_after' => null,
|
||||
'rms_last_activity' => null,
|
||||
'rms_last_activity_fa' => null,
|
||||
'updated_at_fa' => null,
|
||||
'updated_at' => null,
|
||||
'rms_status' => 0,
|
||||
'status' => null,
|
||||
'status_fa' => null,
|
||||
]);
|
||||
|
||||
RoadObservationHistory::query()->create([
|
||||
'id' => $roadObserved->id,
|
||||
'user_id' => auth()->user()->id,
|
||||
'action' => 'restore',
|
||||
'description' => $request->restore_description,
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1141);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ use App\Http\Requests\V3\SafetyAndPrivacy\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\InfoItem;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use App\Services\Cartables\SafetyAndPrivacy\OperatorService;
|
||||
use App\Services\NominatimService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -34,18 +34,18 @@ class OperatorController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
public function index(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->operatorDatatable($request));
|
||||
return response()->json($operatorService->datatable($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
public function excelReport(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $safetyAndPrivacyTableService->operatorDatatable($request);
|
||||
$data = $operatorService->datatable($request);
|
||||
return Excel::download(new OperatorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\SafetyAndPrivacy\OperatorService;
|
||||
use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -18,34 +19,34 @@ class OperatorReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'provinces' => Province::all(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
public function provinceActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
public function countryExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CountryActivityReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
public function provinceExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceActivityReport($data, $request), $name);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\RejectRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use App\Services\Cartables\SafetyAndPrivacy\SupervisorService;
|
||||
use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -22,18 +23,18 @@ class SupervisorController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function index(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
public function index(Request $request, SupervisorService $supervisorService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request));
|
||||
return response()->json($supervisorService->dataTable($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function excelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
public function excelReport(Request $request, SupervisorService $supervisorService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $safetyAndPrivacyTableService->supervisorDataTable($request);
|
||||
$data = $supervisorService->dataTable($request);
|
||||
return Excel::download(new SupervisorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,36 +21,4 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
class SupervisorReportController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'provinces' => Province::all(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'edarateShahri' => EdarateShahri::query()->where('province_id', '=', $request->province_id)->get(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function countryExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->countryActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new CountryActivityReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$data = $safetyAndPrivacyTableService->provinceActivity($request);
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ProvinceActivityReport($data, $request), $name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,269 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard;
|
||||
|
||||
use App\Enums\AxisTypes;
|
||||
use App\Enums\SafetyAndPrivacyStatus;
|
||||
use App\Enums\SafetyAndPrivacySteps;
|
||||
use App\Exports\V3\SafetyAndPrivacy\OperatorCartableReport;
|
||||
use App\Exports\V3\SafetyAndPrivacy\SupervisorCartableReport;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Facades\File\FileFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\FinishRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\RejectRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\FirstStepStoreRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\SecondStepStoreRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\ThirdStepStoreRequest;
|
||||
use App\Http\Requests\V3\SafetyAndPrivacy\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\InfoItem;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use App\Services\Cartables\SafetyAndPrivacyTableService;
|
||||
use App\Services\NominatimService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Throwable;
|
||||
|
||||
class SafetyAndPrivacyController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function operatorIndex(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->operatorDatatable($request));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function operatorExcelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $safetyAndPrivacyTableService->operatorDatatable($request);
|
||||
return Excel::download(new OperatorCartableReport($data['data']), $name);
|
||||
}
|
||||
|
||||
public function firstStepStore(FirstStepStoreRequest $request, NominatimService $nominatimService): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$coordinates = explode(',', $request->point);
|
||||
$item = InfoItem::query()
|
||||
->where('id', $request->info_id)
|
||||
->where('item', 17)
|
||||
->firstOrFail();
|
||||
|
||||
DB::transaction(function () use ($request, $coordinates, $item, $nominatimService, $user)
|
||||
{
|
||||
$step = SafetyAndPrivacySteps::SHENASAEI->value;
|
||||
$safety_and_privacy = SafetyAndPrivacy::query()->create([
|
||||
'lat' => $coordinates[0],
|
||||
'lon' => $coordinates[1],
|
||||
'operator_id' => $user->id,
|
||||
'operator_name' => $user->name,
|
||||
'province_id' => $user->province_id,
|
||||
'province_fa' => $user->province_fa,
|
||||
'info_id' => $item->id,
|
||||
'info_fa' => $item->sub_item_str,
|
||||
'city_id' => $user->city_id,
|
||||
'city_fa' => $user->city_fa,
|
||||
'activity_date_time' => $request->activity_date." ".$request->activity_time,
|
||||
'edare_shahri_id' => $user->edarate_shahri_id,
|
||||
'edare_shahri_name' => $user->edarate_shahri_name,
|
||||
'way_id' => $nominatimService->get_way_id_from_nominatim($coordinates[0], $coordinates[1]),
|
||||
'axis_type_id' => $request->axis_type_id,
|
||||
'axis_type_name' => AxisTypes::name($request->axis_type_id),
|
||||
'step' => $step,
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
'is_finished' => false,
|
||||
]);
|
||||
|
||||
$safety_and_privacy->recognize_picture = $request->has('recognize_picture') ?
|
||||
FileFacade::save($request->recognize_picture, "safety_and_privacy/{$safety_and_privacy->id}") :
|
||||
null;
|
||||
$safety_and_privacy->save();
|
||||
|
||||
$user->addActivityComplete(1134);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function secondStepStore(SafetyAndPrivacy $safetyAndPrivacy, SecondStepStoreRequest $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
|
||||
|
||||
$need_judiciary = $request->need_judiciary;
|
||||
|
||||
$judiciary_document = [];
|
||||
if ($need_judiciary) {
|
||||
foreach ($request->judiciary_document as $index => $file) {
|
||||
$judiciary_document[] = FileFacade::save(
|
||||
$file,
|
||||
"safety_and_privacy/{$safetyAndPrivacy->id}/judiciary_document"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$step = SafetyAndPrivacySteps::MOSTANADAT_GAZAEI->value;
|
||||
$safetyAndPrivacy->update([
|
||||
'step' => $step,
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
'judiciary_document' => $need_judiciary ? serialize($judiciary_document) : null,
|
||||
'judiciary_document_upload_date' => $need_judiciary ? now() : null,
|
||||
'need_judiciary' => $need_judiciary,
|
||||
]);
|
||||
|
||||
$user->addActivityComplete(1135);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function thirdStepStore(SafetyAndPrivacy $safetyAndPrivacy, ThirdStepStoreRequest $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
|
||||
$step = SafetyAndPrivacySteps::BARKHORD->value;
|
||||
$safetyAndPrivacy->update([
|
||||
'step' => $step,
|
||||
'step_fa' => SafetyAndPrivacySteps::name($step),
|
||||
'action_picture' => FileFacade::save($request->action_picture, "safety_and_privacy/{$safetyAndPrivacy->id}/action_picture"),
|
||||
'action_picture_document_upload_date' => now(),
|
||||
'action_date' => $request->action_date,
|
||||
'is_finished' => true,
|
||||
'final_description' => 'پیام سیستمی : این عملیات پس از طی تمامی گام ها خاتمه یافت'
|
||||
]);
|
||||
|
||||
$user->addActivityComplete(1136);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function update(SafetyAndPrivacy $safetyAndPrivacy, UpdateRequest $request): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $safetyAndPrivacy) {
|
||||
$safetyAndPrivacy->update([
|
||||
'axis_type_id' => $request->axis_type_id,
|
||||
'axis_type_name' => AxisTypes::name($request->axis_type_id),
|
||||
]);
|
||||
|
||||
auth()->user()->addActivityComplete(1168);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function show(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
return $this->successResponse($safetyAndPrivacy);
|
||||
}
|
||||
|
||||
public function destroy(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
FileFacade::deleteDirectory("safety_and_privacy/{$safetyAndPrivacy->id}");
|
||||
|
||||
DB::transaction(function () use ($safetyAndPrivacy)
|
||||
{
|
||||
auth()->user()->addActivityComplete(1155);
|
||||
$safetyAndPrivacy->delete();
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function deserialize(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$judiciaries = $safetyAndPrivacy->judiciary_document ? unserialize($safetyAndPrivacy->judiciary_document) : [];
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($judiciaries as $judiciary) {
|
||||
$result[] = Storage::disk('public')->url($judiciary);
|
||||
}
|
||||
|
||||
return $this->successResponse($result);
|
||||
}
|
||||
|
||||
public function subItems(): JsonResponse
|
||||
{
|
||||
return $this->successResponse(InfoItem::query()
|
||||
->where('item', '=', 17)
|
||||
->select('id', 'item', 'item_str', 'sub_item_str as name', 'sub_item_unit as unit', 'needs_image', 'needs_end_point', 'sub_item')
|
||||
->get());
|
||||
}
|
||||
|
||||
public function map(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json(DataTableFacade::run(
|
||||
SafetyAndPrivacy::query(),
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id', 'lat', 'lon', 'step']
|
||||
));
|
||||
}
|
||||
|
||||
public function confirm(SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::CONFIRM->value;
|
||||
|
||||
$safetyAndPrivacy->update([
|
||||
'status' => $status_id,
|
||||
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function reject(RejectRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::REJECT->value;
|
||||
|
||||
$safetyAndPrivacy->update([
|
||||
'status' => $status_id,
|
||||
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
|
||||
'supervisor_description' => $request->supervisor_description
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function finish(FinishRequest $request, SafetyAndPrivacy $safetyAndPrivacy): JsonResponse
|
||||
{
|
||||
$status_id = SafetyAndPrivacyStatus::PENDING->value;
|
||||
|
||||
$safetyAndPrivacy->update([
|
||||
'is_finished' => 1,
|
||||
'final_description' => $request->final_description,
|
||||
'status' => $status_id,
|
||||
'status_fa' => SafetyAndPrivacyStatus::name($status_id),
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function supervisorIndex(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): JsonResponse
|
||||
{
|
||||
return response()->json($safetyAndPrivacyTableService->supervisorDataTable($request));
|
||||
}
|
||||
|
||||
public function supervisorExcelReport(Request $request, SafetyAndPrivacyTableService $safetyAndPrivacyTableService): BinaryFileResponse
|
||||
{
|
||||
$name = 'گزارش از نگهداری حریم راه ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
$data = $safetyAndPrivacyTableService->supervisorDataTable($request);
|
||||
return Excel::download(new SupervisorCartableReport($data['data']), $name);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,9 @@ class NotificationController extends Controller
|
||||
['status', '=', 0]
|
||||
])->count();
|
||||
|
||||
$road_observations['complaint_cnt'] = RoadObserved::query()->where('rms_status', '=', 0)->count();
|
||||
$road_observations['complaint_cnt'] = RoadObserved::query()->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->count();
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
@@ -78,6 +78,7 @@ class Kernel extends HttpKernel
|
||||
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
|
||||
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
|
||||
'validate-store-access' => \App\Http\Middleware\ValidateStoreAccess::class,
|
||||
'check-axis-type' => \App\Http\Middleware\CheckAxisTypeMiddleware::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
33
app/Http/Middleware/CheckAxisTypeMiddleware.php
Normal file
33
app/Http/Middleware/CheckAxisTypeMiddleware.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use function Laravel\Prompts\error;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
|
||||
|
||||
class CheckAxisTypeMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
* @throws ProhibitedAction
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$s = $request->route('safetyAndPrivacy');
|
||||
|
||||
if (($s->step == 3 || $s->step == 2) && is_null($s->axis_type_id))
|
||||
{
|
||||
throw new ProhibitedAction('ابتدا نوع محور را مشخص کنید');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
32
app/Http/Middleware/ValidateShowAccess.php
Normal file
32
app/Http/Middleware/ValidateShowAccess.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Throwable;
|
||||
|
||||
class ValidateShowAccess
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Closure(Request): (Response) $next
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
throw_if (is_null($user->province_id),
|
||||
new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
throw_if(is_null($user->edarate_shahri_id),
|
||||
new ProhibitedAction('اداره شهری برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use App\Models\Accident;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmPaymentInfoRequest extends FormRequest
|
||||
@@ -11,7 +13,7 @@ class ConfirmPaymentInfoRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
return $this->accident->status === AccidentStates::SODOR_NAME_BIME_VA_DAGHI->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,13 +24,14 @@ class StoreRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'is_foreign' => 'required|boolean',
|
||||
'province_id' => 'required|integer|exists:provinces,id',
|
||||
'city_id' => 'required|integer|exists:cities,id',
|
||||
'axis_name' => 'required|string',
|
||||
'driver_name' => 'required|string',
|
||||
'plaque' => 'required|string',
|
||||
'driver_national_code' => 'required|string',
|
||||
'driver_phone_number' => 'required|string',
|
||||
'driver_name' => 'required_if:is_foreign,0|string',
|
||||
'plaque' => 'required_if:is_foreign,0|string',
|
||||
'driver_national_code' => 'required_if:is_foreign,0|string',
|
||||
'driver_phone_number' => 'required_if:is_foreign,0|string',
|
||||
'lat' => 'required|numeric',
|
||||
'lng' => 'required|numeric',
|
||||
'accident_type' => 'required|integer',
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateRequest extends FormRequest
|
||||
@@ -11,7 +12,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
return $this->accident->status === AccidentStates::BEDON_EGHDAM->value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,13 +23,14 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'is_foreign' => 'required|boolean',
|
||||
'province_id' => 'required|integer|exists:provinces,id',
|
||||
'city_id' => 'required|integer|exists:cities,id',
|
||||
'axis_name' => 'required|string',
|
||||
'driver_name' => 'required|string',
|
||||
'plaque' => 'required|string',
|
||||
'driver_national_code' => 'required|string',
|
||||
'driver_phone_number' => 'required|string',
|
||||
'driver_name' => 'required_if:is_foreign,0|string',
|
||||
'plaque' => 'required_if:is_foreign,0|string',
|
||||
'driver_national_code' => 'required_if:is_foreign,0|string',
|
||||
'driver_phone_number' => 'required_if:is_foreign,0|string',
|
||||
'lat' => 'required|numeric',
|
||||
'lng' => 'required|numeric',
|
||||
'accident_type' => 'required|integer',
|
||||
|
||||
36
app/Http/Requests/V3/Mission/RequestPortal/StoreRequest.php
Normal file
36
app/Http/Requests/V3/Mission/RequestPortal/StoreRequest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\RequestPortal;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreRequest 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 [
|
||||
'rahdaran' => 'required|array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'requested_machines' => 'required|array',
|
||||
'type' => 'required|string|max:50',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date',
|
||||
'request_date' => 'required|date',
|
||||
'description' => 'string',
|
||||
'end_point' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Http/Requests/V3/Mission/RequestPortal/UpdateRequest.php
Normal file
37
app/Http/Requests/V3/Mission/RequestPortal/UpdateRequest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\RequestPortal;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->mission->user_id === auth()->user()->id && $this->mission->state_id == MissionStates::REJECT_BY_TRANSPORTATION->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'rahdaran' => 'required|array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'requested_machines' => 'required|array',
|
||||
'type' => 'required|string|max:50',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date',
|
||||
'request_date' => 'required|date',
|
||||
'description' => 'string',
|
||||
'end_point' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\TransportaionUnit;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AllocateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->mission->edare_shahri_id == auth()->user()->edarate_shahri_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'machines' => 'required|array',
|
||||
'machines.*' => 'required|integer|exists:cmms_machines,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\TransportaionUnit;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DeallocateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->mission->edare_shahri_id == auth()->user()->edarate_shahri_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'description' => 'string',
|
||||
];
|
||||
}
|
||||
}
|
||||
63
app/Models/Mission.php
Normal file
63
app/Models/Mission.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
|
||||
class Mission extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function requestedMachines(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn ($value) => json_decode($value)
|
||||
);
|
||||
}
|
||||
|
||||
public function histories(): HasMany
|
||||
{
|
||||
return $this->hasMany(MissionHistory::class);
|
||||
}
|
||||
|
||||
public function roadItems(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadItemsProject::class, 'missionable');
|
||||
}
|
||||
|
||||
public function roadPatrols(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadPatrol::class, 'missionable');
|
||||
}
|
||||
|
||||
public function roadObserveds(): MorphToMany
|
||||
{
|
||||
return $this->morphedByMany(RoadObserved::class, 'missionable');
|
||||
}
|
||||
|
||||
public function machines(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(CMMSMachine::class,
|
||||
'machinable',
|
||||
'machinables',
|
||||
'machinable_id',
|
||||
'machine_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function rahdaran(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Rahdaran::class,
|
||||
'rahdarable',
|
||||
'rahdarables',
|
||||
'rahdarable_id',
|
||||
'rahdar_id',
|
||||
);
|
||||
}
|
||||
}
|
||||
13
app/Models/MissionHistory.php
Normal file
13
app/Models/MissionHistory.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MissionHistory extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
11
app/Models/MissionState.php
Normal file
11
app/Models/MissionState.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MissionState extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -187,4 +187,14 @@ class RoadItemsProject extends Model
|
||||
'rahdar_id',
|
||||
);
|
||||
}
|
||||
|
||||
public function missions(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Mission::class,
|
||||
'missionable',
|
||||
'missionables',
|
||||
'missionable_id',
|
||||
'mission_id',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class RoadObserved extends Model
|
||||
@@ -124,4 +125,14 @@ class RoadObserved extends Model
|
||||
: Storage::disk('public')->url($value))
|
||||
);
|
||||
}
|
||||
|
||||
public function missions(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Mission::class,
|
||||
'missionable',
|
||||
'missionables',
|
||||
'missionable_id',
|
||||
'mission_id',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,4 +45,14 @@ class RoadPatrol extends Model
|
||||
'rahdar_id',
|
||||
);
|
||||
}
|
||||
|
||||
public function missions(): MorphToMany
|
||||
{
|
||||
return $this->morphToMany(Mission::class,
|
||||
'missionable',
|
||||
'missionables',
|
||||
'missionable_id',
|
||||
'mission_id',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ class AccidentReceiptTableService
|
||||
"کشوری" as province_fa,
|
||||
-1 as province_id,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(CASE WHEN STATUS =0 THEN 1 END ) AS egdam,
|
||||
COUNT(CASE WHEN STATUS IN (1,2,3,4) THEN 1 END) AS pardakht,
|
||||
COUNT(CASE WHEN STATUS =5 THEN 1 END ) AS khatm,
|
||||
COUNT(CASE WHEN report_base = 0 THEN 1 END) AS police_rah,
|
||||
COUNT(CASE WHEN report_base = 1 THEN 1 END) AS gozaresh_gasht,
|
||||
SUM(`sum`) AS kol_sabt_shode,
|
||||
@@ -60,6 +63,9 @@ class AccidentReceiptTableService
|
||||
province_fa,
|
||||
province_id,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(CASE WHEN STATUS =0 THEN 1 END ) AS egdam,
|
||||
COUNT(CASE WHEN STATUS IN (1,2,3,4) THEN 1 END) AS pardakht,
|
||||
COUNT(CASE WHEN STATUS =5 THEN 1 END ) AS khatm,
|
||||
COUNT(CASE WHEN report_base = 0 THEN 1 END) AS police_rah,
|
||||
COUNT(CASE WHEN report_base = 1 THEN 1 END) AS gozaresh_gasht,
|
||||
SUM(`sum`) AS kol_sabt_shode,
|
||||
@@ -86,7 +92,10 @@ class AccidentReceiptTableService
|
||||
'SELECT
|
||||
"استانی" as city_fa,
|
||||
-1 as city_id,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(CASE WHEN STATUS =0 THEN 1 END ) AS egdam,
|
||||
COUNT(CASE WHEN STATUS IN (1,2,3,4) THEN 1 END) AS pardakht,
|
||||
COUNT(CASE WHEN STATUS =5 THEN 1 END ) AS khatm,
|
||||
COUNT(CASE WHEN report_base = 0 THEN 1 END) AS police_rah,
|
||||
COUNT(CASE WHEN report_base = 1 THEN 1 END) AS gozaresh_gasht,
|
||||
SUM(`sum`) AS kol_sabt_shode,
|
||||
@@ -100,7 +109,10 @@ class AccidentReceiptTableService
|
||||
SELECT
|
||||
city_fa,
|
||||
city_id,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(id) AS tedade,
|
||||
COUNT(CASE WHEN STATUS =0 THEN 1 END ) AS egdam,
|
||||
COUNT(CASE WHEN STATUS IN (1,2,3,4) THEN 1 END) AS pardakht,
|
||||
COUNT(CASE WHEN STATUS =5 THEN 1 END ) AS khatm,
|
||||
COUNT(CASE WHEN report_base = 0 THEN 1 END) AS police_rah,
|
||||
COUNT(CASE WHEN report_base = 1 THEN 1 END) AS gozaresh_gasht,
|
||||
SUM(`sum`) AS kol_sabt_shode,
|
||||
|
||||
37
app/Services/Cartables/Mission/ControlUnitService.php
Normal file
37
app/Services/Cartables/Mission/ControlUnitService.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ControlUnitService
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$fields = [
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'start_date',
|
||||
'end_date', 'request_date', 'end_point',
|
||||
];
|
||||
|
||||
$query = Mission::query()
|
||||
->where('state_id', '=', MissionStates::PENDING_CONFIRMATION->value)
|
||||
->where('edare_shahri_name', '=', Auth::user()->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
}
|
||||
40
app/Services/Cartables/Mission/RequestPortalService.php
Normal file
40
app/Services/Cartables/Mission/RequestPortalService.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RequestPortalService
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function datatable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$fields = [
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'start_date',
|
||||
'end_date', 'request_date', 'end_point',
|
||||
];
|
||||
$query = Mission::query();
|
||||
|
||||
if ($user->hasPermissionTo('manage-request-portal-city')) {
|
||||
$query->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('manage-request-portal-province')) {
|
||||
$query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
}
|
||||
33
app/Services/Cartables/Mission/TransportationUnitService.php
Normal file
33
app/Services/Cartables/Mission/TransportationUnitService.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class TransportationUnitService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$fields = [
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'start_date',
|
||||
'end_date', 'request_date', 'end_point',
|
||||
];
|
||||
|
||||
$query = Mission::query()
|
||||
->where('state_id', '=', MissionStates::REQUEST_CREATED->value)
|
||||
->where('edare_shahri_name', '=', Auth::user()->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
}
|
||||
86
app/Services/Cartables/RoadObservation/OperatorService.php
Normal file
86
app/Services/Cartables/RoadObservation/OperatorService.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\RoadObservation;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
use Throwable;
|
||||
|
||||
class OperatorService
|
||||
{
|
||||
public function cartableIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'edarate_shahri_id',
|
||||
'rms_description', 'rms_status', 'rms_start_latlng', 'rms_last_activity_fa', 'image_after', 'image_before',
|
||||
'rms_last_activity', 'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa',
|
||||
'edarate_shahri.name_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time'
|
||||
];
|
||||
|
||||
$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);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function complaintsIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = ['fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'FeatureTypeTitle', 'MobileForSendEventSms', 'StartTime_DateTime',
|
||||
'road_observeds.created_at', 'rms_last_activity', 'rms_last_activity_fa', 'status', 'edarate_shahri_id',
|
||||
'status_fa', 'supervisor_description', 'rms_description', 'province_fa', 'city_id', 'city_fa', 'Description',
|
||||
'edarate_shahri.name_fa as edarate_shahri_name_fa', 'lat', 'lng'];
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id');
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
||||
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->where('road_observeds.province_id', '=', $user->province_id);
|
||||
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||
|
||||
throw_if(is_null($user->edarate_shahri_id), new ProhibitedAction('اداره ای برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->where('edarate_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
}
|
||||
53
app/Services/Cartables/RoadObservation/ReportService.php
Normal file
53
app/Services/Cartables/RoadObservation/ReportService.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\RoadObservation;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ReportService
|
||||
{
|
||||
public function index(Request $request): array
|
||||
{
|
||||
$fromDate = $request->from_date . ' 00:00:00';
|
||||
$toDate = $request->date_to . ' 23:59:59';
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage',
|
||||
'road_observeds.id',
|
||||
'Title',
|
||||
'road_observeds.created_at',
|
||||
'lat',
|
||||
'lng',
|
||||
'FeatureTypeTitle',
|
||||
'Description',
|
||||
'MobileForSendEventSms',
|
||||
'road_observeds.province_id',
|
||||
'province_fa',
|
||||
'city_fa',
|
||||
'edarate_shahri.name_fa',
|
||||
'rms_last_activity_fa',
|
||||
'rms_description'
|
||||
];
|
||||
|
||||
$query = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', "<>", 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->whereBetween('road_observeds.created_at', [$fromDate, $toDate])
|
||||
->select($fields);
|
||||
|
||||
$data = DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']
|
||||
);
|
||||
|
||||
return [
|
||||
'data' => $data,
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
];
|
||||
}
|
||||
}
|
||||
48
app/Services/Cartables/RoadObservation/SupervisorService.php
Normal file
48
app/Services/Cartables/RoadObservation/SupervisorService.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\RoadObservation;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupervisorService
|
||||
{
|
||||
/**
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'rms_start_latlng',
|
||||
'rms_description', 'rms_status', 'rms_last_activity_fa', 'rms_last_activity', 'edarate_shahri_id',
|
||||
'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa', 'edarate_shahri.name_fa',
|
||||
'status', 'status_fa', 'supervisor_description', 'supervising_time', 'image_after', 'image_before'
|
||||
];
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->whereNotNull('road_observeds.status')
|
||||
->select($fields);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province'))
|
||||
{
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('road_observeds.province_id', $user->province_id)
|
||||
->whereNotNull('road_observeds.status')
|
||||
->select($fields);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']);
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\RoadObserved;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RoadObservationTableService
|
||||
{
|
||||
use ApiResponse;
|
||||
public function supervisorCartableIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'rms_start_latlng',
|
||||
'rms_description', 'rms_status', 'rms_last_activity_fa', 'rms_last_activity', 'edarate_shahri_id',
|
||||
'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa', 'edarate_shahri.name_fa',
|
||||
'status', 'status_fa', 'supervisor_description', 'supervising_time', 'image_after', 'image_before'
|
||||
];
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->whereNotNull('road_observeds.status')
|
||||
->select($fields);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province'))
|
||||
{
|
||||
if (is_null($user->province_id))
|
||||
{
|
||||
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('road_observeds.province_id', $user->province_id)
|
||||
->whereNotNull('road_observeds.status')
|
||||
->select($fields);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']);
|
||||
}
|
||||
|
||||
public function operatorCartableIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at', 'StartTime_DateTime',
|
||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms', 'edarate_shahri_id',
|
||||
'rms_description', 'rms_status', 'rms_start_latlng', 'rms_last_activity_fa', 'image_after', 'image_before',
|
||||
'rms_last_activity', 'road_observeds.province_id', 'province_fa', 'city_id', 'city_fa',
|
||||
'edarate_shahri.name_fa', 'status', 'status_fa', 'supervisor_description', 'supervising_time'
|
||||
];
|
||||
|
||||
$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,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']);
|
||||
}
|
||||
|
||||
public function complaintsIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = 'fk_RegisteredEventMessage, road_observeds.id, Title, FeatureTypeTitle, MobileForSendEventSms, StartTime_DateTime,
|
||||
road_observeds.created_at, rms_last_activity, rms_last_activity_fa, status, edarate_shahri_id,
|
||||
status_fa, supervisor_description, rms_description, province_fa, city_id, city_fa, Description, edarate_shahri.name_fa as edarate_shahri_name_fa, lat, lng';
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->selectRaw($fields);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
||||
|
||||
if (is_null($user->province_id)) {
|
||||
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->where('road_observeds.province_id', '=', $user->province_id)
|
||||
->selectRaw($fields);
|
||||
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||
|
||||
if (is_null($user->edarate_shahri_id)) {
|
||||
return $this->errorResponse('اداره ای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->where('edarate_shahri_id', '=', $user->edarate_shahri_id)
|
||||
->selectRaw($fields);
|
||||
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']
|
||||
);
|
||||
}
|
||||
|
||||
public function reportIndex(Request $request)
|
||||
{
|
||||
$fromDate = $request->from_date . ' 00:00:00';
|
||||
$toDate = $request->date_to . ' 23:59:59';
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage',
|
||||
'road_observeds.id',
|
||||
'Title',
|
||||
'road_observeds.created_at',
|
||||
'lat',
|
||||
'lng',
|
||||
'FeatureTypeTitle',
|
||||
'Description',
|
||||
'MobileForSendEventSms',
|
||||
'road_observeds.province_id',
|
||||
'province_fa',
|
||||
'city_fa',
|
||||
'edarate_shahri.name_fa',
|
||||
'rms_last_activity_fa',
|
||||
'rms_description'
|
||||
];
|
||||
|
||||
$query = RoadObserved::leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', "<>", 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->whereBetween('road_observeds.created_at', [$fromDate, $toDate])
|
||||
->select($fields);
|
||||
|
||||
$data = DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']
|
||||
);
|
||||
|
||||
return [
|
||||
'data' => $data,
|
||||
'fromDate' => $fromDate,
|
||||
'toDate' => $toDate,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables;
|
||||
namespace App\Services\Cartables\SafetyAndPrivacy;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Province;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class SafetyAndPrivacyTableService
|
||||
class OperatorService
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function operatorDataTable(Request $request)
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
@@ -41,37 +32,6 @@ class SafetyAndPrivacyTableService
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function supervisorDataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'id','lat','lon', 'recognize_picture','action_picture','created_at','status', 'final_description', 'province_fa',
|
||||
'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', 'edare_shahri_name',
|
||||
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', 'operator_description'
|
||||
];
|
||||
|
||||
$query = SafetyAndPrivacy::query();
|
||||
|
||||
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province'))
|
||||
{
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
$query = $query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$activities = [];
|
||||
@@ -186,4 +146,4 @@ class SafetyAndPrivacyTableService
|
||||
|
||||
return array_values($activities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\SafetyAndPrivacy;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\SafetyAndPrivacy;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupervisorService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = [
|
||||
'id','lat','lon', 'recognize_picture','action_picture','created_at','status', 'final_description', 'province_fa',
|
||||
'info_fa', 'activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date', 'edare_shahri_name',
|
||||
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date', 'is_finished', 'status_fa', 'supervisor_description', 'operator_description'
|
||||
];
|
||||
|
||||
$query = SafetyAndPrivacy::query();
|
||||
|
||||
if ($user->hasPermissionTo('show-safety-and-privacy-operator-cartable-province'))
|
||||
{
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
|
||||
$query = $query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class NikarayanService
|
||||
|
||||
$soapClient = new SoapClient($url);
|
||||
$result = $soapClient->UpdateInfo_RoadObservedProblems($array);
|
||||
Log::channel('nikarayan')->info(json_encode($result));
|
||||
Log::channel('nikarayan')->info([json_encode($result), $roadObserved->fk_RegisteredEventMessage]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
23
database/factories/MissionFactory.php
Normal file
23
database/factories/MissionFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Mission>
|
||||
*/
|
||||
class MissionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/MissionHistoryFactory.php
Normal file
23
database/factories/MissionHistoryFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MissionHistory>
|
||||
*/
|
||||
class MissionHistoryFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/MissionStateFactory.php
Normal file
23
database/factories/MissionStateFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MissionState>
|
||||
*/
|
||||
class MissionStateFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('mission_states', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mission_states');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('missions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->string('username');
|
||||
$table->foreignId('state_id')->constrained('mission_states')->noActionOnDelete();
|
||||
$table->string('state_name');
|
||||
$table->unsignedTinyInteger('province_id')->nullable();
|
||||
$table->foreign('province_id')->references('id')->on('provinces')->noActionOnDelete();
|
||||
$table->string('province_name');
|
||||
$table->unsignedBigInteger('edare_shahri_id')->nullable();
|
||||
$table->foreign('edare_shahri_id')->references('id')->on('edarate_shahri')->noActionOnDelete();
|
||||
$table->string('edare_shahri_name')->nullable();
|
||||
$table->json('requested_machines');
|
||||
$table->string('type');
|
||||
$table->dateTime('start_date');
|
||||
$table->dateTime('end_date');
|
||||
$table->dateTime('request_date');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('end_point');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('missions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('missionables', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('mission_id')->constrained('missions')->noActionOnDelete();
|
||||
$table->morphs('missionable');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('missionables');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('mission_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('mission_id')->constrained('missions');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->foreignId('previous_state_id')->constrained('mission_states');
|
||||
$table->string('previous_state_name');
|
||||
$table->text('user_description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mission_histories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('accidents', function (Blueprint $table) {
|
||||
$table->boolean('is_foreign')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('accidents', function (Blueprint $table) {
|
||||
$table->dropColumn('is_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AxisTypeSeeder extends Seeder
|
||||
{
|
||||
@@ -12,6 +13,12 @@ class AxisTypeSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
DB::table('axis_types')->insert([
|
||||
['name' => 'آزادراه'],
|
||||
['name' => 'بزرگراه'],
|
||||
['name' => 'اصلی'],
|
||||
['name' => 'فرعی'],
|
||||
['name' => 'روستایی'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
17
database/seeders/MissionHistorySeeder.php
Normal file
17
database/seeders/MissionHistorySeeder.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MissionHistorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
18
database/seeders/MissionSeeder.php
Normal file
18
database/seeders/MissionSeeder.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
Mission::factory()->count(5)->create();
|
||||
}
|
||||
}
|
||||
25
database/seeders/MissionStateSeeder.php
Normal file
25
database/seeders/MissionStateSeeder.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MissionStateSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
DB::table('mission_states')->insert([
|
||||
['name' => 'درخواست ایجاد شد و در حال بررسی در توسط واحد نقلیه است'],
|
||||
['name' => 'خودرو اختصاص داده شد و درخواست توسط واحد کنترل در حال بررسی است'],
|
||||
['name' => 'درخواست توسط واحد کنترل تایید شد و ماموریت آغاز می شود'],
|
||||
['name' => 'اتمام ماموریت'],
|
||||
['name' => 'عدم تخصیص خودرو توسط واحد نقلیه و بازگشت درخواست به کارتابل کاربر'],
|
||||
['name' => 'ماموریت لغو شد'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -14,20 +14,20 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||
گزارش خسارات وارده به ابنیه فنی و تاسیسات راه از تاریخ
|
||||
{{ verta($fromDate)->format('Y/n/j') }}
|
||||
تا
|
||||
@@ -42,8 +42,8 @@
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
اداره کل
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد کل
|
||||
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد خسارات ثبت شده
|
||||
</th>
|
||||
<th colspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
نحوه شناسایی خسارت
|
||||
@@ -59,6 +59,18 @@
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
کل
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
در دست اقدام
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
در حال پرداخت
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
خاتمه یافته
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش پلیس راه
|
||||
</th>
|
||||
@@ -67,7 +79,7 @@
|
||||
گزارش گشت راهداری
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
فیش
|
||||
فاکتور
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
بیمه
|
||||
@@ -87,6 +99,13 @@
|
||||
{{ $road['name'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['tedade'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['egdam'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['pardakht'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['khatm'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['police_rah'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;text-align:center;">
|
||||
<th colspan="17" style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;text-align:center;">
|
||||
تاریخ دریافت گزارش: {{verta()->now()->format('Y/m/d H:i')}}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
|
||||
<th colspan="17" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="16" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">گزارش کلی خسارات وارده</th>
|
||||
<th colspan="17" style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">گزارش کلی خسارات وارده</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -26,6 +26,7 @@
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">استان</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">شهرستان</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نام محور</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نوع ناوگان</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نام راننده</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">کد ملی راننده</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">شماره موبایل راننده</th>
|
||||
@@ -33,7 +34,7 @@
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">نوع تصادف</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">تاریخ تصادف</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ کل خسارت</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ فیش</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ فاکتور</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ بیمه</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">مبلغ داغی</th>
|
||||
<th style="border: 1px solid black;text-align: center;background-color: #EBF1DE;">تاریخ ثبت</th>
|
||||
@@ -48,6 +49,7 @@
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->province_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->city_fa}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->axis_name}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->is_foreign ? 'خارجی' : 'داخلی'}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->driver_name}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->driver_national_code}}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{$item->driver_phone_number}}</td>
|
||||
|
||||
@@ -14,20 +14,20 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="9"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13;">
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||
گزارش خسارات وارده به ابنیه فنی و تاسیسات راه از تاریخ
|
||||
{{ verta($fromDate)->format('Y/n/j') }}
|
||||
تا
|
||||
@@ -43,8 +43,8 @@
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
اداره کل
|
||||
</th>
|
||||
<th rowspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد کل
|
||||
<th colspan="3" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد خسارات ثبت شده
|
||||
</th>
|
||||
<th colspan="2" style="border:1px solid black;text-align:center;background-color: #C4D79B;">
|
||||
تعداد نحوه شناسایی خسارت
|
||||
@@ -60,6 +60,18 @@
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
کل
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
در دست اقدام
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
در حال پرداخت
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
خاتمه یافته
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
گزارش پلیس راه
|
||||
</th>
|
||||
@@ -68,7 +80,7 @@
|
||||
گزارش گشت راهداری
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
فیش
|
||||
فاکتور
|
||||
</th>
|
||||
<th style="border:1px solid black;text-align:center;background-color: #EBF1DE;">
|
||||
بیمه
|
||||
@@ -88,6 +100,13 @@
|
||||
{{ $road['name'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['tedade'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
<<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['egdam'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['pardakht'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['khatm'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
{{ $road['police_rah'] }}</td>
|
||||
<td style="text-align: center;border:1px solid black;background-color: #DAEEF3;">
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</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>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<th>تاریخ ثبت</th>
|
||||
<th>تاریخ اقدام</th>
|
||||
<th>توضیح مامور</th>
|
||||
<th>توضیح کارشناس</th>
|
||||
<th>توضیح ناظر</th>
|
||||
<th>وضعیت</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -303,6 +303,9 @@ Route::get('map', function () {
|
||||
return view('version2.dashboard_pages.map');
|
||||
})->name('v2.map');
|
||||
|
||||
Route::any('/safety_and_privacy/{any?}', fn() => abort(404, 'not found'))
|
||||
->where('any', '.*');
|
||||
|
||||
Route::prefix('safety_and_privacy')->group(function () {
|
||||
|
||||
Route::get('/sub_item_list', 'V2\Dashboard\SafetyAndPrivacyController@subItemList');
|
||||
|
||||
131
routes/v3.php
131
routes/v3.php
@@ -3,25 +3,27 @@
|
||||
use App\Http\Controllers\V3\Auth\LogoutController;
|
||||
use App\Http\Controllers\V3\CMMSMachinesController;
|
||||
use App\Http\Controllers\V3\DamageManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\Accident\AccidentReceiptController;
|
||||
use App\Http\Controllers\V3\Dashboard\Accident\AccidentReceiptReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshController;
|
||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController;
|
||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController;
|
||||
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\DetailController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\TransportationUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\ObservedItemController;
|
||||
use App\Http\Controllers\V3\Dashboard\AccidentReceiptController;
|
||||
use App\Http\Controllers\V3\Dashboard\OtpManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadMaintenanceStationController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\AccidentReceiptReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadItemsReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\RoadPatrolReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\Reports\SafetyAndPrivacyReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadItemsProjectController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadObservationController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadMaintenanceStationController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadObservation\RoadObservationController;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadPatrolProjectController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReportController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorReportController;
|
||||
use App\Http\Controllers\V3\FMSVehicleManagementController;
|
||||
use App\Http\Controllers\V3\Harim\DivarkeshiController;
|
||||
use App\Http\Controllers\V3\LogListManagementController;
|
||||
@@ -290,37 +292,50 @@ Route::prefix('receipt_reports')
|
||||
|
||||
Route::prefix('road_observations')
|
||||
->name('roadObservations.')
|
||||
->controller(RoadObservationController::class)
|
||||
->group(function () {
|
||||
Route::get('/supervisor_index', 'supervisorIndex')->name('supervisorIndex')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::post('/verify/{roadObserved}', 'verifyBySupervisor')->name('verifyBySupervisor');
|
||||
Route::get('/supervisor_report', 'supervisorCartableReport')->name('supervisorCartableReport')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::get('/operator_index','operatorIndex')->name('operatorIndex')->middleware('permission:show-fast-react-edarate-shahri');
|
||||
Route::get('/operator_report','operatorCartableReport')->name('operatorCartableReport')->middleware('permission:show-fast-react-edarate-shahri');
|
||||
Route::get('/complaints_index', 'complaintsIndex')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('complaintsIndex');
|
||||
Route::get('/complaints_report', 'complaintsReport')->name('complaintsReport')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react');
|
||||
Route::post('/register/{roadObserved}', 'register')
|
||||
->middleware('permission:show-fast-react-edarate-shahri')
|
||||
->name('register');
|
||||
Route::post('/modify_registration/{roadObserved}', 'modifyRegistration')
|
||||
->middleware('permission:show-fast-react-edarate-shahri')
|
||||
->name('modifyRegistration');
|
||||
Route::name('operator.')
|
||||
->controller(\App\Http\Controllers\V3\Dashboard\RoadObservation\OperatorController::class)
|
||||
->group(function () {
|
||||
Route::get('operator/cartable','cartableIndex')->name('cartableIndex')->middleware('permission:show-fast-react-edarate-shahri');
|
||||
Route::get('operator/report','cartableReport')->name('cartableReport')->middleware('permission:show-fast-react-edarate-shahri');
|
||||
Route::get('/complaints_index', 'complaintsIndex')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('complaintsIndex');
|
||||
Route::get('/complaints_report', 'complaintsReport')->name('complaintsReport')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react');
|
||||
Route::post('operator/register/{roadObserved}', 'register')
|
||||
->middleware('permission:show-fast-react-edarate-shahri')
|
||||
->name('register');
|
||||
Route::post('operator/modify_registration/{roadObserved}', 'modifyRegistration')
|
||||
->middleware('permission:show-fast-react-edarate-shahri')
|
||||
->name('modifyRegistration');
|
||||
Route::post('/refer/{roadObserved}', 'refer')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('refer');
|
||||
Route::get('/refer_list/{roadObserved}', 'referList')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('referList');
|
||||
Route::get('/{roadObserved}', 'show')->name('show');
|
||||
});
|
||||
|
||||
Route::get('/{roadObserved}', 'show')->name('show');
|
||||
Route::post('/refer/{roadObserved}', 'refer')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('refer');
|
||||
Route::name('supervisor.')
|
||||
->prefix('supervisor')
|
||||
->controller(\App\Http\Controllers\V3\Dashboard\RoadObservation\SupervisorController::class)
|
||||
->group(function () {
|
||||
Route::get('/index', 'index')->name('index')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::post('/verify/{roadObserved}', 'verify')->name('verify');
|
||||
Route::get('/report', 'report')->name('report')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::post('/restore/{roadObserved}', 'restore')->middleware('permission:restore-fast-react')->name('restore');
|
||||
});
|
||||
|
||||
Route::get('/refer_list/{roadObserved}', 'referList')
|
||||
->middleware('permission:show-fast-react-edarate-shahri|show-fast-react-province|show-fast-react')
|
||||
->name('referList');
|
||||
|
||||
Route::post('/restore/{roadObserved}', 'restore')
|
||||
->middleware('permission:restore-fast-react')
|
||||
->name('restore');
|
||||
Route::name('report.')
|
||||
->prefix('report')
|
||||
->controller(\App\Http\Controllers\V3\Dashboard\RoadObservation\ReportController::class)
|
||||
->group(function () {
|
||||
Route::get('/index', 'index')->name('index')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::get('/excel', 'excel')->name('excel')->middleware('permission:show-fast-react-province|show-fast-react');
|
||||
Route::get('/map', 'map')->name('map');
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('log_list')
|
||||
@@ -349,8 +364,8 @@ Route::prefix('safety_and_privacy')
|
||||
Route::post('operator/first_step_store', 'firstStepStore')->name('firstStepStore')->middleware(['validate-store-access', 'permission:add-safety-and-privacy']);
|
||||
Route::get('/sub_items', 'subItems')->name('subItems');
|
||||
Route::get('/map', 'map')->name('map');
|
||||
Route::post('operator/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']);
|
||||
Route::post('operator/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy']);
|
||||
Route::post('operator/second_step_store/{safetyAndPrivacy}', 'secondStepStore')->name('secondStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy','check-axis-type']);
|
||||
Route::post('operator/third_step_store/{safetyAndPrivacy}', 'thirdStepStore')->name('thirdStepStore')->middleware(['validate-store-access','permission:add-safety-and-privacy','check-axis-type']);
|
||||
Route::post('operator/{safetyAndPrivacy}', 'update')->name('update')->middleware('permission:update-safety-and-privacy');
|
||||
Route::get('operator/{safetyAndPrivacy}', 'show')->name('show');
|
||||
Route::delete('operator/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy');
|
||||
@@ -383,13 +398,6 @@ Route::prefix('safety_and_privacy_report')
|
||||
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||
});
|
||||
|
||||
Route::prefix('supervisor')
|
||||
->name('supervisor.')
|
||||
->controller(SupervisorReportController::class)
|
||||
->group(function () {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('otp')
|
||||
@@ -432,3 +440,40 @@ Route::prefix('road_maintenance_station')
|
||||
Route::post('/{rahdariPoint}', 'update')->name('update')->middleware('permission:edit-tollhouse|edit-tollhouse-province');
|
||||
Route::delete('/{rahdariPoint}', 'destroy')->name('destroy')->middleware('permission:delete-tollhouse|delete-tollhouse-province');
|
||||
});
|
||||
|
||||
Route::prefix('missions')
|
||||
->name('missions.')
|
||||
->group(function () {
|
||||
Route::name('requestPortal.')
|
||||
->prefix('request_portal')
|
||||
->middleware('permission:manage-request-portal-city|manage-request-portal-province|manage-request-portal-country')
|
||||
->controller(RequestPortalController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::get('/{mission}', 'show')->name('show');
|
||||
Route::post('/{mission}', 'update')->name('update');
|
||||
Route::delete('/{mission}', 'destroy')->name('destroy');
|
||||
});
|
||||
Route::name('transportationUnit.')
|
||||
->prefix('transportation_unit')
|
||||
->controller(TransportationUnitController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/allocate/{mission}', 'allocate')->name('allocate');
|
||||
Route::post('/deallocate/{mission}', 'deallocate')->name('deallocate');
|
||||
});
|
||||
Route::name('controlUnit.')
|
||||
->prefix('control_unit')
|
||||
->controller(ControlUnitController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
});
|
||||
Route::prefix('details')
|
||||
->name('details.')
|
||||
->controller(DetailController::class)
|
||||
->group(function () {
|
||||
Route::get('/machines/{mission}', 'machines')->name('machines');
|
||||
Route::get('/rahdaran/{mission}', 'rahdaran')->name('rahdaran');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user