from django import forms
from django.utils.translation import gettext_lazy as _
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Div, HTML, Layout, Fieldset, Submit, Field


class RegistrationForm(forms.Form):
    email = forms.CharField(label=_('Email'), required=True)
    first_name = forms.CharField(label=_('First Name'), required=True)
    last_name = forms.CharField(label=_('Password confirmation'), required=True)
    nick_name = forms.CharField(label=_('Nick Name'), required=False)
    phone = forms.CharField(label=_('Phone'), required=False)
    category = forms.CharField(label=_('Category'), required=True)
    text = forms.CharField(label=_('Text'), required=False, widget=forms.Textarea)

    def __init__(self, *args, **kwargs):
        super(RegistrationForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.form_method = 'post'
        self.helper.form_action = 'submit_survey'
        self.helper.add_input(Submit('submit', 'Submit', css_class='btn btn-primary d-block mx-auto'))


class EmailForm(forms.Form):
    email = forms.CharField(label=_('Email'), required=True)

    def __init__(self, *args, **kwargs):
        super(EmailForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_tag = False
        self.helper.form_method = 'post'
        self.helper.form_action = 'submit_survey'
        self.helper.add_input(Submit('submit', 'Submit', css_class='btn btn-primary d-block mx-auto'))