informationGenerale.ctp 19.5 KB
Newer Older
1
<?php
2
$initialisationRecu = isset($initialisationRecu) ? $initialisationRecu : false;
3
$empty = true;
4
$keySubmit = 'WebdpoFiche.';
5
$keySubmitService = 'WebdpoFiche.';
6 7

if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
8
    $empty = false;
9
    $keySubmit = 'Trash.';
10 11 12 13 14 15

    if ($initialisationRecu === true) {
        $keySubmitService = 'WebdpoFiche.';
    } else {
        $keySubmitService = 'Trash.';
    }
16
}
17 18 19 20

if (!isset($fieldsIsRequired)){
    $fieldsIsRequired = true;
}
21 22
?>

23
<!-- Onglet Information concernant le traitement -->
tguillon's avatar
tguillon committed
24
<div id="information_traitement" class="tab-pane <?php echo $classActiveInfoGenerale; ?>">
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
    <br/>
    <!-- Information sur le rédacteur -->
    <div class="col-md-12">
        <span class='labelFormulaire'>
            <?php
            echo __d('fiche', 'fiche.textInfoContact');
            ?>
        </span>
        <div class="row row35"></div>
    </div>

    <div class="row">
        <!-- Colonne de gauche -->
        <div class="col-md-6">
            <?php
40
            echo $this->WebcilForm->input($keySubmit.'declarantpersonnenom', [
41
                'id' => 'declarantpersonnenom',
42 43 44
                'label' => [
                        'text' => __d('fiche', 'fiche.champDeclarantpersonnenom')
                ],
45 46 47 48
                'readonly' => true,
                'required' => true
            ]);

49 50 51 52 53 54 55
            $serviceFieldOptions = [
                'id' => 'declarantservice',
                'label' => [
                    'text' => __d('fiche', 'fiche.champDeclarantservice')
                ],
                'required' => true,
            ];
56

57 58 59 60
            if (in_array($this->request->params['action'], ['edit', 'show']) !== true ||
                $initialisationRecu === true
            ) {
                $countService = count($this->Session->read('User.service'));
61

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
                if ($countService >= 2 && $fieldsIsRequired === true) {
                    foreach ($this->Session->read('User.service') as $service) {
                        $listeUserService[$service] = $service;
                    }

                    $serviceFieldOptions += [
                        'options' => $listeUserService,
                        'empty' => __d('fiche', 'fiche.emptySelectionnerServiceDeclarant'),
                        'placeholder' => false
                    ];
                } else
                    if ($countService == 0 || $fieldsIsRequired === false) {
                        $serviceFieldOptions += [
                            'readonly' => true,
                            'value' => 'Aucun service'
                        ];
                    } else {
                        $serviceFieldOptions += [
                            'readonly' => true,
                            'value' => $this->Session->read('User.service')
                        ];
                    }
84
            } else {
85 86 87
                $serviceFieldOptions += [
                    'readonly' => true
                ];
88 89
            }

90 91
            echo $this->WebcilForm->input($keySubmitService.'declarantservice', $serviceFieldOptions);

92
            echo $this->WebcilForm->input($keySubmit.'declarantpersonneportable', [
93
                'id' => 'declarantpersonneportable',
94 95 96
                'label' => [
                    'text' => __d('fiche', 'fiche.champDeclarantpersonneportable')
                ],
97 98 99 100 101 102 103 104 105 106
                'readonly' => true,
                'placeholder' => false
            ]);
            ?>
        </div>

        <!-- Colonne de droite -->
        <div class="col-md-6">
            <?php
            echo $this->WebcilForm->inputs([
107
                $keySubmit.'declarantpersonneemail' => [
108
                    'id' => 'declarantpersonneemail',
109 110 111
                    'label' => [
                        'text' => __d('fiche', 'fiche.champDeclarantpersonneemail')
                    ],
112 113 114
                    'readonly' => true,
                    'required' => true
                ],
115
                $keySubmit.'declarantpersonnefix' => [
116
                    'id' => 'declarantpersonnefix',
117 118 119
                    'label' => [
                        'text' => __d('fiche', 'fiche.champDeclarantpersonnefix')
                    ],
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
                    'readonly' => true,
                    'placeholder' => false
                ]
            ]);
            ?>
        </div>
    </div>

    <!-- Information sur la norme -->
    <div class="col-md-12">
        <span class='labelFormulaire'>
            <?php
            echo __d('fiche', 'fiche.textInfoNorme');
            ?>
        </span>
        <div class="row row35"></div>
    </div>

