From 5b73e426fe08b189976ec76f8347e80c1ee114c5 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:14:27 +0800 Subject: [PATCH] reject statement transaction mapping --- .../UpdateStatementTransactionStatusLogic.php | 53 +++++++++++++++++++ .../Services/FetchesStatementTransaction.php | 32 +++++++++++ ...teStatementTransactionStatusController.php | 20 +++++++ .../StatementTransactionComponent.vue | 2 +- routes/accounting.php | 4 ++ 5 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php create mode 100644 app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php create mode 100644 app/Http/Controllers/Accounting/UpdateStatementTransactionStatusController.php diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php new file mode 100644 index 00000000..da9949d2 --- /dev/null +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php @@ -0,0 +1,53 @@ + 'Update Statement Transaction Status', + 'message' => 'You have successfully updated the Statement Transation Status' + ]; + } + + /** @var FetchesStatementTransaction */ + private $fetchesStatementTransaction; + + /** + * UpdateAnnouncementLogic constructor. + * @param FetchesStatementTransaction $fetchesStatementTransaction + */ + public function __construct( + FetchesStatementTransaction $fetchesStatementTransaction, + ) { + $this->fetchesStatementTransaction = $fetchesStatementTransaction; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request): JsonResponse + { + $statementTrasaction = $this->fetchesStatementTransaction->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new BankStatementTransactionResource($statementTrasaction)); + } +} diff --git a/app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php b/app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php new file mode 100644 index 00000000..1ef2bdb3 --- /dev/null +++ b/app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php @@ -0,0 +1,32 @@ +repository = $repository; + } + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} diff --git a/app/Http/Controllers/Accounting/UpdateStatementTransactionStatusController.php b/app/Http/Controllers/Accounting/UpdateStatementTransactionStatusController.php new file mode 100644 index 00000000..dd45e571 --- /dev/null +++ b/app/Http/Controllers/Accounting/UpdateStatementTransactionStatusController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue index 90d012ba..0abe2ce8 100644 --- a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue +++ b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue @@ -69,7 +69,7 @@ contentText="Are you sure you want to reject this mapping?" modalType="delete" class="text-center" - :apiRoute="route('api.company.delete', 1)" + :apiRoute="route('accounting.statement_transaction.owner.status.update', item.id, 'reject')" apiMethod="post" section="statementTransactionComponent" > diff --git a/routes/accounting.php b/routes/accounting.php index 807ba564..b59bf98f 100644 --- a/routes/accounting.php +++ b/routes/accounting.php @@ -9,4 +9,8 @@ Route::group(['prefix' => 'accounting', 'as' => 'accounting.', 'namespace' => 'A Route::get('/details', 'BankStatementController@fetch')->name('details'); Route::put('/details/update', 'BankStatementController@update')->name('details.update'); }); + + Route::group(['prefix' => 'statement_transaction', 'as' => 'statement_transaction.'], function () { + Route::post('/{id}/owner/{status}', 'UpdateStatementTransactionStatusController@update')->name('owner.status.update'); + }); });