Browse Source

UserFields Optamization

master
30117125 4 years ago
parent
commit
601f10f38c

+ 35
- 16
src/components/property/ListProperty/contentSection.vue View File

@@ -1,5 +1,6 @@
1 1
 <template>
2 2
   <section id="services">
3
+    <div v-if="wait" id="preloader"></div>
3 4
     <div class="container">
4 5
       <div class="col-12">
5 6
         <h1>List your property</h1>
@@ -16,7 +17,6 @@
16 17
               role="tab"
17 18
               aria-controls="pills-residential"
18 19
               aria-selected="true"
19
-              @click="getPropTypeResidential"
20 20
               >RESIDENTIAL</a
21 21
             >
22 22
           </li>
@@ -29,7 +29,6 @@
29 29
               role="tab"
30 30
               aria-controls="pills-commercial"
31 31
               aria-selected="false"
32
-              @click="getPropTypeCommercial"
33 32
               >COMMERCIAL</a
34 33
             >
35 34
           </li>
@@ -44,7 +43,7 @@
44 43
             role="tabpanel"
45 44
             aria-labelledby="pills-residential-tab"
46 45
           >
47
-            <ResidentialCreate />
46
+            <ResidentialCreate :propFields="residentialFields" />
48 47
           </div>
49 48
           <div
50 49
             class="tab-pane fade"
@@ -52,7 +51,7 @@
52 51
             role="tabpanel"
53 52
             aria-labelledby="pills-commercial-tab"
54 53
           >
55
-            <CommercialCreate />
54
+            <CommercialCreate :propFields="commercialFields" />
56 55
           </div>
57 56
         </div>
58 57
       </div>
@@ -70,24 +69,44 @@ export default {
70 69
     ResidentialCreate,
71 70
     CommercialCreate
72 71
   },
72
+  data() {
73
+    return {
74
+      wait: true,
75
+      residentialFields: [],
76
+      commercialFields: []
77
+    };
78
+  },
73 79
   methods: {
74 80
     ...mapActions("property", ["getPropertyTypes", "getPropertyFields"]),
75
-    getPropTypeResidential() {
76
-      this.getPropertyTypes("Residential");
77
-      this.getPropertyFields("Residential");
81
+    async loadResidentialFields() {
82
+      await this.getPropertyFields("Residential");
78 83
     },
79
-    getPropTypeCommercial() {
80
-      this.getPropertyTypes("Commercial");
81
-      this.getPropertyFields("Commercial");
84
+    async loadCommercialFields() {
85
+      await this.getPropertyFields("Commercial");
82 86
     }
83 87
   },
84
-  mounted() {
85
-    this.getPropertyTypes("Residential");
86
-    this.getPropertyFields("Residential");
87
-  },
88 88
   computed: {
89
-    ...mapState("property", ["propertyTypes"])
90
-  }
89
+    ...mapState("property", ["propertyTypes", "propertyFields"]),
90
+    propFields() {
91
+      if (!this.wait) {
92
+        return this.propertyFields[0].fields;
93
+      }
94
+    }
95
+  },
96
+  created() {
97
+    this.loadResidentialFields().then(() => {
98
+      this.residentialFields = this.propertyFields[0].fields.sort((a, b) =>
99
+        a.rank > b.rank ? 1 : -1
100
+      );
101
+      this.loadCommercialFields().then(() => {
102
+        this.wait = false;
103
+        this.commercialFields = this.propertyFields[0].fields.sort((a, b) =>
104
+          a.rank > b.rank ? 1 : -1
105
+        );
106
+      });
107
+    });
108
+  },
109
+  mounted() {}
91 110
 };
92 111
 </script>
93 112
 

+ 7
- 12
src/components/property/commercial/createProperty/commercialCreateNew.vue View File

@@ -251,17 +251,12 @@
251 251
         <div class="section-header">
252 252
           <h2>Property Information</h2>
253 253
         </div>
254
-        <div v-for="item in propertyFields" :key="item.id">
254
+        <!-- <div v-for="item in propertyFields" :key="item.id">
255 255
           <div v-if="item.name === 'Commercial Fields'">
256
-            <UserField
257
-              :fields="sortFields"
258
-              :id="item.name"
259
-              @UpdateUserDefinedFields="UpdateUserDefinedFields"
260
-              :fieldValues="item.fields"
261
-            />
256
+            
262 257
           </div>
