an updated and hopefully faster version of the ST Toolbox
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

67 lines
1.5 KiB

package cli
import (
"fmt"
"marmic/servicetrade-toolbox/internal/api"
"marmic/servicetrade-toolbox/internal/ui"
"marmic/servicetrade-toolbox/internal/utils"
)
func HandleContacts(session *api.Session) {
for {
ui.ClearScreen()
fmt.Println("Contacts Menu:")
fmt.Println("1. List Contacts")
fmt.Println("2. Add Contact")
fmt.Println("3. Edit Contact")
fmt.Println("4. Delete Contact")
fmt.Println("5. Back to Main Menu")
choice, err := utils.GetUserChoice(5)
if err != nil {
ui.DisplayError("Invalid input:", err)
utils.PressEnterToContinue()
continue
}
switch choice {
case 1:
listContacts(session)
case 2:
addContact(session)
case 3:
editContact(session)
case 4:
deleteContact(session)
case 5:
return
}
}
}
func listContacts(session *api.Session) {
ui.ClearScreen()
fmt.Println("Listing contacts...")
// TODO: Implement contact listing logic using the API
utils.PressEnterToContinue()
}
func addContact(session *api.Session) {
ui.ClearScreen()
fmt.Println("Adding a new contact...")
// TODO: Implement contact creation logic using the API
utils.PressEnterToContinue()
}
func editContact(session *api.Session) {
ui.ClearScreen()
fmt.Println("Editing a contact...")
// TODO: Implement contact editing logic using the API
utils.PressEnterToContinue()
}
func deleteContact(session *api.Session) {
ui.ClearScreen()
fmt.Println("Deleting a contact...")
// TODO: Implement contact deletion logic using the API
utils.PressEnterToContinue()
}