Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

propertyList.vue 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <!-- eslint-disable max-len -->
  3. <div>
  4. <div class="container">
  5. <div class="container">
  6. <br />
  7. <br />
  8. <div class="row">
  9. <div class="col-md-12 col-lg-8">
  10. <div class="title-box-d">
  11. <h1 class="title-d" style="text-align:left; font-size: 250%">Properties</h1>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="container">
  18. <listView
  19. :items="properties"
  20. :showNew="false"
  21. :editable="true"
  22. :deleteable="true"
  23. :showCustomAction="true"
  24. :CustomActionHeading="'Publish'"
  25. :displayColumns="columns"
  26. :displayFormats="formats"
  27. :displayHeaders="headers"
  28. @onEdit="Edit"
  29. @onDelete="Delete"
  30. @onCustomClick="Publish"
  31. />
  32. </div>
  33. <br />
  34. </div>
  35. </template>
  36. <script>
  37. import { mapState, mapActions } from 'vuex';
  38. import listView from '../shared/listView.vue';
  39. import Log from '../../assets/Log';
  40. export default {
  41. name: 'PropertyList',
  42. components: {
  43. listView,
  44. },
  45. data() {
  46. return {
  47. propertyType: '',
  48. role: 'MY',
  49. user: Log.getUser(),
  50. columns: [
  51. 'name',
  52. 'id',
  53. 'dateAvailable',
  54. 'size',
  55. 'price',
  56. 'usageType',
  57. 'type',
  58. 'saleType',
  59. 'publish',
  60. 'status',
  61. ],
  62. formats: ['text', 'text', 'date', 'text', 'money', 'text', 'text', 'text', 'text', 'text'],
  63. headers: ['', '', 'Available From', '', '', '', 'Property Type', '', '', ''],
  64. };
  65. },
  66. methods: {
  67. ...mapActions('propertyList', ['getProperties', 'deleteProperty', 'publishProperty']),
  68. Edit(item) {
  69. const salesType = item.isSale ? 'Sale' : 'Rental';
  70. this.$router.push({
  71. path: '/property/edit',
  72. query: { id: item.id },
  73. });
  74. },
  75. Delete(item) {
  76. this.deleteProperty(item.id);
  77. },
  78. Publish(item) {
  79. this.publishProperty(item);
  80. },
  81. },
  82. mounted() {
  83. this.getProperties(Object.assign(this.user.id));
  84. },
  85. computed: {
  86. ...mapState('propertyList', ['properties']),
  87. UserChanged() {
  88. this.getProperties(Object.assign(this.user.id));
  89. return this.user;
  90. },
  91. },
  92. watch: {
  93. UserChanged() {
  94. console.log(this.user);
  95. },
  96. },
  97. };
  98. </script>