George Williams 5 år sedan
förälder
incheckning
a58993d33c

+ 16
- 14
src/components/admin/status/agentsUserManagementPage.vue Visa fil

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

+ 85
- 18
src/components/admin/status/timeshareAdminPage.vue Visa fil

1
 <template>
1
 <template>
2
-  <!-- <section class="intro-single"> -->
3
-  <div class="container">
2
+  <div>
3
+    <br />
4
     <br />
4
     <br />
5
     <br />
5
     <br />
6
     <br />
6
     <br />
7
     <br />
7
     <br />
8
     <div class="row">
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
       </div>
28
       </div>
18
-    </div>
19
-    <div id="table" class="col-xs-12 table-responsive">
20
-      <datatable :columns="columns" :data="rows"></datatable>
21
     </div>
29
     </div>
22
   </div>
30
   </div>
23
-  <!-- </section> -->
24
 </template>
31
 </template>
25
 <script>
32
 <script>
26
 import { mapState, mapActions } from 'vuex';
33
 import { mapState, mapActions } from 'vuex';
34
+import Log from '../../../assets/Log';
35
+import ListView from '../../shared/listView.vue';
27
 
36
 
28
 export default {
37
 export default {
29
   name: 'TimeshareAdmin',
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
   computed: {
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
   methods: {
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
 </script>
99
 </script>
41
 
100
 
42
 
101
 
43
 <style>
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
 </style>
111
 </style>

+ 18
- 19
src/components/admin/status/userManagementPage.vue Visa fil

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

+ 85
- 17
src/components/communication/templateDetail.vue Visa fil

8
         <div class="col-md-12">
8
         <div class="col-md-12">
9
           <div class="d-flex">
9
           <div class="d-flex">
10
             <div class="p-2 mr-auto">
10
             <div class="p-2 mr-auto">
11
-              <h2>Detailed Item</h2>
11
+              <h2>Template - Detail</h2>
12
             </div>
12
             </div>
13
             <div class="p-2">
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
             </div>
15
             </div>
16
             <div class="p-2">
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
             </div>
18
             </div>
22
           </div>
19
           </div>
23
         </div>
20
         </div>
32
                 <b>I</b>
29
                 <b>I</b>
33
               </span>
30
               </span>
34
             </div>
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
           </div>
40
           </div>
37
         </div>
41
         </div>
38
         <div class="col-md-8 text-left">
42
         <div class="col-md-8 text-left">
43
                 <b>N</b>
47
                 <b>N</b>
44
               </span>
48
               </span>
45
             </div>
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
           </div>
58
           </div>
48
         </div>
59
         </div>
49
         <div class="col-md-12">
60
         <div class="col-md-12">
57
                 <b>S</b>
68
                 <b>S</b>
58
               </span>
69
               </span>
59
             </div>
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
           </div>
79
           </div>
62
         </div>
80
         </div>
63
         <div class="col-md-12">
81
         <div class="col-md-12">
112
                     step="any"
130
                     step="any"
113
                     name="levy"
131
                     name="levy"
114
                     v-model="item.body"
132
                     v-model="item.body"
133
+                    :disabled="!CanEdit"
115
                   />
134
                   />
116
                 </div>
135
                 </div>
117
               </div>
136
               </div>
135
               <h2>Coded Fields</h2>
154
               <h2>Coded Fields</h2>
136
             </div>
155
             </div>
137
             <div class="p-2">
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
             </div>
162
             </div>
140
           </div>
163
           </div>
141
         </div>
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
         </div>
167
         </div>
149
         <div class="col-md-12">
168
         <div class="col-md-12">
150
           <hr />
169
           <hr />
151
         </div>
170
         </div>
152
         <div class="col-md-12">
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
         </div>
180
         </div>
155
       </div>
181
       </div>
156
     </div>
182
     </div>
157
   </div>
183
   </div>
158
 </template>
184
 </template>
159
 <script>
185
 <script>
186
+import { mapActions } from 'vuex';
160
 import ListView from '../shared/listView.vue';
187
 import ListView from '../shared/listView.vue';
161
 import TemplateInnerItem from './templateInnerItem.vue';
188
 import TemplateInnerItem from './templateInnerItem.vue';
162
 
189
 
164
   data() {
191
   data() {
165
     return {
192
     return {
166
       showNew: false,
193
       showNew: false,
194
+      openFields: false,
167
     };
195
     };
168
   },
196
   },
169
   components: {
197
   components: {
172
   },
200
   },
173
   props: {
201
   props: {
174
     item: {},
202
     item: {},
203
+    editable: {
204
+      default: false,
205
+    },
175
   },
206
   },
176
   computed: {
207
   computed: {
208
+    CanEdit() {
209
+      return this.editable || this.item.id === 0 || this.openFields;
210
+    },
177
     btnCaption() {
211
     btnCaption() {
178
       return this.showNew ? 'Close' : 'New';
212
       return this.showNew ? 'Close' : 'New';
179
     },
213
     },
214
+    ItemList() {
215
+      return this.item.placeHolders;
216
+    },
180
   },
217
   },
181
   methods: {
218
   methods: {
219
+    ...mapActions('template', ['addItem', 'editItem']),
182
     addClose() {
220
     addClose() {
183
       if (this.showNew) {
221
       if (this.showNew) {
184
         this.showNew = false;
222
         this.showNew = false;
185
       } else this.showNew = true;
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
 </script>
257
 </script>

+ 26
- 1
src/components/communication/templateInnerItem.vue Visa fil

1
 <template>
1
 <template>
2
   <div class="row">
2
   <div class="row">
3
+    <div class="col-md-12" v-if="message !== undefined">
4
+      <Alert :text="message" :type="'ERROR'" />
5
+    </div>
3
     <div class="col-md-3">
6
     <div class="col-md-3">
4
       <input
7
       <input
5
         class="form-control"
8
         class="form-control"
21
       </select>
24
       </select>
22
     </div>
25
     </div>
23
     <div class="col-md-3">
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
     </div>
28
     </div>
26
   </div>
29
   </div>
27
 </template>
30
 </template>
28
 <script>
31
 <script>
29
 import { mapState, mapActions } from 'vuex';
32
 import { mapState, mapActions } from 'vuex';
33
+import Alert from '../shared/alert.vue';
30
 
34
 
31
 export default {
35
 export default {
36
+  components: {
37
+    Alert,
38
+  },
32
   mounted() {
39
   mounted() {
33
     this.init();
40
     this.init();
34
   },
41
   },
35
   data() {
42
   data() {
36
     return {
43
     return {
44
+      message: undefined,
37
       item: {
45
       item: {
38
         name: undefined,
46
         name: undefined,
39
         class: undefined,
47
         class: undefined,
49
     onClassChanged() {
57
     onClassChanged() {
50
       this.getProperties(this.item.class);
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
 </script>
79
 </script>

+ 14
- 4
src/components/communication/templatePage.vue Visa fil

13
     </div>
13
     </div>
14
     <div class="row">
14
     <div class="row">
15
       <div :class="listClass">
15
       <div :class="listClass">
16
-        <ListView :items="list" @onRowClick="onRowClick" />
16
+        <ListView :items="list" @onRowClick="onRowClick" @onNew="onNew" :showNew="true" />
17
       </div>
17
       </div>
18
       <div class="col-md-6" v-if="showDetailView">
18
       <div class="col-md-6" v-if="showDetailView">
19
-        <DetailView :item="detailItem" />
19
+        <DetailView :item="detailItem" @onClose="onDetailClose" :editable="clickedNew" />
20
       </div>
20
       </div>
21
     </div>
21
     </div>
22
 
22
 
33
   data() {
33
   data() {
34
     return {
34
     return {
35
       detailItem: undefined,
35
       detailItem: undefined,
36
+      clickedNew: false,
36
     };
37
     };
37
   },
38
   },
38
   components: {
39
   components: {
56
   methods: {
57
   methods: {
57
     ...mapActions('template', ['getList']),
58
     ...mapActions('template', ['getList']),
58
     onRowClick(item) {
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 Visa fil

2
 /* eslint-disable guard-for-in */
2
 /* eslint-disable guard-for-in */
3
 <template>
3
 <template>
4
   <div>
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
       <div class="p-2">
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
       </div>
25
       </div>
9
     </div>
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
           <tr class="dnd-moved">
34
           <tr class="dnd-moved">
14
             <th v-for="(column, c) in Columns" :key="c">
35
             <th v-for="(column, c) in Columns" :key="c">
15
               <div @click="sortBy(column)">{{ column }}</div>
36
               <div @click="sortBy(column)">{{ column }}</div>
18
             <th v-if="deleteable"></th>
39
             <th v-if="deleteable"></th>
19
           </tr>
40
           </tr>
20
         </thead>
41
         </thead>
21
-        <tbody>
42
+        <tbody class="my-table">
22
           <tr
43
           <tr
23
             v-for="(item, i) in DisplayItems"
44
             v-for="(item, i) in DisplayItems"
24
             :key="i"
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
             <td
49
             <td
29
               v-for="(column, c) in Columns"
50
               v-for="(column, c) in Columns"
38
           </tr>
59
           </tr>
39
         </tbody>
60
         </tbody>
40
       </table>
61
       </table>
41
-      <div class="d-flex justify-content-between">
62
+      <div class="d-flex justify-content-between" v-if="showPager">
42
         <div class="p-1">{{ currentPage + ' / ' + PageCount }}</div>
63
         <div class="p-1">{{ currentPage + ' / ' + PageCount }}</div>
43
         <div class="p-1">
64
         <div class="p-1">
44
           <BasePagination
65
           <BasePagination
93
     }
114
     }
94
   },
115
   },
95
   props: {
116
   props: {
117
+    compact: {
118
+      default: true,
119
+    },
120
+    allowSelect: {
121
+      default: true,
122
+    },
123
+    allowMultipleSelect: {
124
+      default: false,
125
+    },
96
     hideSearch: {
126
     hideSearch: {
97
       default: false,
127
       default: false,
98
     },
128
     },
129
+    showNew: {
130
+      default: true,
131
+    },
99
     items: undefined,
132
     items: undefined,
100
     editable: {
133
     editable: {
101
       default: false,
134
       default: false,
106
     columnsCount: {
139
     columnsCount: {
107
       default: 6,
140
       default: 6,
108
     },
141
     },
142
+    showPager: {
143
+      default: true,
144
+    },
145
+    title: {
146
+      default: undefined,
147
+    },
109
   },
148
   },
110
   data() {
149
   data() {
111
     return {
150
     return {
151
+      selectedItems: [],
112
       showControl: false,
152
       showControl: false,
113
       sortKey: '',
153
       sortKey: '',
114
       reverse: false,
154
       reverse: false,
119
     };
159
     };
120
   },
160
   },
121
   methods: {
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
     isObject(item) {
173
     isObject(item) {
123
       return !!item && item.constructor === Object;
174
       return !!item && item.constructor === Object;
124
     },
175
     },
128
     onDelete(item) {
179
     onDelete(item) {
129
       this.$emit('onDelete', item);
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
     changeColumn(title, checked) {
197
     changeColumn(title, checked) {
135
       if (checked) {
198
       if (checked) {
248
 .over {
311
 .over {
249
   background-color: rgba(0, 0, 255, 0.35);
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
 </style>
342
 </style>

+ 17
- 15
src/components/shared/navBar.vue Visa fil

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

+ 1
- 1
src/components/timeshare/sell/sellPage.vue Visa fil

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

+ 52
- 88
src/components/user/updateProfileInfo.vue Visa fil

2
   <!-- eslint-disable max-len -->
2
   <!-- eslint-disable max-len -->
3
   <div class="container">
3
   <div class="container">
4
     <br />
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
     </div>
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
     </div>
21
     </div>
60
-    <br />
61
   </div>
22
   </div>
62
 </template>
23
 </template>
63
 
24
 
64
 <script>
25
 <script>
65
 import { mapState, mapActions, mapGetters } from 'vuex';
26
 import { mapState, mapActions, mapGetters } from 'vuex';
66
-import Individual from './registerPage.vue';
27
+import DetailIndividual from './timeshareIndividual.vue';
67
 
28
 
68
 export default {
29
 export default {
69
   name: 'UpdateInfo',
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
   data() {
31
   data() {
96
-    return {
97
-      item: {},
98
-    };
32
+    return { selectedItem: {} };
33
+  },
34
+  props: {},
35
+  components: {
36
+    DetailIndividual,
99
   },
37
   },
100
   mounted() {
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
   computed: {
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
     ...mapState('individual', ['indiv']),
55
     ...mapState('individual', ['indiv']),
56
+    ...mapState('authentication', ['isLoggedIn']),
109
     ...mapGetters({
57
     ...mapGetters({
110
       user: 'authentication/getUser',
58
       user: 'authentication/getUser',
59
+      person: 'authentication/getPerson',
111
     }),
60
     }),
61
+    isLoggedIn() {
62
+      return this.user && this.person;
63
+    },
112
   },
64
   },
113
   methods: {
65
   methods: {
114
     ...mapActions('individual', ['getIndividual']),
66
     ...mapActions('individual', ['getIndividual']),
67
+    onSelectedItemItemChange(item) {
68
+      this.currentUser = item;
69
+    },
115
   },
70
   },
116
 };
71
 };
117
 </script>
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 Visa fil

5
   state: {
5
   state: {
6
     list: [],
6
     list: [],
7
     item: {},
7
     item: {},
8
+    message: undefined,
8
   },
9
   },
9
   mutations: {
10
   mutations: {
10
     setList(state, list) {
11
     setList(state, list) {
21
         .then(result => commit('setList', result.data))
22
         .then(result => commit('setList', result.data))
22
         .catch(console.error);
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 Visa fil

18
   },
18
   },
19
   getters: {},
19
   getters: {},
20
   actions: {
20
   actions: {
21
-    getIndividual({
22
-      commit,
23
-      rootGetters,
24
-    }, userId) {
21
+    getIndividual({ commit, rootGetters }, userId) {
25
       let id = 0;
22
       let id = 0;
26
       if (!userId || userId === 0) {
23
       if (!userId || userId === 0) {
27
         const rootItem = rootGetters['authentication/getUser'];
24
         const rootItem = rootGetters['authentication/getUser'];
30
       axios
27
       axios
31
         .get(`/api/individual/getIndividual/${id}`)
28
         .get(`/api/individual/getIndividual/${id}`)
32
         .then(r => commit('setItem', {
29
         .then(r => commit('setItem', {
33
-          name: 'indiv',
34
-          value: r.data,
35
-        }))
30
+            name: 'indiv',
31
+            value: r.data,
32
+          }),)
36
         .catch(console.error);
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 Visa fil

54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
54
       state.registerIndividual.find(item => item.id === type.id).password = type.password;
55
     },
55
     },
56
     updateAgency(state, type) {
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
     clearIndividual(state) {
60
     clearIndividual(state) {
63
       state.registerIndividual = {
61
       state.registerIndividual = {
90
     removeAgency(state, id) {
88
     removeAgency(state, id) {
91
       state.registerAgency.pop(state.registerAgency.find(a => a.id === id));
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
   getters: {},
95
   getters: {},
95
   actions: {
96
   actions: {
96
-    getIndividuals({
97
-      commit,
98
-    }) {
97
+    getIndividuals({ commit }) {
99
       axios
98
       axios
100
         .get('/api/individual')
99
         .get('/api/individual')
101
         .then(result => commit('setIndividuals', result.data))
100
         .then(result => commit('setIndividuals', result.data))
102
         .catch(console.error);
101
         .catch(console.error);
103
     },
102
     },
104
-    getAgents({
105
-      commit,
106
-    }) {
103
+    getAgents({ commit }) {
107
       axios
104
       axios
108
         .get('/api/agent')
105
         .get('/api/agent')
109
         .then(result => commit('setAgents', result.data))
106
         .then(result => commit('setAgents', result.data))
118
     //     .catch(console.error);
115
     //     .catch(console.error);
119
     // },
116
     // },
120
 
117
 
121
-    saveIndividual({
122
-      commit,
123
-    }, item) {
118
+    saveIndividual({ commit }, item) {
124
       axios
119
       axios
125
         .post('/api/register/register', item)
120
         .post('/api/register/register', item)
126
         .then(result => commit('addIndividual', result.data))
121
         .then(result => commit('addIndividual', result.data))
127
         .catch(console.error);
122
         .catch(console.error);
128
     },
123
     },
129
-    saveAgency({
130
-      commit,
131
-    }, item) {
124
+    saveAgency({ commit }, item) {
132
       axios
125
       axios
133
         .post('/api/register/registeragency', item)
126
         .post('/api/register/registeragency', item)
134
         .then(result => commit('addAgency', result.data))
127
         .then(result => commit('addAgency', result.data))
135
         .catch(console.error);
128
         .catch(console.error);
136
     },
129
     },
137
-    saveAgent({
138
-      commit,
139
-    }, item) {
130
+    saveAgent({ commit }, item) {
140
       axios
131
       axios
141
         .post('/api/agent', item)
132
         .post('/api/agent', item)
142
         .then(result => commit('addAgent', result.data))
133
         .then(result => commit('addAgent', result.data))
168
     // }) {
159
     // }) {
169
     //   commit('clearAgency');
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
     // deleteAgency({
174
     // deleteAgency({
180
     //   commit,
175
     //   commit,
181
     // }, id) {
176
     // }, id) {

Laddar…
Avbryt
Spara