Commit 14225b7d authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction edition des champs autres

parent 53bddcd2
Loading
Loading
Loading
Loading
+2 −1
Changes for module/Application/src/Controller/AutresController.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ class AutresController extends AbstractController
    }



    public function saisieAction()
    {
        $dossierAutre = $this->getEvent()->getParam('dossierAutre');
@@ -34,6 +33,8 @@ class AutresController extends AbstractController
            try {
                $this->getServiceDossierAutre()->save($autre);
                $this->flashMessenger()->addSuccessMessage('Enregistrement effectué');
                return $this->redirect()->toRoute('autres-infos');

            } catch (\Exception $e) {
                $this->flashMessenger()->addErrorMessage($this->translate($e));
            }
+1 −2
Changes for module/Application/src/Form/Intervenant/AutresForm.php: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ class AutresForm extends AbstractForm
            'name'       => 'submit',
            'type'       => 'Submit',
            'attributes' => [
                'value' => 'Appliquer',
                'value' => 'Enregistrer',
                'class' => 'btn btn-primary',
                'id'    => 'btn-save',
            ],
@@ -106,7 +106,6 @@ class AutresForm extends AbstractForm
    }



    /**
     * Should return an array specification compatible with
     * {@link Laminas\InputFilter\Factory::createInputFilter()}.
+1 −2
Changes for module/Application/view/application/autres/index.phtml: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -38,9 +38,8 @@ echo $this->inlinescript()->appendFile($this->basePath() . '/vendor/ace-builds-m
            <td><?= $autre->getDescription() ?></td>
            <?php if ($canEdit): ?>
                <td style="text-align:center;width:1px;white-space: nowrap">
                    <a class="mod-ajax" data-submit-reload="true"
                    <a
                            href="<?= $this->url('autres-infos/saisie', ['dossierAutre' => $autre->getId()]) ?>"
                       data-submit-reload="true">
                    <i class="fas fa-pen-to-square"></i></a>
                </td>
            <?php endif; ?>
+20 −22
Changes for module/Application/view/application/autres/saisie.phtml: 20 added lines, 22 removed lines.
Original line number Diff line number Diff line
@@ -8,30 +8,33 @@ echo $this->tag('h1', ['class' => 'page-header'])->html($title);
echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
$type = $dossierAutre->getType()->getId();

echo $this->inlinescript()->appendFile($this->basePath() . '/vendor/ace-builds-master/src-min/ace.js');

echo $this->form()->openTag($form); ?>

<div class="row">
    <div class="col-md-3">
    <div class="col-md-6">
        <?= $this->formControlGroup($form->get('libelle')); ?>
    </div>
    <div class="col-md-6">
        <?= $this->formControlGroup($form->get('description')); ?>
    </div>
</div>
<div class="row">
    <div class="col-md-6">
        <?= $this->formControlGroup($form->get('type')); ?>
    </div>
    <div class="col-md-6">
        <?= $this->formControlGroup($form->get('obligatoire')); ?>
    </div>
    <div class="col-md-12">
</div>


<ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="<?= ($type != '3') ? 'active' : ''; ?>"><a href="#json" aria-controls="json"
                                                                                      role="tab"
                >Valeurs manuelles</a></li>
            <li role="presentation" class="<?= ($type == '3') ? 'active' : ''; ?>"><a href="#sql" aria-controls="sql"
                                                                                      role="tab"
                >Valeurs via SQL </a></li>
    <li role="presentation"><a class="nav-link <?= ($type != '3') ? 'active' : ''; ?>" href="#json" aria-controls="json"
                               role="tab" data-bs-toggle="tab">Valeurs manuelles</a></li>
    <li role="presentation"><a class="nav-link <?= ($type == '3') ? 'active' : ''; ?>" href="#sql" aria-controls="sql"
                               role="tab" data-bs-toggle="tab">Valeurs via SQL </a></li>
</ul>

<div class="tab-content">
@@ -40,7 +43,8 @@ echo $this->form()->openTag($form); ?>
        <div class="card bg-default json-value">
            <div class="card-header" role="tab">
                <label>Valeurs sous forme JSON<br/>
                            <small style="font-weight:normal">Format : { "0":"VALUE1" , "1":"VALUE2" ...}</small></label>
                    <small style="font-weight:normal">Format : { "0":"VALUE1" , "1":"VALUE2"
                        ...}</small></label>
            </div>
            <div class="card-body">
                <?= $this->formTextarea($form->get('json-value')) ?>
@@ -61,27 +65,20 @@ echo $this->form()->openTag($form); ?>
        </div>
    </div>
</div>
    </div>
</div>
<?= $this->formSubmit($form->get('submit')); ?>
<?= $this->formControlGroup($form->get('security')); ?>

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


<script>


    $(function ()
    {
    $(function () {

        WidgetInitializer.add('autres-saisir', {
            jsonValueEditor: null,
            sqlValueEditor: null,

            save: function ()
            {
            save: function () {
                var jsonValue = $("<input>")
                    .attr("type", 'hidden')
                    .attr("name", 'json-value')
@@ -96,11 +93,12 @@ echo $this->form()->openTag($form); ?>

            },

            _create: function ()
            {
            _create: function () {
                var that = this;

                that.element.find('#btn-save').click(function () { that.save();});
                that.element.find('#btn-save').click(function () {
                    that.save();
                });
                that.element.find('.nav a').click(function (e) {
                    e.preventDefault();
                    $('a[href="' + $(this).attr('href') + '"]').tab('show');
@@ -108,7 +106,7 @@ echo $this->form()->openTag($form); ?>
                })

                var options = {
                    minLines: 15, maxLines: 40,
                    minLines: 40, maxLines: 40,
                };
                that.jsonValueEditor = ace.edit("json-value");
                that.jsonValueEditor.setTheme("ace/theme/github");