mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
Merge branch 'issue345_internal_thirdparty_contact' into 'master'
Add contact to thirdparty from within modal See merge request Chill-Projet/chill-bundles!284
This commit is contained in:
commit
8e1f3a5cc0
14
CHANGELOG.md
14
CHANGELOG.md
@ -9,6 +9,7 @@ and this project adheres to
|
|||||||
* date versioning for test releases
|
* date versioning for test releases
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
* AddPersons: remove ul-li html tags from AddPersons (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/419)
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
* [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388)
|
* [person] Order social issues by the field "ordering" (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/388)
|
||||||
@ -28,6 +29,7 @@ and this project adheres to
|
|||||||
* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
* [person]: AddPersons: add suggestion of name when creating new person or thirdparty (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/422)
|
||||||
* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber)
|
* [main] Address: fix small bug: when modifying an address without street (isNoAddress), also check errors if street is an empty string as back-end change null value to empty string for street (and streetNumber)
|
||||||
* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449)
|
* [main] Address: stronger client-side validation of addresses (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/449)
|
||||||
|
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||||
* [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415)
|
* [person] accompanying course: filter suggested entities by open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/415)
|
||||||
[activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
[activity] can click through the cross icon for removing person in concerned group (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
||||||
[activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
[activity] correct associated persons by considering only open participations (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/476)
|
||||||
@ -86,7 +88,19 @@ and this project adheres to
|
|||||||
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
* [AddAddress] disable multiselect search, and rely only on most pertinent Cities and Street computed backend
|
||||||
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
|
||||||
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
|
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||||
|
|
||||||
|
|
||||||
|
## Test releases
|
||||||
|
=======
|
||||||
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
|
>>>>>>> issue422_and_others_on_AddPersons
|
||||||
|
|
||||||
|
=======
|
||||||
|
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
|
||||||
|
* [thirdparty] Add a contact to a thirdparty from within onTheFly (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/345)
|
||||||
|
|
||||||
|
>>>>>>> b0d50d315c8e00959a967badac9cf5057ab2b4bc
|
||||||
### test release 2021-01-31
|
### test release 2021-01-31
|
||||||
|
|
||||||
* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409)
|
* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409)
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
class CivilityApiController extends ApiController
|
||||||
|
{
|
||||||
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
||||||
|
{
|
||||||
|
return $query->addOrderBy('e.order', 'ASC');
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@ declare(strict_types=1);
|
|||||||
namespace Chill\MainBundle\DependencyInjection;
|
namespace Chill\MainBundle\DependencyInjection;
|
||||||
|
|
||||||
use Chill\MainBundle\Controller\AddressApiController;
|
use Chill\MainBundle\Controller\AddressApiController;
|
||||||
|
use Chill\MainBundle\Controller\CivilityApiController;
|
||||||
use Chill\MainBundle\Controller\LocationController;
|
use Chill\MainBundle\Controller\LocationController;
|
||||||
use Chill\MainBundle\Controller\LocationTypeController;
|
use Chill\MainBundle\Controller\LocationTypeController;
|
||||||
use Chill\MainBundle\Controller\UserController;
|
use Chill\MainBundle\Controller\UserController;
|
||||||
@ -559,6 +560,21 @@ class ChillMainExtension extends Extension implements
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\MainBundle\Entity\Civility::class,
|
||||||
|
'name' => 'civility',
|
||||||
|
'base_path' => '/api/1.0/main/civility',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'controller' => CivilityApiController::class,
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
|||||||
/**
|
/**
|
||||||
* @ORM\Table(name="chill_main_civility")
|
* @ORM\Table(name="chill_main_civility")
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={"chill_main_civility": Civility::class})
|
||||||
*/
|
*/
|
||||||
class Civility
|
class Civility
|
||||||
{
|
{
|
||||||
@ -29,6 +30,7 @@ class Civility
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
|
@ -77,14 +77,11 @@ export default {
|
|||||||
return this.$refs.castPerson.$data.person;
|
return this.$refs.castPerson.$data.person;
|
||||||
case 'thirdparty':
|
case 'thirdparty':
|
||||||
let data = this.$refs.castThirdparty.$data.thirdparty;
|
let data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
data.name = data.text;
|
|
||||||
/*
|
|
||||||
if (data.address !== undefined && data.address !== null) {
|
if (data.address !== undefined && data.address !== null) {
|
||||||
data.address = { id: data.address.address_id }
|
data.address = { id: data.address.address_id }
|
||||||
} else {
|
} else {
|
||||||
data.address = null;
|
data.address = null;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
default:
|
default:
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
@close="modal.showModal = false">
|
@close="modal.showModal = false">
|
||||||
|
|
||||||
<template v-slot:header>
|
<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>
|
||||||
|
|
||||||
<template v-slot:body v-if="type === 'person'">
|
<template v-slot:body v-if="type === 'person'">
|
||||||
@ -29,10 +30,10 @@
|
|||||||
ref="castPerson">
|
ref="castPerson">
|
||||||
</on-the-fly-person>
|
</on-the-fly-person>
|
||||||
<div v-if="hasResourceComment">
|
<div v-if="hasResourceComment">
|
||||||
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
|
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
|
||||||
<blockquote class="chill-user-quote">
|
<blockquote class="chill-user-quote">
|
||||||
{{ parent.comment }}
|
{{ parent.comment }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -44,13 +45,22 @@
|
|||||||
ref="castThirdparty">
|
ref="castThirdparty">
|
||||||
</on-the-fly-thirdparty>
|
</on-the-fly-thirdparty>
|
||||||
<div v-if="hasResourceComment">
|
<div v-if="hasResourceComment">
|
||||||
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
|
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
|
||||||
<blockquote class="chill-user-quote">
|
<blockquote class="chill-user-quote">
|
||||||
{{ parent.comment }}
|
{{ parent.comment }}
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:body v-else-if="parent">
|
||||||
|
<on-the-fly-thirdparty
|
||||||
|
:parent="parent"
|
||||||
|
:action="action"
|
||||||
|
type="thirdparty"
|
||||||
|
ref="castThirdparty">
|
||||||
|
</on-the-fly-thirdparty>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-slot:body v-else>
|
<template v-slot:body v-else>
|
||||||
<on-the-fly-create
|
<on-the-fly-create
|
||||||
:action="action"
|
:action="action"
|
||||||
@ -83,6 +93,7 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue';
|
|||||||
import OnTheFlyCreate from './Create.vue';
|
import OnTheFlyCreate from './Create.vue';
|
||||||
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
||||||
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
||||||
|
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OnTheFly',
|
name: 'OnTheFly',
|
||||||
@ -105,11 +116,11 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
hasResourceComment() {
|
hasResourceComment() {
|
||||||
//console.log('hasResourceComment', this.parent);
|
//console.log('hasResourceComment', this.parent);
|
||||||
return (typeof this.parent !== 'undefined' && this.parent !== null)
|
return (typeof this.parent !== 'undefined' && this.parent !== null)
|
||||||
&& this.action === 'show'
|
&& this.action === 'show'
|
||||||
&& this.parent.type === 'accompanying_period_resource'
|
&& this.parent.type === 'accompanying_period_resource'
|
||||||
&& (this.parent.comment !== null && this.parent.comment !== '')
|
&& (this.parent.comment !== null && this.parent.comment !== '')
|
||||||
;
|
;
|
||||||
},
|
},
|
||||||
classAction() {
|
classAction() {
|
||||||
switch (this.action) {
|
switch (this.action) {
|
||||||
@ -119,6 +130,8 @@ export default {
|
|||||||
return 'btn-update';
|
return 'btn-update';
|
||||||
case 'create':
|
case 'create':
|
||||||
return 'btn-create';
|
return 'btn-create';
|
||||||
|
case 'addContact':
|
||||||
|
return 'btn-tpchild';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
titleAction() {
|
titleAction() {
|
||||||
@ -129,6 +142,8 @@ export default {
|
|||||||
return 'action.edit';
|
return 'action.edit';
|
||||||
case 'create':
|
case 'create':
|
||||||
return 'action.create';
|
return 'action.create';
|
||||||
|
case 'addContact':
|
||||||
|
return 'action.addContact';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
titleCreate() {
|
titleCreate() {
|
||||||
@ -146,6 +161,8 @@ export default {
|
|||||||
return 'onthefly.edit.' + this.type;
|
return 'onthefly.edit.' + this.type;
|
||||||
case 'create':
|
case 'create':
|
||||||
return this.titleCreate;
|
return this.titleCreate;
|
||||||
|
case 'addContact':
|
||||||
|
return 'onthefly.addContact.title';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
titleMessage() {
|
titleMessage() {
|
||||||
@ -179,8 +196,8 @@ export default {
|
|||||||
this.modal.showModal = false;
|
this.modal.showModal = false;
|
||||||
},
|
},
|
||||||
openModal() {
|
openModal() {
|
||||||
//console.log('## OPEN ON THE FLY MODAL');
|
// console.log('## OPEN ON THE FLY MODAL');
|
||||||
//console.log('## type:', this.type, ', action:', this.action);
|
// console.log('## type:', this.type, ', action:', this.action);
|
||||||
this.modal.showModal = true;
|
this.modal.showModal = true;
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
//this.$refs.search.focus();
|
//this.$refs.search.focus();
|
||||||
@ -190,7 +207,7 @@ export default {
|
|||||||
this.$data.action = action;
|
this.$data.action = action;
|
||||||
},
|
},
|
||||||
saveAction() {
|
saveAction() {
|
||||||
console.log('saveAction button: create/edit action with', this.type);
|
// console.log('saveAction button: create/edit action with', this.type);
|
||||||
let
|
let
|
||||||
type = this.type,
|
type = this.type,
|
||||||
data = {} ;
|
data = {} ;
|
||||||
@ -202,17 +219,28 @@ export default {
|
|||||||
|
|
||||||
case 'thirdparty':
|
case 'thirdparty':
|
||||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
|
/* never executed ? */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (typeof this.type === 'undefined') { // action=create
|
if (typeof this.type === 'undefined') { // action=create or addContact
|
||||||
type = this.$refs.castNew.radioType;
|
console.log('will rewrite data');
|
||||||
data = this.$refs.castNew.castDataByType();
|
if (this.action === 'addContact') {
|
||||||
|
type = 'thirdparty'
|
||||||
|
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
|
console.log('data original', data);
|
||||||
|
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||||
|
} else {
|
||||||
|
type = this.$refs.castNew.radioType;
|
||||||
|
data = this.$refs.castNew.castDataByType();
|
||||||
|
console.log(data)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw 'error with object type';
|
throw 'error with object type';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('type', type);
|
||||||
|
console.log('data', data);
|
||||||
// pass datas to parent
|
// pass datas to parent
|
||||||
this.$emit('saveFormOnTheFly', { type: type, data: data });
|
this.$emit('saveFormOnTheFly', { type: type, data: data });
|
||||||
},
|
},
|
||||||
@ -232,4 +260,8 @@ export default {
|
|||||||
a {
|
a {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* .btn-add-contact {
|
||||||
|
background-color: pink;
|
||||||
|
} */
|
||||||
</style>
|
</style>
|
||||||
|
@ -21,7 +21,13 @@ const ontheflyMessages = {
|
|||||||
person: "un nouvel usager",
|
person: "un nouvel usager",
|
||||||
thirdparty: "un nouveau tiers professionnel"
|
thirdparty: "un nouveau tiers professionnel"
|
||||||
},
|
},
|
||||||
resource_comment_title: "Un commentaire est associé à cet interlocuteur"
|
addContact: {
|
||||||
|
title: "Créer un contact pour {q}"
|
||||||
|
},
|
||||||
|
resource_comment_title: "Un commentaire est associé à cet interlocuteur",
|
||||||
|
addContact: {
|
||||||
|
title: "Créer un contact pour {q}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ const messages = {
|
|||||||
person: "Quitter la page et ouvrir la fiche de l'usager",
|
person: "Quitter la page et ouvrir la fiche de l'usager",
|
||||||
thirdparty: "Quitter la page et voir le tiers",
|
thirdparty: "Quitter la page et voir le tiers",
|
||||||
},
|
},
|
||||||
refresh: 'Rafraîchir'
|
refresh: 'Rafraîchir',
|
||||||
|
addContact: 'Ajouter un contact'
|
||||||
},
|
},
|
||||||
nav: {
|
nav: {
|
||||||
next: "Suivant",
|
next: "Suivant",
|
||||||
|
@ -788,6 +788,16 @@ paths:
|
|||||||
description: "accepted"
|
description: "accepted"
|
||||||
403:
|
403:
|
||||||
description: "unauthorized"
|
description: "unauthorized"
|
||||||
|
/1.0/main/civility.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- civility
|
||||||
|
summary: Return all civility types
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "ok"
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
/1.0/main/user-job.json:
|
/1.0/main/user-job.json:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -159,10 +159,10 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
for (let v of error.violations) {
|
for (let v of error.violations) {
|
||||||
this.$toast.open({message: v });
|
this.$toast.open({message: v });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$toast.open({message: 'An error occurred'});
|
this.$toast.open({message: 'An error occurred'});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -171,9 +171,7 @@ export default {
|
|||||||
body.name = payload.data.text;
|
body.name = payload.data.text;
|
||||||
body.email = payload.data.email;
|
body.email = payload.data.email;
|
||||||
body.telephone = payload.data.phonenumber;
|
body.telephone = payload.data.phonenumber;
|
||||||
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
|
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
|
||||||
|
|
||||||
console.log('body', body)
|
|
||||||
|
|
||||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@ -183,10 +181,10 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
for (let v of error.violations) {
|
for (let v of error.violations) {
|
||||||
this.$toast.open({message: v });
|
this.$toast.open({message: v });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$toast.open({message: 'An error occurred'});
|
this.$toast.open({message: 'An error occurred'});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,8 @@
|
|||||||
v-bind:item="item"
|
v-bind:item="item"
|
||||||
v-bind:search="search"
|
v-bind:search="search"
|
||||||
v-bind:type="checkUniq"
|
v-bind:type="checkUniq"
|
||||||
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
|
@newPriorSuggestion="newPriorSuggestion"
|
||||||
@updateSelected="updateSelected">
|
@updateSelected="updateSelected">
|
||||||
</person-suggestion>
|
</person-suggestion>
|
||||||
|
|
||||||
@ -249,7 +251,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
newPriorSuggestion(entity) {
|
newPriorSuggestion(entity) {
|
||||||
console.log('newPriorSuggestion', entity);
|
// console.log('newPriorSuggestion', entity);
|
||||||
if (entity !== null) {
|
if (entity !== null) {
|
||||||
let suggestion = {
|
let suggestion = {
|
||||||
key: entity.type + entity.id,
|
key: entity.type + entity.id,
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
<suggestion-third-party
|
<suggestion-third-party
|
||||||
v-if="item.result.type === 'thirdparty'"
|
v-if="item.result.type === 'thirdparty'"
|
||||||
|
@newPriorSuggestion="newPriorSuggestion"
|
||||||
v-bind:item="item">
|
v-bind:item="item">
|
||||||
</suggestion-third-party>
|
</suggestion-third-party>
|
||||||
|
|
||||||
@ -26,10 +27,10 @@
|
|||||||
v-bind:item="item">
|
v-bind:item="item">
|
||||||
</suggestion-user>
|
</suggestion-user>
|
||||||
|
|
||||||
<suggestion-household
|
<suggestion-household
|
||||||
v-if="item.result.type === 'household'"
|
v-if="item.result.type === 'household'"
|
||||||
v-bind:item="item">
|
v-bind:item="item">
|
||||||
</suggestion-household>
|
</suggestion-household>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -54,7 +55,7 @@ export default {
|
|||||||
'search',
|
'search',
|
||||||
'type'
|
'type'
|
||||||
],
|
],
|
||||||
emits: ['updateSelected'],
|
emits: ['updateSelected', 'newPriorSuggestion'],
|
||||||
computed: {
|
computed: {
|
||||||
selected: {
|
selected: {
|
||||||
set(value) {
|
set(value) {
|
||||||
@ -72,6 +73,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
setValueByType(value, type) {
|
setValueByType(value, type) {
|
||||||
return (type === 'radio')? [value] : value;
|
return (type === 'radio')? [value] : value;
|
||||||
|
},
|
||||||
|
newPriorSuggestion(response) {
|
||||||
|
this.$emit('newPriorSuggestion', response)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
<div class="container tpartycontainer">
|
<div class="container tpartycontainer">
|
||||||
<div class="tparty-identification">
|
<div class="tparty-identification">
|
||||||
<span class="name">
|
<span class="name">
|
||||||
{{ item.result.text }}
|
{{ item.result.text }}
|
||||||
</span>
|
</span>
|
||||||
<span class="location">
|
<span class="location">
|
||||||
<template v-if="hasAddress">
|
<template v-if="hasAddress">
|
||||||
{{ getAddress.text }} -
|
{{ getAddress.text }} -
|
||||||
{{ getAddress.postcode.name }}
|
{{ getAddress.postcode.name }}
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@ -19,21 +19,28 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="right_actions">
|
<div class="right_actions">
|
||||||
<badge-entity
|
<badge-entity
|
||||||
:entity="item.result"
|
:entity="item.result"
|
||||||
:options="{ displayLong: true }">
|
:options="{ displayLong: true }">
|
||||||
</badge-entity>
|
</badge-entity>
|
||||||
<on-the-fly
|
<on-the-fly v-if="item.result.kind === 'company'"
|
||||||
type="thirdparty"
|
v-bind:parent="item.result"
|
||||||
v-bind:id="item.result.id"
|
@saveFormOnTheFly="saveFormOnTheFly"
|
||||||
action="show">
|
action="addContact"
|
||||||
</on-the-fly>
|
ref="onTheFly"
|
||||||
|
></on-the-fly>
|
||||||
|
<on-the-fly
|
||||||
|
type="thirdparty"
|
||||||
|
v-bind:id="item.result.id"
|
||||||
|
action="show">
|
||||||
|
</on-the-fly>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||||
|
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
|
|
||||||
const i18n = {
|
const i18n = {
|
||||||
messages: {
|
messages: {
|
||||||
@ -48,36 +55,56 @@ const i18n = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SuggestionThirdParty',
|
name: 'SuggestionThirdParty',
|
||||||
components: {
|
components: {
|
||||||
OnTheFly,
|
OnTheFly,
|
||||||
BadgeEntity
|
BadgeEntity
|
||||||
},
|
},
|
||||||
props: ['item'],
|
props: ['item'],
|
||||||
i18n,
|
emits: ['newPriorSuggestion'],
|
||||||
computed: {
|
i18n,
|
||||||
hasAddress() {
|
computed: {
|
||||||
if (this.$props.item.result.address !== null) {
|
hasAddress() {
|
||||||
return true;
|
if (this.$props.item.result.address !== null) {
|
||||||
}
|
return true;
|
||||||
if (this.$props.item.result.parent !== null) {
|
}
|
||||||
this.$props.item.result.parent.address !== null;
|
if (this.$props.item.result.parent !== null) {
|
||||||
}
|
this.$props.item.result.parent.address !== null;
|
||||||
},
|
}
|
||||||
hasParent() {
|
},
|
||||||
return this.$props.item.result.parent !== null;
|
hasParent() {
|
||||||
},
|
return this.$props.item.result.parent !== null;
|
||||||
getAddress() {
|
},
|
||||||
if (this.$props.item.result.address !== null) {
|
getAddress() {
|
||||||
return this.$props.item.result.address;
|
if (this.$props.item.result.address !== null) {
|
||||||
}
|
return this.$props.item.result.address;
|
||||||
if (this.$props.item.result.parent.address !== null) {
|
}
|
||||||
return this.$props.item.result.parent.address;
|
if (this.$props.item.result.parent.address !== null) {
|
||||||
}
|
return this.$props.item.result.parent.address;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
methods: {
|
||||||
|
saveFormOnTheFly({data, type}) {
|
||||||
|
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
||||||
|
.then(response => {
|
||||||
|
this.$emit('newPriorSuggestion', response);
|
||||||
|
this.$refs.onTheFly.closeModal();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
if (error.name === 'ValidationException') {
|
||||||
|
for (let v of error.violations) {
|
||||||
|
this.$toast.open({message: v });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -126,6 +126,21 @@ class ChillThirdPartyExtension extends Extension implements PrependExtensionInte
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'class' => \Chill\ThirdPartyBundle\Entity\ThirdPartyProfession::class,
|
||||||
|
// 'controller' => \Chill\MainBundle\Controller\ProfessionApiController::class,
|
||||||
|
'name' => 'profession',
|
||||||
|
'base_path' => '/api/1.0/thirdparty/professions',
|
||||||
|
'base_role' => 'ROLE_USER',
|
||||||
|
'actions' => [
|
||||||
|
'_index' => [
|
||||||
|
'methods' => [
|
||||||
|
Request::METHOD_GET => true,
|
||||||
|
Request::METHOD_HEAD => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -161,13 +161,14 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @var Civility
|
* @var Civility
|
||||||
* @ORM\ManyToOne(targetEntity=Civility::class)
|
* @ORM\ManyToOne(targetEntity=Civility::class)
|
||||||
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
|
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
|
||||||
* @Groups({"docgen:read", "read", "docgen:read:3party:parent"})
|
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
||||||
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?Civility $civility = null;
|
private ?Civility $civility = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="comment", type="text", nullable=true)
|
* @ORM\Column(name="comment", type="text", nullable=true)
|
||||||
|
* @Groups({"read", "write"})
|
||||||
*/
|
*/
|
||||||
private ?string $comment = null;
|
private ?string $comment = null;
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @ORM\Column(name="id", type="integer")
|
* @ORM\Column(name="id", type="integer")
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
* @Groups({"read", "docgen:read", "docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
|
||||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
* @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"})
|
* @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?ThirdParty $parent = null;
|
private ?ThirdParty $parent = null;
|
||||||
@ -246,7 +247,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @var ThirdPartyProfession
|
* @var ThirdPartyProfession
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
||||||
* ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
|
* ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
|
||||||
* @Groups({"docgen:read", "docgen:read:3party:parent"})
|
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
||||||
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?ThirdPartyProfession $profession = null;
|
private ?ThirdPartyProfession $profession = null;
|
||||||
@ -706,7 +707,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setCivility(Civility $civility): ThirdParty
|
public function setCivility(?Civility $civility): ThirdParty
|
||||||
{
|
{
|
||||||
$this->civility = $civility;
|
$this->civility = $civility;
|
||||||
|
|
||||||
@ -811,7 +812,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
/**
|
/**
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setProfession(ThirdPartyProfession $profession): ThirdParty
|
public function setProfession(?ThirdPartyProfession $profession): ThirdParty
|
||||||
{
|
{
|
||||||
$this->profession = $profession;
|
$this->profession = $profession;
|
||||||
|
|
||||||
|
@ -18,11 +18,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
|||||||
/**
|
/**
|
||||||
* @ORM\Table(name="chill_3party.party_profession")
|
* @ORM\Table(name="chill_3party.party_profession")
|
||||||
* @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class)
|
* @ORM\Entity(repositoryClass=ThirdPartyProfessionRepository::class)
|
||||||
|
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
|
||||||
|
* "third_party_profession": ThirdPartyProfession::class})
|
||||||
*/
|
*/
|
||||||
class ThirdPartyProfession
|
class ThirdPartyProfession
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
|
* @Serializer\Groups({"read"})
|
||||||
*/
|
*/
|
||||||
private bool $active = true;
|
private bool $active = true;
|
||||||
|
|
||||||
@ -30,13 +33,13 @@ class ThirdPartyProfession
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"docgen:read"})
|
* @Serializer\Groups({"docgen:read", "read", "write"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
* @Serializer\Groups({"docgen:read"})
|
* @Serializer\Groups({"docgen:read", "read"})
|
||||||
*/
|
*/
|
||||||
private array $name = [];
|
private array $name = [];
|
||||||
|
|
||||||
|
@ -19,9 +19,15 @@
|
|||||||
></third-party-render-box>
|
></third-party-render-box>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="action === 'edit' || action === 'create'">
|
<div v-else-if="action === 'edit' || action === 'create' || action === 'addContact'">
|
||||||
|
<div v-if="parent">
|
||||||
<div class="form-floating mb-3" v-if="thirdparty.kind !== 'child'">
|
<div class="parent-info">
|
||||||
|
<i class="fa fa-li fa-hand-o-right"></i>
|
||||||
|
<b class="me-2">{{ $t('child_of') }}</b>
|
||||||
|
<span class="chill-entity badge-thirdparty">{{ parent.text }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating mb-3" v-else-if="kind !== 'child'">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
|
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
|
||||||
<label for="tpartyKindInstitution" class="required">
|
<label for="tpartyKindInstitution" class="required">
|
||||||
@ -55,10 +61,30 @@
|
|||||||
addCenter: false,
|
addCenter: false,
|
||||||
addNoData: true,
|
addNoData: true,
|
||||||
isMultiline: false
|
isMultiline: false
|
||||||
}"></third-party-render-box>
|
}"></third-party-render-box>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="thirdparty.kind === 'child' || thirdparty.kind === 'contact'">
|
||||||
|
<div id="child-info">
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<select class="form-select form-select-lg" id="profession"
|
||||||
|
v-model="thirdparty.civility">
|
||||||
|
<option selected disabled :value="null" >{{ $t('thirdparty.civility') }}</option>
|
||||||
|
<option v-for="civility in civilities" :key="civility.id" :value="{type: 'chill_main_civility', id: civility.id }">{{ civility.name.fr }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<select class="form-select form-select-lg" id="civility"
|
||||||
|
v-model="thirdparty.profession">
|
||||||
|
<option selected disabled :value="null">{{ $t('thirdparty.profession') }}</option>
|
||||||
|
<option v-for="profession in professions" :key="profession.id" :value="{type: 'third_party_profession', id: profession.id }">{{ profession.name.fr }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-floating mb-3">
|
<div class="form-floating mb-3">
|
||||||
<input class="form-control form-control-lg" id="name" v-model="thirdparty.text" v-bind:placeholder="$t('thirdparty.name')" />
|
<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>
|
<label for="name">{{ $t('thirdparty.name') }}</label>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="query">
|
<div v-if="query">
|
||||||
@ -98,6 +124,15 @@
|
|||||||
aria-describedby="phonenumber" />
|
aria-describedby="phonenumber" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="parent">
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -106,10 +141,11 @@ import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue';
|
|||||||
import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress';
|
import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress';
|
||||||
import { getThirdparty } from '../../_api/OnTheFly';
|
import { getThirdparty } from '../../_api/OnTheFly';
|
||||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||||
|
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnTheFlyThirdParty",
|
name: "OnTheFlyThirdParty",
|
||||||
props: ['id', 'type', 'action', 'query'],
|
props: ['id', 'type', 'action', 'query', 'parent'],
|
||||||
components: {
|
components: {
|
||||||
ThirdPartyRenderBox,
|
ThirdPartyRenderBox,
|
||||||
AddAddress,
|
AddAddress,
|
||||||
@ -124,8 +160,11 @@ export default {
|
|||||||
kind: 'company',
|
kind: 'company',
|
||||||
name: '',
|
name: '',
|
||||||
telephone: '',
|
telephone: '',
|
||||||
|
civility: null,
|
||||||
|
profession: null,
|
||||||
},
|
},
|
||||||
|
professions: [],
|
||||||
|
civilities: [],
|
||||||
addAddress: {
|
addAddress: {
|
||||||
options: {
|
options: {
|
||||||
openPanesInModal: true,
|
openPanesInModal: true,
|
||||||
@ -177,10 +216,10 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
loadData(){
|
loadData(){
|
||||||
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
return getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||||
this.thirdparty = thirdparty;
|
this.thirdparty = thirdparty;
|
||||||
this.thirdparty.kind = thirdparty.kind;
|
this.thirdparty.kind = thirdparty.kind;
|
||||||
//console.log('get thirdparty', thirdparty);
|
console.log('get thirdparty', thirdparty);
|
||||||
if (this.action !== 'show') {
|
if (this.action !== 'show') {
|
||||||
if (thirdparty.address !== null) {
|
if (thirdparty.address !== null) {
|
||||||
// bof! we force getInitialAddress because addressId not available when mounted
|
// bof! we force getInitialAddress because addressId not available when mounted
|
||||||
@ -190,6 +229,30 @@ export default {
|
|||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
loadCivilities() {
|
||||||
|
const url = `/api/1.0/main/civility.json`;
|
||||||
|
return makeFetch('GET', url)
|
||||||
|
.then(response => {
|
||||||
|
this.$data.civilities = response.results;
|
||||||
|
return Promise.resolve();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
this.$toast.open({message: error.body})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
loadProfessions() {
|
||||||
|
const url = `/api/1.0/thirdparty/professions.json`;
|
||||||
|
return makeFetch('GET', url)
|
||||||
|
.then(response => {
|
||||||
|
this.$data.professions = response.results;
|
||||||
|
return Promise.resolve();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
this.$toast.open({message: error.body})
|
||||||
|
})
|
||||||
|
},
|
||||||
submitAddress(payload) {
|
submitAddress(payload) {
|
||||||
console.log('submitAddress', payload);
|
console.log('submitAddress', payload);
|
||||||
if (typeof payload.addressId !== 'undefined') { // <--
|
if (typeof payload.addressId !== 'undefined') { // <--
|
||||||
@ -200,13 +263,24 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
addQuery(query) {
|
addQuery(query) {
|
||||||
this.thirdparty.text = query;
|
this.thirdparty.name = query;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//console.log('mounted', this.action);
|
let dependencies = [];
|
||||||
|
dependencies.push(this.loadProfessions());
|
||||||
|
dependencies.push(this.loadCivilities());
|
||||||
if (this.action !== 'create') {
|
if (this.action !== 'create') {
|
||||||
this.loadData();
|
if (this.id) {
|
||||||
|
dependencies.push(this.loadData());
|
||||||
|
// here we can do something when all promises are resolve, with
|
||||||
|
// Promise.all(dependencies).then(() => { /* do something */ });
|
||||||
|
}
|
||||||
|
if (this.action === 'addContact') {
|
||||||
|
this.$data.thirdparty.kind = 'child'
|
||||||
|
// this.$data.thirdparty.parent = this.parent.id
|
||||||
|
this.$data.thirdparty.address = null
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.thirdparty.kind = 'company';
|
this.thirdparty.kind = 'company';
|
||||||
}
|
}
|
||||||
@ -229,5 +303,16 @@ dl {
|
|||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.parent-info {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#child-info {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
div {
|
||||||
|
width: 49%;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -4,7 +4,12 @@ const thirdpartyMessages = {
|
|||||||
name: "Dénomination",
|
name: "Dénomination",
|
||||||
email: "Courriel",
|
email: "Courriel",
|
||||||
phonenumber: "Téléphone",
|
phonenumber: "Téléphone",
|
||||||
}
|
comment: "Commentaire",
|
||||||
|
profession: "Qualité",
|
||||||
|
civility: "Civilité"
|
||||||
|
},
|
||||||
|
child_of: "Contact de: ",
|
||||||
|
children: "Personnes de contact: ",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type' => 'thirdparty',
|
'type' => 'thirdparty',
|
||||||
|
'name' => $thirdParty->getName(),
|
||||||
'text' => $this->thirdPartyRender->renderString($thirdParty, []),
|
'text' => $this->thirdPartyRender->renderString($thirdParty, []),
|
||||||
'id' => $thirdParty->getId(),
|
'id' => $thirdParty->getId(),
|
||||||
'kind' => $thirdParty->getKind(),
|
'kind' => $thirdParty->getKind(),
|
||||||
@ -45,6 +46,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
|||||||
'isChild' => $thirdParty->isChild(),
|
'isChild' => $thirdParty->isChild(),
|
||||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||||
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
||||||
|
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||||
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -110,3 +110,14 @@ paths:
|
|||||||
description: "OK"
|
description: "OK"
|
||||||
422:
|
422:
|
||||||
description: "Object with validation errors"
|
description: "Object with validation errors"
|
||||||
|
|
||||||
|
/1.0/thirdparty/professions.json:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- thirdparty
|
||||||
|
summary: Return all thirdparty professions
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "ok"
|
||||||
|
401:
|
||||||
|
description: "Unauthorized"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user