vee validate migration for commands, recorders and rooms should be complete -> not yet clear how virtual commands should work

This commit is contained in:
2020-07-31 16:33:48 +02:00
parent c0d6da48c9
commit f9dc51770f
3 changed files with 37 additions and 67 deletions

View File

@@ -584,16 +584,16 @@
<b-card-text>
<p class="card-text">
<strong>{{ $t('notes') }}:</strong>&nbsp;
<span v-if="!formEditField['model_'+recorderModel.id+'notes']">{{recorderModel.notes}}&nbsp;
<a class="float-right badge badge-pill badge-info" @click="initrecorderModelUpdate(recorderModel, 'notes')">
<span v-if="!formRecModelEditField[recorderModel.id+'_notes']">{{recorderModel.notes}}&nbsp;
<a class="float-right badge badge-pill badge-info" @click="initRecorderModelUpdate(recorderModel, 'notes')">
<font-awesome-icon
icon="pencil-alt"/>
</a>
</span>
<textarea class="textarea form-control" v-else name="notes"
v-model="updateValues['model_'+recorderModel.id+'_notes']"
v-model="updateRecModelValues[recorderModel.id+'_notes']"
:placeholder="'Notes ('+recorderModel.notes +')'"
@blur="updaterecorderModel(recorderModel.id, 'notes')"></textarea>
@blur="updateRecorderModel(recorderModel.id, 'notes')"></textarea>
</p>
@@ -680,6 +680,8 @@
tabIndex: 0,
updateValues: {},
formEditField: {},
updateRecModelValues: {},
formRecModelEditField: {},
show_assigned_recorders: false,
show_assigned_rooms: true,
form: {
@@ -704,6 +706,10 @@
this.$set(this.formEditField, recorder.id + '_' + fieldName, true);
this.$set(this.updateValues, recorder.id + '_' + fieldName, recorder[fieldName]);
},
initRecorderModelUpdate(recorderModel, fieldName) {
this.$set(this.formRecModelEditField, recorderModel.id + '_' + fieldName, true);
this.$set(this.updateRecModelValues, recorderModel.id + '_' + fieldName, recorderModel[fieldName]);
},
updateRecorder(id, fieldName) {
this.$parent.$data.isLoading = true;
const data = {};
@@ -717,6 +723,19 @@
});
});
},
updateRecorderModel(id, fieldName) {
this.$parent.$data.isLoading = true;
const data = {};
data[fieldName] = this.updateRecModelValues[id + '_' + fieldName];
recorderRepository.updateRecorderModel(id, data)
.then(() => {
this.$store.dispatch('loadRecorderModels')
.then(() => {
this.$parent.$data.isLoading = false;
this.formRecModelEditField[id + '_' + fieldName] = false;
});
});
},
saveRecorder() {
this.$parent.$data.isLoading = true;
recorderRepository.createRecorder(this.form)