George Williams 5 лет назад
Родитель
Сommit
a58993d33c

+ 16
- 14
src/components/admin/status/agentsUserManagementPage.vue Просмотреть файл

@@ -46,6 +46,9 @@
46 46
           <input v-model="searchItem" class="form-control" placeholder="Search ..." />
47 47
         </div>
48 48
       </div>
49
+      <div v-if="Delete === true">
50
+        <alert :text="'Private User removed successfully'" :type="'SUCCESS'" />
51
+      </div>
49 52
       <br />
50 53
       <table class="table table-bordered">
51 54
         <thead>
@@ -105,25 +108,15 @@
105 108
             <td>
106 109
               <button
107 110
                 type="button"
108
-                data-toggle="modal"
109
-                :data-target="'#myModal' + i"
110 111
                 class="btn"
111 112
                 style="margin:2px; color: #60CBEB"
113
+                @click="routerGoTo('/user/updateProfileInfo')"
112 114
               >Edit</button>
113
-              <div :id="'myModal' + i" class="modal fade" role="dialog">
114
-                <div class="modal-dialog modal-lg">
115
-                  <div class="modal-content">
116
-                    <div class="modal-header">
117
-                      <button type="button" class="close" data-dismiss="modal">&times;</button>
118
-                    </div>
119
-                    <Agency name="Agency" :isAddAgent="false" :item="item" />
120
-                  </div>
121
-                </div>
122
-              </div>
123 115
             </td>
124 116
             <td>
125 117
               <button
126 118
                 type="button"
119
+                @click="Delete(item.id)"
127 120
                 class="btn"
128 121
                 style="width: 85px; height:40px; color:#60CBEB"
129 122
               >Delete</button>
@@ -155,12 +148,17 @@ import _ from 'lodash';
155 148
 import ItemsPerPageList from '../../../assets/staticData/itemsPerPage';
156 149
 import BasePagination from '../../shared/basePagination.vue';
157 150
 import Agency from '../../user/registerAgencySection.vue';
151
+import alert from '../../shared/alert.vue';
158 152
 
