Skip to content
Snippets Groups Projects
Commit 6f4f0b7a authored by Ingrid Martinsheimen Egge's avatar Ingrid Martinsheimen Egge :cow2:
Browse files

css

parent de2904f4
No related branches found
No related tags found
1 merge request!13Fridge view
Pipeline #222927 failed
......@@ -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;
}
......
......@@ -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}})
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment