From 24db902588214be54d651f627a080b61bfc39a38 Mon Sep 17 00:00:00 2001
From: Vitalii Lysak <v.lysak@dunice.net>
Date: Mon, 4 Jul 2022 22:06:48 +0300
Subject: add file name

---
 src/components/Global/FormFile.vue | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

(limited to 'src/components/Global/FormFile.vue')

diff --git a/src/components/Global/FormFile.vue b/src/components/Global/FormFile.vue
index 907f3004b..48bab7ecc 100644
--- a/src/components/Global/FormFile.vue
+++ b/src/components/Global/FormFile.vue
@@ -41,13 +41,19 @@
         variant="light"
         class="px-2 ml-auto"
         :disabled="disabled"
-        @click="file = null"
+        @click="closeFile"
         ><icon-close :title="$t('global.fileUpload.clearSelectedFile')" /><span
           class="sr-only"
           >{{ $t('global.fileUpload.clearSelectedFile') }}</span
         >
       </b-button>
     </div>
+    <div
+      v-if="fileName && isStarted"
+      class="clear-selected-file px-3 py-2 mt-2"
+    >
+      {{ fileName }}
+    </div>
   </div>
 </template>
 
@@ -79,10 +85,15 @@ export default {
       type: String,
       default: 'secondary',
     },
+    isStarted: {
+      type: Boolean,
+      default: false,
+    },
   },
   data() {
     return {
       file: null,
+      fileName: null,
     };
   },
   computed: {
@@ -93,10 +104,18 @@ export default {
   watch: {
     file() {
       if (this.file) {
+        this.fileName = this.file.name;
         this.$bvModal.hide(`modal-${this.id}`);
       }
     },
   },
+
+  methods: {
+    closeFile() {
+      this.fileName = null;
+      this.file = null;
+    },
+  },
 };
 </script>
 <style lang="scss" scoped>
-- 
cgit v1.2.3

