// Code generated by templ - DO NOT EDIT. // templ: version: v0.3.1020 package templates //lint:file-ignore SA4006 This context is only used if a nested component is present. import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( "fmt" "veola/internal/models" ) type ItemFormData struct { Page IsEdit bool Item models.Item Categories []string Errors []string } func itemSelected(have, want string) bool { return have == want } type marketplaceOpt struct { Value string Label string } func marketplaceOptions() []marketplaceOpt { return []marketplaceOpt{ {"ebay.com", "eBay (US)"}, {"ebay.co.uk", "eBay (UK)"}, {"ebay.de", "eBay (DE)"}, {"ebay.fr", "eBay (FR)"}, {"ebay.com.au", "eBay (AU)"}, {"ebay.ca", "eBay (CA)"}, {"yahoo.co.jp", "Yahoo Auctions JP"}, {"mercari.jp", "Mercari JP"}, } } func isKnownMarketplace(v string) bool { for _, o := range marketplaceOptions() { if o.Value == v { return true } } return false } func itemHasMarketplace(it models.Item, v string) bool { for _, m := range it.Marketplaces { if m == v { return true } } return false } // customMarketplacesCSV returns the comma-separated list of marketplaces on // the item that are NOT in the curated list, so the user can keep editing // unusual values without losing them. func customMarketplacesCSV(it models.Item) string { var custom []string for _, m := range it.Marketplaces { if !isKnownMarketplace(m) { custom = append(custom, m) } } return joinCSV(custom) } func joinCSV(vs []string) string { out := "" for i, v := range vs { if i > 0 { out += ", " } out += v } return out } func itemHasJapanMarketplace(it models.Item) bool { for _, m := range it.Marketplaces { if m == "yahoo.co.jp" || m == "mercari.jp" { return true } } return false } func newCategory(v string, known []string) string { if v == "" { return "" } for _, c := range known { if c == v { return "" } } return v } func itemFormBody(d ItemFormData) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { return templ_7745c5c3_CtxErr } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) if templ_7745c5c3_Err == nil { templ_7745c5c3_Err = templ_7745c5c3_BufErr } }() } ctx = templ.InitializeContext(ctx) templ_7745c5c3_Var1 := templ.GetChildren(ctx) if templ_7745c5c3_Var1 == nil { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "