2019-10-24 10:46:18 +00:00
|
|
|
<template>
|
2019-10-25 08:14:34 +00:00
|
|
|
<modal v-if="show" @close="hideModal">
|
|
|
|
|
<div slot="header">
|
|
|
|
|
<ul>
|
|
|
|
|
<li>
|
2020-09-22 17:06:37 +00:00
|
|
|
<div class="row-wrapper">
|
2020-02-25 02:06:23 +00:00
|
|
|
<h3 class="title">{{ $t("edit_request") }}</h3>
|
2019-10-25 08:14:34 +00:00
|
|
|
<div>
|
|
|
|
|
<button class="icon" @click="hideModal">
|
2020-08-17 10:37:36 +00:00
|
|
|
<closeIcon class="material-icons" />
|
2019-10-25 08:14:34 +00:00
|
|
|
</button>
|
2019-10-24 10:46:18 +00:00
|
|
|
</div>
|
2019-10-25 08:14:34 +00:00
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<div slot="body">
|
2020-10-21 01:11:45 +00:00
|
|
|
<label for="selectLabel">{{ $t("label") }}</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
id="selectLabel"
|
|
|
|
|
v-model="requestUpdateData.name"
|
|
|
|
|
@keyup.enter="saveRequest"
|
|
|
|
|
:placeholder="request.name"
|
|
|
|
|
/>
|
2019-10-24 10:46:18 +00:00
|
|
|
</div>
|
2019-10-25 08:14:34 +00:00
|
|
|
<div slot="footer">
|
2020-09-22 17:06:37 +00:00
|
|
|
<div class="row-wrapper">
|
2019-12-17 19:13:15 +00:00
|
|
|
<span></span>
|
|
|
|
|
<span>
|
|
|
|
|
<button class="icon" @click="hideModal">
|
2020-02-25 02:06:23 +00:00
|
|
|
{{ $t("cancel") }}
|
2019-10-25 08:14:34 +00:00
|
|
|
</button>
|
2019-12-17 19:13:15 +00:00
|
|
|
<button class="icon primary" @click="saveRequest">
|
2020-02-25 02:06:23 +00:00
|
|
|
{{ $t("save") }}
|
2019-12-17 19:13:15 +00:00
|
|
|
</button>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2019-10-25 08:14:34 +00:00
|
|
|
</div>
|
|
|
|
|
</modal>
|
2019-10-24 10:46:18 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-06-21 03:54:45 +00:00
|
|
|
import { fb } from "~/helpers/fb"
|
2020-08-17 10:37:36 +00:00
|
|
|
import closeIcon from "~/static/icons/close-24px.svg?inline"
|
2020-06-07 17:56:13 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
export default {
|
2020-08-17 10:37:36 +00:00
|
|
|
components: {
|
|
|
|
|
closeIcon,
|
|
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
props: {
|
|
|
|
|
show: Boolean,
|
|
|
|
|
collectionIndex: Number,
|
|
|
|
|
folderIndex: Number,
|
2020-10-21 01:11:45 +00:00
|
|
|
folderName: String,
|
2019-11-02 05:32:21 +00:00
|
|
|
request: Object,
|
2020-02-24 18:44:50 +00:00
|
|
|
requestIndex: Number,
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
requestUpdateData: {
|
|
|
|
|
name: undefined,
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
}
|
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
|
|
|
saveRequest() {
|
|
|
|
|
const requestUpdated = {
|
|
|
|
|
...this.$props.request,
|
|
|
|
|
name: this.$data.requestUpdateData.name || this.$props.request.name,
|
2020-02-24 18:44:50 +00:00
|
|
|
}
|
2019-10-24 10:46:18 +00:00
|
|
|
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$store.commit("postwoman/editRequest", {
|
2020-10-21 01:11:45 +00:00
|
|
|
requestCollectionIndex: this.$props.collectionIndex,
|
|
|
|
|
requestFolderName: this.$props.folderName,
|
|
|
|
|
requestFolderIndex: this.$props.folderIndex,
|
2019-11-02 05:32:21 +00:00
|
|
|
requestNew: requestUpdated,
|
2020-10-21 01:11:45 +00:00
|
|
|
requestIndex: this.$props.requestIndex,
|
2020-02-24 18:44:50 +00:00
|
|
|
})
|
2019-10-24 10:46:18 +00:00
|
|
|
|
2020-02-24 18:44:50 +00:00
|
|
|
this.hideModal()
|
2020-06-19 06:56:04 +00:00
|
|
|
this.syncCollections()
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
|
|
|
|
hideModal() {
|
2020-02-25 02:06:23 +00:00
|
|
|
this.$emit("hide-modal")
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-10-24 10:46:18 +00:00
|
|
|
</script>
|