159 153
 export default {
160 154
   name: 'agentManagementPage',
161 155
   components: {
162 156
     BasePagination,
163 157
     Agency,
158
+    alert,
159
+  },
160
+  props: {
161
+    delete: Boolean,
164 162
   },
165 163
   data() {
166 164
     return {
@@ -171,10 +169,11 @@ export default {
171 169
       visibleItemsPerPageCount: 0,
172 170
       currentPage: 1,
173 171
       item: {},
172
+      delete: false,
174 173
     };
175 174
   },
176 175
   methods: {
177
-    ...mapActions('register', ['getAgents']),
176
+    ...mapActions('register', ['getAgents', 'deleteAgent']),
178 177
     addNewAgent({ commit }) {
179 178
       axios
180 179
         .post('/api/agent')
@@ -206,6 +205,9 @@ export default {
206 205
         this.currentPage = 1;
207 206
       }
208 207
     },
208
+    Delete(id) {
209
+      this.deleteAgent(id);
210
+    },
209 211
   },
210 212
   mounted() {
211 213
     this.getAgents();
@@ -220,7 +222,7 @@ export default {
220 222
     }
221 223
   },
222 224
   computed: {
223
-    ...mapState('register', ['agents']),
225
+    ...mapState('register', ['agents', 'removeAgent']),
224 226
 
225 227
     SortDirection() {
226 228
       return this.reverse ? 'desc' : 'asc';

+ 85
- 18
src/components/admin/status/timeshareAdminPage.vue Просмотреть файл

@@ -1,44 +1,111 @@
1 1
 <template>
2
-  <!-- <section class="intro-single"> -->
3
-  <div class="container">
2
+  <div>
3
+    <br />
4 4
     <br />
5 5
     <br />
6 6
     <br />
7 7
     <br />
8 8
     <div class="row">
9
-      <div class="col-md-12 col-lg-8">
10
-        <!-- <div class="title-single-box"> -->
11
-        <!-- <h1 class="title-single" style="text-align:left;">Timeshare Admin</h1> -->
12
-        <!-- </div> -->
13
-        <div class="title-box-d">
14
-          <h1 class="title-d" style="text-align:left; font-size: 250%">Timeshare Admin</h1>
15
-        </div>
16
-        <br />
9
+      <div class="offset-1 col-md-3">
10
+        <button
11
+          type="button"
12
+          :class="{'form-control btn btn-primary ': (1===1), 'my-disable': (!selectedItems || selectedItems.length === 0)}"
13
+          value="Verify Week(s)"
14
+          :disabled="selectedItems.length > 0"
15
+        >{{ButtonMessage}}</button>
16
+        <div>{{Message}}</div>
17
+      </div>
18
+      <div class="offset-1 col-md-10">
19
+        <ListView
20
+          :items="items"
21
+          :allowMultipleSelect="true"
22
+          @onRowClick="onRowClick"
23
+          @onClearSelected="onClearSelected"
24
+          :columnsCount="15"
25
+          :title="'Pending Weeks'"
26
+          :showNew="false"
27
+        />
17 28
       </div>
18
-    </div>
19
-    <div id="table" class="col-xs-12 table-responsive">
20
-      <datatable :columns="columns" :data="rows"></datatable>
21 29
     </div>
22 30
   </div>
23
-  <!-- </section> -->
24 31
 </template>
25 32
 <script>
26 33
 import { mapState, mapActions } from 'vuex';
34
+import Log from '../../../assets/Log';
35
+import ListView from '../../shared/listView.vue';
27 36
 
28 37
 export default {
29 38
   name: 'TimeshareAdmin',
30
-  created() {
31
-    this.gettimeshareAdmin();
39
+  components: {
40
+    ListView,
41
+  },
42
+  data() {
43
+    return {
44
+      user: Log.getUser(),
45
+      selectedItems: [],
46
+      showMessage: false,
47
+    };
48
+  },
49
+  mounted() {
50
+    console.log(this.user.id);
51
+    this.getItems(this.user.id);
32 52
   },
33 53
   computed: {
34
-    ...mapState('status', ['timeshareAdmin']),
54
+    SelectedItems() {
55
+      const selectedArray = [];
56
+      this.selectedItems.forEach(x => selectedArray.push(this.items[x]));
57
+      return selectedArray;
58
+    },
59
+    ButtonMessage() {
60
+      let msg = '';
61
+      if (!(this.selectedItems.length > 0)) {
62
+        msg = 'No Items selected';
63
+      } else {
64
+        msg = 'Verify item';
65
+        if (this.selectedItems.length > 1) {
66
+          msg += 's';
67
+        }
68
+      }
69
+      return msg;
70
+    },
71
+    Message() {
72
+      let msg = '';
73
+      if (!(this.selectedItems.length > 0)) {
74
+        msg = 'Please select the item(s) to verify.';
75
+      } else {
76
+        msg = `${this.selectedItems.length}`;
77
+        if (this.selectedItems.length === 1) {
78
+          msg += ' item ';
79
+        } else msg += ' items ';
80
+        msg += 'selected. Click to verify or select more...';
81
+      }
82
+      return msg;
83
+    },
84
+    ...mapState('myWeeks', ['items']),
35 85
   },
36 86
   methods: {
37
-    ...mapActions('status', ['gettimeshareAdmin']),
87
+    ...mapActions('myWeeks', ['getItems']),
88
+    onRowClick(items) {
89
+      this.selectedItems = items;
90
+    },
91
+    onEdit(item) {
92
+      this.$router.push(`/timeshare/${item.id}`);
93
+    },
94
+    onClearSelected() {
95
+      this.selectedItems = [];
96
+    },
38 97
   },
39 98
 };
40 99
 </script>
41 100
 
42 101
 
43 102
 <style>
103
+.my-disable {
104
+  background-color: silver;
105
+  border-color: silver;
106
+}
107
+.my-disable:hover {
108
+  background-color: lightgray;
109
+  border-color: lightgray;
110
+}
44 111
 </style>

+ 18
- 19
src/components/admin/status/userManagementPage.vue Просмотреть файл

@@ -28,6 +28,9 @@
28 28
           <input v-model="searchItem" class="form-control" placeholder="Search ..." />
29 29
         </div>
30 30
       </div>
31
+      <div v-if="Delete === true">
32
+        <alert :text="'Private User removed successfully'" :type="'SUCCESS'" />
33
+      </div>
31 34
       <br />
32 35
       <table class="table table-bordered">
33 36
         <thead>
@@ -87,26 +90,18 @@
87 90
             <td>
88 91
               <button
89 92
                 type="button"
90
-                data-toggle="modal"
91
-                :data-target="'#myModal' + i"
92 93
                 class="btn"
93 94
                 style="margin:2px; color: #60CBEB"
95
+                @click="routerGoTo('/user/updateProfileInfo')"
94 96
               >Edit</button>
95
-              <div :id="'myModal' + i" class="modal fade" role="dialog">
96
-                <div class="modal-dialog modal-lg">
97
-                  <div class="modal-content">
98
-                    <div class="modal-header">
99
-                      <button type="button" class="close" data-dismiss="modal">&times;</button>
100
-                    </div>
101
-                    <div padding-left="20px">
102
-                      <Individual name="PrivateIndividual" :isAddIndividual="false" :item="item" />
103
-                    </div>
104
-                  </div>
105
-                </div>
106
-              </div>
107 97
             </td>
108 98
             <td>
109
-              <button type="button" class="btn" style="margin:2px; color: #60CBEB">Delete</button>
99
+              <button
100
+                type="button"
101
+                @click="Delete(item.id)"
102
+                class="btn"
103
+                style="margin:2px; color: #60CBEB"
104
+              >Delete</button>
110 105
             </td>
111 106
           </tr>
112 107
         </tbody>
@@ -133,13 +128,13 @@ import { mapState, mapActions } from 'vuex';
133 128
 import _ from 'lodash';
134 129
 import ItemsPerPageList from '../../../assets/staticData/itemsPerPage';
135 130
 import BasePagination from '../../shared/basePagination.vue';
136
-import Individual from '../../user/registerPage.vue';
131
+import alert from '../../shared/alert.vue';
137 132
 
138 133
 export default {
139 134
   name: 'userManagementPage',
140 135
   components: {
141 136
     BasePagination,
142
-    Individual,
137
+    alert,
143 138
   },
144 139
   data() {
145 140
     return {
@@ -152,8 +147,9 @@ export default {
152 147
       item: {},
153 148
     };
154 149
   },
150
+  props: {},
155 151
   methods: {
156
-    ...mapActions('register', ['getIndividuals']),
152
+    ...mapActions('register', ['getIndividuals', 'deleteIndividual']),
157 153
     routerGoTo(goTo) {
158 154
       this.$router.push(goTo);
159 155
     },
@@ -179,6 +175,9 @@ export default {
179 175
         this.currentPage = 1;
180 176
       }
181 177
     },
178
+    Delete(id) {
179
+      this.deleteIndividual(id);
180
+    },
182 181
   },
183 182
   mounted() {
184 183
     this.getIndividuals();
@@ -193,7 +192,7 @@ export default {
193 192
     }
194 193
   },
195 194
   computed: {
196
-    ...mapState('register', ['individuals']),
195
+    ...mapState('register', ['individuals', 'removeIndividual']),
197 196
 
198 197
     SortDirection() {
199 198
       return this.reverse ? 'desc' : 'asc';

+ 85
- 17
src/components/communication/templateDetail.vue Просмотреть файл

@@ -8,16 +8,13 @@
8 8
         <div class="col-md-12">
9 9
           <div class="d-flex">
10 10
             <div class="p-2 mr-auto">
11
-              <h2>Detailed Item</h2>
11
+              <h2>Template - Detail</h2>
12 12
             </div>
13 13
             <div class="p-2">
14
-              <div class="btn btn-primary myBackground">Add New</div>
14
+              <div class="btn btn-primary myBackground" v-if="!editable" @click="onEdit()">Edit</div>
15 15
             </div>
16 16
             <div class="p-2">
17
-              <div class="btn btn-primary myBackground">Edit</div>
18
-            </div>
19
-            <div class="p-2">
20
-              <div class="btn btn-primary myBackground">Close</div>
17
+              <div class="btn btn-primary myBackground" @click="onClose()">Save/Close</div>
21 18
             </div>
22 19
           </div>
23 20
         </div>
@@ -32,7 +29,14 @@
32 29
                 <b>I</b>
33 30
               </span>
34 31
             </div>
35
-            <input class="form-control" type="number" step="any" name="levy" v-model="item.id" />
32
+            <input
33
+              class="form-control"
34
+              type="number"
35
+              step="any"
36
+              name="levy"
37
+              v-model="item.id"
38
+              disabled
39
+            />
36 40
           </div>
37 41
         </div>
38 42
         <div class="col-md-8 text-left">
@@ -43,7 +47,14 @@
43 47
                 <b>N</b>
44 48
               </span>
45 49
             </div>
46
-            <input class="form-control" type="text" step="any" name="levy" v-model="item.name" />
50
+            <input
51
+              class="form-control"
52
+              type="text"
53
+              step="any"
54
+              name="levy"
55
+              v-model="item.name"
56
+              :disabled="!CanEdit"
57
+            />
47 58
           </div>
48 59
         </div>
49 60
         <div class="col-md-12">
@@ -57,7 +68,14 @@
57 68
                 <b>S</b>
58 69
               </span>
59 70
             </div>
60
-            <input class="form-control" type="text" step="any" name="levy" v-model="item.subject" />
71
+            <input
72
+              class="form-control"
73
+              type="text"
74
+              step="any"
75
+              name="levy"
76
+              v-model="item.subject"
77
+              :disabled="!CanEdit"
78
+            />
61 79
           </div>
62 80
         </div>
63 81
         <div class="col-md-12">
@@ -112,6 +130,7 @@
112 130
                     step="any"
113 131
                     name="levy"
114 132
                     v-model="item.body"
133
+                    :disabled="!CanEdit"
115 134
                   />
116 135
                 </div>
117 136
               </div>
@@ -135,28 +154,36 @@
135 154
               <h2>Coded Fields</h2>
136 155
             </div>
137 156
             <div class="p-2">
138
-              <div class="btn btn-primary myBackground" @click="addClose()">{{btnCaption}}</div>
157
+              <div
158
+                class="btn btn-primary myBackground"
159
+                @click="addClose()"
160
+                v-if="CanEdit"
161
+              >{{btnCaption}}</div>
139 162
             </div>
140 163
           </div>
141 164
         </div>
142
-        <div
143
-          class="col-md-12"
144
-          v-if="showNew"
145
-          style="background-color:rgba(255,255,255,0.75); border:silver solid thin;border-radius:10px;padding:10px;padding:10px 30px;"
146
-        >
147
-          <TemplateInnerItem />
165
+        <div class="col-md-12" v-if="showNew">
166
+          <TemplateInnerItem @onItemAdd="onItemAdd" />
148 167
         </div>
149 168
         <div class="col-md-12">
150 169
           <hr />
151 170
         </div>
152 171
         <div class="col-md-12">
153
-          <ListView :items="item.placeHolders" :hideSearch="true" />
172
+          <ListView
173
+            :items="item.placeHolders"
174
+            :hideSearch="true"
175
+            :showNew="false"
176
+            :deleteable="CanEdit"
177
+            :allowMultipleSelect="true"
178
+            @onDelete="onItemDelete"
179
+          />
154 180
         </div>
155 181
       </div>
156 182
     </div>
157 183
   </div>
158 184
 </template>
159 185
 <script>
186
+import { mapActions } from 'vuex';
160 187
 import ListView from '../shared/listView.vue';
161 188
 import TemplateInnerItem from './templateInnerItem.vue';
162 189
 
@@ -164,6 +191,7 @@ export default {
164 191
   data() {
165 192
     return {
166 193
       showNew: false,
194
+      openFields: false,
167 195
     };
168 196
   },
169 197
   components: {
@@ -172,18 +200,58 @@ export default {
172 200
   },
173 201
   props: {
174 202
     item: {},
203
+    editable: {
204
+      default: false,
205
+    },
175 206
   },
176 207
   computed: {
208
+    CanEdit() {
209
+      return this.editable || this.item.id === 0 || this.openFields;
210
+    },
177 211
     btnCaption() {
178 212
       return this.showNew ? 'Close' : 'New';
179 213
     },
214
+    ItemList() {
215
+      return this.item.placeHolders;
216
+    },
180 217
   },
181 218
   methods: {
219
+    ...mapActions('template', ['addItem', 'editItem']),
182 220
     addClose() {
183 221
       if (this.showNew) {
184 222
         this.showNew = false;
185 223
       } else this.showNew = true;
186 224
     },
225
+    onClose() {
226
+      if (this.item.id > 0) {
227
+        // edit
228
+        this.editItem(this.item);
229
+      } else {
230
+        // add.
231
+        this.addItem(this.item);
232
+      }
233
+      console.log(JSON.stringify(this.item));
234
+      this.$emit('onClose');
235
+    },
236
+    onItemDelete(item) {
237
+      this.item.placeHolders = _.remove(
238
+        this.item.placeHolders,
239
+        x => x !== item,
240
+      );
241
+    },
242
+    onEdit() {
243
+      this.openFields = true;
244
+    },
245
+    onItemAdd(item) {
246
+      const myList = this.item.placeHolders ? this.item.placeHolders : [];
247
+      myList.push({
248
+        name: item.name,
249
+        boundTo: item.property,
250
+        boundToClassDisplay: item.class.name,
251
+        boundToClass: item.class.fullName,
252
+      });
253
+      this.item.placeHolders = myList;
254
+    },
187 255
   },
188 256
 };
189 257
 </script>

+ 26
- 1
src/components/communication/templateInnerItem.vue Просмотреть файл

@@ -1,5 +1,8 @@
1 1
 <template>
2 2
   <div class="row">
3
+    <div class="col-md-12" v-if="message !== undefined">
4
+      <Alert :text="message" :type="'ERROR'" />
5
+    </div>
3 6
     <div class="col-md-3">
4 7
       <input
5 8
         class="form-control"
@@ -21,19 +24,24 @@
21 24
       </select>
22 25
     </div>
23 26
     <div class="col-md-3">
24
-      <div class="btn btn-primary myBackground w-100">Add</div>
27
+      <div class="btn btn-primary myBackground w-100" @click="onItemAdd()">Add</div>
25 28
     </div>
26 29
   </div>
27 30
 </template>
28 31
 <script>
29 32
 import { mapState, mapActions } from 'vuex';
33
+import Alert from '../shared/alert.vue';
30 34
 
31 35
 export default {
36
+  components: {
37
+    Alert,
38
+  },
32 39
   mounted() {
33 40
     this.init();
34 41
   },
35 42
   data() {
36 43
     return {
44
+      message: undefined,
37 45
       item: {
38 46
         name: undefined,
39 47
         class: undefined,
@@ -49,6 +57,23 @@ export default {
49 57
     onClassChanged() {
50 58
       this.getProperties(this.item.class);
51 59
     },
60
+    onItemAdd() {
61
+      let msg = '';
62
+      if (this.item.name === undefined) {
63
+        msg += 'Please give a name...';
64
+      }
65
+      if (this.item.class == undefined) {
66
+        msg += 'Please choose a class...';
67
+      }
68
+      if (this.item.property == undefined) {
69
+        msg += 'Please choose a property...';
70
+      }
71
+      if (msg.length > 0) {
72
+        this.message = msg;
73
+      } else {
74
+        this.$emit('onItemAdd', this.item);
75
+      }
76
+    },
52 77
   },
53 78
 };
54 79
 </script>

+ 14
- 4
src/components/communication/templatePage.vue Просмотреть файл

@@ -13,10 +13,10 @@
13 13
     </div>
14 14
     <div class="row">
15 15
       <div :class="listClass">
16
-        <ListView :items="list" @onRowClick="onRowClick" />
16
+        <ListView :items="list" @onRowClick="onRowClick" @onNew="onNew" :showNew="true" />
17 17
       </div>
18 18
       <div class="col-md-6" v-if="showDetailView">
19
-        <DetailView :item="detailItem" />
19
+        <DetailView :item="detailItem" @onClose="onDetailClose" :editable="clickedNew" />
20 20
       </div>
21 21
     </div>
22 22
 
@@ -33,6 +33,7 @@ export default {
33 33
   data() {
34 34
     return {
35 35
       detailItem: undefined,
36
+      clickedNew: false,
36 37
     };
37 38
   },
38 39
   components: {
@@ -56,8 +57,17 @@ export default {
56 57
   methods: {
57 58
     ...mapActions('template', ['getList']),
58 59
     onRowClick(item) {
59
-      console.log(item);
60
-      this.detailItem = item;
60
+      if (this.detailItem !== item) {
61
+        this.detailItem = item;
62
+      } else this.detailItem = undefined;
63
+      this.clickedNew = false;
64
+    },
65
+    onNew() {
66
+      this.detailItem = {};
67
+      this.clickedNew = true;
68
+    },
69
+    onDetailClose() {
70
+      this.detailItem = undefined;
61 71
     },
62 72
   },
63 73
 };

+ 102
- 11
src/components/shared/listView.vue Просмотреть файл

@@ -2,14 +2,35 @@
2 2
 /* eslint-disable guard-for-in */
3 3
 <template>
4 4
   <div>
5
-    <div class="d-flex justify-content-between" v-if="!hideSearch">
5
+    <div style="height:5px"></div>
6
+    <div class="d-flex justify-content-between table-title">
7
+      <div class="p-2" v-if="!hideSearch">
8
+        <input v-model="searchItem" class="form-control" placeholder="Search...." />
9
+      </div>
10
+      <div class="p-2" v-if="title">
11
+        <h2>{{title}}</h2>
12
+      </div>
6 13
       <div class="p-2">
7
-        <input v-model="searchItem" class="form-control" placeholder="Search ..." />
14
+        <div class="d-flex flex-row">
15
+          <div class="p2" v-if="selectedItems.length > 0">
16
+            <div
17
+              class="btn btn-primary myBackground btn-width"
18
+              @click="onClearSelected()"
19
+            >Clear Selected</div>
20
+          </div>
21
+          <div class="p2" v-if="showNew">
22
+            <div class="btn btn-primary myBackground btn-width" @click="onNew()">New</div>
23
+          </div>
24
+        </div>
8 25
       </div>
9 26
     </div>
10
-    <div v-if="items && items.length > 0">
11
-      <table id="table" class="table table-bordered table-hover">
12
-        <thead>
27
+    <div style="height:5px"></div>
28
+    <div v-if="items && items.length > 0" class="table-responsive">
29
+      <table
30
+        id="table"
31
+        :class="{'table table-bordered table-hover': (1 === 1), 'table-sm': compact}"
32
+      >
33
+        <thead class="my-table table-header">
13 34
           <tr class="dnd-moved">
14 35
             <th v-for="(column, c) in Columns" :key="c">
15 36
               <div @click="sortBy(column)">{{ column }}</div>
@@ -18,12 +39,12 @@
18 39
             <th v-if="deleteable"></th>
19 40
           </tr>
20 41
         </thead>
21
-        <tbody>
42
+        <tbody class="my-table">
22 43
           <tr
23 44
             v-for="(item, i) in DisplayItems"
24 45
             :key="i"
25
-            class="text-left dnd-moved"
26
-            @click="onRowClick(item)"
46
+            @click="onRowClick(item, i)"
47
+            :class="{'selected': isSelected(i), 'cursor-pointer': allowSelect}"
27 48
           >
28 49
             <td
29 50
               v-for="(column, c) in Columns"
@@ -38,7 +59,7 @@
38 59
           </tr>
39 60
         </tbody>
40 61
       </table>
41
-      <div class="d-flex justify-content-between">
62
+      <div class="d-flex justify-content-between" v-if="showPager">
42 63
         <div class="p-1">{{ currentPage + ' / ' + PageCount }}</div>
43 64
         <div class="p-1">
44 65
           <BasePagination
@@ -93,9 +114,21 @@ export default {
93 114
     }
94 115
   },
95 116
   props: {
117
+    compact: {
118
+      default: true,
119
+    },
120
+    allowSelect: {
121
+      default: true,
122
+    },
123
+    allowMultipleSelect: {
124
+      default: false,
125
+    },
96 126
     hideSearch: {
97 127
       default: false,
98 128
     },
129
+    showNew: {
130
+      default: true,
131
+    },
99 132
     items: undefined,
100 133
     editable: {
101 134
       default: false,
@@ -106,9 +139,16 @@ export default {
106 139
     columnsCount: {
107 140
       default: 6,
108 141
     },
142
+    showPager: {
143
+      default: true,
144
+    },
145
+    title: {
146
+      default: undefined,
147
+    },
109 148
   },
110 149
   data() {
111 150
     return {
151
+      selectedItems: [],
112 152
       showControl: false,
113 153
       sortKey: '',
114 154
       reverse: false,
@@ -119,6 +159,17 @@ export default {
119 159
     };
120 160
   },
121 161
   methods: {
162
+    onClearSelected() {
163
+      this.selectedItems = [];
164
+      this.$emit('onClearSelected');
165
+    },
166
+    isSelected(i) {
167
+      const ind = this.getActualIndex(i);
168
+      return _.some(this.selectedItems, x => x === ind);
169
+    },
170
+    onNew() {
171
+      this.$emit('onNew');
172
+    },
122 173
     isObject(item) {
123 174
       return !!item && item.constructor === Object;
124 175
     },
@@ -128,8 +179,20 @@ export default {
128 179
     onDelete(item) {
129 180
       this.$emit('onDelete', item);
130 181
     },
131
-    onRowClick(item) {
132
-      this.$emit('onRowClick', item);
182
+    onRowClick(item, i) {
183
+      const ind = this.getActualIndex(i);
184
+      if (_.some(this.selectedItems, x => x === ind)) {
185
+        this.selectedItems = this.selectedItems.filter(x => x !== ind);
186
+      } else {
187
+        if (!this.allowMultipleSelect) {
188
+          this.selectedItems = [];
189
+        }
190
+        this.selectedItems.push(ind);
191
+      }
192
+      this.$emit('onRowClick', this.selectedItems);
193
+    },
194
+    getActualIndex(index) {
195
+      return (this.currentPage - 1) * this.visibleItemsPerPageCount + index;
133 196
     },
134 197
     changeColumn(title, checked) {
135 198
       if (checked) {
@@ -248,4 +311,32 @@ th[draggable] a {
248 311
 .over {
249 312
   background-color: rgba(0, 0, 255, 0.35);
250 313
 }
314
+.my-border {
315
+  border: solid 3px silver;
316
+}
317
+.selected {
318
+  background-color: rgba(96, 203, 235, 0.5);
319
+  border: white 2px double;
320
+}
321
+.selected:hover {
322
+  background-color: rgba(96, 203, 235, 0.85);
323
+}
324
+.btn-width {
325
+  width: 125px;
326
+}
327
+.table-title {
328
+  padding: 5px;
329
+  border: rgba(200, 200, 200, 0.66) double 2px;
330
+  border-radius: 5px;
331
+  background-color: rgba(96, 203, 235, 0.25);
332
+}
333
+.table-title:hover {
334
+  background-color: rgba(96, 203, 235, 0.4);
335
+}
336
+.table-header {
337
+  background-color: rgba(200, 200, 200, 0.66);
338
+}
339
+.my-table {
340
+  border: rgba(150, 150, 150, 0.75) 3px double;
341
+}
251 342
 </style>

+ 17
- 15
src/components/shared/navBar.vue Просмотреть файл

@@ -129,7 +129,7 @@
129 129
                 aria-haspopup="true"
130 130
                 aria-expanded="false"
131 131
                 v-if="isLoggedIn"
132
-              >Admin</a>
132
+              >{{ NAME }}</a>
133 133
               <div class="dropdown-menu" aria-labelledby="navbarDropdown">
134 134
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/status/list')">Status</a>
135 135
                 <a
@@ -144,6 +144,11 @@
144 144
                   class="dropdown-item cursor-pointer"
145 145
                   @click="routerGoTo('/unitConfiguration/list')"
146 146
                 >Unit Configuration</a>
147
+                <a
148
+                  class="dropdown-item cursor-pointer"
149
+                  @click="routerGoTo('/communication/template')"
150
+                >Templates</a>
151
+                <hr />
147 152
                 <a
148 153
                   class="dropdown-item cursor-pointer"
149 154
                   @click="routerGoTo('/status/userManagementPage')"
@@ -160,12 +165,17 @@
160 165
                   class="dropdown-item cursor-pointer"
161 166
                   @click="routerGoTo('/propertyTypes/list')"
162 167
                 >Property Types</a>
168
+                <hr />
163 169
                 <a
164 170
                   class="dropdown-item cursor-pointer"
165 171
                   @click="routerGoTo('/searchLog')"
166 172
                 >Search Logs</a>
167 173
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Offers')">Offers</a>
168 174
                 <a class="dropdown-item cursor-pointer" @click="routerGoTo('/Carousel')">Carousel</a>
175
+                <a
176
+                  class="dropdown-item cursor-pointer"
177
+                  @click="routerGoTo('/user/updateProfileInfo')"
178
+                >Update Info</a>
169 179
               </div>
170 180
             </li>
171 181
             <li class="nav-item dropdown" v-if="!isLoggedIn">
@@ -184,16 +194,6 @@
184 194
                 <a class="nav-link" @click="logout(routerGoTo('/user/login'))">Logout</a>
185 195
               </span>
186 196
             </li>
187
-            <li>
188
-              <span v-if="isLoggedIn">
189
-                <a @click="routerGoTo('/user/updateProfileInfo')">
190
-                  Welcome!
191
-                  <br />
192
-                  {{ NAME }}
193
-                </a>
194
-              </span>
195
-              <span v-else></span>
196
-            </li>
197 197
           </ul>
198 198
         </div>
199 199
       </div>
@@ -214,6 +214,7 @@
214 214
 
215 215
 <script>
216 216
 import { mapState, mapActions } from 'vuex';
217
+import Log from '../../assets/Log';
217 218
 
218 219
 export default {
219 220
   computed: {
@@ -224,11 +225,12 @@ export default {
224 225
       'person',
225 226
       'token',
226 227
     ]),
227
-    NAME() {
228
-      return this.person.fullName;
229
-    },
230 228
     isLoggedIn() {
231
-      return this.token !== null && this.token !== undefined;
229
+      console.log(Log.isLoggedIn());
230
+      return Log.isLoggedIn();
231
+    },
232
+    NAME() {
233
+      return Log.getPerson().name;
232 234
     },
233 235
     // eslint-disable-next-line vue/return-in-computed-property
234 236
     Logout() {

+ 1
- 1
src/components/timeshare/sell/sellPage.vue Просмотреть файл

@@ -296,7 +296,7 @@
296 296
                 </div>
297 297
               </div>
298 298
             </div>
299
-            <DetailIndividual :currentUser="sellItem.owner" :showBank="true" />
299
+            <DetailIndividual :currentUser="sellItem.owner" :showBank="true" :showAddress="true" />
300 300
             <hr />
301 301
           </div>
302 302
           <br />

+ 52
- 88
src/components/user/updateProfileInfo.vue Просмотреть файл

@@ -2,116 +2,80 @@
2 2
   <!-- eslint-disable max-len -->
3 3
   <div class="container">
4 4
     <br />
5
-    <div class="row">
6
-      <div class="col-md-12 col-lg-8">
7
-        <div class="title-box-d">
8
-          <h1 class="title-d" style="text-align:left; font-size: 250%">Update Profile Info</h1>
9
-        </div>
10
-      </div>
5
+    <div class="title-box-d">
6
+      <h1 class="title-d" style="text-align:left; font-size: 250%">Update Profile Info</h1>
11 7
     </div>
12
-    <div class="container">
13
-      <table class="table table-bordered">
14
-        <thead>
15
-          <tr>
16
-            <th>ID</th>
17
-            <th>Name</th>
18
-            <th>Surname</th>
19
-            <th>Cell Number</th>
20
-            <th>Telephone Number</th>
21
-            <th>Email</th>
22
-            <th>Role</th>
23
-            <th>Modify</th>
24
-          </tr>
25
-        </thead>
26
-        <tbody>
27
-          <tr>
28
-            <td>{{ user.id }}</td>
29
-            <td>{{ indiv.name }}</td>
30
-            <td>{{ indiv.surname }}</td>
31
-            <td>{{ indiv.cellNumber }}</td>
32
-            <td>{{ indiv.landlineNumber }}</td>
33
-            <td>{{ indiv.emailAddress }}</td>
34
-            <td>{{ user.role }}</td>
35
-            <td>
36
-              <button
37
-                type="button"
38
-                data-toggle="modal"
39
-                :data-target="'#myModal' + i"
40
-                class="btn"
41
-                style="margin:2px; color: #60CBEB"
42
-              >Edit</button>
43
-              <div :id="'myModal' + i" class="modal fade" role="dialog">
44
-                <div class="modal-dialog modal-lg">
45
-                  <div class="modal-content">
46
-                    <div class="modal-header">
47
-                      <button type="button" class="close" data-dismiss="modal">&times;</button>
48
-                    </div>
49
-                    <div padding-left="20px">
50
-                      <Individual name="PrivateIndividual" :isAddIndividual="false" :item="item" />
51
-                    </div>
52
-                  </div>
53
-                </div>
54
-              </div>
55
-            </td>
56
-          </tr>
57
-        </tbody>
58
-      </table>
8
+    <div class="row mb-4">
9
+      <div class="container col-md-10">
10
+        <form
11
+          id="mainForm"
12
+          method="POST"
13
+          action="/to-sell"
14
+          accept-charset="UTF-8"
15
+          enctype="multipart/form-data"
16
+        >
17
+          <div class="col-md-12" style="text-align:left"></div>
18
+          <DetailIndividual :currentUser="sellItem.owner" :showBank="true" :showAddress="true" />
19
+        </form>
20
+      </div>
59 21
     </div>
60
-    <br />
61 22
   </div>
62 23
 </template>
63 24
 
64 25
 <script>
65 26
 import { mapState, mapActions, mapGetters } from 'vuex';
66
-import Individual from './registerPage.vue';
27
+import DetailIndividual from './timeshareIndividual.vue';
67 28
 
68 29
 export default {
69 30
   name: 'UpdateInfo',
70
-  components: {
71
-    Individual,
72
-  },
73
-  props: {
74
-    currentUser: {
75
-      name: undefined,
76
-      surname: undefined,
77
-      idNumber: undefined,
78
-      companyRegNumber: undefined,
79
-      emailAddress: undefined,
80
-      cellNumber: undefined,
81
-      landlineNumer: undefined,
82
-      bankingDetails: {},
83
-      address: {},
84
-    },
85
-    showChangeCurrentUser: {
86
-      default: false,
87
-    },
88
-    showBank: {
89
-      default: false,
90
-    },
91
-    showAddress: {
92
-      default: false,
93
-    },
94
-  },
95 31
   data() {
96
-    return {
97
-      item: {},
98
-    };
32
+    return { selectedItem: {} };
33
+  },
34
+  props: {},
35
+  components: {
36
+    DetailIndividual,
99 37
   },
100 38
   mounted() {
101
-    if (!this.currentUser) {
102
-      if (this.user) {
103
-        this.getIndividual(this.user.id);
104
-      }
105
-    }
39
+    this.selectedItem = this.currentUser;
106 40
   },
107 41
   computed: {
42
+    ...mapState('timeshare', [
43
+      'resorts',
44
+      'regions',
45
+      'detailedRegion',
46
+      'seasons',
47
+      'result',
48
+      'resortBedrooms',
49
+      'maxSleep',
50
+      'bankedEntities',
51
+      'sellItem',
52
+      'agencies',
53
+      'agents',
54
+    ]),
108 55
     ...mapState('individual', ['indiv']),
56
+    ...mapState('authentication', ['isLoggedIn']),
109 57
     ...mapGetters({
110 58
       user: 'authentication/getUser',
59
+      person: 'authentication/getPerson',
111 60
     }),
61
+    isLoggedIn() {
62
+      return this.user && this.person;
63
+    },
112 64
   },
113 65
   methods: {
114 66
     ...mapActions('individual', ['getIndividual']),
67
+    onSelectedItemItemChange(item) {
68
+      this.currentUser = item;
69
+    },
115 70
   },
116 71
 };
117 72
 </script>
73
+<style>
74
+.myWell {
75
+  width: 100%;
76
+  background-color: #60cbeb;
77
+  border-radius: 6px;
78
+  padding: 5px;
79
+  margin: 3px;
80
+}
81
+</style>

+ 17
- 0
src/store/modules/communication/template.js Просмотреть файл

@@ -5,6 +5,7 @@ export default {
5 5
   state: {
6 6
     list: [],
7 7
     item: {},
8
+    message: undefined,
8 9
   },
9 10
   mutations: {
10 11
     setList(state, list) {
@@ -21,5 +22,21 @@ export default {
21 22
         .then(result => commit('setList', result.data))
22 23
         .catch(console.error);
23 24
     },
25
+    addItem({
26
+      dispatch,
27
+    }, item) {
28
+      axios
29
+        .post('/api/template', item)
30
+        .then(() => dispatch('getList'))
31
+        .catch(console.error);
32
+    },
33
+    editItem({
34
+      dispatch,
35
+    }, item) {
36
+      axios
37
+        .put(`/api/template/${item.id}`, item)
38
+        .then(() => dispatch('getList'))
39
+        .catch(console.error);
40
+    },
24 41
   },
25 42
 };

+ 12
- 14
src/store/modules/user/individual.js Просмотреть файл

@@ -18,10 +18,7 @@ export default {
18 18
   },
19 19
   getters: {},
20 20
   actions: {
21
-    getIndividual({
22
-      commit,
23
-      rootGetters,
24
-    }, userId) {
21
+    getIndividual({ commit, rootGetters }, userId) {
25 22
       let id = 0;
26 23
       if (!userId || userId === 0) {
27 24
         const rootItem = rootGetters['authentication/getUser'];
@@ -30,18 +27,19 @@ export default {
30 27
       axios
31 28
         .get(`/api/individual/getIndividual/${id}`)
32 29
         .then(r => commit('setItem', {
33
-          name: 'indiv',
34
-          value: r.data,
35
-        }))
30
+            name: 'indiv',
31
+            value: r.data,
32
+          }),)
36 33
         .catch(console.error);
37 34
     },
38
-    getAllIndividuals({
39
-      commit,
40
-    }) {
41
-      axios.get('/api/individual/getAllIndividuals').then(x => commit('setItem', {
42
-        name: 'items',
43
-        value: x.data,
44
-      })).catch(console.error);
35
+    getAllIndividuals({ commit }) {
36
+      axios
37
+        .get('/api/individual/getAllIndividuals')
38
+        .then(x => commit('setItem', {
39
+            name: 'items',
40
+            value: x.data,
41
+          }),)
42
+        .catch(console.error);
45 43
     },
46 44
   },
47 45
 };

+ 22
- 27
src/store/modules/user/register.js Просмотреть файл

@@ -54,10 +54,8 @@ export default {
54 54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
55 55
     },
56 56
     updateAgency(state, type) {
57
-      state.registerAgency.find(item => item.id === type.id).eaabeffcNumber = type
58
-        .eaabeffcNumber;
59
-      state.registerAgency.find(item => item.id === type.id).companyRegNumber = type
60
-        .companyRegNumber;
57
+      state.registerAgency.find(item => item.id === type.id).eaabeffcNumber = type.eaabeffcNumber;
58
+      state.registerAgency.find(item => item.id === type.id).companyRegNumber =        type.companyRegNumber;
61 59
     },
62 60
     clearIndividual(state) {
63 61
       state.registerIndividual = {
@@ -90,20 +88,19 @@ export default {
90 88
     removeAgency(state, id) {
91 89
       state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
92 90
     },
91
+    removeAgent(state, id) {
92
+      state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
93
+    },
93 94
   },
94 95
   getters: {},
95 96
   actions: {
96
-    getIndividuals({
97
-      commit,
98
-    }) {
97
+    getIndividuals({ commit }) {
99 98
       axios
100 99
         .get('/api/individual')
101 100
         .then(result => commit('setIndividuals', result.data))
102 101
         .catch(console.error);
103 102
     },
104
-    getAgents({
105
-      commit,
106
-    }) {
103
+    getAgents({ commit }) {
107 104
       axios
108 105
         .get('/api/agent')
109 106
         .then(result => commit('setAgents', result.data))
@@ -118,25 +115,19 @@ export default {
118 115
     //     .catch(console.error);
119 116
     // },
120 117
 
121
-    saveIndividual({
122
-      commit,
123
-    }, item) {
118
+    saveIndividual({ commit }, item) {
124 119
       axios
125 120
         .post('/api/register/register', item)
126 121
         .then(result => commit('addIndividual', result.data))
127 122
         .catch(console.error);
128 123
     },
129
-    saveAgency({
130
-      commit,
131
-    }, item) {
124
+    saveAgency({ commit }, item) {
132 125
       axios
133 126
         .post('/api/register/registeragency', item)
134 127
         .then(result => commit('addAgency', result.data))
135 128
         .catch(console.error);
136 129
     },
137
-    saveAgent({
138
-      commit,
139
-    }, item) {
130
+    saveAgent({ commit }, item) {
140 131
       axios
141 132
         .post('/api/agent', item)
142 133
         .then(result => commit('addAgent', result.data))
@@ -168,14 +159,18 @@ export default {
168 159
     // }) {
169 160
     //   commit('clearAgency');
170 161
     // },
171
-    // deleteIndividual({
172
-    //   commit,
173
-    // }, id) {
174
-    //   axios
175
-    //     .delete(`/api/individual/${id}`)
176
-    //     .then(result => commit('removeIndividual', id))
177
-    //     .catch(console.error);
178
-    // },
162
+    deleteIndividual({ commit }, id) {
163
+      axios
164
+        .delete(`/api/individual/${id}`)
165
+        .then(result => commit('removeIndividual', id))
166
+        .catch(console.error);
167
+    },
168
+    deleteAgent({ commit }, id) {
169
+      axios
170
+        .delete(`/api/agent/${id}`)
171
+        .then(result => commit('removeAgent', id))
172
+        .catch(console.error);
173
+    },
179 174
     // deleteAgency({
180 175
     //   commit,
181 176
     // }, id) {

Загрузка…
Отмена
Сохранить