from django import  forms
from .models import Amministratore

class FormAmministratoreEditId(forms.Form):
  def __init__(self,*args,amministratore=[],**kwargs):
    super().__init__(*args, **kwargs)
    self.fields['scelta'] = forms.ChoiceField(required=True,choices=self.c(amministratore))

  def c(self,amministratore):
    choices = []
    for u in amministratore:
      choices.append((u.id,u.id),)

    print('choices',choices)
    return choices

class FormAmministratore(forms.Form):
  def __init__(self,*args,**kwargs):
    forms.Form.__init__(self,*args,**kwargs)
    self.fields['login'] = forms.CharField(required=True)
    self.fields['nome'] = forms.CharField(required=True)
    self.fields['mail'] = forms.CharField(required=False)
    self.fields['pin'] = forms.CharField(required=True)
    self.fields['uuid'] = forms.CharField(required=False)
    self.fields['sola_lettura'] = forms.BooleanField(required=False)
    self.fields['crea_azienda'] = forms.BooleanField(required=False)
    self.fields['crea_sede'] = forms.BooleanField(required=False)
    self.fields['crea_utente'] = forms.BooleanField(required=False)
    self.fields['crea_documento'] = forms.BooleanField(required=False)
    self.fields['crea_comunicazione'] = forms.BooleanField(required=False)
    self.fields['edit_azienda'] = forms.BooleanField(required=False)
    self.fields['edit_sede'] = forms.BooleanField(required=False)
    self.fields['edit_utente'] = forms.BooleanField(required=False)
    self.fields['edit_comunicazione'] = forms.BooleanField(required=False)
    self.fields['crea_permesso'] = forms.BooleanField(required=False)
    self.fields['edit_permesso'] = forms.BooleanField(required=False)
    self.fields['read_permesso'] = forms.BooleanField(required=False)
