Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

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