{"version":3,"sources":["./src/app/pages/secure/transactions/transactions.page.html","./src/app/pages/secure/transactions/transactions-routing.module.ts","./src/app/pages/secure/transactions/transactions.page.ts","./src/app/pages/secure/transactions/transactions.module.ts"],"names":["routes","path","component","TransactionsPage","modalController","loadingController","alertController","authService","apiService","observerService","router","location","transaction_search_params","spinner","moment","transactions","visible_transactions","this","presentSpinner","then","loadTransactions","showInitialVisibleTransactions","dismiss","catch","subscribe","Promise","resolve","reject","isLoggedIn","getConsumerTransactions","error","status","presentAlert","navigate","replaceUrl","window","reload","event","target","complete","count","length","i","position","push","default_href","history","back","navigateByUrl","params","ordered_params","Object","keys","sort","forEach","key","modal","create","componentProps","onDidDismiss","data","number","Number","consumer_first_name","consumer_last_name","from_date","utc","format","to_date","present","header","sub_header","message","alert","subHeader","buttons","showBackdrop","cssClass","presentTransactionSearch","refreshTransactions","TransactionsPageRoutingModule","forChild","TransactionsPageModule"],"mappings":"uUAegB,oBAAuD,QAAwC,Q,qBAAxC,yD,yBACvD,oBAAoE,QAAoD,Q,qBAApD,+D,yBACpE,oBAAmE,QAAmD,Q,qBAAnD,8D,yBACnE,oBAA0D,QAAyF,Q,qBAAzF,uG,yBAC1D,oBAAwD,QAAqF,Q,qBAArF,mG,uCARpE,sBACI,qBAAyD,2EACrD,uBAA8B,uBAAY,OAC1C,iBACI,4BACA,4BACA,4BACA,4BACA,4BACJ,OACJ,OACJ,O,uBAPwB,wDACA,qEACA,oEACA,2DACA,0D,sEAaZ,QACI,qBACJ,Q,MADa,+BAA+B,kB,+DAE5C,QACI,qBACJ,Q,MADa,+BAAwB,kB,qEAIrC,aACI,qBAAmE,QACvE,Q,8BADa,+BAA2B,iBAA+B,+B,yBAInE,QAAsD,QAAoC,Q,+BAApC,4C,yBACtD,QAAqD,QAAkC,Q,+BAAlC,oC,kEAHzD,YACI,qBACA,+BACA,+BACJ,Q,8BAHa,+BAAwB,iBAClB,2CACA,2C,yBAWnB,QAA4C,kBAAuB,Q,iBAAsC,OAAO,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C,EAAiB,GACrBC,OAAOC,KAAKH,GACPI,OACAC,QAAQ,SAAUC,GACfL,EAAeK,GAAON,EAAOM,KAErCtC,KAAKC,eAAe,wBAAwBC,KAAK,KAC7CF,KAAKG,mBAAmBD,KAAK,KACzBF,KAAKI,iCACLJ,KAAKJ,QAAQS,YAEhBC,MAAM,KACHN,KAAKJ,QAAQS,uBAKhBkC,EAAMa,YAGjB,aAAaC,EAAQC,EAAYC,G,kDACnC,MAAMC,QAAcxD,KAAKX,gBAAgBmD,OAAO,CAC5Ca,OAAQA,EACRI,UAAWH,EACXC,QAASA,EACTG,QAAS,CAAC,cAERF,EAAMJ,YAGV,eAAeG,G,kDACjBvD,KAAKJ,cAAgBI,KAAKZ,kBAAkBoD,OAAO,CAC/Ce,QAASA,EACTI,cAAc,EACdC,SAAU,0BAER5D,KAAKJ,QAAQwD,a,6CA9NdlE,GAAgB,kF,uBAAhBA,EAAgB,wjCFf7B,uBACI,sBACI,oBACI,yBACJ,OACA,wBACI,uBAAY,+BAAS,EAAA2E,6BACjB,oBACJ,OACJ,OACJ,OACA,+BAYJ,OAEA,sBACI,0BAAyE,qCAAc,EAAAC,oBAAA,KACnF,mCACJ,OACA,4BAiCA,uCAGA,4BAQJ,Q,MAlEyB,+BAA0B,iBAIjC,qOAkBH,8EAiCW,8EAGX,gF,mqDElDR,KDAA,Y,MAAMC,G,6CAAAA,I,uBAAAA,I,2BAHF,CAAC,IAAaC,SAASjF,IACtB,O,GAEL,GEIA,Q,MAAMkF,G,6CAAAA,I,uBAAAA,I,2BATF,CACP,IACA,IACA,IACA,IACA,M,GAIG","file":"74.0dd6bae12a0429131293.js","sourcesContent":["\n \n \n Transactions\n \n \n \n \n \n \n \n \n \n Filtered by:\n
\n #{{transaction_search_params['number']}}\n {{transaction_search_params['consumer_first_name']}}\n {{transaction_search_params['consumer_last_name']}}\n From: {{this.moment(transaction_search_params['from_date']).format(\"D MMM YYYY, HH:mm\")}}\n To: {{this.moment(transaction_search_params['to_date']).format(\"D MMM YYYY, HH:mm\")}}\n
\n
\n
\n
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n

\n {{transaction.number}}\n

\n

\n \n {{transaction.consumer.first_name}} \n {{transaction.consumer.last_name}}\n

\n

\n {{this.moment(transaction.created_date).format(\"D MMM YYYY\")}}\n

\n

\n {{this.moment(transaction.created_date).format(\"HH:mm\")}}\n

\n
\n \n \n 0\">–${{transaction.price | number:'1.2'}}\n +${{transaction.price * -1 | number:'1.2'}}\n \n
\n
\n \n \n \n \n \n

\n \n No transactions found\n

\n
\n
\n
\n","import { NgModule } from '@angular/core';\nimport { RouterModule, Routes } from '@angular/router';\nimport { TransactionsPage } from './transactions.page';\n\nconst routes: Routes = [\n {\n path: '',\n component: TransactionsPage,\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(routes)],\n exports: [RouterModule]\n})\nexport class TransactionsPageRoutingModule {}\n","import { Component } from '@angular/core';\nimport { ModalController, LoadingController, AlertController } from '@ionic/angular';\nimport { Router } from \"@angular/router\";\nimport { APIService } from \"../../../services/api.service\";\nimport { AuthService } from \"../../../services/auth.service\";\nimport { ObserverService } from 'src/app/services/observer.service';\nimport * as moment from 'moment-timezone';\nimport { TransactionSearchPage } from '../../../modals/transaction-search/transaction-search.page';\nimport { Location } from '@angular/common';\n\n@Component({\n selector: 'app-transactions',\n templateUrl: 'transactions.page.html',\n styleUrls: ['transactions.page.scss']\n})\nexport class TransactionsPage {\n\n transaction_search_params = {\n\n };\n\n spinner = null;\n moment = moment;\n transactions = null;\n visible_transactions = null;\n\n constructor(\n public modalController: ModalController,\n public loadingController: LoadingController,\n public alertController: AlertController,\n private authService: AuthService,\n private apiService: APIService,\n private observerService: ObserverService,\n private router: Router,\n private location: Location,\n ) { }\n\n ngOnInit() {\n\n this.presentSpinner(\"Loading transactions\").then(() => {\n this.loadTransactions().then(() => {\n this.showInitialVisibleTransactions();\n this.spinner.dismiss();\n })\n .catch(() => {\n this.spinner.dismiss();\n })\n })\n\n this.observerService.subscribe('transaction_intent_approved', () => {\n this.loadTransactions().then(() => {\n this.showInitialVisibleTransactions();\n })\n });\n\n this.observerService.subscribe('transaction_added', () => {\n this.loadTransactions().then(() => {\n this.showInitialVisibleTransactions();\n })\n });\n\n }\n\n loadTransactions() {\n const promise = new Promise((resolve, reject) => {\n this.transactions = null;\n this.visible_transactions = null;\n this.authService.isLoggedIn().then(() => {\n this.apiService.getConsumerTransactions(this.transaction_search_params).then((transactions: any) => {\n if (transactions) {\n this.transactions = transactions;\n resolve();\n }\n })\n .catch((error) => {\n if (error) {\n if (error.status === 400) {\n this.presentAlert(\"Problem\", \"Unknown error\", \"Unfortunately something went wrong when trying to get a list of transactions.\");\n } else if (error.status === 403) {\n this.presentAlert(\"Problem\", \"Insufficient permissions\", \"You don't have permission to view a list of transactions.\");\n } else if (error.status === 404 || error.status === 0) {\n this.presentAlert(\"Problem\", \"Unavailable\", \"Unfortunately we're unable to retrieve a list of transactions at this time.\");\n }\n }\n reject();\n });\n })\n .catch(() => {\n this.router.navigate([\"logout\"], { replaceUrl: true }).then(() => {\n window.location.reload();\n });\n });\n });\n return promise;\n }\n\n refreshTransactions(event) {\n this.loadTransactions().then(() => {\n this.showInitialVisibleTransactions().then(() => event.target.complete());\n })\n .catch(() => event.target.complete());\n }\n\n showInitialVisibleTransactions() {\n let promise = new Promise((resolve, reject) => {\n if (this.transactions && !this.visible_transactions) {\n this.visible_transactions = [];\n }\n let count = this.visible_transactions.length;\n for (let i = 0; i < 15; i++) {\n let position = i + count;\n if (this.transactions.length > position) {\n this.visible_transactions.push(this.transactions[position]);\n }\n else {\n break;\n }\n }\n resolve();\n });\n return promise;\n }\n\n showMoreVisibleTransactions(event) {\n let count = this.visible_transactions.length;\n for (let i = 0; i < 10; i++) {\n let position = i + count;\n if (this.transactions.length > position) {\n this.visible_transactions.push(this.transactions[position]);\n }\n else {\n break;\n }\n }\n event.target.complete();\n }\n\n goBack(default_href) {\n if (window.history.length > 1) {\n this.location.back();\n }\n else {\n this.router.navigateByUrl(default_href);\n }\n }\n\n async presentTransactionSearch() {\n let params = {};\n if (this.transaction_search_params[\"number\"]) {\n params[\"number\"] = this.transaction_search_params[\"number\"];\n }\n if (this.transaction_search_params[\"consumer_first_name\"]) {\n params[\"consumer_first_name\"] = this.transaction_search_params[\"consumer_first_name\"];\n }\n if (this.transaction_search_params[\"consumer_last_name\"]) {\n params[\"consumer_last_name\"] = this.transaction_search_params[\"consumer_last_name\"];\n }\n if (this.transaction_search_params[\"from_date\"]) {\n params[\"from_date\"] = this.transaction_search_params[\"from_date\"];\n }\n if (this.transaction_search_params[\"to_date\"]) {\n params[\"to_date\"] = this.transaction_search_params[\"to_date\"];\n }\n let ordered_params = {};\n Object.keys(params)\n .sort()\n .forEach(function (key) {\n ordered_params[key] = params[key];\n });\n const modal = await this.modalController.create({\n component: TransactionSearchPage,\n componentProps: params,\n });\n modal.onDidDismiss().then(data => {\n if (data.data) {\n let params = data.data;\n if (params.number && params.number.length) {\n this.transaction_search_params[\"number\"] = Number(params.number);\n } else {\n delete this.transaction_search_params[\"number\"];\n }\n if (params.consumer_first_name && params.consumer_first_name.length) {\n this.transaction_search_params[\"consumer_first_name\"] = params.consumer_first_name;\n } else {\n delete this.transaction_search_params[\"consumer_first_name\"];\n }\n if (params.consumer_last_name && params.consumer_last_name.length) {\n this.transaction_search_params[\"consumer_last_name\"] = params.consumer_last_name;\n } else {\n delete this.transaction_search_params[\"consumer_last_name\"];\n }\n if (params.from_date && params.from_date.length) {\n this.transaction_search_params[\"from_date\"] = moment(params.from_date).utc().format();\n } else {\n delete this.transaction_search_params[\"from_date\"];\n }\n if (params.to_date && params.to_date.length) {\n this.transaction_search_params[\"to_date\"] = moment(params.to_date).utc().format();\n } else {\n delete this.transaction_search_params[\"to_date\"];\n }\n let ordered_params = {};\n Object.keys(params)\n .sort()\n .forEach(function (key) {\n ordered_params[key] = params[key];\n });\n this.presentSpinner(\"Loading transactions\").then(() => {\n this.loadTransactions().then(() => {\n this.showInitialVisibleTransactions();\n this.spinner.dismiss();\n })\n .catch(() => {\n this.spinner.dismiss();\n })\n })\n }\n });\n return await modal.present();\n }\n\n async presentAlert(header, sub_header, message) {\n const alert = await this.alertController.create({\n header: header,\n subHeader: sub_header,\n message: message,\n buttons: [\"OK\"],\n });\n await alert.present();\n }\n\n async presentSpinner(message) {\n this.spinner = await this.loadingController.create({\n message: message,\n showBackdrop: true,\n cssClass: 'loading-spinner'\n });\n await this.spinner.present();\n }\n\n}\n","import { IonicModule } from '@ionic/angular';\nimport { RouterModule } from '@angular/router';\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { FontAwesomeModule } from '@fortawesome/angular-fontawesome';\nimport { TransactionsPage } from './transactions.page';\nimport { TransactionsPageRoutingModule } from './transactions-routing.module';\n\n@NgModule({\n imports: [\n FontAwesomeModule,\n IonicModule,\n CommonModule,\n FormsModule,\n TransactionsPageRoutingModule\n ],\n declarations: [TransactionsPage]\n})\nexport class TransactionsPageModule {}\n"],"sourceRoot":"webpack:///"}