AddPersons: allow creation of person or thirdparty depending on allowed types

This commit is contained in:
nobohan
2022-02-14 11:12:37 +01:00
parent f8888462f1
commit 1c3f6c7c1e
5 changed files with 21 additions and 9 deletions

View File

@@ -54,6 +54,7 @@
<template v-slot:body v-else>
<on-the-fly-create
:action="action"
:allowedTypes="allowedTypes"
ref="castNew">
</on-the-fly-create>
</template>
@@ -90,7 +91,7 @@ export default {
OnTheFlyThirdparty,
OnTheFlyCreate
},
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'],
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'allowedTypes'],
emits: ['saveFormOnTheFly'],
data() {
return {
@@ -129,6 +130,13 @@ export default {
return 'action.create';
}
},
titleCreate() {
return this.allowedTypes.every(t => t === 'person')
? 'onthefly.create.title.person'
: this.allowedTypes.every(t => t === 'thirdparty')
? 'onthefly.create.title.thirdparty'
: 'onthefly.create.title.default'
},
titleModal() {
switch (this.action) {
case 'show':
@@ -136,7 +144,7 @@ export default {
case 'edit':
return 'onthefly.edit.' + this.type;
case 'create':
return 'onthefly.create.title';
return this.titleCreate;
}
},
titleMessage() {