feat: Add qty column to server-side pdf templates

This commit is contained in:
Ahmed Bouhuolia
2024-10-17 16:00:19 +02:00
parent 279890e922
commit 758ebbe261
5 changed files with 63 additions and 20 deletions

View File

@@ -108,7 +108,14 @@ block head
.#{prefix}-table__cell--right { .#{prefix}-table__cell--right {
text-align: right; text-align: right;
} }
.#{prefix}-table__cell--item .item {
display: flex;
flex-direction: column;
gap: 2px;
}
.#{prefix}-table__cell--item .item .item__description{
color: #5f6b7c;
}
.#{prefix}-totals { .#{prefix}-totals {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -184,16 +191,19 @@ block content
thead thead
tr tr
th(class=`${prefix}-table__header`) #{'Item'} th(class=`${prefix}-table__header`) #{'Item'}
th(class=`${prefix}-table__header`) #{'Description'} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{'Quantity'}
th(class=`${prefix}-table__header`) #{'Rate'} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{'Rate'}
th(class=`${prefix}-table__header`) #{'Total'} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{'Total'}
tbody tbody
each line in lines each line in lines
tr(class=`${prefix}-table__row`) tr(class=`${prefix}-table__row`)
td(class=`${prefix}-table__cell`) #{line.item} td(class=`${prefix}-table__cell ${prefix}-table__cell--item`)
td(class=`${prefix}-table__cell`) #{line.description} div.item
td(class=`${prefix}-table__cell--right`) #{line.rate} div.item__label #{line.item}
td(class=`${prefix}-table__cell--right`) #{line.total} div.item__description #{line.description}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.quantity}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total}
div(class=`${prefix}-totals`) div(class=`${prefix}-totals`)
if showSubtotal if showSubtotal

View File

@@ -109,6 +109,14 @@ block head
.#{prefix}-table__cell:last-of-type { .#{prefix}-table__cell:last-of-type {
padding-right: 0; padding-right: 0;
} }
.#{prefix}-table__cell--item .item {
display: flex;
flex-direction: column;
gap: 2px;
}
.#{prefix}-table__cell--item .item .item__description{
color: #5f6b7c;
}
.#{prefix}-totals { .#{prefix}-totals {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -193,14 +201,17 @@ block content
thead thead
tr tr
th(class=`${prefix}-table__header`) Item th(class=`${prefix}-table__header`) Item
th(class=`${prefix}-table__header`) Description th(class=`${prefix}-table__header ${prefix}-table__header--right`) Qty
th(class=`${prefix}-table__header ${prefix}-table__header--right`) Rate th(class=`${prefix}-table__header ${prefix}-table__header--right`) Rate
th(class=`${prefix}-table__header ${prefix}-table__header--right`) Total th(class=`${prefix}-table__header ${prefix}-table__header--right`) Total
tbody tbody
each line in lines each line in lines
tr tr
td(class=`${prefix}-table__cell`) #{line.item} td(class=`${prefix}-table__cell ${prefix}-table__cell--item`)
td(class=`${prefix}-table__cell`) #{line.description} div.item
div.item__label #{line.item}
div.item__description #{line.description}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.quantity}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate} td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total} td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total}

View File

@@ -115,6 +115,14 @@ block head
.#{prefix}-table__cell--right { .#{prefix}-table__cell--right {
text-align: right; text-align: right;
} }
.#{prefix}-table__cell--item .item {
display: flex;
flex-direction: column;
gap: 2px;
}
.#{prefix}-table__cell--item .item__description {
color: #5f6b7c;
}
.#{prefix}-totals { .#{prefix}-totals {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -200,14 +208,17 @@ block content
thead thead
tr tr
th(class=`${prefix}-table__header`) #{lineItemLabel} th(class=`${prefix}-table__header`) #{lineItemLabel}
th(class=`${prefix}-table__header`) #{lineDescriptionLabel} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{lineQuantityLabel}
th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{lineRateLabel} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{lineRateLabel}
th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{lineTotalLabel} th(class=`${prefix}-table__header ${prefix}-table__header--right`) #{lineTotalLabel}
tbody tbody
each line in lines each line in lines
tr tr
td(class=`${prefix}-table__cell`) #{line.item} td(class=`${prefix}-table__cell ${prefix}-table__cell--item`)
td(class=`${prefix}-table__cell`) #{line.description} div.item
div.item__label #{line.item}
div.item__description #{line.description}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.quantity}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate} td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total} td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total}

View File

@@ -105,6 +105,14 @@ block head
.#{prefix}-table__cell--right { .#{prefix}-table__cell--right {
text-align: right; text-align: right;
} }
.#{prefix}-table__cell--item .item {
display: flex;
flex-direction: column;
gap: 2px;
}
.#{prefix}-table__cell--item .item .item__description{
color: #5f6b7c;
}
.#{prefix}-totals { .#{prefix}-totals {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -179,16 +187,19 @@ block content
thead(class=`${prefix}-table__header`) thead(class=`${prefix}-table__header`)
tr tr
th(class=`${prefix}-table__header`) Item th(class=`${prefix}-table__header`) Item
th(class=`${prefix}-table__header`) Description th(class=`${prefix}-table__header ${prefix}-table__header--right`) Qty
th(class=`${prefix}-table__header ${prefix}-table__header--right`) Rate th(class=`${prefix}-table__header ${prefix}-table__header--right`) Rate
th(class=`${prefix}-table__header ${prefix}-table__header--right`) Total th(class=`${prefix}-table__header ${prefix}-table__header--right`) Total
tbody tbody
each line in lines each line in lines
tr(class=`${prefix}-table__row`) tr(class=`${prefix}-table__row`)
td(class=`${prefix}-table__cell`)= line.item td(class=`${prefix}-table__cell ${prefix}-table__cell--item`)
td(class=`${prefix}-table__cell`)= line.description div.item
td(class=`${prefix}-table__cell${prefix}-table__cell--right`)= line.rate div.item__label #{line.item}
td(class=`${prefix}-table__cell${prefix}-table__cell--right`)= line.total div.item__description #{line.description}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.quantity}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.rate}
td(class=`${prefix}-table__cell ${prefix}-table__cell--right`) #{line.total}
//- Totals Section //- Totals Section
div(class=`${prefix}-totals`) div(class=`${prefix}-totals`)

View File

@@ -194,7 +194,7 @@ export const defaultInvoicePdfTemplateAttributes = {
// Entries // Entries
lineItemLabel: 'Item', lineItemLabel: 'Item',
lineDescriptionLabel: 'Description', lineQuantityLabel: 'Qty',
lineRateLabel: 'Rate', lineRateLabel: 'Rate',
lineTotalLabel: 'Total', lineTotalLabel: 'Total',