v-model added so data is taken from the form for all fields + modal title correction

This commit is contained in:
2022-01-13 16:30:52 +01:00
parent 02c09687a4
commit 32ff54e130
4 changed files with 44 additions and 25 deletions

View File

@@ -18,7 +18,8 @@
@close="modal.showModal = false">
<template v-slot:header>
<h3 class="modal-title">{{ $t(titleModal) }}</h3>
<h3 v-if="parent" class="modal-title">{{ $t(titleModal, {q: parent.text}) }}</h3>
<h3 v-else class="modal-title">{{ $t(titleModal) }}</h3>
</template>
<template v-slot:body v-if="type === 'person'">
@@ -56,7 +57,7 @@
:parent="parent"
:action="action"
type="thirdparty"
ref="castNew">
ref="castThirdparty">
</on-the-fly-thirdparty>
</template>
@@ -196,7 +197,7 @@ export default {
this.$data.action = action;
},
saveAction() {
console.log('saveAction button: create/edit action with', this.type);
// console.log('saveAction button: create/edit action with', this.type);
let
type = this.type,
data = {} ;
@@ -211,14 +212,20 @@ export default {
break;
default:
if (typeof this.type === 'undefined') { // action=create
type = this.$refs.castNew.radioType;
data = this.$refs.castNew.castDataByType();
if (typeof this.type === 'undefined') { // action=create or addContact
if (this.action === 'addContact') {
type = 'thirdparty'
data = this.$refs.castThirdparty.$data.thirdparty;
// console.log(data)
} else {
type = this.$refs.castNew.radioType;
data = this.$refs.castNew.castDataByType();
}
} else {
throw 'error with object type';
}
}
console.log('type', type, 'data', data)
// pass datas to parent
this.$emit('saveFormOnTheFly', { type: type, data: data });
},

View File

@@ -19,7 +19,7 @@ const ontheflyMessages = {
},
resource_comment_title: "Un commentaire est associé à cet interlocuteur"
addContact: {
title: "Créer un contact pour ..."
title: "Créer un contact pour {q}"
}
}
}