From 0902f3244d6b1a288fb011dc0a7db03620bc16b7 Mon Sep 17 00:00:00 2001 From: Tudor Amariei Date: Thu, 30 Jan 2025 10:54:36 +0200 Subject: [PATCH] fix the ngo presentation form --- backend/donations/forms/ngo_account.py | 48 +++ backend/donations/views/api.py | 24 ++ backend/donations/views/ngo_account.py | 80 +++-- backend/locale/en/LC_MESSAGES/django.po | 302 +++++++++++------- backend/locale/ro/LC_MESSAGES/django.po | 281 +++++++++------- .../redirectioneaza/settings/app_configs.py | 2 + .../templates/v2/components/input/input.html | 37 +-- .../v2/ngo-account/archives/main.html | 2 +- .../ngo-account/my-organization/ngo-form.html | 8 +- .../my-organization/ngo-presentation.html | 28 +- 10 files changed, 502 insertions(+), 310 deletions(-) create mode 100644 backend/donations/forms/ngo_account.py diff --git a/backend/donations/forms/ngo_account.py b/backend/donations/forms/ngo_account.py new file mode 100644 index 00000000..6b6d582c --- /dev/null +++ b/backend/donations/forms/ngo_account.py @@ -0,0 +1,48 @@ +from django import forms +from django.conf import settings +from django.utils.translation import gettext_lazy as _ +from localflavor.generic.forms import IBANFormField +from localflavor.ro.forms import ROCIFField + + +class NgoPresentationForm(forms.Form): + is_accepting_forms = forms.BooleanField(label=_("Is accepting forms"), required=False) + + name = forms.CharField(label=_("Name"), max_length=255, required=True) + cif = ROCIFField(label=_("CUI/CIF"), required=True) + logo = forms.ImageField(label=_("Logo"), required=False) + website = forms.URLField(label=_("Website"), required=False) + + contact_email = forms.EmailField(label=_("Contact email"), required=True) + display_email = forms.BooleanField(label=_("Display email"), required=False) + + contact_phone = forms.CharField(label=_("Contact phone"), max_length=20, required=False) + display_phone = forms.BooleanField(label=_("Display phone"), required=False) + + address = forms.CharField(label=_("Address"), max_length=255, required=True) + locality = forms.CharField(label=_("Locality"), max_length=255, required=False) + county = forms.ChoiceField(label=_("County"), choices=settings.FORM_COUNTIES_CHOICES, required=True) + active_region = forms.ChoiceField(label=_("Active region"), choices=settings.FORM_COUNTIES_CHOICES, required=True) + + def __init__(self, *args, **kwargs): + is_fully_editable = kwargs.pop("is_fully_editable", True) + + super().__init__(*args, **kwargs) + + if not is_fully_editable: + self.fields["name"].widget.attrs["disabled"] = True + self.fields["cif"].widget.attrs["disabled"] = True + self.fields["logo"].widget.attrs["disabled"] = True + self.fields["website"].widget.attrs["disabled"] = True + self.fields["contact_email"].widget.attrs["disabled"] = True + self.fields["contact_phone"].widget.attrs["disabled"] = True + self.fields["address"].widget.attrs["disabled"] = True + self.fields["locality"].widget.attrs["disabled"] = True + self.fields["county"].widget.attrs["disabled"] = True + self.fields["active_region"].widget.attrs["disabled"] = True + + +class NgoFormForm(forms.Form): + slug = forms.SlugField(label=_("Slug"), max_length=50, required=True) + description = forms.CharField(label=_("Description"), widget=forms.Textarea, required=True) + iban = IBANFormField(label=_("IBAN"), include_countries=("RO",), required=True) diff --git a/backend/donations/views/api.py b/backend/donations/views/api.py index 51fda88f..f08a9d11 100644 --- a/backend/donations/views/api.py +++ b/backend/donations/views/api.py @@ -6,6 +6,7 @@ from django.core.exceptions import BadRequest, PermissionDenied from django.core.files import File from django.core.management import call_command +from django.db.models import QuerySet from django.http import Http404, HttpResponse, HttpResponseBadRequest, JsonResponse from django.shortcuts import redirect from django.urls import reverse, reverse_lazy @@ -76,6 +77,29 @@ class CheckNgoUrl(BaseTemplateView): def get(self, request, ngo_url, *args, **kwargs): return self.validate_ngo_slug(request.user, ngo_url) + @classmethod + def check_slug_is_blocked(cls, slug): + if slug.lower() in cls.ngo_url_block_list: + return True + + return False + + @classmethod + def check_slug_is_reused(cls, slug, user): + ngo_queryset: QuerySet[Ngo] = Ngo.objects + + try: + if user.ngo: + ngo_queryset = ngo_queryset.exclude(id=user.ngo.id) + except AttributeError: + # Anonymous users don't have the .ngo attribute + pass + + if ngo_queryset.filter(slug=slug.lower()).count(): + return True + + return False + @classmethod def validate_ngo_slug(cls, user, slug): if not slug or not user and not user.is_staff: diff --git a/backend/donations/views/ngo_account.py b/backend/donations/views/ngo_account.py index f9b335cb..804772d5 100644 --- a/backend/donations/views/ngo_account.py +++ b/backend/donations/views/ngo_account.py @@ -1,11 +1,12 @@ from typing import List, Optional from django.conf import settings +from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied, ValidationError from django.db.models import QuerySet -from django.http import Http404, HttpRequest, HttpResponseBadRequest +from django.http import Http404, HttpRequest from django.shortcuts import redirect, render from django.urls import reverse, reverse_lazy from django.utils.decorators import method_decorator @@ -15,7 +16,8 @@ from users.models import User -from ..common.validation.registration_number import clean_registration_number, extract_vat_id, ngo_id_number_validator +from ..common.validation.registration_number import extract_vat_id, ngo_id_number_validator +from ..forms.ngo_account import NgoFormForm, NgoPresentationForm from ..models.donors import Donor from ..models.jobs import Job from ..models.ngos import Ngo @@ -162,15 +164,15 @@ def post(self, request, *args, **kwargs): is_fully_editable = ngo.ngohub_org_id is None - if is_fully_editable: - registration_number = clean_registration_number(post.get("cif", "")) - registration_number_errors: str = validate_registration_number(ngo, registration_number) - - if registration_number_errors: - errors.append(registration_number_errors) + form = NgoPresentationForm(post, is_fully_editable=is_fully_editable) + if not form.is_valid(): + messages.error(request, _("There are some errors on the presentation form.")) + context.update({"ngo_presentation": form}) - vat_information = extract_vat_id(registration_number) + return render(request, self.template_name, context) + if is_fully_editable: + vat_information = extract_vat_id(form.cleaned_data["cif"]) if ngo.registration_number != vat_information["registration_number"]: ngo.registration_number = vat_information["registration_number"] must_refresh_prefilled_form = True @@ -179,22 +181,21 @@ def post(self, request, *args, **kwargs): ngo.vat_id = vat_information["vat_id"] must_refresh_prefilled_form = True - ngo_name = post.get("name", "").strip() - if ngo.name != ngo_name: - ngo.name = ngo_name - - ngo.phone = post.get("contact-phone", "").strip() - ngo.email = post.get("contact-email", "").strip() + if ngo.name != form.cleaned_data["name"]: + ngo.name = form.cleaned_data["name"] + must_refresh_prefilled_form = True - ngo.website = post.get("website", "").strip() - ngo.address = post.get("address", "").strip() - ngo.county = post.get("county", "").strip() - ngo.active_region = post.get("active-region", "").strip() + ngo.phone = form.cleaned_data["contact_phone"] + ngo.email = form.cleaned_data["contact_email"] - ngo.is_accepting_forms = post.get("is_accepting_forms", "").strip() == "on" + ngo.website = form.cleaned_data["website"] + ngo.address = form.cleaned_data["address"] + ngo.county = form.cleaned_data["county"] + ngo.active_region = form.cleaned_data["active_region"] - ngo.display_email = post.get("display-email", "").strip() == "on" - ngo.display_phone = post.get("display-phone", "").strip() == "on" + ngo.is_accepting_forms = form.cleaned_data["is_accepting_forms"] + ngo.display_email = form.cleaned_data["display_email"] + ngo.display_phone = form.cleaned_data["display_phone"] if errors: return render(request, self.template_name, context) @@ -261,23 +262,32 @@ def post(self, request, *args, **kwargs): must_refresh_prefilled_form = False - ngo_slug = post.get("organization-slug", "").strip().lower() - ngo_slug_errors = CheckNgoUrl.validate_ngo_slug(user, ngo_slug) - ngo.slug = ngo_slug + form = NgoFormForm(post) - if isinstance(ngo_slug_errors, HttpResponseBadRequest): - errors.append(_("The URL is already used")) + if not form.is_valid(): + messages.error(request, _("There are some errors on the redirection form.")) + context.update({"ngo_form": form}) + return render(request, self.template_name, context) + + slug_has_errors = False + + form_slug = form.cleaned_data["slug"] + if CheckNgoUrl().check_slug_is_blocked(form_slug): + slug_has_errors = True + form.add_error("slug", ValidationError(_("The URL is blocked"))) - bank_account = post.get("iban", "").strip().upper().replace(" ", "").replace("<", "").replace(">", "")[:34] - bank_account_errors: str = validate_iban(bank_account) - if ngo.bank_account != bank_account: - ngo.bank_account = bank_account - must_refresh_prefilled_form = True + if CheckNgoUrl().check_slug_is_reused(form_slug, user): + slug_has_errors = True + form.add_error("slug", ValidationError(_("The URL is already used"))) + + if slug_has_errors: + context["ngo_form"] = form + return render(request, self.template_name, context) - ngo.description = post.get("description", "").strip() + ngo.slug = form_slug - if bank_account_errors: - errors.append(bank_account_errors) + ngo.bank_account = form.cleaned_data["iban"] + ngo.description = form.cleaned_data["description"] if errors: return render(request, self.template_name, context) diff --git a/backend/locale/en/LC_MESSAGES/django.po b/backend/locale/en/LC_MESSAGES/django.po index c65cab74..0794439a 100644 --- a/backend/locale/en/LC_MESSAGES/django.po +++ b/backend/locale/en/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-29 14:32+0200\n" +"POT-Creation-Date: 2025-01-30 10:52+0200\n" "PO-Revision-Date: 2024-02-28 15:45+0000\n" "Last-Translator: Tudor Amariei \n" "Language-Team: English %(limit.day)s %(month_limit)s of the current year." msgstr "" -#: templates/v2/form/redirection-header.html:65 -#, fuzzy -#| msgid "description" -msgid "Description" -msgstr "description" - #: templates/v2/form/redirection-open.html:7 msgid "Redirect easily and quickly" msgstr "" @@ -1476,134 +1548,134 @@ msgid "" "submit it directly to ANAF." msgstr "" -#: templates/v2/form/redirection-open.html:37 +#: templates/v2/form/redirection-open.html:38 #, fuzzy #| msgid "description" msgid "Personal data" msgstr "description" -#: templates/v2/form/redirection-open.html:51 +#: templates/v2/form/redirection-open.html:52 #, fuzzy #| msgid "initial" msgid "Father's initial" msgstr "initial" -#: templates/v2/form/redirection-open.html:56 +#: templates/v2/form/redirection-open.html:57 msgid "Personal identification number" msgstr "" -#: templates/v2/form/redirection-open.html:66 +#: templates/v2/form/redirection-open.html:67 #: templates/v2/ngo-account/redirections/list-header.html:17 #, fuzzy #| msgid "street number" msgid "Phone number" msgstr "street number" -#: templates/v2/form/redirection-open.html:77 +#: templates/v2/form/redirection-open.html:78 #, fuzzy #| msgid "address" msgid "Home address" msgstr "address" -#: templates/v2/form/redirection-open.html:81 +#: templates/v2/form/redirection-open.html:82 #, fuzzy #| msgid "street name" msgid "Street name" msgstr "street name" -#: templates/v2/form/redirection-open.html:91 +#: templates/v2/form/redirection-open.html:92 msgid "Flat" msgstr "" -#: templates/v2/form/redirection-open.html:128 +#: templates/v2/form/redirection-open.html:131 msgid "Handwritten signature" msgstr "" -#: templates/v2/form/redirection-open.html:178 -#, fuzzy -#| msgid "Sign In" -msgid "Signature modal" -msgstr "Sign In" - -#: templates/v2/form/redirection-open.html:219 +#: templates/v2/form/redirection-open.html:142 msgid "Data sharing information" msgstr "" -#: templates/v2/form/redirection-open.html:222 +#: templates/v2/form/redirection-open.html:145 msgid "I want my redirection to be valid for two years" msgstr "" -#: templates/v2/form/redirection-open.html:227 +#: templates/v2/form/redirection-open.html:150 msgid "" "I agree that this NGO may contact me in the future with details about the " "projects implemented" msgstr "" -#: templates/v2/form/redirection-open.html:234 +#: templates/v2/form/redirection-open.html:157 #, python-format msgid "" "I agree with the Terms of the application . " " the Privacy Policy ." msgstr "" -#: templates/v2/form/redirection-open.html:252 +#: templates/v2/form/redirection-open.html:175 msgid "Captcha" msgstr "" -#: templates/v2/form/redirection-open.html:270 +#: templates/v2/form/redirection-open.html:193 msgid "Confirm sending without signature modal" msgstr "" -#: templates/v2/form/redirection-open.html:289 +#: templates/v2/form/redirection-open.html:212 #, fuzzy #| msgid "Sign In Error" msgid "Send signed form" msgstr "Sign In Error" -#: templates/v2/form/redirection-open.html:298 +#: templates/v2/form/redirection-open.html:221 #, fuzzy #| msgid "Login through NGO Hub" msgid "Continue without signing" msgstr "Login through NGO Hub" -#: templates/v2/form/redirection-open.html:308 +#: templates/v2/form/redirection-open.html:231 #: templates/v3/admin/forms/action.html:25 #, fuzzy #| msgid "Sign In Error" msgid "Send the form" msgstr "Sign In Error" -#: templates/v2/form/redirection-open.html:330 +#: templates/v2/form/redirection-open.html:252 msgid "Download a template" msgstr "" -#: templates/v2/form/redirection-open.html:334 +#: templates/v2/form/redirection-open.html:256 msgid "" "If you want to fill in the form by hand, you can download the template. " "Print it, fill it in, sign it, and send it yourself." msgstr "" -#: templates/v2/form/redirection-open.html:340 +#: templates/v2/form/redirection-open.html:262 msgid "Check the FAQ for more details." msgstr "" -#: templates/v2/form/redirection-open.html:347 +#: templates/v2/form/redirection-open.html:269 msgid "Download here" msgstr "" -#: templates/v2/form/signature.html:115 +#: templates/v2/form/signature.html:55 +#, fuzzy +#| msgid "Sign In" +msgid "Signature modal" +msgstr "Sign In" + +#: templates/v2/form/signature.html:109 msgid "Add signature" msgstr "" -#: templates/v2/form/signature.html:119 +#: templates/v2/form/signature.html:113 msgid "Draw your signature in the canvas below." msgstr "" -#: templates/v2/form/signature.html:136 +#: templates/v2/form/signature.html:130 msgid "Reset" msgstr "" -#: templates/v2/form/signature.html:146 +#: templates/v2/form/signature.html:140 msgid "Ok" msgstr "" @@ -1713,7 +1785,7 @@ msgstr "Work in progress" msgid "Download" msgstr "" -#: templates/v2/ngo-account/archives/listing.html:19 +#: templates/v2/ngo-account/archives/listing.html:14 #, fuzzy #| msgid "Imports" msgid "exports" @@ -1725,12 +1797,9 @@ msgstr "" #: templates/v2/ngo-account/archives/main.html:14 msgid "" -"\n" -" Here you can find the archives of forms that have been exported.\n" -" If are collecting signed forms,\n" -" the archive containing those forms will also contain the documents " -"for the ANAF dynamic PDF.\n" -" " +"Here you can find the archives of forms that have been exported. If are " +"collecting signed forms, the archive containing those forms will also " +"contain the documents for the ANAF dynamic PDF." msgstr "" #: templates/v2/ngo-account/components/form-title.html:12 @@ -1755,7 +1824,7 @@ msgid "Fill out the organization's profile on redirectioneaza.ro" msgstr "" #: templates/v2/ngo-account/my-organization/base.html:35 -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:52 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:53 msgid "Presentation Data" msgstr "" @@ -1786,14 +1855,14 @@ msgstr "description" msgid "IBAN on form" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:23 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:24 msgid "" "

