diff --git a/backend/cli/commands/schedules.py b/backend/cli/commands/schedules.py index 4ef0e50..3b3fbd3 100644 --- a/backend/cli/commands/schedules.py +++ b/backend/cli/commands/schedules.py @@ -165,6 +165,9 @@ def cmd_schedules_accept(cli: "NimbusFlowCLI", args) -> None: print("\nšŸ›‘ Cancelled") return + # Clear screen after service selection + print("\033[2J\033[H") + # Find pending schedules for this service all_schedules = cli.schedule_repo.list_all() pending_schedules = [ @@ -332,15 +335,18 @@ def cmd_schedules_remove(cli: "NimbusFlowCLI", args) -> None: service_type_map = {st.ServiceTypeId: st.TypeName for st in cli.service_type_repo.list_all()} # Show available services for the date - print(f"\n{TableColors.HEADER}Services available on {args.date}:{TableColors.RESET}") - print(f"{TableColors.BORDER}{'─' * 40}{TableColors.RESET}") + print(f"\n{TableColors.HEADER}Services available on {args.date}{TableColors.RESET}") + print(f"{TableColors.BORDER}─" * 50 + f"{TableColors.RESET}") + print() for i, service in enumerate(services_on_date, 1): type_name = service_type_map.get(service.ServiceTypeId, "Unknown") - print(f"{TableColors.CYAN}{i}.{TableColors.RESET} {type_name} {TableColors.DIM}(Service ID: {service.ServiceId}){TableColors.RESET}") + print(f" {TableColors.CYAN}{i}.{TableColors.RESET} {type_name}") + print() # Let user select service try: - choice = input(f"\n{TableColors.INPUT_BOX}ā”Œā”€ Select service (1-{len(services_on_date)}) ─┐{TableColors.RESET}\n{TableColors.INPUT_BOX}└─> {TableColors.RESET}").strip() + print(f"\n{TableColors.INPUT_BOX}ā”Œā”€ Select service (1-{len(services_on_date)}) ─┐{TableColors.RESET}") + choice = input(f"{TableColors.INPUT_BOX}└─> {TableColors.RESET}").strip() if not choice or not choice.isdigit(): print(f"{TableColors.ERROR}āŒ Invalid selection{TableColors.RESET}") return @@ -355,6 +361,9 @@ def cmd_schedules_remove(cli: "NimbusFlowCLI", args) -> None: print(f"\n{TableColors.WARNING}šŸ›‘ Cancelled{TableColors.RESET}") return + # Clear screen after service selection + print("\033[2J\033[H") + # Find all schedules for this service (not just pending) all_schedules = cli.schedule_repo.list_all() service_schedules = [ @@ -546,6 +555,9 @@ def cmd_schedules_decline(cli: "NimbusFlowCLI", args) -> None: print("\nšŸ›‘ Cancelled") return + # Clear screen after service selection + print("\033[2J\033[H") + # Find pending schedules for this service all_schedules = cli.schedule_repo.list_all() pending_schedules = [ @@ -562,18 +574,22 @@ def cmd_schedules_decline(cli: "NimbusFlowCLI", args) -> None: member_map = {m.MemberId: m for m in cli.member_repo.list_all()} # Show available members to decline - print(f"\nšŸ‘„ Members scheduled for {service_type_map.get(selected_service.ServiceTypeId, 'Unknown')} on {args.date}:") - print("-" * 60) + service_name = service_type_map.get(selected_service.ServiceTypeId, 'Unknown') + print(f"{TableColors.HEADER}Members scheduled for {service_name} on {args.date}{TableColors.RESET}") + print(f"{TableColors.BORDER}─" * 70 + f"{TableColors.RESET}") + print() for i, schedule in enumerate(pending_schedules, 1): member = member_map.get(schedule.MemberId) if member: - print(f"{i}. {member.FirstName} {member.LastName} (Schedule ID: {schedule.ScheduleId})") + print(f" {TableColors.CYAN}{i}.{TableColors.RESET} {member.FirstName} {member.LastName}") else: - print(f"{i}. Unknown Member (ID: {schedule.MemberId}) (Schedule ID: {schedule.ScheduleId})") + print(f" {TableColors.CYAN}{i}.{TableColors.RESET} {TableColors.DIM}Unknown Member (ID: {schedule.MemberId}){TableColors.RESET}") + print() # Let user select member try: - choice = input(f"\nSelect member to decline (1-{len(pending_schedules)}): ").strip() + print(f"\n{TableColors.INPUT_BOX}ā”Œā”€ Select member to decline (1-{len(pending_schedules)}) ─┐{TableColors.RESET}") + choice = input(f"{TableColors.INPUT_BOX}└─> {TableColors.RESET}").strip() if not choice or not choice.isdigit(): print("āŒ Invalid selection") return @@ -696,6 +712,9 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: except (KeyboardInterrupt, EOFError): print("\nšŸ›‘ Operation cancelled") return + + # Clear screen after service selection + print("\033[2J\033[H") elif hasattr(args, 'service_id') and args.service_id: # Service ID based selection @@ -713,7 +732,7 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: service_type = cli.service_type_repo.get_by_id(service.ServiceTypeId) service_type_name = service_type.TypeName if service_type else "Unknown" - print(f"\nšŸ“… Selected Service: {service_type_name} on {service.ServiceDate}") + print(f"{TableColors.HEADER}Selected Service: {service_type_name} on {service.ServiceDate}{TableColors.RESET}") # Get classification constraints if not provided classification_ids = [] @@ -732,13 +751,17 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: else: # If no classifications specified, ask user to select all_classifications = cli.classification_repo.list_all() - print("\nšŸŽµ Available classifications:") + print(f"\n{TableColors.HEADER}Available classifications{TableColors.RESET}") + print(f"{TableColors.BORDER}─" * 50 + f"{TableColors.RESET}") + print() for i, classification in enumerate(all_classifications, 1): - print(f" {i}. {classification.ClassificationName}") + print(f" {TableColors.CYAN}{i}.{TableColors.RESET} {classification.ClassificationName}") + print() while True: try: - choice = input(f"\nšŸŽÆ Select classification(s) (1-{len(all_classifications)}, comma-separated): ").strip() + print(f"\n{TableColors.INPUT_BOX}ā”Œā”€ Select classification(s) (1-{len(all_classifications)}, comma-separated) ─┐{TableColors.RESET}") + choice = input(f"{TableColors.INPUT_BOX}└─> {TableColors.RESET}").strip() if not choice: continue @@ -758,7 +781,8 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: selected_classifications = [c.ClassificationName for c in cli.classification_repo.list_all() if c.ClassificationId in classification_ids] - print(f"\nšŸ” Looking for eligible members in: {', '.join(selected_classifications)}") + print(f"\n{TableColors.SUCCESS}Looking for eligible members in: {', '.join(selected_classifications)}{TableColors.RESET}") + print() excluded_members = set() @@ -781,12 +805,15 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: member_id, first_name, last_name = preview_result # Show preview - print(f"\n✨ Next available member:") - print(f" šŸ‘¤ {first_name} {last_name} (ID: {member_id})") + print(f"\n{TableColors.HEADER}Next available member{TableColors.RESET}") + print(f"{TableColors.BORDER}─" * 50 + f"{TableColors.RESET}") + print(f" {TableColors.CYAN}{first_name} {last_name}{TableColors.RESET}") + print() # Confirm scheduling try: - confirm = input(f"\nšŸ¤” Schedule {first_name} {last_name} for this service? (y/N/q to quit): ").strip().lower() + print(f"\n{TableColors.INPUT_BOX}ā”Œā”€ Schedule {first_name} {last_name} for this service? (y/N/q to quit) ─┐{TableColors.RESET}") + confirm = input(f"{TableColors.INPUT_BOX}└─> {TableColors.RESET}").strip().lower() if confirm in ['y', 'yes']: # Actually create the schedule @@ -799,24 +826,25 @@ def cmd_schedules_schedule(cli: "NimbusFlowCLI", args) -> None: if result: scheduled_member_id, scheduled_first, scheduled_last, schedule_id = result - print(f"\nāœ… Successfully scheduled {scheduled_first} {scheduled_last}!") - print(f" šŸ“‹ Schedule ID: {schedule_id}") - print(f" šŸ“§ Status: Pending (awaiting member response)") + print(f"\n{TableColors.SUCCESS}Successfully scheduled {scheduled_first} {scheduled_last}!{TableColors.RESET}") + print(f"{TableColors.DIM}Schedule ID: {schedule_id}{TableColors.RESET}") + print(f"{TableColors.DIM}Status: Pending (awaiting member response){TableColors.RESET}") else: print("āŒ Failed to create schedule. The member may no longer be eligible.") return elif confirm in ['q', 'quit']: - print("šŸ›‘ Scheduling cancelled") + print(f"\n{TableColors.WARNING}Scheduling cancelled{TableColors.RESET}") return else: # User declined this member - add to exclusion list and continue excluded_members.add(member_id) - print(f"ā­ļø Skipping {first_name} {last_name}, looking for next member...") + print(f"\n{TableColors.DIM}Skipping {first_name} {last_name}, looking for next member...{TableColors.RESET}") + print() except (KeyboardInterrupt, EOFError): - print("\nšŸ›‘ Operation cancelled") + print(f"\n{TableColors.WARNING}Operation cancelled{TableColors.RESET}") return