(self["webpackChunkLearningchain"] = self["webpackChunkLearningchain"] || []).push([["src_app_pages_walletslist_walletslist_module_ts"],{

/***/ 7381:
/*!*****************************************************************!*\
  !*** ./src/app/pages/walletslist/walletslist-routing.module.ts ***!
  \*****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "WalletslistPageRoutingModule": () => (/* binding */ WalletslistPageRoutingModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ 1855);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ 2741);
/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ 9535);
/* harmony import */ var _walletslist_page__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./walletslist.page */ 4922);




const routes = [
    {
        path: '',
        component: _walletslist_page__WEBPACK_IMPORTED_MODULE_0__.WalletslistPage
    }
];
let WalletslistPageRoutingModule = class WalletslistPageRoutingModule {
};
WalletslistPageRoutingModule = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
    (0,_angular_core__WEBPACK_IMPORTED_MODULE_2__.NgModule)({
        imports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule.forChild(routes)],
        exports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule],
    })
], WalletslistPageRoutingModule);



/***/ }),

/***/ 5618:
/*!*********************************************************!*\
  !*** ./src/app/pages/walletslist/walletslist.module.ts ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "WalletslistPageModule": () => (/* binding */ WalletslistPageModule)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ 1855);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/core */ 2741);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ 6274);
/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/forms */ 3324);
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ionic/angular */ 6820);
/* harmony import */ var _walletslist_routing_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./walletslist-routing.module */ 7381);
/* harmony import */ var _walletslist_page__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./walletslist.page */ 4922);







let WalletslistPageModule = class WalletslistPageModule {
};
WalletslistPageModule = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
    (0,_angular_core__WEBPACK_IMPORTED_MODULE_3__.NgModule)({
        imports: [
            _angular_common__WEBPACK_IMPORTED_MODULE_4__.CommonModule,
            _angular_forms__WEBPACK_IMPORTED_MODULE_5__.FormsModule,
            _ionic_angular__WEBPACK_IMPORTED_MODULE_6__.IonicModule,
            _walletslist_routing_module__WEBPACK_IMPORTED_MODULE_0__.WalletslistPageRoutingModule
        ],
        declarations: [_walletslist_page__WEBPACK_IMPORTED_MODULE_1__.WalletslistPage]
    })
], WalletslistPageModule);



/***/ }),

/***/ 4922:
/*!*******************************************************!*\
  !*** ./src/app/pages/walletslist/walletslist.page.ts ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "WalletslistPage": () => (/* binding */ WalletslistPage)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! tslib */ 1855);
/* harmony import */ var _raw_loader_walletslist_page_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !raw-loader!./walletslist.page.html */ 2927);
/* harmony import */ var _walletslist_page_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./walletslist.page.scss */ 9875);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @angular/core */ 2741);
/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ionic/angular */ 6820);
/* harmony import */ var src_app_services_db_service__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! src/app/services/db.service */ 5185);
/* harmony import */ var src_app_services_common_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/common.service */ 6880);
/* harmony import */ var _ionic_native_barcode_scanner_ngx__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ionic-native/barcode-scanner/ngx */ 3370);
/* harmony import */ var src_app_services_api_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/services/api.service */ 3734);
/* harmony import */ var src_environments_environment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/environments/environment */ 4766);










