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 Scrum Team 02
Frontend
Commits
6f4f0b7a
Commit
6f4f0b7a
authored
1 year ago
by
Ingrid Martinsheimen Egge
Browse files
Options
Downloads
Patches
Plain Diff
css
parent
de2904f4
No related branches found
No related tags found
1 merge request
!13
Fridge view
Pipeline
#222927
failed
1 year ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/FridgeItem.vue
+11
-7
11 additions, 7 deletions
src/components/FridgeItem.vue
src/components/ItemSearch.vue
+10
-11
10 additions, 11 deletions
src/components/ItemSearch.vue
with
21 additions
and
18 deletions
src/components/FridgeItem.vue
+
11
−
7
View file @
6f4f0b7a
...
...
@@ -33,7 +33,7 @@ export default {
return
'
#EE6D6D
'
;
}
else
{
return
'
black
'
;
return
'
#737573
'
;
}
},
getImage
(){
...
...
@@ -61,7 +61,7 @@ export default {
case
3
:
return
"
Utgår om tre dager
"
default
:
return
"
Utgår
"
+
this
.
actualItem
.
exp_date
return
"
Utgår
"
+
this
.
actualItem
.
exp_date
.
split
(
'
T
'
)[
0
]
}
}
},
...
...
@@ -82,13 +82,14 @@ export default {
},
methods
:
{
getDateDifference
(){
//returns the difference between two dates
const
date
=
this
.
actualItem
.
exp_date
.
split
(
'
.
'
);
//todo
const
dateFormat
=
date
[
1
]
+
"
/
"
+
date
[
0
]
+
"
/
"
+
date
[
2
];
const
expDate
=
new
Date
(
dateFormat
);
let
date
=
this
.
actualItem
.
exp_date
.
split
(
'
T
'
)[
0
];
const
epDate
=
new
Date
(
date
);
const
expDate
=
Date
.
parse
(
epDate
)
const
today
=
new
Date
();
const
ms
=
expDate
-
today
;
const
numOfDays
=
Math
.
ceil
(
ms
/
(
86400000
))
console
.
log
(
numOfDays
)
return
numOfDays
;
},
appleBtnPressed
(){
...
...
@@ -114,16 +115,19 @@ export default {
}
#fridgeItemName
{
font-weight
:
bold
;
font-weight
:
normal
;
font-size
:
1
.2em
;
}
img
{
width
:
3rem
;
height
:
3em
;
border-radius
:
50%
;
background-color
:
#00663C
;
margin-right
:
.6em
;
object-fit
:
cover
;
}
...
...
This diff is collapsed.
Click to expand it.
src/components/ItemSearch.vue
+
10
−
11
View file @
6f4f0b7a
...
...
@@ -18,6 +18,7 @@
<
script
>
import
{
API
}
from
"
@/util/API
"
;
import
router
from
"
@/router
"
;
export
default
{
name
:
"
itemSearch
"
,
...
...
@@ -33,21 +34,19 @@ export default {
methods
:
{
async
search
()
{
this
.
searchResult
=
await
API
.
searchItems
(
this
.
itemSearch
);
this
.
selectedItem
=
this
.
searchResult
[
0
];
this
.
selectedItem
=
this
.
searchResult
[
0
];
},
addToFridge
(){
const
num
=
this
.
numOfItemsToAdd
;
API
.
addToFridge
(
{
"
itemId
"
:
Number
(
this
.
selectedItem
.
id
),
"
amount
"
:
{
"
quantity
"
:
this
.
selectedItem
.
amount
.
quantity
*
num
,
"
unit
"
:
this
.
selectedItem
.
amount
.
unit
}}).
then
(()
=>
router
.
push
(
'
/myFridge
'
))
/*const ingredient = {
{itemId: 123,
amount: this.selectedItem.amount}
}*/
//const request = [{ingredient}]
//const request = [{ingredient_id: ingred},{ingredient: ingred}]
//const request = [{ingredient: JSON.stringify(ingred)}]
//console.log(request)
API
.
addToFridge
({
"
itemId
"
:
1
,
"
amount
"
:
{
"
quantity
"
:
this
.
selectedItem
.
amount
.
quantity
,
"
unit
"
:
this
.
selectedItem
.
amount
.
unit
}})
}
}
}
...
...
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