52 lines
2.0 KiB
Python
Raw Normal View History

from flask_table import Table, Col, DateCol, LinkCol, BoolCol, DatetimeCol, NestedTableCol
from flask_wtf import FlaskForm
2020-02-17 13:25:14 -05:00
from wtforms import SelectMultipleField, SubmitField, StringField, IntegerField, BooleanField, DateField, widgets, \
SelectField
2020-02-17 13:25:14 -05:00
from models import RequiredDocument, Investigator
class StudySearchForm(FlaskForm):
search = StringField('')
class StudyForm(FlaskForm):
title = StringField('Title')
netbadge_id = StringField('UVA Id for Primary Investigator')
2020-02-17 13:25:14 -05:00
requirements = SelectMultipleField("Requirements",
render_kw={'class':'multi'},
choices=[(rd.code, rd.name) for rd in RequiredDocument.all()])
hsr_number = StringField('HSR Number')
2020-02-17 13:25:14 -05:00
q_complete = BooleanField('Complete in Protocol Builder?', default='checked',
false_values=(False, 'false', 0, '0'))
# last_updated = DateField('Last Updated')
2020-02-17 13:25:14 -05:00
class InvestigatorForm(FlaskForm):
netbadge_id = StringField('UVA Id')
type = SelectField("InvestigatorType", choices=[(i.type, i.description) for i in Investigator.all_types()])
class RequirementsTable(Table):
code = Col('Code')
name = Col('Name')
2020-02-17 13:25:14 -05:00
class InvestigatorsTable(Table):
netbadge_id = Col('UVA Id')
type = Col('Type')
delete = LinkCol('Delete', 'del_investigator', url_kwargs=dict(inv_id='id'))
class StudyTable(Table):
def sort_url(self, col_id, reverse=False):
pass
edit = LinkCol('Edit', 'edit_study', url_kwargs=dict(study_id='study_id'))
2020-02-17 13:25:14 -05:00
delete = LinkCol('Delete', 'del_study', url_kwargs=dict(study_id='study_id'))
add_inv = LinkCol('Add Person', 'new_investigator', url_kwargs=dict(study_id='study_id'))
study_id = Col('Study Id')
title = Col('Title')
2020-02-17 13:25:14 -05:00
netbadge_id = Col('User')
last_updated = DatetimeCol('Last Update', "medium")
q_complete = BoolCol('Complete?')
requirements = NestedTableCol('Requirements', RequirementsTable)
2020-02-17 13:25:14 -05:00
investigators = NestedTableCol('Investigators', InvestigatorsTable)