PaymentDetails.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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="payment")
  20. label(for="cash") Contado
  21. .form-item-option
  22. input.form-input(type="radio" id="credit" value="credit" v-model="payment")
  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 } from 'vuex'
  35. export default {
  36. computed: mapGetters([
  37. 'hasSelectedCustomer',
  38. 'selectedCustomer',
  39. 'paymentTerms',
  40. 'journals',
  41. 'selectedJournal',
  42. 'selectedPaymentTerm'
  43. ]),
  44. methods: {
  45. getCustomerName() {
  46. return this.hasSelectedCustomer ? this.selectedCustomer.display_name : ''
  47. },
  48. getCustomerCredit() {
  49. return this.hasSelectedCustomer && this.selectedCustomer.credit_limit >= this.selectedCustomer.credit ? this.selectedCustomer.credit_limit - this.selectedCustomer.credit : 0
  50. }
  51. },
  52. data() {
  53. return {
  54. payment: 'cash'
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="sass">
  60. .payment-details
  61. width: calc(100% - 450px)
  62. height: 100%
  63. margin-right: 50px
  64. padding: 35px
  65. background: #f5f5f5
  66. .form-separator
  67. h3
  68. color: #9e9e9e
  69. font-size: 8pt
  70. hr
  71. margin-top: 5px
  72. .form-item
  73. .form-label
  74. width: 200px
  75. height: 30px
  76. .form-input
  77. width: 300px
  78. height: 30px
  79. &.input-only
  80. margin-left: 200px
  81. margin-bottom: 15px
  82. .form-item-option
  83. display: inline-block
  84. input
  85. width: 20px
  86. height: 20px
  87. label
  88. font-size: 12pt
  89. margin: 0 45px 15px 5px
  90. </style>