PaystackPaymentDialog.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <ui-dialog
  3. class="ng-paystack-payment-dialog"
  4. :title="title"
  5. width="460px"
  6. top="0"
  7. :visible="visible"
  8. :close-on-click-modal="false"
  9. :show-close="!loading"
  10. v-bind="$attrs"
  11. v-on="$listeners"
  12. >
  13. <p class="ng-paystack-payment-note">{{ note }}</p>
  14. <el-form
  15. v-loading="loading"
  16. class="ng-paystack-payment-form"
  17. label-position="top"
  18. :disabled="loading"
  19. @submit.native.prevent
  20. >
  21. <el-form-item label="Email" for="ng-paystack-payment-email">
  22. <el-input
  23. id="ng-paystack-payment-email"
  24. :value="email"
  25. :readonly="readonlyEmail"
  26. @input="$emit('update:email', $event)"
  27. />
  28. </el-form-item>
  29. </el-form>
  30. <div class="ng-paystack-payment-amount">
  31. <span>Amount</span>
  32. <strong>{{ currency }} {{ amount | toThousandFilter }}</strong>
  33. </div>
  34. <div class="ng-paystack-payment-trigger"><slot /></div>
  35. <el-button
  36. class="ng-paystack-payment-continue"
  37. type="primary"
  38. native-type="button"
  39. :disabled="loading || !visible"
  40. @click="$emit('continue')"
  41. >
  42. {{ continueLabel }}
  43. </el-button>
  44. <template slot="footer"><span /></template>
  45. </ui-dialog>
  46. </template>
  47. <script>
  48. import UiDialog from './UiDialog.vue'
  49. import { toThousandFilter } from '@/filters'
  50. export default {
  51. name: 'PaystackPaymentDialog',
  52. components: { UiDialog },
  53. filters: { toThousandFilter },
  54. inheritAttrs: false,
  55. props: {
  56. visible: { type: Boolean, default: false },
  57. title: { type: String, default: 'Paystack Payment' },
  58. note: {
  59. type: String,
  60. default: 'Confirm your email to continue to the Paystack secure checkout.'
  61. },
  62. continueLabel: { type: String, default: 'Continue to Paystack' },
  63. email: { type: String, default: '' },
  64. amount: { type: [Number, String], default: 0 },
  65. currency: { type: String, default: '' },
  66. readonlyEmail: { type: Boolean, default: false },
  67. loading: { type: Boolean, default: false }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .ng-paystack-payment-dialog {
  73. display: flex;
  74. padding: 16px;
  75. }
  76. .ng-paystack-payment-dialog ::v-deep .el-dialog {
  77. flex-shrink: 0;
  78. max-width: 100%;
  79. margin: auto !important;
  80. border-radius: 14px;
  81. }
  82. .ng-paystack-payment-dialog ::v-deep .el-dialog__header {
  83. padding: 24px 40px 0 24px;
  84. }
  85. .ng-paystack-payment-dialog ::v-deep .el-dialog__title {
  86. color: #25292c;
  87. font-size: 24px;
  88. font-weight: 700;
  89. line-height: 1.3;
  90. }
  91. .ng-paystack-payment-dialog ::v-deep .el-dialog__headerbtn {
  92. top: 16px;
  93. right: 16px;
  94. }
  95. .ng-paystack-payment-dialog ::v-deep .el-dialog__body {
  96. padding: 10px 24px 24px;
  97. }
  98. .ng-paystack-payment-dialog ::v-deep .el-dialog__footer,
  99. .ng-paystack-payment-trigger {
  100. display: none;
  101. }
  102. .ng-paystack-payment-note {
  103. margin: 0 0 16px;
  104. color: #6b737a;
  105. font-size: 14px;
  106. line-height: 1.5;
  107. word-break: normal;
  108. overflow-wrap: break-word;
  109. }
  110. .ng-paystack-payment-form ::v-deep .el-form-item {
  111. margin-bottom: 0;
  112. }
  113. .ng-paystack-payment-form ::v-deep .el-form-item__label {
  114. padding-bottom: 8px;
  115. color: #25292c;
  116. line-height: 1.5;
  117. }
  118. .ng-paystack-payment-form ::v-deep .el-input__inner {
  119. height: 54px;
  120. border-radius: 8px;
  121. font-size: 16px;
  122. line-height: 54px;
  123. }
  124. .ng-paystack-payment-amount {
  125. display: flex;
  126. align-items: center;
  127. justify-content: space-between;
  128. gap: 8px 16px;
  129. margin: 16px 0;
  130. padding: 12px 16px;
  131. border-radius: 8px;
  132. background: #f8f9fa;
  133. color: #6b737a;
  134. font-size: 14px;
  135. line-height: 1.5;
  136. }
  137. .ng-paystack-payment-amount strong {
  138. min-width: 0;
  139. color: #1f6b3f;
  140. font-size: 18px;
  141. font-variant-numeric: tabular-nums;
  142. text-align: right;
  143. overflow-wrap: anywhere;
  144. }
  145. .ng-paystack-payment-continue.el-button--primary {
  146. width: 100%;
  147. min-height: 50px;
  148. padding: 14px 16px;
  149. border-radius: 8px;
  150. font-size: 16px;
  151. font-weight: 700;
  152. line-height: 1.4;
  153. white-space: normal;
  154. }
  155. @media (max-width: 480px) {
  156. .ng-paystack-payment-dialog ::v-deep .el-dialog__title {
  157. font-size: 22px;
  158. }
  159. }
  160. </style>