Merge branch 'develop' into 'main'
Develop See merge request witelgroup/rms_v2!172
This commit is contained in:
@@ -65,4 +65,8 @@ CMMS_MACHINE_INFO_VIEW_NAME=
|
||||
|
||||
FMS_VEHICLE_ACTIVITY_URL=
|
||||
FMS_VEHICLE_ACTIVITY_PASSWORD=
|
||||
FMS_VEHICLE_ACTIVITY_USERNAME=
|
||||
FMS_VEHICLE_ACTIVITY_USERNAME=
|
||||
|
||||
FMS_ERROR_RATE_URL=
|
||||
FMS_ERROR_RATE_PASSWORD=
|
||||
FMS_ERROR_RATE_USERNAME=
|
||||
131
app/Console/Commands/ExtractGeometryForCities.php
Normal file
131
app/Console/Commands/ExtractGeometryForCities.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\City;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use function Symfony\Component\String\b;
|
||||
|
||||
class ExtractGeometryForCities extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:extract-geometry-for-cities {jsonPath}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'This command will extract polygons for cities from the given .json file';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$jsonPath = $this->argument('jsonPath');
|
||||
|
||||
$json = File::get($jsonPath);
|
||||
$data = json_decode($json, true);
|
||||
|
||||
$features = $data['features'] ?? null;
|
||||
if ($features === null) {
|
||||
$this->error('No features were found');
|
||||
return parent::FAILURE;
|
||||
}
|
||||
|
||||
foreach ($data['features'] as $city) {
|
||||
|
||||
$cityId = $city['properties']['city_id'] ?? null;
|
||||
if ($cityId === null)
|
||||
{
|
||||
$this->info("this city doesn't have id: $city");
|
||||
continue;
|
||||
}
|
||||
|
||||
$coordinates = $city['geometry']['coordinates'] ?? null;
|
||||
if ($coordinates === null)
|
||||
{
|
||||
$this->info("this city doesn't have coordinates: $coordinates");
|
||||
continue;
|
||||
}
|
||||
|
||||
$type = $city['geometry']['type'] ?? null;
|
||||
if ($type === null)
|
||||
{
|
||||
$this->info("This city doesn't have a type: $city");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
switch ($type) {
|
||||
|
||||
case 'Polygon':
|
||||
$wktCoords = collect($coordinates[0])
|
||||
->map(fn($pair) => $pair[1] . ' ' . $pair[0])
|
||||
->implode(',');
|
||||
$wellKnownText = "POLYGON(($wktCoords))";
|
||||
break;
|
||||
|
||||
case 'MultiPolygon':
|
||||
$wktCoords = collect($coordinates)
|
||||
->map(function ($polygon) {
|
||||
$rings = collect($polygon)->map(function ($ring) {
|
||||
if ($ring[0] !== end($ring)) {
|
||||
$ring[] = $ring[0];
|
||||
}
|
||||
return collect($ring)
|
||||
->map(fn($pair) => $pair[1] . ' ' . $pair[0])
|
||||
->implode(',');
|
||||
});
|
||||
return '((' . $rings->implode('),(') . '))';
|
||||
})
|
||||
->implode(',');
|
||||
|
||||
$wellKnownText = "MULTIPOLYGON($wktCoords)";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->info("$type is not a valid type in city: $city");
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
catch (\Throwable $th)
|
||||
{
|
||||
$this->error("Something went wrong: $th");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$query = City::query()
|
||||
->find($cityId);
|
||||
|
||||
if (!$query) {
|
||||
$this->info("City $cityId not found");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$query->update([
|
||||
'geometry' => DB::raw("ST_GeomFromText('$wellKnownText', 4326)")
|
||||
]);
|
||||
}
|
||||
catch (\Throwable $th)
|
||||
{
|
||||
$this->error("Something went wrong: $th");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return parent::SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ enum MissionStates: int
|
||||
case END_MISSION = 4;
|
||||
case REJECT_BY_TRANSPORTATION = 5;
|
||||
case CANCELLED = 6;
|
||||
case CREATED_NO_PROCESS = 7 ;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
@@ -20,6 +21,7 @@ enum MissionStates: int
|
||||
4 => 'اتمام ماموریت',
|
||||
5 => 'عدم تخصیص خودرو توسط واحد نقلیه و بازگشت درخواست به کارتابل کاربر',
|
||||
6 => 'ماموریت لغو شد',
|
||||
7 => 'ماموریت بدون فرایند ثبت شد'
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
|
||||
@@ -6,12 +6,14 @@ enum MissionTypes: int
|
||||
{
|
||||
case SAATY= 1;
|
||||
case ROZANE = 2;
|
||||
case NO_PROCESS = 3;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => 'ساعتی',
|
||||
2 => 'روزانه',
|
||||
3 => 'بدون فرآیند',
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmGuaranteeLetterNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmNoRoadAccessNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmRoadAccessEditNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
18
app/Events/V3/Dashboard/Harim/ConfirmRoadAccessNeedEvent.php
Normal file
18
app/Events/V3/Dashboard/Harim/ConfirmRoadAccessNeedEvent.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmRoadAccessNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
18
app/Events/V3/Dashboard/Harim/RejectRequestEvent.php
Normal file
18
app/Events/V3/Dashboard/Harim/RejectRequestEvent.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RejectRequestEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
19
app/Events/V3/Dashboard/Mission/SendDataToFMSEvent.php
Normal file
19
app/Events/V3/Dashboard/Mission/SendDataToFMSEvent.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Mission;
|
||||
|
||||
use App\Models\Harim;
|
||||
use App\Models\Mission;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendDataToFMSEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Mission $mission){}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ use App\Http\Traits\ApiResponse;
|
||||
use App\Models\CMMSMachine;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CMMSMachinesController extends Controller
|
||||
{
|
||||
@@ -39,4 +41,11 @@ class CMMSMachinesController extends Controller
|
||||
|
||||
return $this->successResponse($matchedSearchedMachines);
|
||||
}
|
||||
|
||||
public function carTypes(): Collection
|
||||
{
|
||||
return DB::table('cmms_machines')
|
||||
->distinct()
|
||||
->pluck('car_type');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,11 @@ namespace App\Http\Controllers\V3\Dashboard\Harim;
|
||||
|
||||
use App\Enums\HarimAction;
|
||||
use App\Enums\HarimStates;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmRoadAccessEditNeedRequest;
|
||||
@@ -23,6 +28,7 @@ use Illuminate\Support\Facades\DB;
|
||||
class GeneralManagerController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$query = Harim::query()
|
||||
@@ -40,8 +46,10 @@ class GeneralManagerController extends Controller
|
||||
|
||||
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -57,14 +65,19 @@ class GeneralManagerController extends Controller
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
RejectRequestEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id'=> auth()->user()->id,
|
||||
'previous-state_id' => $harim->state_id,
|
||||
@@ -81,13 +94,16 @@ class GeneralManagerController extends Controller
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id'=> auth()->user()->id,
|
||||
'previous-state_id' => $harim->state_id,
|
||||
@@ -104,13 +120,16 @@ class GeneralManagerController extends Controller
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -121,18 +140,24 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmRoadAccessNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -143,18 +168,25 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
|
||||
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -165,18 +197,24 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::UPDATE_FILE_BARGOZARE_SHODE->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -187,16 +225,20 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_ZEMANAT_NAME_TAVASOTE_KARBAR->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function show(ShowRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
return $this->successResponse($harim->load('histories'));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class HarimOfficeController extends Controller
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'is_possible' => true,
|
||||
'need_road_access' => true,
|
||||
'need_access_road' => true,
|
||||
]);
|
||||
});
|
||||
return $this->successResponse();
|
||||
@@ -112,7 +112,7 @@ class HarimOfficeController extends Controller
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'is_possible' => true,
|
||||
'need_road_access' => false,
|
||||
'need_access_road' => false,
|
||||
]);
|
||||
});
|
||||
return $this->successResponse();
|
||||
@@ -135,7 +135,7 @@ class HarimOfficeController extends Controller
|
||||
$harim ->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'is_file_good' => true,
|
||||
'access_road_allowed' => true,
|
||||
]);
|
||||
});
|
||||
return $this->successResponse();
|
||||
@@ -158,7 +158,7 @@ class HarimOfficeController extends Controller
|
||||
$harim ->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'is_file_good' => false,
|
||||
'access_road_allowed' => false,
|
||||
]);
|
||||
});
|
||||
return $this->successResponse();
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Harim;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\PanjareVahed\GetAccessRoadRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PanjareVahedController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function receiveNewRequests(Request $request)
|
||||
{
|
||||
try {
|
||||
$city = City::query()
|
||||
->whereRaw("ST_Contains(
|
||||
geometry,
|
||||
ST_SRID(ST_GeomFromText('POINT($request->lng $request->lat)'), 4326))"
|
||||
)
|
||||
->firstOrFail(['id', 'name_fa', 'province_id']);
|
||||
}
|
||||
catch (ModelNotFoundException $exception){
|
||||
$city = City::query()
|
||||
->orderByRaw("ST_Distance(
|
||||
geometry,
|
||||
ST_SRID(ST_GeomFromText('POINT($request->lng $request->lat)'), 4326)
|
||||
) ASC"
|
||||
)
|
||||
->first(['id', 'name_fa', 'province_id']);
|
||||
}
|
||||
|
||||
$state = HarimStates::BARESI_EDARE_SHAHRESTAN->value;
|
||||
|
||||
Harim::query()->create([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
'panjare_vahed_id' => $request->id,
|
||||
'national_id' => $request->national_id,
|
||||
'phone_number' => $request->phone_number,
|
||||
'request_date' => $request->request_date,
|
||||
'province_id' => $city->province_id,
|
||||
'province_name' => $city->province()->first()->name_fa,
|
||||
'city_id' => $city->id,
|
||||
'city_name' => $city->name,
|
||||
'edareh_shahri_id' => $city->edarateShahri()->first()->id,
|
||||
'requested_organization' => $request->organization,
|
||||
'plan_group' => $request->plan_group,
|
||||
'plan_title' => $request->plan_title,
|
||||
'worksheet_id' => $request->worksheet_id,
|
||||
'response_options' => json_encode($request->response_options),
|
||||
'isic' => $request->isic,
|
||||
'primary_area' => $request->primary_area,
|
||||
]);
|
||||
|
||||
return $this->successResponse([
|
||||
'city' => $city->edarateShahri()->first()->name_fa,
|
||||
'province' => $city->province()->first()->name_fa,
|
||||
]);
|
||||
}
|
||||
public function getAccessRoad(GetAccessRoadRequest $request, Harim $harim)
|
||||
{
|
||||
Harim::update([
|
||||
'panjarevahed_id' => $request->panjarevahed_id,
|
||||
'polygon' => $request->polygon,
|
||||
]);
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Enums\MissionCategory;
|
||||
use App\Enums\MissionStates;
|
||||
use App\Enums\MissionTypes;
|
||||
use App\Enums\MissionZones;
|
||||
use App\Events\V3\Dashboard\Mission\SendDataToFMSEvent;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Mission\ControlUnit\FinishRequest;
|
||||
use App\Http\Requests\V3\Mission\ControlUnit\NoProcessRequest;
|
||||
use App\Http\Requests\V3\Mission\ControlUnit\StartRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
@@ -51,6 +56,7 @@ class ControlUnitController extends Controller
|
||||
]);
|
||||
|
||||
$state = MissionStates::END_MISSION->value;
|
||||
|
||||
$mission->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
@@ -58,6 +64,48 @@ class ControlUnitController extends Controller
|
||||
]);
|
||||
});
|
||||
|
||||
SendDataToFMSEvent::dispatch($mission);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
|
||||
public function noProcess(NoProcessRequest $request): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request) {
|
||||
$user = auth()->user();
|
||||
$zone= $request->zone;
|
||||
$type= MissionTypes::NO_PROCESS->value;
|
||||
$state = MissionStates::CREATED_NO_PROCESS->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->edarate_shahri_id ?? null,
|
||||
'edare_shahri_name' => $user->edarate_shahri_name ?? null,
|
||||
'zone' => $zone,
|
||||
'zone_fa' => MissionZones::name($zone),
|
||||
'type' => $type,
|
||||
'type_fa' => MissionTypes::name($type),
|
||||
'start_date' => $request->start_date,
|
||||
'end_date' => $request->end_date,
|
||||
'end_point' => $request->end_point,
|
||||
'area' => json_encode($request->area),
|
||||
'category_id' => $request->category_id,
|
||||
'category_name' => MissionCategory::name($request->category_id),
|
||||
'start_time' => $request->start_date,
|
||||
'finish_time' => $request->end_date,
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->sync($request->rahdaran);
|
||||
$mission->machines()->attach($request->machines);
|
||||
$mission->rahdaran()->attach($request->driver, ['is_driver' => true]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@ class RequestPortalController extends Controller
|
||||
'zone_fa' => MissionZones::name($request->zone),
|
||||
'start_date' => $request->start_date,
|
||||
'end_date' => $request->end_date,
|
||||
'request_date' => $request->request_date,
|
||||
'description' => $request->description,
|
||||
'end_point' => $request->end_point,
|
||||
'area' => json_encode($request->area),
|
||||
|
||||
@@ -19,9 +19,7 @@ class AccessRoadActivityController extends Controller
|
||||
use ApiResponse;
|
||||
public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 90]);
|
||||
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(90);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
@@ -31,9 +29,11 @@ class AccessRoadActivityController extends Controller
|
||||
|
||||
public function provinceActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 90]);
|
||||
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 90,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
@@ -42,14 +42,17 @@ class AccessRoadActivityController extends Controller
|
||||
}
|
||||
public function countryExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(90);
|
||||
$name = 'گزارش نگهداری حریم راه برای راه دسترسی غیر مجاز ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ExcelReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 90,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
$name = 'گزارش نگهداری حریم راه برای راه دسترسی غیر مجاز ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new AccessRoadReport($data, $request), $name);
|
||||
}
|
||||
|
||||
@@ -19,20 +19,19 @@ class ConstructionActivityController extends Controller
|
||||
use ApiResponse;
|
||||
public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 89]);
|
||||
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(89);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
public function provinceActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
public function provinceActivity(Request $request, OperatorService $operatorService,): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 89]);
|
||||
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 89,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
@@ -41,17 +40,20 @@ class ConstructionActivityController extends Controller
|
||||
}
|
||||
public function countryExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(89);
|
||||
$name = ' گزارش نگهداری حریم راه برای ساخت و ساز غیر مجاز' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
|
||||
return Excel::download(new ExcelReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 89,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
$name = ' گزارش نگهداری حریم راه برای ساخت و ساز غیر مجاز' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
|
||||
return Excel::download(new ConstructionReport($data, $request), $name);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReport;
|
||||
use App\Exports\V3\SafetyAndPrivacy\Country\UtilityPassingReport as ExcelReport;
|
||||
use App\Exports\V3\SafetyAndPrivacy\Province\UtilityPassingReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\SafetyAndPrivacy\OperatorService;
|
||||
@@ -15,11 +16,11 @@ use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class UtilityPassingActivityController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 91]);
|
||||
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(91);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
@@ -28,9 +29,10 @@ class UtilityPassingActivityController extends Controller
|
||||
}
|
||||
public function provinceActivity(Request $request, OperatorService $operatorService): JsonResponse
|
||||
{
|
||||
$request->merge(['info_id' => 91]);
|
||||
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 91,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
|
||||
return $this->successResponse([
|
||||
'activities' => $data,
|
||||
@@ -39,16 +41,20 @@ class UtilityPassingActivityController extends Controller
|
||||
}
|
||||
public function countryExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->countryActivity($request);
|
||||
$data = $operatorService->countryActivity(91);
|
||||
|
||||
$name = 'گزارش نگهداری حریم راه برای عبور تاسیسات زیربنایی غیر مجاز ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
return Excel::download(new ExcelReport($data), $name);
|
||||
}
|
||||
|
||||
public function provinceExcelActivity(Request $request, OperatorService $operatorService): BinaryFileResponse
|
||||
{
|
||||
$data = $operatorService->provinceActivity($request);
|
||||
$data = $operatorService->provinceActivity(
|
||||
info_id: 91,
|
||||
province_id: $request->input('province_id')
|
||||
);
|
||||
$name = 'گزارش نگهداری حریم راه برای عبور تاسیسات زیربنایی غیر مجاز ' . verta()->now()->format('Y-m-d H-i') . '.xlsx';
|
||||
|
||||
return Excel::download(new UtilityPassingReport($data, $request), $name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
771
app/Http/Controllers/V3/Dashboard/UserManagementController.php
Normal file
771
app/Http/Controllers/V3/Dashboard/UserManagementController.php
Normal file
@@ -0,0 +1,771 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\UserManagement\PermissionUpdateRequest;
|
||||
use App\Http\Requests\V3\Dashboard\UserManagement\StoreRequest;
|
||||
use App\Http\Requests\V3\Dashboard\UserManagement\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\EdarateOstani;
|
||||
use App\Models\EdarateShahri;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Province;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class UserManagementController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
// public function index()
|
||||
// {
|
||||
// if (Auth::user()->can('full-user-managment') || Auth::user()->can('limited-user-management')) {
|
||||
// return view('version2.dashboard_pages.user_management.list');
|
||||
// }
|
||||
//
|
||||
// abort(403);
|
||||
// }
|
||||
public function indexUser(Request $request)
|
||||
{
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1038);
|
||||
}
|
||||
|
||||
$province = $request->province ?? null;
|
||||
$city = $request->city ?? null;
|
||||
$province_office = $request->province_office ?? null;
|
||||
|
||||
if (Auth::user()->checkUserHasPermission('full-user-management')) {
|
||||
$users = User::when($province, function ($query, $province) {
|
||||
return $query->where('province_id', $province);
|
||||
})
|
||||
->when($city, function ($query, $city) {
|
||||
return $query->where('city_id', $city);
|
||||
})
|
||||
->when($province_office, function ($query, $province_office) {
|
||||
if ($province_office == -1) {
|
||||
return $query->where('edarate_ostani_id', null)->whereNotNull('edarate_shahri_id');
|
||||
} else {
|
||||
return $query->where('edarate_ostani_id', $province_office);
|
||||
}
|
||||
})
|
||||
->with(['roles' => function ($query) {
|
||||
$query->where('for_report', 1);
|
||||
}])
|
||||
->get();
|
||||
} elseif (Auth::user()->checkUserHasPermission('limited-user-management')) {
|
||||
$users = User::when($province, function ($query, $province) {
|
||||
return $query->where('province_id', $province);
|
||||
})
|
||||
->where('province_id', Auth::user()->province_id)
|
||||
->when($city, function ($query, $city) {
|
||||
return $query->where('city_id', $city);
|
||||
})
|
||||
->when($province_office, function ($query, $province_office) {
|
||||
if ($province_office == -1) {
|
||||
return $query->where('edarate_ostani_id', null)->whereNotNull('edarate_shahri_id');
|
||||
} else {
|
||||
return $query->where('edarate_ostani_id', $province_office);
|
||||
}
|
||||
})
|
||||
->with(['roles' => function ($query) {
|
||||
$query->where('for_report', 1);
|
||||
}])
|
||||
->get();
|
||||
} else {
|
||||
return response()->json([
|
||||
'message' => 'Forbidden'
|
||||
], 403);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => '200',
|
||||
'message' => 'success',
|
||||
'data' => $users,
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function store(StoreRequest $request): jsonResponse
|
||||
{
|
||||
User::query()->create([
|
||||
'username' => $request->username,
|
||||
'national_code' => $request->national_code,
|
||||
'password' => Hash::make($request->password),
|
||||
'province_id' => $request->province_id,
|
||||
'edarate_ostani_id' => $request->edarate_ostani_id,
|
||||
'city_id' => $request->city_id,
|
||||
'edarate_shahri_id' => $request->edarate_shahri_id,
|
||||
]);
|
||||
|
||||
$user = new User();
|
||||
$user->username = $request->username;
|
||||
|
||||
$user->province_id = $request->province_id == 0 ? null : $request->province_id;
|
||||
$user->province_fa = ($request->province_id == 0) ? 'ستاد' : Province::find($request->province_id)->name_fa;
|
||||
|
||||
$user->city_id = $request->city_id == 0 ? null : $request->city_id;
|
||||
$user->city_fa = ($request->city_id == 0) ? null : City::find($request->city_id)->name_fa ;
|
||||
|
||||
if ($request->edarate_ostani_id != 'null') {
|
||||
$temp = EdarateOstani::find($request->edarate_ostani_id)->name_fa;
|
||||
$user->edarate_ostani_id = $request->edarate_ostani_id;
|
||||
$user->edarate_ostani_name = $temp;
|
||||
if ($request->province_id == 0) {
|
||||
$user->name = $temp .' '. $user->province_fa;
|
||||
} else {
|
||||
$user->name = $temp .' استان '. $user->province_fa;
|
||||
}
|
||||
} else {
|
||||
$temp = EdarateShahri::find($request->edarate_shahri_id)->name_fa;
|
||||
$user->edarate_shahri_id = $request->edarate_shahri_id;
|
||||
$user->edarate_shahri_name = $temp;
|
||||
|
||||
if ($request->province_id == 0) {
|
||||
$user->name = $temp .' '. $user->province_fa;
|
||||
} else {
|
||||
$user->name = $temp .' استان '. $user->province_fa;
|
||||
}
|
||||
}
|
||||
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->national_code = $request->national_code;
|
||||
$user->save();
|
||||
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1039, $user);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $user
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function editRole(Request $request, $id)
|
||||
{
|
||||
$request->validate([
|
||||
'role_name' => 'required|string',
|
||||
'permissions' => 'required'
|
||||
], [
|
||||
'permissions.required' => 'انتخاب دسترسیها الزامی است.',
|
||||
'role_name.required' => 'نام نقش الزامی است.'
|
||||
]);
|
||||
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1044);
|
||||
}
|
||||
$role = Role::find($id);
|
||||
|
||||
|
||||
$updateRole = $role->update([
|
||||
'name_fa' => $request->role_name,
|
||||
'description' => $request->description
|
||||
]);
|
||||
|
||||
$permissions = $request->permissions;
|
||||
// $permissions = explode(",", $request->permissions);
|
||||
|
||||
$role->syncPermissions($permissions);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $role
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function createRole(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'role_name' => 'required|string',
|
||||
'permissions' => 'required'
|
||||
], [
|
||||
'permissions.required' => 'انتخاب دسترسیها الزامی است.',
|
||||
'role_name.required' => 'نام نقش الزامی است.'
|
||||
]);
|
||||
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1043);
|
||||
}
|
||||
|
||||
$role = Role::create([
|
||||
'name' => time(),
|
||||
'name_fa' => $request->role_name,
|
||||
'description' => $request->description
|
||||
]);
|
||||
|
||||
$permissions = $request->permissions;
|
||||
|
||||
// $permissions = explode(",", $request->permissions);
|
||||
$role->givePermissionTo($permissions);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $role
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(User $user)
|
||||
{
|
||||
$user = User::where('id', $user->id)->with(['roles', 'permissions'])->get();
|
||||
return response()->json([
|
||||
'status' => '200',
|
||||
'message' => 'success',
|
||||
'data' => $user
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function update(UpdateRequest $request, User $user): JsonResponse
|
||||
{
|
||||
$user->update([
|
||||
'username' => $request->username,
|
||||
'national_code' => $request->national_code,
|
||||
'password' => Hash::make($request->password),
|
||||
'province_id' => $request->province_id,
|
||||
'edarate_ostani_id' => $request->edarate_ostani_id,
|
||||
'city_id' => $request->city_id,
|
||||
'edarate_shahri_id' => $request->edarate_shahri_id,
|
||||
]);
|
||||
|
||||
$user->province_id = $request->province_id == 0 ? null : $request->province_id;
|
||||
$user->province_fa = ($request->province_id == 0) ? 'ستاد' : Province::find($request->province_id)->name_fa;
|
||||
|
||||
$user->city_id = $request->city_id == 0 ? null : $request->city_id;
|
||||
$user->city_fa = ($request->city_id == 0) ? null : City::find($request->city_id)->name_fa ;
|
||||
|
||||
if ($request->edarate_ostani_id != "null") {
|
||||
$temp = EdarateOstani::find($request->edarate_ostani_id)->name_fa;
|
||||
$user->edarate_ostani_id = $request->edarate_ostani_id;
|
||||
$user->edarate_ostani_name = $temp;
|
||||
|
||||
$user->edarate_shahri_id = null;
|
||||
$user->edarate_shahri_name = null;
|
||||
|
||||
if ($request->province_id == 0) {
|
||||
$user->name = $temp .' '. $user->province_fa;
|
||||
} else {
|
||||
$user->name = $temp .' استان '. $user->province_fa;
|
||||
}
|
||||
} else {
|
||||
$temp = EdarateShahri::find($request->edarate_shahri_id)->name_fa;
|
||||
$user->edarate_shahri_id = $request->edarate_shahri_id;
|
||||
$user->edarate_shahri_name = $temp;
|
||||
$user->edarate_ostani_id = null;
|
||||
$user->edarate_ostani_name = null;
|
||||
if ($request->province_id == 0) {
|
||||
$user->name = $temp .' '. $user->province_fa;
|
||||
} else {
|
||||
$user->name = $temp .' استان '. $user->province_fa;
|
||||
}
|
||||
}
|
||||
|
||||
$user->first_name = $request->first_name;
|
||||
$user->last_name = $request->last_name;
|
||||
$user->position = $request->position;
|
||||
$user->mobile = $request->mobile;
|
||||
$user->degree = $request->degree;
|
||||
$user->major = $request->major;
|
||||
$user->national_code = $request->national_code;
|
||||
|
||||
if (!is_null($request->password)) {
|
||||
$request->validate([
|
||||
'password' => ['string']
|
||||
]);
|
||||
$user->password = Hash::make($request->password);
|
||||
}
|
||||
|
||||
if (! $request->permissions == null) {
|
||||
$user->syncPermissions(explode(",", $request->permissions));
|
||||
}
|
||||
|
||||
$roles = $request->only('roles');
|
||||
if (! $roles == null) {
|
||||
$user->syncRoles($roles);
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1040, $user);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $user
|
||||
]);
|
||||
}
|
||||
|
||||
public function activityReport()
|
||||
{
|
||||
return view('version2.dashboard_pages.user_management.activity_report');
|
||||
}
|
||||
|
||||
public function userActivityLogs()
|
||||
{
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => '',
|
||||
'data' => auth()->user()->activityLogs,
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function changeConfirmedStatus(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'user_ids' => 'required|regex:/^(\d+)(,\d+)*$/',
|
||||
'confirm' => 'required|in:0,1'
|
||||
]);
|
||||
|
||||
$user_ids = explode(",", $request->user_ids);
|
||||
|
||||
User::whereIn('id', $user_ids)->update([
|
||||
'confirmed' => $request->confirm
|
||||
]);
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
]);
|
||||
}
|
||||
|
||||
public function changePassword(User $user, Request $request)
|
||||
{
|
||||
$validData = $request->validate([
|
||||
'password' => 'required|string|min:8|confirmed',
|
||||
]);
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->save();
|
||||
return response()->json(['message' => "password changed successfully!!!!"], 200);
|
||||
}
|
||||
|
||||
public function givePermissionsTo(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'user_ids' => 'required|regex:/^(\d+)(,\d+)*$/',
|
||||
'permission_ids' => 'required',
|
||||
]);
|
||||
|
||||
$user_ids = explode(",", $request->user_ids);
|
||||
$permission_ids = $request->permission_ids;
|
||||
|
||||
User::whereIn('id', $user_ids)->get()->each(function ($user) use ($permission_ids) {
|
||||
$user->syncPermissions($permission_ids);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'status' => 'succeed',
|
||||
'message' => 'permissions assigned to users succussfully.'
|
||||
]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'user_ids' => 'required|regex:/^(\d+)(,\d+)*$/',
|
||||
]);
|
||||
|
||||
$user_ids = explode(',', $request->user_ids);
|
||||
|
||||
foreach ($user_ids as $id) {
|
||||
$user = User::find($id);
|
||||
|
||||
if ($user->avatar) {
|
||||
if (Storage::disk('public')->exists(str_replace('storage/', '', $user->avatar))) {
|
||||
Storage::disk('public')->delete(str_replace('storage/', '', $user->avatar));
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->photo) {
|
||||
if (Storage::disk('public')->exists(str_replace('storage/', '', $user->photo))) {
|
||||
Storage::disk('public')->delete(str_replace('storage/', '', $user->photo));
|
||||
}
|
||||
}
|
||||
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 200,
|
||||
'message' => 'The users deleted succussfully.'
|
||||
]);
|
||||
}
|
||||
|
||||
public function getUserPermissions()
|
||||
{
|
||||
$userPermissions = Auth::user()->getUserPermissions();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $userPermissions
|
||||
]);
|
||||
}
|
||||
|
||||
public function getUserSummaryReport(Request $request, User $user)
|
||||
{
|
||||
$request->fromDate = $request->fromDate ? $request->fromDate . " 00:00:00" : Carbon::now()->subDays(30)->format('Y-m-d 00:00:00');
|
||||
$request->toDate = $request->toDate ? $request->toDate . " 23:59:59" : Carbon::now()->format('Y-m-d 23:59:59');
|
||||
$data = [];
|
||||
|
||||
$ids_list = '';
|
||||
$temp_sql_for_activity_time = "
|
||||
SELECT sum(majmoe) AS activity FROM (SELECT *,
|
||||
COUNT(cnt) AS majmoe
|
||||
FROM (
|
||||
SELECT *,
|
||||
COUNT(*) AS cnt
|
||||
FROM (
|
||||
SELECT YEAR (created_at) AS yy,
|
||||
MONTH (created_at) AS mm,
|
||||
DAY (created_at) AS dd,
|
||||
HOUR (created_at) AS hh,
|
||||
user_id
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$user->id.")
|
||||
) user_activity_distinct
|
||||
GROUP BY yy,
|
||||
mm,
|
||||
dd,
|
||||
hh,
|
||||
user_id
|
||||
) user_activity_by_hour_and_
|
||||
GROUP BY user_id) AS calculated_table;";
|
||||
|
||||
$temp_sql_for_activity_list = "
|
||||
SELECT *,
|
||||
COUNT(*) AS cnt
|
||||
FROM (
|
||||
SELECT
|
||||
description,
|
||||
log_unique_code
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$user->id.")
|
||||
) user_activity_distinct
|
||||
GROUP BY
|
||||
log_unique_code
|
||||
ORDER BY cnt desc";
|
||||
|
||||
$number_of_active_days = "
|
||||
SELECT COUNT(*) AS cnt
|
||||
FROM (
|
||||
SELECT mm,dd
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$user->id.")
|
||||
GROUP BY
|
||||
mm,dd
|
||||
) active_days
|
||||
ORDER BY cnt desc";
|
||||
|
||||
|
||||
$number_of_activities = "
|
||||
SELECT COUNT(*) AS cnt
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$user->id.")
|
||||
ORDER BY cnt desc";
|
||||
|
||||
$number_of_active_days = (DB::select($number_of_active_days)[0]->cnt ? DB::select($number_of_active_days)[0]->cnt : -1);
|
||||
$activity_time = DB::select($temp_sql_for_activity_time)[0]->activity;
|
||||
$number_of_activities = DB::select($number_of_activities)[0]->cnt;
|
||||
$data = [
|
||||
'number_of_active_days' => $number_of_active_days,
|
||||
|
||||
'activity_time' => $user->id ? $activity_time : null,
|
||||
'average_activity_time' => round(($user->id ? $activity_time : 0) / $number_of_active_days, 2) ,
|
||||
'number_of_activities' => $number_of_activities ,
|
||||
'average_activity_number' => round(($user->id ? $number_of_activities : 0) / $number_of_active_days, 2) ,
|
||||
|
||||
'activity_list' => $user->id ? DB::select($temp_sql_for_activity_list) : null,
|
||||
'last_login' => $user->last_login,
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function printGroup(User $user, Request $request)
|
||||
{
|
||||
$request->fromDate = $request->fromDate ? $request->fromDate . " 00:00:00" : Carbon::now()->format('Y-m-d 00:00:00') ;
|
||||
$request->toDate = $request->toDate ? $request->toDate . " 23:59:59" : Carbon::now()->format('Y-m-d 23:59:59');
|
||||
|
||||
$data = [];
|
||||
|
||||
$ids_list = '';
|
||||
// $users = $role->users()->select("*")->get()->toArray();
|
||||
// foreach ($user as $index => $item) {
|
||||
$user_activity_quantity_temp[$user->id] = [
|
||||
"majmoe" => 0,
|
||||
"name" => $user->first_name ? $user->first_name." ".$user->last_name." (".$user->username.")" : $user->name." (".$user->username.")",
|
||||
];
|
||||
|
||||
$user_activity_time_temp[$user->id] = [
|
||||
"majmoe" => 0,
|
||||
"name" => $user->first_name ? $user->first_name." ".$user->last_name." (".$user->username.")" : $user->name."(".$user->username.")",
|
||||
];
|
||||
|
||||
$user_activity_top_5_temp[$user->id] = [
|
||||
"activity_list" => [],
|
||||
"name" => $user->first_name ? $user->first_name." ".$user->last_name." (".$user->username.")" : $user->name."(".$user->username.")",
|
||||
];
|
||||
|
||||
|
||||
// if (!$index) {
|
||||
$ids_list = $user->id;
|
||||
// } else {
|
||||
// $ids_list .= ",".$item['id'];
|
||||
// }
|
||||
// }
|
||||
$total_activity_time_sql = "
|
||||
SELECT sum(majmoe) AS activity FROM (SELECT *,
|
||||
COUNT(quantity) AS majmoe
|
||||
FROM (
|
||||
SELECT user_id,
|
||||
COUNT(*) AS quantity
|
||||
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
|
||||
GROUP BY yy,
|
||||
mm,
|
||||
dd,
|
||||
hh,
|
||||
user_id
|
||||
) user_activity_by_hour_and_
|
||||
GROUP BY user_id) AS calculated_table;";
|
||||
|
||||
$quantitative_activity_chart_sql = "
|
||||
SELECT created_at,
|
||||
COUNT(*) AS quantity
|
||||
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
GROUP BY
|
||||
yy,
|
||||
mm,
|
||||
dd ;";
|
||||
|
||||
$hourly_activity_chart_sql = "
|
||||
SELECT
|
||||
COUNT(quantity) AS majmoe
|
||||
FROM (
|
||||
SELECT yy,
|
||||
mm,
|
||||
dd,
|
||||
hh,
|
||||
COUNT(*) AS quantity
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
GROUP BY yy,
|
||||
mm,
|
||||
dd,
|
||||
hh,
|
||||
user_id
|
||||
) user_activity_by_hour_and_
|
||||
GROUP BY
|
||||
yy,
|
||||
mm,
|
||||
dd;";
|
||||
|
||||
$total_activity_quantity_sql = "
|
||||
SELECT COUNT(*) AS total_activity_quantity
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
";
|
||||
|
||||
|
||||
$top_10_activity_list_sql = "
|
||||
SELECT *,
|
||||
COUNT(*) AS quantity
|
||||
FROM (
|
||||
SELECT
|
||||
description,
|
||||
log_unique_code
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
) user_activity_distinct
|
||||
GROUP BY
|
||||
log_unique_code
|
||||
ORDER BY quantity desc
|
||||
LIMIT 10";
|
||||
|
||||
|
||||
$user_activity_quantity_sql = "
|
||||
SELECT *,
|
||||
COUNT(*) AS quantity
|
||||
FROM (
|
||||
SELECT
|
||||
user_id,
|
||||
user_first_name,
|
||||
user_last_name,
|
||||
user_name,
|
||||
username
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
) user_activity_distinct
|
||||
GROUP BY user_id
|
||||
ORDER BY quantity desc";
|
||||
|
||||
$active_user_count_sql = "
|
||||
SELECT COUNT(*) AS active_user_count
|
||||
FROM(
|
||||
SELECT
|
||||
user_id
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
GROUP BY user_id
|
||||
) grpuped_by_user_id";
|
||||
|
||||
$user_activity_time_sql = "
|
||||
select
|
||||
*,
|
||||
COUNT(quantity) AS majmoe
|
||||
FROM (
|
||||
SELECT
|
||||
user_first_name,
|
||||
user_last_name,
|
||||
user_name,
|
||||
username,
|
||||
user_id,
|
||||
COUNT(*) AS quantity
|
||||
FROM user_activity_logs
|
||||
WHERE created_at between '{$request->fromDate}' and '{$request->toDate}' and user_id IN(".$ids_list.")
|
||||
GROUP BY yy,
|
||||
mm,
|
||||
dd,
|
||||
hh,
|
||||
user_id
|
||||
) user_activity_by_hour_and_
|
||||
GROUP BY user_id
|
||||
ORDER BY majmoe desc;";
|
||||
|
||||
foreach (DB::select($user_activity_quantity_sql) as $key => $value) {
|
||||
$user_activity_quantity_temp[$value->user_id] = [
|
||||
"majmoe" => $value->quantity ?? 0,
|
||||
"name" => $value->user_first_name ? $value->user_first_name." ".$value->user_last_name." (".$value->username.")" : $value->user_name." (".$value->username.")",
|
||||
];
|
||||
}
|
||||
|
||||
foreach (DB::select($user_activity_time_sql) as $key => $value) {
|
||||
$user_activity_time_temp[$value->user_id] = [
|
||||
"majmoe" => $value->majmoe ?? 0,
|
||||
"name" => $value->user_first_name ? $value->user_first_name." ".$value->user_last_name." (".$value->username.")" : $value->user_name." (".$value->username.")",
|
||||
];
|
||||
}
|
||||
|
||||
foreach ($user_activity_top_5_temp as $key => $value) {
|
||||
$user_activity_top_5_temp_sql = "
|
||||
SELECT
|
||||
description,
|
||||
COUNT(*) AS quantity
|
||||
FROM user_activity_logs
|
||||
WHERE user_id = {$key} AND created_at between '{$request->fromDate}' and '{$request->toDate}'
|
||||
GROUP BY log_unique_code
|
||||
ORDER BY quantity DESC
|
||||
LIMIT 5
|
||||
";
|
||||
|
||||
$activity_list = DB::select($user_activity_top_5_temp_sql);
|
||||
$sum = 0;
|
||||
foreach ($activity_list as $index => $item) {
|
||||
$sum += (int) $item->quantity;
|
||||
}
|
||||
$user_activity_top_5_temp[$key] = [
|
||||
"sum" => $sum,
|
||||
"name" => $value['name'],
|
||||
"activity_list" => $activity_list,
|
||||
];
|
||||
}
|
||||
arsort($user_activity_top_5_temp);
|
||||
arsort($user_activity_time_temp);
|
||||
arsort($user_activity_quantity_temp);
|
||||
$data = [
|
||||
'fromDate' => $request->fromDate ? $request->fromDate : null,
|
||||
'toDate' => $request->toDate ? $request->toDate : null,
|
||||
'user_activity_time' => $ids_list ? $user_activity_time_temp : null,
|
||||
'hourly_activity_chart' => $ids_list ? DB::select($hourly_activity_chart_sql) : null,
|
||||
'quantitative_activity_chart' => $ids_list ? DB::select($quantitative_activity_chart_sql) : null,
|
||||
'total_activity_quantity' => $ids_list ? DB::select($total_activity_quantity_sql)[0]->total_activity_quantity : null,
|
||||
'total_activity_time' => $ids_list ? DB::select($total_activity_time_sql)[0]->activity : null,
|
||||
'top_10_activity_list' => $ids_list ? DB::select($top_10_activity_list_sql) : null,
|
||||
'user_activity_quantity' => $ids_list ? $user_activity_quantity_temp : null,
|
||||
'group_name' => $user->first_name." ".$user->last_name,
|
||||
'average' => round(($ids_list ? DB::select($total_activity_time_sql)[0]->activity : 0) / 1, 2) ,
|
||||
'user_activity_top_5_temp' => $user_activity_top_5_temp,
|
||||
'total_user_count' => 1,
|
||||
'active_user_count' => $ids_list ? DB::select($active_user_count_sql)[0]->active_user_count : null,
|
||||
'group_id' => $user->id
|
||||
];
|
||||
|
||||
return View('word.user-activity-individual', compact('data'));
|
||||
}
|
||||
public function userPermission($id)
|
||||
{
|
||||
$user = User::find($id);
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $user->permissions,
|
||||
]);
|
||||
}
|
||||
|
||||
public function assignPermission(Request $request, User $user)
|
||||
{
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1042);
|
||||
}
|
||||
$permissions = explode(",", $request->permissions);
|
||||
if (! $permissions == null) {
|
||||
$user->syncPermissions($permissions);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'status',
|
||||
'data' => User::where('id', $user->id)->with(['permissions'])->get()
|
||||
]);
|
||||
}
|
||||
|
||||
public function showAllRoles(Request $request)
|
||||
{
|
||||
$roles = Role::where('for_report', 0)->get();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => $roles
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteRole(Request $request, $id)
|
||||
{
|
||||
if (auth()->user()) {
|
||||
auth()->user()->addActivityComplete(1045);
|
||||
}
|
||||
$role = Role::find($id)->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'success',
|
||||
'data' => 1
|
||||
]);
|
||||
}
|
||||
|
||||
public function changeUserEnabeld(User $user)
|
||||
{
|
||||
if (Auth::user()->checkUserHasPermission('full-user-management')) {
|
||||
$user->enabled = !$user->enabled;
|
||||
$user->save();
|
||||
return response()->json([
|
||||
'message' => 'success'
|
||||
], 200);
|
||||
} elseif (Auth::user()->checkUserHasPermission('limited-user-management') && Auth::user()->province_id == $user->province_id) {
|
||||
$user->enabled = !$user->enabled;
|
||||
$user->save();
|
||||
return response()->json([
|
||||
'message' => 'success'
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'message' => 'Forbidden'
|
||||
], 403);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,9 @@ class CheckAxisTypeMiddleware
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$s = $request->route('safetyAndPrivacy');
|
||||
$s = $request->safetyAndPrivacy;
|
||||
|
||||
if (($s->step == 3 || $s->step == 2) && is_null($s->axis_type_id))
|
||||
if (($s->step == 1 || $s->step == 2) && is_null($s->axis_type_id))
|
||||
{
|
||||
throw new ProhibitedAction('ابتدا نوع محور را مشخص کنید');
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ class ConfirmPaymentInfoRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->accident->status === AccidentStates::SODOR_NAME_BIME_VA_DAGHI->value;
|
||||
return in_array($this->accident->status,
|
||||
[AccidentStates::SODOR_NAME_BIME_VA_DAGHI->value, AccidentStates::SABT_FISH->value]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\PanjareVahed;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class GetAccessRoadRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'panjarevahed_id'=> 'required|string',
|
||||
'polygon' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
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 [
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostanis,id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahris,id',
|
||||
'username' => 'required|unique:users,username',
|
||||
'national_code' => 'unique:users,national_code',
|
||||
'password' => 'required|min:8',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\UserManagement;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateRequest 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 [
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edarate_ostani_id' => 'exists:edarate_ostanis,id',
|
||||
'city_id' => 'exists:cities,id',
|
||||
'edarate_shahri_id' => 'exists:edarate_shahris,id',
|
||||
'username' => ['required',Rule::unique('users','username')->ignore($this->user->id)],
|
||||
'national_code' =>['required',Rule::unique('users','national_code')->ignore($this->user->id)],
|
||||
'password' => 'required|min:8',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\ControlUnit;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class NoProcessRequest 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, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'machines' => 'required|array',
|
||||
'machines.*' => 'required|integer|exists:cmms_machines,id',
|
||||
'driver' => 'required|integer|exists:rahdaran,id',
|
||||
'zone' => 'required|in:1,2,3',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'required|date|after:start_date|before:now',
|
||||
'end_point' => 'required|string',
|
||||
'area' => 'required|array',
|
||||
'area.type' => 'required|string',
|
||||
'area.coordinates' => 'required|array',
|
||||
'category_id' => 'required|in:1,2,3',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'end_date.before' => 'تاریخ پایان باید قبل از زمان فعلی باشد.',
|
||||
'end_date.after' => 'تاریخ پایان نباید قبل از تاریخ شروع باشد.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmGuaranteeLetterNeedListener implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'harim';
|
||||
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(ConfirmGuaranteeLetterNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmNoRoadAccessNeedListener implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'harim';
|
||||
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(ConfirmNoRoadAccessNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmRoadAccessEditNeedListener implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'harim';
|
||||
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessEditNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmRoadAccessNeedListener implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'harim';
|
||||
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
46
app/Listeners/V3/Dashboard/Harim/RejectRequestListener.php
Normal file
46
app/Listeners/V3/Dashboard/Harim/RejectRequestListener.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class RejectRequestListener implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'harim';
|
||||
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(RejectRequestEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
39
app/Listeners/V3/Dashboard/Mission/SendDataToFMSListener.php
Normal file
39
app/Listeners/V3/Dashboard/Mission/SendDataToFMSListener.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Mission;
|
||||
|
||||
use App\Events\V3\Dashboard\Mission\SendDataToFMSEvent;
|
||||
use App\Services\FMS\GetErrorRateService;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
|
||||
class SendDataToFMSListener implements ShouldQueue
|
||||
{
|
||||
public function __construct(public GetErrorRateService $getErrorRateService) {}
|
||||
|
||||
/**
|
||||
* The name of the queue the job should be sent to.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public ?string $queue = 'fms';
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handle(SendDataToFMSEvent $event): void
|
||||
{
|
||||
$mission = $event->mission;
|
||||
|
||||
$this->getErrorRateService->setInputParameters([
|
||||
'area' => $mission->area,
|
||||
'start_date' => $mission->start_date,
|
||||
'end_date' => $mission->end_date,
|
||||
'machine_code' => $mission->machines()->first('cmms_machines.machine_code')
|
||||
]);
|
||||
|
||||
$this->getErrorRateService->run();
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,11 @@ class City extends Model
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
public function province()
|
||||
protected $fillable = [
|
||||
'geometry',
|
||||
];
|
||||
|
||||
public function province(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo('App\Models\Province');
|
||||
}
|
||||
@@ -72,7 +76,7 @@ class City extends Model
|
||||
return $this->hasMany('App\Models\RoadConstructionRural');
|
||||
}
|
||||
|
||||
public function edarateShahri()
|
||||
public function edarateShahri(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany('App\Models\EdarateShahri', 'edarate_shahri_be_city')->withPivot('is_primary','id');
|
||||
}
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use App\Events\V3\Dashboard\Mission\SendDataToFMSEvent;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmRoadAccessNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\RejectRequestListener;
|
||||
use App\Listeners\V3\Dashboard\Mission\SendDataToFMSListener;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
@@ -25,6 +37,25 @@ class EventServiceProvider extends ServiceProvider
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\LogSuccessfulLogin',
|
||||
],
|
||||
|
||||
RejectRequestEvent::class => [
|
||||
RejectRequestListener::class
|
||||
],
|
||||
ConfirmRoadAccessNeedEvent::class => [
|
||||
ConfirmRoadAccessNeedListener::class
|
||||
],
|
||||
ConfirmNoRoadAccessNeedEvent::class => [
|
||||
ConfirmNoRoadAccessNeedListener::class
|
||||
],
|
||||
ConfirmRoadAccessEditNeedEvent::class => [
|
||||
ConfirmRoadAccessEditNeedListener::class
|
||||
],
|
||||
ConfirmGuaranteeLetterNeedEvent::class => [
|
||||
ConfirmGuaranteeLetterNeedListener::class
|
||||
],
|
||||
SendDataToFMSEvent::class => [
|
||||
SendDataToFMSListener::class
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
34
app/Providers/HorizonServiceProvider.php
Normal file
34
app/Providers/HorizonServiceProvider.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Horizon\Horizon;
|
||||
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
||||
|
||||
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
// Horizon::routeSmsNotificationsTo('15556667777');
|
||||
// Horizon::routeMailNotificationsTo('example@example.com');
|
||||
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Horizon gate.
|
||||
*
|
||||
* This gate determines who can access Horizon in non-local environments.
|
||||
*/
|
||||
protected function gate(): void
|
||||
{
|
||||
Gate::define('viewHorizon', function ($user) {
|
||||
return $user->username == 'witel';
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class AccidentReceiptTableService
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final
|
||||
FROM `accidents`
|
||||
where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'"
|
||||
where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59"
|
||||
union
|
||||
SELECT
|
||||
province_fa,
|
||||
@@ -74,7 +74,7 @@ class AccidentReceiptTableService
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final
|
||||
FROM `accidents`
|
||||
where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'"
|
||||
where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59"
|
||||
GROUP BY province_id
|
||||
'
|
||||
);
|
||||
@@ -104,7 +104,7 @@ class AccidentReceiptTableService
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final
|
||||
FROM `accidents`
|
||||
where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" AND province_id ='.$request->province_id.'
|
||||
where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" AND province_id ='.$request->province_id.'
|
||||
union
|
||||
SELECT
|
||||
city_fa,
|
||||
@@ -121,7 +121,7 @@ class AccidentReceiptTableService
|
||||
SUM(CASE WHEN STATUS > 3 THEN `deposit_daghi_amount` END) AS vasel_shode_daghi,
|
||||
SUM(CASE WHEN STATUS > 3 THEN `final_amount` END) AS vasel_shode_final
|
||||
FROM `accidents`
|
||||
where created_at BETWEEN "'.$request->from_date.'" AND "'.$request->date_to.'" AND province_id ='.$request->province_id.'
|
||||
where created_at BETWEEN "'.$request->from_date.' 00:00:00" AND "'.$request->date_to.' 23:59:59" AND province_id ='.$request->province_id.'
|
||||
GROUP BY city_id
|
||||
'
|
||||
);
|
||||
|
||||
@@ -37,92 +37,103 @@ class OperatorService
|
||||
public function countryActivity(int $info_id): array
|
||||
{
|
||||
return DB::select("
|
||||
WITH combinations AS (
|
||||
SELECT
|
||||
axis_type_id,
|
||||
step
|
||||
FROM (
|
||||
SELECT 1 AS axis_type_id UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
) a
|
||||
CROSS JOIN (
|
||||
SELECT 1 AS step UNION ALL SELECT 2 UNION ALL SELECT 3
|
||||
) s
|
||||
),
|
||||
provinces AS (
|
||||
SELECT DISTINCT province_fa FROM safety_and_privacy WHERE info_id = ?
|
||||
),
|
||||
data AS (
|
||||
SELECT
|
||||
p.province_fa,
|
||||
c.axis_type_id,
|
||||
c.step,
|
||||
COUNT(sp.id) AS total
|
||||
FROM combinations c
|
||||
CROSS JOIN provinces p
|
||||
LEFT JOIN safety_and_privacy sp
|
||||
ON sp.axis_type_id = c.axis_type_id
|
||||
AND sp.step = c.step
|
||||
AND sp.province_fa = p.province_fa
|
||||
AND sp.info_id = ?
|
||||
GROUP BY p.province_fa, c.axis_type_id, c.step
|
||||
WITH base AS (
|
||||
SELECT
|
||||
p.id AS province_id,
|
||||
a.id AS axis_type_id,
|
||||
COALESCE(SUM(t.step = 1), 0) AS s1,
|
||||
COALESCE(SUM(t.step = 2), 0) AS s2,
|
||||
COALESCE(SUM(t.step = 3), 0) AS s3
|
||||
FROM provinces p
|
||||
JOIN axis_types a
|
||||
LEFT JOIN safety_and_privacy t
|
||||
ON t.province_id = p.id
|
||||
AND t.axis_type_id = a.id
|
||||
AND t.info_id = :infoId
|
||||
GROUP BY p.id, a.id
|
||||
)
|
||||
SELECT
|
||||
province_fa,
|
||||
SELECT
|
||||
province_id,
|
||||
axis_type_id,
|
||||
step,
|
||||
total,
|
||||
SUM(total) OVER (PARTITION BY province_fa) AS total_sum
|
||||
FROM data
|
||||
ORDER BY province_fa, axis_type_id, step
|
||||
", [$info_id, $info_id]);
|
||||
s1,
|
||||
s2,
|
||||
s3,
|
||||
COALESCE(
|
||||
SUM(s1 + s2 + s3)
|
||||
OVER (PARTITION BY province_id), 0
|
||||
) AS total_sum
|
||||
FROM base
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-1 AS province_id,
|
||||
axis_type_id,
|
||||
COALESCE(SUM(s1), 0) AS s1,
|
||||
COALESCE(SUM(s2), 0) AS s2,
|
||||
COALESCE(SUM(s3), 0) AS s3,
|
||||
COALESCE(
|
||||
SUM(SUM(s1 + s2 + s3)) OVER (), 0
|
||||
) AS total_sum
|
||||
FROM base
|
||||
GROUP BY axis_type_id
|
||||
|
||||
ORDER BY province_id, axis_type_id
|
||||
|
||||
", [
|
||||
'infoId' => $info_id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(int $info_id, int $province_id): array
|
||||
{
|
||||
return DB::select("
|
||||
WITH combinations AS (
|
||||
SELECT axis_type_id, step
|
||||
FROM (
|
||||
SELECT 1 AS axis_type_id UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
|
||||
) a
|
||||
CROSS JOIN (
|
||||
SELECT 1 AS step UNION ALL SELECT 2 UNION ALL SELECT 3
|
||||
) s
|
||||
),
|
||||
edarat AS (
|
||||
SELECT id AS edare_id, name_fa
|
||||
FROM edarate_shahri
|
||||
WHERE province_id = :provinceId
|
||||
),
|
||||
data AS (
|
||||
SELECT
|
||||
e.edare_id,
|
||||
c.axis_type_id,
|
||||
c.step,
|
||||
COUNT(sp.id) AS total
|
||||
FROM combinations c
|
||||
CROSS JOIN edarat e
|
||||
LEFT JOIN safety_and_privacy sp
|
||||
ON sp.axis_type_id = c.axis_type_id
|
||||
AND sp.step = c.step
|
||||
AND sp.city_id = e.edare_id
|
||||
AND sp.info_id = :infoId
|
||||
GROUP BY e.edare_id, c.axis_type_id, c.step
|
||||
)
|
||||
SELECT
|
||||
e.edare_id,
|
||||
e.name_fa AS edare_name,
|
||||
d.axis_type_id,
|
||||
d.step,
|
||||
d.total,
|
||||
SUM(d.total) OVER (PARTITION BY e.edare_id) AS total_sum
|
||||
FROM data d
|
||||
JOIN edarat e ON e.edare_id = d.edare_id
|
||||
ORDER BY e.edare_id, d.axis_type_id, d.step
|
||||
",[
|
||||
WITH edareh_data AS (
|
||||
SELECT
|
||||
e.id AS edareh_id,
|
||||
a.id AS axis_type_id,
|
||||
COALESCE(SUM(t.step = 1), 0) AS s1,
|
||||
COALESCE(SUM(t.step = 2), 0) AS s2,
|
||||
COALESCE(SUM(t.step = 3), 0) AS s3
|
||||
FROM edarate_shahri e
|
||||
JOIN axis_types a ON 1
|
||||
LEFT JOIN safety_and_privacy t
|
||||
ON e.id = t.edare_shahri_id
|
||||
AND t.axis_type_id = a.id
|
||||
AND t.info_id = :infoId
|
||||
WHERE e.province_id = :provinceId
|
||||
GROUP BY e.id, a.id
|
||||
)
|
||||
SELECT
|
||||
edareh_id,
|
||||
axis_type_id,
|
||||
s1,
|
||||
s2,
|
||||
s3,
|
||||
COALESCE(
|
||||
SUM(s1 + s2 + s3)
|
||||
OVER (PARTITION BY edareh_id), 0
|
||||
) AS total_sum
|
||||
FROM edareh_data
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
-1 AS edareh_id,
|
||||
axis_type_id,
|
||||
COALESCE(SUM(s1), 0) AS s1,
|
||||
COALESCE(SUM(s2), 0) AS s2,
|
||||
COALESCE(SUM(s3), 0) AS s3,
|
||||
COALESCE(
|
||||
SUM(SUM(s1 + s2 + s3)) OVER (), 0
|
||||
) AS total_sum
|
||||
FROM edareh_data
|
||||
GROUP BY axis_type_id
|
||||
|
||||
ORDER BY edareh_id , axis_type_id
|
||||
", [
|
||||
'provinceId' => $province_id,
|
||||
'infoId' => $info_id,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class SupervisorService
|
||||
'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'
|
||||
'supervisor_description', 'operator_description', 'finish_picture', 'evidence_picture', 'recognize_picture_second'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
71
app/Services/FMS/GetErrorRateService.php
Normal file
71
app/Services/FMS/GetErrorRateService.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\FMS;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GetErrorRateService
|
||||
{
|
||||
protected string $url;
|
||||
protected string $channelName;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected array $inputParameters;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('fms_web_services.Error_Rate.url');
|
||||
$this->password = config('fms_web_services.Error_Rate.password');
|
||||
$this->username = config('fms_web_services.Error_Rate.username');
|
||||
$this->channelName = 'fms_error_rate';
|
||||
}
|
||||
|
||||
public function setInputParameters(array $inputs): void
|
||||
{
|
||||
$this->inputParameters = $inputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function run(): array
|
||||
{
|
||||
try {
|
||||
return $this->sendRequest();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Log::channel($this->channelName)
|
||||
->error(get_class($this),
|
||||
[
|
||||
'message' => $e->getMessage(),
|
||||
]
|
||||
);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function sendRequest(): array
|
||||
{
|
||||
$inputData = $this->makeInputParameters();
|
||||
|
||||
return Http::withBody($inputData)
|
||||
->throw()
|
||||
->withoutVerifying()
|
||||
->post($this->url)
|
||||
->json();
|
||||
}
|
||||
|
||||
private function makeInputParameters(): string
|
||||
{
|
||||
$inputData = $this->inputParameters + array(
|
||||
"username" => $this->username,
|
||||
"password" => $this->password,
|
||||
"minStopDuration" => 1,
|
||||
);
|
||||
|
||||
return json_encode($inputData);
|
||||
}
|
||||
}
|
||||
11
bootstrap/cache/packages.php
vendored
11
bootstrap/cache/packages.php
vendored
@@ -28,6 +28,17 @@
|
||||
0 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
|
||||
),
|
||||
),
|
||||
'laravel/horizon' =>
|
||||
array (
|
||||
'aliases' =>
|
||||
array (
|
||||
'Horizon' => 'Laravel\\Horizon\\Horizon',
|
||||
),
|
||||
'providers' =>
|
||||
array (
|
||||
0 => 'Laravel\\Horizon\\HorizonServiceProvider',
|
||||
),
|
||||
),
|
||||
'laravel/pulse' =>
|
||||
array (
|
||||
'aliases' =>
|
||||
|
||||
84
bootstrap/cache/services.php
vendored
84
bootstrap/cache/services.php
vendored
@@ -26,28 +26,30 @@
|
||||
22 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
23 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider',
|
||||
24 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
|
||||
25 => 'Laravel\\Pulse\\PulseServiceProvider',
|
||||
26 => 'Laravel\\Sail\\SailServiceProvider',
|
||||
27 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||
28 => 'Laravel\\Telescope\\TelescopeServiceProvider',
|
||||
29 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||
30 => 'Laravel\\Ui\\UiServiceProvider',
|
||||
31 => 'Livewire\\LivewireServiceProvider',
|
||||
32 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||
33 => 'Carbon\\Laravel\\ServiceProvider',
|
||||
34 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||
35 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||
36 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
|
||||
37 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
25 => 'Laravel\\Horizon\\HorizonServiceProvider',
|
||||
26 => 'Laravel\\Pulse\\PulseServiceProvider',
|
||||
27 => 'Laravel\\Sail\\SailServiceProvider',
|
||||
28 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||
29 => 'Laravel\\Telescope\\TelescopeServiceProvider',
|
||||
30 => 'Laravel\\Tinker\\TinkerServiceProvider',
|
||||
31 => 'Laravel\\Ui\\UiServiceProvider',
|
||||
32 => 'Livewire\\LivewireServiceProvider',
|
||||
33 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||
34 => 'Carbon\\Laravel\\ServiceProvider',
|
||||
35 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||
36 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||
37 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
|
||||
38 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
39 => 'App\\Providers\\AppServiceProvider',
|
||||
40 => 'App\\Providers\\AuthServiceProvider',
|
||||
41 => 'App\\Providers\\EventServiceProvider',
|
||||
42 => 'App\\Providers\\RouteServiceProvider',
|
||||
43 => 'App\\Providers\\TelescopeServiceProvider',
|
||||
44 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
45 => 'App\\Providers\\DataTableServiceProvider',
|
||||
46 => 'App\\Providers\\FileServiceProvider',
|
||||
39 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
40 => 'App\\Providers\\AppServiceProvider',
|
||||
41 => 'App\\Providers\\AuthServiceProvider',
|
||||
42 => 'App\\Providers\\EventServiceProvider',
|
||||
43 => 'App\\Providers\\HorizonServiceProvider',
|
||||
44 => 'App\\Providers\\RouteServiceProvider',
|
||||
45 => 'App\\Providers\\TelescopeServiceProvider',
|
||||
46 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
47 => 'App\\Providers\\DataTableServiceProvider',
|
||||
48 => 'App\\Providers\\FileServiceProvider',
|
||||
),
|
||||
'eager' =>
|
||||
array (
|
||||
@@ -64,26 +66,28 @@
|
||||
10 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
11 => 'Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider',
|
||||
12 => 'KitLoong\\MigrationsGenerator\\MigrationsGeneratorServiceProvider',
|
||||
13 => 'Laravel\\Pulse\\PulseServiceProvider',
|
||||
14 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||
15 => 'Laravel\\Telescope\\TelescopeServiceProvider',
|
||||
16 => 'Laravel\\Ui\\UiServiceProvider',
|
||||
17 => 'Livewire\\LivewireServiceProvider',
|
||||
18 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||
19 => 'Carbon\\Laravel\\ServiceProvider',
|
||||
20 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||
21 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||
22 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
|
||||
23 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
13 => 'Laravel\\Horizon\\HorizonServiceProvider',
|
||||
14 => 'Laravel\\Pulse\\PulseServiceProvider',
|
||||
15 => 'Laravel\\Sanctum\\SanctumServiceProvider',
|
||||
16 => 'Laravel\\Telescope\\TelescopeServiceProvider',
|
||||
17 => 'Laravel\\Ui\\UiServiceProvider',
|
||||
18 => 'Livewire\\LivewireServiceProvider',
|
||||
19 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
|
||||
20 => 'Carbon\\Laravel\\ServiceProvider',
|
||||
21 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
|
||||
22 => 'Termwind\\Laravel\\TermwindServiceProvider',
|
||||
23 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
|
||||
24 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
25 => 'App\\Providers\\AppServiceProvider',
|
||||
26 => 'App\\Providers\\AuthServiceProvider',
|
||||
27 => 'App\\Providers\\EventServiceProvider',
|
||||
28 => 'App\\Providers\\RouteServiceProvider',
|
||||
29 => 'App\\Providers\\TelescopeServiceProvider',
|
||||
30 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
31 => 'App\\Providers\\DataTableServiceProvider',
|
||||
32 => 'App\\Providers\\FileServiceProvider',
|
||||
25 => 'Spatie\\Permission\\PermissionServiceProvider',
|
||||
26 => 'App\\Providers\\AppServiceProvider',
|
||||
27 => 'App\\Providers\\AuthServiceProvider',
|
||||
28 => 'App\\Providers\\EventServiceProvider',
|
||||
29 => 'App\\Providers\\HorizonServiceProvider',
|
||||
30 => 'App\\Providers\\RouteServiceProvider',
|
||||
31 => 'App\\Providers\\TelescopeServiceProvider',
|
||||
32 => 'Barryvdh\\Debugbar\\ServiceProvider',
|
||||
33 => 'App\\Providers\\DataTableServiceProvider',
|
||||
34 => 'App\\Providers\\FileServiceProvider',
|
||||
),
|
||||
'deferred' =>
|
||||
array (
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"hekmatinasser/verta": "^8.3",
|
||||
"laravel/framework": "^10.10",
|
||||
"laravel/horizon": "^5.33",
|
||||
"laravel/pulse": "^1.0@beta",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/telescope": "^4.17",
|
||||
|
||||
82
composer.lock
generated
82
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "bf9b86b55591e7c7df84cb1be8ea9db3",
|
||||
"content-hash": "379d6ba4ded00ca7079f26aa5b12e04e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "beberlei/assert",
|
||||
@@ -1949,6 +1949,86 @@
|
||||
},
|
||||
"time": "2024-01-30T16:25:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/horizon",
|
||||
"version": "v5.33.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/horizon.git",
|
||||
"reference": "aabcd425b34005182acc4c22aae48692684cb765"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/horizon/zipball/aabcd425b34005182acc4c22aae48692684cb765",
|
||||
"reference": "aabcd425b34005182acc4c22aae48692684cb765",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"ext-pcntl": "*",
|
||||
"ext-posix": "*",
|
||||
"illuminate/contracts": "^9.21|^10.0|^11.0|^12.0",
|
||||
"illuminate/queue": "^9.21|^10.0|^11.0|^12.0",
|
||||
"illuminate/support": "^9.21|^10.0|^11.0|^12.0",
|
||||
"nesbot/carbon": "^2.17|^3.0",
|
||||
"php": "^8.0",
|
||||
"ramsey/uuid": "^4.0",
|
||||
"symfony/console": "^6.0|^7.0",
|
||||
"symfony/error-handler": "^6.0|^7.0",
|
||||
"symfony/polyfill-php83": "^1.28",
|
||||
"symfony/process": "^6.0|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.0",
|
||||
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
|
||||
"phpstan/phpstan": "^1.10|^2.0",
|
||||
"phpunit/phpunit": "^9.0|^10.4|^11.5|^12.0",
|
||||
"predis/predis": "^1.1|^2.0|^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-redis": "Required to use the Redis PHP driver.",
|
||||
"predis/predis": "Required when not using the Redis PHP driver (^1.1|^2.0|^3.0)."
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Horizon": "Laravel\\Horizon\\Horizon"
|
||||
},
|
||||
"providers": [
|
||||
"Laravel\\Horizon\\HorizonServiceProvider"
|
||||
]
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "6.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Horizon\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "Dashboard and code-driven configuration for Laravel queues.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"queue"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/horizon/issues",
|
||||
"source": "https://github.com/laravel/horizon/tree/v5.33.3"
|
||||
},
|
||||
"time": "2025-08-11T14:55:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/prompts",
|
||||
"version": "v0.1.15",
|
||||
|
||||
@@ -177,6 +177,7 @@ return [
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\HorizonServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
Barryvdh\Debugbar\ServiceProvider::class,
|
||||
|
||||
@@ -6,4 +6,9 @@ return [
|
||||
'password' => env('FMS_VEHICLE_ACTIVITY_PASSWORD'),
|
||||
'username' => env('FMS_VEHICLE_ACTIVITY_USERNAME'),
|
||||
],
|
||||
'Error_Rate' => [
|
||||
'url' => env('FMS_ERROR_RATE_URL'),
|
||||
'password' => env('FMS_ERROR_RATE_PASSWORD'),
|
||||
'username' => env('FMS_ERROR_RATE_USERNAME'),
|
||||
],
|
||||
];
|
||||
236
config/horizon.php
Normal file
236
config/horizon.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Horizon Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the subdomain where Horizon will be accessible from. If this
|
||||
| setting is null, Horizon will reside under the same domain as the
|
||||
| application. Otherwise, this value will serve as the subdomain.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('HORIZON_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Horizon Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the URI path where Horizon will be accessible from. Feel free
|
||||
| to change this path to anything you like. Note that the URI will not
|
||||
| affect the paths of its internal API that aren't exposed to users.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('HORIZON_PATH', 'horizon'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Horizon Redis Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the Redis connection where Horizon will store the
|
||||
| meta information required for it to function. It includes the list
|
||||
| of supervisors, failed jobs, job metrics, and other information.
|
||||
|
|
||||
*/
|
||||
|
||||
'use' => 'default',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Horizon Redis Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This prefix will be used when storing all Horizon data in Redis. You
|
||||
| may modify the prefix when you are running multiple installations
|
||||
| of Horizon on the same server so that they don't have problems.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env(
|
||||
'HORIZON_PREFIX',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Horizon Route Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These middleware will get attached onto each Horizon route, giving you
|
||||
| the chance to add your own middleware to this list or change any of
|
||||
| the existing middleware. Or, you can simply stick with this list.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Wait Time Thresholds
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to configure when the LongWaitDetected event
|
||||
| will be fired. Every connection / queue combination may have its
|
||||
| own, unique threshold (in seconds) before this event is fired.
|
||||
|
|
||||
*/
|
||||
|
||||
'waits' => [
|
||||
'redis:default' => 60,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Job Trimming Times
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can configure for how long (in minutes) you desire Horizon to
|
||||
| persist the recent and failed jobs. Typically, recent jobs are kept
|
||||
| for one hour while all failed jobs are stored for an entire week.
|
||||
|
|
||||
*/
|
||||
|
||||
'trim' => [
|
||||
'recent' => 60,
|
||||
'pending' => 60,
|
||||
'completed' => 60,
|
||||
'recent_failed' => 10080,
|
||||
'failed' => 10080,
|
||||
'monitored' => 10080,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Silenced Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Silencing a job will instruct Horizon to not place the job in the list
|
||||
| of completed jobs within the Horizon dashboard. This setting may be
|
||||
| used to fully remove any noisy jobs from the completed jobs list.
|
||||
|
|
||||
*/
|
||||
|
||||
'silenced' => [
|
||||
// App\Jobs\ExampleJob::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Metrics
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can configure how many snapshots should be kept to display in
|
||||
| the metrics graph. This will get used in combination with Horizon's
|
||||
| `horizon:snapshot` schedule to define how long to retain metrics.
|
||||
|
|
||||
*/
|
||||
|
||||
'metrics' => [
|
||||
'trim_snapshots' => [
|
||||
'job' => 24,
|
||||
'queue' => 24,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Fast Termination
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this option is enabled, Horizon's "terminate" command will not
|
||||
| wait on all of the workers to terminate unless the --wait option
|
||||
| is provided. Fast termination can shorten deployment delay by
|
||||
| allowing a new instance of Horizon to start while the last
|
||||
| instance will continue to terminate each of its workers.
|
||||
|
|
||||
*/
|
||||
|
||||
'fast_termination' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Memory Limit (MB)
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value describes the maximum amount of memory the Horizon master
|
||||
| supervisor may consume before it is terminated and restarted. For
|
||||
| configuring these limits on your workers, see the next section.
|
||||
|
|
||||
*/
|
||||
|
||||
'memory_limit' => 64,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Worker Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the queue worker settings used by your application
|
||||
| in all environments. These supervisors and settings handle all your
|
||||
| queued jobs and will be provisioned by Horizon during deployment.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'supervisor-1' => [
|
||||
'connection' => 'redis',
|
||||
'queue' => ['harim'],
|
||||
'balance' => 'auto',
|
||||
'autoScalingStrategy' => 'time',
|
||||
'maxProcesses' => 1,
|
||||
'maxTime' => 0,
|
||||
'maxJobs' => 0,
|
||||
'memory' => 128,
|
||||
'tries' => 2,
|
||||
'timeout' => 60,
|
||||
'nice' => 0,
|
||||
'backoff' => 10,
|
||||
],
|
||||
'supervisor-2' => [
|
||||
'connection' => 'redis',
|
||||
'queue' => ['fms'],
|
||||
'balance' => 'auto',
|
||||
'autoScalingStrategy' => 'time',
|
||||
'maxProcesses' => 1,
|
||||
'maxTime' => 0,
|
||||
'maxJobs' => 0,
|
||||
'memory' => 128,
|
||||
'tries' => 2,
|
||||
'timeout' => 60,
|
||||
'nice' => 0,
|
||||
'backoff' => 10,
|
||||
],
|
||||
],
|
||||
|
||||
'environments' => [
|
||||
'production' => [
|
||||
'supervisor-1' => [
|
||||
'maxProcesses' => 10,
|
||||
'balanceMaxShift' => 1,
|
||||
'balanceCooldown' => 3,
|
||||
],
|
||||
'supervisor-2' => [
|
||||
'maxProcesses' => 10,
|
||||
'balanceMaxShift' => 1,
|
||||
'balanceCooldown' => 3,
|
||||
],
|
||||
],
|
||||
|
||||
'local' => [
|
||||
'supervisor-1' => [
|
||||
'maxProcesses' => 3,
|
||||
],
|
||||
'supervisor-2' => [
|
||||
'maxProcesses' => 3,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -129,6 +129,12 @@ return [
|
||||
'path' => storage_path('logs/nikarayan.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
|
||||
'fms_error_rate' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/fms/error_rate_service.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -13,35 +13,38 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('harims', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('panjare_vahed_id');
|
||||
$table->string('national_id');
|
||||
$table->string('phone_number');
|
||||
$table->foreignId('state_id')->constrained('harim_states');
|
||||
$table->string('state_name');
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('phone_number');
|
||||
$table->string('request_number');
|
||||
$table->date('request_date');
|
||||
$table->unsignedTinyInteger('province_id');
|
||||
$table->foreign('province_id')->references('id')->on('provinces');
|
||||
$table->string('province_name');
|
||||
$table->unsignedSmallInteger('city_id');
|
||||
$table->unsignedSmallInteger('city_id')->nullable();
|
||||
$table->foreign('city_id')->references('id')->on('cities');
|
||||
$table->string('city_name');
|
||||
$table->string('city_name')->nullable();
|
||||
$table->unsignedBigInteger('edareh_shahri_id');
|
||||
$table->foreign('edareh_shahri_id')->references('id')->on('edarate_shahri');
|
||||
$table->string('county');
|
||||
$table->string('division');
|
||||
$table->string('village');
|
||||
$table->integer('grand_area');
|
||||
$table->integer('plan_area');
|
||||
$table->string('requested_organization');
|
||||
$table->string('plan_group');
|
||||
$table->string('plan_title');
|
||||
$table->string('address');
|
||||
$table->string('file');
|
||||
$table->json('polygon');
|
||||
$table->boolean('need_road_access')->nullable();
|
||||
$table->boolean('is_file_good')->nullable();
|
||||
$table->boolean('is_possible')->nullable();
|
||||
$table->string('worksheet_id');
|
||||
$table->json('response_options')->nullable();
|
||||
$table->string('isic');
|
||||
$table->polygon('primary_area');
|
||||
$table->polygon('forbidden_area')->nullable();
|
||||
$table->polygon('final_area')->nullable();
|
||||
$table->polygon('final_plan')->nullable();
|
||||
$table->polygon('access_road')->nullable();
|
||||
$table->boolean('need_payment')->nullable();
|
||||
$table->string('payment_amount')->nullable();
|
||||
$table->boolean('need_access_road')->nullable();
|
||||
$table->boolean('access_road_allowed')->nullable();
|
||||
$table->string('lat')->nullable();
|
||||
$table->string('lng')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
||||
$table->id();
|
||||
$table->foreignId('previous_state_id')->constrained('harim_states');
|
||||
$table->string('previous_state_name');
|
||||
$table->foreignId('harim_id')->constrained('harims');
|
||||
$table->foreignId('harim_id')->constrained('harims')->cascadeOnDelete();
|
||||
$table->foreignId('action_id')->constrained('harim_actions');
|
||||
$table->string('action_name');
|
||||
$table->unsignedInteger('expert_id');
|
||||
|
||||
@@ -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::table('cities', function (Blueprint $table) {
|
||||
$table->geometry('geometry')->nullable();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('cities', function (Blueprint $table) {
|
||||
$table->dropColumn('geometry');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -226,6 +226,12 @@ Route::get('axis_reports', function (Request $request) {
|
||||
return view('version2.dashboard_pages.axis_reports');
|
||||
})->name('v2.axis_reports');
|
||||
|
||||
Route::get('receipt/send-to-insurance/{accident}', 'ReceiptController@sendToInsurance');
|
||||
Route::get('receipt/document-release/{accident}', 'ReceiptController@documentRelease');
|
||||
|
||||
Route::any('/receipt/{any?}', fn() => abort(404, 'not found'))
|
||||
->where('any', '.*');
|
||||
|
||||
Route::prefix('receipt')->group(function () {
|
||||
|
||||
Route::prefix('/report')->group(function () {
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshSampleController;
|
||||
use App\Http\Controllers\V3\Dashboard\Azmayesh\AzmayeshTypeController;
|
||||
use App\Http\Controllers\V3\Dashboard\Harim\GeneralManagerController;
|
||||
use App\Http\Controllers\V3\Dashboard\Harim\HarimOfficeController;
|
||||
use App\Http\Controllers\V3\Dashboard\Harim\PanjareVahedController;
|
||||
use App\Http\Controllers\V3\Dashboard\Harim\ProvinceOfficeController;
|
||||
use App\Http\Controllers\V3\Dashboard\Harim\TechnicalDeputyController;
|
||||
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
||||
@@ -26,6 +27,7 @@ use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReport\AccessRoad
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReport\ConstructionActivityController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\OperatorReport\UtilityPassingActivityController;
|
||||
use App\Http\Controllers\V3\Dashboard\SafetyAndPrivacy\SupervisorController;
|
||||
use App\Http\Controllers\V3\Dashboard\UserManagementController;
|
||||
use App\Http\Controllers\V3\FMSVehicleManagementController;
|
||||
use App\Http\Controllers\V3\Harim\DivarkeshiController;
|
||||
use App\Http\Controllers\V3\LogListManagementController;
|
||||
@@ -179,6 +181,7 @@ Route::prefix('cmms_machines')
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::get('/list', 'list')->name('list');
|
||||
Route::get('/search', 'search')->name('search');
|
||||
Route::get('/car_types', 'carTypes')->name('carTypes');
|
||||
});
|
||||
|
||||
Route::prefix('rahdaran')
|
||||
@@ -381,7 +384,7 @@ Route::prefix('safety_and_privacy')
|
||||
Route::get('operator/{safetyAndPrivacy}', 'show')->name('show');
|
||||
Route::delete('operator/{safetyAndPrivacy}', 'destroy')->name('destroy')->middleware('permission:delete-safety-and-privacy');
|
||||
Route::get('/deserialize/{safetyAndPrivacy}', 'deserialize')->name('deserialize');
|
||||
Route::post('operator/finish/{safetyAndPrivacy}', 'finish')->name('finish');
|
||||
Route::post('operator/finish/{safetyAndPrivacy}', 'finish')->middleware(['check-axis-type'])->name('finish');
|
||||
});
|
||||
|
||||
Route::prefix('supervisor')
|
||||
@@ -498,6 +501,7 @@ Route::prefix('missions')
|
||||
->controller(ControlUnitController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/no_process','noProcess')->name('noProcess');
|
||||
Route::post('/start/{mission}', 'start')->name('start');
|
||||
Route::post('/finish/{mission}', 'finish')->name('finish');
|
||||
});
|
||||
@@ -557,5 +561,37 @@ Route::prefix('harim')
|
||||
Route::post('/confirm_guarantee_letter_need/{harim}', 'confirmGuaranteeLetterNeed')->name('confirmGuaranteeLetterNeed');
|
||||
Route::get('/{harim}', 'show')->name('show');
|
||||
});
|
||||
Route::prefix('panjarevahed')
|
||||
->name('panjarevahed.')
|
||||
->controller(PanjarevahedController::class)
|
||||
->group(function () {
|
||||
Route::post('/get_access_road','getAccessRoad')->name('getAccessRoad');
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('user_management')
|
||||
->name('user_management.')
|
||||
->controller(UserManagementController::class)
|
||||
->group(function () {
|
||||
// Route::get('/', 'index')->name('index');
|
||||
Route::get('/index_user', 'indexUser')->name('indexUser');
|
||||
Route::get('/activity_report', 'activityReport')->name('activityReport');
|
||||
Route::get('/userActivityLogs', 'userActivityLogs')->name('userActivityLogs');
|
||||
Route::post('/change_confirmed_status', 'changeConfirmedStatus')->name('changeConfirmedStatus');
|
||||
Route::get('/give_permissions_to', 'givePermissionsTo')->name('givePermissionsTo');
|
||||
Route::get('/get_user_permissions', 'getUserPermissions')->name('getUserPermissions');
|
||||
Route::get('/get_user_summary_report', 'getUserSummaryReport')->name('getUserSummaryReport');
|
||||
Route::get('/print_group', 'printGroup')->name('printGroup');
|
||||
Route::get('/user_permission', 'userPermission')->name('userPermission');
|
||||
Route::get('/assign_permission', 'assignPermission')->name('assignPermission');
|
||||
Route::get('/show_all_roles', 'showAllRoles')->name('showAllRoles');
|
||||
Route::post('/change_user_enabeld','changeUserEnabeld')->name('changeUserEnabeld');
|
||||
Route::post('/','store')->name('store');
|
||||
Route::post('/create_role','createRole')->name('createRole');
|
||||
Route::post('/edit_role','editRole')->name('editRole');
|
||||
Route::get('/{user}', 'show')->name('show');
|
||||
Route::post('/{user}', 'update')->name('update');
|
||||
Route::delete('/{user}', 'destroy')->name('destroy');
|
||||
Route::post('/change_password/{user}', 'changePassword')->name('changePassword');
|
||||
Route::post('delete-role/{id}', 'deleteRole')->name('deleteRole');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user