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
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 HandleServices(session *api.Session) {
|
|
for {
|
|
ui.ClearScreen()
|
|
fmt.Println("Services Menu:")
|
|
fmt.Println("1. List Services")
|
|
fmt.Println("2. Add Service")
|
|
fmt.Println("3. Edit Service")
|
|
fmt.Println("4. Delete Service")
|
|
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:
|
|
listServices(session)
|
|
case 2:
|
|
addService(session)
|
|
case 3:
|
|
editService(session)
|
|
case 4:
|
|
deleteService(session)
|
|
case 5:
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
func listServices(session *api.Session) {
|
|
ui.ClearScreen()
|
|
fmt.Println("Listing services...")
|
|
// TODO: Implement service listing logic using the API
|
|
utils.PressEnterToContinue()
|
|
}
|
|
|
|
func addService(session *api.Session) {
|
|
ui.ClearScreen()
|
|
fmt.Println("Adding a new service...")
|
|
// TODO: Implement service creation logic using the API
|
|
utils.PressEnterToContinue()
|
|
}
|
|
|
|
func editService(session *api.Session) {
|
|
ui.ClearScreen()
|
|
fmt.Println("Editing a service...")
|
|
// TODO: Implement service editing logic using the API
|
|
utils.PressEnterToContinue()
|
|
}
|
|
|
|
func deleteService(session *api.Session) {
|
|
ui.ClearScreen()
|
|
fmt.Println("Deleting a service...")
|
|
// TODO: Implement service deletion logic using the API
|
|
utils.PressEnterToContinue()
|
|
}
|
|
|