Author SHA1 Message Date
odwetaandCopilot App a14500c7ab Decrease PDF invoice item row height by ~10%
Reduce the item table row height from 25pt to 22.5pt and re-center
the cell text within the shorter rows. The header row height is
unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-10 17:22:31 +02:00
odweta 5882a957ad Merge pull request #3 from odweta/odweta-fictional-barnacle
Add CI/CD GitHub Actions workflow for dev image deploys
2026-09-10 16:06:28 +02:00
odwetaandCopilot App f4d2c30493 Add CI/CD GitHub Actions workflow for dev image builds
- Run tests on push/PR to main
- Build and push Docker image to GHCR as :dev and :dev-<sha> on push to main
- Document image pull/run instructions in README

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-10 16:05:06 +02:00
odweta 3848ab47df Merge pull request #2 from odweta/odweta-invoice-pdf-styling
Unify manual and ZIP-exported invoice PDF styling
2026-09-10 16:01:24 +02:00
odweta 84657b9610 Merge pull request #1 from odweta/odweta-invoice-due-dates
Remove custom invoice due date option
2026-09-10 15:59:39 +02:00
odwetaandCopilot App 2bcf9a2f02 Remove custom invoice due date option
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-10 15:58:43 +02:00
5 changed files with 124 additions and 20 deletions
+85
View File
@@ -0,0 +1,85 @@
name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: app/package-lock.json
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
build-and-push:
name: Build and push image (dev)
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=dev
type=sha,prefix=dev-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./app
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Summary
run: |
echo "### Dev image published :rocket:" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
echo "${{ steps.meta.outputs.tags }}" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
+28
View File
@@ -20,3 +20,31 @@ docker compose up --build
Then open `http://localhost:3001` and create an account. PostgreSQL data is kept
in the `postgres-data` Docker volume, so it survives app and container restarts.
To remove the database as well, run `docker compose down -v`.
## CI/CD
On every push to `main`, GitHub Actions (`.github/workflows/ci-cd.yml`) runs the
test suite, then builds and publishes a dev image to the GitHub Container
Registry:
```
ghcr.io/odweta/fakturovac:dev
```
A commit-pinned tag (`ghcr.io/odweta/fakturovac:dev-<short-sha>`) is published
alongside `:dev` for traceability. Pull requests only run the test job.
To pull and run the latest dev image in a testing environment:
```bash
docker login ghcr.io -u <your-github-username> # only needed if the package is private
docker pull ghcr.io/odweta/fakturovac:dev
docker run -d -p 3001:3001 \
-e DATABASE_URL=postgres://fakturovac:fakturovac@<db-host>:5432/fakturovac \
-e NODE_ENV=production \
ghcr.io/odweta/fakturovac:dev
```
The package's visibility (public/private) is managed under the repository's
**Packages** settings on GitHub; no extra secrets are required since the
workflow authenticates with the built-in `GITHUB_TOKEN`.
+9 -8
View File
@@ -539,28 +539,29 @@ const renderInvoicePdf = async (document, invoice) => {
const tableTop = document.y + 12;
const columns = [0, pageWidth * 0.52, pageWidth * 0.68, pageWidth * 0.82, pageWidth];
const rowHeight = 25;
document.rect(document.page.margins.left, tableTop, pageWidth, rowHeight).fill('#eef1f3');
const headerRowHeight = 25;
const itemRowHeight = 22.5;
document.rect(document.page.margins.left, tableTop, pageWidth, headerRowHeight).fill('#eef1f3');
document.fillColor(navy).font(boldFont).fontSize(9);
['Položka', 'Množství', 'MJ', 'Cena za MJ'].forEach((heading, index) => {
document.text(heading, document.page.margins.left + columns[index] + 6, tableTop + 8, {
width: columns[index + 1] - columns[index] - 12
});
});
document.y = tableTop + rowHeight;
document.y = tableTop + headerRowHeight;
(data.items || []).forEach((item, index) => {
const rowTop = document.y;
document.rect(document.page.margins.left, rowTop, pageWidth, rowHeight)
document.rect(document.page.margins.left, rowTop, pageWidth, itemRowHeight)
.fill(index % 2 ? lightBlue : warm);
document.moveTo(document.page.margins.left, rowTop + rowHeight)
.lineTo(document.page.margins.left + pageWidth, rowTop + rowHeight)
document.moveTo(document.page.margins.left, rowTop + itemRowHeight)
.lineTo(document.page.margins.left + pageWidth, rowTop + itemRowHeight)
.strokeColor(line).lineWidth(0.7).stroke();
document.fillColor(bodyText).font(regularFont).fontSize(9);
[pdfText(item.popis), formatCzechNumber(item.mnozstvi), pdfText(item.mernaJednotka), `${formatCzechNumber(item.cenaZaMj)}`]
.forEach((value, columnIndex) => document.text(value, document.page.margins.left + columns[columnIndex] + 6, rowTop + 8, {
.forEach((value, columnIndex) => document.text(value, document.page.margins.left + columns[columnIndex] + 6, rowTop + 6, {
width: columns[columnIndex + 1] - columns[columnIndex] - 12
}));
document.y = rowTop + rowHeight;
document.y = rowTop + itemRowHeight;
});
document.y += 18;
-5
View File
@@ -312,13 +312,8 @@
<select id="dueDateOption">
<option value="14">14 dní</option>
<option value="30">30 dní</option>
<option value="custom">Vlastní počet dní</option>
</select>
</div>
<div class="form-group custom-due-days-group" hidden>
<label for="customDueDays">Počet dní</label>
<input id="customDueDays" type="number" min="1" step="1" value="14" />
</div>
<output id="dueDateDisplay" class="due-date-display"></output>
</div>
</div>
+1 -6
View File
@@ -41,8 +41,6 @@ const savePasswordButton = document.getElementById("savePasswordButton");
const cancelPasswordButton = document.getElementById("cancelPasswordButton");
const passwordStatus = document.getElementById("passwordStatus");
const dueDateOption = document.getElementById("dueDateOption");
const customDueDays = document.getElementById("customDueDays");
const customDueDaysGroup = document.querySelector(".custom-due-days-group");
const dueDateDisplay = document.getElementById("dueDateDisplay");
const paymentPresetSelect = document.getElementById("paymentPresetSelect");
const paymentPresetName = document.getElementById("paymentPresetName");
@@ -110,9 +108,7 @@ const getClientLabel = (client) => [
const formatCzechDate = (dateValue) => new Date(`${dateValue}T00:00:00`).toLocaleDateString("cs-CZ");
const getDueDays = () => dueDateOption.value === "custom"
? Math.max(1, Number.parseInt(customDueDays.value, 10) || 14)
: Number.parseInt(dueDateOption.value, 10);
const getDueDays = () => Number.parseInt(dueDateOption.value, 10) || 14;
const getDueDate = () => {
const dueDate = new Date();
@@ -122,7 +118,6 @@ const getDueDate = () => {
};
const updateDueDate = () => {
customDueDaysGroup.hidden = dueDateOption.value !== "custom";
dueDateDisplay.textContent = `Splatnost: ${formatCzechDate(getDueDate())}`;
};