develop #7
11
.env.example
11
.env.example
@@ -50,6 +50,13 @@ PAYMENT_USERNAME=
|
||||
PAYMENT_PASSWORD=
|
||||
PAYMENT_LINK=
|
||||
|
||||
HARIM_PAYMENT_USERNAME=
|
||||
HARIM_PAYMENT_PASSWORD=
|
||||
HARIM_PAYMENT_URL=
|
||||
HARIM_PAYMENT_SERIAL=
|
||||
HARIM_PAYMENT_INSTANCE_ID=
|
||||
|
||||
|
||||
RMS_VERSION=3.0
|
||||
RMS_CTO_PHONE_NUMBER=
|
||||
|
||||
@@ -91,9 +98,9 @@ HARIM_NEED_GUARANTEE_LETTER_URL='https://zamin.gov.ir/ow/api/ow/esb/response'
|
||||
HARIM_NEED_GUARANTEE_LETTER_PASSWORD=
|
||||
HARIM_NEED_GUARANTEE_LETTER_USERNAME=
|
||||
|
||||
BACKUP_TARGET_DIR=
|
||||
BACKUP_TARGET_DIR=/var
|
||||
BACKUP_USER=
|
||||
BACKUP_PASSWORD=
|
||||
BACKUP_PASSWORD=1qaz
|
||||
|
||||
|
||||
HARIM_ENCRYPTION_KEY="TestKey"
|
||||
|
||||
72
Dockerfile
72
Dockerfile
@@ -1,58 +1,32 @@
|
||||
FROM alpine:3.18
|
||||
FROM dunglas/frankenphp:1.11.1-php8.2
|
||||
|
||||
RUN apk update && apk add --no-cache\
|
||||
bash \
|
||||
wget \
|
||||
curl \
|
||||
nano \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends default-mysql-client \
|
||||
unzip \
|
||||
libzip-dev \
|
||||
libxml2 \
|
||||
libxml2-dev \
|
||||
git \
|
||||
zlib-dev \
|
||||
libpng-dev \
|
||||
php81 \
|
||||
php81-common \
|
||||
php81-fpm \
|
||||
php81-pdo \
|
||||
php81-opcache \
|
||||
php81-soap \
|
||||
php81-zip \
|
||||
php81-phar \
|
||||
php81-iconv \
|
||||
php81-cli \
|
||||
php81-curl \
|
||||
php81-openssl \
|
||||
php81-mbstring \
|
||||
php81-tokenizer \
|
||||
php81-fileinfo \
|
||||
php81-json \
|
||||
php81-xml \
|
||||
php81-xmlwriter \
|
||||
php81-xmlreader \
|
||||
php81-simplexml \
|
||||
php81-dom \
|
||||
php81-pdo_mysql \
|
||||
php81-pdo_pgsql \
|
||||
php81-pdo_sqlite \
|
||||
php81-tokenizer \
|
||||
php81-pecl-redis \
|
||||
php81-gd
|
||||
zip \
|
||||
&& install-php-extensions pdo_mysql \
|
||||
&& install-php-extensions zip \
|
||||
&& install-php-extensions gd \
|
||||
&& install-php-extensions pcntl \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
WORKDIR /var/www/rms
|
||||
|
||||
ENV COMPOSER_ALLOW_SUPERUSER=1
|
||||
# Copy Laravel application
|
||||
COPY . .
|
||||
|
||||
ARG MOUNT_PATH
|
||||
# Give permissions to storage and bootstrap/cache
|
||||
RUN chmod -R 777 storage bootstrap/cache
|
||||
|
||||
COPY . /var/www/app
|
||||
|
||||
WORKDIR /var/www/app
|
||||
# Install Composer
|
||||
COPY --from=docker.arvancloud.ir/composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Optional: Run migrations/seeds if you want
|
||||
# CMD php artisan migrate && php artisan db:seed && frankenphp run --config /etc/frankenphp/config.prod.yaml
|
||||
CMD composer install;\
|
||||
php artisan key:generate;\
|
||||
# php artisan migrate ;\
|
||||
# php artisan db:seed;\
|
||||
# php artisan storege:link;\
|
||||
php artisan serve --host=0.0.0.0
|
||||
php artisan migrate;\
|
||||
php artisan db:seed;\
|
||||
cd public;\
|
||||
frankenphp php-server
|
||||
@@ -47,31 +47,44 @@ class DailyMovingMachineCommand extends Command
|
||||
$missionCodes = $missions->pluck('machine_code');
|
||||
|
||||
$cmmsOnly = $cmms->diff($missionCodes);
|
||||
$missionOnly = $missionCodes->diff($cmms);
|
||||
// $missionOnly = $missionCodes->diff($cmms);
|
||||
|
||||
$violationMachineCodes = MissionViolation::query()->whereDate('request_date', $date)->pluck('machine_code');
|
||||
|
||||
foreach ($cmmsOnly as $code) {
|
||||
$cmm = $response->firstWhere('machineCode', '=', $code);
|
||||
|
||||
if ($violationMachineCodes->contains($cmm->machine_code)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$machine = CMMSMachine::query()->firstWhere('machine_code', '=', $code);
|
||||
|
||||
MissionViolation::query()->create([
|
||||
'machine_code' => $code,
|
||||
'machine_id' => $machine->id,
|
||||
'type' => MissionViolationType::KHOROJ_BEDONE_MOGAVEZ->value,
|
||||
'request_date' => $date,
|
||||
'mileage' => $cmm['mileageKM'],
|
||||
// 'exit_time' => $cmm['exit_time'],
|
||||
// 'enter_time' => $cmm['enter_time'],
|
||||
'province_id' => $machine->province_id,
|
||||
// 'province_name' => $machine->province_fa,
|
||||
'city_id' => $machine->city_id,
|
||||
// 'city_name' => $machine->city_fa,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($missionOnly as $code) {
|
||||
MissionViolation::query()->create([
|
||||
'machine_code' => $code,
|
||||
'mission_id' => $missions->where('machine_code', '=', $code)->value('id'),
|
||||
'type' => MissionViolationType::ADAM_TAHAROK->value,
|
||||
'request_date' => $date,
|
||||
]);
|
||||
}
|
||||
// foreach ($missionOnly as $code) {
|
||||
// MissionViolation::query()->create([
|
||||
// 'machine_code' => $code,
|
||||
// 'mission_id' => $missions->where('machine_code', '=', $code)->value('id'),
|
||||
// 'type' => MissionViolationType::ADAM_TAHAROK->value,
|
||||
// 'request_date' => $date,
|
||||
// ]);
|
||||
// }
|
||||
|
||||
$this->info("ماشینهای متحرک بدون مأموریت: " . $cmmsOnly->count());
|
||||
$this->info("مأموریتهای بدون حرکت در CMMS: " . $missionOnly->count());
|
||||
// $this->info("مأموریتهای بدون حرکت در CMMS: " . $missionOnly->count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ class GetMachinesInfoListCommand extends Command
|
||||
'province_id' => $entry['UnitGroupCode'] ?? null,
|
||||
'city_id' => $entry['UnitCode'] ?? null,
|
||||
'station_id' => $entry['Layer3Code'] ?? null,
|
||||
'driver_name' => $entry['DriverName'] ?? null,
|
||||
]);
|
||||
|
||||
++$updatedRows;
|
||||
|
||||
@@ -46,7 +46,7 @@ class SendContractSmsNotification extends Command
|
||||
foreach ($contractSubItems as $key => $value) {
|
||||
$message = "سلام،\n پروژه راهداری با کد یکتای {$value->unique_code} با مسئولیت شما، به مدت بیشتر از یک ماه به روزرسانی نشده است. لطفا نسبت به روز رسانی دقیق پیشرفت پروژه در سامانه اقدام نمایید.\n rms.rmto.ir";
|
||||
|
||||
self::sms_sender($value->operator_phone, $message);
|
||||
// self::sms_sender($value->operator_phone, $message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,10 @@ enum CmmsMachineStatus: int
|
||||
case AMADE= 1;
|
||||
case RESERVE = 2;
|
||||
case DAR_MAMORIAT = 3;
|
||||
case KHAREGE_AZ_RADE = 4;
|
||||
case DAR_TAMIR = 5 ;
|
||||
case FOROKHTEH_SHODE = 6;
|
||||
case NIZE_BE_TAMIR =7 ;
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
@@ -14,6 +18,10 @@ enum CmmsMachineStatus: int
|
||||
self::AMADE => 'آماده',
|
||||
self::RESERVE => 'رزرو',
|
||||
self::DAR_MAMORIAT => 'در ماموریت',
|
||||
self::KHAREGE_AZ_RADE => 'خارج از محدوده',
|
||||
self::DAR_TAMIR => 'در تعمیر',
|
||||
self::FOROKHTEH_SHODE => ' فروخته شده',
|
||||
self::NIZE_BE_TAMIR => 'نیاز به تعمیر',
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ enum FMSResultCode: string
|
||||
"-1" => "نام ﮐﺎرﺑﺮي ﯾﺎ ﮐﻠﻤﻪ ﻋﺒﻮر ﺻﺤﯿﺢ ﻧﯿﺴﺖ.",
|
||||
"-2" => "خودرو با کد مورد نظر وجود ندارد یا دستگاه ردیاب به آن متصل نیست.",
|
||||
"-3" => "کاربر به خودرو مورد نظر دسترسی ندارد.",
|
||||
"-4" => "ﺗﻌﺪاد دﻓﻌﺎت ﺟﺮاي ﺗﺎﺑﻊ ﺑﯿﺶ از ﺣﺪ ﻣﺠﺎز اﺳﺖ(اﯾﻦ ﺳﺮوﯾﺲ را در ﻫﺮ ثاﻧﯿﻪ ﻓﻘﻂ ﯾﮏ ﺑﺎر ﻣﯽﺗﻮان اﺟﺮاﮐﺮد)",
|
||||
"-4" => "ﺗﻌﺪاد دﻓﻌﺎت اﺟﺮاي ﺗﺎﺑﻊ ﺑﯿﺶ از ﺣﺪ ﻣﺠﺎز اﺳﺖ(اﯾﻦ ﺳﺮوﯾﺲ را در ﻫﺮ ثاﻧﯿﻪ ﻓﻘﻂ ﯾﮏ ﺑﺎر ﻣﯽﺗﻮان اﺟﺮاﮐﺮد)",
|
||||
"-5" => "پارامتر های داده شده صحیح نیستند",
|
||||
];
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ enum HarimStates: int
|
||||
case BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL = 15;
|
||||
case MOKHALEFAT_BA_DASTGAH = 16;
|
||||
case ETMAM_FARAYAND = 17;
|
||||
case SODOR_FACTOR = 18;
|
||||
case PARDAKHT_FACTOR = 19;
|
||||
case SABT_FISH = 20;
|
||||
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
@@ -42,6 +46,9 @@ enum HarimStates: int
|
||||
self::BARESI_ARSE_VA_AYAN_ERSAL_SHODE_TAVASOT_MODIR_KOL => "تائید عرصه و اعیان ارسال شده توسط مدیر",
|
||||
self::MOKHALEFAT_BA_DASTGAH => "مخالفت با درخواست",
|
||||
self::ETMAM_FARAYAND => "اتمام فرایند",
|
||||
self::SODOR_FACTOR => "صدور فاکتور",
|
||||
self::PARDAKHT_FACTOR => "پرداخت فاکتور",
|
||||
self::SABT_FISH => "ثبت فیش",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,11 @@ enum MissionStates: int
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => 'درخواست ایجاد شد و در حال بررسی توسط واحد نقلیه است',
|
||||
1 => 'درخواست ایجاد شد و در حال بررسی توسط واحد تایید کننده است',
|
||||
2 => 'خودرو اختصاص داده شد و درخواست توسط واحد کنترل در حال بررسی است',
|
||||
3 => 'درخواست توسط واحد کنترل تایید شد و ماموریت آغاز می شود',
|
||||
4 => 'اتمام ماموریت',
|
||||
5 => 'عدم تخصیص خودرو توسط واحد نقلیه و بازگشت درخواست به کارتابل کاربر',
|
||||
5 => 'عدم تخصیص خودرو توسط واحد تایید کننده و بازگشت درخواست به کارتابل کاربر',
|
||||
6 => 'ماموریت لغو شد',
|
||||
7 => 'ماموریت بدون فرایند ثبت شد'
|
||||
];
|
||||
|
||||
17
app/Enums/MissionViolationStatus.php
Normal file
17
app/Enums/MissionViolationStatus.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum MissionViolationStatus: int
|
||||
{
|
||||
case BEDON_EGHDAM = 0;
|
||||
case EGHDAM_SHODE = 1;
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::BEDON_EGHDAM => "بدون اقدام",
|
||||
self::EGHDAM_SHODE => "اقدام شده",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ enum MissionViolationType: int
|
||||
public function label(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::KHOROJ_BEDONE_MOGAVEZ => "خروج بدون مجوز ",
|
||||
self::KHOROJ_BEDONE_MOGAVEZ => "خروج بدون مجوز",
|
||||
self::ADAM_TAHAROK => "عدم تحرک",
|
||||
};
|
||||
}
|
||||
|
||||
110
app/Exports/V3/Mission/Report/Tradod/CountryReport.php
Normal file
110
app/Exports/V3/Mission/Report/Tradod/CountryReport.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\Mission\Report\Tradod;
|
||||
|
||||
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\Worksheet\Drawing;
|
||||
|
||||
class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||
{
|
||||
public function __construct(private array $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$grid = [];
|
||||
$national = null;
|
||||
|
||||
foreach ($this->data as $r) {
|
||||
$pid = (int) $r->province_id;
|
||||
$name = $r->province_name;
|
||||
|
||||
if ($pid === -1) {
|
||||
$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),
|
||||
'bafarayand_saeti' => (int) ($r->far_h ?? 0),
|
||||
'bafarayand_rozaneh' => (int) ($r->far_d ?? 0),
|
||||
'bedon_bafarayand_saeti' => (int) ($r->un_far_h ?? 0),
|
||||
'bedon_bafarayand_rozaneh' => (int) ($r->un_far_d ?? 0),
|
||||
'item' => (int) ($r->item ?? 0),
|
||||
'patrol' => (int) ($r->patrol ?? 0),
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($grid[$pid])) {
|
||||
$grid[$pid] = [
|
||||
'province_name' => $name,
|
||||
];
|
||||
}
|
||||
|
||||
$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]['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);
|
||||
$grid[$pid]['bedon_bafarayand_rozaneh'] = (int) ($r->un_far_d ?? 0);
|
||||
$grid[$pid]['item'] = (int) ($r->item ?? 0);
|
||||
$grid[$pid]['patrol'] = (int) ($r->patrol ?? 0);
|
||||
}
|
||||
|
||||
$exportRows = [];
|
||||
if ($national) {
|
||||
$exportRows[] = $national;
|
||||
}
|
||||
foreach ($grid as $row) {
|
||||
$exportRows[] = $row;
|
||||
}
|
||||
|
||||
return view('v3.Reports.Mission.Report.Tradod .CountryActivityReport', [
|
||||
'rows' => $exportRows,
|
||||
]);
|
||||
}
|
||||
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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('J1');
|
||||
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
115
app/Exports/V3/Mission/Report/Tradod/ProvinceReport.php
Normal file
115
app/Exports/V3/Mission/Report/Tradod/ProvinceReport.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\Mission\Report\Tradod;
|
||||
|
||||
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 ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||
{
|
||||
public function __construct(private array $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$grid = [];
|
||||
$province = null;
|
||||
|
||||
foreach ($this->data as $r) {
|
||||
$cid = (int) $r->city_id;
|
||||
$name = $r->city_name;
|
||||
|
||||
if ($cid === -1) {
|
||||
$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),
|
||||
'bafarayand_saeti' => (int) ($r->far_h ?? 0),
|
||||
'bafarayand_rozaneh' => (int) ($r->far_d ?? 0),
|
||||
'bedon_bafarayand_saeti' => (int) ($r->un_far_h ?? 0),
|
||||
'bedon_bafarayand_rozaneh' => (int) ($r->un_far_d ?? 0),
|
||||
'item' => (int) ($r->item ?? 0),
|
||||
'patrol' => (int) ($r->patrol ?? 0),
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($grid[$cid])) {
|
||||
$grid[$cid] = [
|
||||
'city_name' => $name,
|
||||
];
|
||||
}
|
||||
|
||||
$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]['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);
|
||||
$grid[$cid]['bedon_bafarayand_rozaneh'] = (int) ($r->un_far_d ?? 0);
|
||||
$grid[$cid]['item'] = (int) ($r->item ?? 0);
|
||||
$grid[$cid]['patrol'] = (int) ($r->patrol ?? 0);
|
||||
|
||||
}
|
||||
|
||||
$exportRows = [];
|
||||
if ($province) {
|
||||
$exportRows[] = $province;
|
||||
}
|
||||
foreach ($grid as $row) {
|
||||
$exportRows[] = $row;
|
||||
}
|
||||
|
||||
return view('v3.Reports.Mission.Report.Tradod .ProvinceActivityReport', [
|
||||
'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('J1');
|
||||
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
101
app/Exports/V3/Mission/Report/Violation/CountryReport.php
Normal file
101
app/Exports/V3/Mission/Report/Violation/CountryReport.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\Mission\Report\Violation;
|
||||
|
||||
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\Worksheet\Drawing;
|
||||
|
||||
class CountryReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||
{
|
||||
public function __construct(private array $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$grid = [];
|
||||
$national = null;
|
||||
|
||||
foreach ($this->data as $r) {
|
||||
$pid = (int) $r->province_id;
|
||||
$name = $r->province_name;
|
||||
|
||||
if ($pid === -1) {
|
||||
$national = [
|
||||
'province_name' => $name,
|
||||
'total' => (int) ($r->total ?? 0),
|
||||
'egdam_shode' => (int) ($r->done ?? 0),
|
||||
'bedone_egdam' => (int) ($r->undone ?? 0),
|
||||
'sabt_gps' => (int) ($r->gps ?? 0),
|
||||
'sabt_herasat' => (int) ($r->herasat ?? 0),
|
||||
'mil_gps' => (int) ($r->mil_gps ?? 0),
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($grid[$pid])) {
|
||||
$grid[$pid] = [
|
||||
'province_name' => $name,
|
||||
];
|
||||
}
|
||||
$grid[$pid]['total'] = (int) ($r->total ?? 0);
|
||||
$grid[$pid]['egdam_shode'] = (int) ($r->done ?? 0);
|
||||
$grid[$pid]['bedone_egdam'] = (int) ($r->undone ?? 0);
|
||||
$grid[$pid]['sabt_gps'] = (int) ($r->gps ?? 0);
|
||||
$grid[$pid]['sabt_herasat'] = (int) ($r->herasat ?? 0);
|
||||
$grid[$pid]['mil_gps'] = (int) ($r->mil_gps ?? 0);
|
||||
}
|
||||
|
||||
$exportRows = [];
|
||||
if ($national) {
|
||||
$exportRows[] = $national;
|
||||
}
|
||||
foreach ($grid as $row) {
|
||||
$exportRows[] = $row;
|
||||
}
|
||||
|
||||
return view('v3.Reports.Mission.Report.CountryActivityReport', [
|
||||
'rows' => $exportRows,
|
||||
]);
|
||||
}
|
||||
|
||||
public function registerEvents(): array
|
||||
{
|
||||
return [
|
||||
AfterSheet::class => function (AfterSheet $event) {
|
||||
$event->sheet->getDelegate()->setRightToLeft(true);
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
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('G1');
|
||||
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
105
app/Exports/V3/Mission/Report/Violation/ProvinceReport.php
Normal file
105
app/Exports/V3/Mission/Report/Violation/ProvinceReport.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\V3\Mission\Report\Violation;
|
||||
|
||||
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 ProvinceReport implements FromView, ShouldAutoSize, WithDrawings, WithEvents
|
||||
{
|
||||
public function __construct(private array $data)
|
||||
{
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
$grid = [];
|
||||
$province = null;
|
||||
|
||||
foreach ($this->data as $r) {
|
||||
$cid = (int) $r->city_id;
|
||||
$name = $r->city_name;
|
||||
|
||||
if ($cid === -1) {
|
||||
$province = [
|
||||
'city_name' => $name,
|
||||
'total' => (int) ($r->total ?? 0),
|
||||
'egdam_shode' => (int) ($r->done ?? 0),
|
||||
'bedone_egdam' => (int) ($r->undone ?? 0),
|
||||
'sabt_gps' => (int) ($r->gps ?? 0),
|
||||
'sabt_herasat' => (int) ($r->herasat ?? 0),
|
||||
'mil_gps' => (int) ($r->mil_gps ?? 0),
|
||||
];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($grid[$cid])) {
|
||||
$grid[$cid] = [
|
||||
'city_name' => $name,
|
||||
];
|
||||
}
|
||||
$grid[$cid]['total'] = (int) ($r->total ?? 0);
|
||||
$grid[$cid]['egdam_shode'] = (int) ($r->done ?? 0);
|
||||
$grid[$cid]['bedone_egdam'] = (int) ($r->undone ?? 0);
|
||||
$grid[$cid]['sabt_gps'] = (int) ($r->gps ?? 0);
|
||||
$grid[$cid]['sabt_herasat'] = (int) ($r->herasat ?? 0);
|
||||
$grid[$cid]['mil_gps'] = (int) ($r->mil_gps ?? 0);
|
||||
}
|
||||
|
||||
$exportRows = [];
|
||||
if ($province) {
|
||||
$exportRows[] = $province;
|
||||
}
|
||||
foreach ($grid as $row) {
|
||||
$exportRows[] = $row;
|
||||
}
|
||||
|
||||
return view('v3.Reports.Mission.Report.ProvinceActivityReport', [
|
||||
'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('G1');
|
||||
|
||||
return [$drawing, $drawing2];
|
||||
}
|
||||
}
|
||||
@@ -12,28 +12,28 @@ class SmsClass
|
||||
{
|
||||
public function sendSms($mobile, $msg)
|
||||
{
|
||||
if (App::environment('production')) {
|
||||
|
||||
|
||||
$client = new SoapClient("http://172.30.5.36/webservice/sms.asmx?WSDL");
|
||||
$date = date('d-m-y h:i:s');
|
||||
$date = str_replace(" ", "T", $date);
|
||||
$result = $client->Send(
|
||||
array(
|
||||
'Username' => 'admin',
|
||||
'Password' => 'admin141',
|
||||
'ShortCode' => '1000141',
|
||||
'Cellphones' => $mobile,
|
||||
'Message' => $msg,
|
||||
'Farsi' => true,
|
||||
// 'SendDate' => $date
|
||||
// 'uTopic' => false,
|
||||
// 'uFlash' => false
|
||||
)
|
||||
);
|
||||
|
||||
return $result->SendResult;
|
||||
}
|
||||
// if (App::environment('production')) {
|
||||
//
|
||||
//
|
||||
// $client = new SoapClient("http://172.30.5.36/webservice/sms.asmx?WSDL");
|
||||
// $date = date('d-m-y h:i:s');
|
||||
// $date = str_replace(" ", "T", $date);
|
||||
// $result = $client->Send(
|
||||
// array(
|
||||
// 'Username' => 'admin',
|
||||
// 'Password' => 'admin141',
|
||||
// 'ShortCode' => '1000141',
|
||||
// 'Cellphones' => $mobile,
|
||||
// 'Message' => $msg,
|
||||
// 'Farsi' => true,
|
||||
// // 'SendDate' => $date
|
||||
// // 'uTopic' => false,
|
||||
// // 'uFlash' => false
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// return $result->SendResult;
|
||||
// }
|
||||
|
||||
|
||||
// $client = new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
|
||||
|
||||
@@ -609,25 +609,25 @@ class ContractSubItemsController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function sms_sender($mobile, $msg)
|
||||
{
|
||||
$client=new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
|
||||
$result=$client->doSendSMS(
|
||||
array(
|
||||
'uUsername' => 'rmto',
|
||||
'uPassword' => 'Rahdari8
|
||||
',
|
||||
'uNumber' => '1000141',
|
||||
'uCellphones' => $mobile,
|
||||
'uMessage' => $msg,
|
||||
'uFarsi' => true,
|
||||
'uTopic' => false,
|
||||
'uFlash' => false
|
||||
)
|
||||
);
|
||||
$x = $result->doSendSMSResult;
|
||||
return $x;
|
||||
}
|
||||
// public function sms_sender($mobile, $msg)
|
||||
// {
|
||||
// $client=new SoapClient("http://sms1000.ir/webservice/smspro.asmx?WSDL");
|
||||
// $result=$client->doSendSMS(
|
||||
// array(
|
||||
// 'uUsername' => 'rmto',
|
||||
// 'uPassword' => 'Rahdari8
|
||||
// ',
|
||||
// 'uNumber' => '1000141',
|
||||
// 'uCellphones' => $mobile,
|
||||
// 'uMessage' => $msg,
|
||||
// 'uFarsi' => true,
|
||||
// 'uTopic' => false,
|
||||
// 'uFlash' => false
|
||||
// )
|
||||
// );
|
||||
// $x = $result->doSendSMSResult;
|
||||
// return $x;
|
||||
// }
|
||||
|
||||
public function get_way_id_from_nominatim($lat, $lng)
|
||||
{
|
||||
|
||||
@@ -434,6 +434,7 @@ class UserController extends Controller
|
||||
|
||||
$user->password = Hash::make($request->password);
|
||||
$user->national_code = $request->national_code;
|
||||
$user->station_id = $request->station_id;
|
||||
$user->save();
|
||||
|
||||
if (auth()->user()) {
|
||||
|
||||
@@ -2,12 +2,18 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Harim;
|
||||
|
||||
use App\Facades\Sms\Sms;
|
||||
use App\Enums\HarimStates;
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\Detail\HarimSubmitInvoiceRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Harim;
|
||||
use App\Models\HarimState;
|
||||
use App\Services\Cartables\Harim\HarimPaymentService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class DetailController extends Controller
|
||||
@@ -30,4 +36,58 @@ class DetailController extends Controller
|
||||
->orderBy('id', 'desc')
|
||||
->get(['id', 'expert_description', 'action_name', 'previous_state_name']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
* @throws ProhibitedAction
|
||||
*/
|
||||
public function submitInvoice(Harim $harim, HarimPaymentService $harimpaymentService, HarimSubmitInvoiceRequest $request): JsonResponse
|
||||
{
|
||||
$lock = Cache::lock("harimPayment-{$harim->id}", 10);
|
||||
throw_if(! $lock->get(), new ProhibitedAction('امکان درخواست مجدد تا 10 ثانیه دیگر وجود ندارد'));
|
||||
|
||||
$payment_amount = $harim->payment_amount;
|
||||
|
||||
$bill_code = $harimpaymentService->invoiceBillApi($harim->national_id, $payment_amount);
|
||||
|
||||
DB::transaction(function () use ($bill_code, $harim) {
|
||||
|
||||
$harim->histories()->update([
|
||||
// 'bill_code' => $bill_code,
|
||||
'status' => HarimStates::SODOR_FACTOR->value,
|
||||
'status_fa' => HarimStates::SODOR_FACTOR->label(),
|
||||
]);
|
||||
|
||||
});
|
||||
|
||||
$msg = "فاکتور با شناسه پرداخت \n" . explode("/", $harim->bill_code)[0]. "\n برای پرداخت از لینک زیر اقدام نمایید.\n\n"
|
||||
. config('harim_web_services.Harim_Payment.LINK')."/#/pay/".explode("/", $harim->bill_code)[0]."/$payment_amount";
|
||||
|
||||
Sms::sendSms($harim->phone_number, $msg);
|
||||
|
||||
$lock->release();
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function checkPaymentStatus(Harim $harim, HarimPaymentService $harimpaymentService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($harim, $harimpaymentService) {
|
||||
|
||||
$response = json_decode($harimpaymentService->callPaymentStatusBillApi(explode('/', $harim->bill_code)[0]));
|
||||
|
||||
throw_if(! $response->isPayed, new ProhibitedAction('پرداخت انجام نشده است'));
|
||||
|
||||
$harim->histories()->update([
|
||||
'status' => HarimStates::PARDAKHT_FACTOR->value,
|
||||
'status_fa' => HarimStates::PARDAKHT_FACTOR->label(),
|
||||
]);
|
||||
|
||||
});
|
||||
|
||||
return $this->successResponse($harim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Enums\FMSResultCode;
|
||||
use App\Enums\MissionStates;
|
||||
use App\Events\V3\Dashboard\Mission\SendDataToFMSEvent;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -11,6 +12,7 @@ use App\Http\Requests\V3\Mission\ControlUnit\StartRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
use App\Services\Cartables\Mission\ControlUnitService;
|
||||
use App\Services\FMS\GetErrorRateService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -41,7 +43,7 @@ class ControlUnitController extends Controller
|
||||
$mission->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'start_time' => now(),
|
||||
'start_time' => $request->time,
|
||||
'km' => $request->km,
|
||||
]);
|
||||
});
|
||||
@@ -52,9 +54,9 @@ class ControlUnitController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function finish(FinishRequest $request, Mission $mission): JsonResponse
|
||||
public function finish(FinishRequest $request, Mission $mission, GetErrorRateService $getErrorRateService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($mission) {
|
||||
DB::transaction(function () use ($mission, $getErrorRateService, $request) {
|
||||
$mission->histories()->create([
|
||||
'user_id' => auth()->user()->id,
|
||||
'previous_state_id' => $mission->state_id,
|
||||
@@ -66,9 +68,22 @@ class ControlUnitController extends Controller
|
||||
$mission->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => MissionStates::name($state),
|
||||
'finish_time' => now(),
|
||||
'mission_duration' => strtotime(now()) - strtotime($mission->start_time),
|
||||
'finish_time' => $request->time,
|
||||
'mission_duration' => strtotime($request->time) - strtotime($mission->start_time),
|
||||
'end_km' => $request->end_km,
|
||||
]);
|
||||
|
||||
// $getErrorRateService->setInputParameters($mission);
|
||||
// $responseData = $getErrorRateService->run();
|
||||
//
|
||||
// $mission->update([
|
||||
// 'in_area_duration' => $responseData['timeInAreaSeconds'],
|
||||
// 'first_enter' => $responseData['firstEnter'],
|
||||
// 'last_exit' => $responseData['lastExit'],
|
||||
// 'point_number_sent' => $responseData['noOfPointsInMission'],
|
||||
// 'fms_result_code' => $responseData['resultCode'],
|
||||
// 'fms_result_message' => FMSResultCode::name($responseData['resultCode']),
|
||||
// ]);
|
||||
});
|
||||
|
||||
if ($mission->category_id == 2) {
|
||||
@@ -76,7 +91,7 @@ class ControlUnitController extends Controller
|
||||
$rpc->store($mission);
|
||||
}
|
||||
|
||||
SendDataToFMSEvent::dispatch($mission);
|
||||
// SendDataToFMSEvent::dispatch($mission);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||
|
||||
use App\Exports\V3\Mission\Report\Tradod\CountryReport;
|
||||
use App\Exports\V3\Mission\Report\Tradod\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\Report\ReportTradodService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportTradodController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, ReportTradodService $reportMissionService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportMissionService->countryActivity($request),
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request, ReportTradodService $reportMissionService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' =>$reportMissionService->provinceActivity($request),
|
||||
'city' => City::query()
|
||||
->where('province_id', $request->province_id)
|
||||
->where(function ($query) {
|
||||
$query->where('type_id', 1)
|
||||
->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||
})
|
||||
->get(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function countryExcelActivity(Request $request, ReportTradodService $reportMissionService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMissionService->countryActivity($request);
|
||||
$name = 'گزارش کل تردد '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function provinceExcelActivity(Request $request, ReportTradodService $reportMissionService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportMissionService->provinceActivity($request);
|
||||
$name = 'گزارش کل تردد '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission\Report;
|
||||
|
||||
use App\Exports\V3\Mission\Report\Violation\CountryReport;
|
||||
use App\Exports\V3\Mission\Report\Violation\ProvinceReport;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\City;
|
||||
use App\Models\Province;
|
||||
use App\Services\Cartables\Mission\Report\ReportViolationService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use PhpOffice\PhpSpreadsheet\Exception;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ReportViolationController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function countryActivity(Request $request, ReportViolationService $reportService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' => $reportService->countryActivity($request),
|
||||
'provinces' => Province::all(['id', 'name_fa']),
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request, ReportViolationService $reportService): JsonResponse
|
||||
{
|
||||
return $this->successResponse([
|
||||
'activities' =>$reportService->provinceActivity($request),
|
||||
'city' => City::query()
|
||||
->where('province_id', $request->province_id)
|
||||
->where(function ($query) {
|
||||
$query->where('type_id', 1)
|
||||
->orWhereIn('name_fa', ['اداره ماشينآلات', 'اداره نقلیه']);
|
||||
})
|
||||
->get(['id', 'name_fa'])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function countryExcelActivity(Request $request, ReportViolationService $reportService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportService->countryActivity($request);
|
||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new CountryReport($data), $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function provinceExcelActivity(Request $request, ReportViolationService $reportService): BinaryFileResponse
|
||||
{
|
||||
$data = $reportService->provinceActivity($request);
|
||||
$name = 'گزارش تخلفات ماموریت ها '.verta()->now()->format('Y-m-d H-i').'.xlsx';
|
||||
|
||||
return Excel::download(new ProvinceReport($data), $name);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
|
||||
use App\Enums\FMSResultCode;
|
||||
use App\Enums\MissionCategory;
|
||||
use App\Enums\MissionStates;
|
||||
use App\Enums\MissionTypes;
|
||||
@@ -15,8 +16,10 @@ use App\Http\Requests\V3\Mission\RequestPortal\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\CMMSMachine;
|
||||
use App\Models\Mission;
|
||||
use App\Models\RahdariPoint;
|
||||
use App\Models\RoadObserved;
|
||||
use App\Services\Cartables\Mission\RequestPortalService;
|
||||
use App\Services\FMS\GetErrorRateService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -48,6 +51,8 @@ class RequestPortalController extends Controller
|
||||
'username' => $user->username,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'city_id' => $user->city_id ?? null,
|
||||
'city_name' => $user->city_fa ?? null,
|
||||
'edare_shahri_id' => $user->edarate_shahri_id ?? null,
|
||||
'edare_shahri_name' => $user->edarate_shahri_name ?? null,
|
||||
'state_id' => $state,
|
||||
@@ -67,6 +72,8 @@ class RequestPortalController extends Controller
|
||||
'category_name' => MissionCategory::name($category),
|
||||
'explanation' => $request->explanation,
|
||||
'code' => rand(100000, 999999),
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->sync($request->rahdaran);
|
||||
@@ -83,9 +90,9 @@ class RequestPortalController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function continueMission(ContinueMissionRequest $request, Mission $mission): JsonResponse
|
||||
public function continueMission(ContinueMissionRequest $request, Mission $mission, GetErrorRateService $getErrorRateService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $mission) {
|
||||
DB::transaction(function () use ($request, $mission, $getErrorRateService) {
|
||||
$user = auth()->user();
|
||||
|
||||
$mission->update([
|
||||
@@ -94,6 +101,23 @@ class RequestPortalController extends Controller
|
||||
'state_name' => MissionStates::name(MissionStates::END_MISSION->value),
|
||||
]);
|
||||
|
||||
$getErrorRateService->setInputParameters($mission);
|
||||
$responseData = $getErrorRateService->run();
|
||||
|
||||
$mission->update([
|
||||
'in_area_duration' => $responseData['timeInAreaSeconds'],
|
||||
'first_enter' => $responseData['firstEnter'],
|
||||
'last_exit' => $responseData['lastExit'],
|
||||
'point_number_sent' => $responseData['noOfPointsInMission'],
|
||||
'fms_result_code' => $responseData['resultCode'],
|
||||
'fms_result_message' => FMSResultCode::name($responseData['resultCode']),
|
||||
]);
|
||||
|
||||
// if ($mission->category_id == 2) {
|
||||
// $rpc = new OperatorController;
|
||||
// $rpc->store($mission);
|
||||
// }
|
||||
|
||||
$state = MissionStates::START_MISSION->value;
|
||||
$category = $request->category_id;
|
||||
$machine = CMMSMachine::query()->find($request->machine_id);
|
||||
@@ -103,6 +127,8 @@ class RequestPortalController extends Controller
|
||||
'username' => $user->username,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'city_id' => $user->city_id ?? null,
|
||||
'city_name' => $user->city_fa ?? null,
|
||||
'edare_shahri_id' => $user->edarate_shahri_id ?? null,
|
||||
'edare_shahri_name' => $user->edarate_shahri_name ?? null,
|
||||
'state_id' => $state,
|
||||
@@ -123,6 +149,8 @@ class RequestPortalController extends Controller
|
||||
'start_time' => now(),
|
||||
'machine_id' => $machine->id,
|
||||
'machine_code' => $machine->machine_code,
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||
]);
|
||||
|
||||
$newMission->rahdaran()->sync($request->rahdaran);
|
||||
@@ -170,6 +198,7 @@ class RequestPortalController extends Controller
|
||||
{
|
||||
DB::transaction(function () use ($mission) {
|
||||
$mission->rahdaran()->detach();
|
||||
$mission->histories()->delete();
|
||||
$mission->delete();
|
||||
});
|
||||
|
||||
@@ -179,21 +208,24 @@ class RequestPortalController extends Controller
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function noProcess(NoProcessRequest $request): JsonResponse
|
||||
public function noProcess(NoProcessRequest $request, GetErrorRateService $getErrorRateService): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request) {
|
||||
DB::transaction(function () use ($request, $getErrorRateService) {
|
||||
$start = Carbon::parse($request->start_date);
|
||||
$end = Carbon::parse($request->end_date);
|
||||
$type = $start->diffInMinutes($end) > 480 ? MissionTypes::NO_PROCESS_ROZANE->value : MissionTypes::NO_PROCESS_SAATY->value;
|
||||
$user = auth()->user();
|
||||
$zone = $request->zone;
|
||||
$state = MissionStates::END_MISSION->value;
|
||||
$machine = CMMSMachine::query()->where('machine_code', '=', $request->machine_code)->first(['id', 'machine_code']);
|
||||
|
||||
$mission = Mission::query()->create([
|
||||
'user_id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'city_id' => $user->city_id ?? null,
|
||||
'city_name' => $user->city_fa ?? null,
|
||||
'edare_shahri_id' => $user->edarate_shahri_id ?? null,
|
||||
'edare_shahri_name' => $user->edarate_shahri_name ?? null,
|
||||
'zone' => $zone,
|
||||
@@ -201,9 +233,9 @@ class RequestPortalController extends Controller
|
||||
'type' => $type,
|
||||
'type_fa' => MissionTypes::name($type),
|
||||
'start_date' => $request->start_date,
|
||||
'area' => json_encode($request->area),
|
||||
'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,
|
||||
@@ -212,16 +244,31 @@ class RequestPortalController extends Controller
|
||||
'state_name' => MissionStates::name($state),
|
||||
'explanation' => $request->explanation,
|
||||
'request_date' => now(),
|
||||
'machine_id' => $machine->id,
|
||||
'machine_code' => $machine->machine_code,
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->sync($request->rahdaran);
|
||||
$mission->machines()->attach($request->machines);
|
||||
$mission->rahdaran()->attach($request->driver, ['is_driver' => true]);
|
||||
|
||||
if ($mission->category_id == 2) {
|
||||
$rpc = new OperatorController;
|
||||
$rpc->store($mission);
|
||||
}
|
||||
$getErrorRateService->setInputParameters($mission);
|
||||
$responseData = $getErrorRateService->run();
|
||||
|
||||
$mission->update([
|
||||
'in_area_duration' => $responseData['timeInAreaSeconds'],
|
||||
'first_enter' => $responseData['firstEnter'],
|
||||
'last_exit' => $responseData['lastExit'],
|
||||
'point_number_sent' => $responseData['noOfPointsInMission'],
|
||||
'fms_result_code' => $responseData['resultCode'],
|
||||
'fms_result_message' => FMSResultCode::name($responseData['resultCode']),
|
||||
]);
|
||||
|
||||
// if ($mission->category_id == 2) {
|
||||
// $rpc = new OperatorController;
|
||||
// $rpc->store($mission);
|
||||
// }
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
|
||||
@@ -5,17 +5,24 @@ namespace App\Http\Controllers\V3\Dashboard\Mission;
|
||||
use App\Enums\MissionCategory;
|
||||
use App\Enums\MissionStates;
|
||||
use App\Enums\MissionTypes;
|
||||
use App\Enums\MissionViolationStatus;
|
||||
use App\Enums\MissionViolationType;
|
||||
use App\Enums\MissionZones;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\V3\Dashboard\RoadPatrol\OperatorController;
|
||||
use App\Http\Requests\V3\Mission\RequestPortal\NoProcessRequest;
|
||||
use App\Http\Requests\V3\Mission\Violation\NoProcessRequest;
|
||||
use App\Http\Requests\V3\Mission\Violation\StoreRequest;
|
||||
use App\Http\Requests\V3\Mission\Violation\UpdateRequest;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\CMMSMachine;
|
||||
use App\Models\Mission;
|
||||
use App\Models\MissionViolation;
|
||||
use App\Models\RahdariPoint;
|
||||
use App\Services\Cartables\Mission\DailyMoveMachineService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class ViolationManagementController extends Controller
|
||||
{
|
||||
@@ -28,9 +35,12 @@ class ViolationManagementController extends Controller
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function noProcess(NoProcessRequest $request): JsonResponse
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function noProcess(NoProcessRequest $request, MissionViolation $violation): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request) {
|
||||
DB::transaction(function () use ($request, $violation) {
|
||||
|
||||
$start = Carbon::parse($request->start_date);
|
||||
$end = Carbon::parse($request->end_date);
|
||||
@@ -38,42 +48,92 @@ class ViolationManagementController extends Controller
|
||||
$user = auth()->user();
|
||||
$zone = $request->zone;
|
||||
$state = MissionStates::END_MISSION->value;
|
||||
$machine = CMMSMachine::query()->where('machine_code', '=', $violation->machine_code)->first(['id', 'machine_code']);
|
||||
|
||||
$mission = Mission::query()->create([
|
||||
'user_id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'city_id' => $user->city_id ?? null,
|
||||
'city_name' => $user->city_fa ?? null,
|
||||
'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,
|
||||
'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,
|
||||
'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,//
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find( $user->station_id)->name,
|
||||
'km' => $violation->km ?? null,
|
||||
]);
|
||||
|
||||
$mission->rahdaran()->sync($request->rahdaran);
|
||||
$mission->machines()->attach($request->machines);
|
||||
$mission->rahdaran()->attach($request->driver, ['is_driver' => true]);
|
||||
|
||||
if ($mission->category_id == 2) {
|
||||
$rpc = new OperatorController;
|
||||
$rpc->store($mission);
|
||||
}
|
||||
$violation->update(['status' => 1]);
|
||||
|
||||
// if ($mission->category_id == 2) {
|
||||
// $rpc = new OperatorController;
|
||||
// $rpc->store($mission);
|
||||
// }
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
MissionViolation::query()->create([
|
||||
'machine_id'=> CMMSMachine::query()->where('machine_code', '=', $request->machine_code)->value('id'),
|
||||
'machine_code'=> $request->machine_code,
|
||||
'type'=> MissionViolationType::KHOROJ_BEDONE_MOGAVEZ->value,
|
||||
'status' => MissionViolationStatus::BEDON_EGHDAM->value,
|
||||
'request_date' => now(),
|
||||
'km' => $request->km,
|
||||
'gps' => 0,
|
||||
'province_id' => $user->province_id,
|
||||
'province_name' => $user->province_fa,
|
||||
'city_id' => $user->city_id,
|
||||
'city_name' => $user->city_fa,
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
|
||||
}
|
||||
public function show(MissionViolation $violation): JsonResponse
|
||||
{
|
||||
return $this->successResponse($violation);
|
||||
}
|
||||
|
||||
public function update(UpdateRequest $request, MissionViolation $violation): JsonResponse
|
||||
{
|
||||
$violation->update([
|
||||
'enter_time' => $request->enter_time,
|
||||
'exit_time' => $request->exit_time,
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function destroy(MissionViolation $violation): JsonResponse
|
||||
{
|
||||
$violation->delete();
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,15 @@ class RoadMaintenanceStationController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
public function findByCity(Request $request): JsonResponse
|
||||
{
|
||||
$stations = RahdariPoint::query()
|
||||
->where('city_id', $request->query('city_id'))
|
||||
->get();
|
||||
|
||||
return $this->successResponse($stations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
@@ -226,6 +235,6 @@ class RoadMaintenanceStationController extends Controller
|
||||
|
||||
public function giveListToFms(): JsonResponse
|
||||
{
|
||||
return $this->successResponse(RahdariPoint::all(['id', 'name', 'lat', 'lng', 'area']));
|
||||
return $this->successResponse(RahdariPoint::all(['id', 'province_id', 'province_name', 'city_id', 'city_name', 'name', 'lat', 'lng', 'area']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class ProfileController extends Controller
|
||||
'degree' => $user->degree,
|
||||
'mobile' => $user->mobile,
|
||||
'province_id' => $user->province_id,
|
||||
'city_id' => $user->city_id,
|
||||
'avatar' => $user->avatarUrl(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ class RahdaranController extends Controller
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
{
|
||||
$province = Province::query()->find($request->input('province_id'));
|
||||
$edareh = EdarateShahri::query()->find($request->input('edareh_shahri_id'));
|
||||
|
||||
Rahdaran::query()->create([
|
||||
'name' => $request->name,
|
||||
@@ -48,8 +47,6 @@ class RahdaranController extends Controller
|
||||
'mobile' => $request->mobile,
|
||||
'province_id' => $province->id,
|
||||
'province_name' => $province->name_fa,
|
||||
'edareh_shahri_id' => $request->edareh_shahri_id,
|
||||
'edareh_shahri_name' => $edareh->name_fa,
|
||||
'is_driver' => $request->is_driver,
|
||||
]);
|
||||
|
||||
@@ -64,7 +61,6 @@ class RahdaranController extends Controller
|
||||
public function update(UpdateRequest $request, Rahdaran $rahdaran): JsonResponse
|
||||
{
|
||||
$province = Province::query()->find($request->input('province_id'));
|
||||
$edareh = EdarateShahri::query()->find($request->input('edareh_shahri_id'));
|
||||
|
||||
$rahdaran->update([
|
||||
'name' => $request->name,
|
||||
@@ -72,8 +68,6 @@ class RahdaranController extends Controller
|
||||
'mobile' => $request->mobile,
|
||||
'province_id' => $province->id,
|
||||
'province_name' => $province->name_fa,
|
||||
'edareh_shahri_id' => $request->edareh_shahri_id,
|
||||
'edareh_shahri_name' => $edareh->name_fa,
|
||||
'is_driver' => $request->is_driver,
|
||||
]);
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Dashboard\Harim\Detail;
|
||||
|
||||
use App\Enums\HarimStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class HarimSubmitInvoiceRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->harim->state_id == HarimStates::SABT_FISH->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,8 @@ class FinishRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'time' => 'required|date',
|
||||
'end_km' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ class StartRequest extends FormRequest
|
||||
return [
|
||||
'code' => 'required|string',
|
||||
'km' => 'required',
|
||||
'time' => 'required|date',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -25,16 +25,14 @@ class NoProcessRequest extends FormRequest
|
||||
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',
|
||||
'area' => 'array',
|
||||
'area.type' => 'string',
|
||||
'area.coordinates' => 'array',
|
||||
'category_id' => 'required|in:1,2,3',
|
||||
'explanation' => 'required|string',
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'rahdaran' => 'required|array',
|
||||
'rahdaran' => 'array',
|
||||
'rahdaran.*' => 'exists:rahdaran,id',
|
||||
'requested_machines' => 'required|array',
|
||||
'type' => 'required|in:1,2',
|
||||
|
||||
@@ -36,13 +36,13 @@ class AllocateRequest extends FormRequest
|
||||
return [
|
||||
function (Validator $validator) {
|
||||
$duplicateMission = Mission::query()->where('machine_id', '=', $this->machine_id)
|
||||
->whereBetween('start_date', [$this->mission->start_date, $this->mission->end_date])
|
||||
->orWhereBetween('end_date', [$this->mission->start_date, $this->mission->end_date])
|
||||
->where('start_date', '<=', $this->mission->end_date)
|
||||
->where('end_date', '>=', $this->mission->start_date)
|
||||
->exists();
|
||||
|
||||
if ($duplicateMission) {
|
||||
$validator->errors()->add(
|
||||
'machine',
|
||||
'machine_id',
|
||||
'خودروی مورد نظر در این زمان رزرو می باشد'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ class DeallocateRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->mission->edare_shahri_id == auth()->user()->edarate_shahri_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value;
|
||||
return $this->mission->edare_shahri_id == auth()->user()->edarate_shahri_id &&
|
||||
in_array($this->mission->state_id, [MissionStates::REQUEST_CREATED->value, MissionStates::PENDING_CONFIRMATION->value]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
48
app/Http/Requests/V3/Mission/Violation/NoProcessRequest.php
Normal file
48
app/Http/Requests/V3/Mission/Violation/NoProcessRequest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\Violation;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class NoProcessRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->violation->status === 0 && $this->violation->type === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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',
|
||||
'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' => 'array',
|
||||
'area.type' => 'string',
|
||||
'area.coordinates' => 'array',
|
||||
'category_id' => 'required|in:1,2,3',
|
||||
'explanation' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'end_date.before' => 'تاریخ پایان باید قبل از زمان فعلی باشد.',
|
||||
'end_date.after' => 'تاریخ پایان نباید قبل از تاریخ شروع باشد.',
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/V3/Mission/Violation/StoreRequest.php
Normal file
32
app/Http/Requests/V3/Mission/Violation/StoreRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\Violation;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
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, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'machine_code' => 'required',
|
||||
'km'=> 'string',
|
||||
];
|
||||
}
|
||||
}
|
||||
33
app/Http/Requests/V3/Mission/Violation/UpdateRequest.php
Normal file
33
app/Http/Requests/V3/Mission/Violation/UpdateRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\Mission\Violation;
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
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 [
|
||||
'exit_time' => 'date',
|
||||
'enter_time' => 'date',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ class StoreRequest extends FormRequest
|
||||
'code' => 'required|string|max:255|unique:rahdaran,code',
|
||||
'mobile' => 'required|digits:11|regex:/^09\d{9}$/',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edareh_shahri_id' => 'required|exists:edarate_shahri,id',
|
||||
'is_driver' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ class UpdateRequest extends FormRequest
|
||||
'code' => ['required', 'string', Rule::unique('rahdaran', 'code')->ignore($this->rahdaran->id)],
|
||||
'mobile' => 'required|digits:11|regex:/^09\d{9}$/',
|
||||
'province_id' => 'required|exists:provinces,id',
|
||||
'edareh_shahri_id' => 'required|exists:edarate_shahri,id',
|
||||
'is_driver' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -28,15 +28,7 @@ class SendDataToFMSListener implements ShouldQueue
|
||||
{
|
||||
$mission = $event->mission;
|
||||
|
||||
$this->getErrorRateService->setInputParameters([
|
||||
'username' => config('fms_web_services.Error_Rate.username'),
|
||||
'password' => config('fms_web_services.Error_Rate.password'),
|
||||
'missionArea' => $mission->getMissionAreaForFms(),
|
||||
'missionStartDT' => $mission->start_time->format('Y-m-d\TH:i:s'),
|
||||
'missionEndDT' => $mission->finish_time->format('Y-m-d\TH:i:s'),
|
||||
'machineCode' => $mission->machine_code,
|
||||
'areaType' => $mission->area['type'] === 'polygon' ? 1 : 2,
|
||||
]);
|
||||
$this->getErrorRateService->setInputParameters($mission);
|
||||
|
||||
$responseData = $this->getErrorRateService->run();
|
||||
|
||||
|
||||
@@ -4,14 +4,21 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class MissionViolation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded =[];
|
||||
|
||||
public function mission()
|
||||
public function mission(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Mission::class);
|
||||
}
|
||||
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(CMMSMachine::class, 'machine_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class DailyMovingMachinesService
|
||||
$inputData = $this->makeInputParameters();
|
||||
|
||||
return Http::withBody($inputData)
|
||||
->timeout(120)
|
||||
->throw()
|
||||
->withoutVerifying()
|
||||
->post($this->url)
|
||||
|
||||
67
app/Services/Cartables/Harim/HarimPaymentService.php
Normal file
67
app/Services/Cartables/Harim/HarimPaymentService.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Cartables\Harim;
|
||||
|
||||
use App\Exceptions\ProhibitedAction;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
||||
class HarimPaymentService
|
||||
{
|
||||
/**
|
||||
* @throws ProhibitedAction
|
||||
*/
|
||||
public function invoiceBillApi($national_id, $payment_amount): int|string
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
try {
|
||||
$payload = array(
|
||||
'username' => config('harim_web_services.Harim_Payment.username'),
|
||||
'password' => config('harim_web_services.Harim_Payment.PASSWORD'),
|
||||
'amount' => $payment_amount,
|
||||
'serial' => config('harim_web_services.Harim_Payment.serial'),
|
||||
'type' => 1,
|
||||
'instanceid' => config('harim_web_services.Harim_Payment.instanceid'),
|
||||
'ownerid' => $national_id,
|
||||
'calculationBox' => "{\"rows\":[{\"amount\":" . $payment_amount . ",\"code\":\"7070011026200593\"}]}"
|
||||
);
|
||||
|
||||
$response = Http::withBody(http_build_query($payload))
|
||||
->throw()
|
||||
->withoutVerifying()
|
||||
->post(config('harim_web_services.Harim_Payment.url'));
|
||||
|
||||
return $response->body();
|
||||
|
||||
}
|
||||
catch (\Throwable $th) {
|
||||
throw new ProhibitedAction('خطا در ارتباط با سرویس پرداخت');
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function callPaymentStatusBillApi($bill_code)
|
||||
{
|
||||
if (App::isProduction())
|
||||
{
|
||||
try {
|
||||
$username = config('harim_web_services.Harim_Payment.username');
|
||||
$password = config('harim_web_services.Harim_Payment.PASSWORD');
|
||||
$url = config('harim_web_services.Harim_Payment.url');
|
||||
|
||||
$result = "{$url}/{$username}/{$password}/{$bill_code}";
|
||||
|
||||
return Http::get($result)
|
||||
->throw()
|
||||
->body();
|
||||
|
||||
}catch (\Throwable $th) {
|
||||
throw new ProhibitedAction('خطا در دریافت');
|
||||
}
|
||||
}
|
||||
return json_encode(['isPayed' => 1]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
|
||||
use App\Enums\MissionStates;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
@@ -16,11 +15,19 @@ class ControlUnitService
|
||||
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$query = Mission::query()
|
||||
->whereIn('state_id', [
|
||||
MissionStates::PENDING_CONFIRMATION->value, MissionStates::START_MISSION->value
|
||||
])
|
||||
->where('edare_shahri_id', '=', Auth::user()->edarate_shahri_id);
|
||||
$user = Auth::user();
|
||||
|
||||
$query = Mission::query()->whereIn('state_id', [
|
||||
MissionStates::PENDING_CONFIRMATION->value, MissionStates::START_MISSION->value,
|
||||
]);
|
||||
|
||||
if ($user->hasPermissionTo('manage-control-unit-station')) {
|
||||
$query->where('station_id', '=', $user->station_id);
|
||||
} elseif ($user->hasPermissionTo('manage-control-unit-city')) {
|
||||
$query->where('city_id', '=', $user->city_id);
|
||||
} elseif ($user->hasPermissionTo('manage-control-unit-province')) {
|
||||
$query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
@@ -31,8 +38,8 @@ class ControlUnitService
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||
'code', 'category_id', 'category_name', 'explanation'
|
||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,17 +5,29 @@ namespace App\Services\Cartables\Mission;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Models\MissionViolation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DailyMoveMachineService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$query = MissionViolation::query()->with('machine:id,car_name');
|
||||
|
||||
if ($user->hasPermissionTo('manage-violation-station')) {
|
||||
$query->whereRelation('machine', 'station_id', '=', $user->station_id);
|
||||
} elseif ($user->hasPermissionTo('manage-violation-city')) {
|
||||
$query->whereRelation('machine', 'city_id', '=', $user->city_id);
|
||||
} elseif ($user->hasPermissionTo('manage-violation-province')) {
|
||||
$query->whereRelation('machine', 'province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
MissionViolation::query(),
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: ['id', 'mission_id', 'machine_code', 'request_date', 'type', 'exit_time', 'enter_time']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
155
app/Services/Cartables/Mission/Report/ReportTradodService.php
Normal file
155
app/Services/Cartables/Mission/Report/ReportTradodService.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?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 ReportTradodService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$query = MissionViolation::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
}
|
||||
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
FROM(
|
||||
SELECT
|
||||
'کل کشور' AS province_name,
|
||||
-1 AS province_id,
|
||||
COUNT(m.id) AS total,
|
||||
COALESCE(SUM(m.mission_duration != m.in_area_duration), 0) AS khareg_mahdode,
|
||||
COALESCE(SUM(m.in_area_duration)/3600, 0) AS gps,
|
||||
COALESCE(SUM(m.mission_duration)/3600, 0) AS durations,
|
||||
COALESCE(SUM(CASE WHEN m.type = 1 THEN 1 ELSE 0 END), 0) AS far_h,
|
||||
COALESCE(SUM(CASE WHEN m.type = 2 THEN 1 ELSE 0 END), 0) AS far_d,
|
||||
COALESCE(SUM(CASE WHEN m.type = 3 THEN 1 ELSE 0 END), 0) AS un_far_h,
|
||||
COALESCE(SUM(CASE WHEN m.type = 4 THEN 1 ELSE 0 END), 0) AS un_far_d,
|
||||
COALESCE(SUM(CASE WHEN m.category_id = 1 THEN 1 ELSE 0 END), 0) AS item,
|
||||
COALESCE(SUM(CASE WHEN m.category_id = 2 THEN 1 ELSE 0 END), 0) AS patrol
|
||||
FROM missions m
|
||||
WHERE m.created_at >= :from_m_1
|
||||
AND m.created_at <= :to_m_1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
p.name_fa AS province_name,
|
||||
p.id AS province_id,
|
||||
COUNT(m.id) AS total,
|
||||
COALESCE(SUM(m.mission_duration != m.in_area_duration), 0) AS khareg_mahdode,
|
||||
COALESCE(SUM(m.in_area_duration)/3600, 0) AS gps,
|
||||
COALESCE(SUM(m.mission_duration)/3600, 0) AS durations,
|
||||
COALESCE(SUM(CASE WHEN m.type = 1 THEN 1 ELSE 0 END), 0) AS far_h,
|
||||
COALESCE(SUM(CASE WHEN m.type = 2 THEN 1 ELSE 0 END), 0) AS far_d,
|
||||
COALESCE(SUM(CASE WHEN m.type = 3 THEN 1 ELSE 0 END), 0) AS un_far_h,
|
||||
COALESCE(SUM(CASE WHEN m.type = 4 THEN 1 ELSE 0 END), 0) AS un_far_d,
|
||||
COALESCE(SUM(CASE WHEN m.category_id = 1 THEN 1 ELSE 0 END), 0) AS item,
|
||||
COALESCE(SUM(CASE WHEN m.category_id = 2 THEN 1 ELSE 0 END), 0) AS patrol
|
||||
FROM provinces p
|
||||
LEFT JOIN missions m
|
||||
ON m.province_id = p.id
|
||||
AND m.created_at >= :from_m_2
|
||||
AND m.created_at <= :to_m_2
|
||||
GROUP BY p.id, p.name_fa
|
||||
) q
|
||||
ORDER BY
|
||||
CASE WHEN province_id = -1 THEN 0 ELSE 1 END,
|
||||
province_name;
|
||||
";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from_m_1' => $from,
|
||||
'to_m_1' => $to,
|
||||
'from_m_2' => $from,
|
||||
'to_m_2' => $to,
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request): array
|
||||
{
|
||||
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
FROM(
|
||||
SELECT
|
||||
'کل استان' AS city_name,
|
||||
-1 AS city_id,
|
||||
COUNT(m.id) AS total,
|
||||
COALESCE(SUM(m.mission_duration != m.in_area_duration), 0) AS khareg_mahdode,
|
||||
COALESCE(SUM(m.in_area_duration)/3600, 0) AS gps,
|
||||
COALESCE(SUM(m.mission_duration)/3600, 0) AS durations,
|
||||
COALESCE(SUM(m.type = 1), 0) AS far_h,
|
||||
COALESCE(SUM(m.type = 2), 0) AS far_d,
|
||||
COALESCE(SUM(m.type = 3), 0) AS un_far_h,
|
||||
COALESCE(SUM(m.type = 4), 0) AS un_far_d,
|
||||
COALESCE(SUM(m.category_id = 1), 0) AS item,
|
||||
COALESCE(SUM(m.category_id = 2), 0) AS patrol
|
||||
FROM missions m
|
||||
WHERE m.created_at >= :from_m_1
|
||||
AND m.created_at <= :to_m_1
|
||||
AND m.province_id = :province_id_1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
c.name_fa AS city_name,
|
||||
c.id AS city_id,
|
||||
COUNT(m.id) AS total,
|
||||
COALESCE(SUM(m.mission_duration != m.in_area_duration), 0) AS khareg_mahdode,
|
||||
COALESCE(SUM(m.in_area_duration)/3600, 0) AS gps,
|
||||
COALESCE(SUM(m.mission_duration)/3600, 0) AS durations,
|
||||
COALESCE(SUM(m.type = 1), 0) AS far_h,
|
||||
COALESCE(SUM(m.type = 2), 0) AS far_d,
|
||||
COALESCE(SUM(m.type = 3), 0) AS un_far_h,
|
||||
COALESCE(SUM(m.type = 4), 0) AS un_far_d,
|
||||
COALESCE(SUM(m.category_id = 1), 0) AS item,
|
||||
COALESCE(SUM(m.category_id = 2), 0) AS patrol
|
||||
FROM cities c
|
||||
LEFT JOIN missions m
|
||||
ON m.city_id = c.id
|
||||
AND m.created_at >= :from_m_2
|
||||
AND m.created_at <= :to_m_2
|
||||
WHERE c.province_id = :province_id_2
|
||||
AND (
|
||||
c.type_id = 1
|
||||
OR c.name_fa IN ('اداره ماشينآلات', 'اداره نقلیه')
|
||||
)
|
||||
GROUP BY c.id, c.name_fa
|
||||
) q
|
||||
ORDER BY
|
||||
CASE WHEN q.city_id = -1 THEN 0 ELSE 1 END,
|
||||
q.city_name;
|
||||
";
|
||||
|
||||
return DB::select($sql, [
|
||||
'province_id_1' => $provinceId,
|
||||
'from_m_1' => $from,
|
||||
'to_m_1' => $to,
|
||||
'province_id_2' => $provinceId,
|
||||
'from_m_2' => $from,
|
||||
'to_m_2' => $to,
|
||||
]);
|
||||
}
|
||||
}
|
||||
142
app/Services/Cartables/Mission/Report/ReportViolationService.php
Normal file
142
app/Services/Cartables/Mission/Report/ReportViolationService.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?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 ReportViolationService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$query = MissionViolation::query()->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
);
|
||||
}
|
||||
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
FROM(
|
||||
SELECT
|
||||
'کل کشور' AS province_name,
|
||||
-1 AS province_id,
|
||||
COUNT(mv.id) AS total,
|
||||
COALESCE(SUM(CASE WHEN mv.status = 1 THEN 1 ELSE 0 END), 0) as done,
|
||||
COALESCE(SUM(CASE WHEN mv.status = 0 THEN 1 ELSE 0 END), 0) as undone,
|
||||
COALESCE(SUM(CASE WHEN gps = 1 THEN 1 ELSE 0 END), 0) as gps,
|
||||
COALESCE(SUM(CASE WHEN gps = 0 THEN 1 ELSE 0 END), 0) as herasat,
|
||||
COALESCE(SUM(CASE WHEN gps = 1 THEN mileage ELSE 0 END),0) as mil_gps
|
||||
FROM mission_violations mv
|
||||
WHERE mv.created_at >= :from_mv_1
|
||||
AND mv.created_at <= :to_mv_1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
p.name_fa AS province_name,
|
||||
p.id AS province_id,
|
||||
COUNT(mv.id) AS total,
|
||||
COALESCE(SUM(CASE WHEN mv.status = 1 THEN 1 ELSE 0 END), 0) as done,
|
||||
COALESCE(SUM(CASE WHEN mv.status = 0 THEN 1 ELSE 0 END), 0) as undone,
|
||||
COALESCE(SUM(CASE WHEN gps = 1 THEN 1 ELSE 0 END), 0) as gps,
|
||||
COALESCE(SUM(CASE WHEN gps = 0 THEN 1 ELSE 0 END), 0) as herasat,
|
||||
COALESCE(SUM(CASE WHEN gps = 1 THEN mileage ELSE 0 END),0) as mil_gps
|
||||
FROM provinces p
|
||||
LEFT JOIN mission_violations mv
|
||||
ON mv.province_id = p.id
|
||||
AND mv.type = 1
|
||||
AND mv.created_at >= :from_mv_2
|
||||
AND mv.created_at <= :to_mv_2
|
||||
GROUP BY p.id, p.name_fa
|
||||
) q
|
||||
ORDER BY
|
||||
CASE WHEN province_id = -1 THEN 0 ELSE 1 END,
|
||||
province_name;
|
||||
";
|
||||
|
||||
return DB::select($sql, [
|
||||
'from_mv_1' => $from,
|
||||
'to_mv_1' => $to,
|
||||
'from_mv_2' => $from,
|
||||
'to_mv_2' => $to,
|
||||
]);
|
||||
}
|
||||
|
||||
public function provinceActivity(Request $request): array
|
||||
{
|
||||
$provinceId = $request->province_id ?? auth()->user()->province_id;
|
||||
$from = $request->from_date ?? today()->startOfDay();
|
||||
$to = $request->date_to ? Carbon::parse($request->date_to)->endOfDay() : today()->endOfDay();
|
||||
|
||||
$sql = "
|
||||
SELECT*
|
||||
FROM(
|
||||
SELECT
|
||||
'کل استان' AS city_name,
|
||||
-1 AS city_id,
|
||||
COUNT(mv.id) AS total,
|
||||
COALESCE(SUM(mv.status = 1), 0) AS done,
|
||||
COALESCE(SUM(mv.status = 0), 0) AS undone,
|
||||
COALESCE(SUM(mv.gps = 1), 0) AS gps,
|
||||
COALESCE(SUM(mv.gps = 0), 0) AS herasat,
|
||||
COALESCE(SUM(CASE WHEN mv.gps = 1 THEN mv.mileage ELSE 0 END), 0) AS mil_gps
|
||||
FROM mission_violations mv
|
||||
WHERE mv.type = 1
|
||||
AND mv.created_at >= :from_mv_1
|
||||
AND mv.created_at <= :to_mv_1
|
||||
AND mv.province_id = :province_id_1
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
c.name_fa AS city_name,
|
||||
c.id AS city_id,
|
||||
COUNT(mv.id) AS total,
|
||||
COALESCE(SUM(mv.status = 1), 0) AS done,
|
||||
COALESCE(SUM(mv.status = 0), 0) AS undone,
|
||||
COALESCE(SUM(mv.gps = 1), 0) AS gps,
|
||||
COALESCE(SUM(mv.gps = 0), 0) AS herasat,
|
||||
COALESCE(SUM(CASE WHEN mv.gps = 1 THEN mv.mileage ELSE 0 END), 0) AS mil_gps
|
||||
FROM cities c
|
||||
LEFT JOIN mission_violations mv
|
||||
ON mv.city_id = c.id
|
||||
AND mv.type = 1
|
||||
AND mv.created_at >= :from_mv_2
|
||||
AND mv.created_at <= :to_mv_2
|
||||
WHERE c.province_id = :province_id_2
|
||||
AND (
|
||||
c.type_id = 1
|
||||
OR c.name_fa IN ('اداره ماشينآلات', 'اداره نقلیه')
|
||||
)
|
||||
GROUP BY c.id, c.name_fa
|
||||
) q
|
||||
ORDER BY
|
||||
CASE WHEN q.city_id = -1 THEN 0 ELSE 1 END,
|
||||
q.city_name;
|
||||
";
|
||||
|
||||
return DB::select($sql, [
|
||||
'province_id_1' => $provinceId,
|
||||
'from_mv_1' => $from,
|
||||
'to_mv_1' => $to,
|
||||
'province_id_2' => $provinceId,
|
||||
'from_mv_2' => $from,
|
||||
'to_mv_2' => $to,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services\Cartables\Mission;
|
||||
|
||||
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Traits\ApiResponse;
|
||||
use App\Models\Mission;
|
||||
@@ -17,10 +16,11 @@ class RequestPortalService
|
||||
$user = auth()->user();
|
||||
$query = Mission::query();
|
||||
|
||||
if ($user->hasPermissionTo('manage-request-portal-city')) {
|
||||
$query->where('edare_shahri_id', '=', $user->edarate_shahri_id);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('manage-request-portal-province')) {
|
||||
if ($user->hasPermissionTo('manage-request-portal-station')) {
|
||||
$query->where('station_id', '=', $user->station_id);
|
||||
} elseif ($user->hasPermissionTo('manage-request-portal-city')) {
|
||||
$query->where('city_id', '=', $user->city_id);
|
||||
} elseif ($user->hasPermissionTo('manage-request-portal-province')) {
|
||||
$query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ class RequestPortalService
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||
'code', 'category_id', 'category_name', 'explanation'
|
||||
'code', 'category_id', 'category_name', 'explanation', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,17 @@ class TransportationUnitService
|
||||
{
|
||||
public function dataTable(Request $request)
|
||||
{
|
||||
$query = Mission::query()
|
||||
->whereIn('state_id', [MissionStates::REQUEST_CREATED->value, MissionStates::PENDING_CONFIRMATION->value])
|
||||
->where('edare_shahri_id', '=', Auth::user()->edarate_shahri_id);
|
||||
$user = Auth::user();
|
||||
|
||||
$query = Mission::query()->whereIn('state_id', [MissionStates::REQUEST_CREATED->value, MissionStates::PENDING_CONFIRMATION->value]);
|
||||
|
||||
if ($user->hasPermissionTo('manage-transportation-unit-station')) {
|
||||
$query->where('station_id', '=', $user->station_id);
|
||||
} elseif ($user->hasPermissionTo('manage-transportation-unit-city')) {
|
||||
$query->where('city_id', '=', $user->city_id);
|
||||
} elseif ($user->hasPermissionTo('manage-transportation-unit-province')) {
|
||||
$query->where('province_id', '=', $user->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
@@ -25,8 +33,8 @@ class TransportationUnitService
|
||||
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
|
||||
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
|
||||
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
|
||||
'code', 'category_id', 'category_name', 'explanation', 'km'
|
||||
'code', 'category_id', 'category_name', 'explanation', 'km', 'city_id', 'city_name', 'province_id', 'station_name',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services\FMS;
|
||||
|
||||
use App\Models\Mission;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -18,9 +19,17 @@ class GetErrorRateService
|
||||
$this->channelName = 'fms_error_rate';
|
||||
}
|
||||
|
||||
public function setInputParameters(array $inputs): void
|
||||
public function setInputParameters(Mission $mission): void
|
||||
{
|
||||
$this->inputParameters = $inputs;
|
||||
$this->inputParameters = [
|
||||
'username' => config('fms_web_services.Error_Rate.username'),
|
||||
'password' => config('fms_web_services.Error_Rate.password'),
|
||||
'missionArea' => $mission->getMissionAreaForFms(),
|
||||
'missionStartDT' => $mission->start_time->format('Y-m-d\TH:i:s'),
|
||||
'missionEndDT' => $mission->finish_time->format('Y-m-d\TH:i:s'),
|
||||
'machineCode' => $mission->machine_code,
|
||||
'areaType' => $mission->area['type'] === 'polygon' ? 1 : 2,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ class PaymentService
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "http://payment.rmto.ir/acc/rest/payid/gen");
|
||||
curl_setopt($ch, CURLOPT_URL, "https://payment.rmto.ir/acc/rest/payid/gen");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
@@ -59,7 +59,7 @@ class PaymentService
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "http://payment.rmto.ir/acc/rest/payid/track2/" . env("PAYMENT_USERNAME") . "/" . env("PAYMENT_PASSWORD") . "/" . $bill_code);
|
||||
curl_setopt($ch, CURLOPT_URL, "https://payment.rmto.ir/acc/rest/payid/track2/" . env("PAYMENT_USERNAME") . "/" . env("PAYMENT_PASSWORD") . "/" . $bill_code);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
// curl_setopt($ch, CURLOPT_POST, true);
|
||||
// curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
|
||||
|
||||
@@ -38,5 +38,10 @@ return [
|
||||
|
||||
'Harim_Payment' => [
|
||||
'fee' => env('HARIM_AMOUNT_FEE'),
|
||||
'username' => env('HARIM_ENCRYPTION_USERNAME'),
|
||||
'password' => env('HARIM_ENCRYPTION_PASSWORD'),
|
||||
'url' => env('HARIM_ENCRYPTION_URL'),
|
||||
'serial' => env('HARIM_ENCRYPTION_SERIAL'),
|
||||
'instanceid' => env('HARIM_ENCRYPTION_INSTANCE_ID'),
|
||||
]
|
||||
];
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
Schema::create('rahdaran', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('code');
|
||||
$table->string('code')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
||||
$table->string('driver_name')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('cmms_machines', function (Blueprint $table) {
|
||||
$table->dropColumn('driver_name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->smallInteger('status')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dropColumn('status');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('missions', function (Blueprint $table) {
|
||||
$table->unsignedSmallInteger('station_id')->nullable();
|
||||
$table->unsignedSmallInteger('city_id')->nullable();
|
||||
$table->string('station_name')->nullable();
|
||||
$table->string('city_name')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('missions', function (Blueprint $table) {
|
||||
$table->dropColumn(['station_id', 'city_id', 'station_name', 'city_name']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->unsignedSmallInteger('station_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('station_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('mission_violations', function (Blueprint $table) {
|
||||
$table->foreignId('machine_id')->nullable()->constrained('cmms_machines');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dropForeign('mission_violations_machine_id_foreign');
|
||||
$table->dropColumn('machine_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('mission_violations', function (Blueprint $table) {
|
||||
$table->string('km')->nullable();
|
||||
$table->unsignedTinyInteger('gps')->default(1);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dropColumn(['km', 'gps']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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('mission_violations', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('province_id')->nullable();
|
||||
$table->string('province_name')->nullable();
|
||||
$table->unsignedSmallInteger('city_id')->nullable();
|
||||
$table->string('city_name')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dropColumn(['province_id', 'province_name', 'city_id', 'city_name']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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('missions', function (Blueprint $table) {
|
||||
$table->string('end_km')->nullable();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('missions', function (Blueprint $table) {
|
||||
$table->dropColumn('end_km');
|
||||
});
|
||||
}
|
||||
};
|
||||
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:10.11.8
|
||||
container_name: rms-mariadb
|
||||
ports:
|
||||
- "3307:3306"
|
||||
environment:
|
||||
MARIADB_DATABASE: ${DB_DATABASE}
|
||||
MARIADB_USER: ${DB_USERNAME}
|
||||
MARIADB_PASSWORD: ${DB_PASSWORD}
|
||||
MARIADB_ROOT_PASSWORD: ${DB_PASSWORD}
|
||||
volumes:
|
||||
- /var/www/rmsdb:/var/lib/mysql
|
||||
networks:
|
||||
- rms
|
||||
|
||||
backend:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: rms
|
||||
ports:
|
||||
- "8003:80"
|
||||
volumes:
|
||||
- ./:/var/www/rms
|
||||
depends_on:
|
||||
- mariadb
|
||||
networks:
|
||||
- rms
|
||||
|
||||
networks:
|
||||
rms:
|
||||
driver: bridge
|
||||
@@ -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);
|
||||
|
||||
@@ -178,6 +178,16 @@
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
@canany(['manage-request-portal-city', 'manage-request-portal-province', 'manage-request-portal-country', 'manage-request-portal-station',
|
||||
'manage-transportation-unit-city', 'manage-transportation-unit-province', 'manage-transportation-unit-country', 'manage-transportation-unit-station',
|
||||
'manage-control-unit-city', 'manage-control-unit-province', 'manage-control-unit-country', 'manage-control-unit-station',
|
||||
])
|
||||
<div class="user-actions-topic d-flex align-items-center justify-content-between p-2 text-white rounded mt-2">
|
||||
<a href="/v3/dashboard/" class="">
|
||||
<div><i class="fas fa-shipping-fast mx-2"></i>ماموریت</div>
|
||||
</a>
|
||||
</div>
|
||||
@endcan
|
||||
@canany(['add-road-patrol', 'show-road-patrol-supervise-cartable', 'show-road-patrol-supervise-cartable-province'])
|
||||
<div class='user-actions-box pt-2'>
|
||||
<div class="user-actions-topic d-flex align-items-center justify-content-between p-2 text-white rounded">
|
||||
|
||||
@@ -125,11 +125,13 @@
|
||||
$(document).ready(function() {
|
||||
$(".letter-body").find("#accident_date").text(moment(jsonServer.data.accident_date).format(
|
||||
"jYYYY/jMM/jDD"));
|
||||
const plaque = jsonServer.data.plaque.split("-");
|
||||
$("#plaque1").text(plaque[0]);
|
||||
$("#plaque2").text(plaque[1]);
|
||||
$("#plaque3").text(plaque[2]);
|
||||
$("#plaque4").text(plaque[3]);
|
||||
const plaque = jsonServer?.data?.plaque?.split("-");
|
||||
if (plaque) {
|
||||
$("#plaque1").text(plaque[0]);
|
||||
$("#plaque2").text(plaque[1]);
|
||||
$("#plaque3").text(plaque[2]);
|
||||
$("#plaque4").text(plaque[3]);
|
||||
}
|
||||
let row_counter;
|
||||
let i;
|
||||
for (i = 0; i < damages.length; i++) {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<!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="7"
|
||||
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="7"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="7"
|
||||
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>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
ثبت GPS</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;">
|
||||
کیلومتر GPS
|
||||
</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['total'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['egdam_shode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedone_egdam'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_gps'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_herasat'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['mil_gps'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa">
|
||||
|
||||
<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="7"
|
||||
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="7"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="7"
|
||||
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>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
ثبت GPS</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;">
|
||||
مسافت ثبت شده GPS
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($rows as $item)
|
||||
<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['egdam_shode'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedone_egdam'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_gps'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['sabt_herasat'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['mil_gps'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,110 @@
|
||||
<!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="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="11"
|
||||
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;">
|
||||
جمع ساعات GPS
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
جمع ساعات ماموریت </th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
تردد خارج از محدوده
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
با فرآیند ساعتی
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
با فرآیند روزانه </th>
|
||||
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
بدون فرآیند ساعتی
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
بدون فرآیند روزانه
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
فعالیت روزانه </th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
گشت راهداری
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<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['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['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>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_rozaneh'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['item'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['patrol'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,110 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa">
|
||||
|
||||
<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="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right: 1px solid black;font-weight:bolder;">
|
||||
تاریخ دریافت گزارش: {{ verta()->now()->format('Y/m/d H:i') }}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="11"
|
||||
style="background-color: #DAEEF3;text-align: center;border-right:1px solid black;font-weight:bolder;">
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="11"
|
||||
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;">
|
||||
جمع ساعات GPS
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
جمع ساعات ماموریت </th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
تردد خارج از محدوده
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
با فرآیند ساعتی
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
با فرآیند روزانه </th>
|
||||
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
بدون فرآیند ساعتی
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
بدون فرآیند روزانه
|
||||
</th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
فعالیت روزانه </th>
|
||||
<th rowspan="1"
|
||||
style="text-align: center;border: 1px solid black;background-color: #EBF1DE;font-weight: bold;">
|
||||
گشت راهداری
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach ($rows as $item)
|
||||
<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['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>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['bedon_bafarayand_rozaneh'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['item'] ?? '-' }}</td>
|
||||
<td style="border: 1px solid black;text-align: center;">{{ $item['patrol'] ?? '-' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,6 +12,14 @@
|
||||
@can('create-road-item')
|
||||
<a href="{{ route('v2.road_items.operator.create') }}" class="btn btn-default btn-block my-2">ثبت فعالیت روزانه</a>
|
||||
@endcan
|
||||
@canany(['manage-request-portal-city', 'manage-request-portal-province', 'manage-request-portal-country', 'manage-request-portal-station',
|
||||
'manage-transportation-unit-city', 'manage-transportation-unit-province', 'manage-transportation-unit-country', 'manage-transportation-unit-station',
|
||||
'manage-control-unit-city', 'manage-control-unit-province', 'manage-control-unit-country', 'manage-control-unit-station',
|
||||
])
|
||||
<a href="/v3/dashboard/" class="btn btn-default btn-block my-2">
|
||||
ماموریت
|
||||
</a>
|
||||
@endcan
|
||||
@can('add-road-patrol')
|
||||
<a href="{{ route('v2.road_patrols.operator.create') }}" class="btn btn-default btn-block my-2">ثبت گشت راهداری و ترابری</a>
|
||||
@endcan
|
||||
@@ -19,7 +27,7 @@
|
||||
<a href="{{ route('v2.road_observations.pending_view') }}" class="btn btn-default btn-block my-2">رسیدگی به شکایات واکنش سریع</a>
|
||||
@endcan
|
||||
@can('add-safety-and-privacy')
|
||||
<a href="{{ route('v2.safety_and_privacy.operator.create') }}" class="btn btn-default btn-block my-2">ثبت نگهداری حریم راه</a>
|
||||
<a href="/v3/dashboard/road-safety/operator" class="btn btn-default btn-block my-2">ثبت نگهداری حریم راه</a>
|
||||
@endcan
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<button id="add_patrol" class="positive-cta float-left my-2" disabled>ثبت گشت</button>
|
||||
<!-- all modals -->
|
||||
<!-- otp token -->
|
||||
<div class="modal fade" id="otpToken_modal" tabindex="-1" role="dialog">
|
||||
{{-- <div class="modal fade" id="otpToken_modal" tabindex="-1" role="dialog">--}}
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header align-items-center">
|
||||
@@ -69,7 +69,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- </div>--}}
|
||||
<!-- end otp token -->
|
||||
<!-- user info -->
|
||||
<div class="modal fade" id="userInfo_modal" tabindex="-1" role="dialog">
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
<div class="col-12 col-md-4 px-2 form-group">
|
||||
<label for="user_phone">شماره مامور:</label>
|
||||
<input type="number" class="form-control clean-input value-important" readonly autocomplete="off" name="user-phone" id="user_phone">
|
||||
<input type="number" class="form-control clean-input value-important" autocomplete="off" name="user-phone" id="user_phone">
|
||||
</div>
|
||||
<div class="col-12 col-md-4 px-2 form-group">
|
||||
<label for="plaque-number">شماره انتظامی وسیله نقلیه</label>
|
||||
|
||||
@@ -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,8 @@ 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\ReportTradodController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\Report\ReportViolationController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\RequestPortalController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\TransportationUnitController;
|
||||
use App\Http\Controllers\V3\Dashboard\Mission\ViolationManagementController;
|
||||
@@ -473,6 +475,7 @@ Route::prefix('road_maintenance_station')
|
||||
Route::get('/', 'index')->name('index')->middleware('permission:show-tollhouse|show-tollhouse-province');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::get('/map', 'map')->name('map');
|
||||
Route::get('/search_by_city', 'findByCity')->name('findByCity');
|
||||
Route::get('/images/{rahdariPoint}', 'images')->name('images');
|
||||
Route::get('/{rahdariPoint}', 'show')->name('show')->middleware('permission:show-tollhouse|show-tollhouse-province');
|
||||
Route::post('/{rahdariPoint}', 'update')->name('update')->middleware('permission:edit-tollhouse|edit-tollhouse-province');
|
||||
@@ -484,7 +487,7 @@ Route::prefix('missions')
|
||||
->group(function () {
|
||||
Route::name('requestPortal.')
|
||||
->prefix('request_portal')
|
||||
->middleware('permission:manage-request-portal-city|manage-request-portal-province|manage-request-portal-country')
|
||||
->middleware('permission:manage-request-portal-city|manage-request-portal-province|manage-request-portal-country|manage-request-portal-station')
|
||||
->controller(RequestPortalController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
@@ -497,7 +500,7 @@ Route::prefix('missions')
|
||||
});
|
||||
Route::name('transportationUnit.')
|
||||
->prefix('transportation_unit')
|
||||
->middleware('permission:manage-transportation-unit')
|
||||
->middleware('permission:manage-transportation-unit-city|manage-transportation-unit-province|manage-transportation-unit-country|manage-transportation-unit-station')
|
||||
->controller(TransportationUnitController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
@@ -507,7 +510,7 @@ Route::prefix('missions')
|
||||
});
|
||||
Route::name('controlUnit.')
|
||||
->prefix('control_unit')
|
||||
->middleware('permission:manage-control-unit')
|
||||
->middleware('permission:manage-control-unit-city|manage-control-unit-province|manage-control-unit-country|manage-control-unit-station')
|
||||
->controller(ControlUnitController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
@@ -523,9 +526,35 @@ Route::prefix('missions')
|
||||
});
|
||||
Route::prefix('violation_management')
|
||||
->name('violationManagement.')
|
||||
->middleware('permission:manage-violation-city|manage-violation-province|manage-violation-country|manage-violation-station')
|
||||
->controller(ViolationManagementController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::post('/no_process/{violation}','noProcess')->name('noProcess');
|
||||
Route::get('/{violation}', 'show')->name('show');
|
||||
Route::post('/{violation}', 'update')->name('update');
|
||||
Route::delete('/{violation}', 'destroy')->name('destroy');
|
||||
});
|
||||
Route::prefix('report_violation')
|
||||
->name('reportsViolation.')
|
||||
->middleware(['permission:mission-report-province|permission:mission-report-country'])
|
||||
->controller(ReportViolationController::class)
|
||||
->group(function () {
|
||||
Route::get('/country_activity', 'countryActivity')->name('countryActivity');
|
||||
Route::get('/province_activity', 'provinceActivity')->name('provinceActivity');
|
||||
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||
});
|
||||
Route::prefix('report_taradod')
|
||||
->name('reportsTaradod.')
|
||||
->middleware(['permission:mission-report-province|permission:mission-report-country'])
|
||||
->controller(ReportTradodController::class)
|
||||
->group(function () {
|
||||
Route::get('/country_activity', 'countryActivity')->name('countryActivity');
|
||||
Route::get('/province_activity', 'provinceActivity')->name('provinceActivity');
|
||||
Route::get('/country_excel_activity', 'countryExcelActivity')->name('countryExcelActivity');
|
||||
Route::get('/province_excel_activity', 'provinceExcelActivity')->name('provinceExcelActivity');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user