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.4 KiB

package cli
import (
"fmt"
"marmic/servicetrade-toolbox/internal/api"
"marmic/servicetrade-toolbox/internal/ui"
"marmic/servicetrade-toolbox/internal/utils"
)
func HandleAssets(session *api.Session) {
for {
ui.ClearScreen()
fmt.Println("Assets Menu:")
fmt.Println("1. List Assets")
fmt.Println("2. Add Asset")
fmt.Println("3. Edit Asset")
fmt.Println("4. Delete Asset")
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:
listAssets(session)
case 2:
addAsset(session)
case 3:
editAsset(session)
case 4:
deleteAsset(session)
case 5:
return
}
}
}
func listAssets(session *api.Session) {
ui.ClearScreen()
fmt.Println("Listing assets...")
// TODO: Implement asset listing logic using the API
utils.PressEnterToContinue()
}
func addAsset(session *api.Session) {
ui.ClearScreen()
fmt.Println("Adding a new asset...")
// TODO: Implement asset creation logic using the API
utils.PressEnterToContinue()
}
func editAsset(session *api.Session) {
ui.ClearScreen()
fmt.Println("Editing an asset...")
// TODO: Implement asset editing logic using the API
utils.PressEnterToContinue()
}
func deleteAsset(session *api.Session) {
ui.ClearScreen()
fmt.Println("Deleting an asset...")
// TODO: Implement asset deletion logic using the API
utils.PressEnterToContinue()
}