Commit f2c29030 authored by tguillon's avatar tguillon
Browse files

Correction : jquery pour l'affichage et la réinitialisation des champs concernant l'AIPD

Correction : edit et show d'un traitement
Correction : des champs AIPD et dans les infos générale
parent 34c77f12
......@@ -640,6 +640,9 @@ class FichesController extends AppController
'coresponsableid',
'soustraitance',
'soustraitantid',
'obligation_pia',
'realisation_pia',
'depot_pia',
]
]);
......@@ -697,6 +700,10 @@ class FichesController extends AppController
$this->request->data['Fiche']['coresponsable'] = $fiche['Fiche']['coresponsable'];
$this->request->data['Fiche']['soustraitance'] = $fiche['Fiche']['soustraitance'];
$this->request->data['Fiche']['obligation_pia'] = $fiche['Fiche']['obligation_pia'];
$this->request->data['Fiche']['realisation_pia'] = $fiche['Fiche']['realisation_pia'];
$this->request->data['Fiche']['depot_pia'] = $fiche['Fiche']['depot_pia'];
$this->set(compact('formulaireOLD'));
$this->set('formulaire_id', $fiche['Fiche']['form_id']);
......@@ -832,6 +839,9 @@ class FichesController extends AppController
$this->request->data['Fiche']['coresponsable'] = $fiche['Fiche']['coresponsable'];
$this->request->data['Fiche']['soustraitance'] = $fiche['Fiche']['soustraitance'];
$this->request->data['Fiche']['obligation_pia'] = $fiche['Fiche']['obligation_pia'];
$this->request->data['Fiche']['realisation_pia'] = $fiche['Fiche']['realisation_pia'];
$this->request->data['Fiche']['depot_pia'] = $fiche['Fiche']['depot_pia'];
$this->set('formulaire_id', $fiche['Fiche']['form_id']); //@TODO
$this->set(compact('valeurs', 'showRegistre', 'formulaireOLD'));
......
......@@ -327,7 +327,6 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
<?php
echo $this->WebcilForm->input('obligation_pia', [
'id' => 'obligation_pia',
// 'id' => 'obligation_pia_displayed',
'options' => [
true => 'Oui',
false => 'Non'
......@@ -382,7 +381,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
],
'class' => 'transformSelect form-control',
'required' => true,
'empty' => $empty,
'empty' => true,
'placeholder' => false,
'data-placeholder' => ' '
]);
......
<?php
echo $this->Html->script('Fiches/pia');
$empty = true;
if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
$empty = false;
}
?>
<div id="info_pia" class="tab-pane <?php echo $classActivePia; ?>">
......@@ -46,7 +41,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
],
'class' => 'transformSelect form-control '.$classDisplayInput,
'required' => true,
'empty' => $empty,
'empty' => true,
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
......@@ -96,7 +91,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
],
'class' => 'fieldRequiredPia transformSelect form-control '.$classDisplayInput,
'required' => true,
'empty' => $empty,
'empty' => true,
'placeholder' => false,
'data-placeholder' => ' ',
'between' => '<div class="col-md-2 top5">',
......@@ -149,7 +144,7 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
],
'class' => 'transformSelect form-control displayInput',
'required' => true,
'empty' => $empty,
'empty' => true,
'placeholder' => false,
'data-placeholder' => ' '
]);
......
......@@ -49,19 +49,22 @@ echo $this->WebcilForm->create('Fiche', [
'class' => 'form-horizontal',
'novalidate' => 'novalidate'
]);
$classActiveInfoGenerale = 'active';
$classActivePia = '';
if ($this->request->params['action'] === 'add' ) {
$classActiveInfoGenerale = '';
$classActivePia = 'active';
}
?>
<div class="container-fluid" role="main">
<ul class="nav nav-tabs nav-justified" role="tablist">
<?php
$classActiveInfoGenerale = 'active';
$classActivePia = '';
if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
if ($usePIA['Formulaire']['usepia'] === true) {
$classActiveInfoGenerale = '';
$classActivePia = 'active';
?>
<li class="active">
<li class="<?php echo $classActivePia ?>">
<a href="#info_pia" role="tab" data-toggle="tab">
<i class="fa fa-pencil fa-fw"></i>
<?php
......
......@@ -11,6 +11,23 @@ echo $this->WebcilForm->create('Fiche', [
<div class="container-fluid" role="main">
<ul class="nav nav-tabs nav-justified" role="tablist">
<?php
if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
if ($usePIA['Formulaire']['usepia'] === true) {
?>
<li>
<a href="#info_pia" role="tab" data-toggle="tab">
<i class="fa fa-eye fa-fw"></i>
<?php
echo __d('fiche', 'fiche.ongletPia');
?>
</a>
</li>
<?php
}
}
?>
<li class="active">
<a href="#information_traitement" role="tab" data-toggle="tab">
<i class="fa fa-eye fa-fw"><!----></i>
......@@ -127,7 +144,17 @@ echo $this->WebcilForm->create('Fiche', [
<div class="tab-content">
<?php
echo $this->element("Fiches/tabs/informationGenerale");
if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
if ($usePIA['Formulaire']['usepia'] === true) {
echo $this->element("Fiches/tabs/pia", [
'classActivePia' => ''
]);
}
}
echo $this->element('Fiches/tabs/informationGenerale', [
'classActiveInfoGenerale' => 'active'
]);
if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
if (in_array(true, $useFieldsFormulaire['Formulaire'], true)) {
......
......@@ -141,29 +141,37 @@ $(document).ready(function () {
displayFieldRisque();
});
displayFieldTraitementConsidereRisque($('#traitement_considere_risque').val())
$('#traitement_considere_risque').change(function () {
if ($(this).val() == 'Oui') {
// alert('PIA OBLIGATOIRE');
$('#obligation_pia').val('1');
}
if ($(this).val() == 'Non') {
// alert('PIA NON OBLIGATOIRE');
$('#obligation_pia').val('0');
}
displayFieldTraitementConsidereRisque($(this).val());
});
});
function displayFieldTraitementConsidereRisque(val)
{
if (val == 'Oui') {
// alert('PIA OBLIGATOIRE');
$('#obligation_pia').val('1');
}
if (val == 'Non') {
// alert('PIA NON OBLIGATOIRE');
$('#obligation_pia').val('0');
}
}
function displayFieldRisque()
{
var nbChecked = $(":checkbox:checked").length;
if (nbChecked >= 2 ){
$('#traitement_considere_risque').parent().parent().hide();
$('#traitement_considere_risque').val('');
// alert("PIA OBLIGATOIRE");
$('#obligation_pia').val('1');
$('#traitement_considere_risque').parent().parent().hide();
$('#traitement_considere_risque').val('');
} else if (nbChecked == 1) {
$('#obligation_pia').val('');
$('#traitement_considere_risque').parent().parent().show();
} else if (nbChecked == 0) {
$('#traitement_considere_risque').parent().parent().hide();
......@@ -184,8 +192,15 @@ function displayFieldPiaListNotRequired(id, val) {
if (!$('#'+id).parent().parent().next('div').length) {
showListeObligatoire();
}
$('#obligation_pia').val('');
} else {
// if (val == 'Oui') {
if (val == 'Oui') {
// alert('PIA non obligatoire');
$('#obligation_pia').val('0');
}
$('#'+id).parent().parent().nextAll('div').hide();
$('#'+id).parent().parent().nextAll('div').children().children().prop('selectedIndex',0);
......@@ -198,9 +213,6 @@ function displayFieldPiaListNotRequired(id, val) {
$('.fieldListeRequiredPia').val('');
$('input:checkbox[type=checkbox]').attr('checked',false);
$('#traitement_considere_risque').val('');
// alert('PIA non obligatoire');
$('#obligation_pia').val('0');
}
}
......@@ -213,15 +225,19 @@ function showListeObligatoire()
function displayFieldPiaListRequired(id, val)
{
if (val == 'Non') {
$('#'+id).parent().parent().next('div').removeAttr('style');
$('#' + id).parent().parent().next('div').removeAttr('style');
if (!$('#'+id).parent().parent().next('div').length) {
if (!$('#' + id).parent().parent().next('div').length) {
showCriteres();
}
$('#obligation_pia').val('');
} else {
// alert("PIA OBILGATOIRE");
$('#obligation_pia').val('1');
if (val == 'Oui') {
// alert("PIA OBILGATOIRE");
$('#obligation_pia').val('1');
}
$('#'+id).parent().parent().nextAll('div').hide();
$('#'+id).parent().parent().nextAll('div').children().children().prop('selectedIndex',0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment