Commit bff6664a authored by THEO GUILLON's avatar THEO GUILLON
Browse files

Merge branch...

Merge branch '96-ajouter-la-possibiliter-de-rajouter-plusieurs-sous-traitants-lors-de-la-declaration-d-un' into '1.2.0'

Resolve "Ajouter la possibiliter de rajouter plusieurs sous-traitants lors de la déclaration d'un traitement"

Closes #96

See merge request web-DPO/web-DPO!300
parents 0f798728 75c3b84f
......@@ -583,9 +583,9 @@ class FormulairesController extends AppController {
}
}
if ($this->request->params['action'] === 'edit') {
// if ($this->request->params['action'] === 'edit') {
$this->getFields($id);
}
// }
$this->view = 'edit';
}
......@@ -671,7 +671,7 @@ class FormulairesController extends AppController {
];
if (empty($this->request->data)) {
if ($formulaireOLD === false) {
if ($formulaireOLD === false && $this->request->params['action'] == 'edit') {
$this->request->data = $this->Formulaire->find('first', [
'conditions' => [
'id' => $formulaire_id
......@@ -702,6 +702,44 @@ class FormulairesController extends AppController {
}
}
// valeur par défault
if ($this->request->params['action'] == 'add' && empty($this->request->data)) {
$fields['coresponsable'] = [
[
'Champ' => [
'type' => 'input',
'ligne' => 1,
'colonne' => 1,
'details' => '{"name":"nom_responsable_conjoint","placeholder":"Nom et prénom","label":"Nom et prénom du responsable conjoint","default":"","obligatoire":true,"repeat":false}'
]
],
[
'Champ' => [
'type' => 'input',
'ligne' => 3,
'colonne' => 1,
'details' => '{"name":"structure_responsable_conjointe","placeholder":"Raison sociale","label":"Raison sociale de la structure conjointe","default":"","obligatoire":true,"repeat":false}'
]
],
[
'Champ' => [
'type' => 'input',
'ligne' => 1,
'colonne' => 2,
'details' => '{"name":"email_responsable_conjoint","placeholder":"Adresse e-mail","label":"Adresse mail du responsable conjoint","default":"","obligatoire":true,"repeat":false}'
]
],
[
'Champ' => [
'type' => 'textarea',
'ligne' => 3,
'colonne' => 2,
'details' => '{"name":"adresse_structure_responsable_conjointe","placeholder":"Adresse postale","label":"Adresse de la structure conjointe","default":"","obligatoire":false,"repeat":false}'
]
]
];
}
$this->set(compact('fields'));
}
......
......@@ -311,17 +311,19 @@ if (in_array($this->request->params['action'], ['edit', 'show']) === true) {
<?php
if ($formulaireOLD['Formulaire']['oldformulaire'] === false) {
?>
<div class="col-md-12">
<span class='labelFormulaire'>
<?php
echo __d('fiche', 'fiche.textInfoPia');
?>
</span>
<div class="row row35"></div>
</div>
<?php
if (isset($usePIA) && $usePIA['Formulaire']['usepia'] === true) {
?>
<div class="col-md-12">
<span class='labelFormulaire'>
<?php
echo __d('fiche', 'fiche.textInfoPia');
?>
</span>
<div class="row row35"></div>
</div>
<div class="row">
<div class="col-md-6">
<?php
......
......@@ -19,15 +19,21 @@ foreach ($champs as $key => $value) {
// Champ obligatoire ou non
if ($details['obligatoire'] == true) {
$champObligatoire = "checked";
$champObligatoire = "fieldRequired";
} else {
$champObligatoire = "unchecked";
$champObligatoire = "fieldNotRequired";
}
if ($details['repeat'] == true) {
$fieldRepeat = "fieldRepeat";
} else {
$fieldRepeat = "fieldNoRepeat";
}
switch ($value['Champ']['type']) {
// Petit champ texte
case 'input':
echo '<div class="draggable form-group col-md-6 small-text" style="top:' . $line . 'px; ' . $colonne . '" data="' . $champObligatoire . '">'
echo '<div class="draggable form-group col-md-6 small-text" style="top:' . $line . 'px; ' . $colonne . '" virtual-data-required="'.$champObligatoire.'" virtual-data-repeat="'.$fieldRepeat.'">'
. '<div class="col-md-4">'
. '<label>'
. '<span class="labeler">' . $details['label'] . '</span>'
......@@ -42,7 +48,7 @@ foreach ($champs as $key => $value) {
// Grand champ texte
case 'textarea':
echo '<div class="draggable form-group col-md-6 long-text" style="top:' . $line . 'px; ' . $colonne . '" data="' . $champObligatoire . '">'
echo '<div class="draggable form-group col-md-6 long-text" style="top:' . $line . 'px; ' . $colonne . '" virtual-data-required="'.$champObligatoire.'" virtual-data-repeat="'.$fieldRepeat.'">'
. '<div class="col-md-4">'
. '<label>'
. '<span class="labeler">' . $details['label'] . '</span>'
......@@ -57,7 +63,7 @@ foreach ($champs as $key => $value) {
// Champ date
case 'date':
echo '<div class="draggable form-group col-md-6 date" style="top:' . $line . 'px; ' . $colonne . '" data="' . $champObligatoire . '">'
echo '<div class="draggable form-group col-md-6 date" style="top:' . $line . 'px; ' . $colonne . '" virtual-data-required="'.$champObligatoire.'" virtual-data-repeat="'.$fieldRepeat.'">'
. '<div class="col-md-4">'
. '<label>'
. '<span class="labeler">' . $details['label'] . '</span>'
......@@ -118,7 +124,7 @@ foreach ($champs as $key => $value) {
// Choix unique
case 'radios':
echo '<div class="draggable form-group col-md-6 radios" style="top:' . $line . 'px; ' . $colonne . '" data="' . $champObligatoire . '">'
echo '<div class="draggable form-group col-md-6 radios" style="top:' . $line . 'px; ' . $colonne . '" virtual-data-required="'.$champObligatoire.'" virtual-data-repeat="'.$fieldRepeat.'">'
. '<div class="col-md-4">'
. '<label>'
. '<span class="labeler">' . $details['label'] . '</span>'
......@@ -141,7 +147,7 @@ foreach ($champs as $key => $value) {
// Menu déroulant
case 'deroulant':
echo '<div class="draggable form-group col-md-6 deroulant" style="top:' . $line . 'px; ' . $colonne . '" data="' . $champObligatoire . '">'
echo '<div class="draggable form-group col-md-6 deroulant" style="top:' . $line . 'px; ' . $colonne . '" virtual-data-required="'.$champObligatoire.'" virtual-data-repeat="'.$fieldRepeat.'">'
. '<div class="col-md-4">'
. '<label>'
. '<span class="labeler">' . $details['label'] . '</span>'
......
......@@ -18,14 +18,14 @@
<!-- Corps du formulaire -->
<div id="form-container-coresponsable" class="form-container col-md-12">
<?php
if ($this->request->params['action'] == 'edit' && !empty($fields['coresponsable'])) {
// if ($this->request->params['action'] == 'edit' && !empty($fields['coresponsable'])) {
if (!empty($fields['coresponsable'])) {
echo $this->element('Formulaires/champDuFormulaire', [
'champs' => $fields['coresponsable']
]);
}
?>
</div>
</div>
<script type="text/javascript">
......
......@@ -24,10 +24,6 @@
}
?>
</div>
<?php
// echo $this->WebcilForm->hidden('json', ['id' => 'hiddenForm']);
?>
</div>
<!-- Fin onglet Formulaire -->
......
<?php
$empty = false;
if ($this->request->params['action'] == 'add'){
$empty = true;
} else {
$empty = false;
};
}
?>
<!-- Onglet Information complémentaire -->
......
......@@ -26,7 +26,6 @@
}
?>
</div>
</div>
<script type="text/javascript">
......
......@@ -52,7 +52,7 @@ echo $this->WebcilForm->create('Fiche', [
$classActiveInfoGenerale = 'active';
$classActivePia = '';
if ($this->request->params['action'] === 'add' ) {
if ($this->request->params['action'] === 'add' && $usePIA['Formulaire']['usepia'] === true) {
$classActiveInfoGenerale = '';
$classActivePia = 'active';
}
......
$(document).ready(function () {
$('#container').on('submit', function(){
$('#container').on('submit', function() {
var success = true,
retour = [];
......@@ -15,8 +15,9 @@ $(document).ready(function () {
var contenu = {};
contenu['onglet'] = droppableId;
contenu['ligne'] = $(draggable).position().top / 35 + 1;
contenu['ligne'] = Math.round($(draggable).position().top / 35 + 1);
// @TODO
if ($(this).position().left < 10) {
contenu['colonne'] = 1;
} else {
......@@ -153,12 +154,18 @@ $(document).ready(function () {
contenu['default'] = valuesMultiSelectDefault;
}
if ($(draggable).attr('data') === 'checked') {
if ($(draggable).attr('virtual-data-required') === 'fieldRequired') {
contenu['obligatoire'] = true;
} else {
contenu['obligatoire'] = false;
}
if ($(draggable).attr('virtual-data-repeat') === 'fieldRepeat') {
contenu['repeat'] = true;
} else {
contenu['repeat'] = false;
}
retour.push(contenu);
});
});
......
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