263
-        </div>
264
-
258
+        </div> -->
259
+        <UserField :fields="propFields" @UpdateUserDefinedFields="UpdateUserDefinedFields" />
265 260
         <div class="row">
266 261
           <div class="col-sm-12">
267 262
             <div class="section-header">
@@ -348,6 +343,9 @@ export default {
348 343
     carouselSection,
349 344
     mapSection
350 345
   },
346
+  props: {
347
+    propFields: {}
348
+  },
351 349
   data() {
352 350
     return {
353 351
       propertyType: "Commercial",
@@ -539,10 +537,7 @@ export default {
539 537
     ...mapGetters("fees", ["getListingFee"]),
540 538
     sortFields() {
541 539
       var display = [];
542
-
543 540
       display = this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
544
-      console.log(display);
545
-
546 541
       return display;
547 542
     },
548 543
     SalesTypeChanged() {

+ 9
- 9
src/components/property/propertyImage.vue View File

@@ -22,6 +22,7 @@
22 22
           v-if="allowMultiple"
23 23
           type="checkbox"
24 24
           id="checkbox"
25
+          name="checkbox"
25 26
           v-model="imagesDefault[i]"
26 27
           @change="updateList(i)"
27 28
           :disabled="!mayEdit"
@@ -47,14 +48,14 @@ export default {
47 48
     loadedImages: Function,
48 49
     mayEdit: { type: Boolean, default: () => true },
49 50
     allowMultiple: { type: Boolean, default: () => true },
50
-    savedImages: { type: Array, default: () => [] },
51
+    savedImages: { type: Array, default: () => [] }
51 52
   },
52 53
   data() {
53 54
     return {
54 55
       images: {},
55 56
       image: [],
56 57
       imagesDefault: [],
57
-      maxSavedIndex: 0,
58
+      maxSavedIndex: 0
58 59
     };
59 60
   },
60 61
   // Commented out for now.
@@ -87,7 +88,7 @@ export default {
87 88
         const reader = new FileReader();
88 89
         var vm = this;
89 90
 
90
-        reader.onload = (e) => {
91
+        reader.onload = e => {
91 92
           vm.image.push(e.target.result);
92 93
         };
93 94
         reader.readAsDataURL(file[i]);
@@ -117,7 +118,7 @@ export default {
117 118
         }
118 119
         this.$emit("DefaultImage", index);
119 120
       }
120
-    },
121
+    }
121 122
   },
122 123
   watch: {
123 124
     savedImages: {
@@ -132,9 +133,9 @@ export default {
132 133
             this.maxSavedIndex = i;
133 134
           }
134 135
         }
135
-      },
136
-    },
137
-  },
136
+      }
137
+    }
138
+  }
138 139
 };
139 140
 </script>
140 141
 
