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 HandleCompanies(session *api.Session) {
for {
ui.ClearScreen()
fmt.Println("Companies Menu:")
fmt.Println("1. List Companies")
fmt.Println("2. Add Company")
fmt.Println("3. Edit Company")
fmt.Println("4. Delete Company")
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:
listCompanies(session)
case 2:
addCompany(session)
case 3:
editCompany(session)
case 4:
deleteCompany(session)
case 5:
return
}
}
}
func listCompanies(session *api.Session) {
ui.ClearScreen()
fmt.Println("Listing companies...")
// TODO: Implement company listing logic using the API
utils.PressEnterToContinue()
}
func addCompany(session *api.Session) {
ui.ClearScreen()
fmt.Println("Adding a new company...")
// TODO: Implement company creation logic using the API
utils.PressEnterToContinue()
}
func editCompany(session *api.Session) {
ui.ClearScreen()
fmt.Println("Editing a company...")
// TODO: Implement company editing logic using the API
utils.PressEnterToContinue()
}
func deleteCompany(session *api.Session) {
ui.ClearScreen()
fmt.Println("Deleting a company...")
// TODO: Implement company deletion logic using the API
utils.PressEnterToContinue()
}