Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

75 líneas
1.5 KiB

  1. <template>
  2. <Dialog @close="$emit('close')">
  3. <h3>{{heading || "New Fee"}}</h3>
  4. <label>Name</label>
  5. <input type=""
  6. :value="fee.name"
  7. @input="(e) => fee.name = stripLetters(e)">
  8. <label>Amount</label>
  9. <input
  10. type=""
  11. :value="fee.amount / 100 || ''"
  12. @input="(e) => {fee.perc = 0; fee.amount = Math.round(strip(e) * 100)}">
  13. <label>Percentage of price</label>
  14. <input
  15. type=""
  16. :value="fee.perc"
  17. @input="changePerc">
  18. <select id="" name="" v-model="fee.type">
  19. <option value="Title">Title Company</option>
  20. <option value="Government">Government</option>
  21. <option value="Lender">Lender</option>
  22. <option value="Required">Required by Lender</option>
  23. <option value="Other">Other</option>
  24. </select>
  25. <button :disabled="!validFee" @click="() => $emit('save', fee, true)">
  26. Debit
  27. </button>
  28. <button :disabled="!validFee" @click="() => $emit('save', fee, false)">
  29. Credit
  30. </button>
  31. </Dialog>
  32. </template>
  33. <script>
  34. import Dialog from "./dialog.vue"
  35. import { stripLetters, strip, stripInt, stripPerc } from "../helpers.js"
  36. function validFee() {
  37. const fee = this.fee
  38. if (!fee.name || !fee.type) return false
  39. if (!fee.amount && !fee.perc) return false
  40. return true
  41. }
  42. function changePerc(e){
  43. this.fee.perc = stripPerc(e)
  44. this.fee.amount = stripPerc(e)/100*this.price
  45. }
  46. export default {
  47. components: { Dialog },
  48. methods: {
  49. stripLetters, strip, stripInt, stripPerc, changePerc
  50. },
  51. computed: {
  52. validFee,
  53. },
  54. props: ['initial', 'heading', 'price'],
  55. emits: ['close', 'save'],
  56. data() {
  57. return { fee: Object.assign({}, this.initial) }
  58. },
  59. }
  60. </script>