def _get_classcards_formatted_button_to_cart(self, scdID, school_memberships_id, customer_has_membership): """ Get button to add card to shopping cart """ from tools import OsTools from os_customer import Customer db = current.db auth = current.auth TODAY_LOCAL = current.TODAY_LOCAL os_gui = current.globalenv['os_gui'] T = current.T customer = Customer(auth.user.id) memberships = customer.get_memberships_on_date(TODAY_LOCAL) ids = [] for row in memberships: ids.append(row.id) if school_memberships_id and not school_memberships_id in ids: sm = db.school_memberships(school_memberships_id) return A(SPAN(T("Membership %s required" % sm.Name), ' ', os_gui.get_fa_icon('fa-arrow-right'), _class='smaller_font'), _href=URL('shop', 'memberships')) link = A(SPAN(os_gui.get_fa_icon('fa-shopping-cart fa-2x')), _href=URL('classcard_add_to_cart', vars={'scdID': scdID})) return self._get_formatted_button_apply_accent_color(link)
def _get_subscriptions_formatted_button_to_cart( self, ssuID, school_memberships_id, customer_has_membership, customer_subscriptions_ids): """ Get button to add card to shopping cart """ from tools import OsTools from os_customer import Customer db = current.db auth = current.auth TODAY_LOCAL = current.TODAY_LOCAL os_gui = current.globalenv['os_gui'] T = current.T customer = Customer(auth.user.id) memberships = customer.get_memberships_on_date(TODAY_LOCAL) ids = [] for row in memberships: ids.append(row.id) if school_memberships_id and not school_memberships_id in ids: sm = db.school_memberships(school_memberships_id) return A(SPAN(T("Membership %s required" % sm.Name), ' ', os_gui.get_fa_icon('fa-arrow-right'), _class='smaller_font'), _href=URL('shop', 'memberships')) if ssuID in customer_subscriptions_ids: return SPAN(SPAN(T("You have this subscription"), _class='bold'), BR(), SPAN( A(T("View invoices"), _href=URL('profile', 'invoices'))), _class='smaller_font') link = A(SPAN(os_gui.get_fa_icon('fa-shopping-cart fa-2x')), _href=URL('subscription_terms', vars={'ssuID': ssuID})) return self._get_formatted_button_apply_accent_color(link)