Your organization is not accepting forms by e-mail. This means that " "users will have to download and print the form, fill it in, and send it to " "the organization's address or to their ANAF office.

" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:34 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:35 msgid "" "

The information below is displayed on your organization's page on " "redirectioneaza.ro.

Some information (marked with **) is " @@ -1801,64 +1870,54 @@ msgid "" "edited from your organization's administrator account, in NGO HUB.

" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:44 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:45 #, fuzzy #| msgid "NGOs from NGO Hub" msgid "Go to NGO Hub" msgstr "NGOs from NGO Hub" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:58 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:59 msgid "I want to receive the completed forms by email" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:63 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:64 msgid "" "By selecting this option, I confirm that the NGO has an SPV account to " "submit the forms" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:80 -msgid "CUI/CIF" -msgstr "" - -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:90 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:89 #, fuzzy #| msgid "NGO Hub organization ID" msgid "Organization website" msgstr "NGO Hub organization ID" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:96 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:95 #, fuzzy #| msgid "NGO Hub organization ID" msgid "Organization contact e-mail" msgstr "NGO Hub organization ID" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:101 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:100 msgid "Display e-mail in the profile" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:110 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:109 #, fuzzy #| msgid "NGO Hub organization ID" msgid "Organization contact phone" msgstr "NGO Hub organization ID" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:115 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:114 msgid "Display phone in the profile" msgstr "" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:124 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:123 #, fuzzy #| msgid "NGO Hub organization ID" msgid "Organization address" msgstr "NGO Hub organization ID" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:140 -#, fuzzy -#| msgid "active region" -msgid "Active region" -msgstr "active region" - #: templates/v2/ngo-account/redirections/list-header.html:11 msgid "Locality, County" msgstr "" @@ -1903,7 +1962,7 @@ msgstr "Sign In" msgid "Unsigned" msgstr "has signed" -#: templates/v2/ngo-account/redirections/listing.html:19 +#: templates/v2/ngo-account/redirections/listing.html:14 #, fuzzy #| msgid "Donations" msgid "donations" @@ -1922,13 +1981,7 @@ msgid_plural "%(counter)s redirection forms" msgstr[0] "Options" msgstr[1] "Options" -#: templates/v2/ngo-account/redirections/main.html:61 -#, fuzzy -#| msgid "Generate donations archive" -msgid "Generate ANAF Archive" -msgstr "Generate donations archive" - -#: templates/v2/ngo-account/redirections/main.html:66 +#: templates/v2/ngo-account/redirections/main.html:47 #, python-format msgid "" "Because the download operation of the redirections can take longer, " @@ -1936,6 +1989,12 @@ msgid "" "every %(period_between_retries)s." msgstr "" +#: templates/v2/ngo-account/redirections/main.html:70 +#, fuzzy +#| msgid "Generate donations archive" +msgid "Generate ANAF Archive" +msgstr "Generate donations archive" + #: templates/v2/ngo-account/settings/main.html:15 msgid "" "Some of the settings here are managed by the NGO Hub platform. If you need " @@ -2100,6 +2159,11 @@ msgstr "old password" msgid "Group" msgstr "Group" +#, fuzzy +#~| msgid "The IBAN number must have 24 characters" +#~ msgid "IBAN must have 24 characters" +#~ msgstr "The IBAN number must have 24 characters" + #, fuzzy #~| msgid "active region" #~ msgid "Active region:" diff --git a/backend/locale/ro/LC_MESSAGES/django.po b/backend/locale/ro/LC_MESSAGES/django.po index d6e29bc3..9a756cac 100644 --- a/backend/locale/ro/LC_MESSAGES/django.po +++ b/backend/locale/ro/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-29 14:32+0200\n" +"POT-Creation-Date: 2025-01-30 10:52+0200\n" "PO-Revision-Date: 2024-03-07 11:27+0000\n" "Last-Translator: Tudor Amariei \n" "Language-Team: Romanian 1 ianuarie și %(limit.day)s %(month_limit)s al anului curent." -#: templates/v2/form/redirection-header.html:65 -msgid "Description" -msgstr "Descriere" - #: templates/v2/form/redirection-open.html:7 msgid "Redirect easily and quickly" msgstr "Redirecționează simplu și rapid" @@ -1423,52 +1477,48 @@ msgstr "" "că vei imprima, semna formularul de mână și îl vei trimite către ONG prin " "poștă sau email, sau îl vei depune direct la ANAF." -#: templates/v2/form/redirection-open.html:37 +#: templates/v2/form/redirection-open.html:38 msgid "Personal data" msgstr "Informații personale" -#: templates/v2/form/redirection-open.html:51 +#: templates/v2/form/redirection-open.html:52 msgid "Father's initial" msgstr "Inițiala tatălui" -#: templates/v2/form/redirection-open.html:56 +#: templates/v2/form/redirection-open.html:57 msgid "Personal identification number" msgstr "CNP" -#: templates/v2/form/redirection-open.html:66 +#: templates/v2/form/redirection-open.html:67 #: templates/v2/ngo-account/redirections/list-header.html:17 msgid "Phone number" msgstr "Număr de telefon" -#: templates/v2/form/redirection-open.html:77 +#: templates/v2/form/redirection-open.html:78 msgid "Home address" msgstr "Adresă de domiciliu" -#: templates/v2/form/redirection-open.html:81 +#: templates/v2/form/redirection-open.html:82 msgid "Street name" msgstr "Stradă" -#: templates/v2/form/redirection-open.html:91 +#: templates/v2/form/redirection-open.html:92 msgid "Flat" msgstr "Bloc" -#: templates/v2/form/redirection-open.html:128 +#: templates/v2/form/redirection-open.html:131 msgid "Handwritten signature" msgstr "Semnătură olografă" -#: templates/v2/form/redirection-open.html:178 -msgid "Signature modal" -msgstr "Modal de semnătură" - -#: templates/v2/form/redirection-open.html:219 +#: templates/v2/form/redirection-open.html:142 msgid "Data sharing information" msgstr "Informații privind partajarea datelor" -#: templates/v2/form/redirection-open.html:222 +#: templates/v2/form/redirection-open.html:145 msgid "I want my redirection to be valid for two years" msgstr "Doresc ca redirecționarea să se realizeze pe o perioadă de 2 ani" -#: templates/v2/form/redirection-open.html:227 +#: templates/v2/form/redirection-open.html:150 msgid "" "I agree that this NGO may contact me in the future with details about the " "projects implemented" @@ -1476,7 +1526,7 @@ msgstr "" "Sunt de acord ca acest ONG să mă contacteze pe viitor cu detalii despre " "proiectele implementate" -#: templates/v2/form/redirection-open.html:234 +#: templates/v2/form/redirection-open.html:157 #, python-format msgid "" "I agree with the Terms of the application . " @@ -1485,32 +1535,32 @@ msgstr "" "Sunt de acord cu Termenii aplicației și cu Politica de confidențialitate." -#: templates/v2/form/redirection-open.html:252 +#: templates/v2/form/redirection-open.html:175 msgid "Captcha" msgstr "Captcha" -#: templates/v2/form/redirection-open.html:270 +#: templates/v2/form/redirection-open.html:193 msgid "Confirm sending without signature modal" msgstr "Modal de confirmare trimitere fără de semnătură" -#: templates/v2/form/redirection-open.html:289 +#: templates/v2/form/redirection-open.html:212 msgid "Send signed form" msgstr "Trimite formularul semnat" -#: templates/v2/form/redirection-open.html:298 +#: templates/v2/form/redirection-open.html:221 msgid "Continue without signing" msgstr "Continuă fără a semna" -#: templates/v2/form/redirection-open.html:308 +#: templates/v2/form/redirection-open.html:231 #: templates/v3/admin/forms/action.html:25 msgid "Send the form" msgstr "Trimite formularul" -#: templates/v2/form/redirection-open.html:330 +#: templates/v2/form/redirection-open.html:252 msgid "Download a template" msgstr "Descarcă un model" -#: templates/v2/form/redirection-open.html:334 +#: templates/v2/form/redirection-open.html:256 msgid "" "If you want to fill in the form by hand, you can download the template. " "Print it, fill it in, sign it, and send it yourself." @@ -1518,27 +1568,31 @@ msgstr "" "Dacă vrei să completezi formularul de mână, poți descărca modelul. Imprimă-" "l, completează-l, semnează-l și trimite-l singur." -#: templates/v2/form/redirection-open.html:340 +#: templates/v2/form/redirection-open.html:262 msgid "Check the FAQ for more details." msgstr "Verifică pagina de întrebări frecvente pentru mai multe detalii." -#: templates/v2/form/redirection-open.html:347 +#: templates/v2/form/redirection-open.html:269 msgid "Download here" msgstr "Descarcă aici" -#: templates/v2/form/signature.html:115 +#: templates/v2/form/signature.html:55 +msgid "Signature modal" +msgstr "Modal de semnătură" + +#: templates/v2/form/signature.html:109 msgid "Add signature" msgstr "Adaugă semnătura" -#: templates/v2/form/signature.html:119 +#: templates/v2/form/signature.html:113 msgid "Draw your signature in the canvas below." msgstr "Desenează semnătura în câmpul de mai jos." -#: templates/v2/form/signature.html:136 +#: templates/v2/form/signature.html:130 msgid "Reset" msgstr "Resetează" -#: templates/v2/form/signature.html:146 +#: templates/v2/form/signature.html:140 msgid "Ok" msgstr "Ok" @@ -1653,7 +1707,7 @@ msgstr "În curs" msgid "Download" msgstr "Descarcă" -#: templates/v2/ngo-account/archives/listing.html:19 +#: templates/v2/ngo-account/archives/listing.html:14 msgid "exports" msgstr "exporturi" @@ -1663,19 +1717,13 @@ msgstr "Istoric arhive" #: templates/v2/ngo-account/archives/main.html:14 msgid "" -"\n" -" Here you can find the archives of forms that have been exported.\n" -" If are collecting signed forms,\n" -" the archive containing those forms will also contain the documents " -"for the ANAF dynamic PDF.\n" -" " +"Here you can find the archives of forms that have been exported. If are " +"collecting signed forms, the archive containing those forms will also " +"contain the documents for the ANAF dynamic PDF." msgstr "" -"\n" -" Aici găsești arhivele formularelor care au fost exportate.\n" -" Dacă colectezi formulare semnate,\n" -" arhiva care conține acele formulare va conține și documentele pentru " -"PDF-ul dinamic ANAF.\n" -" " +"Aici găsești arhivele formularelor care au fost exportate.Dacă colectezi " +"formulare semnate,arhiva care conține acele formulare va conține și " +"documentele pentru PDF-ul dinamic ANAF." #: templates/v2/ngo-account/components/form-title.html:12 msgid "Get from NGO Hub" @@ -1692,15 +1740,15 @@ msgid "" "fields are filled in:

