mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
do active center filtering in frontend for person creation
This commit is contained in:
parent
b4f9501af5
commit
cd85e37c1b
@ -63,6 +63,7 @@ class CenterNormalizer implements DenormalizerInterface, NormalizerInterface
|
|||||||
'id' => $center->getId(),
|
'id' => $center->getId(),
|
||||||
'type' => 'center',
|
'type' => 'center',
|
||||||
'name' => $center->getName(),
|
'name' => $center->getName(),
|
||||||
|
'isActive' => $center->getIsActive()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,6 @@ class PersonApiController extends ApiController
|
|||||||
{
|
{
|
||||||
$centers = $this->authorizedCenterOnPersonCreation->getCenters();
|
$centers = $this->authorizedCenterOnPersonCreation->getCenters();
|
||||||
|
|
||||||
// $centersActive = array_filter($centers, fn(Center $c) => $c->getIsActive());
|
|
||||||
|
|
||||||
return $this->json(
|
return $this->json(
|
||||||
['showCenters' => $this->showCenters, 'centers' => $centers],
|
['showCenters' => $this->showCenters, 'centers' => $centers],
|
||||||
Response::HTTP_OK,
|
Response::HTTP_OK,
|
||||||
|
@ -329,12 +329,13 @@ export default {
|
|||||||
if (this.action !== 'create') {
|
if (this.action !== 'create') {
|
||||||
this.loadData();
|
this.loadData();
|
||||||
} else {
|
} else {
|
||||||
console.log('show centers', this.showCenters);
|
// console.log('show centers', this.showCenters);
|
||||||
getCentersForPersonCreation()
|
getCentersForPersonCreation()
|
||||||
.then(params => {
|
.then(params => {
|
||||||
this.config.centers = params.centers;
|
this.config.centers = params.centers.filter(c => c.isActive);
|
||||||
this.showCenters = params.showCenters;
|
this.showCenters = params.showCenters;
|
||||||
console.log('show centers inside', this.showCenters);
|
// console.log('centers', this.config.centers)
|
||||||
|
// console.log('show centers inside', this.showCenters);
|
||||||
if (this.showCenters && this.config.centers.length === 1) {
|
if (this.showCenters && this.config.centers.length === 1) {
|
||||||
this.person.center = this.config.centers[0];
|
this.person.center = this.config.centers[0];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user