From ced6d2a1b1bec4fc3454e4140f25e908c8ffe420 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:17:07 +0800 Subject: [PATCH 01/12] reject statement transaction mapping api --- .../accounting/elements/StatementTransactionComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue index 0abe2ce8..b28dcc1b 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('accounting.statement_transaction.owner.status.update', item.id, 'reject')" + :apiRoute="route('api.accounting.statement_transaction.owner.status.update', item.id, 'reject')" apiMethod="post" section="statementTransactionComponent" > From d1fb18d3f4a75050dd514e9850df6142e23459eb Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:18:41 +0800 Subject: [PATCH 02/12] reject statement transaction mapping api --- .../general/forms/GeneralConfirmationFormComponent.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/assets/vue/components/general/forms/GeneralConfirmationFormComponent.vue b/resources/assets/vue/components/general/forms/GeneralConfirmationFormComponent.vue index 45a4b007..361ef8b1 100644 --- a/resources/assets/vue/components/general/forms/GeneralConfirmationFormComponent.vue +++ b/resources/assets/vue/components/general/forms/GeneralConfirmationFormComponent.vue @@ -15,8 +15,7 @@
Cancel
- -
{{ buttonText }}
+
{{ buttonText }}
From 59b7a12a26781cc19f93d6a6f52b24002a0cffcd Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:21:36 +0800 Subject: [PATCH 03/12] reject statement transaction mapping api --- .../ControllersLogic/UpdateStatementTransactionStatusLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php index da9949d2..4319dee6 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php @@ -32,7 +32,7 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic * @param FetchesStatementTransaction $fetchesStatementTransaction */ public function __construct( - FetchesStatementTransaction $fetchesStatementTransaction, + FetchesStatementTransaction $fetchesStatementTransaction ) { $this->fetchesStatementTransaction = $fetchesStatementTransaction; } From 57393c909f5d60009085533759a626e006442675 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:23:27 +0800 Subject: [PATCH 04/12] reject statement transaction mapping api --- .../UpdateStatementTransactionStatusLogic.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php index 4319dee6..a43a07f0 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php @@ -48,6 +48,10 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic { $statementTrasaction = $this->fetchesStatementTransaction->execute(['id' => $request->route('id')]); + $statementTrasactionOwner = $statementTrasaction->owner->first(); + + dd($statementTrasactionOwner); + return $this->resourceResponse(new BankStatementTransactionResource($statementTrasaction)); } } From 87026bfd16fd3f10f9768971ac79a92dc0929ad0 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 16:26:21 +0800 Subject: [PATCH 05/12] reject statement transaction mapping api --- .../ControllersLogic/UpdateStatementTransactionStatusLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php index a43a07f0..296981a0 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php @@ -48,7 +48,7 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic { $statementTrasaction = $this->fetchesStatementTransaction->execute(['id' => $request->route('id')]); - $statementTrasactionOwner = $statementTrasaction->owner->first(); + $statementTrasactionOwner = $statementTrasaction->owners->first(); dd($statementTrasactionOwner); From 6f1b723b8f8faea1604d5d3d1ee40ad7c258002e Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:04:52 +0800 Subject: [PATCH 06/12] reject statement transaction mapping api --- .../UpdateStatementTransactionStatusLogic.php | 25 ++-- .../BankStatementTransactionObject.php | 137 ++++++++++++++++++ ...=> BankStatementTrasactionOwnerObject.php} | 2 +- ...hp => FetchesBankStatementTransaction.php} | 2 +- .../UpdatesBankStatementTransactionOwner.php | 32 ++++ ...tesBankStatementTransactionOwnerStatus.php | 22 +++ routes/accounting.php | 2 +- 7 files changed, 210 insertions(+), 12 deletions(-) create mode 100644 app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTransactionObject.php rename app/Classes/Modules/Accounting/DataTransferObjects/{BankStatementDetailObject.php => BankStatementTrasactionOwnerObject.php} (92%) rename app/Classes/Modules/Accounting/Services/{FetchesStatementTransaction.php => FetchesBankStatementTransaction.php} (90%) create mode 100644 app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwner.php create mode 100644 app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwnerStatus.php diff --git a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php index 296981a0..29163a0c 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/UpdateStatementTransactionStatusLogic.php @@ -3,9 +3,10 @@ namespace App\Classes\Modules\Accounting\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; -use App\Classes\Modules\Accounting\Services\FetchesStatementTransaction; +use App\Classes\Modules\Accounting\Services\FetchesBankStatementTransaction; use App\Http\Resources\BankStatementTransactionResource; -use Carbon\Carbon; +use App\Classes\Modules\Accounting\Services\UpdatesBankStatementTransactionOwnerStatus; +use App\Classes\ValueObjects\Constants\ApprovalStatus; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; @@ -24,17 +25,23 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic ]; } - /** @var FetchesStatementTransaction */ - private $fetchesStatementTransaction; + /** @var FetchesBankStatementTransaction */ + private $fetchesBankStatementTransaction; + + /** @var UpdatesBankStatementTransactionOwnerStatus */ + private $updatesBankStatementTransactionOwnerStatus; /** * UpdateAnnouncementLogic constructor. - * @param FetchesStatementTransaction $fetchesStatementTransaction + * @param FetchesBankStatementTransaction $fetchesBankStatementTransaction + * @param UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus */ public function __construct( - FetchesStatementTransaction $fetchesStatementTransaction + FetchesBankStatementTransaction $fetchesBankStatementTransaction, + UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus ) { - $this->fetchesStatementTransaction = $fetchesStatementTransaction; + $this->fetchesBankStatementTransaction = $fetchesBankStatementTransaction; + $this->updatesBankStatementTransactionOwnerStatus = $updatesBankStatementTransactionOwnerStatus; } /** @@ -46,11 +53,11 @@ class UpdateStatementTransactionStatusLogic extends AbstractControllerLogic */ public function logic(Request $request): JsonResponse { - $statementTrasaction = $this->fetchesStatementTransaction->execute(['id' => $request->route('id')]); + $statementTrasaction = $this->fetchesBankStatementTransaction->execute(['id' => $request->route('id')]); $statementTrasactionOwner = $statementTrasaction->owners->first(); - dd($statementTrasactionOwner); + $this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner, $request->route('status') == 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); return $this->resourceResponse(new BankStatementTransactionResource($statementTrasaction)); } diff --git a/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTransactionObject.php b/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTransactionObject.php new file mode 100644 index 00000000..30bac5d3 --- /dev/null +++ b/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTransactionObject.php @@ -0,0 +1,137 @@ +statement_transaction_id = $statement_transaction_id; + $this->type = $type; + $this->system = $system; + $this->owner_type = $owner_type; + $this->owner_id = $owner_id; + $this->invoice_reference = $invoice_reference; + $this->receipt_reference = $receipt_reference; + $this->is_auto_mapped = $is_auto_mapped; + $this->status = $status; + } + + /** + * @return int + */ + public function getStatementTransactionId(): int + { + return $this->statement_transaction_id; + } + + /** + * @return int + */ + public function getType(): int + { + return $this->type; + } + + /** + * @return string + */ + public function getOwnerType(): string + { + return $this->owner_type; + } + + /** + * @return int + */ + public function getOwnerId(): int + { + return $this->owner_id; + } + + /** + * @return string + */ + public function getSystem(): string + { + return $this->system; + } + + /** + * @return string + */ + public function getInvoiceReference(): string + { + return $this->invoice_reference; + } + + /** + * @return string + */ + public function getReceipteReference(): string + { + return $this->receipt_reference; + } + + /** + * @return Boolean + */ + public function getIsAutoMapped(): Boolean + { + return $this->is_auto_mapped; + } + + /** + * @return int + */ + public function getStatus(): int + { + return $this->status; + } +} diff --git a/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementDetailObject.php b/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTrasactionOwnerObject.php similarity index 92% rename from app/Classes/Modules/Accounting/DataTransferObjects/BankStatementDetailObject.php rename to app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTrasactionOwnerObject.php index 8da675d6..07fe876e 100644 --- a/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementDetailObject.php +++ b/app/Classes/Modules/Accounting/DataTransferObjects/BankStatementTrasactionOwnerObject.php @@ -4,7 +4,7 @@ namespace App\Classes\Modules\Accounting\DataTransferObjects; use App\Classes\General\Interfaces\DataTransferObject; -class BankStatementDetailObject implements DataTransferObject +class BankStatementTrasactionOwnerObject implements DataTransferObject { /** @var string */ private $pay_for; diff --git a/app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php b/app/Classes/Modules/Accounting/Services/FetchesBankStatementTransaction.php similarity index 90% rename from app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php rename to app/Classes/Modules/Accounting/Services/FetchesBankStatementTransaction.php index 1ef2bdb3..d2bff6f9 100644 --- a/app/Classes/Modules/Accounting/Services/FetchesStatementTransaction.php +++ b/app/Classes/Modules/Accounting/Services/FetchesBankStatementTransaction.php @@ -7,7 +7,7 @@ use App\Classes\General\Eloquent\AbstractFetchRecord; use Illuminate\Database\Eloquent\Builder; use App\Models\StatementTransaction; -class FetchesStatementTransaction extends AbstractFetchRecord +class FetchesBankStatementTransaction extends AbstractFetchRecord { /** @var StatementTransaction */ diff --git a/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwner.php b/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwner.php new file mode 100644 index 00000000..6af3d3d6 --- /dev/null +++ b/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwner.php @@ -0,0 +1,32 @@ +statement_transaction_id = $object->getStatementTransactionId(); + $model->type = $object->getType(); + $model->system = $object->getSystem(); + $model->owner_type = $object->getOwnerType(); + $model->owner_id = $object->getOwnerId(); + $model->invoice_reference = $object->getInvoiceReference(); + $model->receipt_reference = $object->getReceipteReference(); + $model->is_auto_mapped = $object->getIsAutoMapped(); + $model->status = $object->getStatus(); + + return $this->handler($model); + } +} diff --git a/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwnerStatus.php b/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwnerStatus.php new file mode 100644 index 00000000..abcda20a --- /dev/null +++ b/app/Classes/Modules/Accounting/Services/UpdatesBankStatementTransactionOwnerStatus.php @@ -0,0 +1,22 @@ +status = $status; + return $this->handler($model); + } +} diff --git a/routes/accounting.php b/routes/accounting.php index b59bf98f..f6b1ba8c 100644 --- a/routes/accounting.php +++ b/routes/accounting.php @@ -11,6 +11,6 @@ Route::group(['prefix' => 'accounting', 'as' => 'accounting.', 'namespace' => 'A }); Route::group(['prefix' => 'statement_transaction', 'as' => 'statement_transaction.'], function () { - Route::post('/{id}/owner/{status}', 'UpdateStatementTransactionStatusController@update')->name('owner.status.update'); + Route::post('/{id}/owner/{status}', 'UpdateStatementTransactionStatusController@update')->where('status', 'approve|reject')->name('owner.status.update'); }); }); From 81f26e70411c84ee1919296433ce14590c3687a4 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:11:50 +0800 Subject: [PATCH 07/12] reject statement transaction mapping api --- .../accounting/elements/StatementTransactionComponent.vue | 6 +++++- .../accounting/bank-statements/bank_statement.blade.php | 2 +- .../pages/accounting/bank-statements/details.blade.php | 2 +- .../views/pages/accounting/bank-statements/index.blade.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue index b28dcc1b..ca74940b 100644 --- a/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue +++ b/resources/assets/vue/components/accounting/elements/StatementTransactionComponent.vue @@ -71,7 +71,7 @@ class="text-center" :apiRoute="route('api.accounting.statement_transaction.owner.status.update', item.id, 'reject')" apiMethod="post" - section="statementTransactionComponent" + :section="section" > @@ -91,6 +91,10 @@ type: Number, default: 0 }, + section:{ + type: String, + required: true + } }, methods: { typeString(type){ diff --git a/resources/views/pages/accounting/bank-statements/bank_statement.blade.php b/resources/views/pages/accounting/bank-statements/bank_statement.blade.php index 87bbf321..ed1f0db0 100644 --- a/resources/views/pages/accounting/bank-statements/bank_statement.blade.php +++ b/resources/views/pages/accounting/bank-statements/bank_statement.blade.php @@ -4,7 +4,7 @@
diff --git a/resources/views/pages/accounting/bank-statements/details.blade.php b/resources/views/pages/accounting/bank-statements/details.blade.php index 6c0caf8b..ac83c27b 100644 --- a/resources/views/pages/accounting/bank-statements/details.blade.php +++ b/resources/views/pages/accounting/bank-statements/details.blade.php @@ -2,7 +2,7 @@ @section('inner_content')
- +
@endsection diff --git a/resources/views/pages/accounting/bank-statements/index.blade.php b/resources/views/pages/accounting/bank-statements/index.blade.php index 34184e2d..6b7e0221 100644 --- a/resources/views/pages/accounting/bank-statements/index.blade.php +++ b/resources/views/pages/accounting/bank-statements/index.blade.php @@ -307,7 +307,7 @@
From 4681a39cd1d20afd829f639de3b390ea09667fbc Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:40:35 +0800 Subject: [PATCH 08/12] groupApprove statement transaction mapping api --- .../GroupApproveStatementTransactionLogic.php | 62 +++++++++++++++++++ ...pApproveStatementTransactionController.php | 20 ++++++ .../sections/TransactionsMappingComponent.vue | 2 +- routes/accounting.php | 1 + 4 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php create mode 100644 app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php diff --git a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php new file mode 100644 index 00000000..fbc82057 --- /dev/null +++ b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php @@ -0,0 +1,62 @@ + 'Group Approve Statement Transaction', + 'message' => 'You have successfully approveed a group of Statement Transation' + ]; + } + + /** @var ListsBankStatementTransactions */ + private $listsBankStatementTransactions; + + /** @var UpdatesBankStatementTransactionOwnerStatus */ + private $updatesBankStatementTransactionOwnerStatus; + + /** + * UpdateAnnouncementLogic constructor. + * @param ListsBankStatementTransactions $listsBankStatementTransactions + * @param UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus + */ + public function __construct( + ListsBankStatementTransactions $listsBankStatementTransactions, + UpdatesBankStatementTransactionOwnerStatus $updatesBankStatementTransactionOwnerStatus + ) { + $this->listsBankStatementTransactions = $listsBankStatementTransactions; + $this->updatesBankStatementTransactionOwnerStatus = $updatesBankStatementTransactionOwnerStatus; + } + + /** + * @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 + { + $statementTrasactions = $this->listsBankStatementTransactions->execute($this->listsBankStatementTransactions->deserializeFilters( + json_decode("{min_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}}", true) + )); + + return $this->collectionResponse(BankStatementTransactionResource::collection($statementTrasactions)); + } +} diff --git a/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php b/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php new file mode 100644 index 00000000..fdb45876 --- /dev/null +++ b/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue b/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue index 2d9459c1..fc074f92 100644 --- a/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue +++ b/resources/assets/vue/components/accounting/sections/TransactionsMappingComponent.vue @@ -66,7 +66,7 @@ contentText="Are you sure you want to approve all these Transaction?" modalType="confirm" class="text-center" - :apiRoute="route('api.company.delete', 1)" + :apiRoute="route('api.accounting.statement_transaction.owner.groupApprove')" apiMethod="post" :section="section" > diff --git a/routes/accounting.php b/routes/accounting.php index f6b1ba8c..107aa269 100644 --- a/routes/accounting.php +++ b/routes/accounting.php @@ -11,6 +11,7 @@ Route::group(['prefix' => 'accounting', 'as' => 'accounting.', 'namespace' => 'A }); Route::group(['prefix' => 'statement_transaction', 'as' => 'statement_transaction.'], function () { + Route::post('/owner/group-approve', 'GroupApproveStatementTransactionController@approve')->name('owner.groupApprove'); Route::post('/{id}/owner/{status}', 'UpdateStatementTransactionStatusController@update')->where('status', 'approve|reject')->name('owner.status.update'); }); }); From 4ede279a0fb71675a8f0a50629ddb7ab4afe1fed Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:44:56 +0800 Subject: [PATCH 09/12] groupApprove statement transaction mapping api --- .../Accounting/GroupApproveStatementTransactionController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php b/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php index fdb45876..9f242704 100644 --- a/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php +++ b/app/Http/Controllers/Accounting/GroupApproveStatementTransactionController.php @@ -13,7 +13,7 @@ class GroupApproveStatementTransactionController * @param ApprovePaymentLogic $logic * @return JsonResponse */ - public function update(Request $request, GroupApproveStatementTransactionLogic $logic): JsonResponse { + public function approve(Request $request, GroupApproveStatementTransactionLogic $logic): JsonResponse { return $logic->execute($request); } From 6e32b0accbff08192311e72c7237611cd949d558 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:47:00 +0800 Subject: [PATCH 10/12] groupApprove statement transaction mapping api --- .../GroupApproveStatementTransactionLogic.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php index fbc82057..d97c3942 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php @@ -57,6 +57,12 @@ class GroupApproveStatementTransactionLogic extends AbstractControllerLogic json_decode("{min_amount: 0, is_mapped: true, is_mapped_with_multiple: false, statement_transaction_owner_type_in: [1, 2], statement_transaction_owner_status_in: [1], per_page: 100, order_by: {column: 'posting_date', DESC: true}}", true) )); + foreach ($statementTrasactions as $statementTrasaction) { + $statementTrasactionOwner = $statementTrasaction->owners->first(); + + $this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner, ApprovalStatus::APPROVED); + } + return $this->collectionResponse(BankStatementTransactionResource::collection($statementTrasactions)); } } From b372ee9e13048ed5496adfc8f6316d7c504e2f19 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:49:14 +0800 Subject: [PATCH 11/12] groupApprove statement transaction mapping api --- .../ControllersLogic/GroupApproveStatementTransactionLogic.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php index d97c3942..a2aca9bc 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php @@ -59,6 +59,8 @@ class GroupApproveStatementTransactionLogic extends AbstractControllerLogic foreach ($statementTrasactions as $statementTrasaction) { $statementTrasactionOwner = $statementTrasaction->owners->first(); + + dd($statementTrasactionOwner); $this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner, ApprovalStatus::APPROVED); } From f8260258fc376c9816a2febfe08b76ef2e46d3cc Mon Sep 17 00:00:00 2001 From: edmondlang Date: Thu, 20 Apr 2023 17:50:36 +0800 Subject: [PATCH 12/12] groupApprove statement transaction mapping api --- .../GroupApproveStatementTransactionLogic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php index a2aca9bc..ca1fa786 100644 --- a/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php +++ b/app/Classes/Modules/Accounting/ControllersLogic/GroupApproveStatementTransactionLogic.php @@ -58,11 +58,11 @@ class GroupApproveStatementTransactionLogic extends AbstractControllerLogic )); foreach ($statementTrasactions as $statementTrasaction) { - $statementTrasactionOwner = $statementTrasaction->owners->first(); - - dd($statementTrasactionOwner); + $statementTrasactionOwner = $statementTrasaction->owners; - $this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner, ApprovalStatus::APPROVED); + if (count($statementTrasactionOwner)) { + $this->updatesBankStatementTransactionOwnerStatus->execute($statementTrasactionOwner->first(), ApprovalStatus::APPROVED); + } } return $this->collectionResponse(BankStatementTransactionResource::collection($statementTrasactions));