138 139 140 141 142 143 144 145 146 147 148 149 150 151
    <?php
    $valueNorme = null;
    if (isset($normeTraitement) && !empty($normeTraitement)) {
        $norme = $normeTraitement['Norme']['norme'] . '-' . sprintf('%03d', $normeTraitement['Norme']['numero']) . ' : ' . $normeTraitement['Norme']['libelle'];
        $normeDescription = preg_replace('@<[^>]*?>.*?>@si', "\n\r", $normeTraitement['Norme']['description']);
        ?>
        <!-- Information sur la norme -->
        <div class="col-md-12">
            <span class='labelFormulaire'>
                <?php
                echo __d('fiche', 'fiche.textInfoNorme');
                ?>
            </span>
            <div class="row row35"></div>
152 153
        </div>

154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
        <div class="row">
            <!-- Colonne de gauche -->
            <div class="col-md-6">
                <?php
                echo $this->WebcilForm->input('norme', [
                    'id' => 'shownorme',
                    'readonly' => true,
                    'placeholder' => false,
                    'value' => $norme
                ]);
                ?>

                <table class="table" id="render">
                    <tbody>
                    <tr>
                        <td class="col-md-1">
                            <i class="fa fa-file-text-o fa-lg"><!----></i>
                        </td>

                        <td class="col-md-9 tdleft">
                            <?php
                            echo $normeTraitement['Norme']['name_fichier'];
                            ?>
                        </td>

                        <td class="col-md-2">
                            <?php
                            echo $this->Html->link('<span class="fa fa-download fa-lg"><!----></span>', [
                                'controller' => 'normes',
                                'action' => 'download',
                                $normeTraitement['Norme']['fichier'],
                                $normeTraitement['Norme']['name_fichier']
                            ], [
                                'class' => 'btn btn-default-default boutonShow btn-sm my-tooltip',
                                'title' => 'Télécharger la norme',
                                'escapeTitle' => false
                            ]);
                            ?>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <!-- Colonne de droite -->
            <div class="col-md-6">
                <?php
                echo $this->WebcilForm->input('descriptionNorme', [
                    'id' => 'showdescriptionNorme',
                    'type' => 'textarea',
                    'readonly' => true,
                    'placeholder' => false,
                    'value' => $normeDescription
                ]);
                ?>
            </div>
210
        </div>
211 212 213 214 215 216 217 218 219 220
        <?php
    } else {
        if (isset($this->request->data['Fiche']['norme_id'])) {
            $valueNorme = $this->request->data['Fiche']['norme_id'];
        }
        ?>
        <div class="row">
            <!-- Colonne de gauche -->
            <div class="col-md-6">
                <?php
221 222 223 224 225
                echo $this->WebcilForm->input('norme_id', [
                    'id' => 'norme_id',
                    'label' => [
                        'text' => __d('fiche', 'fiche.champNorme')
                    ],
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
                    'options' => $options_normes,
                    'class' => 'usersDeroulant transformSelect form-control',
                    'empty' => true,
                    'placeholder' => false,
                    'data-placeholder' => __d('norme', 'norme.placeholderFiltreNorme'),
                    'value' => $valueNorme
                ]);
                ?>
            </div>

            <!-- Colonne de droite -->
            <div class="col-md-6">
                <?php
                echo $this->WebcilForm->input('descriptionNorme', [
                    'id' => 'descriptionNorme',
                    'type' => 'textarea',
                    'readonly' => true,
243
                    'disabled' => true,
244 245 246 247 248 249 250 251
                    'placeholder' => false
                ]);
                ?>
            </div>
        </div>
        <?php
    }
    ?>
252 253 254

    <!-- Information concernant le traitement -->
    <div class="col-md-12">
255 256 257 258 259
        <span class='labelFormulaire'>
            <?php
            echo __d('fiche', 'fiche.textInfoTraitement');
            ?>
        </span>
260 261 262 263 264 265 266 267
        <div class="row row35"></div>
    </div>

    <div class="row">
        <!-- Colonne de gauche -->
        <div class="col-md-6">
            <?php
            echo $this->WebcilForm->inputs([
268
                'WebdpoFiche.outilnom' => [
269
                    'id' => 'outilnom',
270 271 272
                    'label' => [
                        'text' => __d('fiche', 'fiche.champOutilnom')
                    ],
273 274 275
                    'required' => true,
                    'placeholder' => false
                ],
276 277
                'transfert_hors_ue' => [
                    'id' => 'transfert_hors_ue',
278
                    'options' => [
279 280
                        true => 'Oui',
                        false => 'Non'
281
                    ],
282 283 284 285
                    'label' => [
                        'text' => $this->Html->tag(
                            'abbr',
                            __d('fiche', 'fiche.champTransfertHorsUe'),
286 287 288 289
                            [
                                'data-content' => nl2br(__d('fiche', 'fiche.champTransfertHorsUeDefinition')),
                                'class' => 'popoverText'
                            ]
290 291
                        )
                    ],
292 293
                    'class' => 'transformSelect form-control',
                    'required' => true,
294 295 296
                    'empty' => false,
                    'data-placeholder' => ' ',
                    'default' => false
297
                ],
298 299
                'donnees_sensibles' => [
                    'id' => 'donnees_sensibles',
300
                    'options' => [
301 302
                        true => 'Oui',
                        false => 'Non'
303
                    ],
304 305 306 307
                    'label' => [
                        'text' => $this->Html->tag(
                            'abbr',
                            __d('fiche', 'fiche.champDonneesSensibles'),
308 309 310 311
                            [
                                'data-content' => nl2br(__d('fiche', 'fiche.champDonneesSensiblesDefinition')),
                                'class' => 'popoverText'
                            ]
312 313
                        )
                    ],
314 315
                    'class' => 'transformSelect form-control',
                    'required' => true,
316 317 318
                    'empty' => false,
                    'data-placeholder' => ' ',
                    'default' => false
319 320 321 322 323 324 325 326
                ]
            ]);
            ?>
        </div>

        <!-- Colonne de droite -->
        <div class="col-md-6">
            <?php
