Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
idatt2106_2024_02_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 - Gruppe 2
idatt2106_2024_02_frontend
Commits
32dc94d2
Commit
32dc94d2
authored
11 months ago
by
Eline Evje
Browse files
Options
Downloads
Patches
Plain Diff
feat: implemented view for total amount spent on items
parent
7642606c
No related branches found
Branches containing commit
No related tags found
3 merge requests
!66
Final merge
,
!14
Enhancement/implement more config steps
,
!4
Pipeline fix
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/router/index.ts
+5
-0
5 additions, 0 deletions
src/router/index.ts
src/views/ConfigSpendingItemsTotalAmountView.vue
+67
-0
67 additions, 0 deletions
src/views/ConfigSpendingItemsTotalAmountView.vue
with
72 additions
and
0 deletions
src/router/index.ts
+
5
−
0
View file @
32dc94d2
...
...
@@ -54,6 +54,11 @@ const router = createRouter({
name
:
'
configurations4
'
,
component
:
()
=>
import
(
'
../views/ConfigSpendingItemsAmountView.vue
'
)
},
{
path
:
'
/konfigurasjonSteg5
'
,
name
:
'
configurations5
'
,
component
:
()
=>
import
(
'
../views/ConfigSpendingItemsTotalAmountView.vue
'
)
},
{
path
:
'
/forsteSparemaal
'
,
name
:
'
firstSavingGoal
'
,
...
...
This diff is collapsed.
Click to expand it.
src/views/ConfigSpendingItemsTotalAmountView.vue
0 → 100644
+
67
−
0
View file @
32dc94d2
<
template
>
<div
class=
"flex flex-col items-center justify-center min-h-screen px-4 text-center"
>
<h1
class=
"mb-8 lg:mb-12 text-4xl font-bold"
>
Hvor mye bruker du total per uke på ...
</h1>
<div
class=
"flex flex-col gap-2 mb-6"
>
<div
v-for=
"(option, index) in options"
:key=
"index"
class=
"flex items-center w-80 p-2 cursor-pointer transition-colors bg-white rounded-lg my-4"
>
<div
class=
"flex flex-1 justify-start"
>
<p
class=
"text-2xl font-bold"
>
{{
option
.
name
}}
</p>
</div>
<div
class=
"flex flex-1 items-center justify-end"
>
<input
type=
"text"
v-model=
"option.amount"
@
input=
"($event) => filterAmount(index, $event)"
class=
"h-10 px-2 w-2/3 rounded-md text-right text-lg focus:outline-none"
:class=
"
{
'border-2 border-gray-300': option.amount === '',
'border-4 border-[var(--green)]': option.amount !== ''
}"
/>
<p
class=
"text-2xl font-bold ml-2"
>
kr
</p>
</div>
</div>
</div>
<ContinueButtonComponent
@
click=
"onButtonClick"
:disabled=
"options.some((option) => option.amount === '')"
:style=
"
{
opacity: options.some((option) => option.amount === '') ? '0.6' : '1',
cursor: options.some((option) => option.amount === '') ? 'not-allowed' : 'pointer',
filter: options.some((option) => option.amount === '')
? 'brightness(90%)'
: 'brightness(100%)'
}"
class="px-10 py-3 text-2xl self-end mt-16 mb-0"
>
</ContinueButtonComponent>
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
ref
}
from
'
vue
'
import
ContinueButtonComponent
from
'
@/components/ContinueButtonComponent.vue
'
import
router
from
'
@/router
'
interface
Option
{
name
:
string
amount
:
string
}
const
options
=
ref
<
Option
[]
>
([
{
name
:
'
Snus
'
,
amount
:
''
},
{
name
:
'
Kaffe
'
,
amount
:
''
},
{
name
:
'
Kantina
'
,
amount
:
''
}
])
const
onButtonClick
=
()
=>
{
router
.
push
(
'
/
'
)
}
const
filterAmount
=
(
index
:
number
,
event
:
Event
)
=>
{
const
input
=
event
.
target
as
HTMLInputElement
options
.
value
[
index
].
amount
=
input
.
value
.
replace
(
/
[^\d
,
]
/g
,
''
)
}
</
script
>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment