Browse Source

Merge Conflicts

master
Lene Scholtz 5 years ago
parent
commit
b4becc221b
34 changed files with 1187 additions and 504 deletions
  1. 28
    8
      src/App.vue
  2. 4
    1
      src/assets/Log.js
  3. 1
    0
      src/components/admin/misc/carousel.vue
  4. 98
    0
      src/components/admin/misc/carouselList.vue
  5. 6
    3
      src/components/communication/templateDetail.vue
  6. 13
    7
      src/components/communication/templatePage.vue
  7. 13
    1
      src/components/home/carouselSection.vue
  8. 1
    1
      src/components/processFlow/makeOffer.vue
  9. 2
    9
      src/components/property/propertyCreate.vue
  10. 35
    17
      src/components/property/propertyFieldEditor.vue
  11. 5
    1
      src/components/property/propertyImage.vue
  12. 0
    7
      src/components/property/propertyUserField.vue
  13. 342
    125
      src/components/property/propertyeditPage.vue
  14. 11
    11
      src/components/shared/alert.vue
  15. 43
    8
      src/components/shared/listView.vue
  16. 2
    1
      src/components/shared/navBar.vue
  17. 1
    1
      src/components/shared/searchTab.vue
  18. 2
    3
      src/components/timeshare/buy/buyPage.vue
  19. 2
    1
      src/components/timeshare/buy/weekListComponent.vue
  20. 25
    10
      src/components/timeshare/myWeeksPage.vue
  21. 19
    6
      src/components/timeshare/resort/unitPage.vue
  22. 7
    1
      src/components/timeshare/sell/sellPage.vue
  23. 6
    0
      src/components/user/loginPage.vue
  24. 220
    203
      src/router/index.js
  25. 6
    2
      src/store/index.js
  26. 31
    0
      src/store/modules/misc/carousel.js
  27. 3
    3
      src/store/modules/property/property.js
  28. 143
    0
      src/store/modules/property/propertyEdit.js
  29. 16
    0
      src/store/modules/searchTab.js
  30. 17
    2
      src/store/modules/timeshare/myWeeks.js
  31. 48
    42
      src/store/modules/timeshare/region.js
  32. 20
    22
      src/store/modules/timeshare/timeshare.js
  33. 6
    7
      src/store/modules/timeshare/week.js
  34. 11
    1
      src/store/modules/timeshare/weekList.js

+ 28
- 8
src/App.vue View File

36
 hr {
36
 hr {
37
   background-color: #60cbeb;
37
   background-color: #60cbeb;
38
 }
38
 }
39
+.my-btn {
40
+  margin: 2px;
41
+  color: #60cbeb;
42
+}
39
 .title-img {
43
 .title-img {
40
   width: 800px;
44
   width: 800px;
41
   height: 400px;
45
   height: 400px;
54
   fill: #60cbeb;
58
   fill: #60cbeb;
55
   color: #60cbeb;
59
   color: #60cbeb;
56
 }
60
 }
61
+.mySuccess {
62
+  border-color: rgba(2, 184, 117, 0.5);
63
+  background-color: rgba(2, 184, 117, 0.5);
64
+}
65
+.myInfo {
66
+  border-color: rgba(23, 162, 184, 0.5);
67
+  background-color: rgba(23, 162, 184, 0.5);
68
+}
69
+.myWarning {
70
+  border-color: rgba(240, 173, 78, 0.5);
71
+  background-color: rgba(240, 173, 78, 0.5);
72
+}
73
+.myError {
74
+  border-color: rgba(217, 83, 79, 0.5);
75
+  background-color: rgba(217, 83, 79, 0.5);
76
+}
57
 a {
77
 a {
58
   cursor: pointer;
78
   cursor: pointer;
59
 }
79
 }
70
 .cursor-pointer {
90
 .cursor-pointer {
71
   cursor: pointer;
91
   cursor: pointer;
72
 }
92
 }
73
-    body,
74
-    html {
75
-        font-size: 13.7px !important;
76
-        color: #666;
77
-        font-family: "Roboto", sans-serif;
78
-        height: 100%;
79
-        margin: 0;
80
-    }
93
+body,
94
+html {
95
+  font-size: 13.7px !important;
96
+  color: #666;
97
+  font-family: "Roboto", sans-serif;
98
+  height: 100%;
99
+  margin: 0;
100
+}
81
 </style>
101
 </style>
82
 
102
 
83
 <style scoped>
103
 <style scoped>

+ 4
- 1
src/assets/Log.js View File

48
     return localStorage.getItem('token') !== undefined && localStorage.getItem('token') !== null;
48
     return localStorage.getItem('token') !== undefined && localStorage.getItem('token') !== null;
49
   },
49
   },
50
   getUser() {
50
   getUser() {
51
-    return localStorage.getItem('user');
51
+    return localStorage.getItem('user') ? JSON.parse(localStorage.getItem('user')) : {};
52
+  },
53
+  getPerson() {
54
+    return localStorage.getItem('person') ? JSON.parse(localStorage.getItem('person')) : {};
52
   },
55
   },
53
 };
56
 };
54
 export default items;
57
 export default items;

+ 1
- 0
src/components/admin/misc/carousel.vue View File

1
+<!-- Work in Progress -->

+ 98
- 0
src/components/admin/misc/carouselList.vue View File

1
+<template>
2
+  <!-- eslint-disable max-len -->
3
+  <div>
4
+    <div class="container">
5
+      <!-- <section class="intro-single"> -->
6
+      <div class="container">
7
+        <br />
8
+        <br />
9
+        <div class="row">
10
+          <div class="col-md-12 col-lg-8">
11
+            <!-- <div class="title-single-box"> -->
12
+            <!-- <h1 class="title-single">Property Types</h1> -->
13
+            <!-- </div> -->
14
+            <div class="title-box-d">
15
+              <h1 class="title-d" style="text-align:left; font-size: 250%">Carousel Items</h1>
16
+            </div>
17
+            <br />
18
+          </div>
19
+        </div>
20
+      </div>
21
+      <!-- </section> -->
22
+    </div>
23
+    <div class="container">
24
+      <button type="button" @click="New()" class="btn btn-b-n" style="width: 85px; height:40px;">New</button>
25
+    </div>
26
+    <div class="container">
27
+      <table class="table table-bordered">
28
+        <thead>
29
+          <tr>
30
+            <th>Image</th>
31
+            <th>Header</th>
32
+            <th>Type</th>
33
+            <th></th>
34
+            <th></th>
35
+          </tr>
36
+        </thead>
37
+        <tbody>
38
+          <tr v-for="(item, i) in carouselList" :key="i">
39
+            <td>
40
+              <img :src="item.image" style="height:100px; width:100px; object-fit: cover;" />
41
+            </td>
42
+            <td>{{ item.header }}</td>
43
+            <td v-if="item.propertyId">Property</td>
44
+            <td v-else>Timeshare Week</td>
45
+            <td>
46
+              <button
47
+                type="button"
48
+                @click="Edit(item.id)"
49
+                class="btn"
50
+                style="margin:2px; color: #60CBEB"
51
+              >Edit</button>
52
+            </td>
53
+            <td>
54
+              <button
55
+                type="button"
56
+                @click="Delete(item.id)"
57
+                class="btn"
58
+                style="margin:2px; color: #60CBEB"
59
+              >Delete</button>
60
+            </td>
61
+          </tr>
62
+        </tbody>
63
+      </table>
64
+    </div>
65
+    <br />
66
+  </div>
67
+</template>
68
+
69
+<script>
70
+import { mapState, mapActions } from 'vuex';
71
+
72
+export default {
73
+  name: 'CarouselList',
74
+  data() {
75
+    return {};
76
+  },
77
+  methods: {
78
+    ...mapActions('carousel', ['getCarouselList', 'deleteCarousel']),
79
+    New() {
80
+      this.$router.push('/carousel/details/0');
81
+    },
82
+    Edit(itemID) {
83
+      this.$router.push({
84
+        path: `/carousel/details/${itemID}`,
85
+      });
86
+    },
87
+    Delete(id) {
88
+      this.deleteCarousel(id);
89
+    },
90
+  },
91
+  mounted() {
92
+    this.getCarouselList();
93
+  },
94
+  computed: {
95
+    ...mapState('carousel', ['carouselList']),
96
+  },
97
+};
98
+</script>

+ 6
- 3
src/components/communication/templateDetail.vue View File

1
 <template>
1
 <template>
2
   <div style="padding:10px;">
2
   <div style="padding:10px;">
3
-    <div class="container" style="background-color:rgba(215,215,215,0.75);padding:20px;">
3
+    <div
4
+      class="container"
5
+      style="border:silver solid thin;border-radius:10px;background-color:rgba(235,235,235,0.75);padding:20px;"
6
+    >
4
       <div class="row">
7
       <div class="row">
5
         <div class="col-md-12">
8
         <div class="col-md-12">
6
           <div class="d-flex">
9
           <div class="d-flex">
85
           <div
88
           <div
86
             class="tab-content"
89
             class="tab-content"
87
             id="myTabContent"
90
             id="myTabContent"
88
-            style="background-color:rgba(255,255,255,0.75);padding:10px;"
91
+            style="background-color:rgba(255,255,255,0.75);padding:10px;border:silver solid thin;border-radius:10px;"
89
           >
92
           >
90
             <div
93
             <div
91
               class="tab-pane fade show active"
94
               class="tab-pane fade show active"
139
         <div
142
         <div
140
           class="col-md-12"
143
           class="col-md-12"
141
           v-if="showNew"
144
           v-if="showNew"
142
-          style="background-color:rgba(255,255,255,1); border-radius:5px;padding:10px;"
145
+          style="background-color:rgba(255,255,255,0.75); border:silver solid thin;border-radius:10px;padding:10px;padding:10px 30px;"
143
         >
146
         >
144
           <TemplateInnerItem />
147
           <TemplateInnerItem />
145
         </div>
148
         </div>

+ 13
- 7
src/components/communication/templatePage.vue View File

1
 <template>
1
 <template>
2
-  <div>
3
-    <br />
4
-    <hr />
5
-    <hr />
6
-    <hr />
7
-    <hr />
8
-    <hr />
2
+  <div class="container-fluid" style="margin-top:25px;">
3
+    <div class="row">
4
+      <div class="col-md-1"></div>
5
+      <div class="col-md-10">
6
+        <div class>
7
+          <h3 class="sinse-title">Email Templates</h3>
8
+        </div>
9
+      </div>
10
+      <div class="col-md-12">
11
+        <hr />
12
+      </div>
13
+    </div>
9
     <div class="row">
14
     <div class="row">
10
       <div :class="listClass">
15
       <div :class="listClass">
11
         <ListView :items="list" @onRowClick="onRowClick" />
16
         <ListView :items="list" @onRowClick="onRowClick" />
14
         <DetailView :item="detailItem" />
19
         <DetailView :item="detailItem" />
15
       </div>
20
       </div>
16
     </div>
21
     </div>
22
+
17
     <hr />
23
     <hr />
18
   </div>
24
   </div>
19
 </template>
25
 </template>

+ 13
- 1
src/components/home/carouselSection.vue View File

98
   </div>
98
   </div>
99
 </template>
99
 </template>
100
 <script>
100
 <script>
101
-export default {};
101
+import { mapState, mapActions } from 'vuex';
102
+
103
+export default {
104
+  methods: {
105
+    ...mapActions('carousel', ['getCarouselList']),
106
+  },
107
+  mounted() {
108
+    this.getCarouselList();
109
+  },
110
+  computed: {
111
+    ...mapState('carousel', ['carouselList']),
112
+  },
113
+};
102
 </script>
114
 </script>

+ 1
- 1
src/components/processFlow/makeOffer.vue View File

21
         <div class="form-group row">
21
         <div class="form-group row">
22
           <div class="col-md-6 col-lg-5 section-md-t3">
22
           <div class="col-md-6 col-lg-5 section-md-t3">
23
             <div class="title-box-d">
23
             <div class="title-box-d">
24
-              <h3 class="title-d">{{ item ? item.resortName : '' }}</h3>
24
+              <h3 class="title-d">{{ item ? item.resort.resortName : '' }}</h3>
25
             </div>
25
             </div>
26
           </div>
26
           </div>
27
         </div>
27
         </div>

+ 2
- 9
src/components/property/propertyCreate.vue View File

21
           />
21
           />
22
         </div>
22
         </div>
23
         <div class="sinse-box" style="opacity:0.7; border: white solid 3px; border-radius: 15px">
23
         <div class="sinse-box" style="opacity:0.7; border: white solid 3px; border-radius: 15px">
