From d2fa8d8d34f33d77e41e2e6cc10644b84dfdb1a6 Mon Sep 17 00:00:00 2001 From: Jesus Guerrero Date: Sun, 10 Mar 2024 16:47:59 -0400 Subject: [PATCH] fix: allow just ready to assign as inflow category (#368) --- app/Listeners/UpdateBudgetAvailable.php | 26 ++++++++++++++++ app/Providers/EventServiceProvider.php | 13 ++++---- resources/js/Components/atoms/LogerButton.vue | 2 +- .../components/TransactionItems.vue | 30 ++++++++++++++----- .../components/TransactionModal.vue | 1 + 5 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 app/Listeners/UpdateBudgetAvailable.php diff --git a/app/Listeners/UpdateBudgetAvailable.php b/app/Listeners/UpdateBudgetAvailable.php new file mode 100644 index 00000000..55e4b01f --- /dev/null +++ b/app/Listeners/UpdateBudgetAvailable.php @@ -0,0 +1,26 @@ +transaction->team_id; + $date = $event->transaction->date; + (new BudgetRolloverService(new BudgetCategoryService()))->startFrom($teamId, substr($date, 0, 7)); + } +} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 8c58a483..95db0d81 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -16,6 +16,7 @@ use App\Listeners\CreateBudgetCategory; use App\Listeners\CreateBudgetMovement; use App\Listeners\CreateStartingBalance; +use App\Listeners\UpdateBudgetAvailable; use Insane\Journal\Events\AccountCreated; use Insane\Journal\Events\AccountUpdated; use Laravel\Jetstream\Events\TeamCreated; @@ -23,6 +24,9 @@ use App\Listeners\HandleTransactionCreated; use App\Listeners\CreateOccurrenceAutomation; use Insane\Journal\Events\TransactionCreated; +use Insane\Journal\Events\TransactionDeleted; +use Insane\Journal\Events\TransactionUpdated; +use Laravel\Jetstream\Events\TeamMemberAdded; use Insane\Journal\Listeners\CreateTeamAccounts; use App\Listeners\CreateBudgetTransactionMovement; use App\Domains\Transaction\Listeners\UpdateOpenReconciliations; @@ -54,28 +58,25 @@ class EventServiceProvider extends ServiceProvider AccountCreated::class => [ CreateBudgetCategory::class, CreateStartingBalance::class, - CreateBudgetMovement::class, ], AccountUpdated::class => [ CreateBudgetCategory::class, - CreateBudgetMovement::class, ], TransactionCreated::class => [ CreateBudgetTransactionMovement::class, HandleTransactionCreated::class, CheckOccurrence::class, UpdateOpenReconciliations::class, - CreateBudgetMovement::class, + UpdateBudgetAvailable::class, ], TransactionUpdated::class => [ CreateBudgetTransactionMovement::class, - CreateBudgetMovement::class, + UpdateBudgetAvailable::class, ], TransactionDeleted::class => [ CreateBudgetTransactionMovement::class, - CreateBudgetMovement::class, + UpdateBudgetAvailable::class, ], - // App events AppCreated::class => [ ShowInApp::class, ], diff --git a/resources/js/Components/atoms/LogerButton.vue b/resources/js/Components/atoms/LogerButton.vue index 4a884461..b8951b90 100644 --- a/resources/js/Components/atoms/LogerButton.vue +++ b/resources/js/Components/atoms/LogerButton.vue @@ -18,7 +18,7 @@ export type ButtonVariants = keyof typeof variants; const props = withDefaults(defineProps<{ variant: ButtonVariants, as?: Object| string, - processing: boolean, + processing?: boolean, disabled?: boolean icon?: string | Object }>(), { diff --git a/resources/js/domains/transactions/components/TransactionItems.vue b/resources/js/domains/transactions/components/TransactionItems.vue index e34253c2..ceb5b053 100644 --- a/resources/js/domains/transactions/components/TransactionItems.vue +++ b/resources/js/domains/transactions/components/TransactionItems.vue @@ -1,6 +1,5 @@