"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: ksp-servicestelle@sgdnord.rlp.de
Created on: 18.08.22

"""
from django import forms
from django.utils.translation import gettext_lazy as _

from konova.forms.modals import BaseModalForm


class TeamDataForm(BaseModalForm):
    name = forms.CharField(
        label_suffix="",
        label=_("Team name"),
        max_length=500,
        required=False,
        widget=forms.TextInput(
            attrs={
                "placeholder": _("Team name"),
                "class": "form-control",
            }
        )
    )
    description = forms.CharField(
        label_suffix="",
        required=False,
        label=_("Description"),
        widget=forms.Textarea(
            attrs={
                "rows": 5,
                "class": "form-control"
            }
        )
    )

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.form_title = _("Team")
        self.form_caption = ""
        self.render_submit = False
        form_data = {
            "name": self.instance.name,
            "description": self.instance.description,
        }
        self.load_initial_data(
            form_data,
            [
                "name",
                "description"
            ]
        )