Skip to content
Snippets Groups Projects
Commit e1f7d53c authored by henrikburmann's avatar henrikburmann
Browse files

My items done

parent d8a3d3b0
No related branches found
No related tags found
1 merge request!110Delete listing
Pipeline #181096 passed
<template> <template>
<div id="headline" class="text-xl md:text-2xl text-primary-light font-medium"> <div id="headline" class="text-xl md:text-2xl text-primary-light font-medium">
Dine gjenstander Mine gjenstander
</div> </div>
<!-- Search field --> <!-- Search field -->
<div class="relative" id="searchComponent"> <div class="relative" id="searchComponent">
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<div class="cardContainer" id="item" v-for="item in visibleItems" :key="item"> <div class="cardContainer" id="item" v-for="item in visibleItems" :key="item">
<ItemCard class="ItemCard w-fit h-fit" :item="item" /> <ItemCard class="ItemCard w-fit h-fit" :item="item" />
<TripleDotButton class="DotButton" @click="item.toggle = !item.toggle"> <TripleDotButton class="DotButton" @click="openDotMenu(item)">
</TripleDotButton> </TripleDotButton>
<div <div
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
> >
<div class="cardContainer" v-for="item in searchedItems" :key="item"> <div class="cardContainer" v-for="item in searchedItems" :key="item">
<ItemCard class="ItemCard" :item="item" /> <ItemCard class="ItemCard" :item="item" />
<TripleDotButton class="DotButton" @click="item.toggle = !item.toggle"> </TripleDotButton> <TripleDotButton class="DotButton" @click="openDotMenu(item)"> </TripleDotButton>
<div <div
v-show="item.toggle" v-show="item.toggle"
...@@ -222,6 +222,17 @@ export default { ...@@ -222,6 +222,17 @@ export default {
}, },
}, },
methods: { methods: {
openDotMenu(item){
if(item.toggle == false){
for(var i = 0; i<this.visibleItems.length; i++){
this.visibleItems[i].toggle = false;
}
item.toggle = true;
}
else{
item.toggle = false;
}
},
getUserListingsFromAPI: async function () { getUserListingsFromAPI: async function () {
this.items = await GetUserListings(); this.items = await GetUserListings();
for (var i = 0; i < this.items.length; i++) { for (var i = 0; i < this.items.length; i++) {
...@@ -259,7 +270,7 @@ export default { ...@@ -259,7 +270,7 @@ export default {
async deleteItem() { async deleteItem() {
console.log("HEI " + this.chosenItem); console.log("HEI " + this.chosenItem);
await UserService.setListingToDeleted(this.chosenItem); await UserService.setListingToDeleted(this.chosenItem);
// this.$router.go(0); this.$router.go(0);
}, },
searchWritten: function () { searchWritten: function () {
//This method triggers when search input field is changed //This method triggers when search input field is changed
...@@ -284,6 +295,7 @@ export default { ...@@ -284,6 +295,7 @@ export default {
display: block; display: block;
margin-top: 10px; margin-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;
margin-left: 20px;
} }
.cardContainer{ .cardContainer{
position: relative; position: relative;
......
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