From f9dc51770f1e5b175c892129a485b01c59290ef5 Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 31 Jul 2020 16:33:48 +0200 Subject: [PATCH] vee validate migration for commands, recorders and rooms should be complete -> not yet clear how virtual commands should work --- src/api/commandRepository.ts | 2 +- src/components/Commands.vue | 75 +++++++----------------------------- src/components/Recorders.vue | 27 +++++++++++-- 3 files changed, 37 insertions(+), 67 deletions(-) diff --git a/src/api/commandRepository.ts b/src/api/commandRepository.ts index bb3245c..78e70f4 100644 --- a/src/api/commandRepository.ts +++ b/src/api/commandRepository.ts @@ -3,7 +3,7 @@ // @ts-ignore import Repository from './Repository'; -const commandResource = '/command'; +const commandResource = '/virtual_command'; import {dictEmptyValToNull} from '@/utils'; diff --git a/src/components/Commands.vue b/src/components/Commands.vue index acda3fc..91e888b 100644 --- a/src/components/Commands.vue +++ b/src/components/Commands.vue @@ -24,33 +24,6 @@ {{command.name}}  -

- {{ $t('alternative_name') }}:  - {{command.alternative_name}}  - - - - - - - - - - - - - -

{{ $t('description') }}:  {{command.description}}  @@ -62,7 +35,7 @@

@@ -99,51 +72,30 @@

{{ $t('Create a new command')}}:

-
+ +
+
-

- {{ errors.first('name') }} +

+ {{ errors[0] }}

+
- -
- -
-
- -
- -
- -
-

- {{ errors.first('number') }} -

-
- -
- +
+ v-model="form.description">
@@ -163,7 +115,7 @@
+
@@ -224,9 +177,7 @@ show_assigned_recorders: false, form: { name: null, - alternate_name: null, - number: null, - comment: null, + description: null, recorder_id: null, }, }; diff --git a/src/components/Recorders.vue b/src/components/Recorders.vue index e7ab1ce..c9fd382 100644 --- a/src/components/Recorders.vue +++ b/src/components/Recorders.vue @@ -584,16 +584,16 @@

{{ $t('notes') }}:  - {{recorderModel.notes}}  - + {{recorderModel.notes}}  + + @blur="updateRecorderModel(recorderModel.id, 'notes')">

@@ -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)