let WalletslistPage = class WalletslistPage {
    constructor(dbService, navCtrl, barcodeScanner, commonService, apiService) {
        this.dbService = dbService;
        this.navCtrl = navCtrl;
        this.barcodeScanner = barcodeScanner;
        this.commonService = commonService;
        this.apiService = apiService;
        this.row_data = [];
        this.link = '';
    }
    ngOnInit() {
    }
    ionViewDidEnter() {
        this.loginData = JSON.parse(localStorage.getItem("loginData"));
        this.getRows();
    }
    /** Retrieve rows from table */
    getRows() {
        this.dbService.databaseObj.executeSql('SELECT * FROM WalletList WHERE UserId = ?', [this.loginData.UserName])
            .then((res) => {
            this.row_data = [];
            if (res.rows.length > 0) {
                for (var i = 0; i < res.rows.length; i++) {
                    this.row_data.push(res.rows.item(i));
                }
                console.log("rows list is " + this.row_data);
            }
        })
            .catch(e => {
            this.commonService.showErrorShowToast("Something went wrong with fetching data");
        });
    }
    gotocertPage(walletId) {
        let navigationExtras = {
            queryParams: {
                "pagename": 'Dashboard',
                "walletId": walletId
            }
        };
        this.navCtrl.navigateForward(['/menu/menu/certificationlist'], navigationExtras);
    }
    scanBarcode() {
        const options = {
            preferFrontCamera: false,
            showFlipCameraButton: true,
            showTorchButton: true,
            torchOn: false,
            prompt: 'Place a barcode inside the scan area',
            resultDisplayDuration: 0,
            formats: 'EAN_13,EAN_8,QR_CODE,PDF_417 ',
            orientation: 'portrait',
        };
        this.barcodeScanner.scan(options).then(barcodeData => {
            console.log('Barcode data', barcodeData);
            this.scannedData = barcodeData;
            // let index = this.scannedData.text.lastIndexOf('/');
            // let transactionid = this.scannedData.text.slice(index+1,this.scannedData.text.length);
            let transactionid = '';
            if (this.scannedData.text.includes('hash=')) {
                transactionid = this.scannedData.text.split("hash=");
                this.getTransactionsDetails(transactionid[1]);
            }
            else if (this.scannedData.text.includes('uid=')) {
                let uniqueid = this.scannedData.text.split("uid=");
                this.commonService.showLoader();
                let data = {
                    "uniqueID": uniqueid[1]
                };
                this.apiService.postDataToken('student/getDetailsbyQrcode', data).subscribe((res) => {
                    this.commonService.dismissLoader();
                    console.log(res.document[0].transactionId);
                    transactionid = res.document[0].transactionId;
                    this.getTransactionsDetails(transactionid);
                    //alert("certificate details "+ JSON.stringify(transactionid))   
                }, err => {
                    this.commonService.showToast(err.message);
                    setTimeout(() => {
                        this.commonService.dismissLoader();
                    }, 1000);
                });
            }
            else {
                console.log("Invalid QR code.");
            }
            //alert("transaction id in wallet page is "+ transactionid)
            //this.newTransaction(transactionid);
        }).catch(err => {
            console.log('Error', err);
        });
    }
    getTransactionsDetails(transactionid) {
        let data = {
            transactionHash: transactionid
        };
        this.commonService.showLoader();
        this.apiService.postDataToken('explorer/getTransactionDetails', data).subscribe((response) => {
            // setTimeout(() => {
            //     this.commonService.dismissLoader();         
            // }, 1000);
            this.commonService.dismissLoader();
            this.transactionDetails = response;
            this.getCertificationDetails(transactionid);
        }, err => {
            this.commonService.showToast(err.message);
            setTimeout(() => {
                this.commonService.dismissLoader();
            }, 1000);
        });
    }
    getCertificationDetails(transactionid) {
        let data = {
            transactionId: transactionid
        };
        this.commonService.showLoader();
        this.apiService.postDataToken('explorer/getCertificateDetails', data).subscribe((response) => {
            this.commonService.dismissLoader();
            this.transactions = response.data[0];
            this.addcertificate(transactionid);
            //alert("certificate details "+ JSON.stringify(this.transactions))   
        }, err => {
            this.commonService.showToast(err.message);
            setTimeout(() => {
                this.commonService.dismissLoader();
            }, 1000);
        });
    }
    addcertificate(transactionid) {
        //alert("student name is "+this.transactions.studentName);
        this.dbService.databaseObj.executeSql("INSERT INTO certificationlist(UserId,TransactionHash,StudentName,CertificationName,Issuer,DateofIssue,CertificateLink,WalletId,AcademicRef,CertificationType,WalletType) VALUES ('" + this.loginData.UserName + "','" + transactionid + "','" + this.transactions.studentName + "','" + this.transactions.certificationName + "','" + this.transactions.issuerName + "','" + this.transactions.issueMonth + "," + this.transactions.issueYear + "','" + src_environments_environment__WEBPACK_IMPORTED_MODULE_6__.environment.BLOB_URL + this.transactions.sourceFileUrl + "','" + this.transactions.organizationWalletId + "','" + this.transactions.academicReferenceNumber + "','" + this.transactions.certificateType + "','" + 'Dashboard' + "') ", [])
            .then(() => {
            this.commonService.showToast('Row Inserted! with new walletid');
            this.checkWalletExist();
        })
            .catch(e => {
            this.commonService.showErrorShowToast("Something went wrong while inserting data in certificationlist");
        });
    }
    checkWalletExist() {
        this.dbService.databaseObj.executeSql('SELECT * FROM WalletList WHERE WalletId = ?', [this.transactions.organizationWalletId])
            .then((res) => {
            if (res.rows.length <= 0) {
                this.addWallet();
            }
        })
            .catch(e => {
            this.commonService.showErrorShowToast("Something went wrong with fetching data");
        });
    }
    addWallet() {
        this.dbService.databaseObj.executeSql("INSERT INTO WalletList(WalletId,UserId,WalletName,WalletType) VALUES ('" + this.transactions.organizationWalletId + "','" + this.loginData.UserName + "','" + this.transactions.issuerName + "','" + "Institute" + "') ", [])
            .then(() => {
            this.commonService.showToast('Row Inserted! with new walletid');
            this.getRows();
        })
            .catch(e => {
            this.commonService.showErrorShowToast("Something went wrong while inserting data in walletlist");
        });
    }
};
WalletslistPage.ctorParameters = () => [
    { type: src_app_services_db_service__WEBPACK_IMPORTED_MODULE_2__.DbService },
    { type: _ionic_angular__WEBPACK_IMPORTED_MODULE_7__.NavController },
    { type: _ionic_native_barcode_scanner_ngx__WEBPACK_IMPORTED_MODULE_4__.BarcodeScanner },
    { type: src_app_services_common_service__WEBPACK_IMPORTED_MODULE_3__.CommonService },
    { type: src_app_services_api_service__WEBPACK_IMPORTED_MODULE_5__.ApiService }
];
WalletslistPage = (0,tslib__WEBPACK_IMPORTED_MODULE_8__.__decorate)([
    (0,_angular_core__WEBPACK_IMPORTED_MODULE_9__.Component)({
        selector: 'app-walletslist',
        template: _raw_loader_walletslist_page_html__WEBPACK_IMPORTED_MODULE_0__.default,
        styles: [_walletslist_page_scss__WEBPACK_IMPORTED_MODULE_1__.default]
    })
], WalletslistPage);



