PaymentDetails.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template lang="pug">
  2. form.payment-details
  3. .form-separator
  4. h3 Detalles del Cliente
  5. hr
  6. .form-item
  7. label.form-label Cliente
  8. input.form-input(readonly :value="getCustomerName()")
  9. transition(name="fade")
  10. .form-item(v-if="payment === 'credit'")
  11. label.form-label Crédito
  12. input.form-input(readonly :value="getCustomerCredit()")
  13. .form-separator
  14. h3 Detalles del Pago
  15. hr
  16. .form-item
  17. label.form-label Forma de pago
  18. .form-item-option
  19. input.form-input(type="radio" id="cash" value="cash" v-model="payIn")
  20. label(for="cash") Contado
  21. .form-item-option
  22. input.form-input(type="radio" id="credit" value="credit" v-model="payIn")
  23. label(for="credit") Crédito
  24. transition(name="fade")
  25. .form-item(v-if="payment === 'credit'")
  26. select.form-input.input-only
  27. option(v-for="term in paymentTerms" v-bind:value="term.id" v-if="term.lines.length > 0 && term.lines[0].days !== 0") {{ term.display_name }}
  28. .form-item(v-else)
  29. label.form-label Método de Pago
  30. select.form-input
  31. option(v-for="journal in journals" v-bind:value="journal.id") {{ journal.display_name }}
  32. </template>
  33. <script>
  34. import { mapGetters, mapActions } from 'vuex'
  35. export default {
  36. computed: {
  37. payIn: {
  38. get() {
  39. return this.payment
  40. },
  41. set(value) {
  42. this.togglePayment(value)
  43. }
  44. },
  45. ...mapGetters([
  46. 'hasSelectedCustomer',
  47. 'selectedCustomer',
  48. 'payment',
  49. 'paymentTerms',
  50. 'journals',
  51. 'selectedJournal',
  52. 'selectedPaymentTerm'
  53. ])
  54. },
  55. methods: {
  56. getCustomerName() {
  57. return this.hasSelectedCustomer ? this.selectedCustomer.display_name : ''
  58. },
  59. getCustomerCredit() {
  60. return this.hasSelectedCustomer && this.selectedCustomer.credit_limit >= this.selectedCustomer.credit ? this.selectedCustomer.credit_limit - this.selectedCustomer.credit : 0
  61. },
  62. ...mapActions([
  63. 'togglePayment'
  64. ])
  65. }
  66. }
  67. </script>
  68. <style lang="sass">
  69. .payment-details
  70. width: calc(100% - 450px)
  71. height: 100%
  72. margin-right: 50px
  73. padding: 35px
  74. background: #f5f5f5
  75. .form-separator
  76. h3
  77. color: #9e9e9e
  78. font-size: 8pt
  79. hr
  80. margin-top: 5px
  81. .form-item
  82. width: 100%
  83. height: 45px
  84. margin-bottom: 15px
  85. .form-label
  86. width: 250px
  87. height: 45px
  88. font-size: 14pt
  89. .form-input
  90. width: 350px
  91. height: 45px
  92. font-size: 14pt
  93. border-radius: 0
  94. &.input-only
  95. margin-left: 250px
  96. margin-bottom: 15px
  97. .form-item-option
  98. display: inline-block
  99. input
  100. width: 20px
  101. height: 20px
  102. label
  103. font-size: 12pt
  104. margin: 0 45px 15px 5px
  105. </style>