def is_valid_create(self): if self._client_exist(): Alert.raise_danger_alert('Client Exist') elif not self._is_valid(): pass else: return True return False
def _is_valid(self): if not self._name_is_valid(): Alert.raise_danger_alert('Invalid Name, Please use only letters') elif not self._contact_phone_is_valid(): Alert.raise_danger_alert( 'Invalid Phone Number, Please use only numbers') else: return True return False
def _is_valid_login(user, password): if user is None: Alert.raise_danger_alert('Incorrect User') return False elif not check_password_hash(user['password'], password): Alert.raise_danger_alert('Incorrect Password') return False else: return True
def dashboard(): configuration = config.Config() if g.user is None: Alert.raise_danger_alert('Not Logged In') return redirect(url_for('authentication.login')) else: return render_template('dashboard/index.html', configuration=configuration)
def is_valid(self, branchId): cart = ShoppingCart() if self.operationType == 'credit' and not self._client_has_discount(): Alert.raise_danger_alert("Client has no Discount") return False elif self._is_empty_sale(): Alert.raise_danger_alert('Empty Sale') return False elif self.payMethod == 'Cash' and not self._cash_is_enough(): Alert.raise_danger_alert('Cash is Not Enought') return False elif not cart.there_is_enought_stock(branchId): Alert.raise_danger_alert('Not Enought Stock') return False else: return True
def _is_valid(self): if self._article_name_exists(): Alert.raise_danger_alert("Article Exist") return False else: return True
def is_valid(self): if self._category_exist(): Alert.raise_danger_alert('Category Exist') return False else: return True
def is_valid(self): if self._user_exist(): Alert.raise_danger_alert('User Exist') return False else: return True