fix code and use pint for mission in some folder
This commit is contained in:
@@ -10,9 +10,11 @@ use Maatwebsite\Excel\Concerns\WithEvents;
|
|||||||
use Maatwebsite\Excel\Events\AfterSheet;
|
use Maatwebsite\Excel\Events\AfterSheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
|
||||||
class CountryReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
{
|
{
|
||||||
public function __construct(private array $data){}
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function view(): View
|
public function view(): View
|
||||||
{
|
{
|
||||||
@@ -20,32 +22,34 @@ class CountryReport implements FromView, WithEvents, ShouldAutoSize, WithDrawing
|
|||||||
$national = null;
|
$national = null;
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
foreach ($this->data as $r) {
|
||||||
$pid = (int) $r->province_id;
|
$pid = (int) $r->province_id;
|
||||||
$name = $r->province_name;
|
$name = $r->province_name;
|
||||||
|
|
||||||
if ($pid === -1) {
|
if ($pid === -1) {
|
||||||
$national = [
|
$national = [
|
||||||
'province_name' => $name,
|
'province_name' => $name,
|
||||||
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
||||||
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
||||||
];
|
];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! isset($grid[$pid])) {
|
||||||
if (!isset($grid[$pid])) {
|
|
||||||
$grid[$pid] = [
|
$grid[$pid] = [
|
||||||
'province_name' => $name,
|
'province_name' => $name,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$grid[$pid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
$grid[$pid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
||||||
$grid[$pid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
$grid[$pid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$exportRows = [];
|
$exportRows = [];
|
||||||
if ($national) $exportRows[] = $national;
|
if ($national) {
|
||||||
|
$exportRows[] = $national;
|
||||||
|
}
|
||||||
foreach ($grid as $row) {
|
foreach ($grid as $row) {
|
||||||
$exportRows[] = $row;
|
$exportRows[] = $row;
|
||||||
}
|
}
|
||||||
@@ -85,6 +89,7 @@ class CountryReport implements FromView, WithEvents, ShouldAutoSize, WithDrawing
|
|||||||
$drawing2->setOffsetX(5);
|
$drawing2->setOffsetX(5);
|
||||||
$drawing2->setOffsetY(5);
|
$drawing2->setOffsetY(5);
|
||||||
$drawing2->setCoordinates('C1');
|
$drawing2->setCoordinates('C1');
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
return [$drawing, $drawing2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Exports\V3\Mission\Report;
|
namespace App\Exports\V3\Mission\Report;
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Maatwebsite\Excel\Concerns\FromView;
|
use Maatwebsite\Excel\Concerns\FromView;
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
@@ -12,9 +11,11 @@ use Maatwebsite\Excel\Events\AfterSheet;
|
|||||||
use PhpOffice\PhpSpreadsheet\Exception;
|
use PhpOffice\PhpSpreadsheet\Exception;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
|
||||||
|
|
||||||
class ProvinceReport implements FromView, WithEvents, ShouldAutoSize, WithDrawings
|
class ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||||
{
|
{
|
||||||
public function __construct(private array $data){}
|
public function __construct(private array $data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public function view(): View
|
public function view(): View
|
||||||
{
|
{
|
||||||
@@ -22,37 +23,38 @@ class ProvinceReport implements FromView, WithEvents, ShouldAutoSize, WithDrawin
|
|||||||
$province = null;
|
$province = null;
|
||||||
|
|
||||||
foreach ($this->data as $r) {
|
foreach ($this->data as $r) {
|
||||||
$cid = (int) $r->city_id;
|
$cid = (int) $r->city_id;
|
||||||
$name = $r->city_name;
|
$name = $r->city_name;
|
||||||
|
|
||||||
if ($cid === -1) {
|
if ($cid === -1) {
|
||||||
$province = [
|
$province = [
|
||||||
'city_name' => $name,
|
'city_name' => $name,
|
||||||
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
'no_mission_count' => (int) ($r->no_mission_count ?? 0),
|
||||||
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
'out_of_area_count' => (int) ($r->out_of_area_count ?? 0),
|
||||||
];
|
];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! isset($grid[$cid])) {
|
||||||
if (!isset($grid[$cid])) {
|
|
||||||
$grid[$cid] = [
|
$grid[$cid] = [
|
||||||
'city_name' => $name,
|
'city_name' => $name,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$grid[$cid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
$grid[$cid]['no_mission_count'] = (int) ($r->no_mission_count ?? 0);
|
||||||
$grid[$cid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
$grid[$cid]['out_of_area_count'] = (int) ($r->out_of_area_count ?? 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$exportRows = [];
|
$exportRows = [];
|
||||||
if ($province) $exportRows[] = $province;
|
if ($province) {
|
||||||
|
$exportRows[] = $province;
|
||||||
|
}
|
||||||
foreach ($grid as $row) {
|
foreach ($grid as $row) {
|
||||||
$exportRows[] = $row;
|
$exportRows[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return view('v3.Reports.Mission.Report.ProvinceActivityReport', [
|
return view('v3.Reports.Mission.Report.ProvinceActivityReport', [
|
||||||
'rows' => $exportRows,
|
'rows' => $exportRows,
|
||||||
]);
|
]);
|
||||||
@@ -61,7 +63,7 @@ class ProvinceReport implements FromView, WithEvents, ShouldAutoSize, WithDrawin
|
|||||||
public function registerEvents(): array
|
public function registerEvents(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
AfterSheet::class => function (AfterSheet $event) {
|
AfterSheet::class => function (AfterSheet $event) {
|
||||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -91,6 +93,7 @@ class ProvinceReport implements FromView, WithEvents, ShouldAutoSize, WithDrawin
|
|||||||
$drawing2->setOffsetX(5);
|
$drawing2->setOffsetX(5);
|
||||||
$drawing2->setOffsetY(5);
|
$drawing2->setOffsetY(5);
|
||||||
$drawing2->setCoordinates('C1');
|
$drawing2->setCoordinates('C1');
|
||||||
|
|
||||||
return [$drawing, $drawing2];
|
return [$drawing, $drawing2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Services\Cartables\Mission;
|
namespace App\Services\Cartables\Mission;
|
||||||
|
|
||||||
|
|
||||||
use App\Enums\MissionStates;
|
use App\Enums\MissionStates;
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Traits\ApiResponse;
|
use App\Http\Traits\ApiResponse;
|
||||||
@@ -19,16 +18,14 @@ class ControlUnitService
|
|||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$query = Mission::query()->whereIn('state_id', [
|
$query = Mission::query()->whereIn('state_id', [
|
||||||
MissionStates::PENDING_CONFIRMATION->value, MissionStates::START_MISSION->value
|
MissionStates::PENDING_CONFIRMATION->value, MissionStates::START_MISSION->value,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($user->hasPermissionTo('manage-control-unit-station')) {
|
if ($user->hasPermissionTo('manage-control-unit-station')) {
|
||||||
$query->where('station_id', '=', $user->station_id);
|
$query->where('station_id', '=', $user->station_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-control-unit-city')) {
|
||||||
elseif ($user->hasPermissionTo('manage-control-unit-city')) {
|
|
||||||
$query->where('city_id', '=', $user->city_id);
|
$query->where('city_id', '=', $user->city_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-control-unit-province')) {
|
||||||
elseif ($user->hasPermissionTo('manage-control-unit-province')) {
|
|
||||||
$query->where('province_id', '=', $user->province_id);
|
$query->where('province_id', '=', $user->province_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,8 +38,8 @@ class ControlUnitService
|
|||||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name'
|
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,9 @@ class DailyMoveMachineService
|
|||||||
|
|
||||||
if ($user->hasPermissionTo('manage-violation-station')) {
|
if ($user->hasPermissionTo('manage-violation-station')) {
|
||||||
$query->whereRelation('machine', 'station_id', '=', $user->station_id);
|
$query->whereRelation('machine', 'station_id', '=', $user->station_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-violation-city')) {
|
||||||
elseif ($user->hasPermissionTo('manage-violation-city')) {
|
|
||||||
$query->whereRelation('machine', 'city_id', '=', $user->city_id);
|
$query->whereRelation('machine', 'city_id', '=', $user->city_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-violation-province')) {
|
||||||
elseif ($user->hasPermissionTo('manage-violation-province')) {
|
|
||||||
$query->whereRelation('machine', 'province_id', '=', $user->province_id);
|
$query->whereRelation('machine', 'province_id', '=', $user->province_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Services\Cartables\Mission;
|
namespace App\Services\Cartables\Mission;
|
||||||
|
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Models\Mission;
|
|
||||||
use App\Models\MissionViolation;
|
use App\Models\MissionViolation;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -15,7 +14,7 @@ class ReportService
|
|||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
$query =MissionViolation::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
$query = MissionViolation::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||||
|
|
||||||
return DataTableFacade::run(
|
return DataTableFacade::run(
|
||||||
$query,
|
$query,
|
||||||
@@ -28,67 +27,68 @@ class ReportService
|
|||||||
public function countryActivity(Request $request): array
|
public function countryActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
$to = Carbon::parse($request->to_date)->endOfDay()?? today()->endOfDay();
|
$to = Carbon::parse($request->to_date)->endOfDay() ?? today()->endOfDay();
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
WITH r AS (
|
WITH r AS (
|
||||||
SELECT
|
SELECT
|
||||||
p.id AS province_id,
|
p.id AS province_id,
|
||||||
p.name_fa AS province_name,
|
p.name_fa AS province_name,
|
||||||
|
|
||||||
COUNT(DISTINCT CASE
|
COUNT(DISTINCT mv.id) AS no_mission_count,
|
||||||
WHEN mv.type = 1
|
COUNT(DISTINCT m.id) AS out_of_area_count
|
||||||
AND mv.created_at >= :from_mv AND mv.created_at <= :to_mv
|
|
||||||
THEN mv.id
|
|
||||||
END) AS no_mission_count,
|
|
||||||
|
|
||||||
COUNT(DISTINCT CASE
|
|
||||||
WHEN m.mission_duration != m.in_area_duration
|
|
||||||
AND m.created_at >= :from_m AND m.created_at <= :to_m
|
|
||||||
THEN m.id
|
|
||||||
END) AS out_of_area_count
|
|
||||||
|
|
||||||
FROM provinces p
|
FROM provinces p
|
||||||
|
|
||||||
LEFT JOIN cmms_machines cm
|
LEFT JOIN cmms_machines cm
|
||||||
ON cm.province_id = p.id
|
ON cm.province_id = p.id
|
||||||
|
|
||||||
LEFT JOIN mission_violations mv
|
LEFT JOIN mission_violations mv
|
||||||
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
||||||
|
AND mv.type = 1
|
||||||
|
AND mv.created_at >= :from_mv
|
||||||
|
AND mv.created_at <= :to_mv
|
||||||
|
|
||||||
LEFT JOIN missions m
|
LEFT JOIN missions m
|
||||||
ON m.province_id = p.id
|
ON m.province_id = p.id
|
||||||
|
AND m.mission_duration != m.in_area_duration
|
||||||
|
AND m.created_at >= :from_m
|
||||||
|
AND m.created_at <= :to_m
|
||||||
|
|
||||||
GROUP BY p.id, p.name_fa
|
GROUP BY p.id, p.name_fa
|
||||||
)
|
)
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
-1 AS province_id,
|
-1 AS province_id,
|
||||||
'کل کشور' AS province_name,
|
'کل کشور' AS province_name,
|
||||||
SUM(no_mission_count) AS no_mission_count,
|
SUM(no_mission_count) AS no_mission_count,
|
||||||
SUM(out_of_area_count) AS out_of_area_count
|
SUM(out_of_area_count) AS out_of_area_count
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
province_id, province_name, no_mission_count, out_of_area_count
|
province_id, province_name, no_mission_count, out_of_area_count
|
||||||
FROM r
|
FROM r
|
||||||
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
CASE WHEN province_name = 'کل کشور' THEN 0 ELSE 1 END,
|
CASE WHEN province_id = -1 THEN 0 ELSE 1 END,
|
||||||
province_name
|
province_name
|
||||||
";
|
";
|
||||||
|
|
||||||
return DB::select($sql, [
|
return DB::select($sql, [
|
||||||
'from_mv' => $from,
|
'from_mv' => $from,
|
||||||
'to_mv' => $to,
|
'to_mv' => $to,
|
||||||
'from_m' => $from,
|
'from_m' => $from,
|
||||||
'to_m' => $to,
|
'to_m' => $to,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provinceActivity(Request $request): array
|
public function provinceActivity(Request $request): array
|
||||||
{
|
{
|
||||||
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||||
$from = $request->from_date ?? today()->startOfDay();
|
$from = $request->from_date ?? today()->startOfDay();
|
||||||
$to = Carbon::parse($request->to_date)->endOfDay() ?? today()->endOfDay();
|
$to = Carbon::parse($request->to_date)->endOfDay() ?? today()->endOfDay();
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
WITH r AS (
|
WITH r AS (
|
||||||
@@ -96,31 +96,26 @@ class ReportService
|
|||||||
c.id AS city_id,
|
c.id AS city_id,
|
||||||
c.name_fa AS city_name,
|
c.name_fa AS city_name,
|
||||||
|
|
||||||
COUNT(DISTINCT CASE
|
COUNT(DISTINCT mv.id) AS no_mission_count,
|
||||||
WHEN mv.type = 1
|
COUNT(DISTINCT m.id) AS out_of_area_count
|
||||||
AND mv.created_at >= :from_mv AND mv.created_at <= :to_mv
|
|
||||||
THEN mv.id
|
|
||||||
END) AS no_mission_count,
|
|
||||||
|
|
||||||
COUNT(DISTINCT CASE
|
|
||||||
WHEN m.mission_duration != m.in_area_duration
|
|
||||||
AND m.created_at >= :from_m AND m.created_at <= :to_m
|
|
||||||
THEN m.id
|
|
||||||
END) AS out_of_area_count
|
|
||||||
|
|
||||||
FROM cities c
|
FROM cities c
|
||||||
|
|
||||||
LEFT JOIN cmms_machines cm
|
LEFT JOIN cmms_machines cm
|
||||||
ON cm.city_id = c.id
|
ON cm.city_id = c.id
|
||||||
|
|
||||||
LEFT JOIN mission_violations mv
|
LEFT JOIN mission_violations mv
|
||||||
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
ON TRIM(cm.machine_code) = TRIM(mv.machine_code)
|
||||||
|
AND mv.type = 1
|
||||||
|
AND mv.created_at >= :from_mv
|
||||||
|
AND mv.created_at <= :to_mv
|
||||||
|
|
||||||
LEFT JOIN missions m
|
LEFT JOIN missions m
|
||||||
ON m.city_id = c.id
|
ON m.city_id = c.id
|
||||||
|
AND m.mission_duration != m.in_area_duration
|
||||||
|
AND m.created_at >= :from_m
|
||||||
|
AND m.created_at <= :to_m
|
||||||
|
|
||||||
WHERE c.province_id = :province_id
|
WHERE c.province_id = :province_id
|
||||||
|
|
||||||
GROUP BY c.id, c.name_fa
|
GROUP BY c.id, c.name_fa
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -145,9 +140,9 @@ class ReportService
|
|||||||
return DB::select($sql, [
|
return DB::select($sql, [
|
||||||
'province_id' => $provinceId,
|
'province_id' => $provinceId,
|
||||||
'from_mv' => $from,
|
'from_mv' => $from,
|
||||||
'to_mv' => $to,
|
'to_mv' => $to,
|
||||||
'from_m' => $from,
|
'from_m' => $from,
|
||||||
'to_m' => $to,
|
'to_m' => $to,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Services\Cartables\Mission;
|
namespace App\Services\Cartables\Mission;
|
||||||
|
|
||||||
|
|
||||||
use App\Facades\DataTable\DataTableFacade;
|
use App\Facades\DataTable\DataTableFacade;
|
||||||
use App\Http\Traits\ApiResponse;
|
use App\Http\Traits\ApiResponse;
|
||||||
use App\Models\Mission;
|
use App\Models\Mission;
|
||||||
@@ -19,11 +18,9 @@ class RequestPortalService
|
|||||||
|
|
||||||
if ($user->hasPermissionTo('manage-request-portal-station')) {
|
if ($user->hasPermissionTo('manage-request-portal-station')) {
|
||||||
$query->where('station_id', '=', $user->station_id);
|
$query->where('station_id', '=', $user->station_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-request-portal-city')) {
|
||||||
elseif ($user->hasPermissionTo('manage-request-portal-city')) {
|
|
||||||
$query->where('city_id', '=', $user->city_id);
|
$query->where('city_id', '=', $user->city_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-request-portal-province')) {
|
||||||
elseif ($user->hasPermissionTo('manage-request-portal-province')) {
|
|
||||||
$query->where('province_id', '=', $user->province_id);
|
$query->where('province_id', '=', $user->province_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,8 +33,8 @@ class RequestPortalService
|
|||||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name'
|
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,11 +18,9 @@ class TransportationUnitService
|
|||||||
|
|
||||||
if ($user->hasPermissionTo('manage-transportation-unit-station')) {
|
if ($user->hasPermissionTo('manage-transportation-unit-station')) {
|
||||||
$query->where('station_id', '=', $user->station_id);
|
$query->where('station_id', '=', $user->station_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-transportation-unit-city')) {
|
||||||
elseif ($user->hasPermissionTo('manage-transportation-unit-city')) {
|
|
||||||
$query->where('city_id', '=', $user->city_id);
|
$query->where('city_id', '=', $user->city_id);
|
||||||
}
|
} elseif ($user->hasPermissionTo('manage-transportation-unit-province')) {
|
||||||
elseif ($user->hasPermissionTo('manage-transportation-unit-province')) {
|
|
||||||
$query->where('province_id', '=', $user->province_id);
|
$query->where('province_id', '=', $user->province_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,8 +33,8 @@ class TransportationUnitService
|
|||||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||||
'code', 'category_id', 'category_name', 'explanation', 'km', 'city_id', 'city_name', 'province_id', 'station_name'
|
'code', 'category_id', 'category_name', 'explanation', 'km', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user