Exemplo n.º 1
0
    def view_customer(self, customer):
        """ Hér er hægt að framkvæma fjórar aðgerðir fyrir viðskiptavin.
            1. Sjá pantanir, hér er hægt að sjá allar pantanir sem þessi viðskiptavinur hefur skráð á sig.
            2. Breyta skráningu, hér er hægt að breyta skráningu viðskiptavinar með hjálp customer_update_info fallinu í CustomerService
               klasanum.
            3. Afskrá viðskiptavin, hér er viðskiptavinurinn tekinn út úr kerfinu og allar þær pantanir sem eru ókláraðar eyðast úr
               kerfinu líka.
            4. Skrá pöntun á viðskiptavin, hér er hoppað beint inn í make_order_info fallið í OrderService klasanum og 
               viðskiptavinurinn líka svo það þurfi ekki að velja hann aftur."""
        loop = True
        while loop:
            prompt = "Heimasíða / Viðskiptavinir / Skoða viðskiptavin"
            print_header(prompt)
            print(customer)
            print('=' * 70)
            choice = input(
                "\n1.  Sjá pantanir\n2.  Breyta skráningu\n3.  Afskrá viðskiptavin\n4.  Skrá pöntun á viðskiptavin\nt.  Tilbaka\nh.  Heim\n"
            ).lower()
            if choice == "1":
                prompt += " / Sjá pantanir"
                print_header(prompt)
                customer_orders = self.__customer_service.customer_get_history(
                    customer)
                if customer_orders:
                    for order in customer_orders:
                        print(order)
                        print()
                    input('Ýttu á "Enter" til að halda áfram: ')
                else:
                    print("Þessi viðskiptavinur hefur enga notkunarsögu.")
                    sleep(2)
            elif choice == "2":
                prompt += " / Breyta skráningu"
                print_header(prompt)
                self.__customer_service.customer_update_info(customer)
            elif choice == "3":
                prompt += " / Afskrá viðskiptavin"
                print_header(prompt)
                choice = input("Ertu viss?(j/n): ")
                if choice == "j":
                    self.__customer_service.customer_delete(customer)
                    return "Tilbaka", False
            elif choice == "4":
                prompt += " / Skrá pöntun á viðskiptavin"
                print_header(prompt)
                self.__order_service = OrderService()
                new_order = self.__order_service.make_order_info(
                    prompt, customer)
                if type(new_order) == Order:
                    self.__order_ui = OrderUI()
                    self.__order_ui.view_order(new_order)
                else:
                    if new_order == "h":
                        return "Heim", True

                self.__customer_service.update_order_repo()
            elif choice == "t":
                return "Tilbaka", False
            else:
                return "Heim", True
Exemplo n.º 2
0
class CustomerUI:
    def __init__(self):
        self.__customer_service = CustomerService()
        # self.customer_menu()

    def customer_menu(self):
        """ Hér er hægt að framkvæma tvær aðgerðir sem koma viðskiptavinum við.
            1. Leita að viðskiptavin, hér tekur CustomerService klasinn við kennitölu, athugar hvort það sé til viðskiptavinur
               í kerfinu með þessa kennitölu og skilar viðeigandi viðskiptavin. Þegar viðskiptavinur hefur verið valinn er hann
               sentur í view_customer fallið.
            2. Skrá nýjan viðskiptavin, sjá customer_register í CustomerService klasanum. """
        done = False
        while not done:
            prompt = "Heimasíða / Viðskiptavinir"
            print_header(prompt)
            action = input(
                "1.  Leita að viðskiptavin\n2.  Skrá nýjan viðskiptavin\nh.  Heim\n"
            )
            if action == "1":
                exit_info = ""
                prompt += " / Leita að viðskiptavin"
                while exit_info == "":
                    print_header(prompt)
                    ssn = input("Kennitala: ").lower()
                    if ssn == "h":
                        done = True
                        break
                    elif ssn == "t":
                        break
                    customer = self.__customer_service.check_ssn(ssn)
                    if customer:
                        exit_info, done = self.view_customer(customer)
                    else:
                        choice = input(
                            'Kennitalan: "{}" fannst ekki í kerfinu.\n1.  Reyna aftur\nt.  Tilbaka\nh.  Heim\n'
                            .format(ssn))
                        if choice == "t":
                            break
                        elif choice == "h":
                            done = True
                            break
            elif action == "2":
                prompt += " / Skrá nýjan viðskiptavin"
                print_header(prompt)
                new_customer = self.__customer_service.customer_register()
                if type(new_customer) == Customer:
                    exit_info, done = self.view_customer(new_customer)
                elif new_customer == "h":
                    done = True

            else:
                done = True

    def view_customer(self, customer):
        """ Hér er hægt að framkvæma fjórar aðgerðir fyrir viðskiptavin.
            1. Sjá pantanir, hér er hægt að sjá allar pantanir sem þessi viðskiptavinur hefur skráð á sig.
            2. Breyta skráningu, hér er hægt að breyta skráningu viðskiptavinar með hjálp customer_update_info fallinu í CustomerService
               klasanum.
            3. Afskrá viðskiptavin, hér er viðskiptavinurinn tekinn út úr kerfinu og allar þær pantanir sem eru ókláraðar eyðast úr
               kerfinu líka.
            4. Skrá pöntun á viðskiptavin, hér er hoppað beint inn í make_order_info fallið í OrderService klasanum og 
               viðskiptavinurinn líka svo það þurfi ekki að velja hann aftur."""
        loop = True
        while loop:
            prompt = "Heimasíða / Viðskiptavinir / Skoða viðskiptavin"
            print_header(prompt)
            print(customer)
            print('=' * 70)
            choice = input(
                "\n1.  Sjá pantanir\n2.  Breyta skráningu\n3.  Afskrá viðskiptavin\n4.  Skrá pöntun á viðskiptavin\nt.  Tilbaka\nh.  Heim\n"
            ).lower()
            if choice == "1":
                prompt += " / Sjá pantanir"
                print_header(prompt)
                customer_orders = self.__customer_service.customer_get_history(
                    customer)
                if customer_orders:
                    for order in customer_orders:
                        print(order)
                        print()
                    input('Ýttu á "Enter" til að halda áfram: ')
                else:
                    print("Þessi viðskiptavinur hefur enga notkunarsögu.")
                    sleep(2)
            elif choice == "2":
                prompt += " / Breyta skráningu"
                print_header(prompt)
                self.__customer_service.customer_update_info(customer)
            elif choice == "3":
                prompt += " / Afskrá viðskiptavin"
                print_header(prompt)
                choice = input("Ertu viss?(j/n): ")
                if choice == "j":
                    self.__customer_service.customer_delete(customer)
                    return "Tilbaka", False
            elif choice == "4":
                prompt += " / Skrá pöntun á viðskiptavin"
                print_header(prompt)
                self.__order_service = OrderService()
                new_order = self.__order_service.make_order_info(
                    prompt, customer)
                if type(new_order) == Order:
                    self.__order_ui = OrderUI()
                    self.__order_ui.view_order(new_order)
                else:
                    if new_order == "h":
                        return "Heim", True

                self.__customer_service.update_order_repo()
            elif choice == "t":
                return "Tilbaka", False
            else:
                return "Heim", True