/***/ }),

/***/ 9875:
/*!*********************************************************!*\
  !*** ./src/app/pages/walletslist/walletslist.page.scss ***!
  \*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("ion-grid {\n  padding: 16px;\n}\n\nion-card {\n  margin-inline-start: 6px;\n  margin-inline-end: 6px;\n}\n\n.university {\n  height: 130px;\n  border-radius: 8px;\n}\n\n.box1 {\n  height: 70px;\n}\n\n.vmiddle {\n  justify-content: center;\n  display: flex;\n  align-items: center;\n  text-align: center;\n  padding: 2px;\n}\n\n.box2 {\n  height: 60px;\n  background: #e7f0f3;\n  border: 1px solid #e7f0f3;\n  color: #215374;\n  font-weight: 500;\n  font-size: 12px;\n  font-family: \"Roboto\";\n}\n\n.image {\n  width: 45px;\n  height: 45px;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndhbGxldHNsaXN0LnBhZ2Uuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFjQTtFQUNnQixhQUFBO0FBYmhCOztBQWdCQTtFQUNnQix3QkFBQTtFQUNBLHNCQUFBO0FBYmhCOztBQWdCQTtFQUNJLGFBQUE7RUFDQSxrQkFBQTtBQWJKOztBQWdCQTtFQUNJLFlBQUE7QUFiSjs7QUFnQkE7RUFDSSx1QkFBQTtFQUNBLGFBQUE7RUFDQSxtQkFBQTtFQUNBLGtCQUFBO0VBQ0EsWUFBQTtBQWJKOztBQWdCQTtFQUNJLFlBQUE7RUFDQSxtQkFBQTtFQUNBLHlCQUFBO0VBQ0EsY0FBQTtFQUNBLGdCQUFBO0VBQ0EsZUFBQTtFQUNBLHFCQUFBO0FBYko7O0FBZ0JBO0VBQ0ksV0FBQTtFQUNBLFlBQUE7QUFiSiIsImZpbGUiOiJ3YWxsZXRzbGlzdC5wYWdlLnNjc3MiLCJzb3VyY2VzQ29udGVudCI6WyIvLyAudGlsZSB7XG4vLyAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzhCQzM0QTtcbi8vICAgICAgICAgICAgICAgICBjb2xvcjp3aGl0ZTtcbi8vICAgICAgICAgICAgICAgICBoZWlnaHQ6IDc2cHg7XG4vLyAgICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogMTBweDtcbi8vICAgICAgICAgICAgICAgICBkaXNwbGF5OiBmbGV4O1xuLy8gICAgICAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4vLyAgICAgICAgICAgICAgICAgbWFyZ2luLXRvcDogYXV0bztcbi8vICAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiBhdXRvO1xuLy8gICAgICAgICAgICAgICAgIGp1c3RpZnktY29udGVudDogY2VudGVyO1xuLy8gICAgICAgICAgICAgICAgIGZvbnQtd2VpZ2h0OiA1MDA7XG4vLyAgICAgICAgICAgICAgICAgdGV4dC1hbGlnbjogY2VudGVyO1xuLy8gfVxuXG5pb24tZ3JpZCB7XG4gICAgICAgICAgICAgICAgcGFkZGluZzogMTZweDtcbn1cblxuaW9uLWNhcmQge1xuICAgICAgICAgICAgICAgIG1hcmdpbi1pbmxpbmUtc3RhcnQ6IDZweDtcbiAgICAgICAgICAgICAgICBtYXJnaW4taW5saW5lLWVuZDogNnB4O1xufVxuXG4udW5pdmVyc2l0eSB7XG4gICAgaGVpZ2h0OiAxMzBweDtcbiAgICBib3JkZXItcmFkaXVzOiA4cHg7XG59XG5cbi5ib3gxIHtcbiAgICBoZWlnaHQ6IDcwcHg7XG59XG5cbi52bWlkZGxlIHtcbiAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gICAgdGV4dC1hbGlnbjogY2VudGVyO1xuICAgIHBhZGRpbmc6IDJweDtcbn1cblxuLmJveDIge1xuICAgIGhlaWdodDogNjBweDtcbiAgICBiYWNrZ3JvdW5kOiAjZTdmMGYzO1xuICAgIGJvcmRlcjogMXB4IHNvbGlkICNlN2YwZjM7XG4gICAgY29sb3I6ICMyMTUzNzQ7XG4gICAgZm9udC13ZWlnaHQ6IDUwMDtcbiAgICBmb250LXNpemU6IDEycHg7XG4gICAgZm9udC1mYW1pbHk6ICdSb2JvdG8nO1xufVxuXG4uaW1hZ2Uge1xuICAgIHdpZHRoOiA0NXB4O1xuICAgIGhlaWdodDogNDVweDtcbn0iXX0= */");