327
            echo $this->WebcilForm->input('WebdpoFiche.finaliteprincipale', [
328
                'id' => 'finaliteprincipale',
329
                'label' => [
330 331 332
                    'text' => $this->Html->tag(
                        'abbr',
                        __d('fiche', 'fiche.champFinaliteprincipale'),
333 334 335 336
                        [
                            'data-content' => nl2br(__d('fiche', 'fiche.champFinaliteprincipaleDefinition')),
                            'class' => 'popoverText'
                        ]
337
                    )
338
                ],
339 340 341 342 343 344 345 346
                'type' => 'textarea',
                'required' => true,
                'placeholder' => false
            ]);
            ?>
        </div>
    </div>

tguillon's avatar
tguillon committed
347 348
    <?php
    if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
349 350
        ?>
        <div class="col-md-12">
tguillon's avatar
tguillon committed
351 352 353 354 355
            <span class='labelFormulaire'>
                <?php
                echo __d('fiche', 'fiche.textInfoPia');
                ?>
            </span>
356 357
            <div class="row row35"></div>
        </div>
tguillon's avatar
tguillon committed
358

359 360 361
        <?php
        if (isset($usePIA) && $usePIA['Formulaire']['usepia'] === true) {
            ?>
tguillon's avatar
tguillon committed
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
            <div class="row">
                <div class="col-md-6">
                    <?php
                    echo $this->WebcilForm->input('obligation_pia', [
                        'id' => 'obligation_pia',
                        'options' => [
                            true => 'Oui',
                            false => 'Non'
                        ],
                        'class' => 'transformSelect form-control',
                        'required' => true,
                        'readonly' => true,
                        'disabled' => true,
                        'empty' => true,
                        'placeholder' => false,
                        'data-placeholder' => ' '
                    ]);
                    ?>
                </div>

                <div class="col-md-6"></div>
            </div>
            <?php
        } else {
            echo $this->WebcilForm->hidden('obligation_pia', [
                'id' => 'obligation_pia',
                'value' => null
            ]);
        }
tguillon's avatar
tguillon committed
391
        ?>
tguillon's avatar
tguillon committed
392

tguillon's avatar
tguillon committed
393 394 395
        <div class="row">
            <div class="col-md-6">
                <?php
tguillon's avatar
tguillon committed
396 397
                echo $this->WebcilForm->input('realisation_pia', [
                    'id' => 'realisation_pia',
tguillon's avatar
tguillon committed
398 399 400 401
                    'options' => [
                        true => 'Oui',
                        false => 'Non'
                    ],
402 403 404 405
                    'label' => [
                        'text' => $this->Html->tag(
                            'abbr',
                            __d('fiche', 'fiche.champRealisationPia'),
406 407 408 409
                            [
                                'data-content' => nl2br(__d('fiche', 'fiche.champRealisationPiaDefinition')),
                                'class' => 'popoverText'
                            ]
410 411
                        )
                    ],
tguillon's avatar
tguillon committed
412 413 414 415 416 417 418 419 420
                    'class' => 'transformSelect form-control',
                    'required' => true,
                    'empty' => $empty,
                    'placeholder' => false,
                    'data-placeholder' => ' '
                ]);
                ?>
            </div>

tguillon's avatar
tguillon committed
421 422 423 424 425 426 427 428 429 430
            <div class="col-md-6">
                <?php
                echo $this->WebcilForm->input('depot_pia', [
                    'id' => 'depot_pia',
                    'options' => [
                        true => 'Oui',
                        false => 'Non'
                    ],
                    'class' => 'transformSelect form-control',
                    'required' => true,
431
                    'empty' => true,
tguillon's avatar
tguillon committed
432 433 434 435 436
                    'placeholder' => false,
                    'data-placeholder' => ' '
                ]);
                ?>
            </div>