" msgstr "" "

Organizația ta nu poate primi formulare în prezent deoarece nu toate " -"informațiile necesare au fost completate. Te rugăm să te asiguri că următoarele " -"câmpuri sunt completate:

" +"informațiile necesare au fost completate. Te rugăm să te asiguri că " +"următoarele câmpuri sunt completate:

" #: templates/v2/ngo-account/my-organization/base.html:30 msgid "Fill out the organization's profile on redirectioneaza.ro" msgstr "Completează profilul organizației pe redirectioneaza.ro" #: templates/v2/ngo-account/my-organization/base.html:35 -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:52 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:53 msgid "Presentation Data" msgstr "Date prezentare" @@ -1725,7 +1773,7 @@ msgstr "Descriere formular" msgid "IBAN on form" msgstr "Numărul IBAN pe formular" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:23 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:24 msgid "" "

Your organization is not accepting forms by e-mail. This means that " "users will have to download and print the form, fill it in, and send it to " @@ -1735,7 +1783,7 @@ msgstr "" "utilizatorii vor trebui să descarce și să imprime formularul, să-l " "completeze și să-l trimită la adresa organizației sau un oficiu ANAF.

" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:34 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:35 msgid "" "

The information below is displayed on your organization's page on " "redirectioneaza.ro.

