def send_signup_email(self, email, password, firstName, lastName, role, phone_number, host_site): roles = { 1: "Site Admin", 2: "GFB Admin", 3: "Host Site Coordinator", 4: "Client" } db = DB() if (role == "3"): pickupSiteName = db.getHostSite(host_site)['name'] roleTitle = roles.get(int(role)) # to_send = 'curl -s --user \'api:key-5bc79fc3330ac42bf29e1b2f89bb1209\' \\\ # https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ # -F from=\'Garden Fresh Box <*****@*****.**>\' \\\ # -F to=\'' + firstName +'<' + email +'>\'\\\ # -F subject=\'Welcome ' + firstName +'!\' \\\ # -F text=\'Welcome to Garden Fresh Box ' + firstName +'! \n\nYou just joined the Garden Fresh Box program! Thank you for your patronage, please email the sysadmin at [email protected] if you have any questions or concerns about anything on this site. Here are your personal details which may be edited by logging into the Garden Fresh Box site \n\n\ # ' + firstName +' ' + lastName + '\n\ # Email: ' + email +'\n \ # Password: '******'\n \ # Role: ' + roleTitle +'\n \ # Phone Number: ' + phone_number +'\n ' # # if (role == "3"): # to_send = to_send + '\tThe host site you administer: ' + pickupSiteName # # to_send = to_send + '\'' # os.system(to_send) return
def toTable(users): db = DB() roles = {1:"Site Admin", 2:"GFB Admin", 3:"Host Site Coordinator", 4:"Client"} tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table table-hover\" id=\"usersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>First Name</th><th>Last Name</th><th>Phone</th><th>Email</th><th>Host Site</th><th>Role</th></tr></thread><tbody class=\"searchable\">" #This for loop loops through the list of dictionaries and selects certain values to add to the table for user in users: hostsite_name = "None"; if (user.get('fk_credentials') == 1 or user.get('fk_credentials') == 2): hostsite_name = "All" if (user.get('fk_hostsite_id') != None): hsInfo = db.getHostSite(user.get('fk_hostsite_id')) if (hsInfo != None): hostsite_name = hsInfo['name'] tableStr += "<tr id=\"" + str(user.get('id')) + "\" style=\"cursor:pointer;\">" tableStr += "<td>" + str(user.get('first_name')) +"</td>" tableStr += "<td>" + str(user.get('last_name')) +"</td>" tableStr += "<td>" + str(user.get('phone_number')) +"</td>" tableStr += "<td>" + str(user.get('email')) + "</td>" tableStr += "<td>" + hostsite_name + "</td>" tableStr += "<td>" + str(roles.get(user.get('fk_credentials'),'')) + "</td>" tableStr += "<td><button id=\"delete_" + str(user.get('id')) + "\" type=\"button\" class=\"btn btn-danger\" onclick=\"deleteClicked(event);\">Delete</button></td></tr>" tableStr += "</tbody></table>" return tableStr
def host_site(self): db = DB() # Get request - if hostSiteId is *, all host sites are returned, else only the host site matching given hostSiteID if (request.method == "GET"): hostSiteID = request.params['hostSiteID'] if hostSiteID == '*': hs = db.getAllHostSites(request.params['sortid']) return HostSite.toTable( hs, request.params['staticTable'] == "true") else: hs = db.getHostSite(hostSiteID) return json.dumps(hs) # Put request - if hostSiteID is empty string, a new host site is added, else the host with with hostSiteID is updated elif (request.method == "PUT"): hostSiteID = request.params['hostSiteID'] if (request.params['hostSiteID'] != "" and request.params['name'] == ""): # Delete existing host site success = db.removeHostSite(hostSiteID) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to delete new host site\"}" elif (hostSiteID == ""): # New host site hs = HostSite(request.params['name'], request.params['address'], request.params['city'], request.params['province'], request.params['postalCode'], request.params['hoursOfOperation'], request.params['phone'], request.params['email']) success = db.addHostSiteModel(hs) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to add new host site\"}" else: # Update existing host site hs = HostSite(request.params['name'], request.params['address'], request.params['city'], request.params['province'], request.params['postalCode'], request.params['hoursOfOperation'], request.params['phone'], request.params['email']) hs.id = hostSiteID success = db.updateHostSiteModel(hs) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to update host site\"}" # Delete request - not supported elif (request.method == "DELETE"): return "{\"success\":\"false\", \"message\":\"Unimplemented\"}"
def send_signup_email(self, email, password, firstName, lastName, role, phone_number, host_site): roles = {1:"Site Admin", 2:"GFB Admin", 3:"Host Site Coordinator", 4:"Client"} db = DB() if (role == "3"): pickupSiteName = db.getHostSite(host_site)['name'] roleTitle = roles.get(int(role)) # to_send = 'curl -s --user \'api:key-5bc79fc3330ac42bf29e1b2f89bb1209\' \\\ # https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ # -F from=\'Garden Fresh Box <*****@*****.**>\' \\\ # -F to=\'' + firstName +'<' + email +'>\'\\\ # -F subject=\'Welcome ' + firstName +'!\' \\\ # -F text=\'Welcome to Garden Fresh Box ' + firstName +'! \n\nYou just joined the Garden Fresh Box program! Thank you for your patronage, please email the sysadmin at [email protected] if you have any questions or concerns about anything on this site. Here are your personal details which may be edited by logging into the Garden Fresh Box site \n\n\ # ' + firstName +' ' + lastName + '\n\ # Email: ' + email +'\n \ # Password: '******'\n \ # Role: ' + roleTitle +'\n \ # Phone Number: ' + phone_number +'\n ' # # if (role == "3"): # to_send = to_send + '\tThe host site you administer: ' + pickupSiteName # # to_send = to_send + '\'' # os.system(to_send) return
def send_confirmation_email(self, dateCreated, dateToDistribute, firstName, lastName, email, phoneNumber, smallBoxQuantity, largeBoxQuantity, donations, totalPaid, hostSitePickupID, hostSiteOrderID): if (smallBoxQuantity == "" and largeBoxQuantity == ""): to_send = 'curl -s --user \'api:key-5bc79fc3330ac42bf29e1b2f89bb1209\' \\\ https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ -F from=\'Garden Fresh Box <*****@*****.**>\' \\\ -F to=\'' + firstName + '<' + email + '>\'\\\ -F subject=\'Donation by ' + firstName + '\' \\\ -F text=\'Thank you ' + firstName + '!\n\nYou just made a donation to the Garden Fresh Box program and we really appreciate it! Please email the sysadmin at [email protected] if you have any questions or concerns about this order Here are some of the details:\n\n \ Date: ' + dateCreated + '\n \ ' + firstName + ' ' + lastName + '\n \ Donation amount: $' + donations + '\n \'' else: db = DB() pickupSiteName = db.getHostSite(hostSitePickupID)['name'] totalCost = 0 if (smallBoxQuantity != "" and int(smallBoxQuantity) > 0): totalCost += int(smallBoxQuantity) * 15 if (largeBoxQuantity != "" and int(largeBoxQuantity) > 0): totalCost += int(largeBoxQuantity) * 20 if (totalPaid == ""): totalPaid = 0 else: totalPaid = int(totalPaid) amount_owed = totalCost - totalPaid # to_send = 'curl -s --user \'api:key-5bc79fc3330ac42bf29e1b2f89bb1209\' \\\ # https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ # -F from=\'Garden Fresh Box <*****@*****.**>\' \\\ # -F to=\'' + firstName +'<' + email +'>\'\\\ # -F subject=\'Order by ' + firstName +'\' \\\ # -F text=\'Thank you ' + firstName +'! \n\nYou just made a purchase on the Garden Fresh Box program! Thank you for your patronage, please email the sysadmin at [email protected] if you have any questions or concerns about this order. Here are the details of the purchase: \n\n\ # Date created: ' + dateCreated +'\n \ # Date of distribution: ' + dateToDistribute +'\n \ # ' + firstName +' ' + lastName + '\n \ # Number of small boxes: ' + smallBoxQuantity +'\n \ # Number of large boxes: ' + largeBoxQuantity +'\n \ # Host site for pickup: ' + pickupSiteName +'\n \ # Total: $' + str(totalCost) +'\n \ # Amount Paid: $' + str(totalPaid) +'\n \ # Amount Owed: $' + str(amount_owed) +'\'' # os.system(to_send) return
def host_site(self): db = DB() # Get request - if hostSiteId is *, all host sites are returned, else only the host site matching given hostSiteID if (request.method == "GET"): hostSiteID = request.params['hostSiteID'] if hostSiteID == '*': hs = db.getAllHostSites(request.params['sortid']) return HostSite.toTable(hs, request.params['staticTable'] == "true") else: hs = db.getHostSite(hostSiteID) return json.dumps(hs) # Put request - if hostSiteID is empty string, a new host site is added, else the host with with hostSiteID is updated elif (request.method == "PUT"): hostSiteID = request.params['hostSiteID'] if (request.params['hostSiteID'] != "" and request.params['name'] == ""): # Delete existing host site success = db.removeHostSite(hostSiteID) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to delete new host site\"}" elif(hostSiteID == ""): # New host site hs = HostSite(request.params['name'], request.params['address'], request.params['city'], request.params['province'], request.params['postalCode'], request.params['hoursOfOperation'], request.params['phone'], request.params['email']) success = db.addHostSiteModel(hs) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to add new host site\"}" else: # Update existing host site hs = HostSite(request.params['name'], request.params['address'], request.params['city'], request.params['province'], request.params['postalCode'], request.params['hoursOfOperation'], request.params['phone'], request.params['email']) hs.id = hostSiteID success = db.updateHostSiteModel(hs) if success: return self.trueStr else: return "{\"success\":\"false\", \"message\":\"Unable to update host site\"}" # Delete request - not supported elif (request.method == "DELETE"): return "{\"success\":\"false\", \"message\":\"Unimplemented\"}"
def toTableMasterOrderList(orders): tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table\" id=\"ordersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>Host Site</th><th>Small Boxes</th><th>Large Boxes</th></tr></thread><tbody class=\"searchable\">" #A database object is created db = DB() ''' The first loop is used to scan the list of orders and find all the orders from each hostsite it creates a new dictionary with the total number of boxes in it. ''' ords = {} ids = [] for site in orders: currId = site.get('hostsitepickup_idFK') if currId in ids: ords[currId]['small_quantity'] += int( site.get('small_quantity')) ords[currId]['large_quantity'] += int( site.get('large_quantity')) else: ids.append(currId) ords[currId] = {} ords[currId]['small_quantity'] = int( site.get('small_quantity')) ords[currId]['large_quantity'] = int( site.get('large_quantity')) #This for loop goes through the dictionary and selects values to be added to the table for key in ords.keys(): site = ords.get(key) dic = db.getHostSite(key) if dic == None: continue tableStr += "<tr id=\"" + str(key) + "\">" tableStr += "<td>" + str(dic['name']) + "</td>" tableStr += "<td>" + str(site.get('small_quantity')) + "</td>" tableStr += "<td>" + str(site.get('large_quantity')) + "</td></tr>" tableStr += "</tbody></table>" return tableStr
def toTableMasterOrderList(orders): tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table\" id=\"ordersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>Host Site</th><th>Small Boxes</th><th>Large Boxes</th></tr></thread><tbody class=\"searchable\">" #A database object is created db = DB() ''' The first loop is used to scan the list of orders and find all the orders from each hostsite it creates a new dictionary with the total number of boxes in it. ''' ords = {} ids = [] for site in orders: currId = site.get('hostsitepickup_idFK') if currId in ids: ords[currId]['small_quantity'] += int(site.get('small_quantity')) ords[currId]['large_quantity'] += int(site.get('large_quantity')) else: ids.append(currId) ords[currId] = {} ords[currId]['small_quantity'] = int(site.get('small_quantity')) ords[currId]['large_quantity'] = int(site.get('large_quantity')) #This for loop goes through the dictionary and selects values to be added to the table for key in ords.keys(): site = ords.get(key) dic = db.getHostSite(key) if dic == None: continue tableStr += "<tr id=\"" + str(key) + "\">" tableStr += "<td>" + str(dic['name']) +"</td>" tableStr += "<td>" + str(site.get('small_quantity')) +"</td>" tableStr += "<td>" + str(site.get('large_quantity')) +"</td></tr>" tableStr += "</tbody></table>" return tableStr
def toTable(users): db = DB() roles = { 1: "Site Admin", 2: "GFB Admin", 3: "Host Site Coordinator", 4: "Client" } tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table table-hover\" id=\"usersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>First Name</th><th>Last Name</th><th>Phone</th><th>Email</th><th>Host Site</th><th>Role</th></tr></thread><tbody class=\"searchable\">" #This for loop loops through the list of dictionaries and selects certain values to add to the table for user in users: hostsite_name = "None" if (user.get('fk_credentials') == 1 or user.get('fk_credentials') == 2): hostsite_name = "All" if (user.get('fk_hostsite_id') != None): hsInfo = db.getHostSite(user.get('fk_hostsite_id')) if (hsInfo != None): hostsite_name = hsInfo['name'] tableStr += "<tr id=\"" + str( user.get('id')) + "\" style=\"cursor:pointer;\">" tableStr += "<td>" + str(user.get('first_name')) + "</td>" tableStr += "<td>" + str(user.get('last_name')) + "</td>" tableStr += "<td>" + str(user.get('phone_number')) + "</td>" tableStr += "<td>" + str(user.get('email')) + "</td>" tableStr += "<td>" + hostsite_name + "</td>" tableStr += "<td>" + str(roles.get(user.get('fk_credentials'), '')) + "</td>" tableStr += "<td><button id=\"delete_" + str( user.get('id') ) + "\" type=\"button\" class=\"btn btn-danger\" onclick=\"deleteClicked(event);\">Delete</button></td></tr>" tableStr += "</tbody></table>" return tableStr
def send_confirmation_email( self, dateCreated, dateToDistribute, firstName, lastName, email, phoneNumber, smallBoxQuantity, largeBoxQuantity, donations, totalPaid, hostSitePickupID, hostSiteOrderID, ): if smallBoxQuantity == "" and largeBoxQuantity == "": to_send = ( "curl -s --user 'api:key-5bc79fc3330ac42bf29e1b2f89bb1209' \\\ https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ -F from='Garden Fresh Box <*****@*****.**>' \\\ -F to='" + firstName + "<" + email + ">'\\\ -F subject='Donation by " + firstName + "' \\\ -F text='Thank you " + firstName + "!\n\nYou just made a donation to the Garden Fresh Box program and we really appreciate it! Please email the sysadmin at [email protected] if you have any questions or concerns about this order Here are some of the details:\n\n \ Date: " + dateCreated + "\n \ " + firstName + " " + lastName + "\n \ Donation amount: $" + donations + "\n '" ) else: db = DB() pickupSiteName = db.getHostSite(hostSitePickupID)["name"] totalCost = 0 if smallBoxQuantity != "" and int(smallBoxQuantity) > 0: totalCost += int(smallBoxQuantity) * 15 if largeBoxQuantity != "" and int(largeBoxQuantity) > 0: totalCost += int(largeBoxQuantity) * 20 if totalPaid == "": totalPaid = 0 else: totalPaid = int(totalPaid) amount_owed = totalCost - totalPaid # to_send = 'curl -s --user \'api:key-5bc79fc3330ac42bf29e1b2f89bb1209\' \\\ # https://api.mailgun.net/v2/sandboxf445b5fad6f649ffa60875af1df80dee.mailgun.org/messages \\\ # -F from=\'Garden Fresh Box <*****@*****.**>\' \\\ # -F to=\'' + firstName +'<' + email +'>\'\\\ # -F subject=\'Order by ' + firstName +'\' \\\ # -F text=\'Thank you ' + firstName +'! \n\nYou just made a purchase on the Garden Fresh Box program! Thank you for your patronage, please email the sysadmin at [email protected] if you have any questions or concerns about this order. Here are the details of the purchase: \n\n\ # Date created: ' + dateCreated +'\n \ # Date of distribution: ' + dateToDistribute +'\n \ # ' + firstName +' ' + lastName + '\n \ # Number of small boxes: ' + smallBoxQuantity +'\n \ # Number of large boxes: ' + largeBoxQuantity +'\n \ # Host site for pickup: ' + pickupSiteName +'\n \ # Total: $' + str(totalCost) +'\n \ # Amount Paid: $' + str(totalPaid) +'\n \ # Amount Owed: $' + str(amount_owed) +'\'' # os.system(to_send) return
def toUserSaleList(orders): tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table table-hover\" id=\"ordersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>Pickup Site</th><th>Pickup Date</th><th>Customer</th><th>Phone</th><th>Email</th><th>No. Small</th><th>No. Large</th><th>Paid</th><th>Ordered On</th></tr></thread><tbody class=\"searchable\">" #calls to database is made to get the name of the hostsite db = DB() #This for loop loops through the list of dictionaries and selects certain values to add to the table for order in orders: is_not_overdue = False d_date = datetime.datetime.strptime(order.get('distribution_date'), '%Y-%m-%d') - datetime.timedelta(days=12) current_date = datetime.datetime.today() if (current_date < d_date): is_not_overdue = True ordered_from_name = "None"; if (order.get('hostsitepickup_idFK') != None): hsInfo = db.getHostSite(order.get('hostsitepickup_idFK')) if (hsInfo != None): ordered_from_name = hsInfo['name'] tableStr += "<tr id=\"" + str(order.get('id')) + "\">" tableStr += "<td>" + ordered_from_name +"</td>" tableStr += "<td>" + str(order.get('distribution_date')) +"</td>" tableStr += "<td>" + str(order.get('customer_first_name')) + " " + str(order.get('customer_last_name')) +"</td>" tableStr += "<td>" + str(order.get('customer_phone')) +"</td>" tableStr += "<td>" + str(order.get('customer_email')) if str(order.get('email_notifications')) == "1": tableStr += " (Notifications)</td>" else: tableStr += "</td>" tableStr += "<td>" + str(order.get('small_quantity')) +"</td>" tableStr += "<td>" + str(order.get('large_quantity')) +"</td>" if float(order.get('total_paid')) > 0.0: isPaid = "Paid" buttonType = "success" else: isPaid = "Unpaid" if (is_not_overdue): buttonType = "primary" else: buttonType = "warning" tableStr += "<td><button id=\"paid_" + str(order.get('id')) + "\" type=\"button\" class=\"label label-"+ buttonType + "\">" + isPaid +"</td>" cost = 20.0 * float(order.get('large_quantity', 0)) + 15.0 * float(order.get('small_quantity', 0)) owe = cost - float(order.get('total_paid', 0.00)) tableStr += "<td>" + str(order.get('creation_date')) +"</td>" if (is_not_overdue and order.get('total_paid') == "0.00"): tableStr += "<td><button id=\"delete_" + str(order.get('id')) + "\" type=\"button\" class=\"btn btn-danger\" onclick=\"deleteClicked(event);\">Delete</button></td>" tableStr += "</tr>" tableStr += "</tbody></table>" return tableStr
def toUserSaleList(orders): tableStr = "<div class=\"input-group\" style=\"padding-top: 0;margin-bottom: 5px; margin-top: 0; padding-left: 0\"><span class=\"input-group-addon\">Filter</span><input id=\"filterbox\" type=\"text\" class=\"form-control\" placeholder=\"Type here to filter the table (by sites, dates, names, etc.)\"></div>" tableStr += "<table class=\"table table-hover\" id=\"ordersTable\" style=\"background-color:white;cursor: pointer; cursor: hand; \"><thread><tr id=\"info\"><th>Pickup Site</th><th>Pickup Date</th><th>Customer</th><th>Phone</th><th>Email</th><th>No. Small</th><th>No. Large</th><th>Paid</th><th>Ordered On</th></tr></thread><tbody class=\"searchable\">" #calls to database is made to get the name of the hostsite db = DB() #This for loop loops through the list of dictionaries and selects certain values to add to the table for order in orders: is_not_overdue = False d_date = datetime.datetime.strptime( order.get('distribution_date'), '%Y-%m-%d') - datetime.timedelta(days=12) current_date = datetime.datetime.today() if (current_date < d_date): is_not_overdue = True ordered_from_name = "None" if (order.get('hostsitepickup_idFK') != None): hsInfo = db.getHostSite(order.get('hostsitepickup_idFK')) if (hsInfo != None): ordered_from_name = hsInfo['name'] tableStr += "<tr id=\"" + str(order.get('id')) + "\">" tableStr += "<td>" + ordered_from_name + "</td>" tableStr += "<td>" + str(order.get('distribution_date')) + "</td>" tableStr += "<td>" + str( order.get('customer_first_name')) + " " + str( order.get('customer_last_name')) + "</td>" tableStr += "<td>" + str(order.get('customer_phone')) + "</td>" tableStr += "<td>" + str(order.get('customer_email')) if str(order.get('email_notifications')) == "1": tableStr += " (Notifications)</td>" else: tableStr += "</td>" tableStr += "<td>" + str(order.get('small_quantity')) + "</td>" tableStr += "<td>" + str(order.get('large_quantity')) + "</td>" if float(order.get('total_paid')) > 0.0: isPaid = "Paid" buttonType = "success" else: isPaid = "Unpaid" if (is_not_overdue): buttonType = "primary" else: buttonType = "warning" tableStr += "<td><button id=\"paid_" + str( order.get('id') ) + "\" type=\"button\" class=\"label label-" + buttonType + "\">" + isPaid + "</td>" cost = 20.0 * float(order.get('large_quantity', 0)) + 15.0 * float( order.get('small_quantity', 0)) owe = cost - float(order.get('total_paid', 0.00)) tableStr += "<td>" + str(order.get('creation_date')) + "</td>" if (is_not_overdue and order.get('total_paid') == "0.00"): tableStr += "<td><button id=\"delete_" + str( order.get('id') ) + "\" type=\"button\" class=\"btn btn-danger\" onclick=\"deleteClicked(event);\">Delete</button></td>" tableStr += "</tr>" tableStr += "</tbody></table>" return tableStr