Bilder fix Datenblatt

This commit is contained in:
Moritz Utcke
2025-04-01 09:35:15 -03:00
parent c8b41458e1
commit 14e1d89024
41 changed files with 272 additions and 320 deletions

View File

@@ -1,8 +1,6 @@
import { getAusweisartFromUUID } from "#components/Ausweis/types.js";
import { getAusweisartFromId } from "#components/Ausweis/types.js";
import { adminMiddleware } from "#lib/middleware/authorization.js";
import { pdfDatenblattVerbrauchsausweisWohnen } from "#lib/pdf/pdfDatenblattVerbrauchsausweisWohnen.js";
import { pdfVerbrauchsausweisWohnen } from "#lib/pdf/pdfVerbrauchsausweisWohnen.js";
import { Enums, prisma } from "#lib/server/prisma";
import { Enums, prisma } from "#lib/server/prisma.js";
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
import { z } from "astro:content";
import { fileURLToPath } from "url";
@@ -14,17 +12,17 @@ import { PERSISTENT_DIR } from "#lib/server/constants.js";
export const GET = defineApiRoute({
input: z.object({
uid_ausweis: z.string(),
id_ausweis: z.string(),
}),
output: z.void(),
middleware: adminMiddleware,
async fetch({ uid_ausweis }, context, user) {
const ausweisart = getAusweisartFromUUID(uid);
async fetch({ id_ausweis }, context, user) {
const ausweisart = getAusweisartFromId(id_ausweis);
if (ausweisart === "VerbrauchsausweisWohnen") {
const ausweis = await prisma.verbrauchsausweisWohnen.findUnique({
where: {
uid: uid_ausweis,
id: id_ausweis
},
include: {
aufnahme: {
@@ -50,7 +48,7 @@ export const GET = defineApiRoute({
const rechnung = await prisma.rechnung.findFirst({
where: {
verbrauchsausweis_wohnen: {
uid: uid_ausweis
id: id_ausweis
},
},
orderBy: {
@@ -100,7 +98,7 @@ export const GET = defineApiRoute({
if (pdfAusweis) {
const pdfAusweisPath = fileURLToPath(
new URL(
`${PERSISTENT_DIR}/generated/Ausweis-${ausweis.uid}.pdf`,
`${PERSISTENT_DIR}/generated/Ausweis-${ausweis.id}.pdf`,
import.meta.url
)
);
@@ -110,7 +108,7 @@ export const GET = defineApiRoute({
if (pdfDatenblatt) {
const pdfDatenblattPath = fileURLToPath(
new URL(
`${PERSISTENT_DIR}/generated/Datenblatt-${ausweis.uid}.pdf`,
`${PERSISTENT_DIR}/generated/Datenblatt-${ausweis.id}.pdf`,
import.meta.url
)
);
@@ -160,7 +158,7 @@ fax 040 · 209339859
<tr><td>IBAN</td><td>:<td>\t DE81 2004 0000 0348 6008 00</td>
<tr><td>BIC</td><td>:</td><td>\t COBADEFFXXX</td>
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${rechnung.uid}</b></td>
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${rechnung.id}</b></td>
</table>
<br>
@@ -170,11 +168,11 @@ Alternativ können Sie auch direkt online zahlen indem Sie auf den entsprechende
<br>
<table>
<tr><td>Per Einzuglastschrift zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.uid}&p=SEPA'>jetzt per ELV bezahlen</a></td></tr>
<tr><td>Per Sofortüberweisung zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.uid}&p=Sofort'>jetzt per Sofortüberweisung bezahlen</a></td></tr>
<tr><td>Über PayPal zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.uid}&p=PayPal'>jetzt per Paypal bezahlen</a></td></tr>
<tr><td>Per Giropay zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.uid}&p=Giropay'>jetzt per Giropay bezahlen</a></td></tr>
<tr><td>Per Visa oder MasterCard zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.uid}&p=Kreditkarte'>jetzt per Kreditkarte bezahlen</a></td></tr>
<tr><td>Per Einzuglastschrift zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.id}&p=SEPA'>jetzt per ELV bezahlen</a></td></tr>
<tr><td>Per Sofortüberweisung zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.id}&p=Sofort'>jetzt per Sofortüberweisung bezahlen</a></td></tr>
<tr><td>Über PayPal zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.id}&p=PayPal'>jetzt per Paypal bezahlen</a></td></tr>
<tr><td>Per Giropay zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.id}&p=Giropay'>jetzt per Giropay bezahlen</a></td></tr>
<tr><td>Per Visa oder MasterCard zahlen</td> <td>:</td> <td><a href='${BASE_URI}/energieausweis-erstellen/kaufabschluss-fortsetzen?uid=${ausweis.id}&p=Kreditkarte'>jetzt per Kreditkarte bezahlen</a></td></tr>
</table>
<br>
@@ -204,7 +202,7 @@ fax 040 · 209339859
await transport.sendMail({
from: `"IBCornelsen" <info@online-energieausweis.org>`,
to: user.email,
subject: `Ihr Originalausweis vom Ingenieurbüro Cornelsen (ID: ${ausweis.uid})`,
subject: `Ihr Originalausweis vom Ingenieurbüro Cornelsen (ID: ${ausweis.id})`,
text,
});

View File

@@ -1,5 +1,5 @@
import {
getAusweisartFromUUID,
getAusweisartFromId,
UUidWithPrefix,
} from "#components/Ausweis/types.js";
import {
@@ -26,7 +26,7 @@ export const GET = defineApiRoute({
headers: authorizationHeaders,
middleware: adminMiddleware,
async fetch({ uid }, context, user) {
const ausweisart = getAusweisartFromUUID(uid);
const ausweisart = getAusweisartFromId(uid);
const adapter = getPrismaAusweisAdapter(
uid
) as typeof prisma.verbrauchsausweisWohnen;

View File

@@ -1,4 +1,4 @@
import { UUidWithPrefix, getAusweisartFromUUID } from "#components/Ausweis/types.js"
import { UUidWithPrefix, getAusweisartFromId } from "#components/Ausweis/types.js"
import { Enums } from "#lib/client/prisma.js"
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js"
import { mollieClient } from "#lib/mollie.js"
@@ -88,7 +88,7 @@ export const PATCH = defineApiRoute({
})
}
const ausweisart = getAusweisartFromUUID(ausweis.id)
const ausweisart = getAusweisartFromId(ausweis.id)
if (!ausweisart) {
throw new APIError({

View File

@@ -1,4 +1,4 @@
import { getAusweisartFromUUID, UUidWithPrefix } from "#components/Ausweis/types.js";
import { getAusweisartFromId, UUidWithPrefix } from "#components/Ausweis/types.js";
import { omit } from "#lib/helpers.js";
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
import { sendGEGAnforderungsMail } from "#lib/server/mail/geg-anfordern.js";
@@ -18,7 +18,7 @@ export const PUT = defineApiRoute({
headers: authorizationHeaders,
middleware: authorizationMiddleware,
async fetch(input, context, user) {
const ausweisart = getAusweisartFromUUID(input.nachweis_id);
const ausweisart = getAusweisartFromId(input.nachweis_id);
let einpreisung;
let nachweis: GEGNachweisWohnen | GEGNachweisGewerbe;