Skip to content

Commit

Permalink
Merge pull request #61 from deanblackborough/v1.06.0
Browse files Browse the repository at this point in the history
v1.06.0
  • Loading branch information
deanblackborough authored Jan 12, 2023
2 parents a43c81b + 278194c commit f5800a1
Show file tree
Hide file tree
Showing 30 changed files with 554 additions and 366 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/BudgetAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function create(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -91,6 +92,7 @@ public function update(Request $request, $account_id)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down
6 changes: 6 additions & 0 deletions app/Http/Controllers/BudgetItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function confirmDelete(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -170,6 +171,7 @@ public function confirmDisable(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -258,6 +260,7 @@ public function confirmEnable(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -326,6 +329,7 @@ private function create(Request $request, string $view)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -500,6 +504,7 @@ public function index(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down Expand Up @@ -671,6 +676,7 @@ public function update(Request $request)
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),

'accounts' => $budget->accounts(),
'months' => $budget->months(),
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public function home(Request $request)
'has_accounts' => $budget->hasAccounts(),
'has_budget' => $budget->hasBudget(),
'has_savings_account' => $budget->hasSavingsAccount(),
'has_paid_items' => $budget->hasPaidItems()
'has_paid_items' => $budget->hasPaidItems(),
'now_visible' => $budget->nowVisible(),
]
);
}
Expand Down
1 change: 1 addition & 0 deletions app/Notifications/Registered.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function toMail($notifiable)
->line('Budget is powered by the Costs to Expect API and your account is usable across all of our services.')
->line('If you registered in error or want to delete your account, just access "Your Account" within the App and click on one of the delete options.')
->line('If you want to download your data please reach out to us, we haven\'t yet had time to build the feature.')
->line('By using Budget your are agreeing to our Privacy Policy, please review the policy to ensure you are happy, short story, we don\'t share anything ans we don\'t track you.')
->action('Sign-in', url('/sign-in'))
->line('Thanks again for choosing Budget, we hope it helps!');
}
Expand Down
15 changes: 15 additions & 0 deletions app/Service/Budget/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class Service
'year' => null,
];

private bool $now_visible = false;

private DateTimeZone $timezone;

public function __construct(DateTimeZone $timezone)
Expand Down Expand Up @@ -218,6 +220,10 @@ private function setUpMonths(): void
($this->now_year === $year_int && $this->now_month === $month_int),
false
);

if ($this->now_year === $year_int && $this->now_month === $month_int) {
$this->now_visible = true;
}
}
}

Expand All @@ -241,6 +247,10 @@ private function setUpMonths(): void
true,
($this->now_year === $year_int && $this->now_month === $month_int)
);

if ($this->now_year === $year_int && $this->now_month === $month_int) {
$this->now_visible = true;
}
}
}

Expand All @@ -254,6 +264,11 @@ public function nowYear(): int
return $this->now_year;
}

public function nowVisible(): bool
{
return $this->now_visible;
}

public function numberOfItems(): int
{
return count($this->budget_items);
Expand Down
27 changes: 16 additions & 11 deletions app/View/Components/Budget.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ class Budget extends Component

private array $view_end;

private ?string $active_item;
private ?int $active_item_year;
private ?int $active_item_month;

private bool $projection;

private bool $has_accounts;
Expand All @@ -30,6 +26,12 @@ class Budget extends Component

private bool $has_paid_items;

private ?string $active_item;
private ?int $active_item_year;
private ?int $active_item_month;

private bool $now_visible;

public function __construct(
array $accounts,
array $months,
Expand All @@ -40,6 +42,7 @@ public function __construct(
bool $hasBudget = true,
bool $hasSavingsAccount = false,
bool $hasPaidItems = false,
bool $nowVisible = true,
?string $activeItem = null,
?int $activeItemYear = null,
?int $activeItemMonth = null,
Expand All @@ -49,14 +52,15 @@ public function __construct(
$this->months = $months;
$this->pagination = $pagination;
$this->view_end = $viewEnd;
$this->active_item = $activeItem;
$this->active_item_year = $activeItemYear;
$this->active_item_month = $activeItemMonth;
$this->projection = $projection;
$this->has_accounts = $hasAccounts;
$this->has_budget = $hasBudget;
$this->has_savings_account = $hasSavingsAccount;
$this->has_paid_items = $hasPaidItems;
$this->now_visible = $nowVisible;
$this->active_item = $activeItem;
$this->active_item_year = $activeItemYear;
$this->active_item_month = $activeItemMonth;
}

public function render()
Expand All @@ -68,14 +72,15 @@ public function render()
'months' => $this->months,
'pagination' => $this->pagination,
'view_end' => $this->view_end,
'active_item' => $this->active_item,
'active_item_year' => $this->active_item_year,
'active_item_month' => $this->active_item_month,
'projection' => $this->projection,
'has_accounts' => $this->has_accounts,
'has_budget' => $this->has_budget,
'has_savings_account' => $this->has_savings_account,
'has_paid_items' => $this->has_paid_items
'has_paid_items' => $this->has_paid_items,
'now_visible' => $this->now_visible,
'active_item' => $this->active_item,
'active_item_year' => $this->active_item_year,
'active_item_month' => $this->active_item_month,
]
);
}
Expand Down
Loading

0 comments on commit f5800a1

Please sign in to comment.