Exemplo n.º 3
0
 def __init__(self):
     self.__OrderService = OrderService()
     self.__CarService = CarService()
     self.__CustomerService = CustomerService()
Exemplo n.º 4
0
class Put_In_Order_UI:
    def __init__(self):
        self.__OrderService = OrderService()
        self.__CarService = CarService()
        self.__CustomerService = CustomerService()

    def Put_In_Order_Menu(self):
        def print_Choices():
            print('\nPress 1 To Put In Order')
            print('Press 2 To Put In A Future Order\n')

        def new_Or_Old():
            '''Is the Customer new or has he rented from us before'''
            print("-" * 80)
            new_Or_Old = input(
                'Has The Customer Rented From Us Before? (Y = Yes, N = No) '
            ).lower()
            while new_Or_Old != 'y' or 'n':
                if new_Or_Old == 'y':
                    print()
                    break
                elif new_Or_Old == 'n':
                    print("\nSigning A New Customer:")
                    print("-" * 80)
                    SSN_input = input(
                        'Enter The SSN Of The Person Who Is Putting In An Order: '
                    )
                    SSN = self.__CustomerService.check_SSN(SSN_input)
                    # isFound iterates through the file and if there is not match it will allow the user to try again
                    isfound = self.__CustomerService.check_Costumer(SSN)
                    if isfound:
                        print('\nCustomer Already Exists!'
                              )  #we dont need to sign him up
                    else:
                        name = input('Enter A Name: ')
                        phonenumber_input = input('Enter A Phone Number: ')
                        phonenumber = self.__CustomerService.check_Phonenumber(
                            phonenumber_input)
                        email = input('Enter An Email: ')
                        new_Costumer = Customer(SSN, name, phonenumber, email)
                        self.__CustomerService.add_customer(new_Costumer)
                        print("\nCostumer Signed!\n\n")
                        break
                else:
                    print('Invalid Input, Try Again!')
                    new_Or_Old = input(
                        'Has The Customer Rented A Car From Us Before? (Y = Yes, N = No) '
                    ).lower()

        def available_Categories():
            print("-" * 80)
            loop = True
            while loop:
                print(
                    '\nWhat Kind Of Car Do You Want? (M = Mini car, S = Station car, J = Jeep'
                )
                car_choice = input('Choose A Category: ').lower()
                if car_choice == 'm':
                    print("-" * 80)
                    car_choice = 'Mini Car'
                    print('\nThese Mini Cars Are Available:\n')
                    self.__OrderService.pick_a_category(car_choice)
                    loop = False
                elif car_choice == 's':
                    print("-" * 80)
                    car_choice = 'Station Car'
                    print('\nThese Station Cars Are Available:\n')
                    self.__OrderService.pick_a_category(car_choice)
                    loop = False
                elif car_choice == 'j':
                    print("-" * 80)
                    car_choice = 'Jeep'
                    print('\nThese Jeeps Are Available:\n')
                    self.__OrderService.pick_a_category(car_choice)
                    loop = False
                else:
                    print('Invalid Input, Try Again!\n')
            print("-" * 80)

        def rent_Dates():
            rent_year = int(input('\nEnter Rent Year: '))
            car_rent_year = self.__OrderService.check_year(rent_year)
            rent_month = int(input('Enter Rent Month: '))
            car_rent_month = self.__OrderService.check_month(rent_month)
            rent_day = int(input('Enter Rent Day: '))
            car_rent_day = self.__OrderService.check_days(rent_day)
            return_year = int(input('\nEnter Return Year: '))
            car_return_year = self.__OrderService.check_year(return_year)
            return_month = int(input('Enter Return Month: '))
            car_return_month = self.__OrderService.check_month(return_month)
            return_day = int(input('Enter Return Day: '))
            car_return_day = self.__OrderService.check_days(return_day)
            return car_rent_year, car_rent_month, car_rent_day, car_return_year, car_return_month, car_return_day

        def credit_Card():
            cardholder = input("\nEnter The Cardholder's Name: ")
            card = input('Enter Your Card Number: ')
            while len(card) != 16:
                print('Invalid Input, Try Again! (only 16 digits)\n')
                card = input('Enter Your Card Number: ')
            exp_date = input('Enter The Expiration Date: (mm-yy) ')
            sec_num = input('Enter The Security Number: ')
            print('\nPayment Completed!')

        # Press 1 To Put In Order
        def action1():
            today = datetime.today().date()
            print('\nToday: {:}'.format(today))
            print('Are There Any Orders You have To Activate Today?\n')
            self.__OrderService.print_out_future_orders(
            )  # Print Out All The Future Orders
            available_Categories()
            SSN_input = input(
                'Enter The SSN Of The Person Who Is Putting In An Order: ')
            SSN = self.__CustomerService.check_SSN(SSN_input)
            self.__OrderService.remove_from_future_orders(SSN)
            licence_Plate = input(
                '\nEnter The Licence Plate Of The Car: ').upper()
            isFound = self.__OrderService.check_Car(licence_Plate)
            while not isFound:
                print("Car Not Found, Please Try Again!")
                licence_Plate = input(
                    'Enter The Licence Plate Of The Car: ').upper()
                isFound = self.__OrderService.check_Car(licence_Plate)
            car_rent_year, car_rent_month, car_rent_day, car_return_year, car_return_month, car_return_day = rent_Dates(
            )
            loop = True
            while loop:
                if car_return_day == car_rent_day and car_return_month == car_rent_month:
                    print(
                        "\nSorry You Can't Rent For Only One Day! Please Try Again\n"
                    )
                    car_return_month = int(input('Enter Return Month: '))
                    car_return_month = self.__OrderService.check_month(
                        car_return_month)
                    car_return_day = int(input('Enter Return Day: '))
                    car_return_day = self.__OrderService.check_days(
                        car_return_day)
                else:
                    loop = False
            extra_insurance = input(
                '\nDo You Want Extra Insurance: (Y = Yes, N = No) ').lower()
            if extra_insurance == 'y':
                print('\nWe Need Your Credit Card Number Please\n')
                credit_card = input('Enter Your Credit Card Number: ')
                while len(credit_card) != 16:
                    print('Invalid Input, Try Again! (only 16 digits)\n')
                    credit_card = input('Enter Your Credit Card Number: ')
            while extra_insurance not in ['y', 'n']:
                print('Invalid Input, Try Again!')
                extra_insurance = input(
                    '\nDo You Want Extra Insurance: (Y = Yes, N = No) ').lower(
                    )
            payment = input(
                '\nAre You Paying With A Card Or Cash: (1 = Card, 2 = Cash): ')
            if payment == '1':
                credit_Card()
            if payment == '2':
                print('Payment Completed!')
            self.__OrderService.put_in_an_order(SSN, licence_Plate,
                                                car_rent_year, car_rent_month,
                                                car_rent_day, car_return_year,
                                                car_return_month,
                                                car_return_day,
                                                extra_insurance)
            print('\nOrder Added!')

        # Press 2 To Put In A Future Order
        def action2():
            print("-" * 80)
            SSN_input = input('Enter The SSN: ')
            SSN = self.__CustomerService.check_SSN(SSN_input)
            Name = input('Enter Name: ')
            category_inp = input(
                'Enter The Category (M = Mini Car, S = Station Car, J = Jeep): '
            ).lower()
            Category = self.__CarService.check_Category(
                category_inp)  #Check if the category is valid
            car_rent_year, car_rent_month, car_rent_day, car_return_year, car_return_month, car_return_day = rent_Dates(
            )
            loop = True
            while loop:
                if car_return_day == car_rent_day and car_return_month == car_rent_month:
                    print(
                        "\nSorry You Can't Rent For Only One Day! Please Try Again\n"
                    )
                    car_return_month = int(input('Enter Return Month: '))
                    car_return_month = self.__OrderService.check_month(
                        car_return_month)
                    car_return_day = int(input('Enter Return Day: '))
                    car_return_day = self.__OrderService.check_days(
                        car_return_day)
                else:
                    loop = False
            extra_insurance = input(
                'Do You Want Extra Insurance: (Y = Yes, N = No) ').lower()
            while extra_insurance not in ['y', 'n']:
                print('Invalid Input, Try Again!')
                extra_insurance = input(
                    '\nDo You Want Extra Insurance: (Y = Yes, N = No) ').lower(
                    )
            self.__OrderService.put_in_future_order(
                SSN, Name, Category, car_rent_year, car_rent_month,
                car_rent_day, car_return_year, car_return_month,
                car_return_day, extra_insurance)
            print("\nOrder Added!")

        def main():
            new_Or_Old()
            print_Choices()
            action = ""
            while action not in ["1", "2"]:
                action = input('Choose Command: ').lower()
                # Press 1 to Put In Order
                if action == '1':
                    action1()
                # Press 2 to Put In Future Order
                elif action == '2':
                    action2()
                else:
                    print('\nInvalid Input, Try Again!\n')

        main()