24
-          <h3 class="sinse-title">List {{ propertyType }} {{ salesType }} Property CREATE PAGE</h3>
24
+          <h3 class="sinse-title">List {{ propertyType }} {{ salesType }} Property</h3>
25
         </div>
25
         </div>
26
       </div>
26
       </div>
27
       <br />
27
       <br />
349
               class="btn btn-b-n"
349
               class="btn btn-b-n"
350
               style="width: 85px; height:40px;"
350
               style="width: 85px; height:40px;"
351
             >Save</button>
351
             >Save</button>
352
-            <button
353
-              v-if="isEdit"
354
-              type="button"
355
-              @click="Close()"
356
-              class="btn btn-b-n"
357
-              style="width: 85px; height:40px;"
358
-            >Close</button>
359
             <div v-if="wait" id="preloader"></div>
352
             <div v-if="wait" id="preloader"></div>
360
           </form>
353
           </form>
361
         </div>
354
         </div>
372
 import ImageLoad from './propertyImage.vue';
365
 import ImageLoad from './propertyImage.vue';
373
 
366
 
374
 export default {
367
 export default {
375
-  name: 'PropertyEdit',
368
+  name: 'PropertyCreate',
376
   components: {
369
   components: {
377
     UserField,
370
     UserField,
378
     ImageLoad,
371
     ImageLoad,

+ 35
- 17
src/components/property/propertyFieldEditor.vue View File

1
 <template>
1
 <template>
2
+  <!-- eslint-disable max-len -->
2
   <div>
3
   <div>
3
     <div>
4
     <div>
4
       <div v-if="!edit" class="input-group-prepend">
5
       <div v-if="!edit" class="input-group-prepend">
10
           v-model="display"
11
           v-model="display"
11
           disabled
12
           disabled
12
         />
13
         />
13
-        <span @click="EditClick()" class="input-group-text" style="color: #60CBEB">
14
+        <span v-if="mayEdit" @click="EditClick()" class="input-group-text" style="color: #60CBEB">
14
           <eva-icon name="edit-outline" fill="#60CBEB"></eva-icon>
15
           <eva-icon name="edit-outline" fill="#60CBEB"></eva-icon>
15
         </span>
16
         </span>
16
       </div>
17
       </div>
22
           type="text"
23
           type="text"
23
           name="currentField.name"
24
           name="currentField.name"
24
           id="currentField.id"
25
           id="currentField.id"
25
-          v-model="display"
26
+          v-model="updatedDisplay"
26
         />
27
         />
27
         <!-- Number -->
28
         <!-- Number -->
28
         <input
29
         <input
31
           type="number"
32
           type="number"
32
           name="currentField.name"
33
           name="currentField.name"
33
           id="currentField.id"
34
           id="currentField.id"
34
-          v-model="display"
35
+          v-model="updatedDisplay"
35
         />
36
         />
36
         <!-- Selector -->
37
         <!-- Selector -->
37
         <select
38
         <select
40
           v-model="selectorSelection"
41
           v-model="selectorSelection"
41
           @change="SelectorSelected"
42
           @change="SelectorSelected"
42
         >
43
         >
43
-          <option value="0">Please select type</option>
44
+          <option value="0"></option>
44
           <option v-for="item in arrayObject" :value="item.id" :key="item.id">{{ item.description }}</option>
45
           <option v-for="item in arrayObject" :value="item.id" :key="item.id">{{ item.description }}</option>
45
         </select>
46
         </select>
46
         <!-- yesno -->
47
         <!-- yesno -->
49
           <option value="yes">Yes</option>
50
           <option value="yes">Yes</option>
50
           <option value="no">No</option>
51
           <option value="no">No</option>
51
         </select>
52
         </select>
52
-        <span @click="Save()" class="input-group-text" style="color: #60CBEB">
53
+        <span @click="UpdateValue()" class="input-group-text" style="color: #60CBEB">
53
           <eva-icon name="checkmark-outline" fill="#60CBEB"></eva-icon>
54
           <eva-icon name="checkmark-outline" fill="#60CBEB"></eva-icon>
54
         </span>
55
         </span>
55
         <span @click="Close()" class="input-group-text" style="color: #60CBEB">
56
         <span @click="Close()" class="input-group-text" style="color: #60CBEB">
65
   name: 'propertyFieldEdit',
66
   name: 'propertyFieldEdit',
66
   props: {
67
   props: {
67
     display: String,
68
     display: String,
68
-    arrayObject: [],
69
+    arrayObject: { type: Array, default: () => [] },
69
     canEdit: Boolean,
70
     canEdit: Boolean,
70
     editType: String,
71
     editType: String,
72
+    propertyName: String,
73
+    propertyId: Number,
74
+    userDefinedId: Number,
75
+    isUDF: Boolean,
76
+    isPropOverview: Boolean,
77
+    arrayIndex: Number,
78
+    arrayItemIndex: Number,
79
+    mayEdit: Boolean,
71
   },
80
   },
72
   data() {
81
   data() {
73
     return {
82
     return {
74
       edit: false,
83
       edit: false,
75
       selectorSelection: Object,
84
       selectorSelection: Object,
85
+      updatedDisplay: '',
76
     };
86
     };
77
   },
87
   },
78
   methods: {
88
   methods: {
79
     EditClick() {
89
     EditClick() {
80
       this.edit = true;
90
       this.edit = true;
81
     },
91
     },
82
-    Save() {
83
-      this.edit = false;
84
-
85
-      // Need to emit the parent controller
86
-    },
87
     Close() {
92
     Close() {
88
       this.edit = false;
93
       this.edit = false;
89
     },
94
     },
90
     SelectorSelected(item) {
95
     SelectorSelected(item) {
91
       if (item.target.options.selectedIndex > 0) {
96
       if (item.target.options.selectedIndex > 0) {
92
-        this.display = this.arrayObject[
97
+        this.updatedDisplay = this.arrayObject[
93
           item.target.options.selectedIndex - 1
98
           item.target.options.selectedIndex - 1
94
         ].description;
99
         ].description;
95
-        console.log(
96
-          this.arrayObject[item.target.options.selectedIndex - 1].description,
97
-        );
98
       }
100
       }
99
     },
101
     },
100
     YesNoSelected(item) {
102
     YesNoSelected(item) {
101
       if (item.target.options.selectedIndex === 1) {
103
       if (item.target.options.selectedIndex === 1) {
102
-        this.display = 'Yes';
104
+        this.updatedDisplay = 'Yes';
103
       }
105
       }
104
       if (item.target.options.selectedIndex === 2) {
106
       if (item.target.options.selectedIndex === 2) {
105
-        this.display = 'No';
107
+        this.updatedDisplay = 'No';
106
       }
108
       }
107
     },
109
     },
110
+    UpdateValue() {
111
+      this.edit = false;
112
+      this.$emit('UpdateValue', {
113
+        fieldName: this.propertyName,
114
+        value: this.updatedDisplay,
115
+        propertyId: this.propertyId,
116
+        userDefinedId: this.userDefinedId,
117
+        isUDF: this.isUDF,
118
+        isPropOverview: this.isPropOverview,
119
+        arrayIndex: this.arrayIndex,
120
+        arrayItemIndex: this.arrayItemIndex,
121
+      });
122
+    },
123
+  },
124
+  mounted() {
125
+    this.updatedDisplay = this.display;
108
   },
126
   },
109
 };
127
 };
110
 </script>
128
 </script>

+ 5
- 1
src/components/property/propertyImage.vue View File

11
           name="images[]"
11
           name="images[]"
12
           @change="imagesAdd"
12
           @change="imagesAdd"
13
           multiple
13
           multiple
14
+          :disabled="!mayEdit"
14
         />
15
         />
15
       </label>
16
       </label>
16
     </div>
17
     </div>
21
         <label for="checkbox" style="margin: 10px;">Main Image</label>
22
         <label for="checkbox" style="margin: 10px;">Main Image</label>
22
         <img :src="img" style="height:200px; width:150px; object-fit: cover;" />
23
         <img :src="img" style="height:200px; width:150px; object-fit: cover;" />
23
         <br />
24
         <br />
24
-        <a class="fa fa-times del" @click="removeImage(key)" />
25
+        <span class="input-group-text" align="center" @click="removeImage(key)">
26
+          <eva-icon name="trash-2-outline" fill="#60CBEB"></eva-icon>Delete
27
+        </span>
25
       </div>
28
       </div>
26
       <br />
29
       <br />
27
     </div>
30
     </div>
32
 export default {
35
 export default {
33
   props: {
36
   props: {
34
     loadedImages: Function,
37
     loadedImages: Function,
38
+    mayEdit: { type: Boolean, default: () => true },
35
   },
39
   },
36
   data() {
40
   data() {
37
     return {
41
     return {

+ 0
- 7
src/components/property/propertyUserField.vue View File

65
       return '';
65
       return '';
66
     },
66
     },
67
   },
67
   },
68
-  // Testing editing
69
-  // created() {
70
-  //   this.setFields = [];
71
-  //   for (let i = 0; i < this.fields.length; i++) {
72
-  //     this.setFields[i] = this.fields[i].value;
73
-  //   }
74
-  // },
75
 };
68
 };
76
 </script>
69
 </script>

+ 342
- 125
src/components/property/propertyeditPage.vue View File

53
                 </div>
53
                 </div>
54
               </div>
54
               </div>
55
             </div>
55
             </div>
56
+            <div class="form-group row">
57
+              <div class="col-md-4">
58
+                <label>Sale Type</label>
59
+                <propField
60
+                  :display="property.isSale ? 'Sale' : 'Rental'"
61
+                  :editType="'selector'"
62
+                  :arrayObject="salesTypeArr"
63
+                  :propertyName="'isSale'"
64
+                  :mayEdit="mayEdit"
65
+                  @UpdateValue="UpdateValue"
66
+                />
67
+              </div>
68
+            </div>
56
             <div class="form-group row">
69
             <div class="form-group row">
57
               <div class="col-md-4">
70
               <div class="col-md-4">
58
                 <label>Property Type</label>
71
                 <label>Property Type</label>
59
                 <propField
72
                 <propField
60
-                  :display="property.propertyType.description"
61
-                  :editType="'Selector'"
73
+                  :display="property.propertyType ? property.propertyType.description : ''"
74
+                  :editType="'selector'"
62
                   :arrayObject="propertyTypes"
75
                   :arrayObject="propertyTypes"
76
+                  :propertyName="'propertyType'"
77
+                  :mayEdit="mayEdit"
78
+                  @UpdateValue="UpdateValue"
63
                 />
79
                 />
64
               </div>
80
               </div>
65
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
81
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
66
                 <label>Property Name</label>
82
                 <label>Property Name</label>
67
-                <propField :display="property.proeprtyName" :editType="'text'" />
83
+                <propField
84
+                  :display="property.propertyName"
85
+                  :editType="'text'"
86
+                  :propertyName="'propertyName'"
87
+                  :mayEdit="mayEdit"
88
+                  @UpdateValue="UpdateValue"
89
+                />
68
               </div>
90
               </div>
69
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
91
               <div v-if="propertyType === 'Commercial'" class="col-md-4">
70
                 <label>Unit</label>
92
                 <label>Unit</label>
71
-                <propField :label="'Property Type'" :display="property.unit" :editType="'text'" />
93
+                <propField
94
+                  :label="'Property Type'"
95
+                  :display="property.unit"
96
+                  :editType="'text'"
97
+                  :propertyName="'unit'"
98
+                  :mayEdit="mayEdit"
99
+                  @UpdateValue="UpdateValue"
100
+                />
72
               </div>
101
               </div>
73
             </div>
102
             </div>
74
             <div class="form-group row">
103
             <div class="form-group row">
75
               <div class="col-md-6" style="margin-bottom: 1em">
104
               <div class="col-md-6" style="margin-bottom: 1em">
76
                 <label>Street Number</label>
105
                 <label>Street Number</label>
77
-                <propField :display="property.addressLine1" :editType="'text'" />
106
+                <propField
107
+                  :display="property.addressLine1"
108
+                  :editType="'text'"
109
+                  :propertyName="'addressLine1'"
110
+                  :mayEdit="mayEdit"
111
+                  @UpdateValue="UpdateValue"
112
+                />
78
               </div>
113
               </div>
79
               <div class="col-md-6" style="margin-bottom: 1em">
114
               <div class="col-md-6" style="margin-bottom: 1em">
80
                 <label>Street Name</label>
115
                 <label>Street Name</label>
81
-                <propField :display="property.addressLine2" :editType="'text'" />
116
+                <propField
117
+                  :display="property.addressLine2"
118
+                  :editType="'text'"
119
+                  :propertyName="'addressLine2'"
120
+                  :mayEdit="mayEdit"
121
+                  @UpdateValue="UpdateValue"
122
+                />
82
               </div>
123
               </div>
83
               <div class="col-md-6" style="margin-bottom: 1em">
124
               <div class="col-md-6" style="margin-bottom: 1em">
84
                 <label>Province</label>
125
                 <label>Province</label>
85
-                <propField :display="property.province.description" :editType="'selector'" />
126
+                <propField
127
+                  :display="property.province ? property.province.description : ''"
128
+                  :editType="'selector'"
129
+                  :arrayObject="provinces"
130
+                  :propertyName="'province'"
131
+                  :mayEdit="mayEdit"
132
+                  @UpdateValue="UpdateValue"
133
+                />
86
               </div>
134
               </div>
87
 
135
 
88
               <div class="col-md-6" style="margin-bottom: 1em">
136
               <div class="col-md-6" style="margin-bottom: 1em">
89
                 <label>City</label>
137
                 <label>City</label>
90
-                <propField :display="property.city.description" :editType="'selector'" />
138
+                <propField
139
+                  :display="property.city ? property.city.description : ''"
140
+                  :editType="'selector'"
141
+                  :arrayObject="cities"
142
+                  :propertyName="'city'"
143
+                  :mayEdit="mayEdit"
144
+                  @UpdateValue="UpdateValue"
145
+                />
91
               </div>
146
               </div>
92
               <div class="col-md-6" style="margin-bottom: 1em">
147
               <div class="col-md-6" style="margin-bottom: 1em">
93
                 <label>Suburb</label>
148
                 <label>Suburb</label>
94
-                <propField :display="property.suburb.description" :editType="'selector'" />
149
+                <propField
150
+                  :display="property.suburb ? property.suburb.description : ''"
151
+                  :editType="'selector'"
152
+                  :arrayObject="suburbs"
153
+                  :propertyName="'suburb'"
154
+                  :mayEdit="mayEdit"
155
+                  @UpdateValue="UpdateValue"
156
+                />
95
               </div>
157
               </div>
96
               <div class="col-md-6" style="margin-bottom: 1em">
158
               <div class="col-md-6" style="margin-bottom: 1em">
97
                 <label>Postal Code</label>
159
                 <label>Postal Code</label>
98
-                <propField :display="property.addressLine3" :editType="'text'" />
160
+                <propField
161
+                  :display="property.addressLine3"
162
+                  :editType="'text'"
163
+                  :propertyName="'addressLine3'"
164
+                  :mayEdit="mayEdit"
165
+                  @UpdateValue="UpdateValue"
166
+                />
99
               </div>
167
               </div>
100
             </div>
168
             </div>
101
 
169
 
103
               <div class="col-md-6">
171
               <div class="col-md-6">
104
                 <label v-if="salesType === 'Rental'">Rental Price</label>
172
                 <label v-if="salesType === 'Rental'">Rental Price</label>
105
                 <label v-if="salesType !== 'Rental'">Sales Price</label>
173
                 <label v-if="salesType !== 'Rental'">Sales Price</label>
106
-                <propField :display="property.price" :editType="'number'" />
174
+                <propField
175
+                  :display="String(property.price)"
176
+                  :editType="'number'"
177
+                  :propertyName="'price'"
178
+                  :mayEdit="mayEdit"
179
+                  @UpdateValue="UpdateValue"
180
+                />
107
               </div>
181
               </div>
108
               <div class="col-md-6" v-if="salesType === 'Rental'">
182
               <div class="col-md-6" v-if="salesType === 'Rental'">
109
                 <label>Per</label>
183
                 <label>Per</label>
110
-                <propField :display="property.pricePer" :editType="'text'" />
184
+                <propField
185
+                  :display="property.pricePer"
186
+                  :editType="'selector'"
187
+                  :propertyName="'pricePer'"
188
+                  :arrayObject="pricePerArr"
189
+                  :mayEdit="mayEdit"
190
+                  @UpdateValue="UpdateValue"
191
+                />
111
               </div>
192
               </div>
112
             </div>
193
             </div>
113
             <div class="form-group row">
194
             <div class="form-group row">
123
               class="col-md-6"
204
               class="col-md-6"
124
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
205
               v-if="propertyType === 'Residential' & propertyOverviewFields.length > 0"
125
             >
206
             >
126
-              <div v-for="item in propertyOverviewFields[0].fields" :key="item.id">
207
+              <div v-for="(item, i) in propertyOverviewFields[0].fields" :key="item.id">
127
                 <label>{{ item.name }}</label>
208
                 <label>{{ item.name }}</label>
128
-                <propField :display="item.value" :editType="item.type" />
209
+                <propField
210
+                  :display="item.value"
211
+                  :editType="item.type"
212
+                  :propertyId="item.itemID"
213
+                  :userDefinedId="item.id"
214
+                  :isUDF="Boolean('true')"
215
+                  :isPropOverview="Boolean('true')"
216
+                  :mayEdit="mayEdit"
217
+                  :arrayIndex="i"
218
+                  @UpdateValue="UpdateValue"
219
+                />
129
               </div>
220
               </div>
130
             </div>
221
             </div>
131
 
222
 
132
             <div class="form-group row" />
223
             <div class="form-group row" />
133
-            <div v-for="group in propertyFields" :key="group.id">
224
+            <div v-for="(group, i) in propertyFields" :key="group.id">
134
               <div class="row">
225
               <div class="row">
135
                 <div class="col-sm-12">
226
                 <div class="col-sm-12">
136
                   <div class="title-box-d">
227
                   <div class="title-box-d">
138
                   </div>
229
                   </div>
139
                 </div>
230
                 </div>
140
               </div>
231
               </div>
141
-              <div v-for="field in group.fields" :key="field.id">
232
+              <div v-for="(field, ii) in group.fields" :key="field.id">
142
                 <label>{{ field.name }}</label>
233
                 <label>{{ field.name }}</label>
143
-                <propField :display="field.value" :editType="field.type" />
234
+                <propField
235
+                  :display="field.value"
236
+                  :editType="field.type"
237
+                  :propertyId="field.itemID"
238
+                  :userDefinedId="field.id"
239
+                  :isUDF="Boolean('true')"
240
+                  :arrayIndex="i"
241
+                  :arrayItemIndex="ii"
242
+                  :mayEdit="mayEdit"
243
+                  @UpdateValue="UpdateValue"
244
+                />
144
               </div>
245
               </div>
145
-              <!-- <UserField
146
-                :fields="item.fields"
147
-                :id="item.name"
148
-                @UpdateUserDefinedFields="UpdateUserDefinedFields"
149
-                :fieldValues="item.fields"
150
-              />-->
151
             </div>
246
             </div>
152
             <div class="form-group row" />
247
             <div class="form-group row" />
153
             <div class="row">
248
             <div class="row">
160
             <div class="form-group row">
255
             <div class="form-group row">
161
               <div class="col-md-12">
256
               <div class="col-md-12">
162
                 <label>Virtual Tour (URL)</label>
257
                 <label>Virtual Tour (URL)</label>
163
-                <propField :display="property.virtualTour" :editType="'text'" />
258
+                <propField
259
+                  :display="property.virtualTour"
260
+                  :editType="'text'"
261
+                  :propertyName="'virtualTour'"
262
+                  :mayEdit="mayEdit"
263
+                  @UpdateValue="UpdateValue"
264
+                />
164
               </div>
265
               </div>
165
             </div>
266
             </div>
166
             <div class="form-group row">
267
             <div class="form-group row">
167
               <div class="col-md-12">
268
               <div class="col-md-12">
168
                 <label>Video (URL)</label>
269
                 <label>Video (URL)</label>
169
-                <propField :display="property.video" :editType="'text'" />
270
+                <propField
271
+                  :display="property.video"
272
+                  :editType="'text'"
273
+                  :propertyName="'video'"
274
+                  :mayEdit="mayEdit"
275
+                  @UpdateValue="UpdateValue"
276
+                />
170
               </div>
277
               </div>
171
             </div>
278
             </div>
172
             <div class="form-group row">
279
             <div class="form-group row">
176
               </div>
283
               </div>
177
             </div>
284
             </div>
178
             <div class="form-group row">
285
             <div class="form-group row">
179
-              <div class="col-md-6" v-for="(img, i) in propertyImages" :key="i">
180
-                <img :src="img" style="height:200px; width:150px; object-fit: cover;" />
286
+              <div class="col-md-2" v-for="(img, i) in propertyImages" :key="i">
287
+                <input
288
+                  v-if="mayEdit"
289
+                  type="checkbox"
290
+                  id="checkbox"
291
+                  v-model="img.isDefault"
292
+                  :disabled="img.isDeleted"
293
+                />
294
+                <label v-if="mayEdit" for="checkbox" style="margin: 10px;">Main Image</label>
295
+                <br />
296
+                <img
297
+                  :src="img.image"
298
+                  style="height:200px; width:150px; object-fit: cover;"
299
+                  :class="[img.isDeleted ? 'opacity' : '']"
300
+                />
301
+                <span
302
+                  v-if="!img.isDeleted && mayEdit"
303
+                  class="input-group-text"
304
+                  align="center"
305
+                  @click="DeleteImage(img)"
306
+                >
307
+                  <eva-icon name="trash-2-outline" fill="#60CBEB"></eva-icon>Delete
308
+                </span>
181
               </div>
309
               </div>
182
             </div>
310
             </div>
183
-            <ImageLoad :loadedImages="loadedImages" @DefaultImage="UpdateDefaultImage" />
311
+
312
+            <ImageLoad
313
+              :loadedImages="loadedImages"
314
+              @DefaultImage="UpdateDefaultImage"
315
+              :mayEdit="mayEdit"
316
+            />
184
             <button
317
             <button
185
               v-if="!wait"
318
               v-if="!wait"
186
               type="button"
319
               type="button"
187
               @click="SubmitData()"
320
               @click="SubmitData()"
188
               class="btn btn-b-n"
321
               class="btn btn-b-n"
189
               style="width: 85px; height:40px;"
322
               style="width: 85px; height:40px;"
323
+              :disabled="!mayEdit"
190
             >Save</button>
324
             >Save</button>
191
             <button
325
             <button
192
-              v-if="isEdit"
193
               type="button"
326
               type="button"
194
               @click="Close()"
327
               @click="Close()"
195
               class="btn btn-b-n"
328
               class="btn btn-b-n"
221
     return {
354
     return {
222
       propertyType: 'Residential',
355
       propertyType: 'Residential',
223
       salesType: 'Rental',
356
       salesType: 'Rental',
224
-      selectedProvince: '',
225
-      selectedCity: '',
226
       images: [],
357
       images: [],
227
       propertyFieldValues: [],
358
       propertyFieldValues: [],
228
       defaultImage: 0,
359
       defaultImage: 0,
240
         [{ script: 'sub' }, { script: 'super' }],
371
         [{ script: 'sub' }, { script: 'super' }],
241
         [{ indent: '-1' }, { indent: '+1' }],
372
         [{ indent: '-1' }, { indent: '+1' }],
242
       ],
373
       ],
243
-      isEdit: false,
374
+      salesTypeArr: [
375
+        { id: 1, description: 'Sale' },
376
+        { id: 2, description: 'Rental' },
377
+      ],
378
+      pricePerArr: [
379
+        { id: 'Month', description: 'Month' },
380
+        { id: 'Day', description: 'Day' },
381
+      ],
244
     };
382
     };
245
   },
383
   },
246
   methods: {
384
   methods: {
247
-    ...mapActions('searchTab', ['getProvince', 'getCities', 'getSuburbs']),
248
-    ...mapActions('property', [
249
-      'getPropertyTypes',
250
-      'getPropertyOverviewFields',
251
-      'getPropertyFields',
252
-      'saveProperty',
253
-      'getProperty',
254
-      'getPropertyImages',
255
-      'clearProperty',
256
-      'clearPropertyImages',
257
-      'getPropertyEditDisplay',
258
-      'getPropertySavedOverviewFields',
259
-      'getPropertySavedFields',
385
+    ...mapActions('searchTab', [
386
+      'getProvince',
387
+      'getCities',
388
+      'getSuburbs',
389
+      'getListsForPropertyEdit',
390
+    ]),
391
+    ...mapActions('property', ['getPropertyTypes']),
392
+    ...mapActions('propertyEdit', [
260
       'getSavedPropertyData',
393
       'getSavedPropertyData',
394
+      'updateProperty',
395
+      'mayEditProperty',
261
     ]),
396
     ]),
397
+    UpdateValue(item) {
398
+      if (item.isUDF) {
399
+        if (item.isPropOverview) {
400
+          this.propertyOverviewFields[0].fields[item.arrayIndex].value =            item.value;
401
+        } else if (item.isPropOverview === false) {
402
+          this.propertyFields[item.arrayIndex].fields[
403
+            item.arrayItemIndex
404
+          ].value = item.value;
405
+        }
406
+      } else if (!item.isUDF) {
407
+        if (item.fieldName) {
408
+          if (item.fieldName === 'isSale') {
409
+            let isSaleValue = false;
410
+            if (item.value === 'Sale') {
411
+              isSaleValue = true;
412
+            } else isSaleValue = false;
413
+            this.property.isSale = isSaleValue;
414
+          }
415
+          if (item.fieldName === 'propertyType') {
416
+            this.property.propertyType = this.propertyTypes.find(
417
+              pt => pt.description === item.value,
418
+            );
419
+            this.property.propertyTypeId = this.property.propertyType.id;
420
+          }
421
+          if (item.fieldName === 'propertyName') {
422
+            this.property.propertyName = item.value;
423
+          }
424
+          if (item.fieldName === 'unit') {
425
+            this.property.unit = item.value;
426
+          }
427
+          if (item.fieldName === 'addressLine1') {
428
+            this.property.addressLine1 = item.value;
429
+          }
430
+          if (item.fieldName === 'addressLine2') {
431
+            this.property.addressLine2 = item.value;
432
+          }
433
+          if (item.fieldName === 'addressLine3') {
434
+            this.property.addressLine3 = item.value;
435
+          }
436
+          if (item.fieldName === 'province') {
437
+            if (item.value !== '') {
438
+              this.property.province = this.provinces.find(
439
+                p => p.description === item.value,
440
+              );
441
+              this.property.provinceId = this.property.province.id;
442
+              this.getCities(Object.assign({}, { province: item.value }));
443
+              this.property.city = null;
444
+              this.property.suburb = null;
445
+              this.property.addressLine3 = '';
446
+            } else {
447
+              this.property.province = null;
448
+              this.property.city = null;
449
+              this.property.suburb = null;
450
+              this.property.addressLine3 = '';
451
+              this.cities = [];
452
+              this.suburbs = [];
453
+            }
454
+          }
455
+          if (item.fieldName === 'city') {
456
+            if (item.value !== '') {
457
+              const newCity = this.cities.find(
458
+                p => p.description === item.value,
459
+              );
460
+              this.property.city = newCity;
461
+              this.property.cityId = newCity.id;
462
+              this.getSuburbs(
463
+                Object.assign(
464
+                  {},
465
+                  {
466
+                    province: this.property.province.description,
467
+                    city: item.value,
468
+                  },
469
+                ),
470
+              );
471
+              this.property.suburb = null;
472
+              this.property.addressLine3 = '';
473
+            } else {
474
+              this.property.city = null;
475
+              this.property.suburb = null;
476
+              this.property.addressLine3 = '';
477
+              this.suburbs = [];
478
+            }
479
+          }
480
+          if (item.fieldName === 'suburb') {
481
+            if (item.value !== '') {
482
+              const newSuburb = this.suburbs.find(
483
+                p => p.description === item.value,
484
+              );
485
+              this.property.suburb = newSuburb;
486
+              this.property.suburbId = newSuburb.id;
487
+              this.property.addressLine3 = this.property.suburb.postalCode;
488
+            } else {
489
+              this.property.suburb = null;
490
+              this.property.addressLine3 = '';
491
+            }
492
+          }
493
+          if (item.fieldName === 'price') {
494
+            this.property.price = item.value;
495
+          }
496
+          if (item.fieldName === 'pricePer') {
497
+            this.property.pricePer = item.value;
498
+          }
499
+          if (item.fieldName === 'virtualTour') {
500
+            this.property.virtualTour = item.value;
501
+          }
502
+          if (item.fieldName === 'video') {
503
+            this.property.video = item.value;
504
+          }
505
+        }
506
+      }
507
+    },
262
     TypeChanged() {
508
     TypeChanged() {
263
       this.propertyType = this.property.propertyUsageType;
509
       this.propertyType = this.property.propertyUsageType;
264
     },
510
     },
265
     SubmitData() {
511
     SubmitData() {
266
       this.wait = true;
512
       this.wait = true;
267
-      if (this.salesType === 'Sale') {
268
-        this.property.isSale = true;
269
-      }
513
+
514
+      this.newPropertyImages.propertyId = this.property.id;
515
+      this.newPropertyImages.Images = [];
270
       // eslint-disable-next-line no-plusplus
516
       // eslint-disable-next-line no-plusplus
271
       for (let i = 0; i < this.images.length; i++) {
517
       for (let i = 0; i < this.images.length; i++) {
272
         let setAsDefault = false;
518
         let setAsDefault = false;
273
         if (i === this.defaultImage) {
519
         if (i === this.defaultImage) {
274
           setAsDefault = true;
520
           setAsDefault = true;
275
         }
521
         }
276
-        this.property.propertyImages.push({
522
+        this.newPropertyImages.images.push({
277
           image: this.images[i],
523
           image: this.images[i],
278
           isDefault: setAsDefault,
524
           isDefault: setAsDefault,
279
         });
525
         });
280
       }
526
       }
281
-      this.property.propertyUserFields = this.propertyFieldValues;
282
 
527
 
283
-      if (this.property.id === 0) {
284
-        this.property.userId = this.user.id;
285
-        this.saveProperty(this.property);
286
-        setTimeout(
287
-          () => this.$router.push({
288
-              path: '/property/Search',
289
-              query: {
290
-                salesType: this.salesType,
291
-                propertyUsageType: this.propertyType,
292
-              },
293
-            }),
294
-          3000,
295
-        );
296
-      } else {
297
-        setTimeout(() => this.$router.push('/property/admin/list/my'), 3000);
528
+      this.property.propertyImages = this.propertyImages;
529
+      // eslint-disable-next-line no-plusplus
530
+      for (let i = 0; i < this.property.propertyImages.length; i++) {
531
+        this.property.propertyImages[i].image = '';
298
       }
532
       }
533
+      this.property.propertyOverviewFields = this.propertyOverviewFields;
534
+      this.property.propertyFields = this.propertyFields;
535
+      this.updateProperty({
536
+        property: this.property,
537
+        images: this.newPropertyImages,
538
+      });
539
+
540
+      // console.log(JSON.stringify(this.newPropertyImages));
541
+
542
+      // Need to change to promis.
543
+      setTimeout(
544
+        () => this.$router.push({
545
+            path: '/property/admin/list/my',
546
+          }),
547
+        5000,
548
+      );
299
     },
549
     },
300
     Close() {
550
     Close() {
301
       this.$router.push('/property/admin/list/my');
551
       this.$router.push('/property/admin/list/my');
302
     },
552
     },
303
-    ProvinceSelected(item) {
304
-      if (item.target.options.selectedIndex > 0) {
305
-        this.selectedProvince = this.provinces[
306
-          item.target.options.selectedIndex - 1
307
-        ].description;
308
-        this.getCities(Object.assign({}, { province: this.selectedProvince }));
309
-      }
310
-    },
311
-    CitySelected(item) {
312
-      if (item.target.options.selectedIndex > 0) {
313
-        this.selectedCity = this.cities[
314
-          item.target.options.selectedIndex - 1
315
-        ].description;
316
-        this.getSuburbs(
317
-          Object.assign(
318
-            {},
319
-            { province: this.selectedProvince, city: this.selectedCity },
320
-          ),
321
-        );
322
-      }
323
-    },
324
-    getPostalCode(item) {
325
-      this.property.addressLine3 = this.suburbs[
326
-        item.target.options.selectedIndex - 1
327
-      ].postalCode;
328
-    },
329
     loadedImages(values) {
553
     loadedImages(values) {
330
       this.images = values;
554
       this.images = values;
331
     },
555
     },
332
-    UpdateUserDefinedFields(item) {
333
-      let update = false;
334
-      this.propertyFieldValues.forEach((element) => {
335
-        if (element.userDefinedFieldId === item.userDefinedFieldId) {
336
-          element.value = item.value;
337
-          update = true;
338
-        }
339
-      });
340
-      if (!update) {
341
-        this.propertyFieldValues.push(item);
342
-      }
343
-    },
344
     UpdateDefaultImage(item) {
556
     UpdateDefaultImage(item) {
345
       this.defaultImage = item;
557
       this.defaultImage = item;
346
     },
558
     },
559
+    DeleteImage(image) {
560
+      this.propertyImages.find(item => item.id === image.id).isDeleted = true;
561
+    },
347
   },
562
   },
348
   mounted() {
563
   mounted() {
564
+    // Need to check this can remove unused code
349
     this.wait = false;
565
     this.wait = false;
350
-    this.clearProperty();
351
-    this.clearPropertyImages();
352
     this.images = [];
566
     this.images = [];
353
     this.defaultImage = 0;
567
     this.defaultImage = 0;
354
 
568
 
369
 
583
 
370
     this.getPropertyTypes(this.propertyType);
584
     this.getPropertyTypes(this.propertyType);
371
 
585
 
372
-    this.getProvince();
373
-    if (this.$route.query.id) {
374
-      this.getSavedPropertyData(
375
-        Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
376
-      );
377
-      this.isEdit = true;
378
-    } else {
379
-      this.getPropertyOverviewFields();
380
-      this.getPropertyFields(this.propertyType);
381
-    }
586
+    this.getListsForPropertyEdit(this.$route.query.id);
587
+
588
+    this.getSavedPropertyData(
589
+      Object.assign({}, { id: this.$route.query.id, type: this.propertyType }),
590
+    );
591
+
592
+    this.mayEditProperty(this.$route.query.id);
382
   },
593
   },
383
   computed: {
594
   computed: {
384
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
595
     ...mapState('searchTab', ['provinces', 'cities', 'suburbs']),
385
-    ...mapState('property', [
386
-      'propertyTypes',
596
+    ...mapState('property', ['propertyTypes']),
597
+    ...mapState('propertyEdit', [
387
       'propertyOverviewFields',
598
       'propertyOverviewFields',
388
       'propertyFields',
599
       'propertyFields',
389
       'property',
600
       'property',
390
       'propertyImages',
601
       'propertyImages',
602
+      'mayEdit',
603
+      'newPropertyImages',
391
     ]),
604
     ]),
392
     ...mapState('authentication', ['user']),
605
     ...mapState('authentication', ['user']),
393
     SalesTypeChanged() {
606
     SalesTypeChanged() {
394
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
395
-      // this.propertyType = this.$route.params.propType;
396
-      // eslint-disable-next-line vue/no-side-effects-in-computed-properties
397
-      this.salesType = this.$route.params.saleType;
398
       if (this.property && this.property.propertyUsageType) {
607
       if (this.property && this.property.propertyUsageType) {
399
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
608
         // eslint-disable-next-line vue/no-side-effects-in-computed-properties
400
         this.propertyType = this.property.propertyUsageType;
609
         this.propertyType = this.property.propertyUsageType;
401
-      }
402
-
403
-      if (!this.$route.query.id) {
404
-        this.getPropertyFields(this.propertyType);
610
+        // eslint-disable-next-line vue/no-side-effects-in-computed-properties
611
+        this.salesType = this.property.isSale ? 'Sale' : 'Rental';
405
       }
612
       }
406
 
613
 
407
       this.getPropertyTypes(this.propertyType);
614
       this.getPropertyTypes(this.propertyType);
416
   },
623
   },
417
 };
624
 };
418
 </script>
625
 </script>
626
+
627
+<style>
628
+span {
629
+  cursor: pointer;
630
+}
631
+.opacity {
632
+  opacity: 0.5;
633
+  filter: alpha(opacity=50);
634
+}
635
+</style>

+ 11
- 11
src/components/shared/alert.vue View File

1
 <template>
1
 <template>
2
   <div class="container">
2
   <div class="container">
3
     <!-- eslint-disable max-len -->
3
     <!-- eslint-disable max-len -->
4
-    <div class="alert alert-success" v-if="type === 'SUCCESS'">
5
-      <eva-icon name="checkmark-outline"></eva-icon>
6
-      <strong>{{ text }}</strong>
4
+    <div class="alert mySuccess" v-if="type === 'SUCCESS'">
5
+      <eva-icon name="checkmark-outline" style="margin: 0px 20px"></eva-icon>
6
+      <strong class="color-black">{{ text }}</strong>
7
     </div>
7
     </div>