@@ -143,7 +144,6 @@ export default {
143 144
   background: #d9534f;
144 145
   border-width: 0px;
145 146
   width: 150px;
146
-  margin-left: 0;
147 147
   font-family: "Muli";
148 148
   font-size: 15px;
149 149
   letter-spacing: 1px;
@@ -151,7 +151,7 @@ export default {
151 151
   padding: 10px 32px;
152 152
   border-radius: 2px;
153 153
   transition-duration: 5s;
154
-  margin: 10px;
154
+  margin-top: 10px;
155 155
   color: #fff;
156 156
 }
157 157
 

+ 32
- 42
src/components/property/propertyUserField.vue View File

@@ -1,50 +1,38 @@
1 1
 <template>
2 2
   <div class="row">
3
-    <div class="col-md-4 mb-3 mt-2" v-for="(currentField, i) in fields" :key="i">
4
-      <div class="input-group-prepend">
5
-        <!-- <span class="input-group-text" style="color: #60CBEB">
6
-          <b>{{ GetFirstLetter(currentField.name) }}</b>
7
-        </span> -->
8
-        <div v-if="!setFields[i] && currentField.type !== 'yesno'">
9
-          <label class="uniSelectLabel" style="margin-top:-10px">{{ currentField.name }}</label>
10
-        </div>
11
-        <float-label :label="currentField.name" style="width:100%;top:-1em !important;">
12
-          <input
13
-            v-if="currentField.type === 'number'"
14
-            class="form-control uniInput"
15
-            type="number"
16
-            name="currentField.name"
17
-            id="currentField.id"
18
-            v-model="setFields[i]"
19
-            @change="UpdateSetFields(currentField, i)"
20
-          />
21
-
22
-          <input
23
-            v-if="currentField.type === 'text'"
24
-            class="form-control uniInput"
25
-            type="text"
26
-            name="currentField.name"
27
-            id="currentField.id"
28
-            v-model="setFields[i]"
29
-            @change="UpdateSetFields(currentField, i)"
30
-          />
31
-        </float-label>
3
+    <div class="col-md-4" v-for="(currentField, i) in fields" :key="i">
4
+      <div v-if="!setFields[i] && currentField.type !== 'yesno'">
5
+        <label class="uniSelectLabel" style="margin-top:10px;">{{ currentField.name }}</label>
32 6
       </div>
33
-    </div>
34
-
35
-    <div class="col-md-4 mb-2" v-for="(currentField, i) in fields" :key="'checkField' + i">
36
-      <div class="input-group-prepend">
37
-        <!-- <span class="input-group-text" style="color: #60CBEB">
38
-          <b>{{ GetFirstLetter(currentField.name) }}</b>
39
-        </span> -->
40
-        <div v-if="currentField.type === 'yesno'">
41
-          <label class="uniSelectLabel">{{ currentField.name }}</label>
42
-        </div>
7
+      <float-label :label="currentField.name" style="width:100%;top:-1em !important;">
8
+        <input
9
+          v-if="currentField.type === 'number'"
10
+          class="form-control uniInput"
11
+          type="number"
12
+          style="margin-top:20px;"
13
+          :name="currentField.name"
14
+          :id="currentField.id"
15
+          v-model="setFields[i]"
16
+          @change="UpdateSetFields(currentField, i)"
17
+        />
43 18
 
44 19
         <input
45
-          v-if="currentField.type === 'yesno'"
20
+          v-if="currentField.type === 'text'"
21
+          class="form-control uniInput"
22
+          type="text"
23
+          style="margin-top:20px;"
24
+          :name="currentField.name"
25
+          :id="currentField.id"
26
+          v-model="setFields[i]"
27
+          @change="UpdateSetFields(currentField, i)"
28
+        />
29
+      </float-label>
30
+      <div class="input-group" v-if="currentField.type === 'yesno'">
31
+        <label class="uniSelectLabel" :for="currentField.name">{{ currentField.name }}</label>
32
+        <input
46 33
           type="checkbox"
47
-          id="currentField.id"
34
+          :id="currentField.id"
35
+          :name="currentField.name"
48 36
           style="margin-left:-5px; margin-top:10px"
49 37
           v-model="setFields[i]"
50 38
           @change="UpdateSetFields(currentField, i)"
@@ -71,7 +59,9 @@ export default {
71 59
         userDefinedFieldId: field.id,
72 60
         value: this.setFields[index]
73 61
       };
74
-      this.$emit("UpdateUserDefinedFields", item);
62
+      if (item) {
63
+        this.$emit("UpdateUserDefinedFields", item);
64
+      }
75 65
     },