Some information (marked with **) is " @@ -1747,15 +1795,15 @@ msgstr "" "preluate automat din contul organizației pe NGO HUB, și pot fi editate din " "contul de administrator al organizației tale, în NGO HUB.

" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:44 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:45 msgid "Go to NGO Hub" msgstr "Mergi la NGO Hub" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:58 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:59 msgid "I want to receive the completed forms by email" msgstr "Doresc să primesc formularele completate pe email" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:63 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:64 msgid "" "By selecting this option, I confirm that the NGO has an SPV account to " "submit the forms" @@ -1763,38 +1811,30 @@ msgstr "" "Prin selectarea acestei opțiuni, confirm că ONG-ul are un cont SPV pentru a " "depune formularele" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:80 -msgid "CUI/CIF" -msgstr "CUI/CIF" - -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:90 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:89 msgid "Organization website" msgstr "Website-ul organizației" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:96 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:95 msgid "Organization contact e-mail" msgstr "Email de contact al organizației" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:101 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:100 msgid "Display e-mail in the profile" msgstr "Afișează email-ul în profil" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:110 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:109 msgid "Organization contact phone" msgstr "Telefon de contact al organizației" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:115 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:114 msgid "Display phone in the profile" msgstr "Afișează telefonul în profil" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:124 +#: templates/v2/ngo-account/my-organization/ngo-presentation.html:123 msgid "Organization address" msgstr "Adresa organizației" -#: templates/v2/ngo-account/my-organization/ngo-presentation.html:140 -msgid "Active region" -msgstr "Regiune activă" - #: templates/v2/ngo-account/redirections/list-header.html:11 msgid "Locality, County" msgstr "Oraș, Județ" @@ -1827,7 +1867,7 @@ msgstr "Semnat" msgid "Unsigned" msgstr "Nesemnat" -#: templates/v2/ngo-account/redirections/listing.html:19 +#: templates/v2/ngo-account/redirections/listing.html:14 msgid "donations" msgstr "donații" @@ -1846,11 +1886,7 @@ msgstr[0] "%(counter)s formular de redirecționare" msgstr[1] "%(counter)s formulare de redirecționare" msgstr[2] "%(counter)s de formulare de redirecționare" -#: templates/v2/ngo-account/redirections/main.html:61 -msgid "Generate ANAF Archive" -msgstr "Generează arhiva ANAF" - -#: templates/v2/ngo-account/redirections/main.html:66 +#: templates/v2/ngo-account/redirections/main.html:47 #, python-format msgid "" "Because the download operation of the redirections can take longer, " @@ -1861,6 +1897,10 @@ msgstr "" "funcție de numărul de donatori, momentan puteți descărca o singură arhivă la " "fiecare %(period_between_retries)s." +#: templates/v2/ngo-account/redirections/main.html:70 +msgid "Generate ANAF Archive" +msgstr "Generează arhiva ANAF" + #: templates/v2/ngo-account/settings/main.html:15 msgid "" "Some of the settings here are managed by the NGO Hub platform. If you need " @@ -2014,6 +2054,9 @@ msgstr "parolă veche" msgid "Group" msgstr "Grup" +#~ msgid "CIF" +#~ msgstr "CUI/CIF" + #~ msgid "Active region:" #~ msgstr "Regiune activă:" diff --git a/backend/redirectioneaza/settings/app_configs.py b/backend/redirectioneaza/settings/app_configs.py index ec1d72db..e7d658de 100644 --- a/backend/redirectioneaza/settings/app_configs.py +++ b/backend/redirectioneaza/settings/app_configs.py @@ -120,6 +120,8 @@ except IndexError: pass +FORM_COUNTIES_CHOICES = [(county, county) for county in FORM_COUNTIES] + FORM_COUNTIES_NATIONAL = deepcopy(FORM_COUNTIES) FORM_COUNTIES_NATIONAL.insert(0, "Național") diff --git a/backend/templates/v2/components/input/input.html b/backend/templates/v2/components/input/input.html index e62e0956..1ae47cb0 100644 --- a/backend/templates/v2/components/input/input.html +++ b/backend/templates/v2/components/input/input.html @@ -3,23 +3,24 @@ {% block input %} + id="{{ input_id }}" + name="{{ input_name }}" + type="{{ input_type }}" + class="flex h-9 w-full rounded-md border border-gray-300 bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm aria-[invalid]:border-red-500 aria-[invalid]:hover:border-red-500 disabled:bg-zinc-950/5 disabled:text-zinc-950/50" + {# The following attributes are added to the input element #} + {% if input_autofocus %}autofocus{% endif %} + {% if pattern %}pattern="{{ pattern }}"{% endif %} + {% if min_length %}minlength="{{ min_length }}"{% endif %} + {% if max_length %}maxlength="{{ max_length }}"{% endif %} + {% if input_autocomplete %}autocomplete="{{ input_autocomplete }}"{% endif %} + {% if is_required %}required{% endif %} + {% if field or value %}value="{% if field and field.value %}{{ field.value }}{% elif value %}{{ value }}{% endif %}"{% endif %} + {% if placeholder %}placeholder="{{ placeholder }}"{% endif %} + {% if is_disabled %}disabled{% endif %} + {% if value %}input-original-value="{{ value }}"{% endif %} + {% if data_pristine_equals %}data-pristine-equals="{{ data_pristine_equals }}"{% endif %} + /> - {% if field and field.errors %} {% endif %} + {% if field and field.errors %} + {% endif %} {% endblock %} diff --git a/backend/templates/v2/ngo-account/archives/main.html b/backend/templates/v2/ngo-account/archives/main.html index e493064c..dd3901bc 100644 --- a/backend/templates/v2/ngo-account/archives/main.html +++ b/backend/templates/v2/ngo-account/archives/main.html @@ -11,7 +11,7 @@

