2020-03-14 15:03:37 +01:00
|
|
|
import npyscreen
|
|
|
|
|
2020-03-14 13:16:36 +01:00
|
|
|
class membership_data_model():
|
|
|
|
def __init__(self, membership_data_dict):
|
|
|
|
self.membership_data_dict = membership_data_dict
|
|
|
|
self.forms = {}
|
|
|
|
|
|
|
|
def add_edit_fields(self, parent_form):
|
2020-03-14 15:03:37 +01:00
|
|
|
mem = self.membership_data_dict
|
2020-03-14 13:16:36 +01:00
|
|
|
self.forms['status'] = parent_form.add(npyscreen.TitleText, name="Status: ", value=mem['status'])
|
|
|
|
self.forms['von'] = parent_form.add(npyscreen.TitleText, name="Von: ", value=mem['von'])
|
|
|
|
self.forms['bis'] = parent_form.add(npyscreen.TitleText, name="Bis: ", value=mem['bis'])
|
|
|
|
self.forms['mitgliedsbeitrag'] = parent_form.add(npyscreen.TitleText, name="Mitgliedsbeitrag: ",
|
|
|
|
value=mem['mitgliedsbeitrag'])
|
2020-03-14 15:03:37 +01:00
|
|
|
self.forms['spendenbeitrag'] = parent_form.add(npyscreen.TitleText, name="Spendenbeitrag: ",
|
|
|
|
value=mem['spendenbeitrag'])
|
2020-03-14 13:16:36 +01:00
|
|
|
self.forms['schliessberechtigung'] = parent_form.add(npyscreen.TitleText, name="Schliessberechtigung: ",
|
|
|
|
value=mem['schliessberechtigung'])
|
|
|
|
self.forms['scan-antrag'] = parent_form.add(npyscreen.TitleText, name="URI Scan Antrag: ",
|
|
|
|
value=mem['scan-antrag'])
|
|
|
|
|
|
|
|
def get_form_values_dict(self):
|
2020-03-14 15:03:37 +01:00
|
|
|
membership_data_model = dict(zip(self.forms.keys(), map(lambda f: f.value, self.forms.values())))
|
|
|
|
return membership_data_model
|
|
|
|
|
|
|
|
def has_changed(self):
|
|
|
|
return self.membership_data_dict != self.get_form_values_dict()
|