@@ -71,7 +71,7 @@ class ExtractGeometryForCities extends Command
|
|||||||
|
|
||||||
case 'Polygon':
|
case 'Polygon':
|
||||||
$wktCoords = collect($coordinates[0])
|
$wktCoords = collect($coordinates[0])
|
||||||
->map(fn($pair) => $pair[1] . ' ' . $pair[0])
|
->map(fn($pair) => $pair[0] . ' ' . $pair[1])
|
||||||
->implode(',');
|
->implode(',');
|
||||||
$wellKnownText = "POLYGON(($wktCoords))";
|
$wellKnownText = "POLYGON(($wktCoords))";
|
||||||
break;
|
break;
|
||||||
@@ -84,7 +84,7 @@ class ExtractGeometryForCities extends Command
|
|||||||
$ring[] = $ring[0];
|
$ring[] = $ring[0];
|
||||||
}
|
}
|
||||||
return collect($ring)
|
return collect($ring)
|
||||||
->map(fn($pair) => $pair[1] . ' ' . $pair[0])
|
->map(fn($pair) => $pair[0] . ' ' . $pair[1])
|
||||||
->implode(',');
|
->implode(',');
|
||||||
});
|
});
|
||||||
return '((' . $rings->implode('),(') . '))';
|
return '((' . $rings->implode('),(') . '))';
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Facades\Sms\Sms;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\V3\AccidentReceipt\ConfirmPaymentInfoRequest;
|
use App\Http\Requests\V3\AccidentReceipt\ConfirmPaymentInfoRequest;
|
||||||
use App\Http\Requests\V3\AccidentReceipt\StoreRequest;
|
use App\Http\Requests\V3\AccidentReceipt\StoreRequest;
|
||||||
|
use App\Http\Requests\V3\AccidentReceipt\SubmitInvoiceRequest;
|
||||||
use App\Http\Requests\V3\AccidentReceipt\UpdateRequest;
|
use App\Http\Requests\V3\AccidentReceipt\UpdateRequest;
|
||||||
use App\Http\Traits\ApiResponse;
|
use App\Http\Traits\ApiResponse;
|
||||||
use App\Models\Accident;
|
use App\Models\Accident;
|
||||||
@@ -280,7 +281,7 @@ class AccidentReceiptController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
*/
|
*/
|
||||||
public function submitInvoice(Accident $accident, PaymentService $paymentService): JsonResponse
|
public function submitInvoice(Accident $accident, PaymentService $paymentService, SubmitInvoiceRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$final_amount = $accident->driver_share_amount - ($accident->deposit_insurance_amount + $accident->deposit_daghi_amount);
|
$final_amount = $accident->driver_share_amount - ($accident->deposit_insurance_amount + $accident->deposit_daghi_amount);
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class PanjareVahedController extends Controller
|
|||||||
$city = City::query()
|
$city = City::query()
|
||||||
->whereRaw("ST_Contains(
|
->whereRaw("ST_Contains(
|
||||||
geometry,
|
geometry,
|
||||||
ST_GeomFromText('POINT($matches[2] $matches[1])', 4326))"
|
ST_GeomFromText('POINT($matches[1] $matches[2])', 4326))"
|
||||||
)
|
)
|
||||||
->firstOrFail(['id', 'name_fa', 'province_id']);
|
->firstOrFail(['id', 'name_fa', 'province_id']);
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ class PanjareVahedController extends Controller
|
|||||||
$city = City::query()
|
$city = City::query()
|
||||||
->orderByRaw("ST_Distance(
|
->orderByRaw("ST_Distance(
|
||||||
geometry,
|
geometry,
|
||||||
ST_GeomFromText('POINT($matches[2] $matches[1])', 4326)) ASC"
|
ST_GeomFromText('POINT($matches[1] $matches[2])', 4326)) ASC"
|
||||||
)
|
)
|
||||||
->first(['id', 'name_fa', 'province_id']);
|
->first(['id', 'name_fa', 'province_id']);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ class PanjareVahedController extends Controller
|
|||||||
'requested_organization' => $request->requested_organization,
|
'requested_organization' => $request->requested_organization,
|
||||||
'plan_group' => $request->plan_group,
|
'plan_group' => $request->plan_group,
|
||||||
'plan_title' => $request->plan_title,
|
'plan_title' => $request->plan_title,
|
||||||
'worksheet_id' => $request->worksheet_id,
|
'worksheet_id' => $request->worksheet,
|
||||||
'response_options' => json_encode($request->response_options),
|
'response_options' => json_encode($request->response_options),
|
||||||
'isic' => $request->isic,
|
'isic' => $request->isic,
|
||||||
'primary_area' => json_encode($request->primary_area),
|
'primary_area' => json_encode($request->primary_area),
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||||
|
|
||||||
|
use App\Enums\AccidentStates;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class SubmitInvoiceRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return $this->accident->status === AccidentStates::SABT_FISH->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ class GetAccessRoadRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'request_id' => 'required|integer|exists:harims,panjare_vahed_id',
|
'request_id' => 'required|exists:harims,panjare_vahed_id',
|
||||||
'access_road' => 'required|array',
|
'access_road' => 'required|array',
|
||||||
'access_road.type' => 'required|string',
|
'access_road.type' => 'required|string',
|
||||||
'access_road.coordinates' => 'required|array',
|
'access_road.coordinates' => 'required|array',
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class GetFinalPolygonsRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'request_id' => 'required|integer|exists:harims,panjare_vahed_id',
|
'request_id' => 'required|exists:harims,panjare_vahed_id',
|
||||||
'final_area' => 'required|array',
|
'final_area' => 'required|array',
|
||||||
'final_area.type' => 'required|string',
|
'final_area.type' => 'required|string',
|
||||||
'final_area.coordinates' => 'required|array',
|
'final_area.coordinates' => 'required|array',
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class GetRejectRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'request_id' => 'required|integer|exists:harims,panjare_vahed_id',
|
'request_id' => 'required|exists:harims,panjare_vahed_id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ class ReceiveNewRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'request_id' => 'required|integer|unique:harims,panjare_vahed_id',
|
'request_id' => 'required|unique:harims,panjare_vahed_id',
|
||||||
'national_id' => 'required',
|
'national_id' => 'required',
|
||||||
'phone_number' => 'required',
|
'phone_number' => 'required',
|
||||||
'request_date' => 'required',
|
'request_date' => 'required',
|
||||||
'requested_organization' => 'required|string',
|
'requested_organization' => 'required|string',
|
||||||
'plan_group' => 'required',
|
'plan_group' => 'required',
|
||||||
'plan_title' => 'required',
|
'plan_title' => 'required',
|
||||||
'worksheet_id' => 'required',
|
'worksheet' => 'required',
|
||||||
'response_options' => 'required',
|
'response_options' => 'required',
|
||||||
'isic' => 'required',
|
'isic' => 'required',
|
||||||
'primary_area' => 'required|array',
|
'primary_area' => 'required|array',
|
||||||
|
|||||||
Reference in New Issue
Block a user