8
-    <div class="alert alert-info" v-if="type === 'INFO'">
9
-      <eva-icon name="info-outline"></eva-icon>
10
-      <strong>{{ text }}</strong>
8
+    <div class="alert myInfo" v-if="type === 'INFO'">
9
+      <eva-icon name="info-outline" style="margin: 0px 20px"></eva-icon>
10
+      <strong class="color-black">{{ text }}</strong>
11
     </div>
11
     </div>
12
-    <div class="alert alert-warning" v-if="type === 'WARNING'">
13
-      <eva-icon name="alert-circle-outline"></eva-icon>
12
+    <div class="alert myWarning" v-if="type === 'WARNING'">
13
+      <eva-icon name="alert-circle-outline" style="margin: 0px 20px"></eva-icon>
14
       <strong class="color-black">{{ text }}</strong>
14
       <strong class="color-black">{{ text }}</strong>
15
     </div>
15
     </div>
16
-    <div class="alert alert-danger" v-if="type === 'ERROR'">
17
-      <eva-icon name="slash-outline"></eva-icon>
18
-      <strong>{{ text }}</strong>
16
+    <div class="alert myError" v-if="type === 'ERROR'">
17
+      <eva-icon name="slash-outline" style="margin: 0px 20px"></eva-icon>
18
+      <strong class="color-black">{{ text }}</strong>
19
     </div>
19
     </div>
20
   </div>
20
   </div>
21
 </template>
21
 </template>

+ 43
- 8
src/components/shared/listView.vue View File

2
 /* eslint-disable guard-for-in */
2
 /* eslint-disable guard-for-in */
3
 <template>
3
 <template>
4
   <div>
4
   <div>
5
-    <div class="container">
6
-      <div class="d-flex justify-content-between" v-if="!hideSearch">
7
-        <div class="p-2">
8
-          <input v-model="searchItem" class="form-control" placeholder="Search ..." />
9
-        </div>
5
+    <div class="d-flex justify-content-between" v-if="!hideSearch">
6
+      <div class="p-2">
7
+        <input v-model="searchItem" class="form-control" placeholder="Search ..." />
10
       </div>
8
       </div>
11
     </div>
9
     </div>
12
     <table id="table" class="table table-bordered table-hover">
10
     <table id="table" class="table table-bordered table-hover">
15
           <th v-for="(column, c) in Columns" :key="c">
13
           <th v-for="(column, c) in Columns" :key="c">
16
             <div @click="sortBy(column)">{{ column }}</div>
14
             <div @click="sortBy(column)">{{ column }}</div>
17
           </th>
15
           </th>
16
+          <th v-if="editable"></th>
17
+          <th v-if="deleteable"></th>
18
         </tr>
18
         </tr>
19
       </thead>
19
       </thead>
20
       <tbody>
20
       <tbody>
24
           class="text-left dnd-moved"
24
           class="text-left dnd-moved"
25
           @click="onRowClick(item)"
25
           @click="onRowClick(item)"
26
         >
26
         >
27
-          <td v-for="(column, c) in Columns" :key="c">{{ item[column] }}</td>
27
+          <td
28
+            v-for="(column, c) in Columns"
29
+            :key="c"
30
+          >{{ isObject(item[column]) ? item[column].display : item[column] }}</td>
31
+          <td v-if="editable" class="my-width">
32
+            <button type="button" class="btn my-btn" @click="onEdit(item)">Edit</button>
33
+          </td>
34
+          <td v-if="deleteable" class="my-width">
35
+            <button type="button" class="btn my-btn" @click="onDelete(item)">Delete</button>
36
+          </td>
28
         </tr>
37
         </tr>
29
       </tbody>
38
       </tbody>
30
     </table>
39
     </table>
81
       default: false,
90
       default: false,
82
     },
91
     },
83
     items: undefined,
92
     items: undefined,
93
+    editable: {
94
+      default: false,
95
+    },
96
+    deleteable: {
97
+      default: false,
98
+    },
99
+    columnsCount: {
100
+      default: 6,
101
+    },
84
   },
102
   },
85
   data() {
103
   data() {
86
     return {
104
     return {
94
     };
112
     };
95
   },
113
   },
96
   methods: {
114
   methods: {
115
+    isObject(item) {
116
+      return !!item && item.constructor === Object;
117
+    },
118
+    onEdit(item) {
119
+      this.$emit('onEdit', item);
120
+    },
121
+    onDelete(item) {
122
+      this.$emit('onDelete', item);
123
+    },
97
     onRowClick(item) {
124
     onRowClick(item) {
98
       this.$emit('onRowClick', item);
125
       this.$emit('onRowClick', item);
99
     },
126
     },
158
               !list.includes(Object.keys(item)[o])
185
               !list.includes(Object.keys(item)[o])
159
               && !Array.isArray(Object.values(item)[o])
186
               && !Array.isArray(Object.values(item)[o])
160
             ) {
187
             ) {
161
-              list.push(Object.keys(item)[o]);
188
+              if (list.length < this.columnsCount) {
189
+                list.push(Object.keys(item)[o]);
190
+              }
162
             }
191
             }
163
           }
192
           }
164
         }
193
         }
169
       const list = _.filter(this.items, item => Object.values(item).some(
198
       const list = _.filter(this.items, item => Object.values(item).some(
170
           i => JSON.stringify(i)
199
           i => JSON.stringify(i)
171
               .toLowerCase()
200
               .toLowerCase()
172
-              .indexOf(this.searchItem) > -1,
201
+              .indexOf(this.searchItem.toLowerCase()) > -1,
173
         ),);
202
         ),);
174
       return _.orderBy(list, this.sortKey, this.SortDirection);
203
       return _.orderBy(list, this.sortKey, this.SortDirection);
175
     },
204
     },
196
   text-decoration: none;
225
   text-decoration: none;
197
   color: #333333;
226
   color: #333333;
198
 }
227
 }
228
+.table > tbody > tr > td {
229
+  vertical-align: middle;
230
+}
231
+.my-width {
232
+  width: 20px;
233
+}
199
 .drag {
234
 .drag {
200
   background-color: rgba(0, 255, 0, 0.35);
235
   background-color: rgba(0, 255, 0, 0.35);
201
   opacity: 0.25;
236
   opacity: 0.25;

+ 2
- 1
src/components/shared/navBar.vue View File

63
                   <a
63
                   <a
64
                     v-if="isLoggedIn"
64
                     v-if="isLoggedIn"
65
                     class="dropdown-item cursor-pointer"
65
                     class="dropdown-item cursor-pointer"
66
-                    @click="routerGoTo('/timeshare/sell')"
66
+                    @click="routerGoTo('/timeshare/myWeeks')"
67
                   >My Timeshare Weeks</a>
67
                   >My Timeshare Weeks</a>
68
                 </div>
68
                 </div>
69
               </div>
69
               </div>
165
                   @click="routerGoTo('/searchLog')"
165
                   @click="routerGoTo('/searchLog')"
166
                 >Search Logs</a>
166
                 >Search Logs</a>
167
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
167
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
168
+                <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Carousel')">Carousel</a>
168
               </div>
169
               </div>
169
             </li>
170
             </li>
170
             <li class="nav-item dropdown" v-if="!isLoggedIn">
171
             <li class="nav-item dropdown" v-if="!isLoggedIn">

+ 1
- 1
src/components/shared/searchTab.vue View File

143
     },
143
     },
