Compare commits
2 Commits
b75c46ec2f
...
249cccd240
| Author | SHA1 | Date | |
|---|---|---|---|
|
249cccd240
|
|||
|
db3dc9ecd1
|
@@ -212,7 +212,7 @@ func (rc *configController) GetAllPaper(c *gin.Context) {
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
func (rc *configController) InvoiceView(c *gin.Context) {
|
func (rc *configController) InvoiceView(c *gin.Context) {
|
||||||
invoices, err := repositories.Invoices.GetAll()
|
invoices, err := repositories.Invoices.GetAllNewestFirst()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.HTML(http.StatusBadRequest, "invoiceview.html", gin.H{"data": gin.H{"error": err}})
|
c.HTML(http.StatusBadRequest, "invoiceview.html", gin.H{"data": gin.H{"error": err}})
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ import (
|
|||||||
type InvoiceRepository interface {
|
type InvoiceRepository interface {
|
||||||
Create(models.Invoice) (models.Invoice, error)
|
Create(models.Invoice) (models.Invoice, error)
|
||||||
GetAll() ([]models.Invoice, error)
|
GetAll() ([]models.Invoice, error)
|
||||||
|
GetAllSorted(string) ([]models.Invoice, error)
|
||||||
|
GetAllNewestFirst() ([]models.Invoice, error)
|
||||||
|
GetAllNewestLast() ([]models.Invoice, error)
|
||||||
GetById(string) (models.Invoice, error)
|
GetById(string) (models.Invoice, error)
|
||||||
//GetByShopItemId(string) (models.Invoice, error)
|
//GetByInvoiceId(string) (models.Invoice, error)
|
||||||
Update(models.Invoice) (models.Invoice, error)
|
Update(models.Invoice) (models.Invoice, error)
|
||||||
DeleteById(string) error
|
DeleteById(string) error
|
||||||
}
|
}
|
||||||
@@ -44,6 +47,21 @@ func (t *GORMInvoiceRepository) GetAll() ([]models.Invoice, error) {
|
|||||||
return invoice, result.Error
|
return invoice, result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *GORMInvoiceRepository) GetAllSorted(sortString string) ([]models.Invoice, error) {
|
||||||
|
var invoices []models.Invoice
|
||||||
|
result := t.DB.Preload("PrintJobs.ShopItem").Preload("PrintJobs.Variant").Preload("PrintJobs.PaperType").Preload("PrintJobs.CoverPaperType").Preload("PrintJobs").Order(sortString).Find(&invoices)
|
||||||
|
|
||||||
|
return invoices, result.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *GORMInvoiceRepository) GetAllNewestFirst() ([]models.Invoice, error) {
|
||||||
|
return r.GetAllSorted("created_at desc")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *GORMInvoiceRepository) GetAllNewestLast() ([]models.Invoice, error) {
|
||||||
|
return r.GetAllSorted("created_at asc")
|
||||||
|
}
|
||||||
|
|
||||||
func (t *GORMInvoiceRepository) GetById(id string) (models.Invoice, error) {
|
func (t *GORMInvoiceRepository) GetById(id string) (models.Invoice, error) {
|
||||||
invoiceId, err := strconv.Atoi(id)
|
invoiceId, err := strconv.Atoi(id)
|
||||||
|
|
||||||
|
|||||||
@@ -603,10 +603,6 @@ video {
|
|||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.m-8 {
|
|
||||||
margin: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.-mx-2 {
|
.-mx-2 {
|
||||||
margin-left: -0.5rem;
|
margin-left: -0.5rem;
|
||||||
margin-right: -0.5rem;
|
margin-right: -0.5rem;
|
||||||
@@ -786,6 +782,10 @@ video {
|
|||||||
max-width: 48rem;
|
max-width: 48rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.max-w-4xl {
|
||||||
|
max-width: 56rem;
|
||||||
|
}
|
||||||
|
|
||||||
.max-w-6xl {
|
.max-w-6xl {
|
||||||
max-width: 72rem;
|
max-width: 72rem;
|
||||||
}
|
}
|
||||||
@@ -802,10 +802,6 @@ video {
|
|||||||
max-width: 1280px;
|
max-width: 1280px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-4xl {
|
|
||||||
max-width: 56rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1 1 0%;
|
flex: 1 1 0%;
|
||||||
}
|
}
|
||||||
@@ -846,10 +842,6 @@ video {
|
|||||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-cols-7 {
|
|
||||||
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-col {
|
.flex-col {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@@ -948,6 +940,19 @@ video {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.break-normal {
|
||||||
|
overflow-wrap: normal;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.break-words {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.break-all {
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
.rounded {
|
.rounded {
|
||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
@@ -1102,6 +1107,11 @@ video {
|
|||||||
background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1));
|
background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-green-50 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(240 253 244 / var(--tw-bg-opacity, 1));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-green-500 {
|
.bg-green-500 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
|
background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
|
||||||
@@ -1192,6 +1202,11 @@ video {
|
|||||||
background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1));
|
background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-red-50 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-red-500 {
|
.bg-red-500 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
|
background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1));
|
||||||
@@ -1292,16 +1307,6 @@ video {
|
|||||||
background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1));
|
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-red-50 {
|
||||||
fill: #fef2f2;
|
fill: #fef2f2;
|
||||||
}
|
}
|
||||||
@@ -1331,10 +1336,6 @@ video {
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-8 {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.px-2 {
|
.px-2 {
|
||||||
padding-left: 0.5rem;
|
padding-left: 0.5rem;
|
||||||
padding-right: 0.5rem;
|
padding-right: 0.5rem;
|
||||||
@@ -1370,6 +1371,11 @@ video {
|
|||||||
padding-bottom: 0.125rem;
|
padding-bottom: 0.125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.py-1 {
|
||||||
|
padding-top: 0.25rem;
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.py-1\.5 {
|
.py-1\.5 {
|
||||||
padding-top: 0.375rem;
|
padding-top: 0.375rem;
|
||||||
padding-bottom: 0.375rem;
|
padding-bottom: 0.375rem;
|
||||||
@@ -1415,16 +1421,6 @@ video {
|
|||||||
padding-bottom: 2rem;
|
padding-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.px-8 {
|
|
||||||
padding-left: 2rem;
|
|
||||||
padding-right: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.py-1 {
|
|
||||||
padding-top: 0.25rem;
|
|
||||||
padding-bottom: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pb-3 {
|
.pb-3 {
|
||||||
padding-bottom: 0.75rem;
|
padding-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
@@ -1659,6 +1655,11 @@ video {
|
|||||||
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-green-700 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(21 128 61 / var(--tw-text-opacity, 1));
|
||||||
|
}
|
||||||
|
|
||||||
.text-green-800 {
|
.text-green-800 {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(22 101 52 / var(--tw-text-opacity, 1));
|
color: rgb(22 101 52 / var(--tw-text-opacity, 1));
|
||||||
@@ -1739,6 +1740,11 @@ video {
|
|||||||
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
color: rgb(239 68 68 / var(--tw-text-opacity, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-red-700 {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(185 28 28 / var(--tw-text-opacity, 1));
|
||||||
|
}
|
||||||
|
|
||||||
.text-red-800 {
|
.text-red-800 {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(153 27 27 / var(--tw-text-opacity, 1));
|
color: rgb(153 27 27 / var(--tw-text-opacity, 1));
|
||||||
@@ -1829,16 +1835,6 @@ video {
|
|||||||
color: rgb(39 39 42 / var(--tw-text-opacity, 1));
|
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 {
|
.antialiased {
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
@@ -1888,14 +1884,14 @@ video {
|
|||||||
--tw-ring-inset: inset;
|
--tw-ring-inset: inset;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ring-red-600\/10 {
|
|
||||||
--tw-ring-color: rgb(220 38 38 / 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ring-green-600\/20 {
|
.ring-green-600\/20 {
|
||||||
--tw-ring-color: rgb(22 163 74 / 0.2);
|
--tw-ring-color: rgb(22 163 74 / 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ring-red-600\/10 {
|
||||||
|
--tw-ring-color: rgb(220 38 38 / 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.filter {
|
.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);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,9 @@
|
|||||||
<table class="min-w-full divide-y divide-gray-200 dark:divide-neutral-700">
|
<table class="min-w-full divide-y divide-gray-200 dark:divide-neutral-700">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Image</th>
|
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-500"></th>
|
||||||
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Name</th>
|
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Name</th>
|
||||||
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Variant</th>
|
|
||||||
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Paper</th>
|
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Paper</th>
|
||||||
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">CoverPaper</th>
|
|
||||||
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Amount</th>
|
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Amount</th>
|
||||||
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Price</th>
|
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase dark:text-neutral-500">Price</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -21,10 +19,20 @@
|
|||||||
<img class="h-auto w-full max-h-full dark:hidden" src="/{{ .ShopItem.Image }}" alt="imac image" />
|
<img class="h-auto w-full max-h-full dark:hidden" src="/{{ .ShopItem.Image }}" alt="imac image" />
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .ShopItem.Name }}</td>
|
<td class="px-6 py-4 text-sm text-gray-800 dark:text-neutral-200">
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .Variant.Name}}</td>
|
<div class="text-sm break-normal">
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .PaperType.Brand }} - {{.PaperType.Name }}: {{ .PaperType.Size }} {{ .PaperType.Weight }}g/m2</td>
|
<p>{{ .ShopItem.Name }}</p>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .PaperType.Brand }} - {{.PaperType.Name }}: {{ .PaperType.Size }} {{ .PaperType.Weight }}g/m2</td>
|
<p>{{ .Variant.Name }}</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="px-6 py-4 text-sm text-gray-800 dark:text-neutral-200">
|
||||||
|
<div class="text-xs">
|
||||||
|
<p>{{ .PaperType.Brand }} - {{.PaperType.Name }}: {{ .PaperType.Size }} {{ .PaperType.Weight }}g</p>
|
||||||
|
{{ if .CoverPaperType }}
|
||||||
|
<p class="text-red-700">{{ .CoverPaperType.Brand }} - {{.CoverPaperType.Name }}: {{ .CoverPaperType.Size }} {{ .CoverPaperType.Weight }}g</p>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .Amount }}</td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .Amount }}</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .PriceTotal }}</td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200">{{ .PriceTotal }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -38,8 +46,6 @@
|
|||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"></td>
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"><b>{{ .PriceTotal }}</b></td>
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-neutral-200"><b>{{ .PriceTotal }}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ range .data.invoices }}
|
{{ range .data.invoices }}
|
||||||
<div class="w-full grid grid-cols-1 gap-4 mx-auto p-4 m-4 flex flex-wrap border rounded shadow-md">
|
<div class="w-full grid grid-cols-1 gap-4 mx-auto p-4 m-4 flex flex-wrap border rounded shadow-md max-w-4xl">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="font-bold text-center mb-4">
|
<div class="font-bold text-center mb-4">
|
||||||
Invoice #{{ .ID }}
|
Invoice #{{ .ID }} - {{ .CreatedAt }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
|
|||||||
Reference in New Issue
Block a user