From aab95ee4442f2b6354e7d2e65b7e7f12cc96da27 Mon Sep 17 00:00:00 2001
From: Lorenz Stechauner <lorenz.stechauner@necronda.net>
Date: Wed, 6 Sep 2023 17:01:59 +0200
Subject: [PATCH] Documents: Split stylesheet into multiple files

---
 Elwig/Documents/BusinessDocument.cshtml    |   1 +
 Elwig/Documents/DeliveryNote.cshtml        |   1 +
 Elwig/Documents/Document.cshtml            |   1 +
 Elwig/Documents/style-businessdocument.css | 142 ++++++++++
 Elwig/Documents/style-deliverynote.css     |  93 +++++++
 Elwig/Documents/style-page.css             |  71 +++++
 Elwig/Documents/style.css                  | 295 ---------------------
 7 files changed, 309 insertions(+), 295 deletions(-)
 create mode 100644 Elwig/Documents/style-businessdocument.css
 create mode 100644 Elwig/Documents/style-deliverynote.css
 create mode 100644 Elwig/Documents/style-page.css

diff --git a/Elwig/Documents/BusinessDocument.cshtml b/Elwig/Documents/BusinessDocument.cshtml
index 981a88f..3a17172 100644
--- a/Elwig/Documents/BusinessDocument.cshtml
+++ b/Elwig/Documents/BusinessDocument.cshtml
@@ -2,6 +2,7 @@
 @inherits TemplatePage<Elwig.Documents.BusinessDocument>
 @model Elwig.Documents.BusinessDocument
 @{ Layout = "Document"; }
+<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-businessdocument.css" />
 <div class="info-wrapper">
     <div class="address-wrapper">
         <div class="sender">
diff --git a/Elwig/Documents/DeliveryNote.cshtml b/Elwig/Documents/DeliveryNote.cshtml
index d89de8b..00e53a5 100644
--- a/Elwig/Documents/DeliveryNote.cshtml
+++ b/Elwig/Documents/DeliveryNote.cshtml
@@ -2,6 +2,7 @@
 @inherits TemplatePage<Elwig.Documents.DeliveryNote>
 @model Elwig.Documents.DeliveryNote
 @{ Layout = "BusinessDocument"; }
+<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliverynote.css" />
 <main>
 <div class="date">@Model.Location, am @($"{Model.Date:dd.MM.yyyy}")</div>
 <h1>@Model.Title</h1>
diff --git a/Elwig/Documents/Document.cshtml b/Elwig/Documents/Document.cshtml
index d1d31bf..5f957bb 100644
--- a/Elwig/Documents/Document.cshtml
+++ b/Elwig/Documents/Document.cshtml
@@ -15,6 +15,7 @@
         }
     </script>
     <link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style.css"/>
+    <link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-page.css"/>
 </head>
 <body>
     <div class="m1"></div>
