Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
frontend
Merge requests
!39
Feat/budget
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feat/budget
feat/Budget
into
main
Overview
0
Commits
3
Pipelines
1
Changes
6
Merged
Jens Christian Aanestad
requested to merge
feat/Budget
into
main
1 year ago
Overview
0
Commits
3
Pipelines
1
Changes
6
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
1f274394
3 commits,
1 year ago
6 files
+
72
−
15
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
src/components/Budget/BudgetBox.vue
+
11
−
2
Options
@@ -3,7 +3,6 @@ import { onMounted, ref } from 'vue'
import
{
useRouter
}
from
'
vue-router
'
const
router
=
useRouter
();
const
props
=
defineProps
({
title
:
{
type
:
String
,
@@ -19,16 +18,26 @@ const props = defineProps({
}
})
// Calculated balance variable
let
balance
=
props
.
budget
-
props
.
expenses
// Reactive variable for determining background color
const
iRef
=
ref
(
null
)
/**
* Checks if the balance is positive, and depending on the value
* changes background color to green (positive) or red (negative)
*/
onMounted
(()
=>
{
if
(
balance
>=
0
)
{
// By default, the background is set to red
iRef
.
value
.
style
.
backgroundColor
=
'
rgba(34, 231, 50, 0.43)
'
;
}
})
// TODO consider store chosen budget in a pinia store
/**
* Navigates to the pressed budget
*/
const
onBudgetContainerPressed
=
()
=>
{
router
.
push
(
'
/budget
'
)
}
Loading