144
     Search() {
144
     Search() {
145
       if (this.selectedPropertyType === 'timeshare') {
145
       if (this.selectedPropertyType === 'timeshare') {
146
-        this.$router.push('/timeshare/search/');
146
+        this.$router.push('/timesharesearch');
147
       } else {
147
       } else {
148
         // this.$router.push('/property/search');
148
         // this.$router.push('/property/search');
149
         this.$router.push({
149
         this.$router.push({

+ 2
- 3
src/components/timeshare/buy/buyPage.vue View File

120
     };
120
     };
121
   },
121
   },
122
   mounted() {
122
   mounted() {
123
-    console.log(4);
124
     this.init();
123
     this.init();
125
   },
124
   },
126
   computed: {
125
   computed: {
127
-    ...mapState('timeshareBuy', ['detailedRegion', 'resort', 'availRegion']),
126
+    ...mapState('region', ['detailedRegion', 'resort', 'availRegion']),
128
     mapUrl() {
127
     mapUrl() {
129
       return `http://maps.google.com/maps?q=${this.myMap}&z=${this.myZoom}&output=embed`;
128
       return `http://maps.google.com/maps?q=${this.myMap}&z=${this.myZoom}&output=embed`;
130
     },
129
     },
133
     },
132
     },
134
   },
133
   },
135
   methods: {
134
   methods: {
136
-    ...mapActions('timeshareBuy', [
135
+    ...mapActions('region', [
137
       'init',
136
       'init',
138
       'getAvail',
137
       'getAvail',
139
       'getRegions',
138
       'getRegions',

+ 2
- 1
src/components/timeshare/buy/weekListComponent.vue View File

62
 export default {
62
 export default {
63
   props: {
63
   props: {
64
     resortCode: undefined,
64
     resortCode: undefined,
65
+    userId: undefined,
65
   },
66
   },
66
   components: {},
67
   components: {},
67
   computed: {
68
   computed: {
79
   },
80
   },
80
   methods: {
81
   methods: {
81
     View(item) {
82
     View(item) {
82
-      this.$router.push(`/resort/${item.resort.resortCode}/${item.id}`);
83
+      this.$router.push(`/resort/${item.resort.resortCode}/${item.unitNumber}`);
83
     },
84
     },
84
     ...mapActions('weekList', ['getWeeks', 'applyResortFilter']),
85
     ...mapActions('weekList', ['getWeeks', 'applyResortFilter']),
85
   },
86
   },

+ 25
- 10
src/components/timeshare/myWeeksPage.vue View File

4
     <br />
4
     <br />
5
     <br />
5
     <br />
6
     <br />
6
     <br />
7
-    <img
8
-      src="http://www.provision-sa.com:3000/Provision/UnivateProperties/src/branch/master/public/img/logos/UVProp.png"
9
-      height="200"
10
-      width="200"
11
-    />
12
-    {{getUser}}
13
     <br />
7
     <br />
8
+    <div class="row">
9
+      <div class="offset-1 col-md-10">
10
+        <ListView :items="items" :editable="true" @onEdit="onEdit" />
11
+      </div>
12
+    </div>
14
   </div>
13
   </div>
15
 </template>
14
 </template>
16
 <script>
15
 <script>
17
-import { mapState } from 'vuex';
16
+import { mapState, mapActions } from 'vuex';
18
 import log from '../../assets/Log';
17
 import log from '../../assets/Log';
18
+import ListView from '../shared/listView.vue';
19
 
19
 
20
 export default {
20
 export default {
21
+  components: {
22
+    ListView,
23
+  },
24
+  data() {
25
+    return {
26
+      user: JSON.parse(log.getUser()),
27
+    };
28
+  },
29
+  mounted() {
30
+    console.log(this.user.id);
31
+    this.getItems(this.user.id);
32
+  },
21
   computed: {
33
   computed: {
22
-    ...mapState('myWeeks', ['test']),
23
-    getUser() {
24
-      return log.getUser();
34
+    ...mapState('myWeeks', ['items']),
35
+  },
36
+  methods: {
37
+    ...mapActions('myWeeks', ['getItems']),
38
+    onEdit(item) {
39
+      this.$router.push(`/timeshare/${item.id}`);
25
     },
40
     },
26
   },
41
   },
27
 };
42
 };

+ 19
- 6
src/components/timeshare/resort/unitPage.vue View File

1
 <template>
1
 <template>
2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
   <div class="my-container my-top">
3
   <div class="my-container my-top">
4
+    <br />
5
+    <br />
4
     <div class="row">
6
     <div class="row">
5
       <div class="col-md-12 col-lg-8">
7
       <div class="col-md-12 col-lg-8">
6
         <div class="title-box-d">
8
         <div class="title-box-d">
7
-          <h1 class="title-d my-title">{{week ? week.resortName : ''}}</h1>
9
+          <h1 class="title-d my-title">{{week ? week.resort.resortName : ''}}</h1>
8
         </div>
10
         </div>
9
         <br />
11
         <br />
10
       </div>
12
       </div>
158
 </template>
160
 </template>
159
 
161
 
160
 <script>
162
 <script>
161
-import { mapState, mapActions } from 'vuex';
163
+import { mapState, mapActions, mapGetters } from 'vuex';
162
 import makeOffer from '../../processFlow/makeOffer.vue';
164
 import makeOffer from '../../processFlow/makeOffer.vue';
163
 import ResortImages from './resortImage.vue';
165
 import ResortImages from './resortImage.vue';
164
 
166
 
170
   },
172
   },
171
   props: {
173
   props: {
172
     resortCode: {},
174
     resortCode: {},
173
-    weekId: {},
175
+    unitNumber: {},
174
   },
176
   },
175
   mounted() {
177
   mounted() {
176
     this.initResort(this.resortCode);
178
     this.initResort(this.resortCode);
177
-    this.initWeek(this.weekId);
179
+    if (this.resortCode) {
180
+      this.applyResortFilter(this.resortCode);
181
+    }
182
+    this.getWeeks();
178
   },
183
   },
179
   computed: {
184
   computed: {
180
     ...mapState('resort', ['resort', 'description', 'images']),
185
     ...mapState('resort', ['resort', 'description', 'images']),
181
-    ...mapState('week', ['week']),
186
+
187
+    ...mapGetters({
188
+      weekById: 'weekList/weekById',
189
+    }),
190
+    week() {
191
+      return this.weekById(this.resortCode, this.unitNumber);
192
+    },
193
+    // ...mapState('week', ['currentWeek']),
182
   },
194
   },
183
   methods: {
195
   methods: {
196
+    ...mapActions('weekList', ['getWeeks', 'applyResortFilter']),
184
     ...mapActions('resort', ['initResort']),
197
     ...mapActions('resort', ['initResort']),
185
-    ...mapActions('week', ['initWeek']),
198
+    // ...mapActions('week', ['initWeek']),
186
     formatPrice(value) {
199
     formatPrice(value) {
187
       if (value) {
200
       if (value) {
188
         const val = (value / 1).toFixed(2);
201
         const val = (value / 1).toFixed(2);

+ 7
- 1
src/components/timeshare/sell/sellPage.vue View File

517
 
517
 
518
 export default {
518
 export default {
519
   name: 'TimeshareToSell',
519
   name: 'TimeshareToSell',
520
+  props: {
521
+    weekId: {
522
+      default: 0,
523
+    },
524
+  },
520
   components: {
525
   components: {
521
     DetailIndividual,
526
     DetailIndividual,
522
     BankDetails,
527
     BankDetails,
524
     Alert,
529
     Alert,
525
   },
530
   },
526
   created() {
531
   created() {
527
-    this.initTimeshare();
532
+    console.log(46);
533
+    this.initTimeshare(this.weekId);
528
   },
534
   },
529
   computed: {
535
   computed: {
530
     ...mapState('timeshare', [
536
     ...mapState('timeshare', [

+ 6
- 0
src/components/user/loginPage.vue View File

129
       } else this.troubleToggle = true;
129
       } else this.troubleToggle = true;
130
     },
130
     },
131
     Login() {
131
     Login() {
132
+      console.log(this.$store.state.authentication);
133
+
132
       this.login().then(() => {
134
       this.login().then(() => {
135
+        console.log('this');
136
+        console.log(this);
137
+        console.log(this.$store.state.authentication.status);
138
+
133
         if (this.$store.state.authentication.status === 'error') {
139
         if (this.$store.state.authentication.status === 'error') {
134
           this.$router.push('/user/login');
140
           this.$router.push('/user/login');
135
         } else {
141
         } else {

+ 220
- 203
src/router/index.js View File

48
 // import store from '../store';
48
 // import store from '../store';
49
 
49
 
50
 import TemplatePage from '../components/communication/templatePage.vue';
50
 import TemplatePage from '../components/communication/templatePage.vue';
51
+import CarouselList from '../components/admin/misc/carouselList.vue';
52
+import CarouselDetail from '../components/admin/misc/carousel.vue';
51
 
53
 
52
 Vue.use(Router);
54
 Vue.use(Router);
53
 
55
 
59
       y: 0,
61
       y: 0,
60
     };
62
     };
61
   },
63
   },
62
-  routes: [
63
-    {
64
-      path: '/',
65
-      name: 'Home',
66
-      component: HomePage,
67
-    },
68
-    {
69
-      path: '/about/us',
70
-      name: 'aboutus',
71
-      component: AboutUs,
72
-    },
73
-    {
74
-      path: '/about/timeshare',
75
-      name: 'abouttimeshare',
76
-      component: AboutTimeshare,
77
-    },
78
-    {
79
-      path: '/communication/template',
80
-      name: 'template',
81
-      component: TemplatePage,
82
-    },
83
-    {
84
-      path: '/timeshare/sell',
85
-      name: 'TimeshareSell',
86
-      component: TimeshareSell,
87
-    },
88
-    {
89
-      path: '/timeshare/buy',
90
-      name: 'TimeshareBuy',
91
-      component: TimeshareBuy,
92
-    },
93
-    {
94
-      path: '/timeshare/faq',
95
-      name: 'TimeshareFAQ',
96
-      component: TimeshareFAQ,
97
-    },
98
-    {
99
-      path: '/timeshare/myWeeks',
100
-      name: 'MyWeeks',
101
-      component: MyWeeksPage,
102
-    },
103
-    {
104
-      path: '/user/login',
105
-      name: 'Login',
106
-      component: Login,
107
-    },
108
-    {
109
-      path: '/user/updateProfileInfo',
110
-      name: 'UpdateInfo',
111
-      component: UpdateInfo,
112
-    },
113
-    {
114
-      path: '/user/register',
115
-      name: 'PrivateIndividual',
116
-      component: PrivateIndividual,
117
-    },
118
-    {
119
-      path: '/user/registeragency',
120
-      name: 'Agency',
121
-      component: Agency,
122
-    },
123
-    {
124
-      path: '/property/property/:id',
125
-      name: 'PropertyPage',
126
-      component: PropertyPage,
127
-    },
128
-    {
129
-      path: '/property/:propertyUsageType/search',
130
-      name: 'PropertySearch',
131
-      component: PropertySearch,
132
-    },
133
-    {
134
-      path: '/property/search',
135
-      name: 'PropertySearchTab',
136
-      component: PropertySearch,
137
-    },
138
-    {
139
-      path: '/property/new/:saleType',
140
-      name: 'PropertyNew',
141
-      component: PropertyCreate,
142
-    },
143
-    {
144
-      path: '/property/new/:propertyUsageType/:saleType',
145
-      name: 'PropertyNewFromSearch',
146
-      component: PropertyCreate,
147
-    },
148
-    {
149
-      path: '/property/edit',
150
-      name: 'PropertyEdit',
151
-      component: PropertyEdit,
152
-    },
153
-    {
154
-      path: '/property/admin/list/:by',
155
-      name: 'PropertyListAdmin',
156
-      component: PropertyList,
157
-    },
158
-    {
159
-      path: '/propertyTypes/list',
160
-      name: 'PropertyTypeList',
161
-      component: PropertyTypeList,
162
-    },
163
-    {
164
-      path: '/propertyType/new',
165
-      name: 'PropertyTypeNew',
166
-      component: PropertyType,
167
-    },
168
-    {
169
-      path: '/propertyType/:id',
170
-      name: 'PropertyTypeEdit',
171
-      component: PropertyType,
172
-    },
173
-    {
174
-      path: '/userDefinedGroups/list',
175
-      name: 'UserDefinedGroupsList',
176
-      component: UserDefinedGroups,
177
-    },
178
-    {
179
-      path: '/userDefinedGroups/userDefinedGroup/:id',
180
-      name: 'UserDefinedGroupEdit',
181
-      component: UserDefinedGroup,
182
-    },
183
-    {
184
-      path: '/userDefinedGroups/userDefinedGroup',
185
-      name: 'UserDefinedGroupNew',
186
-      component: UserDefinedGroup,
187
-    },
188
-    {
189
-      path: '/status/list',
190
-      name: 'StatusList',
191
-      component: Status,
192
-    },
193
-    {
194
-      path: '/status/timeshareAdmin',
195
-      name: 'TimeshareAdmin',
196
-      component: timeshareAdminPage,
197
-    },
198
-    {
199
-      path: '/status/tenderWeekAdmin',
200
-      name: 'TenderWeekAdmin',
201
-      component: tenderWeekAdminPage,
202
-    },
203
-    {
204
-      path: '/status/userManagementPage',
205
-      name: 'userManagementPage',
206
-      component: userManagementPage,
207
-    },
208
-    {
209
-      path: '/status/agentUserManagementPage',
210
-      name: 'agentManagementPage',
211
-      component: agentManagementPage,
212
-    },
213
-    {
214
-      path: '/status/changeLogPage',
215
-      name: 'changeLogPage',
216
-      component: changeLogPage,
217
-    },
218
-    {
219
-      path: '/unitConfiguration/list',
220
-      name: 'UnitConfiguration',
221
-      component: UnitConfiguration,
222
-    },
223
-    {
224
-      path: '/contactus',
225
-      name: 'ContactUs',
226
-      component: ContactUs,
227
-    },
228
-    {
229
-      path: '/privacypolicy',
230
-      name: 'PrivacyPolicy',
231
-      component: PrivacyPolicy,
232
-    },
233
-    {
234
-      path: '/resort/:resortCode',
235
-      name: 'ResortPage',
236
-      component: ResortPage,
237
-      props: true,
238
-    },
239
-    {
240
-      path: '/resort/:resortCode/:weekId',
241
-      name: 'UnitPage',
242
-      component: UnitPage,
243
-      props: true,
244
-    },
245
-    {
246
-      path: '/MakeOffer',
247
-      name: 'MakeOffer',
248
-      component: MakeOffer,
249
-    },
250
-    {
251
-      path: '/Offers',
252
-      name: 'Offers',
253
-      component: Offer,
254
-    },
255
-    {
256
-      path: '/timeshare/search',
257
-      name: 'TimeshareSearch',
258
-      component: TimeshareSearch,
259
-    },
260
-    {
261
-      path: '/searchLog',
262
-      name: 'SearchLog',
263
-      component: searchLog,
264
-    },
64
+  routes: [{
65
+    path: '/',
66
+    name: 'Home',
67
+    component: HomePage,
68
+  },
69
+  {
70
+    path: '/about/us',
71
+    name: 'aboutus',
72
+    component: AboutUs,
73
+  },
74
+  {
75
+    path: '/about/timeshare',
76
+    name: 'abouttimeshare',
77
+    component: AboutTimeshare,
78
+  },
79
+  {
80
+    path: '/communication/template',
81
+    name: 'template',
82
+    component: TemplatePage,
83
+  },
84
+  {
85
+    path: '/timeshare/sell',
86
+    name: 'TimeshareSell',
87
+    component: TimeshareSell,
88
+  },
89
+  {
90
+    path: '/timeshare/buy',
91
+    name: 'TimeshareBuy',
92
+    component: TimeshareBuy,
93
+  },
94
+  {
95
+    path: '/timeshare/faq',
96
+    name: 'TimeshareFAQ',
97
+    component: TimeshareFAQ,
98
+  },
99
+  {
100
+    path: '/timeshare/myWeeks',
101
+    name: 'MyWeeks',
102
+    component: MyWeeksPage,
103
+  },
104
+  {
105
+    path: '/user/login',
106
+    name: 'Login',
107
+    component: Login,
108
+  },
109
+  {
110
+    path: '/user/updateProfileInfo',
111
+    name: 'UpdateInfo',
112
+    component: UpdateInfo,
113
+  },
114
+  {
115
+    path: '/user/register',
116
+    name: 'PrivateIndividual',
117
+    component: PrivateIndividual,
118
+  },
119
+  {
120
+    path: '/user/registeragency',
121
+    name: 'Agency',
122
+    component: Agency,
123
+  },
124
+  {
125
+    path: '/property/property/:id',
126
+    name: 'PropertyPage',
127
+    component: PropertyPage,
128
+  },
129
+  {
130
+    path: '/property/:propertyUsageType/search',
131
+    name: 'PropertySearch',
132
+    component: PropertySearch,
133
+  },
134
+  {
135
+    path: '/property/search',
136
+    name: 'PropertySearchTab',
137
+    component: PropertySearch,
138
+  },
139
+  {
140
+    path: '/property/new/:saleType',
141
+    name: 'PropertyNew',
142
+    component: PropertyCreate,
143
+  },
144
+  {
145
+    path: '/property/new/:propertyUsageType/:saleType',
146
+    name: 'PropertyNewFromSearch',
147
+    component: PropertyCreate,
148
+  },
149
+  {
150
+    path: '/property/edit',
151
+    name: 'PropertyEdit',
152
+    component: PropertyEdit,
153
+  },
154
+  {
155
+    path: '/property/admin/list/:by',
156
+    name: 'PropertyListAdmin',
157
+    component: PropertyList,
158
+  },
159
+  {
160
+    path: '/propertyTypes/list',
161
+    name: 'PropertyTypeList',
162
+    component: PropertyTypeList,
163
+  },
164
+  {
165
+    path: '/propertyType/new',
166
+    name: 'PropertyTypeNew',
167
+    component: PropertyType,
168
+  },
169
+  {
170
+    path: '/propertyType/:id',
171
+    name: 'PropertyTypeEdit',
172
+    component: PropertyType,
173
+  },
174
+  {
175
+    path: '/userDefinedGroups/list',
176
+    name: 'UserDefinedGroupsList',
177
+    component: UserDefinedGroups,
178
+  },
179
+  {
180
+    path: '/userDefinedGroups/userDefinedGroup/:id',
181
+    name: 'UserDefinedGroupEdit',
182
+    component: UserDefinedGroup,
183
+  },
184
+  {
185
+    path: '/userDefinedGroups/userDefinedGroup',
186
+    name: 'UserDefinedGroupNew',
187
+    component: UserDefinedGroup,
188
+  },
189
+  {
190
+    path: '/status/list',
191
+    name: 'StatusList',
192
+    component: Status,
193
+  },
194
+  {
195
+    path: '/status/timeshareAdmin',
196
+    name: 'TimeshareAdmin',
197
+    component: timeshareAdminPage,
198
+  },
199
+  {
200
+    path: '/status/tenderWeekAdmin',
201
+    name: 'TenderWeekAdmin',
202
+    component: tenderWeekAdminPage,
203
+  },
204
+  {
205
+    path: '/status/userManagementPage',
206
+    name: 'userManagementPage',
207
+    component: userManagementPage,
208
+  },
209
+  {
210
+    path: '/status/agentUserManagementPage',
211
+    name: 'agentManagementPage',
212
+    component: agentManagementPage,
213
+  },
214
+  {
215
+    path: '/status/changeLogPage',
216
+    name: 'changeLogPage',
217
+    component: changeLogPage,
218
+  },
219
+  {
220
+    path: '/unitConfiguration/list',
221
+    name: 'UnitConfiguration',
222
+    component: UnitConfiguration,
223
+  },
224
+  {
225
+    path: '/contactus',
226
+    name: 'ContactUs',
227
+    component: ContactUs,
228
+  },
229
+  {
230
+    path: '/privacypolicy',
231
+    name: 'PrivacyPolicy',
232
+    component: PrivacyPolicy,
233
+  },
234
+  {
235
+    path: '/resort/:resortCode',
236
+    name: 'ResortPage',
237
+    component: ResortPage,
238
+    props: true,
239
+  },
240
+  {
241
+    path: '/resort/:resortCode/:unitNumber',
242
+    name: 'UnitPage',
243
+    component: UnitPage,
244
+    props: true,
245
+  },
246
+  {
247
+    path: '/timeshare/:weekId',
248
+    name: 'TimeshareSell',
249
+    component: TimeshareSell,
250
+    props: true,
251
+  },
252
+  {
253
+    path: '/MakeOffer',
254
+    name: 'MakeOffer',
255
+    component: MakeOffer,
256
+  },
257
+  {
258
+    path: '/Offers',
259
+    name: 'Offers',
260
+    component: Offer,
261
+  },
262
+  {
263
+    path: '/timesharesearch',
264
+    name: 'TimeshareSearch',
265
+    component: TimeshareSearch,
266
+  },
267
+  {
268
+    path: '/searchLog',
269
+    name: 'SearchLog',
270
+    component: searchLog,
271
+  },
272
+  {
273
+    path: '/carousel',
274
+    name: 'carousel',
275
+    component: CarouselList,
276
+  },
277
+  {
278
+    path: '/carousel/details/:id',
279
+    name: 'CarouselDetails',
280
+    component: CarouselDetail,
281
+  },
265
   ],
282
   ],
266
 });
283
 });

+ 6
- 2
src/store/index.js View File

5
 import UsersModule from './modules/users';
5
 import UsersModule from './modules/users';
6
 import StatusModule from './modules/timeshare/status';
6
 import StatusModule from './modules/timeshare/status';
7
 import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
7
 import UnitConfigurationModule from './modules/timeshare/unitConfiguration';
8
-import TimeshareBuyModule from './modules/timeshare/buyPage';
8
+import RegionModule from './modules/timeshare/region';
9
 import SearchTabModule from './modules/searchTab';
9
 import SearchTabModule from './modules/searchTab';
10
 import ResortModule from './modules/timeshare/resort';
10
 import ResortModule from './modules/timeshare/resort';
11
 import PropertyModule from './modules/property/property';
11
 import PropertyModule from './modules/property/property';
22
 import SearchLog from './modules/logs/searchLog';
22
 import SearchLog from './modules/logs/searchLog';
23
 import Template from './modules/communication/template';
23
 import Template from './modules/communication/template';
24
 import Info from './modules/communication/info';
24
 import Info from './modules/communication/info';
25
+import PropertyEdit from './modules/property/propertyEdit';
26
+import Carousel from './modules/misc/carousel';
25
 
27
 
26
 Vue.use(Vuex);
28
 Vue.use(Vuex);
27
 /* eslint no-param-reassign: ["error", { "props": false }] */
29
 /* eslint no-param-reassign: ["error", { "props": false }] */
32
     users: UsersModule,
34
     users: UsersModule,
33
     status: StatusModule,
35
     status: StatusModule,
34
     unitConfiguration: UnitConfigurationModule,
36
     unitConfiguration: UnitConfigurationModule,
35
-    timeshareBuy: TimeshareBuyModule,
37
+    region: RegionModule,
36
     searchTab: SearchTabModule,
38
     searchTab: SearchTabModule,
37
     resort: ResortModule,
39
     resort: ResortModule,
38
     property: PropertyModule,
40
     property: PropertyModule,
48
     searchLog: SearchLog,
50
     searchLog: SearchLog,
49
     template: Template,
51
     template: Template,
50
     info: Info,
52
     info: Info,
53
+    propertyEdit: PropertyEdit,
54
+    carousel: Carousel,
51
   },
55
   },
52
 });
56
 });

+ 31
- 0
src/store/modules/misc/carousel.js View File

1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    carouselList: [],
7
+  },
8
+  mutations: {
9
+    setCarouselList(state, items) {
10
+      state.carouselList = items;
11
+    },
12
+    removeCarousel(state, id) {
13
+      state.carouselList.pop(state.carouselList.find(p => p.id === id));
14
+    },
15
+  },
16
+  getters: {},
17
+  actions: {
18
+    getCarouselList({ commit }) {
19
+      axios
20
+        .get('/api/Carousel')
21
+        .then(result => commit('setCarouselList', result.data))
22
+        .catch(console.error);
23
+    },
24
+    deleteCarousel({ commit }, id) {
25
+      axios
26
+        .delete(`/api/Carousel/${id}`)
27
+        .then(commit('removeCarousel', id))
28
+        .catch(console.error);
29
+    },
30
+  },
31
+};

+ 3
- 3
src/store/modules/property/property.js View File

103
     },
103
     },
104
     getPropertyImages({ commit }, id) {
104
     getPropertyImages({ commit }, id) {
105
       axios
105
       axios
106
-        .get(`/api/PropertyImage/getPropertyImages/${id}`)
106
+        .get(`/api/PropertyImage/GetImagesByProperty/${id}`)
107
         .then(result => commit('setPropertyImages', result.data))
107
         .then(result => commit('setPropertyImages', result.data))
108
         .catch(console.error);
108
         .catch(console.error);
109
     },
109
     },
164
       commit('clearPropertyImages');
164
       commit('clearPropertyImages');
165
 
165
 
166
       axios
166
       axios
167
-        .get(`/api/Property/getproperty/${item.id}`)
167
+        .get(`/api/Property/getProperty/${item.id}`)
168
         .then(result => commit('setProperty', result.data))
168
         .then(result => commit('setProperty', result.data))
169
         .catch(console.error);
169
         .catch(console.error);
170
 
170
 
171
       axios
171
       axios
172
-        .get(`/api/PropertyImage/getPropertyImages/${item.id}`)
172
+        .get(`/api/PropertyImage/GetProperySavedImages/${item.id}`)
173
         .then(result => commit('setPropertyImages', result.data))
173
         .then(result => commit('setPropertyImages', result.data))
174
         .catch(console.error);
174
         .catch(console.error);
175
 
175
 

+ 143
- 0
src/store/modules/property/propertyEdit.js View File

1
+import axios from 'axios';
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    property: {
7
+      createdBy: '',
8
+      propertyTypeId: 0,
9
+      propertyName: '',
10
+      unit: '',
11
+      operationalCosts: 0.0,
12
+      price: 0,
13
+      pricePer: '',
14
+      isSale: false,
15
+      description: '',
16
+      shortDescription: '',
17
+      addressLine1: '',
18
+      addressLine2: '',
19
+      addressLine3: '',
20
+      suburbId: 0,
21
+      cityId: 0,
22
+      provinceId: 0,
23
+      published: false,
24
+      propertyUserFields: [],
25
+      propertyImages: [],
26
+      newImages: [],
27
+      id: 0,
28
+      virtualTour: '',
29
+      video: '',
30
+      userId: 0,
31
+    },
32
+    propertyImages: [],
33
+    propertyTypes: [],
34
+    propertyTypesRes: [],
35
+    propertyTypesCom: [],
36
+    propertyOverviewFields: [],
37
+    propertyFields: [],
38
+    mayEdit: false,
39
+    newPropertyImages: {
40
+      propertyId: 0,
41
+      images: [],
42
+    },
43
+  },
44
+  mutations: {
45
+    setProperty(state, property) {
46
+      state.property = property;
47
+    },
48
+    setPropertyImages(state, images) {
49
+      state.propertyImages = images;
50
+    },
51
+    setPropertyOverviewFields(state, fields) {
52
+      state.propertyOverviewFields = fields;
53
+    },
54
+    setPropertyFields(state, fields) {
55
+      state.propertyFields = fields;
56
+    },
57
+    setMayEdit(state, data) {
58
+      state.mayEdit = data;
59
+    },
60
+    clearProperty(state) {
61
+      state.property = {
62
+        createdBy: '',
63
+        propertyTypeId: 0,
64
+        propertyName: '',
65
+        unit: '',
66
+        operationalCosts: 0.0,
67
+        price: 0,
68
+        pricePer: '',
69
+        isSale: false,
70
+        description: '',
71
+        shortDescription: '',
72
+        addressLine1: '',
73
+        addressLine2: '',
74
+        addressLine3: '',
75
+        suburbId: 0,
76
+        cityId: 0,
77
+        provinceId: 0,
78
+        published: false,
79
+        propertyOverviewFields: [],
80
+        propertyFields: [],
81
+        propertyImages: [],
82
+        newImages: [],
83
+        id: 0,
84
+        virtualTour: '',
85
+        video: '',
86
+        userId: 0,
87
+      };
88
+    },
89
+    clearPropertyImages(state) {
90
+      state.propertyImages = [];
91
+    },
92
+    ClearNewImages(state) {
93
+      state.newPropertyImages = {
94
+        propertyId: 0,
95
+        images: [],
96
+      };
97
+    },
98
+  },
99
+  getters: {},
100
+  actions: {
101
+    getSavedPropertyData({ commit }, item) {
102
+      commit('clearProperty');
103
+      commit('clearPropertyImages');
104
+
105
+      axios
106
+        .get(`/api/Property/getProperty/${item.id}`)
107
+        .then(result => commit('setProperty', result.data))
108
+        .catch(console.error);
109
+
110
+      axios
111
+        .get(`/api/PropertyImage/GetProperySavedImages/${item.id}`)
112
+        .then(result => commit('setPropertyImages', result.data))
113
+        .catch(console.error);
114
+
115
+      axios
116
+        .get(`/api/PropertyFields/GetSavedValues/Residential/Property Overview/${item.id}`)
117
+        .then(response => commit('setPropertyOverviewFields', response.data))
118
+        .catch(console.error);
119
+
120
+      axios
121
+        .get(`/api/PropertyFields/GetSavedValues/${item.type}/All/${item.id}`)
122
+        .then(response => commit('setPropertyFields', response.data))
123
+        .catch(console.error);
124
+    },
125
+    updateProperty({ commit }, item) {
126
+      axios
127
+        .post('/api/PropertyImage', item.images)
128
+        .then(commit('ClearNewImages'))
129
+        .catch(console.error);
130
+
131
+      axios
132
+        .put('/api/Property', item.property)
133
+        .then(commit('setProperty', item.property))
134
+        .catch(console.error);
135
+    },
136
+    mayEditProperty({ commit }, id) {
137
+      axios
138
+        .get(`/api/property/MayEditProperty/${id}`)
139
+        .then(response => commit('setMayEdit', response.data))
140
+        .catch(console.error);
141
+    },
142
+  },
143
+};

+ 16
- 0
src/store/modules/searchTab.js View File

36
         .get(`/api/Suburb/${item.province}/${item.city}`)
36
         .get(`/api/Suburb/${item.province}/${item.city}`)
37
         .then(result => commit('setSuburbs', result.data));
37
         .then(result => commit('setSuburbs', result.data));
38
     },
38
     },
39
+    getListsForPropertyEdit({ commit }, propertyId) {
40
+      axios
41
+        .get('/api/province')
42
+        .then(result => commit('setProvince', result.data))
43
+        .catch(console.error);
44
+
45
+      axios
46
+        .get(`/api/City/GetByProperty/${propertyId}`)
47
+        .then(result => commit('setCities', result.data))
48
+        .catch(console.error);
49
+
50
+      axios
51
+        .get(`/api/Suburb/GetByProperty/${propertyId}`)
52
+        .then(result => commit('setSuburbs', result.data))
53
+        .catch(console.error);
54
+    },
39
   },
55
   },
40
 };
56
 };

