diff --git a/app/Classes/General/Abstracts/AbstractRule.php b/app/Classes/General/Abstracts/AbstractRule.php index d2e0568b..8a9b6f86 100644 --- a/app/Classes/General/Abstracts/AbstractRule.php +++ b/app/Classes/General/Abstracts/AbstractRule.php @@ -27,7 +27,7 @@ abstract class AbstractRule public function passes(?DataTransferObject $object = null): bool { try { if(!$this->authorized()){ - throw new AccessForbiddenException('You don\'t have permission to preform this action'); + throw new AccessForbiddenException('You don\'t have permission to perform this action'); } $this->validators($object); @@ -36,7 +36,7 @@ abstract class AbstractRule return true; } catch(AccessForbiddenException $exception){ - throw new AccessForbiddenException('You don\'t have permission to preform this action'); + throw new AccessForbiddenException('You don\'t have permission to perform this action'); } catch(\Exception $exception){ throw new RequestValidationException($exception->getMessage()); } diff --git a/app/Classes/General/Interfaces/Remarkable.php b/app/Classes/General/Interfaces/Remarkable.php new file mode 100644 index 00000000..dcbd94ce --- /dev/null +++ b/app/Classes/General/Interfaces/Remarkable.php @@ -0,0 +1,13 @@ +fetchBookingQuotation = $fetchBookingQuotation; $this->fetchesTransaction = $fetchesTransaction; @@ -69,6 +75,7 @@ class CreateBookingRefundLogic extends AbstractControllerLogic $this->generatesTransactionBillNumber = $generatesTransactionBillNumber; $this->createsTransaction = $createsTransaction; $this->updateRefundTransactionStatusLogic = $updateRefundTransactionStatusLogic; + $this->createRemarkProcessor = $createRemarkProcessor; } /** @@ -132,6 +139,11 @@ class CreateBookingRefundLogic extends AbstractControllerLogic } + if($request->input('refundRemark')){ + $remarkObject = new RemarkObject($request->input('refundRemark'), Auth()->user()->id); + $this->createRemarkProcessor->execute($this->fetchesTransaction->execute(['id' => $refund_transaction->id]), $remarkObject); + } + return $this->resourceResponse(new TransactionResource($refund_transaction)); } diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php index a7d2e5b1..fc51178f 100644 --- a/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanCreateRemark.php @@ -26,7 +26,7 @@ class CanCreateRemark extends AbstractRule /** * @return bool */ - protected function authorized($object): bool + protected function authorized(): bool { // TODO Set Authorization rules return true; diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php index 1c61ac9d..7ddece31 100644 --- a/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanDeleteRemark.php @@ -13,7 +13,7 @@ class CanDeleteRemark extends AbstractRule /** * @return bool */ - protected function authorized($object): bool + protected function authorized(): bool { // TODO Set Authorization rules return true; diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanFetchRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanFetchRemark.php index 31ae8301..6642611c 100644 --- a/app/Classes/Modules/Remarks/Standards/Rules/CanFetchRemark.php +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanFetchRemark.php @@ -13,7 +13,7 @@ class CanFetchRemark extends AbstractRule /** * @return bool */ - protected function authorized($object): bool + protected function authorized(): bool { // TODO Set Authorization rules return true; diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanListRemarks.php b/app/Classes/Modules/Remarks/Standards/Rules/CanListRemarks.php index b1372049..4911a53b 100644 --- a/app/Classes/Modules/Remarks/Standards/Rules/CanListRemarks.php +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanListRemarks.php @@ -13,7 +13,7 @@ class CanListRemarks extends AbstractRule /** * @return bool */ - protected function authorized($object): bool + protected function authorized(): bool { // TODO Set Authorization rules return true; diff --git a/app/Classes/Modules/Remarks/Standards/Rules/CanUpdateRemark.php b/app/Classes/Modules/Remarks/Standards/Rules/CanUpdateRemark.php index f6fd6587..8a8c10e8 100644 --- a/app/Classes/Modules/Remarks/Standards/Rules/CanUpdateRemark.php +++ b/app/Classes/Modules/Remarks/Standards/Rules/CanUpdateRemark.php @@ -26,7 +26,7 @@ class CanUpdateRemark extends AbstractRule /** * @return bool */ - protected function authorized($object): bool + protected function authorized(): bool { // TODO Set Authorization rules return true; diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index b431c854..d259d777 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -53,6 +53,7 @@ class TransactionResource extends JsonResource 'value' => $days->gt(Carbon::now()) ? '+' : '-', 'duration' => $days->diff(Carbon::now())->format('%d'), ], + 'remarks' => RemarkResource::collection($this->remarks), 'redemption' => new VoucherRedemptionResource($this->voucherRedemption) ]; } diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index aba5decc..31b67e69 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Classes\General\Interfaces\Documentable; +use App\Classes\General\Interfaces\Remarkable; use App\Classes\General\Interfaces\Transactionable; use App\Classes\General\Interfaces\Voucherifiable; use App\Classes\General\Traits\LogData; @@ -21,7 +22,7 @@ use Staudenmeir\EloquentHasManyDeep\HasTableAlias; use App\Models\StatementTransactionOwner; -class Transaction extends AbstractModel implements Documentable, Transactionable, Voucherifiable +class Transaction extends AbstractModel implements Documentable, Transactionable, Voucherifiable, Remarkable { use HasTableAlias; use SoftDeletes; diff --git a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue index 7679b807..ac77bc06 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue @@ -332,6 +332,14 @@
+ Nothing To Show Here Yet!
+{{item.content}}
-