From 58ecb36f6a98114604952d9dbe78cb99fb159351 Mon Sep 17 00:00:00 2001
From: Vidhu Kant Sharma <vidhukant@vidhukant.com>
Date: Tue, 9 Jul 2024 11:43:15 +0530
Subject: printing user-specific logos and signatures on invoices

---
 src/components/PrintPreviewHeader.vue | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

(limited to 'src/components/PrintPreviewHeader.vue')

diff --git a/src/components/PrintPreviewHeader.vue b/src/components/PrintPreviewHeader.vue
index 9e89c84..62da945 100644
--- a/src/components/PrintPreviewHeader.vue
+++ b/src/components/PrintPreviewHeader.vue
@@ -1,11 +1,38 @@
 <script setup lang="ts">
+  import { onMounted, ref } from "vue"
+ import  User from "./../classes/user.js"
+ import axios from "axios"
+
   const props = defineProps(["invoice"])
+
+  const user = ref()
+
+  // temporarily using this
+  // TODO: don't call api from PrintPreview
+  const getUser = async () => {
+    user.value = new User()
+
+    try {
+      const r = await axios.get('/user')
+      if (r.status === 200) {
+        user.value = r.data.data
+      }
+    } catch (err) {
+      console.error(err)
+    }
+  }
+
+  // TODO: remove
+  onMounted(() => {
+    getUser()
+  })
 </script>
 
 <template>
   <div class="print-preview-header">
+    <!-- TODO: add option to not use logo -->
     <div class="logo-container"> 
-      <img src="../assets/placeholderlogo.png"/>
+      <img :src="'/pub/' + user.LogoFile"/>
     </div>
 
     <div> 
-- 
cgit v1.2.3

