Commit 77cafc73 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Correction du changement de structure de role

parent 6f1c9b29
Loading
Loading
Loading
Loading
+3 −17
Changes for module/Application/src/View/Helper/UserProfileSelectRadioItem.php: 3 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ class UserProfileSelectRadioItem extends UnicaenAuthViewHelper
        $perimetre = $this->role ? $this->role->getPerimetre() : null;

        if ($this->role->getPeutChangerStructure() && $perimetre && $perimetre->isEtablissement()) {
            $selectClass = 'user-profile-select-input-structure';
            $selectClass = 'user-profile-select-input user-profile-select-input-structure toto';

            $select = new \Laminas\Form\Element\Select('structure-' . $this->role->getRoleId());
            $select
@@ -40,24 +40,10 @@ class UserProfileSelectRadioItem extends UnicaenAuthViewHelper
                ->setValueOptions($this->getStructures())
                ->setValue($this->getStructure() ? $this->getStructure()->getId() : null)
                ->setAttribute('class', $selectClass)
                ->setAttribute('onchange', 'Util.userProfileStructureChange(this)')
                ->setAttribute('title', "Cliquez pour sélectionner la structure associée au profil $this->role");

            $html .= ' ' . $this->getView()->formSelect($select);

            $html .= <<<EOS
<script>
    $(function() {
        $("select.$selectClass").tooltip({ delay: 500, placement: 'right' }).change(function() {
            var roleInput = $(this).parent().find('input.user-profile-select-input');
            if (roleInput.attr("checked")) {
                submitProfile();
            }else{
                roleInput.attr("checked", "checked");
            }
        });
    });
</script>
EOS;
            $html .= $this->getView()->formSelect($select);
        }

        return $html;
+1 −2
Changes for module/Application/view/layout/layout.phtml: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ echo $this->doctype();
    <script type="text/javascript" src="<?= $this->basePath('/vendor/jquery-3.6.0.min.js?v=' . $version) ?>"></script>
    <script type="text/javascript"
            src="<?= $this->basePath('/vendor/jquery-ui-1.12.1/jquery-ui.min.js?v=' . $version) ?>"></script>
    <?= $this->headScript(); ?>
</head>

<body class="<?= getenv('APPLICATION_ENV') ?: 'dev' ?> p-0" data-base-url="<?= $this->url('home') ?>">
@@ -148,8 +149,6 @@ echo $this->doctype();
<script type="text/javascript" src="<?= $this->basePath('/js/paiement.js?v=' . $version) ?>"></script>
<script type="text/javascript" src="<?= $this->basePath('/js/piece-jointe.js?v=' . $version) ?>"></script>

<?= $this->headScript(); ?>

<!-- Scripts chargés dynamiquement -->
<?= $this->inlineScript(); ?>

+10 −0
Changes for public/js/app.js: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -184,6 +184,16 @@ Util = {

    },

    userProfileStructureChange: function (select)
    {
        var roleInput = $(select).parent().find('input.user-profile-select-input');
        if (!roleInput.attr("checked")) {
            roleInput.attr("checked", "checked");
        }
        var event = new Event('change', {bubbles: true});
        roleInput[0].dispatchEvent(event);
    },

    changementAnnee: function (annee)
    {
        $.get(