+ 17
- 2
src/store/modules/timeshare/myWeeks.js View File

1
+import axios from 'axios';
2
+
1
 export default {
3
 export default {
2
   namespaced: true,
4
   namespaced: true,
3
   state: {
5
   state: {
4
     test: 'kobus',
6
     test: 'kobus',
5
     items: [],
7
     items: [],
6
   },
8
   },
7
-  mutations: {},
9
+  mutations: {
10
+    setItems(state, list) {
11
+      state.items = list;
12
+    },
13
+  },
8
   getters: {},
14
   getters: {},
9
-  actions: {},
15
+  actions: {
16
+    getItems({
17
+      commit,
18
+    }, id) {
19
+      axios.get(`/api/timeshareweek/getMyWeek/${id}`).then(r => commit('setItems', r.data)).catch(
20
+        console
21
+          .error,
22
+      );
23
+    },
24
+  },
10
 };
25
 };

src/store/modules/timeshare/buyPage.js → src/store/modules/timeshare/region.js View File

1
 /* eslint-disable no-restricted-syntax */
1
 /* eslint-disable no-restricted-syntax */
2
 /* eslint-disable guard-for-in */
2
 /* eslint-disable guard-for-in */
3
 import axios from 'axios';
3
 import axios from 'axios';
4
-import _ from 'lodash';
5
-import resort from './resort';
6
 
