Commit 4453e64e authored by Théo GUILLON's avatar Théo GUILLON
Browse files

Correction : warning sur les boutons de création de champ

Suppression : ancienne modale pour les conditions
Modification : factorisation lors de la vérification et l'attribution des valeurs au champ selectionné.
parent f2b6ab3b
......@@ -7,61 +7,61 @@ $typeCreateForm = isset($typeCreateForm) === true ? $typeCreateForm : '';
<div class="col-md-12" id="forScroll" style="padding: 0;">
<div class="btn-group-<?php echo $typeCreateForm;?>" role="group">
<!-- Bouton Petit champ texte -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-small-text-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-small-text-<?php echo $typeCreateForm;?>">
<i class="fa fa-font fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnPetitChamp');?>
</button>
<!-- Bouton Grand champ texte -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-long-text-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-long-text-<?php echo $typeCreateForm;?>">
<i class="fa fa-text-height fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnGrandChamp');?>
</button>
<!-- Bouton Champ date -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-date-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-date-<?php echo $typeCreateForm;?>">
<i class="fa fa-calendar fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnChampDate');?>
</button>
<!-- Bouton Cases à cocher -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-checkbox-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-checkbox-<?php echo $typeCreateForm;?>">
<i class="fa fa-check-square-o fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnCheckbox');?>
</button>
<!-- Bouton Choix unique -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-radio-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-radio-<?php echo $typeCreateForm;?>">
<i class="fa fa-dot-circle-o fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnRadio');?>
</button>
<!-- Bouton Menu deroulant -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-deroulant-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-deroulant-<?php echo $typeCreateForm;?>">
<i class="fa fa-list-alt fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnDeroulant');?>
</button>
<!-- Bouton Menu multi-select-->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-multi-select-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-multi-select-<?php echo $typeCreateForm;?>">
<i class="fa fa-list-alt fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnMultiSelect');?>
</button>
<!-- Bouton Titre de catégorie -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-title-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-title-<?php echo $typeCreateForm;?>">
<i class="fa fa-tag fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnTitreCategorie');?>
</button>
<!-- Bouton Champ d'information -->
<button type="button" type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-help-<?php echo $typeCreateForm;?>"">
<button type="button" type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-help-<?php echo $typeCreateForm;?>">
<i class="fa fa-info-circle fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnChampInfo');?>
</button>
<!-- Bouton Label -->
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-texte-<?php echo $typeCreateForm;?>"">
<button type="button" class="btn btn-default-default btn-sm btn-input-<?php echo $typeCreateForm;?>" id="btn-texte-<?php echo $typeCreateForm;?>">
<i class="fa fa-pencil fa-lg fa-fw"></i>
<?php echo __d ('formulaire','formulaire.btnLabel');?>
</button>
......
<!-- Pop-up de création de création de formulaire -->
<div class="modal fade" id="modalAddCondtion" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<?php
echo "Ajouter une condition sur le champ";
?>
</h4>
</div>
<div class="modal-body">
<?php
echo $this->WebcilForm->create('modalConditions', [
'url' => '#'
]);
?>
<div class="row form-group">
<?php
echo $this->WebcilForm->input('ifTheField', [
'placeholder' => false,
'required' => true
]);
?>
</div>
<div class="row form-group">
<?php
echo $this->WebcilForm->input('hasAsValue', [
'options' => [],
'empty' => true,
'class' => 'transformSelect form-control',
'placeholder' => false,
'required' => true,
'data-placeholder' => ' '
]);
?>
</div>
<div class="row form-group">
<?php
echo $this->WebcilForm->input('thenTheField', [
'options' => [],
'empty' => true,
'class' => 'transformSelect form-control',
'placeholder' => false,
'required' => true,
'data-placeholder' => ' '
]);
?>
</div>
<div class="row form-group">
<?php
echo $this->WebcilForm->input('mustBe', [
'options' => [
'show' => "afficher",
'hide' => "cacher"
],
'empty' => true,
'class' => 'transformSelect form-control',
'placeholder' => false,
'required' => true,
'data-placeholder' => ' '
]);
?>
</div>
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-default-default" data-dismiss="modal">
<i class="fa fa-times-circle fa-lg"><!----></i>
<?php echo __d('default', 'default.btnAnnuler'); ?>
</button>
<?php
echo $this->Form->button("<i class='fa fa-floppy-o fa-lg'><!----></i>" . __d('default', 'default.btnEnregistrer'), [
// 'type' => 'submit',
'class' => 'btn btn-default-success',
'escape' => false
]);
?>
</div>
<?php
echo $this->Form->end();
?>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -50,7 +50,7 @@
'value' => __d('default', 'default.valueChampRemplissageAuto')
],
'Fiche.declarantpersonnefix' => [
'id' => 'declarantpersonneportable',
'id' => 'declarantpersonnefix',
'readonly' => true,
'placeholder' => false,
'value' => __d('default', 'default.valueChampRemplissageAuto')
......
......@@ -147,7 +147,6 @@ echo $this->WebcilForm->create('Formulaire', [
</div>
<?php
//echo $this->element('Formulaires/modal/modalAddConditionOLD');
echo $this->element('Formulaires/modal/modalAddCondition');
echo $this->WebcilForm->end();
......@@ -165,7 +164,7 @@ echo $this->WebcilForm->end();
// Mise en évidence des onglets ayant des erreurs.
$("div.form-group .error-message").closest("div.tab-pane").each(function(idx, pane) {
$( "a[href='#"+$(pane).attr('id')+"']" ).append("<span class='fa fa-exclamation-circle fa-danger' aria-hidden='true'><!----></span>");
$( "a[href='#"+$(pane).attr('id')+"']" ).append("<span class='fa fa-exclamation-circle fa-danger' aria-hidden='true'/>");
});
});
......
......@@ -796,12 +796,8 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs aux champs "Petit champ texte" et "Champ date"
if ($(this).is('.small-text, .date')) {
// give to field the "name"
$(idContainer).find('.ui-selected').find('select').attr('id', newNameField);
$(idContainer).find('.ui-selected').find('input').attr('name', newNameField);
// give to field the "label"
$(idContainer).find('.ui-selected').find('label').html('<span class="labeler">' + newLabelField + '</span>');
// give to field the "placeholder"
$(idContainer).find('.ui-selected').find('input').attr('placeholder', newPlaceholderField);
......@@ -822,14 +818,17 @@ var createForm = function(typeCreateForm) {
// Attribution les valeurs au champ "Grand champ texte"
if ($(this).hasClass('long-text')) {
// give to field the "name"
$(idContainer).find('.ui-selected').find('select').attr('id', newNameField);
$(idContainer).find('.ui-selected').find('textarea').attr('name', newNameField);
// give to field the "placeholder"
$(idContainer).find('.ui-selected').find('textarea').attr('placeholder', newPlaceholderField);
}
if ($(this).is('.small-text, .date, .long-text')) {
// give to field the "label"
$(idContainer).find('.ui-selected').find('label').html('<span class="labeler">' + newLabelField + '</span>');
// give to field the "placeholder"
$(idContainer).find('.ui-selected').find('textarea').attr('placeholder', newPlaceholderField);
$(idContainer).find('.ui-selected').find('select').attr('id', newNameField);
}
// Attribution les valeurs au champ "Cases à cocher"
......
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