Exemplo n.º 5
0
class OrderUI:
    def __init__(self):
        self.__order_service = OrderService()
        # self.order_menu()

    def order_menu(self):
        """ Hér er hægt að framkvæma þrjár aðgerðir sem koma pöntunum við.
            1. Skoða pöntun, hér þarf að setja inn pöntunarnúmer og OrderService klasinn athugar hvort það sé til pöntun með
               þessu númeri og skilar viðeigandi pöntun. Þegar pöntun hefur verið valin er hægt að framkvæma tvær aðgerðir, annað
               hvort uppfæra upplýsingar hennar eða afskrá hana.
            2. Skrá nýja pöntun, fer beint í fallið make_order_info í OrderService klasanum.
            3. Klára pantanir dagsins fer í fallið complete_orders í Orderservice klasanum. """
        done = False
        while not done:
            prompt = "Heimasíða / Skoða eða skrá pantanir"
            print_header(prompt)
            action = input("1.  Skoða pöntun\n2.  Skrá nýja pöntun\n3.  Klára pantanir dagsins\nh.  Heim\n")
            if action == "1":
                prompt += " / Skoða pöntun"
                print_header(prompt)
                exit_info = ""
                while exit_info == "":
                    order_name = input("Pöntunarnúmer: ")
                    if order_name == "t":
                        break
                    elif order_name == "h":
                        done = True
                        break
                    order = self.__order_service.get_order_by_name(order_name)
                    print_header(prompt)
                    if order:
                        exit_info, done = self.view_order(order)
                    else:
                        choice = input('Pöntunin: "{}" fannst ekki í kerfinu.\n1.  Reyna aftur\nt.  Tilbaka\nh.  Heimasíða\n'.format(order_name))
                        if choice == "t" or choice == "h":
                            if choice == "h":
                                done = True
                            exit_info = "Tilbaka"
            elif action == "2":
                finished = False
                while not finished:
                    prompt = "Heimasíða / Skoða eða skrá pantanir / Skrá nýja pöntun"
                    print_header(prompt)
                    new_order = self.__order_service.make_order_info(prompt, False)
                    if type(new_order) == Order:
                        finished, done = self.view_order(new_order)
                    else:
                        if new_order == "t":
                            finished = True
                        elif new_order == "h":
                            finished = True
                            done = True
            elif action == "3":
                prompt += " / Klára pantanir dagsins"
                print_header(prompt)
                choice = self.__order_service.complete_orders(prompt)
                if choice == "h":
                    done = True
            else:
                done = True

    def view_order(self, order):
        loop = True
        while loop:
            prompt = "Heimasíða / Skoða eða skrá pantanir / Skoða pöntun"
            print_header(prompt)
            print(order)
            print('='*60)
            choice = input("\n1.  Uppfæra pöntun\n2.  Eyða pöntun\nt.  Tilbaka\nh.  Heim\n")
            if choice == "1":
                prompt += " / Uppfæra Pöntun"
                self.__order_service.change_order_info(order, prompt)
                # exit_info = "Pöntun uppfærð"
            elif choice == "2":
                prompt += " / Eyða pöntun"
                print_header(prompt)
                choice = input("Ertu viss? (j/n): ")
                if choice == "j":
                    self.__order_service.order_delete(order)
                    return "Tilbaka", False
            elif choice == "t":
                return "Tilbaka", False
            else:
                return "Heim", True