tguillon's avatar
tguillon committed
437 438 439
        </div>
        <?php
    }
440
    ?>
tguillon's avatar
tguillon committed
441

442 443 444 445 446 447 448 449 450
    <!-- Co-responsabilité sur le traitement -->
    <div class="col-md-12">
        <span class='labelFormulaire'>
            <?php
            echo __d('fiche', 'fiche.textInfoCoresponsable');
            ?>
        </span>
        <div class="row row35"></div>
    </div>
451

452 453 454 455 456 457 458 459 460 461
    <div class="row">
        <!-- Colonne de gauche -->
        <div class="col-md-6">
            <?php
            echo $this->WebcilForm->input('coresponsable', [
                'id' => 'coresponsable',
                'options' => [
                    true => 'Oui',
                    false => 'Non'
                ],
462 463 464 465
                'label' => [
                    'text' => $this->Html->tag(
                        'abbr',
                        __d('fiche', 'fiche.champCoresponsable'),
466 467 468 469
                        [
                            'data-content' => nl2br(__d('fiche', 'fiche.champCoresponsableDefinition')),
                            'class' => 'popoverText'
                        ]
470 471
                    )
                ],
472 473 474 475 476 477 478
                'class' => 'transformSelect form-control',
                'required' => true,
                'empty' => false,
                'data-placeholder' => ' ',
                'default' => false
            ]);
            ?>
479
        </div>
480
    </div>
481

482 483 484 485
    <!-- Sous-traitance sur le traitement -->
    <div class="col-md-12">
        <span class='labelFormulaire'>
            <?php
486 487 488 489 490 491 492
            if ($rt_externe === false) {
                echo __d('fiche', 'fiche.textInfoSousTraitance');
                $libelleFieldSoustraitance = __d('fiche', 'fiche.champSoustraitance');
            } else {
                echo __d('fiche', 'fiche.textInfoSousTraitanceUlterieur');
                $libelleFieldSoustraitance = __d('fiche', 'fiche.champSoustraitanceUlterieur');
            }
493 494 495 496
            ?>
        </span>
        <div class="row row35"></div>
    </div>
497

498 499 500 501
    <div class="row">
        <!-- Colonne de gauche -->
        <div class="col-md-6">
            <?php
502 503
            echo $this->WebcilForm->input('soustraitance', [
                'id' => 'soustraitance',
504
                'label' => [
505 506 507
                    'text' => $this->Html->tag(
                        'abbr',
                        $libelleFieldSoustraitance,
508 509 510 511
                        [
                            'data-content' => nl2br(__d('fiche', 'fiche.champSoustraitanceDefinition')),
                            'class' => 'popoverText'
                        ]
512
                    )
513
                ],
514 515 516 517 518 519 520 521 522
                'options' => [
                    true => 'Oui',
                    false => 'Non'
                ],
                'class' => 'transformSelect form-control',
                'required' => true,
                'empty' => false,
                'data-placeholder' => ' ',
                'default' => false
523
            ]);
524
            ?>
525
        </div>
526
    </div>
527 528 529 530 531 532 533 534
</div>
<!-- Fin onglet Information concernant le traitement-->

<script type="text/javascript">

    $(document).ready(function () {

        var descriptions = <?php echo json_encode($descriptions_normes); ?>;
535 536
        //var normeId = <?php ////echo json_encode($valueNorme);?>////;
        var normeId = $('#norme_id').val();
537

538
        if (typeof(normeId) != "undefined" && normeId !== null && normeId) {
539 540 541 542
            var str = descriptions[normeId].replace(/<br\s*[\/]?>/gi, "\n");
            $("#descriptionNorme").val(str);
        }

543
        $('#norme_id').change(function () {
544
            var idNorme = $(this).val();
545
            var str = '';
546

547 548 549 550 551 552 553 554 555
            if (idNorme === '') {
                str = null;
            } else {
                str = descriptions[idNorme].replace(/<br\s*[\/]?>/gi, "\n");
            }

            $("#descriptionNorme").val(str);
        });

tguillon's avatar
tguillon committed
556 557 558 559 560
        displayFieldDepotPIA($('#realisation_pia').val());
        $('#realisation_pia').change(function () {
            var val = $(this).val();
            displayFieldDepotPIA(val);
        });
561 562
    });

tguillon's avatar
tguillon committed
563 564 565 566 567
    function displayFieldDepotPIA(val)
    {
        if (val == true) {
            $('#depot_pia').parent().parent().show();
        } else {
tguillon's avatar
tguillon committed
568
            $('#depot_pia').val('');
tguillon's avatar
tguillon committed
569 570 571 572
            $('#depot_pia').parent().parent().hide();
        }
    }

573
</script>