Skip to content

Commit

Permalink
#1775 [PublicAnswer] add: rework IHM
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Jul 23, 2024
1 parent 444ed78 commit 0893c7d
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 19 deletions.
27 changes: 13 additions & 14 deletions core/tpl/digiquali_answers.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@
<div class="table-row">
<!-- Contenu et commentaire -->
<div class="table-cell table-full">
<div class="label"><strong><?php print $question->getNomUrl(1, isset($publicInterface) ? 'nolink' : '', 1, '', -1, 1); ?></strong></div>
<div class="description"><?php print $question->description; ?></div>
<?php if (!isset($publicInterface)) : ?>
<div class="label"><strong><?php print $question->getNomUrl(1, '', 1, '', -1, 1); ?></strong></div>
<?php else : ?>
<div class="label"><strong><?php print $question->label; ?></strong></div>
<?php endif; ?>
<div class="question-comment-container">
<div class="question-ref">
<?php
if (!empty($objectLine->ref) ) {
print '<span class="question-ref-title">' . $objectLine->ref . '</span> :';
if (!empty($objectLine->ref && !isset($publicInterface)) ) {
print '<span class="question-ref-title">' . $objectLine->ref . '</span> :';
} ?>
</div>
<?php if ($question->type == 'Text') : ?>
Expand All @@ -74,14 +78,12 @@
<?php endif; ?>
</div>
</div>
<!-- Photo OK KO -->
<?php if ($question->show_photo > 0) : ?>
<?php if ($question->show_photo > 0 && getDolGlobalInt('DIGIQUALI_' . dol_strtoupper($object->element) . '_DISPLAY_MEDIAS')) : ?>
<!-- Photo OK KO -->
<div class="table-cell table-450 cell-photo-check wpeo-table">
<?php
if (getDolGlobalInt('DIGIQUALI_' . dol_strtoupper($object->element) . '_DISPLAY_MEDIAS')) :
print saturne_show_medias_linked('digiquali', $conf->digiquali->multidir_output[$conf->entity] . '/question/'. $question->ref . '/photo_ok', 'small', '', 0, 0, 0, 200, 200, 0, 0, 0, 'question/' . $question->ref . '/photo_ok', $question, 'photo_ok', 0, 0, 0,1, 'photo-ok', 0);
print saturne_show_medias_linked('digiquali', $conf->digiquali->multidir_output[$conf->entity] . '/question/'. $question->ref . '/photo_ko', 'small', '', 0, 0, 0, 200, 200, 0, 0, 0, 'question/' . $question->ref . '/photo_ko', $question, 'photo_ko', 0, 0, 0,1, 'photo-ko', 0);
endif;
?>
</div>
<?php endif; ?>
Expand Down Expand Up @@ -152,14 +154,11 @@
} ?>
</div>
<?php elseif ($question->type == 'Percentage') : ?>
<div class="table-cell table-end answer-cell table-flex <?php echo ($object->status > 0) ? 'style="pointer-events: none"' : '' ?>" data-questionId="<?php echo $question->id; ?>">
<div class="table-cell answer-cell table-flex table-full percentage-cell <?php echo ($object->status > 0) ? 'style="pointer-events: none"' : '' ?>" data-questionId="<?php echo $question->id; ?>">
<?php
print '<span class="table-cell" value="">';
print $langs->transnoentities('Answer') . ' : ';
print '</span>';
print '<span class="table-cell" value="">';
print '<input' . ($object->status > $object::STATUS_DRAFT ? ' disabled' : '') . ' name="answer' . $question->id . '" id="answer' . $question->id . '" type="number" min="0" max="100" class="input-answer ' . ($object->status > 0 ? 'disable' : '') . ' ' . ($questionAnswer == $answerLinked->position ? 'active' : '') . '" value="' . $questionAnswer . '"> %';
print '</span>';
print img_picto('', 'fontawesome_fa-frown-open_fas_#D53C3D_2em', 'class="range-image"');
print '<input type="range" class="search_component_input range input-answer ' . ($object->status > 0 ? 'disable' : '') . ' ' . ($questionAnswer == $answerLinked->position ? 'active' : '') . '" name="answer' . $question->id . '" id="answer' . $question->id . '" min="0" max="100" step="25" value="' . $questionAnswer . '"' . ($object->status > $object::STATUS_DRAFT ? ' disabled' : '') . '>';
print img_picto('', 'fontawesome_fa-grin_fas_#57AD39_2em', 'class="range-image"');
?>
</div>
<?php elseif ($question->type == 'Range') : ?>
Expand Down
2 changes: 1 addition & 1 deletion css/digiquali.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions css/scss/page/_control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
margin-top: 0 !important;
}
> .wpeo-table {
border-bottom: 1px solid rgba(0,0,0,0.2);
//border-bottom: 1px solid rgba(0,0,0,0.2);

&:nth-of-type(odd) {
//background: rgba(0,0,0,0.1);
//background: rgba(155,117,166,0.3);
background: rgba(38,60,92,0.15);
//background: rgba(38,60,92,0.15);
}

.cell-photo-check {
Expand Down
1 change: 1 addition & 0 deletions css/scss/page/_page.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "control";
@import "element-medias";
@import "question-add";
@import "question-answer";
67 changes: 67 additions & 0 deletions css/scss/page/_question-answer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.question-answer-container {
.description {
text-align: center;
color: #4B4F5A;
font-size: 24px;
margin-top: 20px;
}

.label {
text-align: center;
color: #002475;
font-size: 32px;
margin: 20px 0 20px 0;
}

.table-cell.percentage-cell {
margin-bottom: 3em;
}

.percentage-cell {
display: flex;
justify-content: space-around;
align-items: center;
}

input[type=range] {
-webkit-appearance: none;
appearance: none;
padding: 0;
width: 50%;
cursor: pointer;
background-color: transparent;
border: 0;
}

input[type=range]::-webkit-slider-thumb {
appearance: none;
width: 4em;
height: 4em;
border: solid #F5F5F5;
border-radius: 50%;
background: #FFF;
position: relative;
bottom: 15px;
}
input[type=range]::-webkit-slider-runnable-track {
border-radius: 50px;
height: 30px;
background: linear-gradient(90deg, #D53C3D 0%, #ED911D 25%, #F2C32E 50%, #92D444 75%, #57AD39 100%);
}

input[type=range]::-moz-range-thumb {
appearance: none;
width: 4em;
height: 4em;
border: solid #F5F5F5;
border-radius: 50%;
background: #FFF;
position: relative;
bottom: 15px;
}
input[type=range]::-moz-range-track {
border-radius: 50px;
height: 30px;
background: linear-gradient(90deg, #D53C3D 0%, #ED911D 25%, #F2C32E 50%, #92D444 75%, #57AD39 100%);
}
}
6 changes: 4 additions & 2 deletions public/public_answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@
$substitutionArray = getCommonSubstitutionArray($langs, 0, null, $object);
complete_substitutions_array($substitutionArray, $langs, $object);
$answerPublicInterfaceTitle = make_substitutions($langs->transnoentities($conf->global->DIGIQUALI_ANSWER_PUBLIC_INTERFACE_TITLE), $substitutionArray);
print '<h2 class="center">' . (dol_strlen($answerPublicInterfaceTitle) > 0 ? $answerPublicInterfaceTitle : $langs->transnoentities('AnswerPublicInterface')) . '</h2>';
print '<br>';
//print '<h2 class="center">' . (dol_strlen($answerPublicInterfaceTitle) > 0 ? $answerPublicInterfaceTitle : $langs->transnoentities('AnswerPublicInterface')) . '</h2>';
//print '<br>';
$publicInterface = true;
$sheet->fetchObjectLinked($object->fk_sheet, 'digiquali_' . $sheet->element, null, '', 'OR', 1, 'position');
require_once __DIR__ . '/../core/tpl/digiquali_answers.tpl.php';
Expand All @@ -179,6 +179,8 @@
print '</div>';
}
print '</div>';
print '<button type="submit" class="wpeo-button button-square-50 button-rounded save-public-answer"><i class="fas fa-chevron-left"></i></button>';
print '<button type="submit" class="wpeo-button button-square-50 button-rounded save-public-answer"><i class="fas fa-chevron-right"></i></button>';
print '</form>';

llxFooter('', 'public');
Expand Down

0 comments on commit 0893c7d

Please sign in to comment.