Compare commits
2 Commits
92bff5640f
...
24cfcd61ed
Author | SHA1 | Date | |
---|---|---|---|
24cfcd61ed | |||
58b7552714 |
22
main.go
22
main.go
@@ -60,7 +60,11 @@ var (
|
||||
"Terrapin", "Vulture", "Hull-A", "Hull-C", "Zeus ES", "Zeus CL",
|
||||
// …weitere Capital- und Concept-Schiffe sind ebenfalls bekannt!
|
||||
}
|
||||
waren = []string{"", "Laranite", "Titanium", "Medical Supplies", "Gold", "Agricium", "Hydrogen", "Nitrogen", "Astatine", "Iodine", "Aluminium", "Copper", "Lithium", "Silicon", "Tungsten", "Aphorite", "Beryl", "Bexalite", "Corundum", "Diamond", "Dolivine", "Hadanite", "Hephaestanite", "Laranite", "Quartz", "Taranite"}
|
||||
waren = []string{
|
||||
"", "Laranite", "Titanium", "Medical Supplies", "Gold", "Agricium", "Hydrogen", "Nitrogen", "Astatine",
|
||||
"Iodine", "Aluminium", "Copper", "Lithium", "Silicon", "Tungsten", "Aphorite", "Beryl", "Bexalite",
|
||||
"Corundum", "Diamond", "Dolivine", "Hadanite", "Hephaestanite", "Laranite", "Quartz", "Taranite",
|
||||
}
|
||||
)
|
||||
|
||||
type POI struct {
|
||||
@@ -218,8 +222,10 @@ func main() {
|
||||
}
|
||||
orte = append(orte, "")
|
||||
for _, poi := range pois {
|
||||
formatted := fmt.Sprintf("%s - %s - %s (%s)", poi.System, poi.Planet, poi.PoiName, poi.Type)
|
||||
orte = append(orte, formatted)
|
||||
if poi.System == "Stanton" || poi.System == "Pyro" {
|
||||
formatted := fmt.Sprintf("%s - %s - %s (%s)", poi.System, poi.Planet, poi.PoiName, poi.Type)
|
||||
orte = append(orte, formatted)
|
||||
}
|
||||
}
|
||||
//
|
||||
if err != nil {
|
||||
@@ -333,10 +339,11 @@ func main() {
|
||||
startort := r.FormValue("startort")
|
||||
zielort := r.FormValue("zielort")
|
||||
schiff := r.FormValue("schiff")
|
||||
ware := r.FormValue("ware")
|
||||
ware := r.Form["ware"]
|
||||
wareStr := strings.Join(ware, ", ")
|
||||
zeitaufwand, _ := strconv.ParseFloat(r.FormValue("zeitaufwand"), 64)
|
||||
|
||||
_, err := db.Exec(`INSERT INTO eintraege (anfangsbestand, endbestand, prozentwert, abgabe, created_at, startort, zielort, schiff, ware, zeitaufwand) VALUES (?, ?, ?, ?, datetime('now'), ?, ?, ?, ?, ?)`, anfang, ende, prozent, abgabe, startort, zielort, schiff, ware, zeitaufwand)
|
||||
_, err := db.Exec(`INSERT INTO eintraege (anfangsbestand, endbestand, prozentwert, abgabe, created_at, startort, zielort, schiff, ware, zeitaufwand) VALUES (?, ?, ?, ?, datetime('now'), ?, ?, ?, ?, ?)`, anfang, ende, prozent, abgabe, startort, zielort, schiff, wareStr, zeitaufwand)
|
||||
if err != nil {
|
||||
http.Error(w, "Fehler beim Einfügen", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -664,7 +671,7 @@ const htmlTemplate = `
|
||||
</div>
|
||||
<div class="col">
|
||||
<label class="form-label">Ware</label>
|
||||
<select id="ware" name="ware" class="form-select">
|
||||
<select id="ware" name="ware" class="form-select" multiple>
|
||||
{{range .Waren}}
|
||||
<option value="{{.}}">{{.}}</option>
|
||||
{{end}}
|
||||
@@ -912,7 +919,8 @@ const htmlTemplate = `
|
||||
<script>
|
||||
new TomSelect("#ware", {
|
||||
create: true, // erlaubt Freitext
|
||||
sortField: "text"
|
||||
sortField: "text",
|
||||
plugins: ['remove_button'] // ← erlaubt Entfernen per „x“-Button
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user