11<template >
22 <v-container class =" transaction-container" >
3+ <v-fade-transition >
4+ <div
5+ v-if =" isLoading"
6+ class =" loading-container"
7+ >
8+ <v-progress-circular
9+ size =" 50"
10+ width =" 5"
11+ color =" primary"
12+ :indeterminate =" isLoading"
13+ />
14+ </div >
15+ </v-fade-transition >
316 <header
417 v-if =" title"
518 class =" view-header align-center mb-5 ml-4"
6982 class =" mt-4"
7083 :extended =" extended"
7184 :headers =" sortedHeaders"
85+ @isDownloadingReceipt =" isLoading = $event"
7286 />
7387 </section >
7488 <!-- export csv error -->
103117<script lang="ts">
104118import { Account , Pages } from ' @/util/constants'
105119import { MembershipType , OrgPaymentDetails } from ' @/models/Organization'
106- import { Ref , computed , defineComponent , onBeforeUnmount , onMounted , ref , watch } from ' @vue/composition-api'
120+ import { Ref , computed , defineComponent , onBeforeUnmount , onMounted , ref , reactive , toRefs , watch } from ' @vue/composition-api'
107121import { useAccountChangeHandler , useTransactions } from ' @/composables'
108122import { BaseTableHeaderI } from ' @/components/datatable/interfaces'
109123import CommonUtils from ' @/util/common-util'
@@ -137,6 +151,10 @@ export default defineComponent({
137151 const { setAccountChangedHandler, beforeDestroy } = useAccountChangeHandler ()
138152 const { clearAllFilters, getTransactionReport, loadTransactionList, setViewAll, defaultSearchToOneYear } = useTransactions ()
139153
154+ const state = reactive ({
155+ isLoading: false
156+ })
157+
140158 // FUTURE: vue3 we can set this fn explicitly in the resource instead of doing it here
141159 const headers = getTransactionTableHeaders (props .extended )
142160 headers .forEach ((header ) => {
@@ -170,7 +188,6 @@ export default defineComponent({
170188 })
171189
172190 const credit = ref (0 )
173- const isLoading = ref (false )
174191
175192 const isTransactionsAllowed = computed ((): boolean => {
176193 return [Account .PREMIUM , Account .STAFF , Account .SBC_STAFF ]
@@ -204,7 +221,7 @@ export default defineComponent({
204221 }
205222
206223 const exportCSV = async () => {
207- isLoading . value = true
224+ state . isLoading = true
208225 // grab from composable**
209226 const downloadData = await getTransactionReport ()
210227 if (! downloadData || downloadData .error ) {
@@ -215,7 +232,7 @@ export default defineComponent({
215232 } else {
216233 CommonUtils .fileDownload (downloadData , ` bcregistry-transactions-${moment ().format (' MM-DD-YYYY' )}.csv ` , ' text/csv' )
217234 }
218- isLoading . value = false
235+ state . isLoading = false
219236 }
220237
221238 onMounted (() => {
@@ -224,14 +241,14 @@ export default defineComponent({
224241 onBeforeUnmount (() => { beforeDestroy () })
225242
226243 return {
244+ ... toRefs (state ),
227245 csvErrorDialog ,
228246 csvErrorDialogText ,
229247 headers ,
230248 headerSelections ,
231249 headersSelected ,
232250 sortedHeaders ,
233251 credit ,
234- isLoading ,
235252 exportCSV
236253 }
237254 }
@@ -323,4 +340,8 @@ export default defineComponent({
323340 .credit-details {
324341 color : $gray7 ;
325342 }
343+
344+ .loading-container {
345+ background : rgba (255 ,255 ,255 , 0.8 );
346+ }
326347 </style >
0 commit comments