Commit 18ca39d6 authored by Florian Joriot's avatar Florian Joriot
Browse files

Ajout du taux dans l'element form

parent 3795eb5b
Loading
Loading
Loading
Loading
+6 −1
Changes for module/OffreFormation/src/Controller/ElementPedagogiqueController.php: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ use Application\Service\Traits\StructureServiceAwareTrait;
use OffreFormation\Service\Traits\ElementModulateurServiceAwareTrait;
use OffreFormation\Service\Traits\ElementPedagogiqueServiceAwareTrait;
use OffreFormation\Service\Traits\VolumeHoraireEnsServiceAwareTrait;
use Paiement\Service\TauxRemuServiceAwareTrait;
use UnicaenImport\Service\Traits\SchemaServiceAwareTrait;

/**
@@ -35,7 +36,7 @@ class ElementPedagogiqueController extends AbstractController
    use ElementPedagogiqueSynchronisationFormAwareTrait;
    use StructureServiceAwareTrait;
    use SchemaServiceAwareTrait;

    use TauxRemuServiceAwareTrait;

    public function voirAction()
    {
@@ -322,6 +323,10 @@ class ElementPedagogiqueController extends AbstractController
                'fc' => $datasPost['fc'],
            ];
            $element     = $this->getServiceCentreCoutEp()->addElementCentreCout($element, $centreCouts);
            //Taux de remuneration
            $tauxRemu =  $datasPost['tauxRemu'];

            $this->getServiceElementPedagogique()->updateTauxRemu($element, $this->getServiceTauxRemu()->get($tauxRemu));
        }

        $form->setElementPedagogique($element);
+41 −0
Changes for module/OffreFormation/src/Form/ElementModulateurCentreCoutForm.php: 41 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Application\Service\Traits\CentreCoutServiceAwareTrait;
use Laminas\Form\Element\Select;
use OffreFormation\Service\Traits\ElementPedagogiqueServiceAwareTrait;
use Application\Service\Traits\TypeModulateurServiceAwareTrait;
use Paiement\Service\TauxRemuServiceAwareTrait;

/**
 * Description of ElementModulateurSaisie
@@ -23,6 +24,7 @@ class ElementModulateurCentreCoutForm extends AbstractForm
    use TypeModulateurServiceAwareTrait;
    use ElementModulateursFieldsetAwareTrait;
    use CentreCoutServiceAwareTrait;
    use TauxRemuServiceAwareTrait;

    /**
     * Element
@@ -104,6 +106,21 @@ class ElementModulateurCentreCoutForm extends AbstractForm
            $this->add($selectCentreCout);
        }

        /* partie taux de rémuneration */
        //Formulaire partie Taux de rémunération de l'élément pédagogique en cours
        $tauxRemu        = $elementPedagogique->getTauxRemuEp();
        $tauxRemusValues = [];
        if ($tauxRemu) {

            $tauxRemusValues["tauxRemu"] = $tauxRemu->getCode();
        }

        $selectTauxRemu = $this->createSelectElementTauxRemu($elementPedagogique);
        if (array_key_exists('tauxRemu', $centresCoutsValues)) {
            $selectTauxRemu->setValue($centresCoutsValues['tauxRemu']);
        }
        $this->add($selectTauxRemu);


        $this->add([
            'name' => 'id',
@@ -135,6 +152,30 @@ class ElementModulateurCentreCoutForm extends AbstractForm



    /**
     * @param ElementPedagogique $elementPedagogique
     *
     * @return Select
     */
    private function createSelectElementTauxRemu(ElementPedagogique $elementPedagogique)
    {
        $tauxRemus    = $this->getServiceTauxRemu()->getTauxRemus();
        $valueOptions = [];
        foreach ($tauxRemus as $tauxRemu) {
            $valueOptions[$tauxRemu->getId()] = $tauxRemu->getCode() . ' - ' . $tauxRemu->getLibelle();
        }
        $element = new Select('tauxRemu');
        $element
            ->setLabel('tauxRemu')
            ->setValueOptions(['' => '(Aucun)'] + $valueOptions)
            ->setAttribute('class', 'taux-remu selectpicker')
            ->setAttribute('data-live-search', 'true');

        return $element;
    }



    /**
     * Retourne la liste des types de modulateurs de l'element
     *
+13 −1
Changes for module/OffreFormation/view/offre-formation/element-pedagogique/modulateurs-centres-couts.phtml: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -51,7 +51,19 @@
        <?php endif; ?>
        </tbody>
    </table>

    <table class="table table-bordered table-xs">
        <thead>
        <tr>
            <th colspan="2">Taux de rémunération de l'élément pédagogique</th>
        </tr>
        </thead>
        <?php if ($form->has('tauxRemu')): ?>
            <tr>
                <td><?= $this->formSelect($form->get('tauxRemu')); ?></td>
            </tr>
        <?php endif; ?>
        </tbody>
    </table>
    <?= $this->formSubmit($form->get('submit')); ?>

    <?= $this->form()->closeTag($form); ?>