diff --git a/Elwig/Documents/style-businessdocument.css b/Elwig/Documents/style-businessdocument.css
new file mode 100644
index 0000000..b072950
--- /dev/null
+++ b/Elwig/Documents/style-businessdocument.css
@@ -0,0 +1,142 @@
+
+header, .address-wrapper, aside, main {
+    overflow: hidden;
+}
+
+header {
+    height: 45mm;
+    padding: 5mm;
+    position: absolute;
+    top: -25mm;
+    left: 0;
+    right: 0;
+    text-align: center;
+}
+
+header h1 {
+    font-size: 18pt;
+    margin-top: 10mm;
+}
+
+.spacing {
+    height: 20mm;
+}
+
+.info-wrapper {
+    width: 100%;
+    height: 45mm;
+    margin: 0 0 2mm 0;
+    position: relative;
+}
+
+.address-wrapper {
+    height: 45mm;
+    width: 85mm;
+    margin: 0;
+    padding: 5mm;
+    position: absolute;
+    left: -5mm;
+    top: 0;
+}
+
+.address-wrapper .sender {
+    height: 4em;
+    font-size: 8pt;
+    padding: 1em 0;
+}
+
+address {
+    height: 5em;
+    white-space: pre-line;
+    font-size: 12pt;
+    font-style: normal;
+}
+
+aside {
+    height: 40mm;
+    width: 75mm;
+    margin: 0;
+    position: absolute;
+    left: 100mm;
+    top: 5mm;
+}
+
+aside table {
+    border-collapse: collapse;
+    border: 0.5pt solid #808080;
+    width: 65mm;
+    margin-right: 10mm;
+}
+
+aside table thead:not(:first-child) tr {
+    border-top: 0.5pt solid #808080;
+}
+
+aside table thead th {
+    background-color: #E0E0E0;
+    font-size: 10pt;
+}
+
+aside table tbody th,
+aside table tbody td {
+    text-align: left;
+    font-size: 10pt;
+}
+
+aside table tbody th {
+    font-weight: normal;
+}
+
+main {
+    margin: 2em 0 1em 0;
+}
+
+main > *:first-child {
+    margin-top: 0;
+}
+
+.main-wrapper h1, .main-wrapper p {
+    font-size: 12pt;
+    margin: 1em 0;
+    text-align: justify;
+}
+
+.main-wrapper p {
+    widows: 3;
+    orphans: 3;
+    hyphens: manual;
+}
+
+.main-wrapper .date {
+    margin-bottom: 2em;
+    text-align: right;
+}
+
+.main-wrapper h1 {
+    margin-bottom: 2em;
+}
+
+.main-wrapper p.comment {
+    font-size: 10pt;
+}
+
+.main-wrapper .bottom {
+    bottom: 0;
+    position: absolute;
+    width: 165mm;
+}
+
+.main-wrapper .signatures {
+    width: 100%;
+    display: flex;
+    justify-content: space-around;
+    margin: 20mm 0 2mm 0;
+}
+
+.main-wrapper .signatures > * {
+    width: 50mm;
+    border-top: 0.5pt solid black;
+    padding-top: 1mm;
+    text-align: center;
+    font-size: 10pt;
+}
diff --git a/Elwig/Documents/style-deliverynote.css b/Elwig/Documents/style-deliverynote.css
new file mode 100644
index 0000000..c1b3ffe
--- /dev/null
+++ b/Elwig/Documents/style-deliverynote.css
@@ -0,0 +1,93 @@
+
+table.delivery {
+    margin-bottom: 5mm;
+}
+
+table.delivery tr:not(.main) {
+    break-before: avoid;
+}
+
+table.delivery th {
+    font-weight: normal;
+    font-style: italic;
+    font-size: 10pt;
+}
+
+table.delivery th.main {
+    text-align: left;
+}
+
+table.delivery tr.main td {
+    font-weight: bold;
+    padding-top: 2mm;
+}
+
+table.delivery tbody tr:not(.main) td {
+    font-size: 8pt;
+}
+
+table.delivery tr.tight:not(.first) td {
+    padding-top: 0;
+    padding-bottom: 0;
+}
+
+table.delivery tr.tight.first td {
+    padding-bottom: 0;
+}
+
+/* FIXME update version of WeasyPrint
+table.delivery tr.tight:has(+ tr:not(.tight)) td {
+padding-bottom: 0.5mm !important;
+}
+*/
+
+table.delivery tr.sum {
+    border-top: 0.5pt solid black;
+    break-before: avoid;
+}
+
+table.delivery tr.sum td {
+    padding-top: 1mm;
+}
+
+table.delivery-stats {
+    font-size: 8pt;
+}
+
+table.delivery-stats.expanded th,
+table.delivery-stats.expanded td {
+    padding: 0.25mm 0;
+}
+
+table.delivery-stats:not(.expanded) th,
+table.delivery-stats:not(.expanded) td {
+    padding: 0.125mm 0;
+}
+
+table.delivery-stats:not(.expanded) tr.optional {
+    display: none;
+}
+
+table.delivery-stats thead th {
+    font-weight: normal;
+    font-style: italic;
+    text-align: right;
+}
+
+table.delivery-stats thead th:first-child {
+    text-align: left;
+}
+
+table.delivery-stats.expanded tbody {
+    font-size: 10pt;
+}
+
+table.delivery-stats td {
+    text-align: right;
+}
+
+table.delivery-stats tbody th {
+    font-weight: normal;
+    font-style: italic;
+    text-align: left;
+}
diff --git a/Elwig/Documents/style-page.css b/Elwig/Documents/style-page.css
new file mode 100644
index 0000000..73452b7
--- /dev/null
+++ b/Elwig/Documents/style-page.css
@@ -0,0 +1,71 @@
+
+.m1, .m2, .m3 {
+    height: 0;
+    width: 10mm;
+    position: fixed;
+    left: -25mm;
+    border-top: 0.5pt solid black;
+}
+.m1.r, .m2.r, .m3.r {
+    left: initial;
+    right: -20mm;
+}
+.m1 {top: 80mm;}
+.m2 {top: 123.5mm;}
+.m3 {top: 185mm;}
+
+.page-break {
+    break-before: page;
+}
+hr.page-break {
+    display: none;
+}
+
+@page {
+    size: A4;
+    margin: 25mm 20mm 35mm 25mm;
+
+    @bottom-center {
+        content: element(page-footer);
+    }
+}
+
+@media screen {
+    body, header, .footer-wrapper {
+        width: 210mm;
+    }
+
+    header, .address-wrapper, aside, main {
+        border: 1px solid lightgray;
+    }
+
+    .m1, .m2, .m3 {
+        display: none;
+    }
+
+    header {
+        top: 0;
+    }
+
+    .spacing {
+        height: 45mm;
+    }
+
+    .main-wrapper {
+        margin: 0 20mm 40mm 25mm;
+    }
+
+    .footer-wrapper {
+        position: fixed;
+        bottom: 0;
+        left: 0;
+        right: 0;
+        background: white;
+    }
+}
+
+@media print {
+    .page::after {
+        content: "Seite " counter(page) " von " counter(pages);
+    }
+}
diff --git a/Elwig/Documents/style.css b/Elwig/Documents/style.css
index f2626e7..a751ccb 100644
--- a/Elwig/Documents/style.css
+++ b/Elwig/Documents/style.css
@@ -12,74 +12,6 @@ body {
     margin: 0;
 }
 
