Highlight und neue ID

This commit is contained in:
Moritz Utcke
2025-03-25 14:01:13 -03:00
parent 84a3a2dd39
commit 5d66eb10ca
89 changed files with 1650 additions and 601 deletions

View File

@@ -48,7 +48,7 @@
openWindowWithPost("/kundendaten", {
ausweis,
ausweis: { ...ausweis, ausweistyp },
objekt,
aufnahme,
bilder,
@@ -80,11 +80,11 @@
window.history.pushState(
{},
"",
`${location.pathname}?uid=${ausweis.uid}`
`${location.pathname}?uid=${ausweis.id}`
);
localStorage.clear()
window.location.href = `/speichern-erfolgreich?uid=${ausweis.uid}`
window.location.href = `/speichern-erfolgreich?uid=${ausweis.id}`
}
}

View File

@@ -31,13 +31,8 @@ export type UploadedGebaeudeBild = OmitKeys<Bild, "id" | "aufnahme_id"> & {
* @export
* @typedef {VerbrauchsausweisWohnenClient}
*/
export type VerbrauchsausweisWohnenClient = OmitKeys<
VerbrauchsausweisWohnen,
"id" | "aufnahme_id" | "benutzer_id"
> & {
uid_objekt: string,
uid_aufnahme: string,
uid_benutzer?: string
export type VerbrauchsausweisWohnenClient = VerbrauchsausweisWohnen & {
objekt_id: string
};
/**
@@ -50,13 +45,8 @@ export type VerbrauchsausweisWohnenClient = OmitKeys<
* @export
* @typedef {VerbrauchsausweisWohnenClient}
*/
export type VerbrauchsausweisGewerbeClient = OmitKeys<
VerbrauchsausweisGewerbe,
"id" | "aufnahme_id" | "benutzer_id"
> & {
uid_objekt: string,
uid_aufnahme: string,
uid_benutzer?: string
export type VerbrauchsausweisGewerbeClient = VerbrauchsausweisGewerbe & {
objekt_id: string
};
/**
@@ -69,13 +59,8 @@ export type VerbrauchsausweisGewerbeClient = OmitKeys<
* @export
* @typedef {VerbrauchsausweisWohnenClient}
*/
export type BedarfsausweisWohnenClient = OmitKeys<
BedarfsausweisWohnen,
"id" | "aufnahme_id" | "benutzer_id"
> & {
uid_objekt: string,
uid_aufnahme: string,
uid_benutzer?: string
export type BedarfsausweisWohnenClient = BedarfsausweisWohnen & {
objekt_id: string
};
/**
@@ -88,20 +73,15 @@ export type BedarfsausweisWohnenClient = OmitKeys<
* @export
* @typedef {ObjektClient}
*/
export type ObjektClient = OmitKeys<Objekt, "benutzer_id" | "id">;
export type ObjektClient = Objekt;
export type AufnahmeClient = OmitKeys<
Aufnahme,
"id" | "objekt_id" | "benutzer_id"
> & {
uid_objekt: string
};
export type AufnahmeClient = Aufnahme
export type TicketClient = OmitKeys<Tickets, "bearbeiter_id" | "benutzer_id" | "id">
export type BenutzerClient = OmitKeys<Benutzer, "id" | "passwort">;
export type BenutzerClient = OmitKeys<Benutzer, "passwort">;
export type RechnungClient = OmitKeys<Rechnung, "id">
export type RechnungClient = Rechnung
export function ZodOverlap<T, S = z.ZodType<T, z.ZodTypeDef, T>>(arg: S): S {
return arg;
@@ -122,34 +102,34 @@ export type OptionalNullable<T> = T extends object ? {
} : T;
export const UUidWithPrefix = z.string().refine((value) => {
const prefixedUUidRegex = /^([0-9a-z]+)-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i
const prefixedUUidRegex = /^([A-Z]{2})[0-9A-Z]{6}$/i
const match = value.match(prefixedUUidRegex)
if (match && match[1] in VALID_UUID_PREFIXES) {
if (match && Object.values(VALID_UUID_PREFIXES).indexOf(match[1] as VALID_UUID_PREFIXES) > -1) {
return true;
}
return false;
})
export function getAusweisartFromUUID(uid: string): Enums.Ausweisart | null {
if (!UUidWithPrefix.safeParse(uid).success) {
export function getAusweisartFromUUID(id: string): Enums.Ausweisart | null {
if (!UUidWithPrefix.safeParse(id).success) {
return null
}
switch(uid.split("-")[0]) {
case "vaw":
switch(id.slice(0, 2) as VALID_UUID_PREFIXES) {
case VALID_UUID_PREFIXES.VerbrauchsausweisWohnen:
return Enums.Ausweisart.VerbrauchsausweisWohnen
case "vag":
case VALID_UUID_PREFIXES.VerbrauchsausweisGewerbe:
return Enums.Ausweisart.VerbrauchsausweisGewerbe
case "baw":
case VALID_UUID_PREFIXES.BedarfsausweisWohnen:
return Enums.Ausweisart.BedarfsausweisWohnen
case "bag":
case VALID_UUID_PREFIXES.BedarfsausweisGewerbe:
return Enums.Ausweisart.BedarfsausweisGewerbe
case "gnw":
case VALID_UUID_PREFIXES.GEGNachweisWohnen:
return Enums.Ausweisart.GEGNachweisWohnen
case "gng":
case VALID_UUID_PREFIXES.GEGNachweisGewerbe:
return Enums.Ausweisart.GEGNachweisGewerbe
default:
return null

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { PRICES } from "#lib/constants.js";
import { Enums } from "#lib/client/prisma";
import { Enums } from "#lib/client/prisma.js";
export let bullets;
export let title;
export let ref = "";
@@ -56,9 +56,9 @@ bullets = [
<div class="zeile grid grid-cols-subgrid col-span-4 py-4 border-b-[0px] justify-items-center items-center">
<div class="justify-self-start pl-2"></div>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude/" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Standard}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Beratung}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
<a href="{ref}/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?ausweistyp={Enums.AusweisTyp.Offline}" ><button class="bestellbutton" type="button">sofort<br>bestellen</button></a>
</div>
</div>