diff --git a/hesabixCore/src/Controller/ApprovalController.php b/hesabixCore/src/Controller/ApprovalController.php index 865451b..04c186a 100644 --- a/hesabixCore/src/Controller/ApprovalController.php +++ b/hesabixCore/src/Controller/ApprovalController.php @@ -1,5 +1,10 @@ json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$doc->getId()]]); } + /** + * ویرایش سند پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/documents/{docId}/update", + * summary="ویرایش سند پرونده واردات", + * tags={"Import Workflow Documents"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="docId", + * in="path", + * description="شناسه سند", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\MediaType( + * mediaType="multipart/form-data", + * @OA\Schema( + * @OA\Property(property="type", type="string", description="نوع سند"), + * @OA\Property(property="title", type="string", description="عنوان سند"), + * @OA\Property(property="documentNumber", type="string", description="شماره سند"), + * @OA\Property(property="issueDate", type="string", description="تاریخ صدور (جلالی)"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="file", type="string", format="binary", description="فایل سند") + * ) + * ) + * ), + * @OA\Response( + * response=200, + * description="سند با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه سند") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا سند یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/documents/{docId}/update', name: 'api_import_workflow_document_update', methods: ['PUT','POST'])] public function updateDocument(string $id, string $docId, Request $request, Access $access, EntityManagerInterface $entityManager, FileStorage $storage): JsonResponse { @@ -442,6 +742,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$doc->getId()]]); } + /** + * حذف سند پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/documents/{docId}/delete", + * summary="حذف سند پرونده واردات", + * tags={"Import Workflow Documents"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="docId", + * in="path", + * description="شناسه سند", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="سند با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا سند یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/documents/{docId}/delete', name: 'api_import_workflow_document_delete', methods: ['DELETE'])] public function deleteDocument(string $id, string $docId, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -461,6 +797,50 @@ class PlugImportWorkflowController extends AbstractController } // Stages CRUD + /** + * ایجاد مرحله جدید برای پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{id}/stages/create", + * summary="ایجاد مرحله جدید برای پرونده واردات", + * tags={"Import Workflow Stages"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"stage"}, + * @OA\Property(property="stage", type="string", description="نام مرحله"), + * @OA\Property(property="status", type="string", description="وضعیت مرحله", default="pending"), + * @OA\Property(property="startDate", type="string", description="تاریخ شروع (جلالی)"), + * @OA\Property(property="endDate", type="string", description="تاریخ پایان (جلالی)"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="assignedTo", type="string", description="واگذار شده به"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها") + * ) + * ), + * @OA\Response( + * response=200, + * description="مرحله با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه مرحله") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/stages/create', name: 'api_import_workflow_stage_create', methods: ['POST'])] public function createStage(string $id, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -485,6 +865,56 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$st->getId()]]); } + /** + * ویرایش مرحله پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/stages/{sid}/update", + * summary="ویرایش مرحله پرونده واردات", + * tags={"Import Workflow Stages"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="sid", + * in="path", + * description="شناسه مرحله", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="stage", type="string", description="نام مرحله"), + * @OA\Property(property="status", type="string", description="وضعیت مرحله"), + * @OA\Property(property="startDate", type="string", description="تاریخ شروع (جلالی)"), + * @OA\Property(property="endDate", type="string", description="تاریخ پایان (جلالی)"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="assignedTo", type="string", description="واگذار شده به"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها") + * ) + * ), + * @OA\Response( + * response=200, + * description="مرحله با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه مرحله") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا مرحله یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/stages/{sid}/update', name: 'api_import_workflow_stage_update', methods: ['PUT'])] public function updateStage(string $id, string $sid, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -510,6 +940,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$st->getId()]]); } + /** + * حذف مرحله پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/stages/{sid}/delete", + * summary="حذف مرحله پرونده واردات", + * tags={"Import Workflow Stages"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="sid", + * in="path", + * description="شناسه مرحله", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="مرحله با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا مرحله یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/stages/{sid}/delete', name: 'api_import_workflow_stage_delete', methods: ['DELETE'])] public function deleteStage(string $id, string $sid, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -529,6 +995,57 @@ class PlugImportWorkflowController extends AbstractController } // Shipping CRUD + /** + * ایجاد اطلاعات حمل برای پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{id}/shipping/create", + * summary="ایجاد اطلاعات حمل برای پرونده واردات", + * tags={"Import Workflow Shipping"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="type", type="string", description="نوع حمل", default="sea"), + * @OA\Property(property="containerNumber", type="string", description="شماره کانتینر"), + * @OA\Property(property="billOfLading", type="string", description="بارنامه"), + * @OA\Property(property="shippingDate", type="string", description="تاریخ حمل (جلالی)"), + * @OA\Property(property="arrivalDate", type="string", description="تاریخ ورود (جلالی)"), + * @OA\Property(property="unloadingDate", type="string", description="تاریخ تخلیه (جلالی)"), + * @OA\Property(property="shippingCompany", type="string", description="شرکت حمل"), + * @OA\Property(property="shippingCompanyPhone", type="string", description="تلفن شرکت حمل"), + * @OA\Property(property="shippingCompanyEmail", type="string", description="ایمیل شرکت حمل"), + * @OA\Property(property="originPort", type="string", description="بندر مبدا"), + * @OA\Property(property="destinationPort", type="string", description="بندر مقصد"), + * @OA\Property(property="vesselName", type="string", description="نام کشتی"), + * @OA\Property(property="voyageNumber", type="string", description="شماره سفر"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="status", type="string", description="وضعیت", default="active") + * ) + * ), + * @OA\Response( + * response=200, + * description="اطلاعات حمل با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه اطلاعات حمل") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/shipping/create', name: 'api_import_workflow_shipping_create', methods: ['POST'])] public function createShipping(string $id, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -561,6 +1078,64 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$sh->getId()]]); } + /** + * ویرایش اطلاعات حمل پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/shipping/{sid}/update", + * summary="ویرایش اطلاعات حمل پرونده واردات", + * tags={"Import Workflow Shipping"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="sid", + * in="path", + * description="شناسه اطلاعات حمل", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="type", type="string", description="نوع حمل"), + * @OA\Property(property="containerNumber", type="string", description="شماره کانتینر"), + * @OA\Property(property="billOfLading", type="string", description="بارنامه"), + * @OA\Property(property="shippingDate", type="string", description="تاریخ حمل (جلالی)"), + * @OA\Property(property="arrivalDate", type="string", description="تاریخ ورود (جلالی)"), + * @OA\Property(property="unloadingDate", type="string", description="تاریخ تخلیه (جلالی)"), + * @OA\Property(property="shippingCompany", type="string", description="شرکت حمل"), + * @OA\Property(property="shippingCompanyPhone", type="string", description="تلفن شرکت حمل"), + * @OA\Property(property="shippingCompanyEmail", type="string", description="ایمیل شرکت حمل"), + * @OA\Property(property="originPort", type="string", description="بندر مبدا"), + * @OA\Property(property="destinationPort", type="string", description="بندر مقصد"), + * @OA\Property(property="vesselName", type="string", description="نام کشتی"), + * @OA\Property(property="voyageNumber", type="string", description="شماره سفر"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="status", type="string", description="وضعیت") + * ) + * ), + * @OA\Response( + * response=200, + * description="اطلاعات حمل با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه اطلاعات حمل") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا اطلاعات حمل یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/shipping/{sid}/update', name: 'api_import_workflow_shipping_update', methods: ['PUT','POST'])] public function updateShipping(string $id, string $sid, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -594,6 +1169,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$sh->getId()]]); } + /** + * حذف اطلاعات حمل پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/shipping/{sid}/delete", + * summary="حذف اطلاعات حمل پرونده واردات", + * tags={"Import Workflow Shipping"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="sid", + * in="path", + * description="شناسه اطلاعات حمل", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="اطلاعات حمل با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا اطلاعات حمل یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/shipping/{sid}/delete', name: 'api_import_workflow_shipping_delete', methods: ['DELETE'])] public function deleteShipping(string $id, string $sid, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -613,6 +1224,57 @@ class PlugImportWorkflowController extends AbstractController } // Customs CRUD + /** + * ایجاد اطلاعات گمرک برای پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{id}/customs/create", + * summary="ایجاد اطلاعات گمرک برای پرونده واردات", + * tags={"Import Workflow Customs"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"declarationNumber"}, + * @OA\Property(property="declarationNumber", type="string", description="شماره اظهارنامه"), + * @OA\Property(property="customsCode", type="string", description="کد گمرک"), + * @OA\Property(property="clearanceDate", type="string", description="تاریخ ترخیص (جلالی)"), + * @OA\Property(property="customsDuty", type="number", description="حقوق گمرکی"), + * @OA\Property(property="valueAddedTax", type="number", description="مالیات بر ارزش افزوده"), + * @OA\Property(property="otherCharges", type="number", description="سایر هزینه‌ها"), + * @OA\Property(property="totalCustomsCharges", type="number", description="کل هزینه‌های گمرک"), + * @OA\Property(property="customsBroker", type="string", description="کارگزار گمرک"), + * @OA\Property(property="customsBrokerPhone", type="string", description="تلفن کارگزار"), + * @OA\Property(property="customsBrokerEmail", type="string", description="ایمیل کارگزار"), + * @OA\Property(property="warehouseNumber", type="string", description="شماره انبار"), + * @OA\Property(property="warehouseLocation", type="string", description="موقعیت انبار"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="status", type="string", description="وضعیت", default="active") + * ) + * ), + * @OA\Response( + * response=200, + * description="اطلاعات گمرک با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه اطلاعات گمرک") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/customs/create', name: 'api_import_workflow_customs_create', methods: ['POST'])] public function createCustoms(string $id, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -644,6 +1306,63 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$c->getId()]]); } + /** + * ویرایش اطلاعات گمرک پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/customs/{cid}/update", + * summary="ویرایش اطلاعات گمرک پرونده واردات", + * tags={"Import Workflow Customs"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="cid", + * in="path", + * description="شناسه اطلاعات گمرک", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="declarationNumber", type="string", description="شماره اظهارنامه"), + * @OA\Property(property="customsCode", type="string", description="کد گمرک"), + * @OA\Property(property="clearanceDate", type="string", description="تاریخ ترخیص (جلالی)"), + * @OA\Property(property="customsDuty", type="number", description="حقوق گمرکی"), + * @OA\Property(property="valueAddedTax", type="number", description="مالیات بر ارزش افزوده"), + * @OA\Property(property="otherCharges", type="number", description="سایر هزینه‌ها"), + * @OA\Property(property="totalCustomsCharges", type="number", description="کل هزینه‌های گمرک"), + * @OA\Property(property="customsBroker", type="string", description="کارگزار گمرک"), + * @OA\Property(property="customsBrokerPhone", type="string", description="تلفن کارگزار"), + * @OA\Property(property="customsBrokerEmail", type="string", description="ایمیل کارگزار"), + * @OA\Property(property="warehouseNumber", type="string", description="شماره انبار"), + * @OA\Property(property="warehouseLocation", type="string", description="موقعیت انبار"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="status", type="string", description="وضعیت") + * ) + * ), + * @OA\Response( + * response=200, + * description="اطلاعات گمرک با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه اطلاعات گمرک") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا اطلاعات گمرک یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/customs/{cid}/update', name: 'api_import_workflow_customs_update', methods: ['PUT','POST'])] public function updateCustoms(string $id, string $cid, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -676,6 +1395,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$c->getId()]]); } + /** + * حذف اطلاعات گمرک پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/customs/{cid}/delete", + * summary="حذف اطلاعات گمرک پرونده واردات", + * tags={"Import Workflow Customs"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="cid", + * in="path", + * description="شناسه اطلاعات گمرک", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="اطلاعات گمرک با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا اطلاعات گمرک یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/customs/{cid}/delete', name: 'api_import_workflow_customs_delete', methods: ['DELETE'])] public function deleteCustoms(string $id, string $cid, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -695,6 +1450,54 @@ class PlugImportWorkflowController extends AbstractController } // Payments CRUD + /** + * ایجاد پرداخت جدید برای پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{id}/payments/create", + * summary="ایجاد پرداخت جدید برای پرونده واردات", + * tags={"Import Workflow Payments"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="type", type="string", description="نوع پرداخت", default="other"), + * @OA\Property(property="amount", type="string", description="مبلغ پرداخت"), + * @OA\Property(property="currency", type="string", description="واحد پول", default="IRR"), + * @OA\Property(property="amountIRR", type="string", description="مبلغ به ریال"), + * @OA\Property(property="paymentDate", type="string", description="تاریخ پرداخت (جلالی)"), + * @OA\Property(property="referenceNumber", type="string", description="شماره مرجع"), + * @OA\Property(property="bankName", type="string", description="نام بانک"), + * @OA\Property(property="accountNumber", type="string", description="شماره حساب"), + * @OA\Property(property="recipientName", type="string", description="نام گیرنده"), + * @OA\Property(property="status", type="string", description="وضعیت", default="pending"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="receiptNumber", type="string", description="شماره رسید") + * ) + * ), + * @OA\Response( + * response=200, + * description="پرداخت با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه پرداخت") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/payments/create', name: 'api_import_workflow_payment_create', methods: ['POST'])] public function createPayment(string $id, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -726,6 +1529,61 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$p->getId()]]); } + /** + * ویرایش پرداخت پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/payments/{pid}/update", + * summary="ویرایش پرداخت پرونده واردات", + * tags={"Import Workflow Payments"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="pid", + * in="path", + * description="شناسه پرداخت", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="type", type="string", description="نوع پرداخت"), + * @OA\Property(property="amount", type="string", description="مبلغ پرداخت"), + * @OA\Property(property="currency", type="string", description="واحد پول"), + * @OA\Property(property="amountIRR", type="string", description="مبلغ به ریال"), + * @OA\Property(property="paymentDate", type="string", description="تاریخ پرداخت (جلالی)"), + * @OA\Property(property="referenceNumber", type="string", description="شماره مرجع"), + * @OA\Property(property="bankName", type="string", description="نام بانک"), + * @OA\Property(property="accountNumber", type="string", description="شماره حساب"), + * @OA\Property(property="recipientName", type="string", description="نام گیرنده"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="receiptNumber", type="string", description="شماره رسید") + * ) + * ), + * @OA\Response( + * response=200, + * description="پرداخت با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه پرداخت") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا پرداخت یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/payments/{pid}/update', name: 'api_import_workflow_payment_update', methods: ['PUT'])] public function updatePayment(string $id, string $pid, Request $request, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -758,6 +1616,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$p->getId()]]); } + /** + * حذف پرداخت پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/payments/{pid}/delete", + * summary="حذف پرداخت پرونده واردات", + * tags={"Import Workflow Payments"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="pid", + * in="path", + * description="شناسه پرداخت", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="پرداخت با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا پرداخت یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/payments/{pid}/delete', name: 'api_import_workflow_payment_delete', methods: ['DELETE'])] public function deletePayment(string $id, string $pid, Access $access, EntityManagerInterface $entityManager): JsonResponse { @@ -778,6 +1672,56 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>true]); } + /** + * ایجاد آیتم کالا برای پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{id}/items/create", + * summary="ایجاد آیتم کالا برای پرونده واردات", + * tags={"Import Workflow Items"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"commodity_id"}, + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="name", type="string", description="نام کالا"), + * @OA\Property(property="productCode", type="string", description="کد محصول"), + * @OA\Property(property="brand", type="string", description="برند"), + * @OA\Property(property="model", type="string", description="مدل"), + * @OA\Property(property="originCountry", type="string", description="کشور مبدا"), + * @OA\Property(property="quantity", type="string", description="تعداد"), + * @OA\Property(property="unitPrice", type="number", description="قیمت واحد"), + * @OA\Property(property="weight", type="string", description="وزن"), + * @OA\Property(property="volume", type="string", description="حجم"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="specifications", type="string", description="مشخصات") + * ) + * ), + * @OA\Response( + * response=200, + * description="آیتم کالا با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه آیتم") + * ) + * ) + * ), + * @OA\Response(response=400, description="کالا انتخاب نشده است"), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا کالا یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/items/create', name: 'api_import_workflow_item_create', methods: ['POST'])] public function createItem( string $id, @@ -847,6 +1791,61 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$item->getId()]]); } + /** + * ویرایش آیتم کالای پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/items/{itemId}/update", + * summary="ویرایش آیتم کالای پرونده واردات", + * tags={"Import Workflow Items"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="itemId", + * in="path", + * description="شناسه آیتم", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="name", type="string", description="نام کالا"), + * @OA\Property(property="productCode", type="string", description="کد محصول"), + * @OA\Property(property="brand", type="string", description="برند"), + * @OA\Property(property="model", type="string", description="مدل"), + * @OA\Property(property="originCountry", type="string", description="کشور مبدا"), + * @OA\Property(property="quantity", type="string", description="تعداد"), + * @OA\Property(property="unitPrice", type="number", description="قیمت واحد"), + * @OA\Property(property="weight", type="string", description="وزن"), + * @OA\Property(property="volume", type="string", description="حجم"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="specifications", type="string", description="مشخصات") + * ) + * ), + * @OA\Response( + * response=200, + * description="آیتم کالا با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه آیتم") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا آیتم یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/items/{itemId}/update', name: 'api_import_workflow_item_update', methods: ['PUT'])] public function updateItem( string $id, @@ -916,6 +1915,42 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>['id'=>$item->getId()]]); } + /** + * حذف آیتم کالای پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/items/{itemId}/delete", + * summary="حذف آیتم کالای پرونده واردات", + * tags={"Import Workflow Items"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Parameter( + * name="itemId", + * in="path", + * description="شناسه آیتم", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="آیتم کالا با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یا آیتم یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/items/{itemId}/delete', name: 'api_import_workflow_item_delete', methods: ['DELETE'])] public function deleteItem( string $id, @@ -940,6 +1975,53 @@ class PlugImportWorkflowController extends AbstractController return $this->json(['Success'=>true,'ErrorCode'=>0,'ErrorMessage'=>'','Result'=>true]); } + /** + * ویرایش پرونده واردات + * + * @OA\Put( + * path="/api/import-workflow/{id}/update", + * summary="ویرایش پرونده واردات", + * tags={"Import Workflow"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="title", type="string", description="عنوان پرونده"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="supplierName", type="string", description="نام تامین‌کننده"), + * @OA\Property(property="supplierCountry", type="string", description="کشور تامین‌کننده"), + * @OA\Property(property="supplierAddress", type="string", description="آدرس تامین‌کننده"), + * @OA\Property(property="supplierPhone", type="string", description="تلفن تامین‌کننده"), + * @OA\Property(property="supplierEmail", type="string", description="ایمیل تامین‌کننده"), + * @OA\Property(property="currency", type="string", description="واحد پول"), + * @OA\Property(property="exchangeRate", type="number", description="نرخ ارز"), + * @OA\Property(property="status", type="string", description="وضعیت") + * ) + * ), + * @OA\Response( + * response=200, + * description="پرونده واردات با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="id", type="integer", description="شناسه پرونده"), + * @OA\Property(property="code", type="string", description="کد پرونده") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/update', name: 'api_import_workflow_update', methods: ['PUT'])] public function update( string $id, @@ -998,6 +2080,35 @@ class PlugImportWorkflowController extends AbstractController ]); } + /** + * حذف پرونده واردات + * + * @OA\Delete( + * path="/api/import-workflow/{id}/delete", + * summary="حذف پرونده واردات", + * tags={"Import Workflow"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="پرونده واردات با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="string", example="پرونده واردات با موفقیت حذف شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات یافت نشد") + * ) + */ #[Route('/api/import-workflow/{id}/delete', name: 'api_import_workflow_delete', methods: ['DELETE'])] public function delete( string $id, @@ -1039,6 +2150,46 @@ class PlugImportWorkflowController extends AbstractController ]); } + /** + * ایجاد حواله ورود به انبار از پرونده واردات + * + * @OA\Post( + * path="/api/import-workflow/{code}/create-inbound-ticket", + * summary="ایجاد حواله ورود به انبار از پرونده واردات", + * tags={"Import Workflow"}, + * @OA\Parameter( + * name="code", + * in="path", + * description="کد پرونده واردات", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"storeroom_id", "person_id"}, + * @OA\Property(property="storeroom_id", type="integer", description="شناسه انبار"), + * @OA\Property(property="person_id", type="integer", description="شناسه طرف حساب") + * ) + * ), + * @OA\Response( + * response=200, + * description="حواله ورود به انبار با موفقیت ایجاد شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="Success", type="boolean", example=true), + * @OA\Property(property="ErrorCode", type="integer", example=0), + * @OA\Property(property="ErrorMessage", type="string", example=""), + * @OA\Property(property="Result", type="object", + * @OA\Property(property="ticketCode", type="string", description="کد حواله انبار") + * ) + * ) + * ), + * @OA\Response(response=400, description="پارامترهای ناقص"), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="پرونده واردات، انبار یا طرف حساب یافت نشد") + * ) + */ #[Route('/api/import-workflow/{code}/create-inbound-ticket', name: 'api_import_workflow_create_inbound_ticket', methods: ['POST'])] public function createInboundTicket( string $code, diff --git a/hesabixCore/src/Controller/Plugins/PlugWarrantyController.php b/hesabixCore/src/Controller/Plugins/PlugWarrantyController.php index 8c6f9a2..d7d93a8 100644 --- a/hesabixCore/src/Controller/Plugins/PlugWarrantyController.php +++ b/hesabixCore/src/Controller/Plugins/PlugWarrantyController.php @@ -1,5 +1,10 @@ entityManager = $entityManager; } + /** + * درخواست تخصیص سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/assign/request", + * summary="درخواست تخصیص سریال‌های گارانتی به اسناد", + * tags={"Warranty Assignment"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"items"}, + * @OA\Property(property="items", type="array", @OA\Items( + * type="object", + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="count", type="integer", description="تعداد"), + * @OA\Property(property="document_id", type="integer", description="شناسه سند"), + * @OA\Property(property="document_item_id", type="integer", description="شناسه آیتم سند") + * ), description="لیست اقلام برای تخصیص") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال‌ها با موفقیت تخصیص داده شدند", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="allocated", type="array", @OA\Items( + * type="object", + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="allocated", type="array", @OA\Items(type="integer"), description="شناسه‌های سریال‌های تخصیص داده شده") + * )) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="پارامترهای نامعتبر"), + * @OA\Response(response=404, description="کسب‌وکار یافت نشد"), + * @OA\Response(response=409, description="کد گارانتی کافی موجود نیست") + * ) + */ #[Route('/api/plugins/warranty/assign/request', name: 'plugin_warranty_assign_request', methods: ['POST'])] public function plugin_warranty_assign_request(Request $request, EntityManagerInterface $em, Access $access, PluginService $pluginService): JsonResponse { @@ -179,6 +262,40 @@ class PlugWarrantyController extends AbstractController } } + /** + * اسکن و تأیید سریال گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/assign/scan", + * summary="اسکن و تأیید سریال گارانتی برای تخصیص", + * tags={"Warranty Assignment"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"serialNumber", "commodity_id", "document_item_id"}, + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="document_id", type="integer", description="شناسه سند"), + * @OA\Property(property="document_item_id", type="integer", description="شناسه آیتم سند"), + * @OA\Property(property="physicalBoxBarcode", type="string", description="بارکد فیزیکی جعبه"), + * @OA\Property(property="productTypeCode", type="string", description="کد نوع محصول") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال با موفقیت تأیید شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="تأیید شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="پارامترهای ناقص"), + * @OA\Response(response=404, description="کد گارانتی یافت نشد"), + * @OA\Response(response=409, description="وضعیت کد برای اسکن معتبر نیست") + * ) + */ #[Route('/api/plugins/warranty/assign/scan', name: 'plugin_warranty_assign_scan', methods: ['POST'])] public function plugin_warranty_assign_scan(Request $request, EntityManagerInterface $entityManager, Access $access, PluginService $pluginService): JsonResponse { @@ -240,6 +357,40 @@ class PlugWarrantyController extends AbstractController } } + /** + * دریافت سریال‌های گارانتی بر اساس فاکتور + * + * @OA\Get( + * path="/api/plugins/warranty/serials/by-invoice/{code}", + * summary="دریافت سریال‌های گارانتی مرتبط با فاکتور", + * tags={"Warranty Serials"}, + * @OA\Parameter( + * name="code", + * in="path", + * description="کد فاکتور", + * required=true, + * @OA\Schema(type="string") + * ), + * @OA\Response( + * response=200, + * description="سریال‌های گارانتی فاکتور", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="items", type="array", @OA\Items( + * type="object", + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity", type="string", description="نام کالا"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="expired", type="boolean", description="آیا منقضی شده") + * )) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="فاکتور یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/by-invoice/{code}', name: 'plugin_warranty_serials_by_invoice', methods: ['GET'])] public function plugin_warranty_serials_by_invoice(string $code, Request $request, Access $access, EntityManagerInterface $entityManager, PluginService $pluginService): JsonResponse { @@ -283,6 +434,34 @@ class PlugWarrantyController extends AbstractController return $this->json(['success' => true, 'items' => $result]); } + /** + * ارسال سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/send-serials", + * summary="ارسال سریال‌های گارانتی فاکتور به مشتری", + * tags={"Warranty Serials"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"invoiceCode", "mobile"}, + * @OA\Property(property="invoiceCode", type="string", description="کد فاکتور"), + * @OA\Property(property="mobile", type="string", description="شماره موبایل مشتری") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال‌ها با موفقیت ارسال شدند", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="پارامترهای ناقص"), + * @OA\Response(response=404, description="فاکتور یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/send-serials', name: 'plugin_warranty_send_serials', methods: ['POST'])] public function plugin_warranty_send_serials(Request $request, Access $access, EntityManagerInterface $entityManager, PluginService $pluginService, SMS $SMS, registryMGR $registryMGR): JsonResponse { @@ -332,6 +511,35 @@ class PlugWarrantyController extends AbstractController return $this->json(['success' => true]); } + /** + * پیش‌نمایش وارد کردن سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/preview-import", + * summary="پیش‌نمایش فایل اکسل برای وارد کردن سریال‌های گارانتی", + * tags={"Warranty Import"}, + * @OA\RequestBody( + * required=true, + * @OA\MediaType( + * mediaType="multipart/form-data", + * @OA\Schema( + * @OA\Property(property="file", type="string", format="binary", description="فایل اکسل") + * ) + * ) + * ), + * @OA\Response( + * response=200, + * description="پیش‌نمایش داده‌های فایل", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="preview", type="array", @OA\Items(type="object"), description="داده‌های پیش‌نمایش"), + * @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="خطاهای موجود") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="فایل ارسال نشده است") + * ) + */ #[Route('/api/plugins/warranty/serials/preview-import', name: 'plugin_warranty_serial_preview_import', methods: ['POST'])] public function plugin_warranty_serial_preview_import(Request $request, Access $access): JsonResponse { @@ -398,6 +606,34 @@ class PlugWarrantyController extends AbstractController } } + /** + * وارد کردن سریال‌های گارانتی از اکسل + * + * @OA\Post( + * path="/api/plugins/warranty/serials/import-excel", + * summary="وارد کردن سریال‌های گارانتی از فایل اکسل", + * tags={"Warranty Import"}, + * @OA\RequestBody( + * required=true, + * @OA\MediaType( + * mediaType="multipart/form-data", + * @OA\Schema( + * @OA\Property(property="file", type="string", format="binary", description="فایل اکسل") + * ) + * ) + * ), + * @OA\Response( + * response=200, + * description="داده‌های استخراج شده از فایل", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="serials", type="array", @OA\Items(type="object"), description="سریال‌های استخراج شده") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="فایل ارسال نشده است") + * ) + */ #[Route('/api/plugins/warranty/serials/import-excel', name: 'plugin_warranty_serial_import_excel', methods: ['POST'])] public function plugin_warranty_serial_import_excel(Request $request, EntityManagerInterface $entityManager, Access $access): JsonResponse { @@ -458,6 +694,60 @@ class PlugWarrantyController extends AbstractController } } + /** + * دریافت لیست سریال‌های گارانتی + * + * @OA\Get( + * path="/api/plugins/warranty/serials", + * summary="دریافت لیست سریال‌های گارانتی با فیلترهای مختلف", + * tags={"Warranty Serials"}, + * @OA\Parameter(name="page", in="query", description="شماره صفحه", @OA\Schema(type="integer", default=1)), + * @OA\Parameter(name="limit", in="query", description="تعداد در هر صفحه", @OA\Schema(type="integer", default=20)), + * @OA\Parameter(name="status", in="query", description="فیلتر بر اساس وضعیت", @OA\Schema(type="string")), + * @OA\Parameter(name="commodity_id", in="query", description="فیلتر بر اساس کالا", @OA\Schema(type="integer")), + * @OA\Parameter(name="search", in="query", description="جستجو در سریال‌ها", @OA\Schema(type="string")), + * @OA\Response( + * response=200, + * description="لیست سریال‌های گارانتی", + * @OA\JsonContent( + * type="array", + * @OA\Items( + * type="object", + * @OA\Property(property="id", type="integer", description="شناسه سریال"), + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity", type="object", + * @OA\Property(property="id", type="integer", description="شناسه کالا"), + * @OA\Property(property="name", type="string", description="نام کالا"), + * @OA\Property(property="code", type="string", description="کد کالا") + * ), + * @OA\Property(property="dateSubmit", type="string", description="تاریخ ثبت"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="activation", type="string", description="فعال‌سازی"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها"), + * @OA\Property(property="expired", type="boolean", description="آیا منقضی شده"), + * @OA\Property(property="submitter", type="object", + * @OA\Property(property="id", type="integer", description="شناسه ثبت‌کننده"), + * @OA\Property(property="name", type="string", description="نام ثبت‌کننده") + * ), + * @OA\Property(property="commoditySerial", type="string", description="سریال کالا"), + * @OA\Property(property="buyer", type="object", + * @OA\Property(property="id", type="integer", description="شناسه خریدار"), + * @OA\Property(property="code", type="string", description="کد خریدار"), + * @OA\Property(property="name", type="string", description="نام خریدار"), + * @OA\Property(property="nikename", type="string", description="نام مستعار"), + * @OA\Property(property="mobile", type="string", description="موبایل") + * ), + * @OA\Property(property="activationAt", type="string", description="تاریخ فعال‌سازی"), + * @OA\Property(property="allocatedToDocumentCode", type="string", description="کد سند تخصیص داده شده") + * ) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/warranty/serials', name: 'plugin_warranty_serials', methods: ['GET'])] public function plugin_warranty_serials(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Request $request): JsonResponse { @@ -531,6 +821,60 @@ class PlugWarrantyController extends AbstractController } } + /** + * دریافت جزئیات یک سریال گارانتی + * + * @OA\Get( + * path="/api/plugins/warranty/serials/{id}", + * summary="دریافت جزئیات کامل یک سریال گارانتی", + * tags={"Warranty Serials"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه سریال گارانتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\Response( + * response=200, + * description="جزئیات سریال گارانتی", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="id", type="integer", description="شناسه سریال"), + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity", type="object", + * @OA\Property(property="id", type="integer", description="شناسه کالا"), + * @OA\Property(property="name", type="string", description="نام کالا"), + * @OA\Property(property="code", type="string", description="کد کالا") + * ), + * @OA\Property(property="dateSubmit", type="string", description="تاریخ ثبت"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="activation", type="string", description="فعال‌سازی"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها"), + * @OA\Property(property="expired", type="boolean", description="آیا منقضی شده"), + * @OA\Property(property="submitter", type="object", + * @OA\Property(property="id", type="integer", description="شناسه ثبت‌کننده"), + * @OA\Property(property="name", type="string", description="نام ثبت‌کننده") + * ), + * @OA\Property(property="commoditySerial", type="string", description="سریال کالا"), + * @OA\Property(property="buyer", type="object", + * @OA\Property(property="id", type="integer", description="شناسه خریدار"), + * @OA\Property(property="code", type="string", description="کد خریدار"), + * @OA\Property(property="name", type="string", description="نام خریدار"), + * @OA\Property(property="nikename", type="string", description="نام مستعار"), + * @OA\Property(property="mobile", type="string", description="موبایل") + * ), + * @OA\Property(property="activationAt", type="string", description="تاریخ فعال‌سازی"), + * @OA\Property(property="allocatedToDocumentCode", type="string", description="کد سند تخصیص داده شده") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="سریال یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/{id}', name: 'plugin_warranty_serial', methods: ['GET'])] public function plugin_warranty_serial(EntityManagerInterface $entityManager, Access $access, $id): JsonResponse { @@ -589,6 +933,41 @@ class PlugWarrantyController extends AbstractController } } + /** + * افزودن سریال گارانتی جدید + * + * @OA\Post( + * path="/api/plugins/warranty/serials/add", + * summary="افزودن سریال گارانتی جدید", + * tags={"Warranty Serials"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"serialNumber", "commodity_id"}, + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال با موفقیت افزوده شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="سریال با موفقیت افزوده شد"), + * @OA\Property(property="id", type="integer", description="شناسه سریال ایجاد شده") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="شماره سریال تکراری است یا محصول یافت نشد"), + * @OA\Response(response=404, description="کسب‌وکار یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/add', name: 'plugin_warranty_serial_add', methods: ['POST'])] public function plugin_warranty_serial_add(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse { @@ -657,6 +1036,74 @@ class PlugWarrantyController extends AbstractController } } + /** + * ویرایش سریال گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/edit/{id}", + * summary="ویرایش اطلاعات سریال گارانتی", + * tags={"Warranty Serials"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه سریال گارانتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity_id", type="integer", description="شناسه کالا"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها"), + * @OA\Property(property="activation", type="string", description="فعال‌سازی") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال با موفقیت ویرایش شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="سریال با موفقیت ویرایش شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="شماره سریال تکراری است یا محصول یافت نشد"), + * @OA\Response(response=404, description="سریال یافت نشد") + * ) + */ + /** + * ویرایش سریال گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/edit/{id}", + * summary="ویرایش اطلاعات سریال گارانتی", + * tags={"Warranty Serials"}, + * @OA\Parameter(name="id", in="path", description="شناسه سریال", required=true, @OA\Schema(type="integer")), + * @OA\RequestBody(required=true, @OA\JsonContent( + * @OA\Property(property="serialNumber", type="string"), + * @OA\Property(property="commodity_id", type="integer"), + * @OA\Property(property="description", type="string"), + * @OA\Property(property="warrantyStartDate", type="string"), + * @OA\Property(property="warrantyEndDate", type="string"), + * @OA\Property(property="status", type="string"), + * @OA\Property(property="notes", type="string"), + * @OA\Property(property="activation", type="string") + * )), + * @OA\Response(response=200, description="سریال ویرایش شد", @OA\JsonContent( + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="سریال با موفقیت ویرایش شد") + * )), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="شماره سریال تکراری است"), + * @OA\Response(response=404, description="سریال یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/edit/{id}', name: 'plugin_warranty_serial_edit', methods: ['POST'])] public function plugin_warranty_serial_edit(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, $id, Log $log): JsonResponse { @@ -753,6 +1200,49 @@ class PlugWarrantyController extends AbstractController } } + /** + * حذف سریال گارانتی + * + * @OA\Delete( + * path="/api/plugins/warranty/serials/{id}", + * summary="حذف سریال گارانتی", + * tags={"Warranty Serials"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه سریال گارانتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\Response( + * response=200, + * description="سریال با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="سریال با موفقیت حذف شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="سریال یافت نشد") + * ) + */ + /** + * حذف سریال گارانتی + * + * @OA\Delete( + * path="/api/plugins/warranty/serials/{id}", + * summary="حذف سریال گارانتی", + * tags={"Warranty Serials"}, + * @OA\Parameter(name="id", in="path", description="شناسه سریال", required=true, @OA\Schema(type="integer")), + * @OA\Response(response=200, description="سریال حذف شد", @OA\JsonContent( + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="سریال با موفقیت حذف شد") + * )), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="سریال یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/{id}', name: 'plugin_warranty_serial_delete', methods: ['DELETE'])] public function plugin_warranty_serial_delete(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, $id, Log $log): JsonResponse { @@ -791,6 +1281,69 @@ class PlugWarrantyController extends AbstractController } } + /** + * وارد کردن انبوه سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/bulk-import", + * summary="وارد کردن انبوه سریال‌های گارانتی", + * tags={"Warranty Import"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"serials"}, + * @OA\Property(property="serials", type="array", @OA\Items( + * type="object", + * @OA\Property(property="serialNumber", type="string", description="شماره سریال"), + * @OA\Property(property="commodity_code", type="string", description="کد کالا"), + * @OA\Property(property="description", type="string", description="توضیحات"), + * @OA\Property(property="warrantyStartDate", type="string", description="تاریخ شروع گارانتی"), + * @OA\Property(property="warrantyEndDate", type="string", description="تاریخ پایان گارانتی"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="notes", type="string", description="یادداشت‌ها") + * ), description="لیست سریال‌ها برای وارد کردن") + * ) + * ), + * @OA\Response( + * response=200, + * description="عملیات وارد کردن انبوه تکمیل شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", description="پیام نتیجه"), + * @OA\Property(property="successCount", type="integer", description="تعداد موفق"), + * @OA\Property(property="errorCount", type="integer", description="تعداد خطا"), + * @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="لیست خطاها") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="داده‌های نامعتبر"), + * @OA\Response(response=404, description="کسب‌وکار یافت نشد") + * ) + */ + /** + * وارد کردن انبوه سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/bulk-import", + * summary="وارد کردن انبوه سریال‌های گارانتی", + * tags={"Warranty Import"}, + * @OA\RequestBody(required=true, @OA\JsonContent( + * required={"serials"}, + * @OA\Property(property="serials", type="array", @OA\Items(type="object"), description="لیست سریال‌ها") + * )), + * @OA\Response(response=200, description="عملیات تکمیل شد", @OA\JsonContent( + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string"), + * @OA\Property(property="successCount", type="integer"), + * @OA\Property(property="errorCount", type="integer"), + * @OA\Property(property="errors", type="array", @OA\Items(type="string")) + * )), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="داده‌های نامعتبر"), + * @OA\Response(response=404, description="کسب‌وکار یافت نشد") + * ) + */ #[Route('/api/plugins/warranty/serials/bulk-import', name: 'plugin_warranty_serial_bulk_import', methods: ['POST'])] public function plugin_warranty_serial_bulk_import(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse { @@ -891,6 +1444,26 @@ class PlugWarrantyController extends AbstractController } } + /** + * دریافت آمار سریال‌های گارانتی + * + * @OA\Get( + * path="/api/plugins/warranty/stats", + * summary="دریافت آمار و گزارش سریال‌های گارانتی", + * tags={"Warranty Statistics"}, + * @OA\Response( + * response=200, + * description="آمار سریال‌های گارانتی", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="totalSerials", type="integer", description="تعداد کل سریال‌ها"), + * @OA\Property(property="byStatus", type="object", description="تعداد بر اساس وضعیت"), + * @OA\Property(property="expiredFlagCount", type="integer", description="تعداد منقضی شده") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/warranty/stats', name: 'plugin_warranty_stats', methods: ['GET'])] public function plugin_warranty_stats(EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access): JsonResponse { @@ -936,6 +1509,35 @@ class PlugWarrantyController extends AbstractController } } + /** + * حذف گروهی سریال‌های گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/serials/bulk-delete", + * summary="حذف گروهی سریال‌های گارانتی", + * tags={"Warranty Serials"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"ids"}, + * @OA\Property(property="ids", type="array", @OA\Items(type="integer"), description="شناسه‌های سریال‌ها برای حذف") + * ) + * ), + * @OA\Response( + * response=200, + * description="سریال‌ها با موفقیت حذف شدند", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", description="پیام نتیجه"), + * @OA\Property(property="deletedCount", type="integer", description="تعداد حذف شده"), + * @OA\Property(property="errors", type="array", @OA\Items(type="string"), description="لیست خطاها") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="هیچ آیتمی برای حذف انتخاب نشده است") + * ) + */ #[Route('/api/plugins/warranty/serials/bulk-delete', name: 'plugin_warranty_serial_bulk_delete', methods: ['POST'])] public function plugin_warranty_serial_bulk_delete(Request $request, EntityManagerInterface $entityManager, PlugWarrantySerialRepository $repository, Access $access, Log $log): JsonResponse { @@ -999,6 +1601,26 @@ class PlugWarrantyController extends AbstractController } } + /** + * دریافت تنظیمات گارانتی + * + * @OA\Get( + * path="/api/plugins/warranty/settings/get", + * summary="دریافت تنظیمات گارانتی کسب و کار", + * tags={"Warranty Settings"}, + * @OA\Response( + * response=200, + * description="تنظیمات گارانتی", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="requireWarrantyOnDelivery", type="boolean", description="آیا گارانتی در تحویل الزامی است"), + * @OA\Property(property="activationGraceDays", type="integer", description="تعداد روزهای مهلت فعال‌سازی"), + * @OA\Property(property="matchWarrantyToSerial", type="boolean", description="آیا گارانتی با سریال مطابقت دارد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/warranty/settings/get', name: 'plugin_warranty_settings_get', methods: ['GET'])] public function plugin_warranty_settings_get(Access $access, registryMGR $registryMGR, EntityManagerInterface $entityManager): JsonResponse { @@ -1019,6 +1641,32 @@ class PlugWarrantyController extends AbstractController ]); } + /** + * ذخیره تنظیمات گارانتی + * + * @OA\Post( + * path="/api/plugins/warranty/settings/save", + * summary="ذخیره تنظیمات گارانتی کسب و کار", + * tags={"Warranty Settings"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * @OA\Property(property="requireWarrantyOnDelivery", type="boolean", description="آیا گارانتی در تحویل الزامی است"), + * @OA\Property(property="activationGraceDays", type="integer", description="تعداد روزهای مهلت فعال‌سازی"), + * @OA\Property(property="matchWarrantyToSerial", type="boolean", description="آیا گارانتی با سریال مطابقت دارد") + * ) + * ), + * @OA\Response( + * response=200, + * description="تنظیمات با موفقیت ذخیره شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/warranty/settings/save', name: 'plugin_warranty_settings_save', methods: ['POST'])] public function plugin_warranty_settings_save(Request $request, Access $access, registryMGR $registryMGR, EntityManagerInterface $entityManager): JsonResponse { diff --git a/hesabixCore/src/Controller/Plugins/TaxSettingsController.php b/hesabixCore/src/Controller/Plugins/TaxSettingsController.php index 62a094e..ec320b2 100644 --- a/hesabixCore/src/Controller/Plugins/TaxSettingsController.php +++ b/hesabixCore/src/Controller/Plugins/TaxSettingsController.php @@ -10,7 +10,6 @@ namespace App\Controller\Plugins; use App\Entity\Business; use App\Entity\Permission; use App\Service\Access; -use App\Service\Extractor; use App\Service\Log; use App\Service\registryMGR; use Doctrine\ORM\EntityManagerInterface; @@ -24,6 +23,7 @@ use App\Entity\PluginTaxInvoice; use App\Dto\TaxSettingsDto; use Symfony\Component\Validator\Validator\ValidatorInterface; use App\Entity\User; +use OpenApi\Annotations as OA; use DateTime; class TaxSettingsController extends AbstractController @@ -74,6 +74,26 @@ class TaxSettingsController extends AbstractController return $settings; } + /** + * دریافت تنظیمات مالیاتی + * + * @OA\Get( + * path="/api/plugins/tax/settings/get", + * summary="دریافت تنظیمات مالیاتی کسب و کار", + * tags={"Tax Settings"}, + * @OA\Response( + * response=200, + * description="تنظیمات مالیاتی", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="taxMemoryId", type="string", description="شناسه حافظه مالیاتی"), + * @OA\Property(property="economicCode", type="string", description="کد اقتصادی"), + * @OA\Property(property="privateKey", type="string", description="کلید خصوصی") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/tax/settings/get', name: 'plugin_tax_settings_get', methods: ['GET'])] public function plugin_tax_settings_get(EntityManagerInterface $em, Access $access): JsonResponse { @@ -90,6 +110,35 @@ class TaxSettingsController extends AbstractController return $this->json($settings); } + /** + * ذخیره تنظیمات مالیاتی + * + * @OA\Post( + * path="/api/plugins/tax/settings/save", + * summary="ذخیره تنظیمات مالیاتی کسب و کار", + * tags={"Tax Settings"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"taxMemoryId", "economicCode", "privateKey"}, + * @OA\Property(property="taxMemoryId", type="string", description="شناسه حافظه مالیاتی"), + * @OA\Property(property="economicCode", type="string", description="کد اقتصادی"), + * @OA\Property(property="privateKey", type="string", description="کلید خصوصی") + * ) + * ), + * @OA\Response( + * response=200, + * description="تنظیمات با موفقیت ذخیره شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="تنظیمات با موفقیت ذخیره شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=422, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/settings/save', name: 'plugin_tax_settings_save', methods: ['POST'])] public function plugin_tax_settings_save(Request $request, registryMGR $registryMGR, Access $access, Log $log, EntityManagerInterface $em, ValidatorInterface $validator): JsonResponse { @@ -119,7 +168,7 @@ class TaxSettingsController extends AbstractController $businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid']; $user = $this->getUser(); - $userId = $user instanceof \App\Entity\User ? $user->getId() : null; + $userId = $user instanceof User ? $user->getId() : null; $repo = $em->getRepository(PluginTaxsettingsKey::class); $entity = $repo->findOneBy(['business_id' => $businessId, 'user_id' => $userId]); @@ -127,12 +176,12 @@ class TaxSettingsController extends AbstractController $entity = new PluginTaxsettingsKey(); $entity->setBusinessId($businessId); $entity->setUserId($userId); - $entity->setCreatedAt(new \DateTime()); + $entity->setCreatedAt(new DateTime()); } $entity->setPrivateKey($dto->privateKey); $entity->setTaxMemoryId($dto->taxMemoryId); $entity->setEconomicCode($dto->economicCode); - $entity->setUpdatedAt(new \DateTime()); + $entity->setUpdatedAt(new DateTime()); $em->persist($entity); $em->flush(); @@ -177,6 +226,40 @@ class TaxSettingsController extends AbstractController return $keyDetails['key']; } + /** + * تولید کلید و CSR + * + * @OA\Post( + * path="/api/plugins/tax/settings/generate-csr", + * summary="تولید کلید خصوصی، عمومی و CSR برای سامانه مودیان", + * tags={"Tax Settings"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"nationalId"}, + * @OA\Property(property="personType", type="string", enum={"natural", "legal"}, description="نوع شخص"), + * @OA\Property(property="nationalId", type="string", description="شناسه ملی"), + * @OA\Property(property="nameFa", type="string", description="نام فارسی (برای اشخاص حقوقی)"), + * @OA\Property(property="nameEn", type="string", description="نام انگلیسی (برای اشخاص حقوقی)"), + * @OA\Property(property="email", type="string", description="ایمیل (برای اشخاص حقوقی)") + * ) + * ), + * @OA\Response( + * response=200, + * description="کلید و CSR با موفقیت تولید شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="privateKey", type="string", description="کلید خصوصی"), + * @OA\Property(property="publicKey", type="string", description="کلید عمومی"), + * @OA\Property(property="csr", type="string", description="CSR (برای اشخاص حقوقی)"), + * @OA\Property(property="message", type="string", description="پیام نتیجه") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/settings/generate-csr', name: 'plugin_tax_settings_generate_csr', methods: ['POST'])] public function plugin_tax_settings_generate_csr(Request $request, registryMGR $registryMGR, Access $access, Log $log): JsonResponse { @@ -279,6 +362,39 @@ class TaxSettingsController extends AbstractController return $csr; } + /** + * اضافه کردن فاکتورها به لیست ارسال + * + * @OA\Post( + * path="/api/plugins/tax/list/send-invoice", + * summary="اضافه کردن فاکتورها به لیست ارسال به سامانه مودیان", + * tags={"Tax Invoices"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"codes"}, + * @OA\Property(property="codes", type="array", @OA\Items(type="string"), description="کدهای فاکتور") + * ) + * ), + * @OA\Response( + * response=200, + * description="فاکتورها با موفقیت به لیست ارسال اضافه شدند", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", description="پیام نتیجه"), + * @OA\Property(property="summary", type="object", + * @OA\Property(property="total", type="integer", description="تعداد کل"), + * @OA\Property(property="success", type="integer", description="تعداد موفق"), + * @OA\Property(property="error", type="integer", description="تعداد خطا") + * ), + * @OA\Property(property="results", type="array", @OA\Items(type="object")) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/list/send-invoice', name: 'plugin_tax_list_send_invoice', methods: ['POST'])] public function plugin_tax_list_send_invoice(Request $request, Access $access, Log $log, EntityManagerInterface $em): JsonResponse { @@ -299,7 +415,7 @@ class TaxSettingsController extends AbstractController $businessId = is_object($acc['bid']) ? $acc['bid']->getId() : $acc['bid']; $user = $this->getUser(); - $userId = $user instanceof \App\Entity\User ? $user->getId() : null; + $userId = $user instanceof User ? $user->getId() : null; try { $taxRepo = $em->getRepository(PluginTaxsettingsKey::class); @@ -416,8 +532,8 @@ class TaxSettingsController extends AbstractController } $taxInvoice = new PluginTaxInvoice(); - $taxInvoice->setBusiness($em->getRepository(\App\Entity\Business::class)->find($businessId)); - $taxInvoice->setUser($em->getRepository(\App\Entity\User::class)->find($userId)); + $taxInvoice->setBusiness($em->getRepository(Business::class)->find($businessId)); + $taxInvoice->setUser($em->getRepository(User::class)->find($userId)); $taxInvoice->setInvoice($invoice); $taxInvoice->setInvoiceCode($invoice->getCode()); $taxInvoice->setStatus('pending'); @@ -461,6 +577,40 @@ class TaxSettingsController extends AbstractController } } + /** + * دریافت لیست فاکتورهای مالیاتی + * + * @OA\Get( + * path="/api/plugins/tax/invoices/list", + * summary="دریافت لیست فاکتورهای مالیاتی کسب و کار", + * tags={"Tax Invoices"}, + * @OA\Response( + * response=200, + * description="لیست فاکتورهای مالیاتی", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="data", type="array", @OA\Items( + * type="object", + * @OA\Property(property="id", type="integer", description="شناسه فاکتور مالیاتی"), + * @OA\Property(property="invoiceNumber", type="string", description="شماره فاکتور"), + * @OA\Property(property="date", type="string", description="تاریخ فاکتور"), + * @OA\Property(property="customerName", type="string", description="نام مشتری"), + * @OA\Property(property="customerId", type="string", description="کد مشتری"), + * @OA\Property(property="totalAmount", type="number", description="مبلغ کل"), + * @OA\Property(property="status", type="string", description="وضعیت"), + * @OA\Property(property="sentDate", type="string", description="تاریخ ارسال"), + * @OA\Property(property="errorMessage", type="string", description="پیام خطا"), + * @OA\Property(property="createdAt", type="string", description="تاریخ ایجاد"), + * @OA\Property(property="uniqueTaxNumber", type="string", description="شماره یکتا مالیاتی"), + * @OA\Property(property="referenceUniqueTaxNumber", type="string", description="شماره ارجاع یکتا"), + * @OA\Property(property="invoiceType", type="string", description="نوع فاکتور") + * )) + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز") + * ) + */ #[Route('/api/plugins/tax/invoices/list', name: 'plugin_tax_settings_invoices_list', methods: ['GET'])] public function plugin_tax_settings_invoices_list(Request $request, Access $access, EntityManagerInterface $em): JsonResponse { @@ -774,6 +924,36 @@ class TaxSettingsController extends AbstractController } } + /** + * ارسال فاکتور مالیاتی + * + * @OA\Post( + * path="/api/plugins/tax/invoice/send/{id}", + * summary="ارسال فاکتور مالیاتی به سامانه مودیان", + * tags={"Tax Invoices"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه فاکتور مالیاتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\Response( + * response=200, + * description="فاکتور با موفقیت ارسال شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="data", type="object", description="پاسخ سامانه مودیان"), + * @OA\Property(property="invoiceCode", type="string", description="کد فاکتور"), + * @OA\Property(property="referenceNumber", type="string", description="شماره ارجاع") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"), + * @OA\Response(response=400, description="خطا در ارسال فاکتور") + * ) + */ #[Route('/api/plugins/tax/invoice/send/{id}', name: 'plugin_tax_invoice_send', methods: ['POST'])] public function sendTaxInvoice(int $id, Access $access, Log $log, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse { @@ -933,6 +1113,34 @@ class TaxSettingsController extends AbstractController } } + /** + * حذف فاکتور مالیاتی + * + * @OA\Delete( + * path="/api/plugins/tax/invoice/delete/{id}", + * summary="حذف فاکتور مالیاتی از لیست ارسال", + * tags={"Tax Invoices"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه فاکتور مالیاتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\Response( + * response=200, + * description="فاکتور مالیاتی با موفقیت حذف شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", example="فاکتور مالیاتی با موفقیت حذف شد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"), + * @OA\Response(response=400, description="فاکتور قابل حذف نیست") + * ) + */ #[Route('/api/plugins/tax/invoice/delete/{id}', name: 'plugin_tax_invoice_delete', methods: ['DELETE'])] public function deleteTaxInvoice(int $id, Access $access, Log $log, EntityManagerInterface $em): JsonResponse { @@ -989,6 +1197,33 @@ class TaxSettingsController extends AbstractController } } + /** + * استعلام وضعیت فاکتورهای مالیاتی + * + * @OA\Post( + * path="/api/plugins/tax/inquire-status", + * summary="استعلام وضعیت فاکتورهای ارسال شده به سامانه مودیان", + * tags={"Tax Invoices"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"referenceNumbers"}, + * @OA\Property(property="referenceNumbers", type="array", @OA\Items(type="string"), description="شماره‌های ارجاع فاکتورها") + * ) + * ), + * @OA\Response( + * response=200, + * description="وضعیت فاکتورها با موفقیت دریافت شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="data", type="array", @OA\Items(type="object"), description="اطلاعات وضعیت فاکتورها") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/inquire-status', name: 'plugin_tax_inquire_status', methods: ['POST'])] public function inquireInvoiceStatus(Request $request, Access $access, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse { @@ -1342,6 +1577,39 @@ class TaxSettingsController extends AbstractController } } + /** + * ارسال گروهی فاکتورهای مالیاتی + * + * @OA\Post( + * path="/api/plugins/tax/invoice/send-bulk", + * summary="ارسال گروهی فاکتورهای مالیاتی به سامانه مودیان", + * tags={"Tax Invoices"}, + * @OA\RequestBody( + * required=true, + * @OA\JsonContent( + * required={"ids"}, + * @OA\Property(property="ids", type="array", @OA\Items(type="integer"), description="شناسه‌های فاکتورهای مالیاتی") + * ) + * ), + * @OA\Response( + * response=200, + * description="ارسال گروهی فاکتورها تکمیل شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", description="پیام نتیجه"), + * @OA\Property(property="summary", type="object", + * @OA\Property(property="total", type="integer", description="تعداد کل"), + * @OA\Property(property="success", type="integer", description="تعداد موفق"), + * @OA\Property(property="error", type="integer", description="تعداد خطا") + * ), + * @OA\Property(property="results", type="array", @OA\Items(type="object"), description="نتایج ارسال هر فاکتور") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=400, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/invoice/send-bulk', name: 'plugin_tax_invoice_send_bulk', methods: ['POST'])] public function sendBulkTaxInvoices(Request $request, Access $access, Log $log, EntityManagerInterface $em, registryMGR $registryMGR): JsonResponse { @@ -1572,6 +1840,44 @@ class TaxSettingsController extends AbstractController } } + /** + * اعتبارسنجی اطلاعات خریدار + * + * @OA\Post( + * path="/api/plugins/tax/invoice/validate-buyer-info/{id}", + * summary="اعتبارسنجی اطلاعات اقتصادی خریدار فاکتور", + * tags={"Tax Invoices"}, + * @OA\Parameter( + * name="id", + * in="path", + * description="شناسه فاکتور مالیاتی", + * required=true, + * @OA\Schema(type="integer") + * ), + * @OA\Response( + * response=200, + * description="اطلاعات اقتصادی خریدار بررسی شد", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="success", type="boolean", example=true), + * @OA\Property(property="message", type="string", description="پیام نتیجه"), + * @OA\Property(property="buyer_info", type="object", + * @OA\Property(property="is_valid", type="boolean", description="آیا اطلاعات معتبر است"), + * @OA\Property(property="buyer_name", type="string", description="نام خریدار"), + * @OA\Property(property="buyer_id", type="integer", description="شناسه خریدار"), + * @OA\Property(property="buyer_code", type="string", description="کد خریدار"), + * @OA\Property(property="national_id", type="string", description="شناسه ملی"), + * @OA\Property(property="economic_code", type="string", description="کد اقتصادی"), + * @OA\Property(property="missing_fields", type="array", @OA\Items(type="string"), description="فیلدهای ناقص") + * ), + * @OA\Property(property="can_proceed", type="boolean", description="آیا می‌توان ادامه داد") + * ) + * ), + * @OA\Response(response=403, description="دسترسی غیرمجاز"), + * @OA\Response(response=404, description="فاکتور مالیاتی یافت نشد"), + * @OA\Response(response=400, description="اطلاعات نامعتبر") + * ) + */ #[Route('/api/plugins/tax/invoice/validate-buyer-info/{id}', name: 'plugin_tax_invoice_validate_buyer_info', methods: ['POST'])] public function validateBuyerInfo(int $id, Access $access, Log $log, EntityManagerInterface $em): JsonResponse {