This commit is contained in:
2020-04-23 00:03:39 +00:00
parent 89c01b39d7
commit 95424f42a7
2 changed files with 36 additions and 1 deletions

View File

@@ -86,7 +86,7 @@
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text @click="editMenu = false">{{ $ay.t("Cancel") }}</v-btn>
<v-btn color="primary" text @click="editClick()">{{
<v-btn color="primary" text @click="saveEdit">{{
$ay.t("OK")
}}</v-btn>
</v-card-actions>
@@ -233,6 +233,37 @@ export default {
this.$nextTick(() => {
this.editMenu = true;
});
},
saveEdit() {
let vm = this;
if (!vm.editName) {
//todo: some error here, name is required..
return;
}
//check if they differ first
let o = null;
for (let i = 0; i < vm.displayList.length; i++) {
if (vm.displayList[i].id == vm.editId) {
o = vm.displayList[i];
break;
}
}
//any changes?
if (o.name == vm.editName && o.notes == vm.editNotes) {
return;
}
//post to server
//get concurrency token for PUT from master list?
//or do away with master list and just have updateDisplayList become createDisplayList (and it adds concurrency token) and
//get called from all routes that return a list? **BETTER IDEA!**
//todo: MAKE A PUT ROUTE then POST THIS
//Update item in list
//(attempting to cheat here, rather than refresh the whole list from server)
//but I do like a clean refresh so if this doesn't work then just call get list
o.name = vm.editName;
o.notes = vm.editNotes;
}
//-----
}