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 HandleLocations(session *api.Session) {
for {
ui.ClearScreen()
fmt.Println("Locations Menu:")
fmt.Println("1. List Locations")
fmt.Println("2. Add Location")
fmt.Println("3. Edit Location")
fmt.Println("4. Delete Location")
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:
listLocations(session)
case 2:
addLocation(session)
case 3:
editLocation(session)
case 4:
deleteLocation(session)
case 5:
return
}
}
}
func listLocations(session *api.Session) {
ui.ClearScreen()
fmt.Println("Listing locations...")
// TODO: Implement location listing logic using the API
utils.PressEnterToContinue()
}
func addLocation(session *api.Session) {
ui.ClearScreen()
fmt.Println("Adding a new location...")
// TODO: Implement location creation logic using the API
utils.PressEnterToContinue()
}
func editLocation(session *api.Session) {
ui.ClearScreen()
fmt.Println("Editing a location...")
// TODO: Implement location editing logic using the API
utils.PressEnterToContinue()
}
func deleteLocation(session *api.Session) {
ui.ClearScreen()
fmt.Println("Deleting a location...")
// TODO: Implement location deletion logic using the API
utils.PressEnterToContinue()
}