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 95547e961e
commit bea0b69858
4 changed files with 47 additions and 27 deletions

View File

@@ -126,13 +126,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
* @var Civility
* @ORM\ManyToOne(targetEntity=Civility::class)
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
* @Groups({"docgen:read", "read", "docgen:read:3party:parent"})
* @Groups({"docgen:read", "read", "write", "docgen:read:3party:parent"})
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
*/
private ?Civility $civility = null;
/**
* @ORM\Column(name="comment", type="text", nullable=true)
* @Groups({"read", "write"})
*/
private ?string $comment = null;
@@ -198,7 +199,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
*
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
* @Groups({"read", "docgen:read"})
* @Groups({"read", "write", "docgen:read"})
* @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"})
*/
private ?ThirdParty $parent = null;

View File

@@ -65,20 +65,27 @@
}"></third-party-render-box>
</div>
<div v-if="parent" id="child-info">
<div v-if="parent">
<div class="input-group mb-3">
<span class="input-group-text" id="comment"><i class="fa fa-fw fa-user-circle-o"></i></span>
<select class="form-select form-select-lg" id="civility">
<option selected disabled >{{ $t('thirdparty.profession') }}</option>
<option v-for="profession in professions" :key="profession.id" :value="profession.id">{{ profession.name.fr }}</option>
</select>
<input type="hidden" name="parent_id" :value="parent.id" />
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="comment"><i class="fa fa-fw fa-briefcase"></i></span>
<select class="form-select form-select-lg" id="profession">
<option selected disabled >{{ $t('thirdparty.civility') }}</option>
<option v-for="civility in civilities" :key="civility.id" :value="civility.id">{{ civility.name.fr }}</option>
</select>
<div id="child-info">
<div class="input-group mb-3">
<!-- <span class="input-group-text" id="comment"><i class="fa fa-fw fa-briefcase"></i></span> -->
<select class="form-select form-select-lg" id="profession"
v-model="thirdparty.civility">
<option selected disabled >{{ $t('thirdparty.civility') }}</option>
<option v-for="civility in civilities" :key="civility.id" :value="civility.id">{{ civility.name.fr }}</option>
</select>
</div>
<div class="input-group mb-3">
<!-- <span class="input-group-text" id="comment"><i class="fa fa-fw fa-user-circle-o"></i></span> -->
<select class="form-select form-select-lg" id="civility"
v-model="thirdparty.profession">
<option selected disabled >{{ $t('thirdparty.profession') }}</option>
<option v-for="profession in professions" :key="profession.id" :value="profession.id">{{ profession.name.fr }}</option>
</select>
</div>
</div>
</div>
@@ -121,6 +128,7 @@
<span class="input-group-text" id="comment"><i class="fa fa-fw fa-pencil"></i></span>
<textarea class="form-control form-control-lg"
v-bind:placeholder="$t('thirdparty.comment')"
v-model="thirdparty.comment"
></textarea>
</div>
</div>
@@ -218,7 +226,6 @@ export default {
const url = `/api/1.0/main/civility.json`;
makeFetch('GET', url)
.then(response => {
console.log(response)
this.$data.civilities = response.results;
})
.catch((error) => {
@@ -230,7 +237,6 @@ export default {
const url = `/api/1.0/thirdparty/professions.json`;
makeFetch('GET', url)
.then(response => {
console.log(response)
this.$data.professions = response.results;
})
.catch((error) => {
@@ -251,7 +257,9 @@ export default {
mounted() {
console.log('mounted', this.action);
if (this.action !== 'create') {
this.loadData();
if (this.id) {
this.loadData();
}
if (this.action === 'addContact') {
this.loadProfessions();
this.loadCivilities();
@@ -284,6 +292,10 @@ dl {
#child-info {
display: flex;
justify-content: space-between;
div {
width: 49%;
}
}
</style>