remove exit station
This commit is contained in:
@@ -236,8 +236,8 @@ class RequestPortalController extends Controller
|
||||
{
|
||||
DB::transaction(function () use ($request, $violation) {
|
||||
|
||||
$start = Carbon::parse($violation->exit_station);
|
||||
$end = Carbon::parse($violation->enter_station);
|
||||
$start = Carbon::parse($violation->exit_time);
|
||||
$end = Carbon::parse($violation->enter_time);
|
||||
$type = $start->diffInMinutes($end) > 480 ? MissionTypes::NO_PROCESS_ROZANE->value : MissionTypes::NO_PROCESS_SAATY->value;
|
||||
$user = auth()->user();
|
||||
$zone = $request->zone;
|
||||
@@ -257,14 +257,14 @@ class RequestPortalController extends Controller
|
||||
'encoded_route' => $request->encoded_route,
|
||||
'type' => $type,
|
||||
'type_fa' => MissionTypes::name($type),
|
||||
'start_date' => $violation->exit_station,
|
||||
'end_date' => $violation->enter_station,
|
||||
'start_date' => $violation->exit_time,
|
||||
'end_date' => $violation->enter_time,
|
||||
'end_point' => $request->end_point,
|
||||
'category_id' => $request->category_id,
|
||||
'category_name' => MissionCategory::name($request->category_id),
|
||||
'start_time' => $violation->exit_station,
|
||||
'finish_time' => $violation->enter_station,
|
||||
'mission_duration' => strtotime($violation->enter_station) - strtotime($violation->exit_station),
|
||||
'start_time' => $violation->exit_time,
|
||||
'finish_time' => $violation->enter_time,
|
||||
'mission_duration' => strtotime($violation->enter_time) - strtotime($violation->exit_time),
|
||||
'state_id' => MissionStates::END_MISSION->value,
|
||||
'state_name' => MissionStates::END_MISSION->label(),
|
||||
'explanation' => $request->explanation,
|
||||
|
||||
@@ -54,7 +54,7 @@ class ViolationManagementController extends Controller
|
||||
'city_name' => $user->city_fa,
|
||||
'station_id' => $user->station_id,
|
||||
'station_name' => RahdariPoint::query()->find($user->station_id)->name,
|
||||
'exit_station' => $request->exit_station,
|
||||
'exit_time' => $request->exit_time,
|
||||
]);
|
||||
|
||||
return $this->successResponse();
|
||||
@@ -68,7 +68,7 @@ class ViolationManagementController extends Controller
|
||||
public function update(UpdateRequest $request, MissionViolation $violation): JsonResponse
|
||||
{
|
||||
$violation->update([
|
||||
'enter_station' => $request->enter_station,
|
||||
'enter_time' => $request->enter_time,
|
||||
'status' => MissionViolationStatus::BEDON_EGHDAM->value,
|
||||
]);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class StoreRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'exit_station' => 'required|date',
|
||||
'exit_time' => 'required|date',
|
||||
'machine_code' => 'required',
|
||||
'km'=> 'string',
|
||||
];
|
||||
|
||||
@@ -26,7 +26,7 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'enter_station' => 'required|date',
|
||||
'enter_time' => 'required|date',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class UpdateRequest extends FormRequest
|
||||
{
|
||||
return [
|
||||
function (Validator $validator) {
|
||||
if (strtotime($this->violation->exit_station) < strtotime($this->enter_station)) {
|
||||
if (strtotime($this->violation->exit_time) < strtotime($this->enter_time)) {
|
||||
$validator->errors()->add(
|
||||
'time',
|
||||
'زمان پایان ماموریت باید بعد از زمان شروع ماموریت باشد.'
|
||||
|
||||
@@ -12,8 +12,6 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dateTime('exit_station')->nullable();
|
||||
$table->dateTime('enter_station')->nullable();
|
||||
$table->unsignedInteger('station_id')->nullable();
|
||||
$table->string('station_name')->nullable();
|
||||
});
|
||||
@@ -25,7 +23,7 @@ return new class extends Migration
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('mission_violations', function (Blueprint $table) {
|
||||
$table->dropColumn(['exit_station', 'enter_station']);
|
||||
$table->dropColumn(['station_id', 'station_name']);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user