Compare commits
15 Commits
feature/Fi
...
a8b99706d0
| Author | SHA1 | Date | |
|---|---|---|---|
| a8b99706d0 | |||
| 92cf157b29 | |||
| 5004b99d03 | |||
| a0ee7cccd3 | |||
| 25e2883e9c | |||
| 23dd62550d | |||
| e3b49ebbb3 | |||
| 7d7507411d | |||
| e0edcf6db2 | |||
| 893edea5a9 | |||
| 57d59b79b4 | |||
| 9f394abc3e | |||
|
|
08db103f26 | ||
| a5cf79cd1b | |||
|
|
6a1513a72f |
73
app/Exports/V3/Mission/Report/Machine/machineReport.php
Normal file
73
app/Exports/V3/Mission/Report/Machine/machineReport.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\Mission\Report\Machine;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithDrawings;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||
|
||||
class machineReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||
{
|
||||
public function __construct(private array $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{ $exportRows = [];
|
||||
|
||||
foreach ($this->data as $r) {
|
||||
$exportRows[] = [
|
||||
'city_name' => $r->c_name ?? '',
|
||||
'province_name' => $r->p_name ?? '',
|
||||
'missions' => $r->missions ?? 0,
|
||||
'distance' => (int) ($r->distance ?? 0),
|
||||
];
|
||||
}
|
||||
|
||||
return view('v3.Reports.Mission.Report.Machine.ActivityReport', [
|
||||
'rows' => $exportRows,
|
||||
]);
|
||||
}
|
||||
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function drawings(): array
|
||||
{
|
||||
$drawing = new Drawing();
|
||||
$drawing->setName('Logo');
|
||||
$drawing->setDescription('This is my logo');
|
||||
$drawing->setPath(public_path('/dist/logo.png'));
|
||||
$drawing->setWidth(50);
|
||||
$drawing->setHeight(50);
|
||||
$drawing->setOffsetX(5);
|
||||
$drawing->setOffsetY(5);
|
||||
$drawing->setCoordinates('A1');
|
||||
|
||||
$drawing2 = new Drawing();
|
||||
$drawing2->setName('Logo');
|
||||
$drawing2->setDescription('This is my logo');
|
||||
$drawing2->setPath(public_path('/dist/141icon.png'));
|
||||
$drawing2->setWidth(50);
|
||||
$drawing2->setHeight(50);
|
||||
$drawing2->setOffsetX(5);
|
||||
$drawing2->setOffsetY(5);
|
||||
$drawing2->setCoordinates('D1');
|
||||
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
@@ -29,9 +29,9 @@ class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
||||
$national = [
|
||||
'province_name' => $name,
|
||||
'total' => (int) ($r->total ?? 0),
|
||||
'khareg_mahdode' => (int) ($r->khareg_mahdode ?? 0),
|
||||
'gps' => (int) ($r->gps ?? 0),
|
||||
'durations' => (int) ($r->durations ?? 0),
|
||||
'khareg_mahdode' => (int) ($r->khareg_mahdode ?? 0),
|
||||
'bafarayand_saeti' => (int) ($r->far_h ?? 0),
|
||||
'bafarayand_rozaneh' => (int) ($r->far_d ?? 0),
|
||||
'bedon_bafarayand_saeti' => (int) ($r->un_far_h ?? 0),
|
||||
@@ -50,9 +50,9 @@ class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvent
|
||||
}
|
||||
|
||||
$grid[$pid]['total'] = (int) ($r->total ?? 0);
|
||||
$grid[$pid]['khareg_mahdode'] = ($r->khareg_mahdode ?? 0);
|
||||
$grid[$pid]['gps'] = (int) ($r->gps ?? 0);
|
||||
$grid[$pid]['durations'] = (int) ($r->durations ?? 0);
|
||||
$grid[$pid]['khareg_mahdode'] = ($r->khareg_mahdode ?? 0);
|
||||
$grid[$pid]['bafarayand_saeti'] = (int) ($r->far_h ?? 0);
|
||||
$grid[$pid]['bafarayand_rozaneh'] = (int) ($r->far_d ?? 0);
|
||||
$grid[$pid]['bedon_bafarayand_saeti'] = (int) ($r->un_far_h ?? 0);
|
||||
|
||||
@@ -30,9 +30,9 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEven
|
||||
$province = [
|
||||
'city_name' => $name,
|
||||
'total' => (int) ($r->total ?? 0),
|
||||
'khareg_mahdode' => (int) ($r->khareg_mahdode ?? 0),
|
||||
'gps' => (int) ($r->gps ?? 0),
|
||||
'durations' => (int) ($r->durations ?? 0),
|
||||
'khareg_mahdode' => (int) ($r->khareg_mahdode ?? 0),
|
||||
'bafarayand_saeti' => (int) ($r->far_h ?? 0),
|
||||
'bafarayand_rozaneh' => (int) ($r->far_d ?? 0),
|
||||
'bedon_bafarayand_saeti' => (int) ($r->un_far_h ?? 0),
|
||||
@@ -51,9 +51,9 @@ class ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEven
|
||||
}
|
||||
|
||||
$grid[$cid]['total'] = (int) ($r->total ?? 0);
|
||||
$grid[$cid]['khareg_mahdode'] = ($r->khareg_mahdode ?? 0);
|
||||
$grid[$cid]['gps'] = (int) ($r->gps ?? 0);
|
||||
$grid[$cid]['durations'] = (int) ($r->durations ?? 0);
|
||||
$grid[$cid]['khareg_mahdode'] = ($r->khareg_mahdode ?? 0);
|
||||
$grid[$cid]['bafarayand_saeti'] = (int) ($r->far_h ?? 0);
|
||||
$grid[$cid]['bafarayand_rozaneh'] = (int) ($r->far_d ?? 0);
|
||||
$grid[$cid]['bedon_bafarayand_saeti'] = (int) ($r->un_far_h ?? 0);
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\V3;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\CMMSMachine\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\CMMSMachine;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -48,4 +49,16 @@ class CMMSMachinesController extends Controller
|
||||
->distinct()
|
||||
->pluck('car_type');
|
||||
}
|
||||
|
||||
public function update(UpdateRequest $request , CMMSMachine $machine): JsonResponse
|
||||
{
|
||||
$machine->update([
|
||||
'status' => $request->status,
|
||||
'province_id' => $request->province_id,
|
||||
'city_id' => $request->city_id,
|
||||
'station_id' => $request->station_id,
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ class ControlUnitController extends Controller
|
||||
public function start(StartRequest $request, Mission $mission): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($mission, $request) {
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name,
|
||||
]);
|
||||
// $mission->histories()->create([
|
||||
// 'user_id' => auth()->user()->id,
|
||||
// 'previous_state_id' => $mission->state_id,
|
||||
// 'previous_state_name' => $mission->state_name,
|
||||
// ]);
|
||||
|
||||
$state = MissionStates::START_MISSION->value;
|
||||
$mission->update([
|
||||
@@ -57,11 +57,11 @@ class ControlUnitController extends Controller
|
||||
public function finish(FinishRequest $request, Mission $mission, GetErrorRateService $getErrorRateService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($mission, $getErrorRateService, $request) {
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name,
|
||||
]);
|
||||
// $mission->histories()->create([
|
||||
// 'user_id' => auth()->user()->id,
|
||||
// 'previous_state_id' => $mission->state_id,
|
||||
// 'previous_state_name' => $mission->state_name,
|
||||
// ]);
|
||||
|
||||
$state = MissionStates::END_MISSION->value;
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||
|
||||
use App\Exports\V3\Mission\Report\Machine\machineReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\Report\ReportMachineService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportMachineController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function activity(Request $request, ReportMachineService $reportMachineService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMachineService->activity($request),
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function excelActivity(Request $request, ReportMachineService $reportMachineService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMachineService->activity($request);
|
||||
$name = 'گزارش کل تردد یک ماشین '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new machineReport($data), $name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use App\Enums\MissionTypes;
|
||||
use App\Enums\MissionZones;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadPatrol\OperatorController;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\ChangeStateRequest;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\ContinueMissionRequest;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\NoProcessRequest;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\StoreRequest;
|
||||
@@ -273,4 +274,14 @@ class RequestPortalController extends Controller
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function changeState(ChangeStateRequest $request, Mission $mission): JsonResponse
|
||||
{
|
||||
$mission->update([
|
||||
'state' => $request->state_id,
|
||||
'state_name' => MissionStates::name($request->status_id),
|
||||
]);
|
||||
|
||||
return $this->successResponse($mission);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,11 @@ class TransportationUnitController extends Controller
|
||||
DB::transaction(function () use ($request, $mission) {
|
||||
$mission->rahdaran()->attach($request->driver, ['is_driver' => true]);
|
||||
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name,
|
||||
]);
|
||||
// $mission->histories()->create([
|
||||
// 'user_id' => auth()->user()->id,
|
||||
// 'previous_state_id' => $mission->state_id,
|
||||
// 'previous_state_name' => $mission->state_name,
|
||||
// ]);
|
||||
|
||||
$state = MissionStates::PENDING_CONFIRMATION->value;
|
||||
$machine = CMMSMachine::query()->find($request->machine_id);
|
||||
@@ -61,12 +61,12 @@ class TransportationUnitController extends Controller
|
||||
DB::transaction(function () use ($request, $mission) {
|
||||
$mission->rahdaran()->wherePivot('is_driver', '=', true)->detach();
|
||||
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
'previous_state_name' => $mission->state_name,
|
||||
'user_description' => $request->description,
|
||||
]);
|
||||
// $mission->histories()->create([
|
||||
// 'user_id' => auth()->user()->id,
|
||||
// 'previous_state_id' => $mission->state_id,
|
||||
// 'previous_state_name' => $mission->state_name,
|
||||
// 'user_description' => $request->description,
|
||||
// ]);
|
||||
|
||||
$state = MissionStates::REJECT_BY_TRANSPORTATION->value;
|
||||
|
||||
|
||||
@@ -63,19 +63,19 @@ class ViolationManagementController extends Controller
|
||||
'zone_fa' => MissionZones::name($zone),
|
||||
'type' => $type,
|
||||
'type_fa' => MissionTypes::name($type),
|
||||
'start_date' => $request->start_date,//
|
||||
'end_date' => $request->end_date,//
|
||||
'start_date' => $request->start_date,
|
||||
'end_date' => $request->end_date,
|
||||
'end_point' => $request->end_point,
|
||||
'category_id' => $request->category_id,
|
||||
'category_name' => MissionCategory::name($request->category_id),
|
||||
'start_time' => $request->start_date,//
|
||||
'finish_time' => $request->end_date,//
|
||||
'start_time' => $request->start_date,
|
||||
'finish_time' => $request->end_date,
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'explanation' => $request->explanation,
|
||||
'request_date' => now(),
|
||||
'machine_id' => $machine->id,//
|
||||
'machine_code' => $machine->machine_code,//
|
||||
'machine_id' => $machine->id,
|
||||
'machine_code' => $machine->machine_code,
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||
'km' => $violation->km ?? null,
|
||||
|
||||
@@ -42,7 +42,7 @@ class RoadMaintenanceStationController extends Controller
|
||||
{
|
||||
$stations = RahdariPoint::query()
|
||||
->where('city_id', $request->query('city_id'))
|
||||
->get();
|
||||
->get(['id', 'name']);
|
||||
|
||||
return $this->successResponse($stations);
|
||||
}
|
||||
|
||||
33
app/Http/Requests/V3/CMMSMachine/UpdateRequest.php
Normal file
33
app/Http/Requests/V3/CMMSMachine/UpdateRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\CMMSMachine;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
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, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status' => 'integer',
|
||||
'province_id' => 'integer|exists:provinces,id',
|
||||
'city_id' => 'integer|exists:cities,id',
|
||||
'station_id' => 'integer|exists:rahdari_points,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Requests\V3\Mission\ControlUnit;
|
||||
use App\Enums\MissionStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class FinishRequest extends FormRequest
|
||||
{
|
||||
@@ -28,4 +29,25 @@ class FinishRequest extends FormRequest
|
||||
'end_km' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function after(): array
|
||||
{
|
||||
return [
|
||||
function (Validator $validator) {
|
||||
$mission = $this->mission;
|
||||
if (strtotime($this->time) < strtotime($mission->start_time)) {
|
||||
$validator->errors()->add(
|
||||
'time',
|
||||
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||
);
|
||||
}
|
||||
if ($this->end_km < $mission->km) {
|
||||
$validator->errors()->add(
|
||||
'end_km',
|
||||
'کیلومتر پایان باید بزرگتر از کیلومتر شروع باشد.'
|
||||
);
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\RequestPortal;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ChangeStateRequest 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 [
|
||||
'state_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\Mission\Report;
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\MissionViolation;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ReportMachineService
|
||||
{
|
||||
public function activity(Request $request): array
|
||||
{
|
||||
$code = $request->machine_code;
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
m.city_name AS c.name,
|
||||
m.city_id AS c_id,
|
||||
m.province_name AS p_name,
|
||||
m.province_id AS p_id,
|
||||
COUNT(m.id) As missions,
|
||||
(SUM(m.end_km)-SUM(m.km)) AS distance
|
||||
|
||||
FROM missions m
|
||||
WHERE m.machine_code = :machineCode
|
||||
AND m.created_at >= :from
|
||||
AND m.created_at <= :to;
|
||||
";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from' => $from,
|
||||
'to' => $to,
|
||||
'machineCode' => $code,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class ReportTradodService
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->to_date ? Carbon::parse($request->to_date)->endOfDay() : today()->endOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
@@ -88,7 +88,7 @@ class ReportTradodService
|
||||
{
|
||||
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->to_date ? Carbon::parse($request->to_date)->endOfDay() : today()->endOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
|
||||
@@ -27,7 +27,7 @@ class ReportViolationService
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->to_date ? Carbon::parse($request->to_date)->endOfDay() : today()->endOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
@@ -81,7 +81,7 @@ class ReportViolationService
|
||||
{
|
||||
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->to_date ? Carbon::parse($request->to_date)->endOfDay() : today()->endOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
|
||||
@@ -61,9 +61,6 @@ function errorHandler(error) {
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("Error trace object");
|
||||
console.log("Error object:");
|
||||
console.log(error);
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "خطا",
|
||||
@@ -417,6 +414,43 @@ function getCityByProvince(province_id, dom_id, selected_id = 0) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getTollhouseByCity(city_id, dom_id, selected_id = 0) {$.ajax({
|
||||
url: `/api/v3/road_maintenance_station/search_by_city?city_id=${city_id}`,
|
||||
type: "GET",
|
||||
async: false,
|
||||
beforeSend: function () {
|
||||
$(`#${dom_id}`).empty();
|
||||
showLoaderScreen()
|
||||
},
|
||||
success: function (result) {
|
||||
$(`#${dom_id}`).append('<option value="0"></option>');
|
||||
cities = result.data;
|
||||
|
||||
for (let index = 0; index < cities.length; index++) {
|
||||
|
||||
$(`#${dom_id}`).append(
|
||||
`<option value=${cities[index].id}>${cities[index].name}</option>`
|
||||
);
|
||||
}
|
||||
|
||||
if (selected_id == null) {
|
||||
disableDOM(dom_id);
|
||||
} else if (selected_id != 0) {
|
||||
enableDOM(dom_id);
|
||||
$(`#${dom_id} option[value="${selected_id}"]`).attr("selected", true);
|
||||
}
|
||||
|
||||
hideLoaderScreen();
|
||||
},
|
||||
error: function (error) {
|
||||
errorHandler(error);
|
||||
hideLoaderScreen();
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function getCityOfficeByCity(city_id, dom_id, selected_id = 0) {
|
||||
$.ajax({
|
||||
url: "/public/contents/edarateShahri/" + city_id,
|
||||
@@ -923,7 +957,6 @@ $(document).on('click', '#report_btn', function () {
|
||||
var tr = $(this).closest("tr");
|
||||
var row = table.row(tr);
|
||||
$("#report_modal").modal('show');
|
||||
console.log(row.data().id);
|
||||
$("#selected_user_for_report").val(row.data().id);
|
||||
|
||||
})
|
||||
@@ -1003,7 +1036,6 @@ $(document).on('click', '#activity_report', function () {
|
||||
showLoaderScreen()
|
||||
},
|
||||
success: function (result) {
|
||||
console.log(result);
|
||||
|
||||
$("#activity_time").text(result.activity_time);
|
||||
$("#average_activity_time").text(result.average_activity_time);
|
||||
@@ -1042,9 +1074,6 @@ $(document).on('click', '.permission-control', function () {
|
||||
modal.find('.permission-label').removeClass('text-muted')
|
||||
modal.find('.all-permission-by-type').prop('checked', false)
|
||||
modal.find('#user_id').val(row.data().id)
|
||||
|
||||
console.log(row.data().province_id);
|
||||
console.log(row.data().edarate_shahri_id);
|
||||
modal.find('.permission-input').each((index, element) => {
|
||||
if ($(element).data('needProvince') == 1) {
|
||||
if (row.data().province_id == null) {
|
||||
@@ -1625,7 +1654,6 @@ $("table").on("click", "tbody tr", function () {
|
||||
|
||||
|
||||
$('#user_data_table').on('change', ".user-finder-all", function () {
|
||||
console.log(checkedItemsId);
|
||||
|
||||
var thiz = $(this);
|
||||
if (thiz.is(':checked')) {
|
||||
@@ -1642,7 +1670,6 @@ $('#user_data_table').on('change', ".user-finder-all", function () {
|
||||
});
|
||||
|
||||
$('#user_data_table').on('change', ".user-finder", function () {
|
||||
console.log(checkedItemsId);
|
||||
|
||||
const checkedItemId = $(this).data("idUser");
|
||||
|
||||
@@ -2104,7 +2131,6 @@ $("#edit_province_office").change(function () {
|
||||
|
||||
|
||||
$("#edit_city_office").change(function () {
|
||||
console.log("this is ok");
|
||||
setUserName("edit");
|
||||
})
|
||||
|
||||
@@ -2386,6 +2412,19 @@ $("#add_province_office").change(function () {
|
||||
setUserName();
|
||||
})
|
||||
|
||||
$("#add_simple_city").change(function () {
|
||||
|
||||
if ($("#add_simple_city").val() == -1) {
|
||||
|
||||
disableDOM("add_simple_tollhouse")
|
||||
$("#add_simple_tollhouse").empty();
|
||||
} else {
|
||||
|
||||
enableDOM("add_simple_tollhouse")
|
||||
getTollhouseByCity($("#add_simple_city").val(), "add_simple_tollhouse")
|
||||
}
|
||||
})
|
||||
|
||||
// $("#edit_city").change(function () {
|
||||
|
||||
// if ($(this).val() == 0) {
|
||||
@@ -2396,15 +2435,6 @@ $("#add_province_office").change(function () {
|
||||
// setUserName("edit");
|
||||
// })
|
||||
|
||||
// $("#add_simple_city").change(function () {
|
||||
|
||||
// if ($(this).val() == 0) {
|
||||
// $("#add_simple_city_office").empty();
|
||||
// } else {
|
||||
// getCityOfficeByCity($(this).val(), "add_simple_city_office")
|
||||
// }
|
||||
// setUserName();
|
||||
// })
|
||||
|
||||
// $("#add_city").change(function () {
|
||||
|
||||
@@ -2581,6 +2611,9 @@ $('#add_simple_user_show_modal').on('click', function () {
|
||||
enableDOM("add_simple_city")
|
||||
$("#add_simple_city").empty();
|
||||
$("#add_simple_city").append('<option value="0" selected disabled>ابتدا استان را انتخاب کنید</option>');
|
||||
enableDOM("add_simple_tollhouse")
|
||||
$("#add_simple_tollhouse").empty();
|
||||
$("#add_simple_tollhouse").append('<option value="0" selected disabled>ابتدا شهر را انتخاب کنید</option>');
|
||||
enableDOM("add_simple_city_office")
|
||||
$("#add_simple_city_office").empty();
|
||||
$("#add_simple_city_office").append('<option value="0" selected disabled></option>');
|
||||
@@ -2594,8 +2627,10 @@ $("#add_simple_province").change(function () {
|
||||
|
||||
disableDOM("add_simple_city")
|
||||
disableDOM("add_simple_city_office")
|
||||
disableDOM("add_simple_tollhouse")
|
||||
$("#add_simple_city").empty();
|
||||
$("#add_simple_city_office").empty();
|
||||
$("#add_simple_tollhouse").empty();
|
||||
|
||||
} else {
|
||||
if ($("#add_simple_province_office").val() == 0) {
|
||||
@@ -2622,8 +2657,10 @@ $("#add_simple_province_office").change(function () {
|
||||
|
||||
disableDOM("add_simple_city")
|
||||
disableDOM("add_simple_city_office")
|
||||
disableDOM("add_simple_tollhouse")
|
||||
$("#add_simple_city").empty();
|
||||
$("#add_simple_city_office").empty();
|
||||
$("#add_simple_tollhouse").empty();
|
||||
|
||||
} else {
|
||||
if ($("#add_simple_province").val() == 0 || $("#add_simple_province").val() == -1) {
|
||||
@@ -2657,6 +2694,7 @@ $("#add_simple_submit_form").on("click", function () {
|
||||
var edarate_shahri_id = $("#add_simple_city_office").children("option:selected").val();
|
||||
var national_code = $("#add_simple_national_code").val();
|
||||
var city_id = $("#add_simple_city").children("option:selected").val();
|
||||
var tollhouse_id = $("#add_simple_tollhouse").children("option:selected").val();
|
||||
|
||||
|
||||
if (edarate_ostani_id <= 0 && edarate_shahri_id <= 0) {
|
||||
@@ -2695,6 +2733,12 @@ $("#add_simple_submit_form").on("click", function () {
|
||||
} else {
|
||||
$("#add_simple_city").removeClass("validity-checker");
|
||||
}
|
||||
if (tollhouse_id == 0) {
|
||||
$("#add_simple_tollhouse").addClass("validity-checker");
|
||||
form_validation_status = false;
|
||||
} else {
|
||||
$("#add_simple_tollhouse").removeClass("validity-checker");
|
||||
}
|
||||
|
||||
if (province_id < 0) {
|
||||
$("#add_simple_province").addClass("validity-checker");
|
||||
@@ -2734,6 +2778,10 @@ $("#add_simple_submit_form").on("click", function () {
|
||||
formData.append("city_id", city_id);
|
||||
}
|
||||
|
||||
if (tollhouse_id != undefined) {
|
||||
formData.append("station_id", tollhouse_id);
|
||||
}
|
||||
|
||||
formData.append("password_confirmation", repass);
|
||||
if (edarate_ostani_id != 0) {
|
||||
formData.append("edarate_ostani_id", edarate_ostani_id);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>گزارش کل تردد های یک ماشین </title>
|
||||
|
||||
<style>
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body dir="rtl" style="text-align: center;">
|
||||
@php
|
||||
// show a dot if key missing or value is 0/empty
|
||||
function cell($row, $key) {
|
||||
return array_key_exists($key, $row) ? ($row[$key] ?: '0') : '0';
|
||||
}
|
||||
@endphp
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="4"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;font-size: 13px;">
|
||||
گزارش ماشین های ماموریت رفته
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
استان
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
شهر
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
تعداد ماموریت </th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
جمع کارکرد
|
||||
</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($rows as $item)
|
||||
<tr>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['missions'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['distance'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -93,9 +93,9 @@
|
||||
<tr>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['province_name'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['total'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['khareg_mahdode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['gps'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['durations'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['khareg_mahdode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_saeti'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_rozaneh'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_saeti'] ?? '-' }}</td>
|
||||
|
||||
@@ -93,9 +93,9 @@
|
||||
<tr>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['city_name'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['total'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['khareg_mahdode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['gps'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['durations'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['khareg_mahdode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_saeti'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bafarayand_rozaneh'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_saeti'] ?? '-' }}</td>
|
||||
|
||||
@@ -675,6 +675,11 @@
|
||||
id="add_simple_city_office">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label>راهدارخانه</label>
|
||||
<select class="form-control tollhouse" name="add_simple_tollhouse" id="add_simple_tollhouse">
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label> نام کاربری</label>
|
||||
<span style="color: crimson">*</span>
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Http\Controllers\V3\Dashboard\Harim\TechnicalDeputyController;
|
||||
use App\Http\Controllers\V3\Dashboard\ItemsManagementController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\ControlUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\DetailController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportMachineController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportTradodController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportViolationController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
||||
@@ -185,6 +186,7 @@ Route::prefix('cmms_machines')
|
||||
Route::get('/list', 'list')->name('list');
|
||||
Route::get('/search', 'search')->name('search');
|
||||
Route::get('/car_types', 'carTypes')->name('carTypes');
|
||||
Route::post('/{machine}', 'update')->name('update')->middleware('permission:update-machine');
|
||||
});
|
||||
|
||||
Route::prefix('rahdaran')
|
||||
@@ -497,6 +499,7 @@ Route::prefix('missions')
|
||||
Route::get('/{mission}', 'show')->name('show');
|
||||
Route::post('/{mission}', 'update')->name('update');
|
||||
Route::delete('/{mission}', 'destroy')->name('destroy');
|
||||
Route::post('/change_state/{mission}', 'changeState')->name('changeState');
|
||||
});
|
||||
Route::name('transportationUnit.')
|
||||
->prefix('transportation_unit')
|
||||
@@ -538,7 +541,7 @@ Route::prefix('missions')
|
||||
});
|
||||
Route::prefix('report_violation')
|
||||
->name('reportsViolation.')
|
||||
->middleware(['permission:mission-report-province|permission:mission-report-country'])
|
||||
->middleware(['permission:mission-report-province|mission-report-country'])
|
||||
->controller(ReportViolationController::class)
|
||||
->group(function () {
|
||||
Route::get('/country_activity', 'countryActivity')->name('countryActivity');
|
||||
@@ -548,7 +551,7 @@ Route::prefix('missions')
|
||||
});
|
||||
Route::prefix('report_taradod')
|
||||
->name('reportsTaradod.')
|
||||
->middleware(['permission:mission-report-province|permission:mission-report-country'])
|
||||
->middleware(['permission:mission-report-province|mission-report-country'])
|
||||
->controller(ReportTradodController::class)
|
||||
->group(function () {
|
||||
Route::get('/country_activity', 'countryActivity')->name('countryActivity');
|
||||
@@ -556,6 +559,14 @@ Route::prefix('missions')
|
||||
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||
});
|
||||
Route::prefix('report_machine')
|
||||
->name('reportsMachine.')
|
||||
->middleware(['permission:mission-report-province|mission-report-country'])
|
||||
->controller(ReportMachineController::class)
|
||||
->group(function () {
|
||||
Route::get('/activity', 'activity')->name('Activity');
|
||||
Route::get('/excel_activity', 'excelActivity')->name('ProvinceActivity');
|
||||
});
|
||||
});
|
||||
|
||||
Route::prefix('harim')
|
||||
|
||||
Reference in New Issue
Block a user