Add persistent invoice template management

This commit is contained in:
2026-03-13 16:02:46 +01:00
parent ff237332e1
commit 490be6a89b
16 changed files with 1254 additions and 146 deletions

View File

@@ -1,3 +1,2 @@
export const USER_STORAGE_KEY = "muh.current-user";
export const AUTH_TOKEN_STORAGE_KEY = "muh.auth-token";
export const INVOICE_TEMPLATE_STORAGE_KEY = "muh.invoice-template";

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@ export default function LoginPage() {
const [showRegistration, setShowRegistration] = useState(false);
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [loginInputsUnlocked, setLoginInputsUnlocked] = useState(false);
const [showLoginValidation, setShowLoginValidation] = useState(false);
const [showRegisterValidation, setShowRegisterValidation] = useState(false);
const [registration, setRegistration] = useState({
@@ -28,6 +29,10 @@ export default function LoginPage() {
const [feedback, setFeedback] = useState<FeedbackState>(null);
const { setSession } = useSession();
function unlockLoginInputs() {
setLoginInputsUnlocked(true);
}
async function handlePasswordLogin(event: FormEvent<HTMLFormElement>) {
event.preventDefault();
setShowLoginValidation(true);
@@ -116,14 +121,23 @@ export default function LoginPage() {
<div className="auth-grid">
{!showRegistration ? (
<form className={`login-panel__section ${showLoginValidation ? "show-validation" : ""}`} onSubmit={handlePasswordLogin}>
<form
className={`login-panel__section ${showLoginValidation ? "show-validation" : ""}`}
onSubmit={handlePasswordLogin}
autoComplete="off"
>
<label className="field field--required">
<span>E-Mail</span>
<input
type="email"
name="login-email"
value={email}
onChange={(event) => setEmail(event.target.value)}
onFocus={unlockLoginInputs}
onPointerDown={unlockLoginInputs}
placeholder="z. B. name@hof.de"
autoComplete="off"
readOnly={!loginInputsUnlocked}
required
/>
</label>
@@ -131,8 +145,13 @@ export default function LoginPage() {
<span>Passwort</span>
<input
type="password"
name="login-password"
value={password}
onChange={(event) => setPassword(event.target.value)}
onFocus={unlockLoginInputs}
onPointerDown={unlockLoginInputs}
autoComplete="new-password"
readOnly={!loginInputsUnlocked}
required
/>
</label>

View File

@@ -751,6 +751,9 @@ a {
grid-template-rows: auto minmax(0, 1fr);
height: 100%;
padding: 20px;
background: var(--surface-strong);
box-shadow: none;
backdrop-filter: none;
overflow: hidden;
}
@@ -854,13 +857,14 @@ a {
}
.invoice-template__canvas-shell {
position: relative;
display: flex;
justify-content: center;
align-items: flex-start;
height: 100%;
min-height: 0;
overflow: hidden;
padding: 0 0 8px;
padding: 0 0 10px;
box-sizing: border-box;
}
@@ -883,7 +887,6 @@ a {
linear-gradient(90deg, transparent 31px, rgba(37, 49, 58, 0.05) 32px),
#fffdf9;
background-size: auto, 32px 32px, 32px 32px, auto;
box-shadow: 0 32px 60px rgba(54, 44, 27, 0.12);
overflow: hidden;
transform-origin: top left;
will-change: transform;
@@ -891,7 +894,7 @@ a {
.invoice-template__canvas.is-active {
border-color: rgba(17, 109, 99, 0.48);
box-shadow: 0 32px 60px rgba(54, 44, 27, 0.12), 0 0 0 6px rgba(17, 109, 99, 0.08);
box-shadow: 0 0 0 6px rgba(17, 109, 99, 0.08);
}
.invoice-template__canvas::before {
@@ -924,9 +927,15 @@ a {
color: var(--text);
cursor: move;
box-shadow: none;
overflow: visible;
user-select: none;
}
.invoice-template__canvas-element--line,
.invoice-template__canvas-element--image {
padding: 0;
}
.invoice-template__canvas-element:hover,
.invoice-template__canvas-element.is-selected {
border-color: rgba(17, 109, 99, 0.28);
@@ -938,6 +947,11 @@ a {
z-index: 2;
}
.invoice-template__canvas-element.is-resizing {
cursor: nwse-resize;
z-index: 3;
}
.invoice-template__canvas-element-text {
display: block;
line-height: 1.35;
@@ -945,6 +959,56 @@ a {
word-break: break-word;
}
.invoice-template__canvas-line {
display: block;
width: 100%;
height: 100%;
border-radius: 999px;
background: rgba(37, 49, 58, 0.82);
pointer-events: none;
}
.invoice-template__canvas-image {
display: block;
width: 100%;
height: 100%;
border-radius: 16px;
object-fit: contain;
pointer-events: none;
}
.invoice-template__canvas-image-placeholder {
display: grid;
place-items: center;
width: 100%;
height: 100%;
min-height: 100%;
padding: 12px;
border: 1px dashed rgba(17, 109, 99, 0.28);
border-radius: 18px;
background: rgba(17, 109, 99, 0.05);
color: var(--muted);
font-size: 0.82rem;
line-height: 1.4;
pointer-events: none;
text-align: center;
}
.invoice-template__canvas-element-resize-handle {
position: absolute;
right: -7px;
bottom: -7px;
width: 14px;
height: 14px;
border: 1px solid rgba(17, 109, 99, 0.48);
border-radius: 999px;
background: var(--surface-strong);
box-shadow: 0 0 0 3px rgba(17, 109, 99, 0.12);
cursor: nwse-resize;
pointer-events: auto;
touch-action: none;
}
.invoice-template__inspector {
display: grid;
gap: 12px;
@@ -957,7 +1021,9 @@ a {
.invoice-template__inspector-actions {
display: flex;
gap: 12px;
justify-content: flex-end;
flex-wrap: wrap;
}
.invoice-template-page .field-grid {