mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Adding fonction in personrenderbox
This commit is contained in:
parent
5d530aaae9
commit
262bb13b6c
@ -30,13 +30,13 @@ class ThirdPartyProfession
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json")
|
||||
* @Serializer\Groups({"docgen:read"})
|
||||
* @Serializer\Groups({"read", "docgen:read"})
|
||||
*/
|
||||
private array $name = [];
|
||||
|
||||
|
@ -22,8 +22,6 @@
|
||||
</badge-entity>
|
||||
</div>
|
||||
|
||||
<p v-if="thirdparty.profession">{{ thirdparty.profession }}</p>
|
||||
|
||||
<p v-if="this.options.addInfo === true" class="moreinfo">
|
||||
</p>
|
||||
</div>
|
||||
@ -96,10 +94,8 @@
|
||||
|
||||
<script>
|
||||
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
|
||||
import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
|
||||
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
|
||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||
//import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
||||
|
||||
export default {
|
||||
name: "ThirdPartyRenderBox",
|
||||
@ -107,7 +103,6 @@ export default {
|
||||
AddressRenderBox,
|
||||
Confidential,
|
||||
BadgeEntity,
|
||||
//OnTheFly
|
||||
},
|
||||
i18n: {
|
||||
messages: {
|
||||
@ -119,7 +114,6 @@ export default {
|
||||
props: ['thirdparty', 'options'],
|
||||
computed: {
|
||||
isMultiline: function() {
|
||||
console.log('thirdparty', this.thirdparty)
|
||||
if (this.options.isMultiline){
|
||||
return this.options.isMultiline
|
||||
} else {
|
||||
@ -129,6 +123,15 @@ export default {
|
||||
hasParent() {
|
||||
return !(this.thirdparty.parent === null || this.thirdparty.parent === undefined);
|
||||
},
|
||||
getProfession() {
|
||||
let profession = []
|
||||
|
||||
if (this.thirdparty.category) {
|
||||
profession = this.thirdparty.category.map((category) => category.text);
|
||||
}
|
||||
|
||||
return profession
|
||||
}
|
||||
/* TODO need backend normalizer to serve children without circular reference
|
||||
hasChildren() {
|
||||
//console.log(this.thirdparty.activeChildren.length > 0)
|
||||
@ -148,6 +151,15 @@ export default {
|
||||
font-variant: all-small-caps;
|
||||
}
|
||||
}
|
||||
|
||||
.list-item {
|
||||
&::after {
|
||||
content: "|";
|
||||
}
|
||||
&:last-child::after {
|
||||
content: ""
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
@ -11,7 +11,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ThirdPartyBundle\Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
@ -23,9 +26,14 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
|
||||
private ThirdPartyRender $thirdPartyRender;
|
||||
|
||||
public function __construct(ThirdPartyRender $thirdPartyRender)
|
||||
{
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ThirdPartyRender $thirdPartyRender,
|
||||
TranslatableStringHelperInterface $translatableStringHelper
|
||||
) {
|
||||
$this->thirdPartyRender = $thirdPartyRender;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,13 +47,26 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
'text' => $this->thirdPartyRender->renderString($thirdParty, []),
|
||||
'id' => $thirdParty->getId(),
|
||||
'kind' => $thirdParty->getKind(),
|
||||
'category' => array_map(function ($el) {
|
||||
if ($el instanceof ThirdPartyCategory) {
|
||||
return [
|
||||
'text' => $this->translatableStringHelper->localize($el->getName()),
|
||||
'type' => 'thirdparty_category',
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
'text' => $el,
|
||||
'type' => 'thirdparty_kind',
|
||||
];
|
||||
}
|
||||
}, $thirdParty->getTypesAndCategories()),
|
||||
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||
'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, ['address_rendering' => 'short']),
|
||||
'phonenumber' => $thirdParty->getTelephone(),
|
||||
'email' => $thirdParty->getEmail(),
|
||||
'isChild' => $thirdParty->isChild(),
|
||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
||||
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
||||
];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user