From 3ebd619d89aa20b57542888ac1dac47451c4b1a9 Mon Sep 17 00:00:00 2001
From: Vidhu Kant Sharma <vidhukant@vidhukant.com>
Date: Thu, 7 Dec 2023 16:17:28 +0530
Subject: making print preview slightly better

---
 src/views/ViewInvoice.vue | 56 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 9 deletions(-)

(limited to 'src/views/ViewInvoice.vue')

diff --git a/src/views/ViewInvoice.vue b/src/views/ViewInvoice.vue
index 5cc04b8..4ac8325 100644
--- a/src/views/ViewInvoice.vue
+++ b/src/views/ViewInvoice.vue
@@ -51,25 +51,63 @@ onMounted(() => {
 </script>
 
 <template>
-  <invoiceHeader
-    :invoice="invoice" />
-  <invoiceItemsTable
-    :items="items"
-    :isLoading="itemsTableIsLoading" />
-  <invoiceSummary
-    :items="items"
-    :isLoading="itemsTableIsLoading"
-  />
+  <div id="print-preview" class="bg-light text-black">
+    <invoiceHeader
+      :invoice="invoice" />
+    <invoiceItemsTable
+      preview=true
+      :items="items"
+      :isLoading="itemsTableIsLoading" />
+    <invoiceSummary
+      :items="items"
+      :isLoading="itemsTableIsLoading"
+    />
+  </div>
   <button id="print-button" class="btn btn-primary" @click="handlePrint">Print</button>
 </template>
 
 <style>
+#print-preview {
+  width: 670px;
+}
+#print-preview * {
+  font-size: 12pt !important;
+}
+#print-preview .sup {
+  display: none;
+}
+#print-preview table {
+  width: 100%;
+}
+#print-preview table * {
+  font-size: 10pt !important;
+}
+#print-preview .invoice-items-table {
+  margin-bottom: auto !important;
+}
+#print-preview .invoice-summary {
+  margin-top: auto !important;
+}
 @media print {
+  #print-preview {
+    width: auto !important;
+  }
   #sidebar, #navbar, #print-button, .btn {
     display: none !important;
   }
   ::-webkit-scrollbar {
     display: none;
   }
+  main {
+    width: 100% !important;
+    overflow-x: visible !important;
+    margin: 0 !important;
+    padding: 0 !important;
+  }
+  #app {
+    display: block;
+    max-height: auto !important;
+    overflow-y: visible !important;
+  }
 }
 </style>
-- 
cgit v1.2.3

