Commit 56cac6ae authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Refonte de l'UI de gestion des membres/partenaires

parent 547b2d5e
Loading
Loading
Loading
Loading
+0 −1
Changes for module/Oscar/src/Oscar/Controller/OrganizationController.php: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -93,7 +93,6 @@ class OrganizationController extends AbstractOscarController

        $organizations = $this->getOrganizationService()->getOrganizationsSearchPaged($search, $page, $filter);


        if ($this->getRequest()->isXmlHttpRequest()) {
            $result = [ 'datas' => []];
            foreach ($organizations as $data) {
+3 −1
Changes for module/Oscar/src/Oscar/Controller/PersonController.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -447,7 +447,9 @@ class PersonController extends AbstractOscarController
                'datas' => []
            ];
            foreach ($datas as $data) {
                $json['datas'][] = $data->toArray();
                $personData = $data->toArray();

                $json['datas'][] = $personData;
            }
            $view = new JsonModel();
            $view->setVariables($json);
+8 −0
Changes for module/Oscar/src/Oscar/Controller/ProjectGrantController.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1284,6 +1284,7 @@ class ProjectGrantController extends AbstractOscarController
        $pvRepo = $this->getEntityManager()->getRepository(ValidationPeriod::class);
        $declarations = $pvRepo->getValidationPeriodsByActivity($entity);

        $rolesPersons = $this->getOscarUserContext()->getAllRoleIdPersonInActivity();

        $activityTypeChain = $this->getActivityTypeService()->getActivityTypeChain($entity->getActivityType());

@@ -1343,6 +1344,7 @@ class ProjectGrantController extends AbstractOscarController
            'involvedPerson' => $involvedPersonsJSON,

            'rolesOrganizations' => $rolesOrganizations,
            'rolesPersons' => $rolesPersons,

            // Notifications précalculées
            'notifications' => $this->getEntityManager()->getRepository(Notification::class)
@@ -1415,6 +1417,7 @@ class ProjectGrantController extends AbstractOscarController

        $editableA = $deletableA = $this->getOscarUserContext()->hasPrivileges(Privileges::ACTIVITY_PERSON_MANAGE, $activity);
        $editableP = $deletableP = $this->getOscarUserContext()->hasPrivileges(Privileges::PROJECT_PERSON_MANAGE, $activity->getProject());
        $showable = $this->getOscarUserContext()->hasPrivileges(Privileges::PERSON_SHOW);

        /**
         * @var ActivityPerson $activityPerson
@@ -1439,6 +1442,10 @@ class ProjectGrantController extends AbstractOscarController
                $deletable = $deletableP;
                $context = "project";
            }
            $urlShow = false;
            if( $showable ){
                $urlShow = $showable ? $this->url()->fromRoute('person/show', ['id' => $activityPerson->getPerson()->getId()]) : false;
            }

            $out[] = [
                'id' => $activityPerson->getId(),
@@ -1448,6 +1455,7 @@ class ProjectGrantController extends AbstractOscarController
                'urlDelete' => $urlDelete,
                'context' => $context,
                'urlEdit' => $urlEdit,
                'urlShow' => $urlShow,
                'enroller' => $activity->getId(),
                'enrollerLabel' => $activity->getLabel(),
                'editable' => $editable,
+1 −0
Changes for module/Oscar/src/Oscar/Entity/Person.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -802,6 +802,7 @@ class Person implements ResourceInterface
            'firstName'             => $this->getFirstname(),
            'lastName'              => $this->getLastname(),
            'displayname'           => $this->getDisplayName(),
            'label'           => $this->getDisplayName(),
            'text'                  => $this->getDisplayName(),
            'email'                 => $this->getEmail(),
            'phone'                 => $this->getPhone(),
+36 −68
Changes for module/Oscar/view/oscar/project-grant/show.phtml: 36 added lines, 68 removed lines.
Original line number Diff line number Diff line
@@ -155,42 +155,15 @@
    <div class="row">
        <div class="col-md-8">

            <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_PERSON_SHOW, $entity)): ?>

            <section id="members-activity" class="has-btn">
                <h2><i class="icon-group"></i> Membres</h2>


                <div class="subsection">

                    <div id="persons-activity" class="enrollerPack"></div>

                    <script>
                        require(['EnrollerPack'], function(EnrollerPack){
                            EnrollerPack({
                                label: "personne",
                                urlDatas: '<?= $this->url('contract/persons', ['id' => $entity->getId()]) ?>',
                                lsname: "activity_persons",
                                el: '#persons-activity'
                            });
                        });
                    </script>


                    <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_PERSON_MANAGE, $entity)): ?>
                        <div class="btn-area">
                            <a href="<?= $this->url('personactivity/new', ['idenroller'=>$entity->getId()]) ?>" class="smoke" data-modalform>
                                <i class="icon-user"></i>
                                Ajouter un membre pour cette activité
                            </a>
                        </div>
                    <?php endif; ?>

                </div>
            <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_ORGANIZATION_SHOW, $entity)): ?>
                <section class="has-btn">
                    <h2>
                        <i class="icon-group"></i>
                        Membres
                    </h2>
                    <section id="organizations" class="has-btn"></section>
                    <?php if( $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_PERSON_ACCESS, $entity)): ?>
                <section id="involved">

                </section>
                        <section id="involved"></section>
                        <script>
                            require(['vue'], function(Vue){
                                new Vue({
@@ -236,15 +209,38 @@
                                })
                            })
                        </script>


                    <?php endif; ?>
                </section>
            <hr />
                <script>
                    require(['vue', 'vue-resource', 'EntityWithRole'], function(Vue, VueResource, EntityWithRole){
                        Vue.use(VueResource);
                        Vue.http.options.emulateJSON = true;
                        Vue.http.options.emulateHTTP = true;
                        new Vue({
                            el: "#organizations",
                            render(h){
                                return h(EntityWithRole.default, { props: {
                                        url: "<?= $this->url('contract/persons', ['id' => $entity->getId()]) ?>",
                                        urlNew: "<?= $this->url('personactivity/new', ['idenroller' => $entity->getId()]) ?>",
                                        manage: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_PERSON_MANAGE) ? "true" : false ?>,
                                        title: "Personne",
                                        roles: <?= json_encode($rolesPersons) ?>
                                    }});
                            }

                        })
                    });
                </script>
            <?php endif; ?>


            <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_ORGANIZATION_SHOW, $entity)): ?>
            <section id="organizations" class="has-btn">ORGANIZATIONS
            <section class="has-btn">
                <h2>
                    <i class="icon-building-filled"></i>
                    Partenaires
                </h2>
                <section id="organizations" class="has-btn"></section>
            </section>
            <script>
                require(['vue', 'vue-resource', 'EntityWithRole'], function(Vue, VueResource, EntityWithRole){
@@ -258,6 +254,7 @@
                                    url: "<?= $this->url('contract/organizations', ['id' => $entity->getId()]) ?>",
                                    urlNew: "<?= $this->url('organizationactivity/new', ['idenroller' => $entity->getId()]) ?>",
                                    manage: <?= $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_ORGANIZATION_MANAGE) ? "true" : false ?>,
                                    title: "Organisation",
                                    roles: <?= json_encode($rolesOrganizations) ?>
                                }});
                        }
@@ -267,35 +264,6 @@
            </script>
            <?php endif; ?>


            <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_ORGANIZATION_SHOW, $entity)): ?>
            <section id="partners" class="has-btn">
                <h2><i class="icon-group"></i> Partenaires</h2>

                <?php if ($this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_ORGANIZATION_MANAGE, $entity)): ?>
                    <div class="btn-area">
                        <a href="<?= $this->url('organizationactivity/new', ['idenroller'=>$entity->getId()]) ?>" class="smoke" data-modalform>
                            <i class="icon-user"></i>
                            Ajouter un partenaire pour cette activité
                        </a>
                    </div>
                <?php endif; ?>
                <div class="subsection">
                    <div id="organizations-activity" class="enrollerPack"></div>
                </div>
                <script>
                    require(['EnrollerPack'], function(EnrollerPack){
                        EnrollerPack({
                            label: "organisation",
                            urlDatas: '<?= $this->url('contract/organizations', ['id' => $entity->getId()]) ?>',
                            lsname: "activity_organizations",
                            el: '#organizations-activity'
                        });
                    });
                </script>
            </section>
            <?php endif; ?>

            <?php
            $manage = $this->grant()->privilege(\Oscar\Provider\Privileges::ACTIVITY_DOCUMENT_MANAGE, $entity);

Loading