def __init__(self): self.customers = Customer.get_all() self.heads = customer_heads self.data = self.get_empty_data() self.add_data() self.names = self.data["name"] self.emails = self.data["email"] self.phones = self.data["phone"] self.addresses = self.data["address"]
def customers(): customers = Customer.get_all() autocomplete_data = [customer.name for customer in customers] placeholder = "Escribe el nombre o el email del cliente que buscas..." if request.method == "POST": search_term = request.form["search_term"] customer = Customer.search(search_term) if customer: return redirect(url_for('customer.profile', id=customer.id)) else: flash("No se encontró ningún cliente") return render_template('customer/customers.html', customers=customers, heads=customer_heads, autocomplete_data=autocomplete_data, placeholder=placeholder)