2019-10-01 22:20:23 +00:00
|
|
|
<template>
|
2019-10-25 08:14:34 +00:00
|
|
|
<div>
|
|
|
|
|
<div class="flex-wrap">
|
|
|
|
|
<div>
|
|
|
|
|
<button class="icon" @click="toggleShowChildren">
|
|
|
|
|
<i class="material-icons" v-show="!showChildren">arrow_right</i>
|
|
|
|
|
<i class="material-icons" v-show="showChildren">arrow_drop_down</i>
|
|
|
|
|
<i class="material-icons">folder_open</i>
|
2019-11-12 04:52:50 +00:00
|
|
|
<span>{{ folder.name }}</span>
|
2019-10-25 08:14:34 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
2019-11-16 23:33:57 +00:00
|
|
|
<v-popover>
|
2020-06-30 08:44:05 +00:00
|
|
|
<button class="tooltip-target icon" v-tooltip.left="$t('more')">
|
2019-11-13 01:27:09 +00:00
|
|
|
<i class="material-icons">more_vert</i>
|
|
|
|
|
</button>
|
|
|
|
|
<template slot="popover">
|
|
|
|
|
<div>
|
2019-11-18 12:32:44 +00:00
|
|
|
<button class="icon" @click="editFolder" v-close-popover>
|
2019-11-16 23:33:57 +00:00
|
|
|
<i class="material-icons">edit</i>
|
2020-02-25 02:06:23 +00:00
|
|
|
<span>{{ $t("edit") }}</span>
|
2019-11-13 01:27:09 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
2019-11-18 12:32:44 +00:00
|
|
|
<button class="icon" @click="removeFolder" v-close-popover>
|
2019-11-16 23:33:57 +00:00
|
|
|
<i class="material-icons">delete</i>
|
2020-02-25 02:06:23 +00:00
|
|
|
<span>{{ $t("delete") }}</span>
|
2019-11-13 01:27:09 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</v-popover>
|
2019-10-25 08:14:34 +00:00
|
|
|
</div>
|
2019-10-01 22:20:23 +00:00
|
|
|
|
2019-10-25 08:14:34 +00:00
|
|
|
<div v-show="showChildren">
|
|
|
|
|
<ul>
|
|
|
|
|
<li v-for="(request, index) in folder.requests" :key="index">
|
|
|
|
|
<request
|
2019-12-15 13:50:31 +00:00
|
|
|
:request="request"
|
|
|
|
|
:collection-index="collectionIndex"
|
|
|
|
|
:folder-index="folderIndex"
|
|
|
|
|
:request-index="index"
|
2020-07-18 12:16:29 +00:00
|
|
|
:doc="doc"
|
2019-12-15 13:32:37 +00:00
|
|
|
@edit-request="
|
2019-11-12 04:52:50 +00:00
|
|
|
$emit('edit-request', {
|
|
|
|
|
request,
|
|
|
|
|
collectionIndex,
|
|
|
|
|
folderIndex,
|
2020-02-24 18:44:50 +00:00
|
|
|
requestIndex: index,
|
2019-11-12 04:52:50 +00:00
|
|
|
})
|
2019-11-26 14:31:48 +00:00
|
|
|
"
|
|
|
|
|
/>
|
2019-10-25 08:14:34 +00:00
|
|
|
</li>
|
|
|
|
|
<li v-if="folder.requests.length === 0">
|
2020-02-25 02:06:23 +00:00
|
|
|
<label>{{ $t("folder_empty") }}</label>
|
2019-10-25 08:14:34 +00:00
|
|
|
</li>
|
|
|
|
|
</ul>
|
2019-10-01 22:20:23 +00:00
|
|
|
</div>
|
2019-10-25 08:14:34 +00:00
|
|
|
</div>
|
2019-10-01 22:20:23 +00:00
|
|
|
</template>
|
|
|
|
|
|
2019-12-06 01:41:38 +00:00
|
|
|
<style scoped lang="scss">
|
2019-11-02 05:32:21 +00:00
|
|
|
ul {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
2019-10-01 22:20:23 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
ul li {
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-left: 32px;
|
|
|
|
|
border-left: 1px solid var(--brd-color);
|
|
|
|
|
}
|
2019-10-01 22:20:23 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-06-21 03:54:45 +00:00
|
|
|
import { fb } from "~/helpers/fb"
|
2020-06-07 17:56:13 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
folder: Object,
|
|
|
|
|
collectionIndex: Number,
|
2020-02-24 18:44:50 +00:00
|
|
|
folderIndex: Number,
|
2020-07-18 12:16:29 +00:00
|
|
|
doc: Boolean,
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
components: {
|
2020-02-25 02:06:23 +00:00
|
|
|
request: () => import("./request"),
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2020-02-24 18:44:50 +00:00
|
|
|
showChildren: false,
|
|
|
|
|
}
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
methods: {
|
2020-06-07 17:56:13 +00:00
|
|
|
syncCollections() {
|
|
|
|
|
if (fb.currentUser !== null) {
|
|
|
|
|
if (fb.currentSettings[0].value) {
|
|
|
|
|
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
toggleShowChildren() {
|
2020-02-24 18:44:50 +00:00
|
|
|
this.showChildren = !this.showChildren
|
2019-10-01 22:20:23 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
selectRequest(request) {
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$store.commit("postwoman/selectRequest", { request })
|
2019-10-01 22:20:23 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
removeFolder() {
|
2020-02-25 02:06:23 +00:00
|
|
|
if (!confirm("Are you sure you want to remove this folder?")) return
|
|
|
|
|
this.$store.commit("postwoman/removeFolder", {
|
2019-11-02 05:32:21 +00:00
|
|
|
collectionIndex: this.collectionIndex,
|
2020-02-24 18:44:50 +00:00
|
|
|
folderIndex: this.folderIndex,
|
|
|
|
|
})
|
2020-06-19 06:56:04 +00:00
|
|
|
this.syncCollections()
|
2019-10-01 22:20:23 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
editFolder() {
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$emit("edit-folder")
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-10-22 09:13:54 +00:00
|
|
|
</script>
|