Pārlūkot izejas kodu

UserFields Optamization

master
30117125 4 gadus atpakaļ
vecāks
revīzija
601f10f38c

+ 35
- 16
src/components/property/ListProperty/contentSection.vue Parādīt failu

1
 <template>
1
 <template>
2
   <section id="services">
2
   <section id="services">
3
+    <div v-if="wait" id="preloader"></div>
3
     <div class="container">
4
     <div class="container">
4
       <div class="col-12">
5
       <div class="col-12">
5
         <h1>List your property</h1>
6
         <h1>List your property</h1>
16
               role="tab"
17
               role="tab"
17
               aria-controls="pills-residential"
18
               aria-controls="pills-residential"
18
               aria-selected="true"
19
               aria-selected="true"
19
-              @click="getPropTypeResidential"
20
               >RESIDENTIAL</a
20
               >RESIDENTIAL</a
21
             >
21
             >
22
           </li>
22
           </li>
29
               role="tab"
29
               role="tab"
30
               aria-controls="pills-commercial"
30
               aria-controls="pills-commercial"
31
               aria-selected="false"
31
               aria-selected="false"
32
-              @click="getPropTypeCommercial"
33
               >COMMERCIAL</a
32
               >COMMERCIAL</a
34
             >
33
             >
35
           </li>
34
           </li>
44
             role="tabpanel"
43
             role="tabpanel"
45
             aria-labelledby="pills-residential-tab"
44
             aria-labelledby="pills-residential-tab"
46
           >
45
           >
47
-            <ResidentialCreate />
46
+            <ResidentialCreate :propFields="residentialFields" />
48
           </div>
47
           </div>
49
           <div
48
           <div
50
             class="tab-pane fade"
49
             class="tab-pane fade"
52
             role="tabpanel"
51
             role="tabpanel"
53
             aria-labelledby="pills-commercial-tab"
52
             aria-labelledby="pills-commercial-tab"
54
           >
53
           >
55
-            <CommercialCreate />
54
+            <CommercialCreate :propFields="commercialFields" />
56
           </div>
55
           </div>
57
         </div>
56
         </div>
58
       </div>
57
       </div>
70
     ResidentialCreate,
69
     ResidentialCreate,
71
     CommercialCreate
70
     CommercialCreate
72
   },
71
   },
72
+  data() {
73
+    return {
74
+      wait: true,
75
+      residentialFields: [],
76
+      commercialFields: []
77
+    };
78
+  },
73
   methods: {
79
   methods: {
74
     ...mapActions("property", ["getPropertyTypes", "getPropertyFields"]),
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
   computed: {
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
 </script>
111
 </script>
93
 
112
 

+ 7
- 12
src/components/property/commercial/createProperty/commercialCreateNew.vue Parādīt failu

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

+ 9
- 9
src/components/property/propertyImage.vue Parādīt failu

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

+ 32
- 42
src/components/property/propertyUserField.vue Parādīt failu

1
 <template>
1
 <template>
2
   <div class="row">
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
       </div>
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
         <input
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
           type="checkbox"
33
           type="checkbox"
47
-          id="currentField.id"
34
+          :id="currentField.id"
35
+          :name="currentField.name"
48
           style="margin-left:-5px; margin-top:10px"
36
           style="margin-left:-5px; margin-top:10px"
49
           v-model="setFields[i]"
37
           v-model="setFields[i]"
50
           @change="UpdateSetFields(currentField, i)"
38
           @change="UpdateSetFields(currentField, i)"
71
         userDefinedFieldId: field.id,
59
         userDefinedFieldId: field.id,
72
         value: this.setFields[index]
60
         value: this.setFields[index]
73
       };
61
       };
74
-      this.$emit("UpdateUserDefinedFields", item);
62
+      if (item) {
63
+        this.$emit("UpdateUserDefinedFields", item);
64
+      }
75
     },
65
     },
76
     GetFirstLetter(value) {
66
     GetFirstLetter(value) {
77
       if (value) {
67
       if (value) {

+ 77
- 117
src/components/property/residential/createProperty/residentialCreateNew.vue Parādīt failu

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

+ 6
- 4
src/store/modules/property/property.js Parādīt failu

53
       state.statuses = stats;
53
       state.statuses = stats;
54
     }
54
     }
55
   },
55
   },
56
-  getters: {},
56
+  getters: {
57
+    getFields: state => state.propertyFields
58
+  },
57
   actions: {
59
   actions: {
58
     getStatuses({ commit }) {
60
     getStatuses({ commit }) {
59
       axios
61
       axios
123
         .then(response => commit("setPropertyOverviewFields", response.data));
125
         .then(response => commit("setPropertyOverviewFields", response.data));
124
     },
126
     },
125
     getPropertyFields({ commit }, propertyType) {
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
     getSavedPropertyFields({ commit }, id) {
132
     getSavedPropertyFields({ commit }, id) {
131
       axios
133
       axios

Notiek ielāde…
Atcelt
Saglabāt