Ejemplo n.º 1
0
    def deactivate(self):
        if (self.type.text == "Employee"):
            if db.get_emp_id(self.email.text) != None:
                self.id = db.get_emp_id(self.email.text)
                db.delete_user("Employee", self.id)
                self.pop_up("Deactivated",
                            "The selected account has been deactivated")
                self.email.text = ""
                self.type.text = ""
            else:
                self.pop_up(
                    "Bad Data",
                    "The user email provided could not be found in the system")
        elif (self.type.text == "Patient"):

            if db.get_pat_id(self.email.text) != None:
                self.id = db.get_pat_id(self.email.text)
                db.delete_user("Patient", self.id)
                self.pop_up("Deactivated",
                            "The selected account has been deactivated")
                self.email.text = ""
                self.type.text = ""
            else:
                self.pop_up(
                    "Bad Data",
                    "The user email provided could not be found in the system")
        else:
            self.pop_up("Bad Data", "Invalid User Type")
Ejemplo n.º 2
0
 def get_input(self):
     dr_id = db.get_emp_id(self.dr_email.text)
     hy_id = db.get_emp_id(self.hy_email.text)
     pat_id = db.get_pat_id(self.pat_email.text)
     if (dr_id == None):
         self.pop_up("Bad Input", "The provided doctor could not be found")
     elif (hy_id == None):
         self.pop_up("Bad Input",
                     "The provided hygenist could not be found")
     elif (pat_id == None):
         self.pop_up("Bad Input", "The provided patient could not be found")
     else:
         maw.dr_info[0] = self.dr_email.text
         maw.dr_info[1] = self.hy_email.text
         plw.user_info[0] = pat_id
         plw.user_info[2] = self.pat_email.text
         plw.user_info[3] = self.descrp.text
         calendar.window = "st_home"
         wm.screen_manager.current = "calendar"
Ejemplo n.º 3
0
 def employee_scheduled(self, j, i, day, emp):
     dr_id = db.get_emp_id(emp)
     list = db.view_user_schedule(dr_id, "Employee")
     # build a string of format "2019-10-30-11" "yr-mon-day-strTime"
     cur_app = ("{}-{}-{}-{}".format(self.year, self.month, day, j + 8))
     # if the employee is busy
     for app in list:
         dr_schedule = ("{}-{}".format(app[0], app[1]))
         if (dr_schedule == cur_app):
             return False
     return True
Ejemplo n.º 4
0
    def login(self):
        # retrieve user entered data
        passw = self.password.text
        em = self.email.text

        # check if the credentials are correct
        if(db.is_user(em, passw, "Admin")):
            user_info[0] = db.get_emp_id(em)
            user_info[1] = "Admin"
            user_info[2] = em
            wm.screen_manager.current = "admin_action"

        # inform user that password or email was incorrect
        else:
            self.invalid_admin_login()
Ejemplo n.º 5
0
 def view_schedule(self):
     if (self.type.text == "Employee"):
         if (db.get_emp_id(self.email.text) != None):
             pa.email = self.email.text
             pa.type = self.type.text
             self.email.text = ""
             self.type.text = ""
             wm.screen_manager.current = "patient_apps"
     if (self.type.text == "Patient"):
         if db.get_pat_id(self.email.text) != None:
             pa.email = self.email.text
             pa.type = self.type.text
             self.email.text = ""
             self.type.text = ""
             wm.screen_manager.current = "patient_apps"
Ejemplo n.º 6
0
    def login(self):
        em = self.email.text
        passw = self.password.text

        if(db.is_user(em, passw, "Employee")):
            self.reset_inputs()
            user_info[0] = db.get_emp_id(em)
            user_info[1] = "Employee"
            user_info[2] = em

            # Check is the users schedule has been edited
            if(db.has_notification("Employee", user_info[0]) == 1):
                self.pop_up("Schedule Change", "Your Schedule has changed since you last \nloged in. Please review your new schedule\ndisplayed on the homepage.")
            wm.screen_manager.current = "st_home"
        else:
            self.pop_up("Login Failed", "The email or password provided was not correct.")
Ejemplo n.º 7
0
    def get_app(self):
        global email, type

        for item in self.labels:
            self.remove_widget(item)
        pos_x = .035
        pos_y = .75
        schedule = []
        if type == "Patient":
            schedule = db.view_user_schedule(int(db.get_pat_id(email)),
                                             "Patient")

            cur_time = ("{}{}{}{}".format(self.time.tm_year, self.time.tm_mon,
                                          self.time.tm_mday,
                                          self.time.tm_hour))
            if (len(schedule) != 0):
                self.appointment.text = ""
                for app in schedule:
                    temp = app[0].split("-")
                    temp2 = app[1].split(":")
                    app_time = 0
                    if (int(temp2[0]) < 10):
                        app_time = "{}{}{}0{}".format(temp[0], temp[1],
                                                      temp[2], temp2[0])
                    else:
                        app_time = "{}{}{}{}".format(temp[0], temp[1], temp[2],
                                                     temp2[0])
                    if (int(app_time) >= int(cur_time)):
                        line1 = "Date: {}".format(app[0])
                        line2 = "Time: {}".format(app[1])
                        line3 = "Description: {}".format(app[3])
                        line4 = "Dr: {} {}\nHygienist: {} {}".format(
                            app[4], app[5], app[6], app[7])
                        line5 = "{}\n{}:00\n{}\n{}\n\n".format(
                            line1, line2, line3, line4)

                        lbl = Label(text=line5,
                                    font_size=15,
                                    pos_hint={
                                        "x": pos_x,
                                        "y": pos_y
                                    },
                                    size_hint=(.225, .125),
                                    color=[255, 255, 255, 1])
                        self.labels.append(lbl)

                        self.add_widget(lbl)
                        pos_y -= .185
                        if ((len(self.labels)) % 3 == 0):
                            pos_x += .225
                            pos_y = .75
            else:
                self.appointment.text = "No Appointments Scheduled"
        else:
            schedule = db.view_user_schedule(int(db.get_emp_id(email)),
                                             "Employee")
            cur_time = ("{}{}{}{}".format(self.time.tm_year, self.time.tm_mon,
                                          self.time.tm_mday,
                                          self.time.tm_hour))
            if (len(schedule) != 0):
                self.appointment.text = ""
                for app in schedule:
                    # run a check to see if app has passed
                    temp = app[0].split("-")
                    temp2 = app[1].split(":")
                    app_time = 0
                    if (int(temp2[0]) < 10):
                        app_time = "{}{}{}{}0".format(temp[0], temp[1],
                                                      temp[2], temp2[0])
                    else:
                        app_time = "{}{}{}{}".format(temp[0], temp[1], temp[2],
                                                     temp2[0])
                    if (int(cur_time) < int(app_time)):
                        line1 = "Date: {}".format(app[0])
                        line2 = "Time: {}".format(app[1])
                        line3 = "Description: {}".format(app[3])
                        line4 = "With: {} {}".format(app[4], app[5])
                        self.appointment.text += "{}\n {}:00\n {}\n {}\n\n".format(
                            line1, line2, line3, line4)
            else:
                self.appointment.text = "No Current Appointments."