/***/ }),

/***/ 2927:
/*!***********************************************************************************************!*\
  !*** ./node_modules/raw-loader/dist/cjs.js!./src/app/pages/walletslist/walletslist.page.html ***!
  \***********************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("<ion-header>\n        <ion-toolbar>\n                <ion-buttons slot=\"start\">\n                        <ion-menu-button autoHide=\"false\"></ion-menu-button>\n                </ion-buttons>\n                <ion-title>Dashboard</ion-title>\n        </ion-toolbar>\n</ion-header>\n\n<!-- <ion-content>\n            <ion-grid>\n                    <ion-row>\n                          <ion-col size=\"4\"  *ngFor=\"let wallet of row_data;\">\n                                    <ion-card  class=\"tile\" (click)=\"gotocertPage(wallet.WalletId)\">\n                                        {{wallet.WalletName}}\n                                    </ion-card>\n                          </ion-col>\n                    </ion-row>\n            </ion-grid>\n            \n            <ion-fab vertical=\"bottom\" horizontal=\"end\" slot=\"fixed\" (click)=\"scanBarcode()\">\n                <ion-fab-button>\n                        <ion-icon name=\"add\"></ion-icon>\n                </ion-fab-button>\n            </ion-fab>\n</ion-content> -->\n\n<ion-content>\n        <ion-grid>\n                <ion-row>\n                        <ion-col size=\"6\" *ngFor=\"let wallet of row_data;\">\n                                <ion-card class=\"university\" (click)=\"gotocertPage(wallet.WalletId)\">\n                                       <div class=\"box1 vmiddle\"><img  class=\"image\" src=\"../assets/images/College_icon.png\"/></div> \n                                       <div class=\"box2 vmiddle\">{{wallet.WalletName}} </div>\n                                </ion-card>              \n                        </ion-col>\n                </ion-row>\n        </ion-grid>\n        <ion-fab vertical=\"bottom\" horizontal=\"end\" slot=\"fixed\" (click)=\"scanBarcode()\">\n                <ion-fab-button>\n                        <ion-icon name=\"add\"></ion-icon>\n                </ion-fab-button>\n            </ion-fab>\n</ion-content>\n");

/***/ })

}]);
//# sourceMappingURL=src_app_pages_walletslist_walletslist_module_ts.js.map