PageSourceSearch

https://saferoads.ph/src_app_pages_home_receipt-student_receipt-student_module_ts.js

js saferoads.ph collected 2026-09-27 14:59:30 UTC 21,605 bytes, 487 lines download raw bytes

1(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([["src_app_pages_home_receipt-student_receipt-student_module_ts"],{
2
3/***/ 9023:
4/*!******************************************************************************!*\
5  !*** ./src/app/pages/home/receipt-student/receipt-student-routing.module.ts ***!
6  \******************************************************************************/
7/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
9"use strict";
10__webpack_require__.r(__webpack_exports__);
11/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12/* harmony export */   ReceiptStudentPageRoutingModule: () => (/* binding */ ReceiptStudentPageRoutingModule)
13/* harmony export */ });
14/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ 24398);
15/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ 37580);
16/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/router */ 95072);
17/* harmony import */ var _receipt_student_page__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./receipt-student.page */ 87857);
18
19
20
21
22const routes = [{
23  path: '',
24  component: _receipt_student_page__WEBPACK_IMPORTED_MODULE_0__.ReceiptStudentPage
25}];
26let ReceiptStudentPageRoutingModule = class ReceiptStudentPageRoutingModule {};
27ReceiptStudentPageRoutingModule = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_2__.NgModule)({
28  imports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule.forChild(routes)],
29  exports: [_angular_router__WEBPACK_IMPORTED_MODULE_3__.RouterModule]
30})], ReceiptStudentPageRoutingModule);
31
32
33/***/ }),
34
35/***/ 17902:
36/*!**********************************************************************!*\
37  !*** ./src/app/pages/home/receipt-student/receipt-student.module.ts ***!
38  \**********************************************************************/
39/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
40
41"use strict";
42__webpack_require__.r(__webpack_exports__);
43/* harmony export */ __webpack_require__.d(__webpack_exports__, {
44/* harmony export */   ReceiptStudentPageModule: () => (/* binding */ ReceiptStudentPageModule)
45/* harmony export */ });
46/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ 24398);
47/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/core */ 37580);
48/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ 60316);
49/* harmony import */ var _angular_forms__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/forms */ 34456);
50/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ionic/angular */ 5995);
51/* harmony import */ var _receipt_student_routing_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./receipt-student-routing.module */ 9023);
52/* harmony import */ var _receipt_student_page__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./receipt-student.page */ 87857);
53
54
55
56
57
58
59
60let ReceiptStudentPageModule = class ReceiptStudentPageModule {};
61ReceiptStudentPageModule = (0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_3__.NgModule)({
62  imports: [_angular_common__WEBPACK_IMPORTED_MODULE_4__.CommonModule, _angular_forms__WEBPACK_IMPORTED_MODULE_5__.FormsModule, _ionic_angular__WEBPACK_IMPORTED_MODULE_6__.IonicModule, _receipt_student_routing_module__WEBPACK_IMPORTED_MODULE_0__.ReceiptStudentPageRoutingModule],
63  declarations: [_receipt_student_page__WEBPACK_IMPORTED_MODULE_1__.ReceiptStudentPage]
64})], ReceiptStudentPageModule);
65
66
67/***/ }),
68
69/***/ 87857:
70/*!********************************************************************!*\
71  !*** ./src/app/pages/home/receipt-student/receipt-student.page.ts ***!
72  \********************************************************************/
73/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
74
75"use strict";
76__webpack_require__.r(__webpack_exports__);
77/* harmony export */ __webpack_require__.d(__webpack_exports__, {
78/* harmony export */   ReceiptStudentPage: () => (/* binding */ ReceiptStudentPage)
79/* harmony export */ });
80/* harmony import */ var C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 89204);
81/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! tslib */ 24398);
82/* harmony import */ var _receipt_student_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./receipt-student.page.html?ngResource */ 98399);
83/* harmony import */ var _receipt_student_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./receipt-student.page.scss?ngResource */ 40049);
84/* harmony import */ var _receipt_student_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_receipt_student_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__);
85/* harmony import */ var _angular_router__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @angular/router */ 95072);
86/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @angular/core */ 37580);
87/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ionic/angular */ 5995);
88/* harmony import */ var src_app_services_payment_payment_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/payment/payment.service */ 52537);
89/* harmony import */ var pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! pdfmake/build/pdfmake */ 27888);
90/* harmony import */ var pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_4__);
91/* harmony import */ var pdfmake_build_vfs_fonts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! pdfmake/build/vfs_fonts */ 55360);
92/* harmony import */ var _angular_common_http__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @angular/common/http */ 46443);
93/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! moment */ 39545);
94/* harmony import */ var moment__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(moment__WEBPACK_IMPORTED_MODULE_6__);
95/* harmony import */ var _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @capacitor/filesystem */ 63474);
96/* harmony import */ var src_app_services_cms_cms_service__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! src/app/services/cms/cms.service */ 17377);
97/* harmony import */ var _ionic_native_file_opener_ngx__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ionic-native/file-opener/ngx */ 28442);
98/* harmony import */ var src_app_services_user_user_service__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! src/app/services/user/user.service */ 83273);
99/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @angular/common */ 60316);
100
101
102
103
104
105
106
107
108
109
110
111(pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_4___default().vfs) = pdfmake_build_vfs_fonts__WEBPACK_IMPORTED_MODULE_5__.pdfMake.vfs;
112
113
114
115
116
117
118
119let ReceiptStudentPage = class ReceiptStudentPage {
120  constructor(route, loadingCtrl, plt, fileOpener, http, userService, cmsService, paymentService, currencyPipe, datePipe) {
121    this.route = route;
122    this.loadingCtrl = loadingCtrl;
123    this.plt = plt;
124    this.fileOpener = fileOpener;
125    this.http = http;
126    this.userService = userService;
127    this.cmsService = cmsService;
128    this.paymentService = paymentService;
129    this.currencyPipe = currencyPipe;
130    this.datePipe = datePipe;
131    this.showButtons = true;
132    this.fileDownloaded = false;
133  }
134  ngOnInit() {
135    this.fileDownloaded = false;
136  }
137  ionViewDidEnter() {
138    this.studentId = this.route.snapshot.params['studentId'];
139    this.paymentId = this.route.snapshot.params['paymentId'];
140    this.paymentService.getTransactionDetails(this.studentId).then(trans => {
141      this.transaction = trans.result[0];
142      //console.log( this.transaction )
143      //console.log(this.transaction.dsProfileId);
144      this.userService.getStudentProfile(this.studentId).then(profile => {
145        this.studentProfile = profile.result[0];
146        //console.log(  this.studentProfile )
147        this.studentAddress = this.studentProfile.address.block + " " + this.studentProfile.address.barangay + "\n " + this.studentProfile.address.city + "\n " + this.studentProfile.address.province + " " + this.studentProfile.address.postalCode;
148        this.billToDetails = this.studentProfile.fullName + "\n " + this.studentAddress;
149        if (this.transaction) {
150          this.paymentMethod = this.transaction.paymentMethodCode.replace('_', ' ');
151          this.paymentDate = this.datePipe.transform(this.transaction.paymentDate, 'yyyy-MM-dd');
152          if (this.transaction.validationDate) {
153            this.validationDate = this.datePipe.transform(this.transaction.validationDate, 'yyyy-MM-dd');
154          }
155        }
156      });
157      this.userService.getDsProfileById(this.transaction.dsProfileId).then(school => {
158        this.school = school.result[0];
159        //console.log(this.school);          
160        this.getDSProfileImage(this.school.logo);
161      });
162    });
163    this.generatePdf();
164  }
165  getBlobForDSNoPhoto() {
166    this.http.get('assets/img/cert/nophoto.jpg', {
167      responseType: 'blob'
168    }).subscribe(res => {
169      const reader = new FileReader();
170      reader.onloadend = () => {
171        this.dsProfileImg = reader.result;
172      };
173      reader.readAsDataURL(res);
174    });
175  }
176  getDSProfileImage(profileImg) {
177    fetch(profileImg).then(res => res.blob()).then(res => {
178      //console.log(res);
179      const reader = new FileReader();
180      reader.onloadend = () => {
181        this.dsProfileImg = reader.result;
182      };
183      reader.readAsDataURL(res);
184    }).catch(err => {
185      this.getBlobForDSNoPhoto();
186    });
187  }
188  formatMoney(value) {
189    const temp = `${value}`.replace(/\,/g, "");
190    return this.currencyPipe.transform(temp).replace("$", "");
191  }
192  generatePdf() {
193    var _this = this;
194    return (0,C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () {
195      _this.loading = yield _this.loadingCtrl.create({
196        cssClass: 'my-custom-class',
197        message: 'Generating Receipt, please wait to download the PDF file...'
198      });
199      yield _this.loading.present();
200      var dd = {
201        pageSize: 'LETTER',
202        //pageSize: { width: 612.00, height: 792.00},
203        pageMargins: [60.5, 0, 0, 0],
204        content: [{
205          text: 'PAYMENT RECEIPT',
206          style: 'headerMid'
207        }, {
208          image: _this.dsProfileImg,
209          alignment: 'left',
210          width: 60,
211          height: 60,
212          margin: [0, 0, 0, 0]
213        }, {
214          text: ' '
215        }, {
216          text: _this.school.companyName
217        }, {
218          text: _this.school.fullAddress
219        }, {
220          text: 'Email: ' + _this.school.companyEmail
221        }, {
222          text: 'Tel. No.: ' + _this.school.telephone + ' | Mobile No.: ' + _this.school.mobile
223        }, {
224          text: 'LTO Accreditiation No: ' + _this.school.ltoAccreditationNo
225        }, {
226          text: 'Payment Details',
227          style: 'studentInformationLabel'
228        }, {
229          layout: 'noBorders',
230          // optional
231          table: {
232            widths: [72, 401, 308],
233            body: [[{
234              text: 'Bill To: ',
235              margin: [0, 15, 0, 0],
236              style: 'label'
237            }, {
238              text: _this.billToDetails,
239              fillColor: '#f8f8f8',
240              margin: [0, 15, 0, 0],
241              style: 'field'
242            }], [{
243              text: 'Reference No.',
244              margin: [0, 15, 0, 0],
245              style: 'label'
246            }, {
247              text: _this.transaction.paymentRefNumber,
248              fillColor: '#f8f8f8',
249              margin: [0, 15, 0, 0],
250              style: 'field'
251            }], [{
252              text: 'Date',
253              margin: [0, 15, 0, 0],
254              style: 'label'
255            }, {
256              text: _this.paymentDate,
257              fillColor: '#f8f8f8',
258              margin: [0, 15, 0, 0],
259              style: 'field'
260            }], [{
261              text: 'Method',
262              margin: [0, 15, 0, 0],
263              style: 'label'
264            }, {
265              text: _this.transaction.paymentMethodName,
266              fillColor: '#f8f8f8',
267              margin: [0, 15, 0, 0],
268              style: 'field'
269            }], [{
270              text: 'Remarks',
271              margin: [0, 15, 0, 0],
272              style: 'label'
273            }, {
274              text: _this.transaction.Remarks,
275              fillColor: '#f8f8f8',
276              margin: [0, 15, 0, 0],
277              style: 'field'
278            }]]
279          }
280        }, {
281          text: 'Course Information',
282          style: 'studentInformationLabel'
283        }, {
284          layout: 'noBorders',
285          // optional
286          table: {
287            // headers are automatically repeated if the table spans over multiple pages
288            // you can declare how many rows should be treated as headers
289            //widths: [82, 362, 66],
290            widths: [72, 401, 308],
291            body: [[{
292              text: 'Name',
293              margin: [0, 15, 0, 0],
294              style: 'label'
295            }, {
296              text: _this.transaction.courseName,
297              fillColor: '#f8f8f8',
298              margin: [0, 15, 0, 0],
299              style: 'field'
300            }], [{
301              text: 'Description',
302              margin: [0, 15, 0, 0],
303              style: 'label'
304            }, {
305              text: _this.transaction.courseName,
306              fillColor: '#f8f8f8',
307              margin: [0, 15, 0, 0],
308              style: 'field'
309            }], [{
310              text: 'Paid Amount',
311              margin: [0, 15, 0, 0],
312              style: 'label'
313            }, {
314              text: 'PHP ' + _this.formatMoney(_this.transaction.paymentTotalAmount),
315              fillColor: '#f8f8f8',
316              margin: [0, 15, 0, 0],
317              style: 'field'
318            }]]
319          }
320        }, {
321          text: '',
322          style: 'studentInformationLabel'
323        }, {
324          text: '=== This is a computer generated document, the official receipt will be issued by the Driving School ===',
325          alignment: 'center',
326          style: 'footer'
327        }, {
328          text: '',
329          style: 'studentInformationLabel'
330        }, {
331          text: '© ' + moment__WEBPACK_IMPORTED_MODULE_6__(new Date()).format('YYYY') + ' [email protected]',
332          style: 'footer'
333        }],
334        styles: {
335          headerSmall: {
336            fontSize: 15,
337            bold: true,
338            alignment: 'left',
339            color: '#333232',
340            margin: [0, 100, 0, 0]
341          },
342          header: {
343            fontSize: 45,
344            alignment: 'left',
345            color: '#0038a8',
346            bold: true
347          },
348          forLabel: {
349            fontSize: 15,
350            bold: true,
351            alignment: 'left',
352            color: '#333232',
353            margin: [0, 0, 0, 0]
354          },
355          headerMid: {
356            fontSize: 15,
357            bold: true,
358            alignment: 'left',
359            color: '#0038a8',
360            margin: [0, 24.5, 0, 11]
361          },
362          studentInformationLabel: {
363            fontSize: 12,
364            bold: true,
365            alignment: 'left',
366            color: '#0038a8',
367            margin: [0, 24.5, 0, 11]
368          },
369          label: {
370            fontSize: 10,
371            color: '#333232'
372          },
373          field: {
374            fontSize: 10,
375            bold: true,
376            color: '#000000'
377          },
378          footer: {
379            fontSize: 6,
380            color: '#333232'
381          }
382        }
383      };
384      _this.pdfObj = pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_4___default().createPdf(dd);
385      //console.log(this.pdfObj);
386      var qr = "{ qr: 'text in QR', fit: '500' }";
387      if (_this.plt.is('hybrid')) {
388        _this.pdfObj.getBase64( /*#__PURE__*/function () {
389          var _ref = (0,C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* (data) {
390            try {
391              let path = `pdf/certificate_${Date.now()}.pdf`;
392              const result = yield _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_7__.Filesystem.writeFile({
393                path,
394                data,
395                directory: _capacitor_filesystem__WEBPACK_IMPORTED_MODULE_7__.Directory.Documents,
396                recursive: true
397              });
398              _this.cmsService.successMessageToast('File Uri : ' + result.uri);
399              //console.log('error');
400              _this.fileOpener.open(`${result.uri}`, 'application/pdf').then(() => {
401                _this.loadingCtrl.dismiss();
402              }).catch(e => {
403                _this.cmsService.errorMessageToast('Error in File Opener : ' + e);
404                //console.log('error');
405                _this.loadingCtrl.dismiss();
406              });
407            } catch (e) {
408              _this.cmsService.errorMessageToast('Unnable to Write' + e);
409              console.error('Unnable to write');
410              _this.loadingCtrl.dismiss();
411            }
412          });
413          return function (_x) {
414            return _ref.apply(this, arguments);
415          };
416        }());
417        _this.fileDownloaded = true;
418      } else {
419        _this.fileDownloaded = true;
420        _this.pdfObj.download();
421        _this.loadingCtrl.dismiss();
422      }
423    })();
424  }
425  static #_ = this.ctorParameters = () => [{
426    type: _angular_router__WEBPACK_IMPORTED_MODULE_11__.ActivatedRoute
427  }, {
428    type: _ionic_angular__WEBPACK_IMPORTED_MODULE_12__.LoadingController
429  }, {
430    type: _ionic_angular__WEBPACK_IMPORTED_MODULE_12__.Platform
431  }, {
432    type: _ionic_native_file_opener_ngx__WEBPACK_IMPORTED_MODULE_9__.FileOpener
433  }, {
434    type: _angular_common_http__WEBPACK_IMPORTED_MODULE_13__.HttpClient
435  }, {
436    type: src_app_services_user_user_service__WEBPACK_IMPORTED_MODULE_10__.UserService
437  }, {
438    type: src_app_services_cms_cms_service__WEBPACK_IMPORTED_MODULE_8__.CmsService
439  }, {
440    type: src_app_services_payment_payment_service__WEBPACK_IMPORTED_MODULE_3__.PaymentService
441  }, {
442    type: _angular_common__WEBPACK_IMPORTED_MODULE_14__.CurrencyPipe
443  }, {
444    type: _angular_common__WEBPACK_IMPORTED_MODULE_14__.DatePipe
445  }];
446};
447ReceiptStudentPage = (0,tslib__WEBPACK_IMPORTED_MODULE_15__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_16__.Component)({
448  selector: 'app-receipt-student',
449  template: _receipt_student_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__,
450  providers: [_angular_common__WEBPACK_IMPORTED_MODULE_14__.DatePipe, _angular_common__WEBPACK_IMPORTED_MODULE_14__.CurrencyPipe],
451  styles: [(_receipt_student_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default())]
452})], ReceiptStudentPage);
453
454
455/***/ }),
456
457/***/ 40049:
458/*!*********************************************************************************!*\
459  !*** ./src/app/pages/home/receipt-student/receipt-student.page.scss?ngResource ***!
460  \*********************************************************************************/
461/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
462
463// Imports
464var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/sourceMaps.js */ 53142);
465var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/api.js */ 35950);
466var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_
466LOADER_API_SOURCEMAP_IMPORT___);
467// Module
468___CSS_LOADER_EXPORT___.push([module.id, ``, "",{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}]);
469// Exports
470module.exports = ___CSS_LOADER_EXPORT___.toString();
471
472
473/***/ }),
474
475/***/ 98399:
476/*!*********************************************************************************!*\
477  !*** ./src/app/pages/home/receipt-student/receipt-student.page.html?ngResource ***!
478  \*********************************************************************************/
479/***/ ((module) => {
480
481"use strict";
482module.exports = "<br/>\r\n<ion-content>\r\n  <ion-row class=\"course ion-margin-top\" *ngIf=\"fileDownloaded == false\">\r\n    <ion-col>\r\n      <div class=\"ion-text-center ion-padding\">\r\n        <h3>\r\n          <p>Downloading Receipt...</p>\r\n        </h3>\r\n      </div>\r\n    </ion-col>\r\n  </ion-row>\r\n  <ion-row class=\"course ion-margin-top\" *ngIf=\"fileDownloaded\">\r\n    <ion-col>\r\n      <div class=\"ion-text-center ion-padding\">\r\n        <h3>\r\n          <p>Receipt Successfully Downloaded.</p>\r\n        </h3>\r\n      </div>\r\n    </ion-col>\r\n  </ion-row>\r\n</ion-content>\r\n";
483
484/***/ })
485
486}]);
487//# sourceMappingURL=src_app_pages_home_receipt-student_receipt-student_module_ts.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.