create supervisor cartable
This commit is contained in:
19
app/Enums/SafetyAndPrivacyStatus.php
Normal file
19
app/Enums/SafetyAndPrivacyStatus.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
enum SafetyAndPrivacyStatus: int
|
||||
{
|
||||
case CONFIRM = 1;
|
||||
case REJECT = 2;
|
||||
|
||||
public static function name(int $state): string
|
||||
{
|
||||
$mapArray = [
|
||||
1 => 'تایید',
|
||||
2 => 'عدم تایید',
|
||||
];
|
||||
|
||||
return $mapArray[$state];
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,10 @@ class SafetyAndPrivacy extends Model
|
||||
'action_picture_document_upload_date',
|
||||
'axis_type_id',
|
||||
'axis_type_name',
|
||||
'action_date'
|
||||
'action_date',
|
||||
'status',
|
||||
'final_description',
|
||||
'is_finished'
|
||||
];
|
||||
|
||||
public $table = "safety_and_privacy";
|
||||
|
||||
@@ -18,7 +18,7 @@ class SafetyAndPrivacyTableService
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function dataTable(Request $request, $loadRelations = false)
|
||||
public function operatorDataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
@@ -50,6 +50,30 @@ class SafetyAndPrivacyTableService
|
||||
);
|
||||
}
|
||||
|
||||
public function supervisorDataTable(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$fields = ['id','lat','lon','province_id','province_fa','city_id','city_fa','edare_shahri_id','edare_shahri_name',
|
||||
'recognize_picture','action_picture','operator_id','operator_name','way_id','created_at','updated_at','step',
|
||||
'info_id','info_fa','activity_date_time', 'action_picture_document_upload_date', 'judiciary_document_upload_date',
|
||||
'step_fa', 'axis_type_id', 'axis_type_name', 'action_date'
|
||||
];
|
||||
|
||||
$query = SafetyAndPrivacy::query()->where([
|
||||
['province_id', '=', $user->province_id],
|
||||
['is_finished', '=', 1]
|
||||
]);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'],
|
||||
allowedSelects: $fields
|
||||
);
|
||||
}
|
||||
|
||||
public function countryActivity(Request $request): array
|
||||
{
|
||||
$activities = [];
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('safety_and_privacy', function (Blueprint $table) {
|
||||
$table->boolean('is_finished')->nullable();
|
||||
$table->integer('status')->nullable();
|
||||
$table->string('final_description')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('safety_and_privacy', function (Blueprint $table) {
|
||||
$table->dropColumn(['status', 'final_description', 'is_finished']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user