MovesGrid.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template lang="pug">
  2. .card-grid-wrapper-move
  3. .card-grid-move
  4. card(v-for='item in items' :key='item.id' :amountResidual='item.amountResidualCurrency' :dateMaturity='item.dateMaturity' :debit='item.amountCurrency' :currency='currency' :isSelected='item.id === selectedId' :isDisable='moveDisable(item.dateMaturity)' @onClick='onClickCard(item)')
  5. </template>
  6. <script>
  7. import card from '@@/moveLine/MoveLineCard'
  8. export default {
  9. props: {
  10. items: {
  11. type: Array,
  12. default: []
  13. },
  14. currency: {
  15. type: Object,
  16. default: {
  17. name: '',
  18. symbol: '',
  19. position:'before',
  20. rateSilent: 0,
  21. thousandsSeparator: '.',
  22. decimalSeparator: ',',
  23. decimalPlaces: 0
  24. }
  25. }
  26. },
  27. components: {
  28. card
  29. },
  30. methods: {
  31. moveDisable(date_maturity) {
  32. let dateMaturity = moment(date_maturity).valueOf()
  33. let dates = this.items.map(item => {
  34. return moment(item.dateMaturity).valueOf()
  35. })
  36. return dates.findIndex(item => item >= dateMaturity) !== 0 ? true : false
  37. },
  38. onClickCard(item) {
  39. this.selectedId = item.id
  40. this.$emit('onSelect', item)
  41. }
  42. },
  43. data() {
  44. return {
  45. selectedId: -1
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="sass">
  51. .card-grid-wrapper-move
  52. width: calc(100% - 300px)
  53. height: calc(100% - 100px)
  54. margin-top: 15px
  55. overflow-y: auto
  56. display: inline-block
  57. .card-grid-move
  58. width: 100%
  59. </style>