-.m1, .m2, .m3 {
-    height: 0;
-    width: 10mm;
-    position: fixed;
-    left: -25mm;
-    border-top: 0.5pt solid black;
-}
-.m1.r, .m2.r, .m3.r {
-    left: initial;
-    right: -20mm;
-}
-.m1 {top: 80mm;}
-.m2 {top: 123.5mm;}
-.m3 {top: 185mm;}
-
-header, .address-wrapper, aside, main {
-    overflow: hidden;
-}
-
-header {
-    height: 45mm;
-    padding: 5mm;
-    position: absolute;
-    top: -25mm;
-    left: 0;
-    right: 0;
-    text-align: center;
-}
-
-header h1{
-    font-size: 18pt;
-    margin-top: 10mm;
-}
-
-.spacing {
-    height: 20mm;
-}
-
-.info-wrapper {
-    width: 100%;
-    height: 45mm;
-    margin: 0 0 2mm 0;
-    position: relative;
-}
-
-.address-wrapper {
-    height: 45mm;
-    width: 85mm;
-    margin: 0;
-    padding: 5mm;
-    position: absolute;
-    left: -5mm;
-    top: 0;
-}
-
-.address-wrapper .sender {
-    height: 4em;
-    font-size: 8pt;
-    padding: 1em 0;
-}
-
-address {
-    height: 5em;
-    white-space: pre-line;
-    font-size: 12pt;
-    font-style: normal;
-}
-
 table {
     width: 100%;
     border-collapse: collapse;
@@ -95,74 +27,6 @@ table th {
     text-align: center;
 }
 
-aside {
-    height: 40mm;
-    width: 75mm;
-    margin: 0;
-    position: absolute;
-    left: 100mm;
-    top: 5mm;
-}
-
-aside table {
-    border-collapse: collapse;
-    border: 0.5pt solid #808080;
-    width: 65mm;
-    margin-right: 10mm;
-}
-
-aside table thead:not(:first-child) tr {
-    border-top: 0.5pt solid #808080;
-}
-
-aside table thead th {
-    background-color: #E0E0E0;
-    font-size: 10pt;
-}
-
-aside table tbody th,
-aside table tbody td {
-    text-align: left;
-    font-size: 10pt;
-}
-
-aside table tbody th {
-    font-weight: normal;
-}
-
-main {
-    margin: 2em 0 1em 0;
-}
-
-main > *:first-child {
-    margin-top: 0;
-}
-
-.main-wrapper h1, .main-wrapper p {
-    font-size: 12pt;
-    margin: 1em 0;
-    text-align: justify;
-}
-
-.main-wrapper p {
-    widows: 3;
-    orphans: 3;
-    hyphens: manual;
-}
-
-.main-wrapper .date {
-    margin-bottom: 2em;
-    text-align: right;
-}
-
-.main-wrapper h1 {
-    margin-bottom: 2em;
-}
-
-.main-wrapper p.comment {
-    font-size: 10pt;
-}
-
 .footer-wrapper {
     position: running(page-footer);
     width: 165mm;
@@ -204,171 +68,12 @@ footer {
     text-align: center;
 }
 
-table.delivery {
-    margin-bottom: 5mm;
-}
-
-table.delivery tr:not(.main) {
-    break-before: avoid;
-}
-
-table.delivery th {
-    font-weight: normal;
-    font-style: italic;
-    font-size: 10pt;
-}
-
-table.delivery th.main {
-    text-align: left;
-}
-
-table.delivery tr.main td {
-    font-weight: bold;
-    padding-top: 2mm;
-}
-
-table.delivery tbody tr:not(.main) td {
-    font-size: 8pt;
-}
-
-table.delivery tr.tight:not(.first) td {
-    padding-top: 0;
-    padding-bottom: 0;
-}
-
-table.delivery tr.tight.first td {
-    padding-bottom: 0;
-}
-
-/* FIXME update version of WeasyPrint
-table.delivery tr.tight:has(+ tr:not(.tight)) td {
-    padding-bottom: 0.5mm !important;
-}
-*/
-
-table.delivery tr.sum {
-    border-top: 0.5pt solid black;
-    break-before: avoid;
-}
-
-table.delivery tr.sum td {
-    padding-top: 1mm;
-}
-
-table.delivery-stats {
-    font-size: 8pt;
-}
-
-table.delivery-stats.expanded th,
-table.delivery-stats.expanded td {
-    padding: 0.25mm 0;
-}
-
-table.delivery-stats:not(.expanded) th,
-table.delivery-stats:not(.expanded) td {
-    padding: 0.125mm 0;
-}
-
-table.delivery-stats:not(.expanded) tr.optional {
-    display: none;
-}
-
-table.delivery-stats thead th {
-    font-weight: normal;
-    font-style: italic;
-    text-align: right;
-}
-
-table.delivery-stats thead th:first-child {
-    text-align: left;
-}
-
-table.delivery-stats.expanded tbody {
-    font-size: 10pt;
-}
-
-table.delivery-stats td {
-    text-align: right;
-}
-
-table.delivery-stats tbody th {
-    font-weight: normal;
-    font-style: italic;
-    text-align: left;
-}
-
 .hidden {
     visibility: hidden;
 }
 
-.main-wrapper .bottom {
-    bottom: 0;
-    position: absolute;
-    width: 165mm;
-}
-
-.main-wrapper .signatures {
-    width: 100%;
-    display: flex;
-    justify-content: space-around;
-    margin: 20mm 0 2mm 0;
-}
-
-.main-wrapper .signatures > * {
-    width: 50mm;
-    border-top: 0.5pt solid black;
-    padding-top: 1mm;
-    text-align: center;
-    font-size: 10pt;
-}
-
 hr {
     border: none;
     border-top: 0.5pt solid black;
     margin: 5mm 0;
 }
-
-hr.page-break {
-    display: none;
-    break-after: page;
-}
-
-tr.page-break {
-    break-before: page;
-}
-
-@page {
-    size: A4;
-    margin: 25mm 20mm 35mm 25mm;
-    @bottom-center {
-        content: element(page-footer);
-    }
-}
-
-@media screen {
-    body, header, .footer-wrapper {
-        width: 210mm;
-    }
-    header, .address-wrapper, aside, main {
-        border: 1px solid lightgray;
-    }
-    .m1, .m2, .m3 {display: none;}
-    header {top: 0;}
-    .spacing {height: 45mm;}
-    .main-wrapper {
-        margin: 0 20mm 40mm 25mm;
-    }
-    .footer-wrapper {
-        position: fixed;
-        bottom: 0;
-        left: 0;
-        right: 0;
-        background: white;
-    }
-}
-
-@media print {
-    .page::after {
-        content: "Seite " counter(page) " von " counter(pages);
-    }
-}