This commit is contained in:
2025-11-26 09:46:17 +03:30
parent d47b23f368
commit 6a8d27b2c3
12 changed files with 102 additions and 18 deletions

View File

@@ -2,18 +2,30 @@
namespace App\Http\Controllers\V3\Dashboard\Harim;
use App\Exceptions\ProhibitedAction;
use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use App\Models\HarimState;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Throwable;
class DetailController extends Controller
{
use ApiResponse;
public function states(Request $request): JsonResponse
public function states(): JsonResponse
{
return $this->successResponse(HarimState::query()->get(['id', 'name']));
}
/**
* @throws Throwable
*/
public function histories(Harim $harim): JsonResponse
{
throw_if($this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id, new ProhibitedAction("unauthorized"));
return $this->successResponse($harim->histories()->get(['id', 'expert_description', 'action_name', 'previous_state_name']));
}
}

View File

@@ -26,6 +26,7 @@ use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Throwable;
class GeneralManagerController extends Controller
{
@@ -46,6 +47,9 @@ class GeneralManagerController extends Controller
return response()->json($data);
}
/**
* @throws Throwable
*/
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -62,6 +66,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -76,6 +83,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -90,6 +100,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -106,6 +119,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -122,6 +138,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -138,6 +157,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -159,6 +181,9 @@ class GeneralManagerController extends Controller
return $this->successResponse($harim->load('histories'));
}
/**
* @throws Throwable
*/
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -173,6 +198,9 @@ class GeneralManagerController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(

View File

@@ -19,6 +19,7 @@ use App\Models\Harim;
use App\Models\Province;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Throwable;
class HarimOfficeController extends Controller
{
@@ -39,6 +40,9 @@ class HarimOfficeController extends Controller
return response()->json($data);
}
/**
* @throws Throwable
*/
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -54,6 +58,9 @@ class HarimOfficeController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -68,6 +75,9 @@ class HarimOfficeController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function needRoadAccess(NeedRoadAccessRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -85,6 +95,9 @@ class HarimOfficeController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function withoutRoadAccess(WithoutRoadAccessRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -102,6 +115,9 @@ class HarimOfficeController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function fileAccepted(FileAcceptedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -117,6 +133,9 @@ class HarimOfficeController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function fileRejected(FileRejectedRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -134,7 +153,7 @@ class HarimOfficeController extends Controller
public function show(ShowRequest $request, Harim $harim): JsonResponse
{
return $this->successResponse($harim->load('histories'));
return $this->successResponse($harim);
}
public function referToCity(Request $request, Harim $harim)
@@ -148,6 +167,9 @@ class HarimOfficeController extends Controller
]);
}
/**
* @throws Throwable
*/
public function computingPayment(ComputingPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(

View File

@@ -12,6 +12,7 @@ use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Throwable;
class ProvinceOfficeController extends Controller
{
@@ -31,9 +32,11 @@ class ProvinceOfficeController extends Controller
);
return response()->json($data);
}
/**
* @throws Throwable
*/
public function feedback(FeedBackRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(

View File

@@ -17,6 +17,7 @@ use App\Http\Traits\ApiResponse;
use App\Models\Harim;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Throwable;
class TechnicalDeputyController extends Controller
{
@@ -37,6 +38,9 @@ class TechnicalDeputyController extends Controller
return response()->json($data);
}
/**
* @throws Throwable
*/
public function confirmRequest(ConfirmRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -51,6 +55,9 @@ class TechnicalDeputyController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -65,6 +72,9 @@ class TechnicalDeputyController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmRoadAccess(ConfirmRoadAccessRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -79,6 +89,9 @@ class TechnicalDeputyController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function referRoadAccess(ReferRoadAccessRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -95,9 +108,12 @@ class TechnicalDeputyController extends Controller
public function show(ShowRequest $request, Harim $harim): JsonResponse
{
return $this->successResponse($harim->load('histories'));
return $this->successResponse($harim);
}
/**
* @throws Throwable
*/
public function referPayment(ReferPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(
@@ -112,6 +128,9 @@ class TechnicalDeputyController extends Controller
return $this->successResponse();
}
/**
* @throws Throwable
*/
public function confirmPayment(ConfirmPaymentRequest $request, Harim $harim): JsonResponse
{
$harim->updateStateWithHistory(