Exemplo n.º 6
0
 def __init__(self):
     self.__order_service = OrderService()
Exemplo n.º 7
0
 def __init__(self):
     self.__car_service = CarService()
     self.__car_ui = CarUi()
     self.__order_service = OrderService()
     self.__customer_service = CustomerService()
     self.__customer_repo = CustomerRepository()
Exemplo n.º 8
0
class OrdercarUi:
    def __init__(self):
        self.__car_service = CarService()
        self.__car_ui = CarUi()
        self.__order_service = OrderService()
        self.__customer_service = CustomerService()
        self.__customer_repo = CustomerRepository()

    def header(self, i):
        print("-" * 50)
        print("|{:^48}|".format(i))
        print("-" * 50)
        print()

    def print_receipt(self, order):
        """
        Prints out the receipt for a customer and shows a few details (e. price)
        :param order:
        :return:
        """
        car = self.__car_service.get_car_by_license(order["License"])
        customer = self.__customer_service.get_customer_by_kt(order["Kt"])

        receipt = """
Customer

                PPN/Kt: {i:<30}
                  Name: {name:<30}
                E-Mail: {mail:<30}
          Phone number: {phone:<30}
       Driving license: {license:<30}
                   Age: {age:<30}
               Country: {country:<30}
               Address: {address:<30}
                                                                From day: {from_day:<8}
                                                                  To day: {to_day:<8}

     Car                                |     Per day     |   Quantity   |     Total
  -----------------------------------------------------------------------------------

         License plate: {car_license:<20}
                 Model: {car_model:<20}
                  Type: {car_type:<20}
                 Class: {car_class:<20}
                 Seats: {car_seats:<20}
                   4x4: {car_fwd:<20}
          Transmission: {car_transmission:<20}
          Price of car: {car_price:<20}{car_price:>6} kr.{order_days:^20}{car_order_price:>7} kr.
             Insurance: {order_insurance:<20}{insurance_price:>6} kr.{order_days:^20}{insurance_order_price:>7} kr.
               Penalty: {order_penalty:>57} kr.

           Total price: ------------------------------------------------- {order_price} kr.

                                        """
        if order["Insurance"] == "No":
            i_price = 0
            t_price = 0
        else:
            i_price = int(car["Price"]) * 0.25
            t_price = (int(car["Price"]) * 0.25) * int(order["Days"])

        output = receipt.format(i=customer["Passport number"],
                                name=customer["Name"],
                                mail=customer["Mail"],
                                address=customer["Address"],
                                country=customer["Country"],
                                license=customer["license"],
                                age=customer["Age"],
                                phone=customer["Phone number"],
                                car_license=car["License"],
                                car_model=car["Model"],
                                car_type=car["Type"],
                                car_class=car["Class"],
                                car_seats=car["Seats"],
                                car_fwd=car["4x4"],
                                car_transmission=car["Transmission"],
                                car_price=car["Price"],
                                price=order["Price"],
                                order_insurance=order["Insurance"],
                                order_days=order["Days"],
                                order_price=order["Total price"],
                                car_order_price=(int(car["Price"]) *
                                                 int(order["Days"])),
                                insurance_order_price=round(t_price),
                                insurance_price=round(i_price),
                                from_day=order["From date"],
                                to_day=order["To date"],
                                order_penalty=round(float(order["Penalty"])))
        print(output)

    @staticmethod
    def calculate_days(from_date, to_date):
        """
        Calulates how many days the customer have used the car. from and to
        :param from_date:
        :param to_date:
        :return:
        """
        # Calculate how long the order is in days
        from_date = datetime.datetime.date(from_date)
        to_date = datetime.datetime.date(to_date)
        delta = to_date - from_date
        return delta.days  # how many days the rental is

    def create_customer(self, kt):
        """
        This asks you for information about customer (e. Enter country)

        :param kt:
        :return:
        """
        name = input("\tEnter name: ").translate(remove_punct_map)
        country = input("\tEnter country: ").translate(remove_punct_map)
        address = input("\tEnter address: ").translate(remove_punct_map)
        mail = input("\tEnter mail: ").strip()
        phone = input("\tEnter phone number: ").translate(remove_punct_map)
        customer_license = input("\tEnter drivers license: ").translate(
            remove_punct_map)
        age = int(input("\tEnter age: "))
        new_customer = Customer(name, kt, country, address, mail, phone,
                                customer_license, age)
        self.__customer_service.add_customer(new_customer)
        return name

    def print_car_types(self):
        """
        Prints out the type of the car, we user the get car class to help us with this function
        :return:
        """
        cars = self.__car_service.get_car_class()
        if cars:
            print("\n\t", end="")
            for x in cars:
                print(str(x), end=' ')
            print()
            return True
        else:
            return False

    def rent_car(self):
        """
        This rents a car and ask the customer for a few details.
        :return:
        """
        self.header("Rent car")
        con = True
        while con:
            # self.__customer_service.list_all_customers()
            kt = input("Enter PPN/Kt(\33[;31mq to go back\33[;0m): ").lower(
            ).translate(remove_punct_map)
            if kt == "q":
                break
            elif input(
                    "Select this PPN/Kt(\33[;32mY\33[;0m/\33[;31mN\33[;0m): "
            ).format(kt).lower() == "y":
                con = False
                customer = self.__order_service.check_kt(kt)

                if customer:
                    self.__customer_service.print_customer(customer)
                else:
                    name = self.create_customer(kt)

                approved = False
                while not approved:
                    from_date = self.__car_service.user_date(
                        "Enter start date for rent (dd/mm/yy): ")

                    is_valid = False
                    while not is_valid:

                        to_date = self.__car_service.user_date(
                            "Enter end date for rent (dd/mm/yy): ")

                        if from_date <= to_date:
                            is_valid = True

                        else:
                            print("Time traveling?")

                    car_type = self.__car_service.check_car_class(
                        "Enter class: \n\t\33[;36m1. Luxury\n\t2. Sport\n\t"
                        "3. Off-road\n\t4. Sedan\n\t5. Economy\33[;0m\n"
                        "Select class: ", "Invalid input")
                    available_cars_type = self.__car_service.get_available_date_type(
                        car_type, from_date, to_date)

                    if not available_cars_type:
                        i = input(
                            "No cars available,(\33[;31mpress q to quit\33[;0m,\33[;32m"
                            " enter to select another date\33[;0m)")
                        if i == "q":
                            break
                    if car_type and available_cars_type:
                        while not approved:
                            print("\nAvailable cars\n")
                            c_id = self.__car_ui.print_cars(
                                available_cars_type)
                            if c_id.lower() == 'q':
                                print(
                                    "\nCanceled, please select another date\n")
                                break
                            try:
                                if c_id.isdigit():
                                    c_id = int(c_id)
                                    selected_car = available_cars_type[c_id -
                                                                       1]
                                    chosen_car_plate = selected_car["License"]
                                    price_of_order = int(selected_car["Price"])

                                    print("\nSelected car: {}\n".format(
                                        chosen_car_plate))

                                    days = self.calculate_days(
                                        from_date, to_date)
                                    if days == 0:
                                        days = 1
                                    price_of_order_days = price_of_order * days  # Price for car multiplied with days

                                    print("Price of order: {} ISK".format(
                                        int(price_of_order_days)))
                                    insurance = input(
                                        "Would you like extra insurance for {} {}"
                                        .format  # Insurance (Yes or No)
                                        (int(price_of_order * 0.25),
                                         "ISK per day? (\33[;32mY\33[;0m/"
                                         "\33[;31mN\33[;0m): ")).upper()
                                    price_of_order_days_insurance = price_of_order_days

                                    if insurance == 'Y':
                                        price_of_order_days_insurance = price_of_order_days * 1.25  # Price of order with extra insurance
                                        print("Price of order: {} ISK".format(
                                            int(price_of_order_days_insurance))
                                              )
                                        deposit = price_of_order_days_insurance * 0.10
                                    else:
                                        deposit = price_of_order_days * 0.10

                                    print(
                                        "Your deposit of the order is {} ISK".
                                        format(int(deposit)))

                                    book = input(
                                        "Order car? (\33[;32mY\33[;0m/\33[;31mN\33[;0m): "
                                    ).upper()
                                    if book == 'Y':
                                        if customer:
                                            name = customer["Name"]

                                        new_order = Order(
                                            kt, name, chosen_car_plate,
                                            from_date, to_date,
                                            price_of_order_days, insurance,
                                            price_of_order_days_insurance,
                                            days)
                                        self.__order_service.add_order(
                                            new_order, False)
                                        print("\nOrder successful!\n")
                                        approved = True
                                    else:
                                        print("\nOrder canceled!\n")
                                else:
                                    print("\nPlease enter correct input")
                            except IndexError:
                                print("ID not available")
                input("\33[;32mPress enter to continue \33[;0m")

    def return_car(self):
        """
        Here will the car be returned.
        :return:
        """
        self.header("Return car")
        returning = True
        correct_km = True
        while returning:
            try:
                orders = self.__order_service.get_orders()
                if orders:
                    self.__order_service.print_current_orders(orders)
                    o_id = input(
                        "Select order by Id (\33[;31mq to go back\33[;0m): ")
                    if o_id.isdigit():
                        order = self.__order_service.get_order_by_id(int(o_id))
                        current_order = Order(
                            order["Kt"], order["Name"], order["License"],
                            order["From date"], order["To date"],
                            order["Price"], order["Insurance"],
                            order["Total price"], order["Days"])
                        print(current_order)
                        price = float(order["Total price"])
                        while correct_km:
                            current_order.set_penalty(0)
                            km_length = input("Enter the km driven: ")
                            if km_length.isdigit():
                                max_km = 100 * int(order["Days"])
                                penalty = 0
                                if int(km_length) > max_km:
                                    for x in range(int(km_length) - max_km):
                                        penalty += int(order["Price"]) / int(
                                            order["Days"]) * 0.01
                                current_order.set_price_insurance(price +
                                                                  penalty)
                                current_order.set_penalty(penalty)
                                self.__order_service.remove_order(o_id)
                                self.__order_service.add_order(
                                    current_order, True)
                                order = self.__order_service.get_order_by_id(
                                    int(o_id))
                                self.print_receipt(order)
                                if self.__order_service.pay_order(
                                        round(price), order):
                                    self.__order_service.remove_order(
                                        int(o_id))
                                    print("\nCar Returned!\n")
                                    input(
                                        "\33[;32mPress enter to continue \33[;0m"
                                    )
                                    returning = False
                                    correct_km = False
                                else:
                                    print("\nCar payment not accepted!\n")
                                break
                            else:
                                print("\nPlease enter a correct input\n")

                    elif o_id.lower() == 'q':
                        print("\nReturning order canceled\n")
                        input("\33[;32mPress enter to continue\33[;0m")
                        break
                    else:
                        print("\nPlease enter a correct input\n")
                else:
                    print("No cars in rent\n")
                    input("\33[;32mPress enter to continue \33[;0m")
                    break

            except Exception:
                print("\nPlease enter a correct input\n")

    def revoke_order(self):
        """
        Here the order will be revoked.
        :return:
        """
        self.header("Revoke order")
        try:
            orders = self.__order_service.get_orders()
            if orders:
                revoking = True
                while revoking:
                    self.__order_service.print_current_orders(orders)
                    o_id = input("Select order by Id (\33[;31mq to quit\33[;0m"
                                 "): ")
                    if o_id.isdigit():
                        order = self.__order_service.get_order_by_id(int(o_id))
                        if order:
                            print(
                                "Name: {} License of car: {} Total Price: {}".
                                format(order["Name"], order["License"],
                                       order["Total price"]))
                            total_price = float(order["Total price"])
                            print("Your deposit was {} ISK".format(
                                int(total_price * 0.10)))
                            choice = input(
                                "Are you sure you want to revoke the order? (\33[;32mY\33[;0m/\33[;31mN\33[;0m): "
                            ).lower()
                            if choice == 'y':
                                self.__order_service.remove_order(o_id)
                                print("\nOrder revoked and deposit returned\n")
                                revoking = False
                                break
                            else:
                                print("\nRevoke canceled\n")
                                revoking = False
                        else:
                            print("\n\33[;31mWrong input try again\33[;0m\n")
                    if o_id.lower() == 'q':
                        break
                    else:
                        print("\n\33[;31mWrong input try again\33[;0m\n")
            else:
                print("\nNo orders\n")
        except Exception:
            print("\nRevoke failed\n")
        input("\33[;32mPress enter to continue \33[;0m")

    def edit_current_order(self):
        """
        Here you cant edit a specific order by id (e. edit name)
        :return:
        """
        self.header("Edit order")
        orders = self.__order_service.get_orders()
        editing_order = True
        while editing_order:
            if orders:
                self.__order_service.print_current_orders(orders)
                o_id = input("Select order by Id (\33[;31mq to quit\33[;0m"
                             "): ")
                if o_id.lower() == 'q':
                    editing_order = False
                    break
                if o_id.isdigit():
                    order = self.__order_service.get_order_by_id(int(o_id))
                    if order:
                        edited_order = Order(
                            order["Kt"], order["Name"], order["License"],
                            order["From date"], order["To date"],
                            order["Price"], order["Insurance"],
                            order["Total price"], order["Days"])
                        a_choice = ''
                        while a_choice != 'q':
                            print(
                                "1. Edit PPN/Kt\n2. Edit name\n3. Car-license\n4. From date\n5. To date\n6. Price\n"
                                "7. Insurance\n8. Days\n\n"
                                "\33[;31mPress q to go back \33[;0m\n")
                            a_choice = input("Choose an option: ").lower()
                            if a_choice.lower() == 'q':
                                break
                            elif a_choice == "1":
                                edited_order.set_kt(
                                    input("Enter new Kt: ").translate(
                                        remove_punct_map))
                            elif a_choice == '2':
                                edited_order.set_renter(
                                    input("Enter new name: ").translate(
                                        remove_punct_map))
                            elif a_choice == '3':
                                edited_order.set_car(
                                    input("Enter new license: ").translate(
                                        remove_punct_map))
                            elif a_choice == '4':
                                edited_order.set_from_date(
                                    datetime.datetime.strftime(
                                        self.__car_service.user_date(
                                            "Enter new from date: "),
                                        "%d/%m/%y"))
                            elif a_choice == '5':
                                edited_order.set_to_date(
                                    datetime.datetime.strftime(
                                        self.__car_service.user_date(
                                            "Enter new to date: "),
                                        "%d/%m/%y"))
                            elif a_choice == '6':
                                edited_order.set_price(
                                    input("Enter new price: ").translate(
                                        remove_punct_map))
                            elif a_choice == '7':
                                edited_order.set_insurance(
                                    input(
                                        "Enter new insurance \33[;32mY\33[;0m/\33[;31mN\33"
                                        "[;0m: ").translate(remove_punct_map))
                            elif a_choice == '8':
                                edited_order.set_days(
                                    input("Enter number of days: ").translate(
                                        remove_punct_map))
                            else:
                                print(
                                    "\n\33[;31mWrong input try again\33[;0m\n")
                        self.__order_service.remove_order(o_id)
                        self.__order_service.add_order(edited_order, True)
                        print("\nOrder edited\n")
                        editing_order = False
                    else:
                        print("\n\33[;31mWrong input try again\33[;0m\n")
                else:
                    print("\n\33[;31mWrong input try again\33[;0m\n")
            else:
                print("No orders to edit\n")
                input("\33[;32mPress enter to continue \33[;0m")
                break
        input("\33[;32mPress enter to continue \33[;0m")

    def get_order_history_of_customer(self):
        """
        Gets order history of customer. and messages you if you have no orders
        :return:
        """
        self.header("Order history of customer")
        history = True
        while history:
            kt = input(
                "Enter PPN/Kt of the customer(\33[;31mq to go back\33[;0m): "
            ).upper()
            orders = self.__order_service.get_available_order_customer(kt)
            check_kt = self.__order_service.check_kt(kt)
            if kt == 'Q':
                history = False
            elif check_kt and orders:
                self.__order_service.print_completed_orders(orders)
                history = False
            elif not check_kt:
                print("\nCustomer does not exist\n")
            elif not orders:
                print("\nCustomer has no orders\n")
        input("\33[;32mPress enter to continue \33[;0m")

    def history_of_car(self):
        self.header("Order history of car")
        history = True
        while history:
            cars = self.__car_service.get_cars()

            car_id = self.__car_ui.print_cars(cars)
            if car_id.isdigit():
                car = self.__car_service.get_car_by_id(int(car_id))
                car_orders = self.__order_service.get_available_orders(
                    car["License"])
                if car and car_orders:
                    self.__order_service.print_completed_orders(car_orders)
                    history = False
                elif not car:
                    print("\nCar does not exist\n")
                elif not car_orders:
                    print("\nThe car has not been rented\n")
                    history = False
            elif car_id.lower() == 'q':
                break
        input("\33[;32mPress enter to continue \33[;0m")

    def completed_orders(self):
        """
        Here you can find a specific completed order
        :return:
        """
        self.header("Completed orders")
        try:
            completed_orders = self.__order_service.get_completed_orders()
            correct_id = True
            while correct_id:
                if completed_orders:
                    self.__order_service.print_completed_orders(
                        completed_orders)
                    o_id = input(
                        "Select the order you want to view (\33[;31mq to go back\33[;0m): "
                    )
                    if o_id.isdigit():
                        os.system('cls')
                        order = self.__order_service.get_completed_order_id(
                            int(o_id))
                        self.print_receipt(order)
                        correct_id = False
                    elif o_id.lower() == 'q':
                        correct_id = False
                        break
                    else:
                        print("\nPlease enter a correct input\n")
                else:
                    print("No orders are complete\n")
                    correct_id = False
        except Exception:
            print("Something went wrong")
        input("\33[;32mPress enter to continue\33[;0m")

    def main_menu(self):
        """
        This is the main menu for the Order car interface, this will offer you to choose (e. 1. Rent a car)
        
        :return:
        """
        action = ''
        while action != 'q':
            os.system('cls')
            self.header("Orders")
            print("You can do the following: ")
            print("1. Rent a car")
            print("2. Return car")
            print("3. Current orders")
            print("4. Completed orders")
            print("5. Revoke order")
            print("6. Edit order")
            print("7. List order history of car")
            print("8. List order history of customer")
            print("\n" "\33[;31mPress q to go back \33[;0m")

            action = input("\nChoose an option: ")
            if action == '1':
                self.rent_car()

            elif action == '2':
                self.return_car()

            elif action == '3':
                self.header("Current orders")
                orders = self.__order_service.get_orders()
                if orders:
                    self.__order_service.print_current_orders(orders)
                else:
                    print("\nNo orders\n")
                input("\33[;32mPress enter to continue \33[;0m")

            elif action == '4':
                self.completed_orders()

            elif action == '5':
                self.revoke_order()

            elif action == '6':
                self.edit_current_order()

            elif action == "7":
                self.history_of_car()

            elif action == '8':
                self.get_order_history_of_customer()
