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

Fjernet komponent

parent f91b7cc5
No related branches found
No related tags found
1 merge request!21Merge profilinnstillinger into main
<template>
<h1>App-innstillinger</h1>
<form @submit.prevent="submit">
<h2>-Matpreferanser-</h2>
<p class ="infoText">Hvis huket av, så vil du kun få oppskrifter av disse typene:</p>
<input type="checkbox" id="vegetar" name="vegetar" value="vegetar">
<label for="vegetar"> vegetar </label><br>
<input type="checkbox" id="vegan" name="vegan" value="vegan">
<label for="vegan"> vegan </label><br>
<br>
<h2>-Allergener-</h2>
<p class ="infoText">Du vil ikke få forslag om oppskrifter med disse varene:</p>
<input type="checkbox" id="gluten" name="gluten" value="Gluten">
<label for="allergen"> gluten</label><br>
<input type="checkbox" id="nøtter" name="nøtter" value="nøtter">
<label for="allergen"> nøtter</label><br>
<input type="checkbox" id="melk" name="melk" value="melk">
<label for="allergen"> melk</label><br>
<button class="saveBtn" @click="saveFoodPreference">Lagre matpreferanser <br> og allergener</button>
</form>
</template>
<script>
export default {
name: "AppSettings"
}
</script>
<style scoped>
</style>
\ No newline at end of file
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
<div id ="item"> <div id ="item">
<img :src="getImage" alt=""> <img :src="getImage" alt="">
<div id="itemInfo"> <div id="itemInfo">
<p id="fridgeItemName">{{this.actualItem.item.name }} {{ this.actualItem.amount.quantity }}{{this.actualItem.item.amount.unit}}</p> <p id="fridgeItemName">{{ this.fridgeItem.item.name }} {{
this.fridgeItem.amount.quantity
}}{{ this.fridgeItem.item.amount.unit }}</p>
<p class="expText" :style="{color:expirationTextColor}">{{expirationText}}</p> <p class="expText" :style="{color:expirationTextColor}">{{expirationText}}</p>
</div> </div>
<div id = "appleBtn" @click="appleBtnPressed"> <div id = "appleBtn" @click="appleBtnPressed">
...@@ -36,7 +38,7 @@ export default { ...@@ -36,7 +38,7 @@ export default {
} }
}, },
getImage(){ getImage(){
return this.actualItem.item.image_url; return this.fridgeItem.item.image_url;
}, },
expirationText() { expirationText() {
...@@ -66,11 +68,7 @@ export default { ...@@ -66,11 +68,7 @@ export default {
} }
}, },
props: { props: {
item: { fridgeItem: {
type:Object,
required: false,
},
actualItem: {
type: Object, type: Object,
required:false, required:false,
}, },
...@@ -82,7 +80,7 @@ export default { ...@@ -82,7 +80,7 @@ export default {
}, },
methods: { methods: {
getDateDifference(){ //returns the difference in days between the expiration date and today getDateDifference(){ //returns the difference in days between the expiration date and today
let date = this.actualItem.exp_date; let date = this.fridgeItem.exp_date;
const epDate = new Date(date); const epDate = new Date(date);
const parsedDate = Date.parse(epDate) const parsedDate = Date.parse(epDate)
...@@ -94,10 +92,10 @@ export default { ...@@ -94,10 +92,10 @@ export default {
return numOfDays; return numOfDays;
}, },
appleBtnPressed(){ appleBtnPressed(){
this.$emit('appleBtnPressed', this.actualItem); this.$emit('appleBtnPressed', this.fridgeItem);
}, },
formatDate(){ //formats expiration date as dd.mm.yyyy formatDate(){ //formats expiration date as dd.mm.yyyy
let fullExpirationDate = new Date(this.actualItem.exp_date); let fullExpirationDate = new Date(this.fridgeItem.exp_date);
let day = fullExpirationDate.getDate(); let day = fullExpirationDate.getDate();
let month= (fullExpirationDate.getMonth()+1).toString(); let month= (fullExpirationDate.getMonth()+1).toString();
let year= fullExpirationDate.getFullYear().toString(); let year= fullExpirationDate.getFullYear().toString();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<eat-fridge-item-modal @closeModal="hideModal" v-if="visible" :fridge-item="selectedItem"></eat-fridge-item-modal> <eat-fridge-item-modal @closeModal="hideModal" v-if="visible" :fridge-item="selectedItem"></eat-fridge-item-modal>
<div id = "itemContainer" > <div id = "itemContainer" >
<FridgeItem v-for="item in fridgeItems" :actualItem = "item" @appleBtnPressed="showModal"></FridgeItem> <FridgeItem v-for="item in fridgeItems" :fridgeItem = "item" @appleBtnPressed="showModal"></FridgeItem>
</div> </div>
<div id="addItemBtn-container"> <div id="addItemBtn-container">
......
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