- {% blocktrans %} + {% blocktrans trimmed %} Here you can find the archives of forms that have been exported. If are collecting signed forms, the archive containing those forms will also contain the documents for the ANAF dynamic PDF. diff --git a/backend/templates/v2/ngo-account/my-organization/ngo-form.html b/backend/templates/v2/ngo-account/my-organization/ngo-form.html index 895e86bb..4633ab0c 100644 --- a/backend/templates/v2/ngo-account/my-organization/ngo-form.html +++ b/backend/templates/v2/ngo-account/my-organization/ngo-form.html @@ -21,18 +21,18 @@

{% trans "Organization URL" as input_title %} - {% include "components/input/input.html" with input_id="organization-slug" input_title=input_title input_type="text" input_name="organization-slug" is_required=True value=ngo.slug max_length=150 %} + {% include "components/input/input.html" with input_id="slug" input_type="text" input_name="slug" is_required=True value=ngo.slug field=ngo_form.slug max_length=150 %}
{% trans "Form title" as input_title %} - {% include "components/input/input.html" with input_id="page_name" input_type="text" input_name="page_name" placeholder="Organization name" is_required=True is_disabled=True value=ngo.name %} + {% include "components/input/input.html" with input_id="form_title" input_type="text" input_name="form_title" placeholder="Organization name" is_required=True is_disabled=True value=ngo.name %} {% trans "Form description" as input_title %} - {% include "components/input/textarea.html" with input_id="description" input_title=input_title input_type="textarea" input_name="description" is_required=True value=ngo.description %} + {% include "components/input/textarea.html" with input_id="description" input_type="textarea" input_name="description" is_required=True value=ngo.description field=ngo_form.description %} {% trans "IBAN on form" as input_title %} - {% include "components/input/input.html" with input_id="iban" input_type="text" input_name="iban" placeholder="RO001234567812345678" is_required=True value=ngo.bank_account max_length=100 %} + {% include "components/input/input.html" with input_id="iban" input_type="text" input_name="iban" placeholder="RO00 1234 5678 1234 5678" is_required=True value=ngo.bank_account field=ngo_form.iban max_length=48 %}
diff --git a/backend/templates/v2/ngo-account/my-organization/ngo-presentation.html b/backend/templates/v2/ngo-account/my-organization/ngo-presentation.html index a3279fd9..2a5c42f8 100644 --- a/backend/templates/v2/ngo-account/my-organization/ngo-presentation.html +++ b/backend/templates/v2/ngo-account/my-organization/ngo-presentation.html @@ -57,7 +57,7 @@
{% trans "I want to receive the completed forms by email" as input_title %} - {% include "components/input/checkbox.html" with input_id="is_accepting_forms" input_title=input_title input_name="is_accepting_forms" value=ngo.is_accepting_forms %} + {% include "components/input/checkbox.html" with input_id="is_accepting_forms" input_name="is_accepting_forms" value=ngo.is_accepting_forms field=ngo_presentation.is_accepting_forms %}

