diff --git a/controllers/printController.go b/controllers/printController.go index 988d388..6c8d695 100644 --- a/controllers/printController.go +++ b/controllers/printController.go @@ -180,7 +180,19 @@ func (rc *printController) PrintHandler(c *gin.Context) { executeJobs := func() { for _, printJob := range printJobs { - printJob.Execute() + printJob.ShopItem.WasPrinted = true + _, err = repositories.ShopItems.Update(printJob.ShopItem) + + if err != nil { + fmt.Printf("Error: %s\n", err) + } + + err := printJob.Execute() + + if err == nil { + return + } + } } diff --git a/controllers/shopItemController.go b/controllers/shopItemController.go index d662d18..7649709 100644 --- a/controllers/shopItemController.go +++ b/controllers/shopItemController.go @@ -161,6 +161,7 @@ func (rc *shopItemController) NewShopItemFromForm(ctx *gin.Context) (models.Shop Pdf: dstPdf, Variants: variants, PrintMode: printMode, + WasPrinted: false, } fmt.Println("Creating Shopitem: ", shopItem) @@ -400,6 +401,7 @@ func (rc *shopItemController) AddItemsHandler(c *gin.Context) { Pdf: dstPdf, Variants: variants, PrintMode: "CreateBooklet", + WasPrinted: false, } _, err = repositories.ShopItems.Create(shopItem) @@ -537,6 +539,7 @@ func (rc *shopItemController) EditItemHandler(c *gin.Context) { newShopItem.Variants = shopItem.Variants newShopItem.BasePrice = shopItem.BasePrice newShopItem.IsPublic = shopItem.IsPublic + newShopItem.WasPrinted = false if len(shopItem.Tags) != 0 { newShopItem.Tags = shopItem.Tags diff --git a/models/shopItem.go b/models/shopItem.go index 30a018b..8146878 100644 --- a/models/shopItem.go +++ b/models/shopItem.go @@ -53,4 +53,5 @@ type ShopItem struct { Image string Pdf string PrintMode string `json:"printMode" gorm:"default:CreateBooklet"` + WasPrinted bool `gorm:"default:false"` } diff --git a/static/output.css b/static/output.css index f3583d6..941769a 100644 --- a/static/output.css +++ b/static/output.css @@ -694,6 +694,10 @@ video { display: flex; } +.inline-flex { + display: inline-flex; +} + .table { display: table; } @@ -1288,6 +1292,16 @@ video { background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1)); } +.bg-red-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1)); +} + +.bg-green-50 { + --tw-bg-opacity: 1; + background-color: rgb(240 253 244 / var(--tw-bg-opacity, 1)); +} + .fill-red-50 { fill: #fef2f2; } @@ -1406,6 +1420,11 @@ video { padding-right: 2rem; } +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + .pb-3 { padding-bottom: 0.75rem; } @@ -1810,6 +1829,16 @@ video { color: rgb(39 39 42 / var(--tw-text-opacity, 1)); } +.text-red-700 { + --tw-text-opacity: 1; + color: rgb(185 28 28 / var(--tw-text-opacity, 1)); +} + +.text-green-700 { + --tw-text-opacity: 1; + color: rgb(21 128 61 / var(--tw-text-opacity, 1)); +} + .antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -1849,6 +1878,24 @@ video { outline-color: #d1d5db; } +.ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.ring-inset { + --tw-ring-inset: inset; +} + +.ring-red-600\/10 { + --tw-ring-color: rgb(220 38 38 / 0.1); +} + +.ring-green-600\/20 { + --tw-ring-color: rgb(22 163 74 / 0.2); +} + .filter { filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow); } diff --git a/views/printvariant.html b/views/printvariant.html index 28c72ac..aa30b5d 100644 --- a/views/printvariant.html +++ b/views/printvariant.html @@ -1,7 +1,7 @@ {{ template "header.html" . }}
-
+

Zineshop Print @@ -33,6 +33,12 @@ imac image + + {{ if .ShopItem.WasPrinted }} + Tested + {{ else }} + NOT TESTED + {{ end }} {{ .ShopItem.Name }} - {{ .ItemVariant.Name }}