Add invoice template editor
This commit is contained in:
@@ -13,6 +13,7 @@ import SearchPage from "./pages/SearchPage";
|
|||||||
import SearchFarmerPage from "./pages/SearchFarmerPage";
|
import SearchFarmerPage from "./pages/SearchFarmerPage";
|
||||||
import SearchCalendarPage from "./pages/SearchCalendarPage";
|
import SearchCalendarPage from "./pages/SearchCalendarPage";
|
||||||
import UserManagementPage from "./pages/UserManagementPage";
|
import UserManagementPage from "./pages/UserManagementPage";
|
||||||
|
import InvoiceTemplatePage from "./pages/InvoiceTemplatePage";
|
||||||
|
|
||||||
function ProtectedRoutes() {
|
function ProtectedRoutes() {
|
||||||
const { user, ready } = useSession();
|
const { user, ready } = useSession();
|
||||||
@@ -35,6 +36,7 @@ function ProtectedRoutes() {
|
|||||||
<Route path="/samples/:sampleId/anamnesis" element={<AnamnesisPage />} />
|
<Route path="/samples/:sampleId/anamnesis" element={<AnamnesisPage />} />
|
||||||
<Route path="/samples/:sampleId/antibiogram" element={<AntibiogramPage />} />
|
<Route path="/samples/:sampleId/antibiogram" element={<AntibiogramPage />} />
|
||||||
<Route path="/samples/:sampleId/therapy" element={<TherapyPage />} />
|
<Route path="/samples/:sampleId/therapy" element={<TherapyPage />} />
|
||||||
|
<Route path="/invoice-template" element={<InvoiceTemplatePage />} />
|
||||||
<Route path="/admin" element={<Navigate to={isAdmin ? "/admin/landwirte" : "/admin/benutzer"} replace />} />
|
<Route path="/admin" element={<Navigate to={isAdmin ? "/admin/landwirte" : "/admin/benutzer"} replace />} />
|
||||||
<Route path="/admin/benutzer" element={<UserManagementPage />} />
|
<Route path="/admin/benutzer" element={<UserManagementPage />} />
|
||||||
<Route path="/admin/landwirte" element={<AdministrationPage />} />
|
<Route path="/admin/landwirte" element={<AdministrationPage />} />
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const PAGE_TITLES: Record<string, string> = {
|
|||||||
"/home": "Startseite",
|
"/home": "Startseite",
|
||||||
"/samples/new": "Neuanlage einer Probe",
|
"/samples/new": "Neuanlage einer Probe",
|
||||||
"/portal": "MUH-Portal",
|
"/portal": "MUH-Portal",
|
||||||
|
"/invoice-template": "Rechnungstemplate",
|
||||||
};
|
};
|
||||||
|
|
||||||
function resolvePageTitle(pathname: string) {
|
function resolvePageTitle(pathname: string) {
|
||||||
@@ -79,6 +80,9 @@ export default function AppShell() {
|
|||||||
<div className="nav-group">
|
<div className="nav-group">
|
||||||
<div className="nav-group__label">Verwaltung</div>
|
<div className="nav-group__label">Verwaltung</div>
|
||||||
<div className="nav-subnav">
|
<div className="nav-subnav">
|
||||||
|
<NavLink to="/invoice-template" className={({ isActive }) => `nav-sublink ${isActive ? "is-active" : ""}`}>
|
||||||
|
Rechnungstemplate
|
||||||
|
</NavLink>
|
||||||
<NavLink to="/admin/landwirte" className={({ isActive }) => `nav-sublink ${isActive ? "is-active" : ""}`}>
|
<NavLink to="/admin/landwirte" className={({ isActive }) => `nav-sublink ${isActive ? "is-active" : ""}`}>
|
||||||
Landwirte
|
Landwirte
|
||||||
</NavLink>
|
</NavLink>
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export const USER_STORAGE_KEY = "muh.current-user";
|
export const USER_STORAGE_KEY = "muh.current-user";
|
||||||
export const AUTH_TOKEN_STORAGE_KEY = "muh.auth-token";
|
export const AUTH_TOKEN_STORAGE_KEY = "muh.auth-token";
|
||||||
|
export const INVOICE_TEMPLATE_STORAGE_KEY = "muh.invoice-template";
|
||||||
|
|||||||
1252
frontend/src/pages/InvoiceTemplatePage.tsx
Normal file
1252
frontend/src/pages/InvoiceTemplatePage.tsx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -741,7 +741,314 @@ a {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invoice-template-page {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page__card {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto minmax(0, 1fr);
|
||||||
|
height: 100%;
|
||||||
|
padding: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page__card .section-card__header {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page__card .page-actions {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(260px, 320px);
|
||||||
|
gap: 24px;
|
||||||
|
align-items: start;
|
||||||
|
min-height: 0;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel,
|
||||||
|
.invoice-template__canvas-column {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: auto minmax(0, 1fr);
|
||||||
|
gap: 18px;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel {
|
||||||
|
position: sticky;
|
||||||
|
top: 18px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel-header,
|
||||||
|
.invoice-template__canvas-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: end;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel-header h4,
|
||||||
|
.invoice-template__canvas-header h4 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel-note {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.82rem;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__palette {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 6px;
|
||||||
|
align-content: start;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__tile {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border: 1px solid rgba(37, 49, 58, 0.1);
|
||||||
|
border-radius: 18px;
|
||||||
|
background: rgba(255, 255, 255, 0.72);
|
||||||
|
text-align: left;
|
||||||
|
cursor: grab;
|
||||||
|
transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__tile:hover {
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 18px 36px rgba(54, 44, 27, 0.1);
|
||||||
|
border-color: rgba(17, 109, 99, 0.22);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__tile strong,
|
||||||
|
.invoice-template__tile span,
|
||||||
|
.invoice-template__tile small {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__tile span {
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 0.84rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__tile small {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-shell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: flex-start;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0 0 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-stage {
|
||||||
|
position: relative;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas {
|
||||||
|
position: relative;
|
||||||
|
width: 794px;
|
||||||
|
min-width: 794px;
|
||||||
|
height: 1123px;
|
||||||
|
border: 1px dashed rgba(17, 109, 99, 0.22);
|
||||||
|
border-radius: 32px;
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(17, 109, 99, 0.03), transparent 18%),
|
||||||
|
linear-gradient(transparent 31px, rgba(37, 49, 58, 0.05) 32px),
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 28px;
|
||||||
|
border: 1px solid rgba(37, 49, 58, 0.05);
|
||||||
|
border-radius: 20px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-empty {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
height: 100%;
|
||||||
|
padding: 48px;
|
||||||
|
color: var(--muted);
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-element {
|
||||||
|
position: absolute;
|
||||||
|
display: grid;
|
||||||
|
gap: 0;
|
||||||
|
padding: 4px 5px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--text);
|
||||||
|
cursor: move;
|
||||||
|
box-shadow: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-element:hover,
|
||||||
|
.invoice-template__canvas-element.is-selected {
|
||||||
|
border-color: rgba(17, 109, 99, 0.28);
|
||||||
|
background: rgba(17, 109, 99, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-element.is-dragging {
|
||||||
|
cursor: grabbing;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-element-text {
|
||||||
|
display: block;
|
||||||
|
line-height: 1.35;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__inspector {
|
||||||
|
display: grid;
|
||||||
|
gap: 12px;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 6px;
|
||||||
|
align-content: start;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__inspector-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page .field-grid {
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page .field input,
|
||||||
|
.invoice-template-page .field select,
|
||||||
|
.invoice-template-page .field textarea {
|
||||||
|
padding: 10px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template-page .field textarea {
|
||||||
|
min-height: 88px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-backdrop {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
padding: 28px;
|
||||||
|
background: rgba(29, 36, 40, 0.42);
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
display: grid;
|
||||||
|
gap: 18px;
|
||||||
|
width: min(1120px, 100%);
|
||||||
|
max-height: calc(100vh - 56px);
|
||||||
|
padding: 24px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.42);
|
||||||
|
border-radius: var(--radius-xl);
|
||||||
|
background: rgba(255, 248, 240, 0.96);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog--wide {
|
||||||
|
width: min(1180px, 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__header h4 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__actions a {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__body {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__body--pdf {
|
||||||
|
height: min(80vh, 900px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__frame {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
|
.invoice-template-page,
|
||||||
|
.invoice-template-page__card {
|
||||||
|
height: auto;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
.app-shell {
|
.app-shell {
|
||||||
grid-template-columns: 240px minmax(0, 1fr);
|
grid-template-columns: 240px minmax(0, 1fr);
|
||||||
}
|
}
|
||||||
@@ -753,10 +1060,25 @@ a {
|
|||||||
.portal-grid,
|
.portal-grid,
|
||||||
.form-grid,
|
.form-grid,
|
||||||
.field-grid,
|
.field-grid,
|
||||||
.metrics-grid {
|
.metrics-grid,
|
||||||
|
.invoice-template {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invoice-template__panel {
|
||||||
|
position: static;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__palette,
|
||||||
|
.invoice-template__inspector {
|
||||||
|
overflow: visible;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invoice-template__palette {
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
.quarter-grid {
|
.quarter-grid {
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
@@ -786,4 +1108,27 @@ a {
|
|||||||
.quarter-grid {
|
.quarter-grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invoice-template__canvas-shell {
|
||||||
|
margin-inline: 0;
|
||||||
|
padding-inline: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-backdrop {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog {
|
||||||
|
padding: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__header {
|
||||||
|
align-items: flex-start;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog__body--pdf {
|
||||||
|
height: 72vh;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user