@@ -71,34 +71,34 @@

{% trans "Name" as input_title %} - {% include "components/input/input.html" with input_id="name" input_title=input_title input_type="text" input_name="name" is_required=True is_disabled=disable_ngohub_fields value=ngo.name max_length=200 %} + {% include "components/input/input.html" with input_id="name" input_type="text" input_name="name" is_required=True is_disabled=disable_ngohub_fields value=ngo.name field=ngo_presentation.name max_length=200 %}
{% trans "CUI/CIF" as input_title %} - {% include "components/input/input.html" with input_id="cif" input_title=input_title input_type="text" input_name="cif" is_required=True is_disabled=disable_ngohub_fields value=ngo.full_registration_number max_length=100 %} + {% include "components/input/input.html" with input_id="cif" input_type="text" input_name="cif" is_required=True is_disabled=disable_ngohub_fields value=ngo.full_registration_number field=ngo_presentation.cif max_length=100 %}
{% trans "Logo" as input_title %} - {% include "components/input/image.html" with input_id="logo" input_title=input_title input_type="file" input_name="logo" is_required=False is_disabled=disable_ngohub_fields image=ngo.logo %} + {% include "components/input/image.html" with input_id="logo" input_type="file" input_name="logo" is_required=False is_disabled=disable_ngohub_fields image=ngo.logo %}
{% trans "Organization website" as input_title %} - {% include "components/input/input.html" with input_id="website" input_title=input_title input_type="url" input_name="website" is_disabled=disable_ngohub_fields value=ngo.website max_length=200 %} + {% include "components/input/input.html" with input_id="website" input_type="url" input_name="website" is_disabled=disable_ngohub_fields value=ngo.website field=ngo_presentation.website max_length=200 %}
{% trans "Organization contact e-mail" as input_title %} - {% include "components/input/input.html" with input_id="contact-email" input_title=input_title input_type="email" input_name="contact-email" is_required=True is_disabled=disable_ngohub_fields value=ngo.email max_length=254 %} + {% include "components/input/input.html" with input_id="contact_email" input_type="email" input_name="contact_email" is_required=True is_disabled=disable_ngohub_fields value=ngo.email field=ngo_presentation.contact_email max_length=254 %}
{% trans "Display e-mail in the profile" as input_title %}
- {% include "components/input/checkbox.html" with input_id="display-email" input_title=input_title input_name="display-email" value=ngo.display_email %} + {% include "components/input/checkbox.html" with input_id="display_email" input_name="display_email" value=ngo.display_email field=ngo_presentation.display_email %}
@@ -106,13 +106,13 @@
{% trans "Organization contact phone" as input_title %} - {% include "components/input/input.html" with input_id="contact-phone" input_title=input_title input_type="tel" input_name="contact-phone" is_disabled=disable_ngohub_fields value=ngo.phone max_length=30 %} + {% include "components/input/input.html" with input_id="contact_phone" input_type="tel" input_name="contact_phone" is_disabled=disable_ngohub_fields value=ngo.phone field=ngo_presentation.contact_phone max_length=30 %}
{% trans "Display phone in the profile" as input_title %}
- {% include "components/input/checkbox.html" with input_id="display-phone" input_title=input_title input_name="display-phone" value=ngo.display_phone %} + {% include "components/input/checkbox.html" with input_id="display-phone" input_name="display_phone" value=ngo.display_phone field=ngo_presentation.display_phone %}
@@ -120,26 +120,26 @@
{% trans "Organization address" as input_title %} - {% include "components/input/input.html" with input_id="address" input_title=input_title input_type="text" input_name="address" is_required=True is_disabled=disable_ngohub_fields value=ngo.address %} + {% include "components/input/input.html" with input_id="address" input_type="text" input_name="address" is_required=True is_disabled=disable_ngohub_fields value=ngo.address field=ngo_presentation.address %}
{% trans "Locality" as input_title %} - {% include "components/input/input.html" with input_id="locality" input_title=input_title input_type="text" input_name="locality" is_disabled=disable_ngohub_fields value=ngo.locality %} + {% include "components/input/input.html" with input_id="locality" input_type="text" input_name="locality" is_disabled=disable_ngohub_fields value=ngo.locality field=ngo_presentation.locality %}
{% trans "County" as input_title %} - {% include "components/input/county.html" with input_id="county" input_title=input_title input_name="county" is_required=True is_disabled=disable_ngohub_fields value=ngo.county %} + {% include "components/input/county.html" with input_id="county" input_name="county" is_required=True is_disabled=disable_ngohub_fields value=ngo.county field=ngo_presentation.county %}
{% trans "Active region" as input_title %} {% if has_ngohub %} - {% include "components/input/input.html" with input_id="active-region" input_title=input_title input_type="text" input_name="active-region" is_required=True is_disabled=disable_ngohub_fields value=ngo.active_region max_length=100 %} + {% include "components/input/input.html" with input_id="active_region" input_type="text" input_name="active_region" is_required=True is_disabled=disable_ngohub_fields value=ngo.active_region field=ngo_presentation.active_region max_length=100 %} {% else %} - {% include "components/input/county.html" with input_id="active-region" input_title=input_title input_name="active-region" is_required=True value=ngo.active_region %} + {% include "components/input/county.html" with input_id="active_region" input_name="active_region" is_required=True value=ngo.active_region field=ngo_presentation.active_region %} {% endif %}