mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
AddPersons: allow creation of person or thirdparty depending on allowed types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<li v-if="allowedTypes.includes('person')" class="nav-item">
|
||||
<a class="nav-link" :class="{ active: isActive('person') }">
|
||||
<label for="person">
|
||||
<input type="radio" name="person" id="person" v-model="radioType" value="person">
|
||||
@@ -8,7 +8,7 @@
|
||||
</label>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li v-if="allowedTypes.includes('thirdparty')" class="nav-item">
|
||||
<a class="nav-link" :class="{ active: isActive('thirdparty') }">
|
||||
<label for="thirdparty">
|
||||
<input type="radio" name="thirdparty" id="thirdparty" v-model="radioType" value="thirdparty">
|
||||
@@ -38,11 +38,10 @@
|
||||
<script>
|
||||
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
||||
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
|
||||
export default {
|
||||
name: "OnTheFlyCreate",
|
||||
props: ['action'],
|
||||
props: ['action', 'allowedTypes'],
|
||||
components: {
|
||||
OnTheFlyPerson,
|
||||
OnTheFlyThirdparty
|
||||
|
@@ -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() {
|
||||
|
@@ -9,11 +9,15 @@ const ontheflyMessages = {
|
||||
},
|
||||
edit: {
|
||||
person: "Modifier un usager",
|
||||
thirdparty: "Modifier un tiers"
|
||||
thirdparty: "Modifier un tiers",
|
||||
},
|
||||
create: {
|
||||
button: "Créer \"{q}\"",
|
||||
title: "Création d'un nouvel usager ou d'un tiers professionnel",
|
||||
title: {
|
||||
default: "Création d'un nouvel usager ou d'un tiers professionnel",
|
||||
person: "Création d'un nouvel usager",
|
||||
thirdparty: "Création d'un nouveau tiers professionnel",
|
||||
},
|
||||
person: "un nouvel usager",
|
||||
thirdparty: "un nouveau tiers professionnel"
|
||||
},
|
||||
|
Reference in New Issue
Block a user