stammdaten-formular/financial_data_model.py
2020-03-14 15:03:37 +01:00

25 lines
No EOL
1.2 KiB
Python

import npyscreen
class financial_data_model():
def __init__(self, financial_data_dict):
self.financial_data_dict = financial_data_dict
self.forms = {}
def add_edit_fields(self, form):
fin = self.financial_data_dict
self.forms['iban'] = form.add(npyscreen.TitleText, name="IBAN: ", value=fin['iban'])
self.forms['bic'] = form.add(npyscreen.TitleText, name="BIC: ", value=fin['bic'])
self.forms['holder'] = form.add(npyscreen.TitleText, name="Kontoinhaber: ", value=fin['holder'])
self.forms['issuance'] = form.add(npyscreen.TitleText, name="Tag der Erteilung Lastschriftmandat: ",
value=fin['issuance'])
self.forms['reference'] = form.add(npyscreen.TitleText, name="Mandatsreferenznummer: ",
value=fin['reference'])
self.forms['scan-sepa-mandate'] = form.add(npyscreen.TitleText, name="URI Scan SEPA-Mandat: ",
value=fin['scan-sepa-mandate'])
def get_form_values_dict(self):
financial_data_model = dict(zip(self.forms.keys(), map(lambda f: f.value, self.forms.values())))
return financial_data_model
def has_changed(self):
return self.financial_data_dict != self.get_form_values_dict()