Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

differenciate comment visible in resume and report #1022

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion geocity/apps/submissions/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1836,6 +1836,7 @@ def __init__(self, user, submission, *args, **kwargs):
user, submission
):
self.fields["comment_is_visible_by_author"].disabled = True
self.fields["comment_is_visible_in_reports"].disabled = True

self.fields["validation_status"].choices = [
(
Expand All @@ -1851,11 +1852,13 @@ class Meta:
"validation_status",
"comment",
"comment_is_visible_by_author",
"comment_is_visible_in_reports",
]
widgets = {
"validation_status": forms.RadioSelect(),
"comment": forms.Textarea(attrs={"rows": 3}),
"comment_is_visible_by_author": forms.CheckboxInput(),
"comment_is_visible_in_reports": forms.CheckboxInput(),
}


Expand Down Expand Up @@ -2386,7 +2389,12 @@ def get_submission_forms(submission):
class SubmissionValidationsForm(forms.ModelForm):
class Meta:
model = models.SubmissionValidation
fields = ["department", "comment", "comment_is_visible_by_author"]
fields = [
"department",
"comment",
"comment_is_visible_by_author",
"comment_is_visible_in_reports",
]

def __init__(self, *args, **kwargs):
super(SubmissionValidationsForm, self).__init__(*args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated by Django 4.2.11 on 2024-06-05 12:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("submissions", "0030_alter_servicefeetype_fix_price_editable"),
]

operations = [
migrations.AddField(
model_name="historicalsubmissionvalidation",
name="comment_is_visible_in_reports",
field=models.BooleanField(
default=True,
verbose_name="Commentaire visible dans le modèle d'impression",
),
),
migrations.AddField(
model_name="submissionvalidation",
name="comment_is_visible_in_reports",
field=models.BooleanField(
default=True,
verbose_name="Commentaire visible dans le modèle d'impression",
),
),
migrations.AlterField(
model_name="historicalsubmissionvalidation",
name="comment_is_visible_by_author",
field=models.BooleanField(
default=False,
verbose_name="Commentaire visible dans le résumé pour l'auteur de la demande",
),
),
migrations.AlterField(
model_name="submissionvalidation",
name="comment_is_visible_by_author",
field=models.BooleanField(
default=False,
verbose_name="Commentaire visible dans le résumé pour l'auteur de la demande",
),
),
]
6 changes: 5 additions & 1 deletion geocity/apps/submissions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2046,7 +2046,11 @@ class SubmissionValidation(models.Model):
blank=True,
)
comment_is_visible_by_author = models.BooleanField(
_("Commentaire visible par l'auteur de la demande"), default=True
_("Commentaire visible dans le résumé pour l'auteur de la demande"),
default=False,
)
comment_is_visible_in_reports = models.BooleanField(
_("Commentaire visible dans le modèle d'impression"), default=True
)
validated_by = models.ForeignKey(
User, verbose_name=_("Validé par"), null=True, on_delete=models.SET_NULL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,24 @@ <h2>{% translate "Validation" %}</h2>
{% if validation.comment_is_visible_by_author or current_user != submission.author %}
<dt>{% translate "Commentaire" %}:</dt> <dd> {{ validation.comment|linebreaksbr }} </dd>
{% if current_user != submission.author %}
<dt>{% translate "Commentaire visible par l'auteur de la demande" %}:</dt>
{% comment %} résumé {% endcomment %}
<dt>{% translate "Visible dans le résumé pour l'auteur de la demande" %}:</dt>
<dd>
{% if validation.comment_is_visible_by_author %}
<i class="fa fa-check-circle" aria-hidden="true"></i>
{% else %}
<i class="fa fa-times-circle" aria-hidden="true"></i>
{% endif %}
</dd>
{% comment %} modèle d'impression {% endcomment %}
<dt>{% translate "Visible dans le modèle d'impression" %}:</dt>
<dd>
{% if validation.comment_is_visible_in_reports %}
<i class="fa fa-check-circle" aria-hidden="true"></i>
{% else %}
<i class="fa fa-times-circle" aria-hidden="true"></i>
{% endif %}
</dd>
{% endif %}
{% endif %}
{% endif %}
Expand Down
Loading