Exemplo n.º 9
0
class Order_UI:

    def __init__(self):
        self.__OrderService = OrderService()
        self.__CarService = CarService()
        self.__Customer = CustomerOptions()
        self.__CustomerService = CustomerService()

    def Order_Menu(self):
        def print_Choices():
            ''' Prints out everything you can do with orders in the system '''
            print('{:<40}{:>40}'.format('The Car Rental', 'F To Go to Frontpage'))
            print('-'*80)
            print("{:^80}".format('ORDERS'))
            print('-'*80)
            print('Press 1 to Put In Order')
            print('Press 2 to Cancel Order')
            print('Press 3 to Look Up Order')
            print('Press 4 to Change Order')
            print('Press 5 to Return Car')
            print('Press F to Go To Frontpage\n')

        # Press 2 to Cancel Order
        def action2():
            print("-"*80)
            SSN_input = input('Enter The SSN Of The Person Who Put In The Order: ')
            SSN = self.__CustomerService.check_SSN(SSN_input)
            print()
            # isFound iterates through the file and if there is not match it will allow the user to try again or quit
            isFound = self.__OrderService.check_Order(SSN)
            if isFound:
                self.__OrderService.cancel_Order(SSN)
                print('Order Canceled!')
            while not isFound:
                again = input("Order Not Found! (1 = Try Again, 2 = to Quit)")
                if again == '1':
                    SSN_input = input('\nEnter The SSN Of The Person Who Put In Order: ')
                    SSN = self.__CustomerService.check_SSN(SSN_input)
                    print()
                    isFound = self.__CustomerService.check_Costumer(SSN)
                    if isFound:
                        self.__OrderService.cancel_Order(SSN)
                        print('Order Canceled!')
                else:
                    print('Quitting..')
                    break

        # Press 3 to Look Up Order
        def action3():
            print("-"*80)
            SSN_input = input('Enter The SSN Of The Person Who Put In The Order: ')
            SSN = self.__CustomerService.check_SSN(SSN_input)
            print()
            # isFound iterates through the file and if there is not match it will allow the user to try again or quit
            isFound = self.__OrderService.check_Order(SSN)
            if isFound:
                print()
                self.__OrderService.look_up_order(SSN)
            while not isFound:
                again = input("Order Not Found! (1 = Try Again, 2 = to Quit) ")
                if again == '1':
                    SSN_input = input('Enter The SSN Of The Person Who Put In Order: ')
                    SSN = self.__CustomerService.check_SSN(SSN_input)
                    isFound = self.__CustomerService.check_Costumer(SSN)
                    if isFound:
                        print()
                        self.__OrderService.look_up_order(SSN)
                else:
                    print('Quitting..')
                    break

        # Press 4 to Change Order
        def action4():
            print("-"*80)
            SSN_input = input('Enter The SSN Of The Person Who Put In The Order: ')
            SSN = self.__CustomerService.check_SSN(SSN_input)
            # isFound iterates through the file and if there is not match it will allow the user to try again
            isFound = self.__CustomerService.check_Costumer(SSN)
            while not isFound:
                print("\nOrder Not Found! Please Try Again\n")
                SSN_input = input('Enter The SSN Of The Person Who Put In The Order: ')
                SSN = self.__CustomerService.check_SSN(SSN_input)
                isFound = self.__CustomerService.check_Costumer(SSN)
            print()
            self.__OrderService.look_up_order(SSN)
            print('\n\nPress 1 To Change Rent Date')
            print('Press 2 To Change Return Date')
            print('Press 3 To Change Extra Insurance (Y = Yes, N = No)\n')
            choice = input('Enter Choice: ')
            while choice not in ['1', '2', '3']:
                print('Invalid Input, Try Again!\n')
                choice = input('Enter Choice: ')
            if choice == '1' or choice == '2':
                print('Put In The Date In The Format yyyy-mm-dd\n')
            changes = input('Enter New Info: ').lower()
            self.__OrderService.change_Order(SSN, choice, changes)
            print('\nOrder Changed!')

        # Press 5 to Return Car
        def action5():
            print("-"*80)
            print('Return Car: \n')
            self.__OrderService.print_orders()
            plate = input('\nEnter The Licence Plate Of The Car You Want To Return: ')
            plate = plate.upper()
            self.__OrderService.return_car(plate)
            print('\nCar Returned!')

        def main():
            print_Choices()
            action = ""
            while action not in ["1", "2", "3", "4", "5", "F"]:
                action = input('Choose Command: ').lower()
                if action == '1':
                    # Press 1 to Put in order
                    ui = Put_In_Order_UI()
                    ui.Put_In_Order_Menu()
                # Press 2 to Cancel Order
                elif action == '2':
                    action2()
                # Press 3 to Look Up Order
                elif action == '3':
                    action3()
                # Press 4 to Change Order
                elif action == '4':
                    action4()
                # Press 5 to Return Car'
                elif action == '5':
                    action5()
                # Press F to Go To Frontpage
                elif action == 'f':
                    break
                else:
                    print("Invalid Input, Try Again!")

        main()
