Updates to editing request.
This commit is contained in:
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
show() {
|
||||
if (!this.editingCollection.collectionIndex);
|
||||
if (!this.editingCollection.collectionIndex) return;
|
||||
this.newCollection = Object.assign({}, this.editingCollection);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -50,7 +50,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
show() {
|
||||
if (!this.editingFolder.folderIndex);
|
||||
if (!this.editingFolder.folderIndex) return;
|
||||
this.newFolder = Object.assign({}, this.editingFolder);
|
||||
},
|
||||
},
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
padding: 0;
|
||||
width: 20px;
|
||||
margin: 0;
|
||||
margin-right: .2rem;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
padding: 0;
|
||||
width: 20px;
|
||||
margin: 0;
|
||||
margin-right: .2rem;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,26 @@ export default {
|
||||
show() {
|
||||
this.request = Object.assign(this.request, this.editingRequest);
|
||||
},
|
||||
'request.collection': function (newValue, oldValue) {
|
||||
if (!oldValue) return;
|
||||
|
||||
if (newValue === oldValue) {
|
||||
delete this.request.oldCollection;
|
||||
return;
|
||||
}
|
||||
this.request.oldFolder = this.request.folder;
|
||||
this.request.folder = -1;
|
||||
this.request.oldCollection = oldValue;
|
||||
},
|
||||
'request.folder': function (newValue, oldValue) {
|
||||
if (!oldValue) return;
|
||||
|
||||
if (newValue === oldValue) {
|
||||
delete this.request.oldFolder;
|
||||
return;
|
||||
}
|
||||
this.request.oldFolder = oldValue;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
collections() {
|
||||
|
||||
@@ -111,6 +111,21 @@ export const mutations = {
|
||||
|
||||
saveRequest (state, payload) {
|
||||
const { request } = payload;
|
||||
|
||||
// Remove the old request from collection
|
||||
if (request.hasOwnProperty('oldCollection') && request.oldCollection > -1) {
|
||||
const folder = request.hasOwnProperty('oldFolder') && request.oldFolder >= -1 ? request.oldFolder : request.folder;
|
||||
if (folder > -1) {
|
||||
state.collections[request.oldCollection].folders[folder].requests.splice(request.requestIndex, 1)
|
||||
} else {
|
||||
state.collections[request.oldCollection].requests.splice(request.requestIndex, 1)
|
||||
}
|
||||
} else if (request.hasOwnProperty('oldFolder') && request.oldFolder !== -1) {
|
||||
state.collections[request.collection].folders[folder].requests.splice(request.requestIndex, 1)
|
||||
}
|
||||
|
||||
delete request.oldCollection;
|
||||
delete request.oldFolder;
|
||||
|
||||
// Request that is directly attached to collection
|
||||
if (request.folder === -1) {
|
||||
|
||||
Reference in New Issue
Block a user