def render_grants_due_list(supplier): cutoff_date = datetime.date.today() + datetime.timedelta(21) grant_list = db.find_pending_grants(supplier, cutoff_date) field_list = (grants.state_field, grants.target_date_field, grants.creator_field, grants.source_field, grants.project_field, grants.amount_field) sub_heading = renderers.sub_heading('Grant Payments Due') table = views.view_entity_list(grant_list, field_list) return (sub_heading, table)
def view_entity_history(key): audit_list = db.AuditRecord.query( db.AuditRecord.entity == key).order(-db.AuditRecord.timestamp).iter( limit=20) sub_heading = renderers.sub_heading('Activity Log') table = view_entity_list(audit_list, audit_fields, selectable=False, no_links=False) return (sub_heading, table)
def show_payment(payment_key, action, model): if payment_key is None: return [] payment = payment_key.get() sub_heading = renderers.sub_heading(payment.payment_type.capitalize() + ' Payment') paid_button = action.render(model) payment_fields = (payment_amount_field, payment_paid_field, payment_transfer_field, payment_transferred_field) payment_grid = views.view_entity(payment, payment_fields) return [sub_heading, paid_button, payment_grid]
def render_purchase_payments_list(supplier): column_headers = properties.get_labels(payment_field_list) payment_list = db.find_pending_payments(supplier) payment_grid = properties.display_entity_list(payment_list, payment_field_list, no_links=True) purchase_list = [data_models.get_parent(e) for e in payment_list] payment_url_list = map(urls.url_for_entity, purchase_list) sub_heading = renderers.sub_heading('Purchase Payments Due') table = renderers.render_table(column_headers, payment_grid, payment_url_list) return (sub_heading, table)
def home(): model = data_models.Model(None) links = views.view_links(None, ('Committee', 'Show Committees'), ('Supplier', 'Show Suppliers'), ('User', 'Show Users')) audit_list = db.AuditRecord.query(db.AuditRecord.parent == None).order( -db.AuditRecord.timestamp).fetch(10) sub_heading = renderers.sub_heading('Recent Activity') table = views.view_entity_list(audit_list, audit_fields, selectable=False, no_links=False) content = renderers.render_div(sub_heading, table) return render_template('layout.html', title='DashBoard', user=views.view_user_controls(model), links=links, content=content)