This commit is contained in:
2025-04-10 11:52:34 +02:00
parent 89f7c8c4bb
commit 5a7565663d
3 changed files with 24 additions and 124 deletions

View File

@@ -7,13 +7,16 @@ import (
/* /*
Sticker Sticker
- name, abstr, descr, price, tag - name, abstr, descr, price, tag
Poster Poster
- name, abstr, descr, price bw/colored, tag - name, abstr, descr, price bw/colored, tag
Zines Zines
- name, abstr, descr, price bw/colored/coloredcoveronly, tag - name, abstr, descr, price bw/colored/coloredcoveronly, tag
Books Books
- name, abstr, descr, price, tag - name, abstr, descr, price, tag
*/ */
type Category string type Category string
@@ -31,22 +34,22 @@ func ParseCategory(s string) (c Category, err error) {
type ItemVariant struct { type ItemVariant struct {
gorm.Model gorm.Model
Name string `json:"name" gorm:"not null"` Name string `json:"name" gorm:"not null"`
Price float64 `json:"price" gorm:"not null"` Price float64 `json:"price" gorm:"not null"`
InStock bool `json:"inStock" gorm:"default:true"` InStock bool `json:"inStock" gorm:"default:true"`
ShopItemID uint ShopItemID uint
} }
type ShopItem struct { type ShopItem struct {
gorm.Model gorm.Model
Name string `json:"name" binding:"required" gorm:"unique;not null"` Name string `json:"name" binding:"required" gorm:"unique;not null"`
Abstract string `json:"Abstract" binding:"required"` Abstract string `json:"Abstract" binding:"required"`
Description string `json:"description" binding:"required"` Description string `json:"description" binding:"required"`
Category Category `json:"category"` Category Category `json:"category"`
Variants []ItemVariant `json:"variant"` Variants []ItemVariant `json:"variant"`
BasePrice float64 `json:"basePrice"` BasePrice float64 `json:"basePrice"`
IsPublic bool `json:"isPublic" gorm:"default:true"` IsPublic bool `json:"isPublic" gorm:"default:true"`
Tags []Tag `gorm:"many2many:item_tags;"` Tags []Tag `gorm:"many2many:item_tags;"`
Image string Image string
Pdf string Pdf string
} }

View File

@@ -587,22 +587,6 @@ video {
right: 0px; right: 0px;
} }
.-bottom-\[1\.75rem\] {
bottom: -1.75rem;
}
.end-0 {
inset-inline-end: 0px;
}
.left-1\/2 {
left: 50%;
}
.start-0 {
inset-inline-start: 0px;
}
.col-span-12 { .col-span-12 {
grid-column: span 12 / span 12; grid-column: span 12 / span 12;
} }
@@ -630,11 +614,6 @@ video {
margin-right: auto; margin-right: auto;
} }
.-mx-5 {
margin-left: -1.25rem;
margin-right: -1.25rem;
}
.mb-2 { .mb-2 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
@@ -719,16 +698,6 @@ video {
aspect-ratio: 1 / 1; aspect-ratio: 1 / 1;
} }
.size-5 {
width: 1.25rem;
height: 1.25rem;
}
.size-6 {
width: 1.5rem;
height: 1.5rem;
}
.h-10 { .h-10 {
height: 2.5rem; height: 2.5rem;
} }
@@ -793,14 +762,6 @@ video {
width: 100%; width: 100%;
} }
.w-1\/4 {
width: 25%;
}
.w-2\/4 {
width: 50%;
}
.max-w-2xl { .max-w-2xl {
max-width: 42rem; max-width: 42rem;
} }
@@ -837,11 +798,6 @@ video {
flex-grow: 1; flex-grow: 1;
} }
.-translate-x-1\/2 {
--tw-translate-x: -50%;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.cursor-pointer { .cursor-pointer {
cursor: pointer; cursor: pointer;
} }
@@ -854,10 +810,6 @@ video {
grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-columns: repeat(12, minmax(0, 1fr));
} }
.grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.flex-col { .flex-col {
flex-direction: column; flex-direction: column;
} }
@@ -870,14 +822,6 @@ video {
align-items: center; align-items: center;
} }
.justify-start {
justify-content: flex-start;
}
.justify-end {
justify-content: flex-end;
}
.justify-center { .justify-center {
justify-content: center; justify-content: center;
} }
@@ -894,10 +838,6 @@ video {
gap: 1.25rem; gap: 1.25rem;
} }
.gap-2 {
gap: 0.5rem;
}
.gap-x-6 { .gap-x-6 {
-moz-column-gap: 1.5rem; -moz-column-gap: 1.5rem;
column-gap: 1.5rem; column-gap: 1.5rem;
@@ -1084,11 +1024,6 @@ video {
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
} }
.bg-gray-600 {
--tw-bg-opacity: 1;
background-color: rgb(75 85 99 / var(--tw-bg-opacity, 1));
}
.fill-red-50 { .fill-red-50 {
fill: #fef2f2; fill: #fef2f2;
} }
@@ -1366,11 +1301,6 @@ video {
color: rgb(255 255 255 / var(--tw-text-opacity, 1)); color: rgb(255 255 255 / var(--tw-text-opacity, 1));
} }
.text-blue-600 {
--tw-text-opacity: 1;
color: rgb(37 99 235 / var(--tw-text-opacity, 1));
}
.underline { .underline {
text-decoration-line: underline; text-decoration-line: underline;
} }
@@ -1427,37 +1357,6 @@ video {
color: rgb(156 163 175 / var(--tw-text-opacity, 1)); color: rgb(156 163 175 / var(--tw-text-opacity, 1));
} }
.after\:mt-4::after {
content: var(--tw-content);
margin-top: 1rem;
}
.after\:block::after {
content: var(--tw-content);
display: block;
}
.after\:h-1::after {
content: var(--tw-content);
height: 0.25rem;
}
.after\:w-full::after {
content: var(--tw-content);
width: 100%;
}
.after\:rounded-lg::after {
content: var(--tw-content);
border-radius: 0.5rem;
}
.after\:bg-gray-200::after {
content: var(--tw-content);
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
}
.focus-within\:outline-none:focus-within { .focus-within\:outline-none:focus-within {
outline: 2px solid transparent; outline: 2px solid transparent;
outline-offset: 2px; outline-offset: 2px;

View File

@@ -9,23 +9,21 @@
<img class="w-full h-full object-cover" src="/{{ .data.shopItem.Image}}" alt="Product Image"> <img class="w-full h-full object-cover" src="/{{ .data.shopItem.Image}}" alt="Product Image">
</div> </div>
<div class="flex -mx-2 mb-4"> <div class="flex -mx-2 mb-4">
<input type="hidden" id="{{ .data.shopItem.ID}}" name="ShopItemId" value="{{ .data.shopItem.ID }}"> <input type="hidden" id="{{ .data.shopItem.ID}}" name="ShopItemId" value="{{ .data.shopItem.ID }}">
<div class="w-1/3 px-2"> <div class="w-1/3 px-2">
<button type="submit" class="w-full bg-gray-900 dark:bg-gray-600 text-white py-2 px-4 rounded-full font-bold hover:bg-gray-800 dark:hover:bg-gray-700">Add to Cart</button> <button type="submit" class="w-full bg-gray-900 dark:bg-gray-600 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 dark:hover:bg-gray-700">Add to Cart</button>
</div> </div>
<div class="w-1/3 px-2"> <div class="w-1/3 px-2">
<a href="/{{ .data.shopItem.Pdf }}"><button type="button" class="w-full bg-blue-900 dark:bg-gray-600 text-white py-2 px-4 rounded-full font-bold hover:bg-gray-800 dark:hover:bg-gray-700">View</button></a> <button type="button" class="w-full bg-blue-900 dark:bg-gray-600 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 dark:hover:bg-gray-700"><a href="/{{ .data.shopItem.Pdf }}">View</a></button>
</div> </div>
{{ if .loggedIn }} {{ if .loggedIn }}
<div class="w-1/3 px-2"> <div class="w-1/3 px-2">
<a href="{{ .data.shopItem.ID }}/edit"><button type="button" class="w-full bg-blue-900 dark:bg-gray-600 text-white py-2 px-4 rounded-full font-bold hover:bg-gray-800 dark:hover:bg-gray-700">Edit</button></a> <button type="button" class="w-full bg-blue-900 dark:bg-gray-600 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 dark:hover:bg-gray-700"><a href="{{ .data.shopItem.ID }}/edit">Edit</a></button>
</div> </div>
<div class="w-1/3 px-2"> <div class="w-1/3 px-2">
<a href="{{ .data.shopItem.ID }}/delete"><button type="button" class="w-full bg-red-900 dark:bg-red-600 text-white py-2 px-4 rounded-full font-bold hover:bg-gray-800 dark:hover:bg-gray-700">Delete</button></a> <button type="button" class="w-full bg-red-900 dark:bg-red-600 text-white py-2 px-4 rounded-lg font-bold hover:bg-gray-800 dark:hover:bg-gray-700"><a href="{{ .data.shopItem.ID }}/delete">Delete</a></button>
</div> </div>
{{ end }} {{ end }}
</div> </div>