def show_requests(cls):
     admins = read_data_from_admins_database()
     r_box = admins['admins_inf']['requests_box']
     while len(r_box) > 0:
         os.system('clear')
         index = RefRequest.get_input_all_reqs_or_get_single_req()
         # print(index)
         try:
             RefRequest.browsing_single_request(index)
             continue
         except TypeError:
             break
     print("No requests!\n")
     inp = input("Press Enter to go back.\n")
     FuncNode.current_node()
    def get_input_all_reqs_or_get_single_req(cls):
        while True:

            admins = read_data_from_admins_database()
            r_box = admins['admins_inf']['requests_box']
            os.system('clear')
            if len(r_box) > 0:
                RefRequest.print_all_requests()
                inp = input(
                    "\nEnter the positional number to browse a single request.\n\n"
                    "Enter A to mark all requests as accepted.\n"
                    "Enter D to mark all requests as declined.\n"
                    "Enter E to execute all requests.\n"
                    "Enter R to go back.\n")

                try:
                    inp = int(inp)
                    if inp not in range(1, len(r_box) + 1):
                        print("Choose valid option.")
                        time.sleep(2)
                        continue
                    else:
                        index = inp - 1
                        return index

                except ValueError:
                    opts = ["a", "d", "r", "e"]
                    inp = inp.lower()
                    if inp not in opts:
                        print("Choose valid option.")
                        time.sleep(2)
                        continue
                    else:
                        if inp == "a":
                            for req in r_box:
                                req['approved'] = True
                                write_data_to_admins_database(admins)
                                continue
                        if inp == "d":
                            for req in r_box:
                                req['approved'] = False
                                write_data_to_admins_database(admins)
                                continue
                        if inp == "r":
                            return FuncNode.current_node()
                        if inp == "e":
                            users = read_data_from_users_database()
                            for r in r_box:
                                for user in users['users']:
                                    if user['username'] == r['username']:
                                        if r["approved"]:
                                            user["wallet"] += r["amount"]
                                            user["notifications"].append(
                                                f"Your request for {r['amount']} points has been accepted."
                                            )
                                            print("\nRequest executed.\n")
                                        else:
                                            print(
                                                "The request is not approved.")
                                            print("Deleting the request.")
                                            time.sleep(3)
                                            user["notifications"].append(
                                                f"Your request for {r['amount']} points has been rejected."
                                            )
                                        admins = read_data_from_admins_database(
                                        )
                                        del admins['admins_inf'][
                                            'requests_box'][:]
                                        del admins['admins_inf'][
                                            'notifications'][:]
                                        write_data_to_users_database(users)
                                        write_data_to_admins_database(admins)
            else:
                # print("There are no new requests.")
                time.sleep(2)
                return