76 66
     GetFirstLetter(value) {
77 67
       if (value) {

+ 77
- 117
src/components/property/residential/createProperty/residentialCreateNew.vue View File

@@ -4,9 +4,9 @@
4 4
       <div class="container pb-5">
5 5
         <div class="row">
6 6
           <div class="col">
7
-            <label v-if="!salesType" class="uniSelectLabel" for="saleType">Sale Type</label>
7
+            <label v-if="!salesType" class="uniSelectLabel" for="resSaleType">Sale Type</label>
8 8
             <float-label label="Sale Type">
9
-              <select class="form-control uniSelect mb-3" name="saleType" v-model="salesType">
9
+              <select class="form-control uniSelect mb-3" name="resSaleType" v-model="salesType">
10 10
                 <option value="Sale">To Sell</option>
11 11
                 <option value="Rental">To Rent</option>
12 12
               </select>
@@ -22,7 +22,7 @@
22 22
               <input
23 23
                 class="form-control uniInput"
24 24
                 type="text"
25
-                name="propertyName"
25
+                name="resPropertyName"
26 26
                 v-model="property.propertyName"
27 27
               />
28 28
             </float-label>
@@ -35,7 +35,7 @@
35 35
               <input
36 36
                 class="form-control uniInput"
37 37
                 type="text"
38
-                name="propertyRef"
38
+                name="resPropertyRef"
39 39
                 v-model="property.propertyRef"
40 40
               />
41 41
             </float-label>
@@ -45,17 +45,15 @@
45 45
           <div class="col-md-6">
46 46
             <select
47 47
               class="form-control uniSelect"
48
-              name="propertyType"
49
-              id="propertyType"
48
+              name="resPropertyType"
49
+              id="resPropertyType"
50 50
               v-model="property.propertyTypeId"
51 51
               @change="PropertyTypeSelected"
52 52
             >
53 53
               <option value="0">Please select type *</option>
54
-              <option
55
-                v-for="item in propertyTypes"
56
-                :value="item.id"
57
-                :key="item.id"
58
-              >{{ item.description }}</option>
54
+              <option v-for="item in propertyTypes" :value="item.id" :key="item.id">{{
55
+                item.description
56
+              }}</option>
59 57
             </select>
60 58
           </div>
61 59
         </div>
@@ -74,19 +72,20 @@
74 72
               <div class="col-md-6">
75 73
                 <div v-if="property.price < 1">
76 74
                   <label
77
-                    for="price"
75
+                    for="resPrice"
78 76
                     class="uniSelectLabel"
79 77
                     style="text-transform:uppercase; margin-left:17px; background-color:white"
80
-                  >{{ salesType }} Price</label>
78
+                    >{{ salesType }} Price</label
79
+                  >
81 80
                 </div>
82 81
                 <float-label label="Price">
83 82
                   <currency-input
84 83
                     onclick="this.setSelectionRange(0, this.value.length)"
85
-                    name="price"
84
+                    name="resPrice"
86 85
                     :value="property.price"
87 86
                     @input="property.price = $event"
88 87
                     v-model="property.price"
89
-                    id="price"
88
+                    id="resPrice"
90 89
                     class="form-control uniInput"
91 90
                   />
92 91
                 </float-label>
@@ -94,8 +93,8 @@
94 93
               <div v-if="salesType === 'Rental'" class="col-md-6">
95 94
                 <select
96 95
                   class="form-control uniSelect"
97
-                  name="propertyType"
98
-                  id="propertyType"
96
+                  name="resPropertyType"
97
+                  id="resPropertyType"
99 98
                   v-model="property.pricePer"
100 99
                 >
101 100
                   <option value>Please select</option>
@@ -109,7 +108,7 @@
109 108
                 <input
110 109
                   type="date"
111 110
                   class="form-control uniInput"
112
-                  name="date"
111
+                  name="resDate"
113 112
                   v-model="property.dateAvailable"
114 113
                 />
115 114
               </div>
@@ -120,13 +119,13 @@
120 119
             <div class="row my-3">
121 120
               <div class="col-md-12">
122 121
                 <div v-if="!property.streetNumber">
123
-                  <label for="streetNumber" class="uniSelectLabel">STREET NUMBER</label>
122
+                  <label for="resStreetNumber" class="uniSelectLabel">STREET NUMBER</label>
124 123
                 </div>
125 124
                 <input
126 125
                   class="form-control uniInput"
127 126
                   type="text"
128
-                  name="streetNumber"
129
-                  id="streetNumber"
127
+                  name="resStreetNumber"
128
+                  id="resStreetNumber"
130 129
                   v-model="property.streetNumber"
131 130
                 />
132 131
               </div>
@@ -134,13 +133,13 @@
134 133
             <div class="row my-3">
135 134
               <div class="col-md-12">
136 135
                 <div v-if="!property.streetName">
137
-                  <label for="streetName" class="uniSelectLabel">STREET NAME</label>
136
+                  <label for="resStreetName" class="uniSelectLabel">STREET NAME</label>
138 137
                 </div>
139 138
                 <input
140 139
                   class="form-control uniInput"
141 140
                   type="text"
142
-                  name="streetName"
143
-                  id="streetName"
141
+                  name="resStreetName"
142
+                  id="resStreetName"
144 143
                   v-model="property.streetName"
145 144
                 />
146 145
               </div>
@@ -148,13 +147,13 @@
148 147
             <div class="row my-3">
149 148
               <div class="col-md-12">
150 149
                 <div v-if="!property.suburb">
151
-                  <label for="suburb" class="uniSelectLabel">SUBURB</label>
150
+                  <label for="resSuburb" class="uniSelectLabel">SUBURB</label>
152 151
                 </div>
153 152
                 <input
154 153
                   class="form-control uniInput"
155 154
                   type="text"
156
-                  name="suburb"
157
-                  id="suburb"
155
+                  name="resSuburb"
156
+                  id="resSuburb"
158 157
                   v-model="property.suburb"
159 158
                 />
160 159
               </div>
@@ -162,13 +161,13 @@
162 161
             <div class="row my-3">
163 162
               <div class="col-md-12">
164 163
                 <div v-if="!property.city">
165
-                  <label for="city" class="uniSelectLabel">CITY</label>
164
+                  <label for="resCity" class="uniSelectLabel">CITY</label>
166 165
                 </div>
167 166
                 <input
168 167
                   class="form-control uniInput"
169 168
                   type="text"
170
-                  name="city"
171
-                  id="city"
169
+                  name="resCity"
170
+                  id="resCity"
172 171
                   v-model="property.city"
173 172
                 />
174 173
               </div>
@@ -176,13 +175,13 @@
176 175
             <div class="row my-3">
177 176
               <div class="col-md-12">
178 177
                 <div v-if="!property.province">
179
-                  <label for="province" class="uniSelectLabel">PROVINCE</label>
178
+                  <label for="resProvince" class="uniSelectLabel">PROVINCE</label>
180 179
                 </div>
181 180
                 <input
182 181
                   class="form-control uniInput"
183 182
                   type="text"
184
-                  name="province"
185
-                  id="province"
183
+                  name="resProvince"
184
+                  id="resProvince"
186 185
                   v-model="property.province"
187 186
                 />
188 187
               </div>
@@ -190,13 +189,13 @@
190 189
             <div class="row my-3">
191 190
               <div class="col-md-12">
192 191
                 <div v-if="!property.postalCode">
193
-                  <label for="postalCode" class="uniSelectLabel">POSTAL CODE</label>
192
+                  <label for="resPostalCode" class="uniSelectLabel">POSTAL CODE</label>
194 193
                 </div>
195 194
                 <input
196 195
                   class="form-control uniInput"
197 196
                   type="text"
198
-                  name="postalCode"
199
-                  id="postalCode"
197
+                  name="resPostalCode"
198
+                  id="resPostalCode"
200 199
                   v-model="property.postalCode"
201 200
                 />
202 201
               </div>
@@ -204,20 +203,22 @@
204 203
             <div class="row my-3">
205 204
               <div class="col-md-12">
206 205
                 <div v-if="!property.country">
207
-                  <label for="country" class="uniSelectLabel">COUNTRY</label>
206
+                  <label for="resCountry" class="uniSelectLabel">COUNTRY</label>
208 207
                 </div>
209 208
                 <input
210 209
                   class="form-control uniInput"
211 210
                   type="text"
212
-                  name="country"
213
-                  id="country"
211
+                  name="resCountry"
212
+                  id="resCountry"
214 213
                   v-model="property.country"
215 214
                 />
216 215
               </div>
217 216
             </div>
218 217
             <div class="row my-3">
219 218
               <div class="col-md-12">
220
-                <button type="button" @click="clearAddress()" class="btn-solid-blue">Clear Address</button>
219
+                <button type="button" @click="clearAddress()" class="btn-solid-blue">
220
+                  Clear Address
221
+                </button>
221 222
               </div>
222 223
             </div>
223 224
           </div>
@@ -237,42 +238,10 @@
237 238
         <div class="section-header">
238 239
           <h2>Property Information</h2>
239 240
         </div>
240
-
241
-        <div v-for="item in propertyFields" :key="item.id">
242
-          <div v-if="item.name === 'Residential Fields'">
243
-            <UserField
244
-              :fields="item.fields"
245
-              :id="item.name"
246
-              @UpdateUserDefinedFields="UpdateUserDefinedFields"
247
-              :fieldValues="item.fields"
248
-            />
249
-          </div>
250
-        </div>
251
-        <!-- <UserField
252
-          v-if="propertyOverviewFields.length > 0"
253
-          :fields="propertyOverviewFields[0].fields"
254
-          @UpdateUserDefinedFields="UpdateUserDefinedFields"
255
-          :id="1"
256
-        ></UserField>-->
257
-        <!-- <div class="row">
258
-          <div class="col-md-12">
259
-            <div v-for="item in propertyFields" :key="item.id">
260
-              <div class="row">
261
-                <div class="col-sm-12">
262
-                  <div class="section-header">
263
-                    <h2>{{ item.name }}</h2>
264
-                  </div>
265
-                </div>
266
-              </div>
267
-              <UserField
268
-                :fields="item.fields"
269
-                :id="item.name"
270
-                @UpdateUserDefinedFields="UpdateUserDefinedFields"
271
-                :fieldValues="item.fields"
272
-              />
273
-            </div>
274
-          </div>
275
-        </div>-->
241
+        <UserField
242
+          :fields="propFields"
243
+          @UpdateUserDefinedFields="UpdateUserResidentialFields"
244
+        ></UserField>
276 245
         <div class="row">
277 246
           <div class="col-sm-12">
278 247
             <div class="section-header">
@@ -288,8 +257,8 @@
288 257
                 <input
289 258
                   class="form-control uniInput"
290 259
                   type="link"
291
-                  name="vtlink"
292
-                  id="vtlink"
260
+                  name="resVtlink"
261
+                  id="resVtlink"
293 262
                   v-model="property.virtualTour"
294 263
                 />
295 264
               </float-label>
@@ -304,8 +273,8 @@
304 273
                 <input
305 274
                   class="form-control uniInput"
306 275
                   type="link"
307
-                  name="vlink"
308
-                  id="vlink"
276
+                  name="resVlink"
277
+                  id="resVlink"
309 278
                   v-model="property.video"
310 279
                 />
311 280
               </float-label>
@@ -326,9 +295,13 @@
326 295
           :savedImages="propertyImages"
327 296
           @DefaultImage="UpdateDefaultImage"
328 297
         />
329
-        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">Save</button>
298
+        <button v-if="!wait" type="button" @click="SubmitData()" class="btn-solid-blue">
299
+          Save
300
+        </button>
330 301
         <div v-if="showPropertyTypeError">
331
-          <p class="alert myError">Missing fields. Please fill in all required fields. Marked with *</p>
302
+          <p class="alert myError">
303
+            Missing fields. Please fill in all required fields. Marked with *
304
+          </p>
332 305
         </div>
333 306
         <div v-if="wait" id="preloader"></div>
334 307
       </div>
@@ -353,7 +326,10 @@ export default {
353 326
     ImageLoad,
354 327
     VueEditor,
355 328
     carouselSection,
356
-    mapSection,
329
+    mapSection
330
+  },
331
+  props: {
332
+    propFields: {}
357 333
   },
358 334
   data() {
359 335
     return {
@@ -366,22 +342,17 @@ export default {
366 342
       customToolbar: [
367 343
         [{ header: [false, 1, 2, 3, 4, 5, 6] }],
368 344
         ["bold", "italic", "underline", "strike"],
369
-        [
370
-          { align: "" },
371
-          { align: "center" },
372
-          { align: "right" },
373
-          { align: "justify" },
374
-        ],
345
+        [{ align: "" }, { align: "center" }, { align: "right" }, { align: "justify" }],
375 346
         [{ list: "ordered" }, { list: "bullet" }, { list: "check" }],
376 347
         [{ script: "sub" }, { script: "super" }],
377
-        [{ indent: "-1" }, { indent: "+1" }],
348
+        [{ indent: "-1" }, { indent: "+1" }]
378 349
       ],
379 350
       error: "",
380 351
       addressSet: false,
381 352
       showPropertyTypeError: false,
382 353
       showDateError: false,
383 354
       user: Log.getUser(),
384
-      mayEdit: Log.isLoggedIn(),
355
+      mayEdit: Log.isLoggedIn()
385 356
     };
386 357
   },
387 358
   methods: {
@@ -396,7 +367,7 @@ export default {
396 367
       "getPropertyEditDisplay",
397 368
       "getPropertySavedOverviewFields",
398 369
       "getPropertySavedFields",
399
-      "getSavedPropertyData",
370
+      "getSavedPropertyData"
400 371
     ]),
401 372
     updateLocation(place) {
402 373
       this.addressSet = true;
@@ -418,10 +389,7 @@ export default {
418 389
         this.showPropertyTypeError = true;
419 390
       }
420 391
 
421
-      if (
422
-        this.salesType === "Rental" &&
423
-        this.property.dateAvailable === "undef"
424
-      ) {
392
+      if (this.salesType === "Rental" && this.property.dateAvailable === "undef") {
425 393
         this.showDateError = true;
426 394
       }
427 395
 
@@ -445,7 +413,7 @@ export default {
445 413
         }
446 414
         this.property.propertyImages.push({
447 415
           image: this.images[i],
448
-          isDefault: setAsDefault,
416
+          isDefault: setAsDefault
449 417
         });
450 418
       }
451 419
       this.property.propertyUserFields = this.propertyFieldValues;
@@ -453,7 +421,7 @@ export default {
453 421
       if (this.user) {
454 422
         this.property.userId = this.user.id;
455 423
       }
456
-      this.property.propertyUserFields.forEach((item) => {
424
+      this.property.propertyUserFields.forEach(item => {
457 425
         if (item.value === true) {
458 426
           item.value = "yes";
459 427
         } else if (item.value === false) {
@@ -462,12 +430,10 @@ export default {
462 430
       });
463 431
 
464 432
       this.saveProperty(this.property)
465
-        .then((fulfilled) => {
466
-          this.$router.push(
467
-            `/property/residential/property/${fulfilled.data.id}`
468
-          );
433
+        .then(fulfilled => {
434
+          this.$router.push(`/property/residential/property/${fulfilled.data.id}`);
469 435
         })
470
-        .catch((error) => {
436
+        .catch(error => {
471 437
           console.log(error.message);
472 438
         });
473 439
     },
@@ -487,11 +453,9 @@ export default {
487 453
     loadedImages(values) {
488 454
       this.images = values;
489 455
     },
490
-    UpdateUserDefinedFields(item) {
456
+    UpdateUserResidentialFields(item) {
491 457
       let update = false;
492
-      this.propertyFieldValues.forEach((element) => {
493
-        console.log(element);
494
-
458
+      this.propertyFieldValues.forEach(element => {
495 459
         if (element.userDefinedFieldId === item.userDefinedFieldId) {
496 460
           element.value = item.value;
497 461
           update = true;
@@ -525,11 +489,9 @@ export default {
525 489
         fields.push(arr.slice(i, (i += len)));
526 490
       }
527 491
       return fields;
528
-    },
492
+    }
529 493
   },
530 494
   mounted() {
531
-    console.log(this.propertyFields);
532
-
533 495
     this.wait = false;
534 496
     this.getProperty(0);
535 497
     this.clearPropertyImages();
@@ -562,14 +524,12 @@ export default {
562 524
       "propertyOverviewFields",
563 525
       "propertyFields",
564 526
       "property",
565
-      "propertyImages",
527
+      "propertyImages"
566 528
     ]),
567 529
     ...mapState("authentication", ["user"]),
568 530
     ...mapGetters("fees", ["getListingFee"]),
569 531
     sortFields() {
570
-      return this.propertyFields[0].fields.sort((a, b) =>
571
-        a.rank > b.rank ? 1 : -1
572
-      );
532
+      return this.propertyFields[0].fields.sort((a, b) => (a.rank > b.rank ? 1 : -1));
573 533
     },
574 534
     SalesTypeChanged() {
575 535
       // eslint-disable-next-line vue/no-side-effects-in-computed-properties
@@ -589,13 +549,13 @@ export default {
589 549
     },
590 550
     userFieldsArr() {
591 551
       return this.userFieldsArrFunc(this.propertyFields, 4);
592
-    },
552
+    }
593 553
   },
594 554
   watch: {
595 555
     SalesTypeChanged() {
596 556
       return null;
597
-    },
598
-  },
557
+    }
558
+  }
599 559
 };
600 560
 </script>
601 561
 

+ 6
- 4
src/store/modules/property/property.js View File

@@ -53,7 +53,9 @@ export default {
53 53
       state.statuses = stats;
54 54
     }
55 55
   },
56
-  getters: {},
56
+  getters: {
57
+    getFields: state => state.propertyFields
58
+  },
57 59
   actions: {
58 60
     getStatuses({ commit }) {
59 61
       axios
@@ -123,9 +125,9 @@ export default {
123 125
         .then(response => commit("setPropertyOverviewFields", response.data));
124 126
     },
125 127
     getPropertyFields({ commit }, propertyType) {
126
-      axios
127
-        .get(`/api/propertyFields/PropertyType/${propertyType}`)
128
-        .then(response => commit("setPropertyFields", response.data));
128
+      return axios.get(`/api/propertyFields/PropertyType/${propertyType}`).then(response => {
129
+        commit("setPropertyFields", response.data);
130
+      });
129 131
     },
130 132
     getSavedPropertyFields({ commit }, id) {
131 133
       axios

Loading…
Cancel
Save