4
 
7
 export default {
5
 export default {
8
   namespaced: true,
6
   namespaced: true,
10
     regions: [],
8
     regions: [],
11
     detailedRegion: [],
9
     detailedRegion: [],
12
     availRegion: [],
10
     availRegion: [],
13
-    resort: {},
11
+    initFlag: false,
14
   },
12
   },
15
   mutations: {
13
   mutations: {
16
-    clearAvail(state, avail) {
17
-      state.availRegion = [];
14
+    addItem(state, item) {
15
+      state[item.name].push(item.value);
18
     },
16
     },
19
-    addAvail(state, avail) {
20
-      state.availRegion.push(avail);
21
-    },
22
-    setRegions(state, regions) {
23
-      state.regions = regions;
24
-    },
25
-    clearDetailed(state) {
26
-      state.detailedRegion = [];
27
-    },
28
-    addDetailed(state, detailed) {
29
-      state.detailedRegion.push(detailed);
30
-    },
31
-    setResort(state, resort) {
32
-      state.resort = resort;
17
+    setItem(state, item) {
18
+      state[item.name] = item.value;
33
     },
19
     },
34
   },
20
   },
35
   getters: {},
21
   getters: {},
36
   actions: {
22
   actions: {
37
     init({
23
     init({
24
+      state,
25
+      commit,
26
+      dispatch,
27
+    }) {
28
+      if (!state.initFlag) {
29
+        commit('setItem', {
30
+          name: 'availRegion',
31
+          value: [],
32
+        });
33
+        dispatch('getAvail');
34
+        dispatch('getRegions');
35
+        commit('setItem', {
36
+          name: 'initFlag',
37
+          value: true,
38
+        });
39
+      }
40
+    },
41
+    forceInit({
38
       commit,
42
       commit,
39
       dispatch,
43
       dispatch,
40
     }) {
44
     }) {
41
-      commit('clearAvail');
42
-      dispatch('getAvail');
43
-      dispatch('getRegions');
45
+      commit('setItem', {
46
+        name: 'initFlag',
47
+        value: false,
48
+      });
49
+      dispatch('init');
44
     },
50
     },
45
     getAvail({
51
     getAvail({
46
       commit,
52
       commit,
75
             }
81
             }
76
             newRegion.resorts.push(newResort);
82
             newRegion.resorts.push(newResort);
77
           }
83
           }
78
-          commit('addAvail', newRegion);
84
+          commit('addItem', {
85
+            name: 'availRegion',
86
+            value: newRegion,
87
+          });
79
         }
88
         }
80
       }).catch(
89
       }).catch(
81
         console
90
         console
86
       commit,
95
       commit,
87
       dispatch,
96
       dispatch,
88
     }) {
97
     }) {
89
-      commit('clearDetailed');
98
+      commit('setItem', {
99
+        name: 'detailedRegion',
100
+        value: [],
101
+      });
90
       axios.get(
102
       axios.get(
91
         'https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA/',
103
         'https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/regions/list/ZA/',
92
       )
104
       )
93
         .then((result) => {
105
         .then((result) => {
94
-          commit('setRegions', result.data);
106
+          commit('setItem', {
107
+            name: 'regions',
108
+            value: result.data,
109
+          });
95
           if (result.data) {
110
           if (result.data) {
96
             for (const i in result.data) {
111
             for (const i in result.data) {
97
               const region = result.data[i];
112
               const region = result.data[i];
101
         })
116
         })
102
         .catch(console.error);
117
         .catch(console.error);
103
     },
118
     },
104
-    getResort({
105
-      commit,
106
-    }, resortCode) {
107
-      axios.get(
108
-        `https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/TRESORT/${
109
-          resortCode}`,
110
-      )
111
-        .then((result) => {
112
-          commit('setResort', result.data);
113
-        })
114
-        .catch(console.error);
115
-    },
116
     getDetailedRegion({
119
     getDetailedRegion({
117
       commit,
120
       commit,
118
     }, region) {
121
     }, region) {
120
         axios
123
         axios
121
           .get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
124
           .get(`https://www.tradeunipoint.com/unibackend/seam/resource/rest/products/resorts/${
122
             region.regionCode}/`)
125
             region.regionCode}/`)
123
-          .then(result => commit('addDetailed', {
124
-            id: region.id,
125
-            regionCode: region.regionCode,
126
-            regionName: region.regionName,
127
-            resorts: result.data,
126
+          .then(result => commit('addItem', {
127
+            name: 'detailedRegion',
128
+            value: {
129
+              id: region.id,
130
+              regionCode: region.regionCode,
131
+              regionName: region.regionName,
132
+              resorts: result.data,
133
+            },
128
           }))
134
           }))
129
           .catch(console.error);
135
           .catch(console.error);
130
       }
136
       }

+ 20
- 22
src/store/modules/timeshare/timeshare.js View File

49
       mandate: undefined,
49
       mandate: undefined,
50
       status: undefined,
50
       status: undefined,
51
       owner: {
51
       owner: {
52
-        name: undefined,
53
-        surname: undefined,
54
-        idNumber: undefined,
55
-        companyRegNumber: undefined,
56
-        maritalStatus: undefined,
57
-        emailAddress: undefined,
58
-        cellNumber: undefined,
59
-        landlineNumber: undefined,
60
-        address: {
61
-          streetNumber: undefined,
62
-          streetName: undefined,
63
-          suburb: undefined,
64
-          city: undefined,
65
-          province: undefined,
66
-          postalCode: undefined,
67
-        },
68
-        bankingDetails: {
69
-          bank: undefined,
70
-          accountNumber: undefined,
71
-          accountHolder: undefined,
72
-        },
52
+        address: {},
53
+        bankingDetails: {},
73
       },
54
       },
74
     },
55
     },
75
   },
56
   },
118
     displayResult(state) {
99
     displayResult(state) {
119
       state.result = 'Week has been added ^-^';
100
       state.result = 'Week has been added ^-^';
120
     },
101
     },
102
+    setWeekDetail(state, week) {
103
+      state.sellItem = week;
104
+    },
121
   },
105
   },
122
   getters: {
106
   getters: {
123
     getRegionCode(state) {
107
     getRegionCode(state) {
143
     initTimeshare({
127
     initTimeshare({
144
       commit,
128
       commit,
145
       dispatch,
129
       dispatch,
146
-    }) {
130
+    }, timeshareId) {
147
       commit('setResortBedrooms', MyData.resortBedrooms);
131
       commit('setResortBedrooms', MyData.resortBedrooms);
148
       commit('setMaxSleep', MyData.maxBedrooms);
132
       commit('setMaxSleep', MyData.maxBedrooms);
149
       commit('setBankedEntities', MyData.bankedEntities);
133
       commit('setBankedEntities', MyData.bankedEntities);
152
       dispatch('getAgencies');
136
       dispatch('getAgencies');
153
       dispatch('getResorts');
137
       dispatch('getResorts');
154
       dispatch('getRegions');
138
       dispatch('getRegions');
139
+      if (timeshareId && timeshareId !== 0) {
140
+        dispatch('getWeekDetail', timeshareId);
141
+      }
142
+    },
143
+    getWeekDetail({
144
+      commit,
145
+    }, timeshareId) {
146
+      axios
147
+        .get(`api/timeshareweek/${timeshareId}`)
148
+        .then((result) => {
149
+          console.log(result.data);
150
+          commit('setWeekDetail', result.data);
151
+        })
152
+        .catch(console.error);
155
     },
153
     },
156
     getSeasons({
154
     getSeasons({
157
       commit,
155
       commit,

+ 6
- 7
src/store/modules/timeshare/week.js View File

6
 export default {
6
 export default {
7
   namespaced: true,
7
   namespaced: true,
8
   state: {
8
   state: {
9
-    week: undefined,
9
+    currentWeek: undefined,
10
   },
10
   },
11
   mutations: {
11
   mutations: {
12
     setWeek(state, week) {
12
     setWeek(state, week) {
13
-      if (week.length > 0) {
14
-        state.week = week[0];
15
-      }
13
+      state.currentWeek = week;
16
     },
14
     },
17
   },
15
   },
18
   getters: {},
16
   getters: {},
19
   actions: {
17
   actions: {
20
     initWeek({
18
     initWeek({
21
       commit,
19
       commit,
22
-    }, weekId) {
23
-      axios.get(`/api/timeshareweek/${weekId}`).then(r => commit('setWeek', r.data)).catch(console
24
-        .error);
20
+    }, week) {
21
+      commit('setWeek', week);
22
+      // axios.get(`/api/timeshareweek/${weekId}`).then(r => commit('setWeek', r.data)).catch(console
23
+      //  .error);
25
     },
24
     },
26
   },
25
   },
27
 };
26
 };

+ 11
- 1
src/store/modules/timeshare/weekList.js View File

46
   },
46
   },
47
   getters: {
47
   getters: {
48
     filteredWeeks: (state) => {
48
     filteredWeeks: (state) => {
49
-      console.log(JSON.stringify(state.filter));
50
       let weekList = state.weeks;
49
       let weekList = state.weeks;
51
       const {
50
       const {
52
         filter,
51
         filter,
111
     getRegions(state, getters, rootState, rootGetters) {
110
     getRegions(state, getters, rootState, rootGetters) {
112
       return rootGetters['timeshare/getRegionCode']('KK');
111
       return rootGetters['timeshare/getRegionCode']('KK');
113
     },
112
     },
113
+    weekById(state) {
114
+      return (resortCode, unitNumber) => {
115
+        const w = state.weeks.find(week => week.resort !== undefined && week.resort.resortCode
116
+          === resortCode && week.unitNumber === unitNumber);
117
+        console.log(resortCode, unitNumber);
118
+
119
+        if (w) {
120
+          return w;
121
+        }
122
+      };
123
+    },
114
   },
124
   },
115
   actions: {
125
   actions: {
116
     applyResortFilter({
126
     applyResortFilter({

Loading…
Cancel
Save