merge firstname branch

This commit is contained in:
2022-03-24 11:13:07 +01:00
20 changed files with 216 additions and 67 deletions

View File

@@ -66,14 +66,14 @@
<div v-if="thirdparty.kind === 'child' || thirdparty.kind === 'contact'">
<div id="child-info">
<div class="input-group mb-3">
<div class="input-group mb-3 input-section">
<select class="form-select form-select-lg" id="civility"
v-model="thirdparty.civility">
<option selected disabled :value="null" >{{ $t('thirdparty.civility') }}</option>
<option v-for="civility in civilities" :key="civility.id" :value="civility">{{ civility.name.fr }}</option>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group mb-3 input-section">
<select class="form-select form-select-lg" id="profession"
v-model="thirdparty.profession">
<option selected disabled :value="null">{{ $t('thirdparty.profession') }}</option>
@@ -81,18 +81,48 @@
</select>
</div>
</div>
<div class="child-info">
<div class="input-section">
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="firstname" v-model="thirdparty.firstname" v-bind:placeholder="$t('thirdparty.firstname')" />
<label for="firstname">{{ $t('thirdparty.firstname') }}</label>
</div>
<div v-if="queryItems">
<ul class="list-suggest add-items inline">
<li v-for="(qi, i) in queryItems" :key="i" @click="addQueryItem('firstName', qi)">
<span class="person-text">{{ qi }}</span>
</li>
</ul>
</div>
</div>
<div class="input-section">
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="thirdparty.name" v-bind:placeholder="$t('thirdparty.lastname')" />
<label for="name">{{ $t('thirdparty.lastname') }}</label>
</div>
<div v-if="queryItems">
<ul class="list-suggest add-items inline">
<li v-for="(qi, i) in queryItems" :key="i" @click="addQueryItem('name', qi)">
<span class="person-text">{{ qi }}</span>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="thirdparty.name" v-bind:placeholder="$t('thirdparty.name')" />
<label for="name">{{ $t('thirdparty.name') }}</label>
</div>
<div v-if="query">
<ul class="list-suggest add-items inline">
<li @click="addQuery(query)">
<span class="person-text">{{ query }}</span>
</li>
</ul>
<div v-if="thirdparty.kind === 'company'">
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="thirdparty.name" v-bind:placeholder="$t('thirdparty.name')" />
<label for="name">{{ $t('thirdparty.name') }}</label>
</div>
<div v-if="query">
<ul class="list-suggest add-items inline">
<li @click="addQuery(query)">
<span class="person-text">{{ query }}</span>
</li>
</ul>
</div>
</div>
<template
@@ -158,6 +188,7 @@ export default {
type: 'thirdparty',
address: null,
kind: 'company',
firstname: '',
name: '',
telephone: '',
civility: null,
@@ -212,6 +243,9 @@ export default {
//this.context = context; <--
return context;
},
queryItems() {
return this.query ? this.query.split(' ') : null;
},
},
methods: {
loadData(){
@@ -260,6 +294,16 @@ export default {
console.log('switch address to edit mode', this.context);
}
},
addQueryItem(field, queryItem) {
switch (field) {
case 'name':
this.thirdparty.name = queryItem;
break;
case 'firstName':
this.thirdparty.firstname = queryItem;
break;
}
},
addQuery(query) {
this.thirdparty.name = query;
},
@@ -305,10 +349,10 @@ dl {
margin-bottom: 1rem;
}
#child-info {
.child-info {
display: flex;
justify-content: space-between;
div {
.input-section {
width: 49%;
}
}

View File

@@ -1,6 +1,8 @@
const thirdpartyMessages = {
fr: {
thirdparty: {
firstname: "Prénom",
lastname: "Nom",
name: "Dénomination",
email: "Courriel",
phonenumber: "Téléphone",

View File

@@ -3,6 +3,10 @@
{{ form_row(form.civility) }}
{% endif %}
{% if form.firstname is defined %}
{{ form_row(form.firstname) }}
{% endif %}
{{ form_row(form.name) }}
{% if form.nameCompany is defined %}

View File

@@ -7,6 +7,11 @@
{{ form_errors(form.civility) }}
{{ form_label(form.civility) }}
</div>
<div class="form-group col-md-5 mb-3">
{{ form_widget(form.firstname) }}
{{ form_errors(form.firstname) }}
{{ form_label(form.firstname) }}
</div>
<div class="form-group col-md-5 mb-3">
{{ form_widget(form.name) }}
{{ form_errors(form.name) }}

View File

@@ -1,7 +1,8 @@
{% extends "@ChillMain/layout.html.twig" %}
{% set thirdParty = entity %}
{% set title_ = 'Show third party %name%'|trans({'%name%' : thirdParty.name }) %}
{% set name = thirdParty.firstname is not empty ? thirdParty.firstname ~ ' ' ~ thirdParty.name : thirdParty.name %}
{% set title_ = 'Show third party %name%'|trans({'%name%' : name }) %}
{% block title title_ %}
@@ -25,7 +26,7 @@
<dt>{{ 'Name'|trans }}</dt>
<dd>
{% if thirdParty.isLeaf == true %}{{ thirdParty.civility }}{% endif %}
{{ thirdParty.name }}
{{ thirdParty.firstname ~ ' ' ~ thirdParty.name }}
</dd>
{% if thirdParty.kind == 'company' %}