Commit cd478c87 authored by tguillon's avatar tguillon
Browse files

Ajout : des variables concernant l'onglet information complémentaire lors de...

Ajout : des variables concernant l'onglet information complémentaire lors de la génération documentaire.
Ajout : des variables concernant l'onglet information complémentaire dans les infos des varibles
parent f34d0523
......@@ -220,4 +220,7 @@ msgstr "Co-responsable"
msgid "modele.sousTitreSoustraitant"
msgstr "Sous-traitant"
msgid "modele.sousTitreVariableInformationComplementaireTraitement"
msgstr "Information complémentaire du traitement"
###############################################################################
......@@ -96,6 +96,10 @@ class Fiche extends AppModel {
'Champ' => [
'className' => 'Champ',
'foreignKey' => 'formulaires_id'
],
'Baselegale' => [
'className' => 'Baselegale',
'foreignKey' => 'id'
]
];
......@@ -476,6 +480,11 @@ class Fiche extends AppModel {
}
}
$champsInformationComplementaire = [
'sousFinalite',
'baselegale'
];
/**
* On vérifie que le tableau qu'on a créé juste au dessus existe.
* Si il exite on on prend la valeur de l'id choisit dans le tableau,
......@@ -496,6 +505,40 @@ class Fiche extends AppModel {
'type' => 'text'
];
}
} elseif (in_array($value['Valeur']['champ_name'], $champsInformationComplementaire)) {
if ($value['Valeur']['champ_name'] === 'sousFinalite') {
foreach (json_decode($value['Valeur']['valeur']) as $key => $val) {
$donnees[$value['Valeur']['champ_name']][$key]['valeur_' . $value['Valeur']['champ_name']] = [
'value' => $val,
'type' => 'text'
];
}
}
if ($value['Valeur']['champ_name'] === 'baselegale') {
$baseLegales = $this->Baselegale->find('all', [
'conditions' => [
'id' => json_decode($value['Valeur']['valeur'])
],
'fields' => [
'id',
'libelle',
'description'
]
]);
foreach ($baseLegales as $key => $val) {
$donnees[$value['Valeur']['champ_name']][$key]['valeur_' . $value['Valeur']['champ_name']] = [
'value' => $val['Baselegale']['libelle'],
'type' => 'text'
];
$donnees[$value['Valeur']['champ_name'].'description'][$key]['valeur_' . $value['Valeur']['champ_name'].'description'] = [
'value' => $val['Baselegale']['description'],
'type' => 'text'
];
}
}
} else {
$donnees['valeur_' . $value['Valeur']['champ_name']] = [
'value' => $value['Valeur']['valeur'],
......
......@@ -127,11 +127,6 @@ class WebdpoFiche extends AppModel {
]
],
// ---------------------------------------------------------------------
'decisionAutomatisee' => [
'notBlank' => [
'rule' => ['notBlank']
]
],
'descriptionDecisionAutomatisee' => [
'checkNotBlankIf' => [
'rule' => ['checkNotBlankIf', 'decisionAutomatisee', true, ['1']]
......
<?php
$key = null;
$empty = true;
$idSousFinalite = null;
$afterSousFinalite = '<a href="#" class="removeclass"><span class="fa fa-trash fa-lg fa-danger"><!----></span></a></div>';
$viewBtnAddSousFinalite = true;
if ($this->request->params['action'] === 'edit') {
$empty = false;
}
if ($this->request->params['action'] === 'show') {
$afterSousFinalite = '</div>';
$viewBtnAddSousFinalite = false;
......@@ -35,9 +30,10 @@ if ($this->request->params['action'] === 'show') {
<?php
if (isset($this->request->data['Fiche']['sousFinalite'])) {
foreach ($this->request->data['Fiche']['sousFinalite'] as $key => $sousFinalite) {
$label = 'Sous finalité ' . ($key+1);
echo $this->WebcilForm->input('sousFinalite_'.$key, [
'id' => 'sousFinalite_'.$key,
$idSousFinalite = $key + 1 ;
$label = 'Sous finalité ' . $idSousFinalite;
echo $this->WebcilForm->input('sousFinalite_'.$idSousFinalite, [
'id' => 'sousFinalite_'.$idSousFinalite,
'value' => $sousFinalite,
'name' => 'data[Fiche][sousFinalite][]',
'label' => [
......@@ -55,7 +51,8 @@ if ($this->request->params['action'] === 'show') {
if ($viewBtnAddSousFinalite === true) {
?>
<div id="AddMoreFileId">
<a href="#" id="AddMoreFileBox" class="btn btn-info">Ajouter une sous-finalité</a><br><br>
<a id="AddMoreFileBox" class="btn btn-info">Ajouter une sous-finalité</a>
<br><br>
</div>
<?php
}
......@@ -82,13 +79,16 @@ if ($this->request->params['action'] === 'show') {
],
'decisionAutomatisee' => [
'id' => 'decisionAutomatisee',
// 'options' => [
// true => 'Oui',
// false => 'Non'
// ],
'options' => [
true => 'Oui',
false => 'Non'
'Oui' => 'Oui',
'Non' => 'Non'
],
'class' => 'transformSelect form-control',
'empty' => $empty,
'required' => true,
'empty' => true,
'placeholder' => false,
'data-placeholder' => ' '
]
......@@ -124,46 +124,42 @@ if ($this->request->params['action'] === 'show') {
$(document).ready(function() {
var actionForm = <?php echo json_encode($this->request->params['action']);?>;
var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID
var AddButton = $("#AddMoreFileBox"); //Add button ID
var FieldCount = 0; //to keep track of text box added
var idField = 0; //to keep track of text box added
var idField = 1; // to keep track of text box added
if (actionForm === 'edit') {
var key = <?php echo json_encode($key); ?>;
FieldCount = key+1;
var key = <?php echo json_encode($idSousFinalite); ?>;
idField = key;
}
//on add input button click
$(AddButton).click(function (e) {
FieldCount++; //text box added ncrement
$('#AddMoreFileBox').click(function (e) {
//add input box
$(InputsWrapper).append('<div class="form-group"><label for="sousfinalite" class="col-md-4 control-label">Sous finalité '+FieldCount+'</label><div class="col-md-8"><input name="data[Fiche][sousFinalite][]" id="sousFinalite_'+ idField +'" class="form-control" type="text"><a href="#" class="removeclass"><span class="fa fa-trash fa-lg fa-danger"><!----></span></a></div></div>');
$("#AddMoreFileId").show();
$('AddMoreFileBox').html("Add field");
$('#InputsWrapper').append('<div class="form-group"><label for="sousfinalite" class="col-md-4 control-label">Sous finalité '+idField+'</label><div class="col-md-8"><input name="data[Fiche][sousFinalite][]" id="sousFinalite_'+ idField +'" class="form-control" type="text"><a href="#" class="removeclass"><span class="fa fa-trash fa-lg fa-danger"><!----></span></a></div></div>');
idField++;
});
$("body").on("click",".removeclass", function(e){ //user click on remove text
//user click on remove text
$("body").on("click",".removeclass", function(e) {
var idInputDelete = $(this).siblings().first().attr('id');
var intIdInputDelete = parseInt(idInputDelete.substr(idInputDelete.indexOf("_") + 1));
var i = intIdInputDelete + 1;
$(this).parent('div').parent('div').remove(); //remove text box
$("#AddMoreFileId").show();
while (i <= idField) {
var newValue = (i - 1);
$("#lineBreak").html("");
$('#sousFinalite_'+i).parent('div').siblings().first().text('Sous finalité '+ newValue);
$('#sousFinalite_'+i).attr('id', 'sousFinalite_'+newValue);
// Adds the "add" link again when a field is removed.
$('AddMoreFileBox').html("Add field");
})
i++;
}
idField--;
})
// Partie concernant les champs sur la decision automatisee
displayDescriptionDecisionAutomatisee($('#decisionAutomatisee').val());
var descriptionsBaseLegale = <?php echo json_encode($descriptions_baseLegale); ?>;
......@@ -173,11 +169,10 @@ if ($this->request->params['action'] === 'show') {
displayDescriptionDecisionAutomatisee(select);
});
});
function displayDescriptionDecisionAutomatisee(val){
if (val == true) {
if (val == 'Oui') {
$('#descriptionDecisionAutomatisee').parent().parent().show();
} else {
$('#descriptionDecisionAutomatisee').parent().parent().hide();
......
......@@ -25,7 +25,7 @@ echo $this->WebcilForm->create('Fiche', [
<li>
<a href="#information_complementaire" role="tab" data-toggle="tab">
<i class="fa fa-pencil fa-fw"><!----></i>
<i class="fa fa-eye fa-fw"><!----></i>
<?php
echo __d('fiche', 'fiche.ongletInformationComplementaire');
?>
......
......@@ -390,6 +390,173 @@ if (!empty($valeurPropreTraitement['soustraitant'])) {
}
?>
<!-- Tableau des variables du formulaire -->
<table class="table">
<h4>
<?php
echo __d('modele', 'modele.sousTitreVariableInformationComplementaireTraitement');
?>
</h4>
<thead>
<tr>
<th class="thleft col-md-5">
<?php
echo __d('modele', 'modele.titreTableauNomChamp');
?>
</th>
<th class="thleft col-md-2">
<?php
echo "Section";
?>
</th>
<th class="thleft col-md-3">
<?php
echo __d('modele', 'modele.titreTableauNomVariable');
?>
</th>
<th class="thleft col-md-5">
<?php
echo __d('modele', 'modele.titreTableauType');
?>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tdleft">
<?php
echo 'Sous finalité';
?>
</td>
<td class="tdleft">
<?php
echo "sousFinalite";
?>
</td>
<td class="tdleft">
<?php
echo "valeur_sousFinalite";
?>
</td>
<td class="tdleft">
<?php
echo __d('modele', 'modele.textPetitChamp');
?>
</td>
</tr>
<tr>
<td class="tdleft">
<?php
echo 'Base légale';
?>
</td>
<td class="tdleft">
<?php
echo "baselegale";
?>
</td>
<td class="tdleft">
<?php
echo "valeur_baselegale";
?>
</td>
<td class="tdleft">
<?php
echo __d('modele', 'modele.textCheckboxChamp');
?>
</td>
</tr>
<tr>
<td class="tdleft">
<?php
echo 'Description de la base légale';
?>
</td>
<td class="tdleft">
<?php
echo "baselegaledescription";
?>
</td>
<td class="tdleft">
<?php
echo "valeur_baselegaledescription";
?>
</td>
<td class="tdleft">
<?php
echo __d('modele', 'modele.textGrandChamp');
?>
</td>
</tr>
<tr>
<td class="tdleft">
<?php
echo 'Prise de décision automatisé sur le traitement';
?>
</td>
<td class="tdleft">
<?php
echo "";
?>
</td>
<td class="tdleft">
<?php
echo "valeur_decisionAutomatisee";
?>
</td>
<td class="tdleft">
<?php
echo __d('modele', 'modele.textDeroulantChamp');
?>
</td>
</tr>
<tr>
<td class="tdleft">
<?php
echo 'Description de la prise de décision automatique';
?>
</td>
<td class="tdleft">
<?php
echo "";
?>
</td>
<td class="tdleft">
<?php
echo "valeur_descriptionDecisionAutomatisee";
?>
</td>
<td class="tdleft">
<?php
echo __d('modele', 'modele.textGrandChamp');
?>
</td>
</tr>
</tbody>
</table>
<br>
<?php
if (!empty($variables)) {
?>
......
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