diff --git a/lib/www/client/source/src/views/SequenceList.vue b/lib/www/client/source/src/views/SequenceList.vue
index bcca37f..0275995 100644
--- a/lib/www/client/source/src/views/SequenceList.vue
+++ b/lib/www/client/source/src/views/SequenceList.vue
@@ -41,19 +41,77 @@
Acquisition remarks
+
+ mdi-content-save-edit-outline
+
+
+ mdi-square-edit-outline
+
-
+
+
+
+
+
{{ item.remarks }}
-
+
Processing remarks
+
+ mdi-content-save-edit-outline
+
+
+ mdi-square-edit-outline
+
+
+
+
+
{{ item.remarks_final }}
@@ -318,7 +376,8 @@ export default {
filter: "",
options: {},
num_rows: null,
- activeItem: null
+ activeItem: null,
+ edit: null // {sequence, key, value}
}
},
@@ -332,10 +391,51 @@ export default {
this.getSequences();
},
deep: true
+ },
+
+ async edit (newVal, oldVal) {
+ if (newVal === null && oldVal !== null) {
+ const item = this.items.find(i => i.sequence == oldVal.sequence);
+ if (item && item[oldVal.key] != oldVal.value) {
+ if (await this.saveItem(oldVal)) {
+ item[oldVal.key] = oldVal.value;
+ } else {
+ this.edit = oldVal;
+ }
+ }
+ }
}
},
methods: {
+
+ editItem (item, key) {
+ this.edit = {
+ sequence: item.sequence,
+ key,
+ value: item[key]
+ }
+ },
+
+ async saveItem (edit) {
+ if (!edit) return;
+
+ try {
+ const url = `/project/${this.$route.params.project}/sequence/${edit.sequence}`;
+ const init = {
+ method: "PATCH",
+ body: {
+ [edit.key]: edit.value
+ }
+ };
+
+ let res;
+ await this.api([url, init, (e, r) => res = r]);
+ return res && res.ok;
+ } catch (err) {
+ return false;
+ }
+ },
setActiveItem (item) {
this.activeItem = this.activeItem == item