mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
v-model added so data is taken from the form for all fields + modal title correction
This commit is contained in:
@@ -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'">
|
||||
@@ -44,7 +45,7 @@
|
||||
:parent="parent"
|
||||
:action="action"
|
||||
type="thirdparty"
|
||||
ref="castNew">
|
||||
ref="castThirdparty">
|
||||
</on-the-fly-thirdparty>
|
||||
</template>
|
||||
|
||||
@@ -160,8 +161,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
console.log('## OPEN ON THE FLY MODAL');
|
||||
console.log('## type:', this.type, ', action:', this.action);
|
||||
// console.log('## OPEN ON THE FLY MODAL');
|
||||
// console.log('## type:', this.type, ', action:', this.action);
|
||||
this.modal.showModal = true;
|
||||
this.$nextTick(function() {
|
||||
//this.$refs.search.focus();
|
||||
@@ -171,7 +172,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 = {} ;
|
||||
@@ -186,14 +187,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 });
|
||||
|
||||
|
@@ -18,7 +18,7 @@ const ontheflyMessages = {
|
||||
thirdparty: "un nouveau tiers professionnel"
|
||||
},
|
||||
addContact: {
|
||||
title: "Créer un contact pour ..."
|
||||
title: "Créer un contact pour {q}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user