Browse Source

Field formating

master
George Williams 5 years ago
parent
commit
14b7c0527e

+ 37
- 20
src/components/property/propertyUserField.vue View File

@@ -2,27 +2,31 @@
2 2
   <div class="form-group row">
3 3
     <div class="col-md-4 mb-2" v-for="(currentField, i) in fields" :key="i">
4 4
       <label>{{ currentField.name }}</label>
5
-      <input
6
-        v-if="currentField.type === 'number'"
7
-        class="form-control form-control-lg form-control-a"
8
-        type="number"
9
-        name="currentField.name"
10
-        id="currentField.id"
11
-        v-model="setFields[i]"
12
-        @change="UpdateSetFields(currentField, i)"
13
-      />
14
-      <input
15
-        v-if="currentField.type === 'text'"
16
-        class="form-control form-control-lg form-control-a"
17
-        type="text"
18
-        name="currentField.name"
19
-        id="currentField.id"
20
-        v-model="setFields[i]"
21
-        @change="UpdateSetFields(currentField, i)"
22
-      />
23
-      <div v-if="currentField.type === 'yesno'">
5
+      <div class="input-group-prepend">
6
+        <span class="input-group-text" style="color: #60CBEB">
7
+          <b>{{ GetFirstLetter(currentField.name) }}</b>
8
+        </span>
9
+        <input
10
+          v-if="currentField.type === 'number'"
11
+          class="form-control"
12
+          type="number"
13
+          name="currentField.name"
14
+          id="currentField.id"
15
+          v-model="setFields[i]"
16
+          @change="UpdateSetFields(currentField, i)"
17
+        />
18
+        <input
19
+          v-if="currentField.type === 'text'"
20
+          class="form-control"
21
+          type="text"
22
+          name="currentField.name"
23
+          id="currentField.id"
24
+          v-model="setFields[i]"
25
+          @change="UpdateSetFields(currentField, i)"
26
+        />
24 27
         <select
25
-          class="form-control form-control-lg form-control-a"
28
+          v-if="currentField.type === 'yesno'"
29
+          class="form-control"
26 30
           id="currentField.id"
27 31
           v-model="setFields[i]"
28 32
           @change="UpdateSetFields(currentField, i)"
@@ -54,6 +58,19 @@ export default {
54 58
       };
55 59
       this.$emit('UpdateUserDefinedFields', item);
56 60
     },
61
+    GetFirstLetter(value) {
62
+      if (value) {
63
+        return value.slice(0, 1);
64
+      }
65
+      return '';
66
+    },
57 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
+  // },
58 75
 };
59 76
 </script>

+ 18
- 17
src/components/timeshare/resort/unitPage.vue View File

@@ -37,7 +37,7 @@
37 37
             <div class="title-box-d">
38 38
               <h3 class="title-d">Facilities</h3>
39 39
             </div>
40
-            <ul>
40
+            <ul v-if="resort.prUnitFacilities">
41 41
               <li v-for="(item, i) in resort.prUnitFacilities.split('\n')" :key="i">{{item}}</li>
42 42
             </ul>
43 43
           </div>
@@ -104,25 +104,23 @@
104 104
                     type="text"
105 105
                     id="levy"
106 106
                     name="levy"
107
-                    :value="week.currentLevy"
107
+                    :value="formatPrice(week.currentLevy)"
108 108
                     disabled
109 109
                   />
110 110
                 </div>
111 111
               </div>
112 112
               <div class="col-md-6">
113 113
                 <label for="price">Price</label>
114
-                <div class="card-box-ico">
115
-                  <span class="ion-money">R</span>
114
+                <div class="property-price d-flex justify-content-center foo">
115
+                  <div class="card-header-c d-flex">
116
+                    <div class="card-box-ico">
117
+                      <span class="ion-money">R</span>
118
+                    </div>
119
+                    <div class="card-title-c align-self-center">
120
+                      <h5 class="title-c">{{ formatPrice(week.price) }}</h5>
121
+                    </div>
122
+                  </div>
116 123
                 </div>
117
-
118
-                <input
119
-                  class="form-control"
120
-                  type="text"
121
-                  name="price"
122
-                  id="price"
123
-                  :value="week.price"
124
-                  disabled
125
-                />
126 124
               </div>
127 125
             </div>
128 126
             <br />
@@ -230,10 +228,13 @@ export default {
230 228
   methods: {
231 229
     ...mapActions('resort', ['initResort']),
232 230
     ...mapActions('week', ['initWeek']),
233
-  },
234
-  formatPrice(value) {
235
-    const val = (value / 1).toFixed(2);
236
-    return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
231
+    formatPrice(value) {
232
+      if (value) {
233
+        const val = (value / 1).toFixed(2);
234
+        return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
235
+      }
236
+      return '';
237
+    },
237 238
   },
238 239
 };
239 240
 </script>

Loading…
Cancel
Save