Exemplo n.º 10
0
class CustomerUi:
    def __init__(self):
        self.__customer_service = CustomerService()
        self.__order_service = OrderService()
        self.__orderUi = OrdercarUi()

    @staticmethod
    def header(i):
        """
        This is the header on the user interface. we user this format in the functions down below
        :param i:
        :return:
        """
        print("-" * 50)
        print("|{:^48}|".format(i))
        print("-" * 50)
        print()

    def add_customer(self):
        """
        Adds an customer by asking the customer for a few details
        :return:
        """
        self.header("Add customer")
        con = True
        while con:
            try:
                kt = input("\tEnter PPN/Kt (\33[;31mq to go back\33[;0m): "
                           ).lower().translate(remove_punct_map)
                if self.__order_service.check_kt(kt):
                    print("\nCustomer already exists!\n")
                elif kt == "q":
                    break
                elif not self.__order_service.check_kt(kt):
                    name = input("\tEnter name: ").translate(remove_punct_map)
                    country = input("\tEnter country: ").translate(
                        remove_punct_map)
                    address = input("\tEnter address: ").translate(
                        remove_punct_map)
                    mail = input("\tEnter mail: ").strip()
                    phone = input("\tEnter phone number: ").translate(
                        remove_punct_map)
                    customer_license = input("\tEnter driving license: "
                                             ).translate(remove_punct_map)
                    age = int(
                        input("\tEnter age: ").translate(remove_punct_map))
                    new_customer = Customer(name, kt, country, address, mail,
                                            phone, customer_license, age)
                    print(new_customer)
                    if input(
                            "Do you want create this customer? (\33[;32mY\33[;0m/\33[;31mN\33[;0m): "
                    ).upper() == "Y":
                        self.__customer_service.add_customer(new_customer)
                        print("\nCustomer created!\n")
                else:
                    print("\nNo customer created.\n")
            except Exception:
                print(
                    "\n\33[;31mSomething went wrong, please try again!\33[;0m\n"
                )
            input("\33[;32mPress enter to continue\33[;0m")

    def list_all_customers(self):
        """
        List all of the customers
        :return:
        """
        self.header("All customers")
        self.__customer_service.list_all_customers()
        input("\33[;32mPress enter to continue\33[;0m")

    def edit_customer(self):
        """
        Offer you to edit an customer by id.
        :return:
        """
        self.header("Edit customer")
        customers = self.__customer_service.get_customers()
        if customers:
            editing_customer = True
            while editing_customer:
                e_action = ''
                self.__customer_service.print_customers(customers)
                customer_id = input(
                    "Which customer do you want to edit?(\33[;31mq to quit\33[;0m): "
                ).lower()
                if customer_id.isdigit(
                ) and int(customer_id) <= len(customers):
                    try:
                        customer_id = int(customer_id)

                        customer = self.__customer_service.get_customer_by_id(
                            customer_id)
                        self.__customer_service.print_customer(customer)
                        new_customer = Customer(
                            customer["Name"], customer["Passport number"],
                            customer["Country"], customer["Address"],
                            customer["Mail"], customer["Phone number"],
                            customer["license"], customer["Age"])

                        while e_action != 'q':
                            print(
                                "\n1. Passport number/kt.\n2. Name\n3. Country\n4. Address\n5. Phone number"
                                "\n6. E-mail\n7. Driving license\n8. Age\n\n\33[;31mPress q to go back\33[;0m\n"
                            )

                            e_action = input("Choose an option: ").lower()

                            if e_action == '1':
                                new_customer.set_kt(
                                    input("Enter passport number/kt: ").
                                    translate(remove_punct_map))
                            elif e_action == '2':
                                new_customer.set_name(
                                    input("Enter name: ").translate(
                                        remove_punct_map))
                            elif e_action == '3':
                                new_customer.set_country(
                                    input("Enter country: ").translate(
                                        remove_punct_map))
                            elif e_action == '4':
                                new_customer.set_address(
                                    input("Enter address: ").translate(
                                        remove_punct_map))
                            elif e_action == '5':
                                new_customer.set_phone_number(
                                    input("Enter phone number: ").translate(
                                        remove_punct_map))
                            elif e_action == '6':
                                new_customer.set_mail(
                                    input("Enter mail: ").strip())
                            elif e_action == '7':
                                new_customer.set_license(
                                    input("Enter driving license: ").translate(
                                        remove_punct_map))
                            elif e_action == '8':
                                new_customer.set_age(
                                    input("Enter age: ").translate(
                                        remove_punct_map))

                        self.__customer_service.remove_customer(customer_id)
                        self.__customer_service.add_customer(new_customer)
                        print("\nCustomer edited\n")
                        editing_customer = False
                        break
                    except Exception:
                        print("\n\33[;31mWrong input, try again!\33[;0m\n")
                        print("\n\33[;31mWrong input, try again!\33[;0m\n")
                else:
                    print("\n\33[;31mWrong input, try again!\33[;0m\n")
        else:
            print("No customers to edit\n")
        input("\33[;32mPress enter to continue \33[;0m")

    def remove_customer(self):
        """
        Remove a specific customer, removes the content in the csv file and appears it without the removed customer
        :return:
        """
        self.header("Remove customer")
        customers = self.__customer_service.get_customers()
        if customers:
            removing_customer = True
            while removing_customer:
                self.__customer_service.print_customers(customers)
                customer_to_delete = input(
                    "What customer would you like to remove? (\33[;31mq to quit\33[;0m): "
                ).lower()
                if customer_to_delete.isdigit(
                ) and int(customer_to_delete) <= len(customers) + 1:
                    try:
                        are_you_sure = input(
                            "Are you sure you want to remove this customer? (\33[;32mY\33[;0m/\33[;31mN\33[;0m): "
                        ).lower()
                        if are_you_sure == "y":
                            customer_to_delete = int(customer_to_delete)
                            print("\nCustomer number {} removed\n".format(
                                customer_to_delete))
                            self.__customer_service.remove_customer(
                                customer_to_delete)
                            removing_customer = False
                    except Exception:
                        print("\n\33[;31mWrong input, try again!\33[;0m")
                elif customer_to_delete.lower() == 'q':
                    removing_customer = False
                    break
                else:
                    print("\n\33[;31mWrong input, try again!\33[;0m\n")
        else:
            print("\33[;31mNo customers to delete!\33[;0m\n")
        input("\33[;32mPress enter to continue \33[;0m")

    def see_customer(self):
        """
        offers you to see a specific customer with "PPN/kt"
        :return:
        """
        self.header("See customer")
        kt = input(
            "Enter PPN/Kt of the customer(\33[;31mq to go back\33[;0m): "
        ).upper()
        customer = self.__order_service.check_kt(kt)
        if customer:
            self.__customer_service.print_customer(customer)
        elif not customer:
            print("\nCustomer does not exist\n")
        input("\33[;32mPress enter to continue \33[;0m")

    def main_menu(self):
        """
        This is the main menu for the customer user interface. you can (e. add customer)
        :return:
        """
        action = ""
        while action != 'q':
            os.system('cls')
            self.header("Customer")
            print(
                "You can do the following: \n1. Add a customer\n2. List all customers\n3. Edit customer"
                "\n4. Remove customer\n5. See customer\n\n"
                "\33[;31mPress q to go back\33[;0m")
            action = input("\nChoose an option: ").lower()
            print()
            if action == "1":
                self.add_customer()

            elif action == "2":
                self.list_all_customers()

            elif action == "3":
                self.edit_customer()

            elif action == "4":
                self.remove_customer()

            elif action == "5":
                self.see_customer()
Exemplo n.º 11
0
 def __init__(self):
     self.__customer_service = CustomerService()
     self.__order_service = OrderService()
     self.__orderUi = OrdercarUi()