payment.component.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <h1>{{ isMobile ? 'Scan QR & Authenticate to Pay' : 'Scan to make Payment!' }}</h1>
  2. <!-- Loading State -->
  3. <div *ngIf="loading">
  4. <p>Loading…</p>
  5. </div>
  6. <!-- Web QR Code + Payment List -->
  7. <div *ngIf="!isMobile && !loading && qrData"
  8. style="display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap;">
  9. <!-- QR Code -->
  10. <div>
  11. <qrcode [qrdata]="qrData" [width]="256" [errorCorrectionLevel]="'M'"></qrcode>
  12. </div>
  13. <!-- Payment List -->
  14. <div style="min-width: 300px; flex: 1;">
  15. <h2>Payment List</h2>
  16. <table style="width: 100%; border-collapse: collapse;">
  17. <thead>
  18. <tr>
  19. <th style="text-align: left; padding: 0.5rem; border-bottom: 1px solid #ccc;">Name</th>
  20. <th style="text-align: left; padding: 0.5rem; border-bottom: 1px solid #ccc;">Time</th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. <tr *ngFor="let payee of paymentList">
  25. <td style="padding: 0.5rem; border-bottom: 1px solid #eee;">{{ payee.name }}</td>
  26. <td style="padding: 0.5rem; border-bottom: 1px solid #eee;">
  27. {{ payee.time | date: 'medium' }}
  28. </td>
  29. </tr>
  30. </tbody>
  31. </table>
  32. </div>
  33. </div>
  34. <!-- If unable to generate QR -->
  35. <div *ngIf="!isMobile && !loading && !qrData">
  36. <p>Unable to generate QR code.</p>
  37. </div>
  38. <!-- Mobile Section -->
  39. <div *ngIf="isMobile && !loading">
  40. <div *ngIf="scannedResult; else noResult">
  41. <p><strong>Scanned Result:</strong></p>
  42. <code>{{ scannedResult }}</code>
  43. </div>
  44. <ng-template #noResult>
  45. <p>Tap below to scan a QR code and authenticate payment.</p>
  46. </ng-template>
  47. <button (click)="startScan()">📷 Scan & Pay</button>
  48. <div *ngIf="postResponse" style="margin-top: 1rem;">
  49. <strong>Server Response:</strong>
  50. <p>{{ postResponse }}</p>
  51. </div>
  52. </div>