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 HandleContracts(session *api.Session) {
for {
ui.ClearScreen()
fmt.Println("Contracts Menu:")
fmt.Println("1. List Contracts")
fmt.Println("2. Add Contract")
fmt.Println("3. Edit Contract")
fmt.Println("4. Delete Contract")
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:
listContracts(session)
case 2:
addContract(session)
case 3:
editContract(session)
case 4:
deleteContract(session)
case 5:
return
}
}
}
func listContracts(session *api.Session) {
ui.ClearScreen()
fmt.Println("Listing contracts...")
// TODO: Implement contract listing logic using the API
utils.PressEnterToContinue()
}
func addContract(session *api.Session) {
ui.ClearScreen()
fmt.Println("Adding a new contract...")
// TODO: Implement contract creation logic using the API
utils.PressEnterToContinue()
}
func editContract(session *api.Session) {
ui.ClearScreen()
fmt.Println("Editing a contract...")
// TODO: Implement contract editing logic using the API
utils.PressEnterToContinue()
}
func deleteContract(session *api.Session) {
ui.ClearScreen()
fmt.Println("Deleting a contract...")
// TODO: Implement contract deletion logic using the API
utils.PressEnterToContinue()
}