Bladeren bron

Super Admin - Screens

master
George Williams 4 jaren geleden
bovenliggende
commit
06aefd3d51

+ 320
- 0
src/components/customer/customerDetails.vue Bestand weergeven

@@ -0,0 +1,320 @@
1
+<template>
2
+  <div>
3
+    <div class="conainer">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-box-d">
8
+              <br />
9
+              <h1 class="title-d" style="text-align:left; font-size: 250%">My Details</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+        <div class="row"></div>
14
+        <div class="row" style="text-align:left">
15
+          <div class="col-md-6" style="margin-bottom: 1em">
16
+            <label>Name</label>
17
+            <div class="input-group-prepend">
18
+              <span class="input-group-text">
19
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
20
+              </span>
21
+              <input class="form-control" type="text" name="FirstName" v-model="user.firstName" />
22
+            </div>
23
+          </div>
24
+          <div class="col-md-6" style="margin-bottom: 1em">
25
+            <label>Surname</label>
26
+            <div class="input-group-prepend">
27
+              <span class="input-group-text">
28
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
29
+              </span>
30
+              <input class="form-control" type="text" name="Surname" v-model="user.surname" />
31
+            </div>
32
+          </div>
33
+        </div>
34
+        <div class="row" style="text-align:left">
35
+          <div class="col-md-6" style="margin-bottom: 1em">
36
+            <label>Eamil Addres</label>
37
+            <div class="input-group-prepend">
38
+              <span class="input-group-text">
39
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
40
+              </span>
41
+              <input
42
+                class="form-control"
43
+                type="text"
44
+                name="emailAddress"
45
+                v-model="user.emailAddress"
46
+              />
47
+            </div>
48
+          </div>
49
+          <div class="col-md-6" style="margin-bottom: 1em">
50
+            <label>Cellphone</label>
51
+            <div class="input-group-prepend">
52
+              <span class="input-group-text">
53
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
54
+              </span>
55
+              <input class="form-control" type="text" name="cellphone" v-model="user.cellphone" />
56
+            </div>
57
+          </div>
58
+        </div>
59
+        <div class="row">
60
+          <div class="col-md-12 col-lg-8">
61
+            <div class="title-box-d">
62
+              <br />
63
+              <h2 class="title-d" style="text-align:left;">My Address</h2>
64
+            </div>
65
+          </div>
66
+        </div>
67
+        <div class="row" style="text-align:left">
68
+          <div class="col-md-4" style="margin-bottom: 1em">
69
+            <div class="custom-control custom-switch">
70
+              <label>Do you live in a complex or block of flats?</label>
71
+              <input
72
+                style="margin-left: 1px"
73
+                type="checkbox"
74
+                class="custom-control-input"
75
+                id="thCloseSwitch"
76
+                :checked="userAddress.isComplex"
77
+                @change="selectionChanged"
78
+              />
79
+              <label
80
+                class="custom-control-label"
81
+                for="thCloseSwitch"
82
+                style="margin-left: 40px"
83
+              >{{userAddress.isComplex ? 'Yes' : 'No'}}</label>
84
+            </div>
85
+          </div>
86
+        </div>
87
+        <div class="row" style="text-align:left">
88
+          <div class="col-md-4" style="margin-bottom: 1em">
89
+            <button
90
+              @click="ShowMap()"
91
+              class="btn btn-b-n"
92
+              type="button"
93
+              data-dismiss="modal"
94
+            >Update Address</button>
95
+          </div>
96
+        </div>
97
+        <div v-if="userAddress.isComplex" class="row" style="text-align:left">
98
+          <div class="col-md-6" style="margin-bottom: 1em">
99
+            <label>Complex Name</label>
100
+            <div class="input-group-prepend">
101
+              <span class="input-group-text">
102
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
103
+              </span>
104
+              <input
105
+                class="form-control"
106
+                type="text"
107
+                name="FirstName"
108
+                v-model="userAddress.complexName"
109
+              />
110
+            </div>
111
+          </div>
112
+          <div class="col-md-6" style="margin-bottom: 1em">
113
+            <label>Unit Number</label>
114
+            <div class="input-group-prepend">
115
+              <span class="input-group-text">
116
+                <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
117
+              </span>
118
+              <input
119
+                class="form-control"
120
+                type="text"
121
+                name="Surname"
122
+                v-model="userAddress.unitNumber"
123
+              />
124
+            </div>
125
+          </div>
126
+        </div>
127
+        <div class="row" style="text-align:left">
128
+          <div class="col-md-6" style="margin-bottomL 1em">
129
+            <div class="row" style="text-align:left">
130
+              <div class="col-md-12" style="margin-bottom: 1em">
131
+                <label>Street Number</label>
132
+                <div class="input-group-prepend">
133
+                  <span class="input-group-text">
134
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
135
+                  </span>
136
+                  <input
137
+                    class="form-control"
138
+                    type="text"
139
+                    name="FirstName"
140
+                    v-model="userAddress.streetNumber"
141
+                    disabled
142
+                  />
143
+                </div>
144
+              </div>
145
+            </div>
146
+            <div class="row" style="text-align:left">
147
+              <div class="col-md-12" style="margin-bottom: 1em">
148
+                <label>Street Name</label>
149
+                <div class="input-group-prepend">
150
+                  <span class="input-group-text">
151
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
152
+                  </span>
153
+                  <input
154
+                    class="form-control"
155
+                    type="text"
156
+                    name="FirstName"
157
+                    v-model="userAddress.streetName"
158
+                    disabled
159
+                  />
160
+                </div>
161
+              </div>
162
+            </div>
163
+            <div class="row" style="text-align:left">
164
+              <div class="col-md-12" style="margin-bottom: 1em">
165
+                <label>Suburb</label>
166
+                <div class="input-group-prepend">
167
+                  <span class="input-group-text">
168
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
169
+                  </span>
170
+                  <input
171
+                    class="form-control"
172
+                    type="text"
173
+                    name="FirstName"
174
+                    v-model="userAddress.suburb"
175
+                    disabled
176
+                  />
177
+                </div>
178
+              </div>
179
+            </div>
180
+            <div class="row" style="text-align:left">
181
+              <div class="col-md-12" style="margin-bottom: 1em">
182
+                <label>City</label>
183
+                <div class="input-group-prepend">
184
+                  <span class="input-group-text">
185
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
186
+                  </span>
187
+                  <input
188
+                    class="form-control"
189
+                    type="text"
190
+                    name="FirstName"
191
+                    v-model="userAddress.city"
192
+                    disabled
193
+                  />
194
+                </div>
195
+              </div>
196
+            </div>
197
+            <div class="row" style="text-align:left">
198
+              <div class="col-md-12" style="margin-bottom: 1em">
199
+                <label>Province</label>
200
+                <div class="input-group-prepend">
201
+                  <span class="input-group-text">
202
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
203
+                  </span>
204
+                  <input
205
+                    class="form-control"
206
+                    type="text"
207
+                    name="FirstName"
208
+                    v-model="userAddress.province"
209
+                    disabled
210
+                  />
211
+                </div>
212
+              </div>
213
+            </div>
214
+            <div class="row" style="text-align:left">
215
+              <div class="col-md-12" style="margin-bottom: 1em">
216
+                <label>Postal Code</label>
217
+                <div class="input-group-prepend">
218
+                  <span class="input-group-text">
219
+                    <eva-icon name="person-outline" fill="#60CBEB"></eva-icon>
220
+                  </span>
221
+                  <input
222
+                    class="form-control"
223
+                    type="text"
224
+                    name="FirstName"
225
+                    v-model="userAddress.postalCode"
226
+                    disabled
227
+                  />
228
+                </div>
229
+              </div>
230
+            </div>
231
+          </div>
232
+          <div class="col-md-6" style="margin-bottomL 1em">
233
+            <Map :showAutoComplete="false" :showLocationLabel="false" :setLocation="mapCoords" />
234
+          </div>
235
+        </div>
236
+        <div class="row offset-md-5">
237
+          <div class="col-md-2">
238
+            <button @click="Save()" class="btn btn-b-n" type="button" data-dismiss="modal">Save</button>
239
+          </div>
240
+          <div class="col-md-2">
241
+            <button @click="Close()" class="btn btn-b-n" type="button" data-dismiss="modal">Close</button>
242
+          </div>
243
+        </div>
244
+      </div>
245
+    </div>
246
+    <modal name="map" :width="600" :height="620">
247
+      <div class="container">
248
+        <h2>Update Location</h2>
249
+        <br />
250
+        <Map :showLocationLabel="false" @GoogleAddress="UpdateAddress" />
251
+        <div class="row" style="text-align:left">
252
+          <div class="col-md-4" style="margin-bottom: 1em">
253
+            <button @click="HideMap()" class="btn btn-b-n" type="button" data-dismiss="modal">Close</button>
254
+          </div>
255
+        </div>
256
+      </div>
257
+    </modal>
258
+  </div>
259
+</template>
260
+
261
+<script>
262
+import Map from "../shared/mapSetLocation";
263
+import { mapState, mapActions } from "vuex";
264
+
265
+export default {
266
+  name: "CustomerDetails",
267
+  components: {
268
+    Map
269
+  },
270
+  data() {
271
+    return {
272
+      complex: false
273
+    };
274
+  },
275
+  methods: {
276
+    ...mapActions("user", ["getUser", "updateUser", "getUserAddress"]),
277
+    selectionChanged() {
278
+      this.userAddress.isComplex = !this.userAddress.isComplex;
279
+    },
280
+    ShowMap() {
281
+      this.$modal.show("map");
282
+    },
283
+    HideMap() {
284
+      this.$modal.hide("map");
285
+    },
286
+    UpdateAddress(address) {
287
+      console.log(JSON.stringify(address));
288
+      this.userAddress.streetNumber = address.streetNumber;
289
+      this.userAddress.streetName = address.streetName;
290
+      this.userAddress.suburb = address.suburb;
291
+      this.userAddress.city = address.city;
292
+      this.userAddress.province = address.province;
293
+      this.userAddress.country = address.country;
294
+      this.userAddress.postalCode = address.postalCode;
295
+      this.userAddress.googleMapUrl = address.url;
296
+      this.userAddress.latitude = address.coordinates.lat;
297
+      this.userAddress.longitude = address.coordinates.lng;
298
+    },
299
+    Save() {
300
+      this.user.addresses = [];
301
+      this.user.addresses.push(this.userAddress);
302
+      this.updateUser(this.user);
303
+    }
304
+  },
305
+  computed: {
306
+    ...mapState("user", ["user", "userAddress"]),
307
+    mapCoords() {
308
+      var coords = {
309
+        lat: this.userAddress.latitude,
310
+        lng: this.userAddress.longitude
311
+      };
312
+      return coords;
313
+    }
314
+  },
315
+  mounted() {
316
+    this.getUser(2); //Will need to replace with auth object's ID
317
+    this.getUserAddress(2);
318
+  }
319
+};
320
+</script>

+ 48
- 0
src/components/customer/customerList.vue Bestand weergeven

@@ -0,0 +1,48 @@
1
+<template>
2
+  <div>
3
+    <div class="conainer">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-box-d">
8
+              <br />
9
+              <h1 class="title-d" style="text-align:left; font-size: 250%">Customers</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+        <div class="row"></div>
14
+        <div class="row">
15
+          <div class="col-md-12">
16
+            <listView :items="users" :displayColumns="columns" :showNew="false" />
17
+          </div>
18
+        </div>
19
+      </div>
20
+    </div>
21
+  </div>
22
+</template>
23
+
24
+<script>
25
+import listView from "../shared/listView";
26
+import { mapState, mapActions } from "vuex";
27
+
28
+export default {
29
+  name: "Customers",
30
+  components: {
31
+    listView
32
+  },
33
+  data() {
34
+    return {
35
+      columns: ["emailAddress", "firstName", "surname", "cellphone"]
36
+    };
37
+  },
38
+  methods: {
39
+    ...mapActions("user", ["getUsers"])
40
+  },
41
+  computed: {
42
+    ...mapState("user", ["users"])
43
+  },
44
+  mounted() {
45
+    this.getUsers();
46
+  }
47
+};
48
+</script>

+ 33
- 0
src/components/customer/customerOrders.vue Bestand weergeven

@@ -0,0 +1,33 @@
1
+<template>
2
+  <div>
3
+    <div class="conainer">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-box-d">
8
+              <br />
9
+              <h1 class="title-d" style="text-align:left; font-size: 250%">My Orders</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+        <div class="row"></div>
14
+        <div class="row">
15
+          <div class="col-md-12">
16
+            <listView />
17
+          </div>
18
+        </div>
19
+      </div>
20
+    </div>
21
+  </div>
22
+</template>
23
+
24
+<script>
25
+import listView from "../shared/listView";
26
+
27
+export default {
28
+  name: "CustomerOrders",
29
+  components: {
30
+    listView
31
+  }
32
+};
33
+</script>

+ 2
- 2
src/components/home/restaurantCategory.vue Bestand weergeven

@@ -3,7 +3,7 @@
3 3
     <div class="form-group row"></div>
4 4
     <div class="form-group row">
5 5
       <div class="col-md-4" v-for="cat in restaurantsCategories" :key="cat.id">
6
-        <router-link :to="`/property/property/${cat.id}`">
6
+        <router-link :to="'/Search'">
7 7
           <div class="card-box-a card-shadow">
8 8
             <div class="img-box-a">
9 9
               <img
@@ -17,7 +17,7 @@
17 17
               <div class="card-overlay-a-content">
18 18
                 <div class="card-header-a">
19 19
                   <h4 class="card-title-a">
20
-                    <router-link :to="`/property/property/${cat.id}`" class="link-a">
20
+                    <router-link :to="'/Search'" class="link-a">
21 21
                       {{
22 22
                       cat.description
23 23
                       }}

+ 16
- 0
src/components/home/restaurantSearch.vue Bestand weergeven

@@ -0,0 +1,16 @@
1
+<template>
2
+  <div class="container">
3
+    <h1>Resturants</h1>
4
+  </div>
5
+</template>
6
+
7
+<script>
8
+export default {
9
+  name: "Search",
10
+  data() {
11
+    return {
12
+      search: ""
13
+    };
14
+  }
15
+};
16
+</script>

+ 5
- 5
src/components/home/restaurantsSection.vue Bestand weergeven

@@ -3,7 +3,7 @@
3 3
     <div class="form-group row"></div>
4 4
     <div class="form-group row">
5 5
       <div class="col-md-4" v-for="restaurant in restaurants" :key="restaurant.id">
6
-        <router-link :to="`/property/property/${restaurant.id}`">
6
+        <router-link :to="'/Search'">
7 7
           <div class="card-box-a card-shadow">
8 8
             <div class="img-box-a">
9 9
               <img
@@ -17,21 +17,21 @@
17 17
               <div class="card-overlay-a-content">
18 18
                 <div class="card-header-a">
19 19
                   <h2 class="card-title-a">
20
-                    <router-link :to="`/property/property/${restaurant.id}`" class="link-a">
20
+                    <router-link :to="'/Search'" class="link-a">
21 21
                       {{
22 22
                       restaurant.name
23 23
                       }}
24 24
                     </router-link>
25 25
                   </h2>
26 26
                   <h3 class="card-title-b">
27
-                    <router-link :to="`/property/property/${restaurant.id}`" class="link-a">
27
+                    <router-link :to="'/Search'" class="link-a">
28 28
                       {{
29 29
                       restaurant.suburb
30 30
                       }}
31 31
                     </router-link>
32 32
                   </h3>
33 33
                   <h4 class="card-title-c">
34
-                    <router-link :to="`/property/property/${restaurant.id}`" class="link-a">
34
+                    <router-link :to="'/Search'" class="link-a">
35 35
                       {{
36 36
                       restaurant.subText
37 37
                       }}
@@ -40,7 +40,7 @@
40 40
                 </div>
41 41
                 <div class="card-body-a">
42 42
                   <div class="price-box d-flex"></div>
43
-                  <router-link :to="`/property/property/${restaurant.id}`" class="link-a">
43
+                  <router-link :to="'/Search'" class="link-a">
44 44
                     <span class="ion-ios-arrow-forward"></span>
45 45
                   </router-link>
46 46
                 </div>

+ 48
- 0
src/components/restaurants/restaurantList.vue Bestand weergeven

@@ -0,0 +1,48 @@
1
+<template>
2
+  <div>
3
+    <div class="conainer">
4
+      <div class="container">
5
+        <div class="row">
6
+          <div class="col-md-12 col-lg-8">
7
+            <div class="title-box-d">
8
+              <br />
9
+              <h1 class="title-d" style="text-align:left; font-size: 250%">Restaurants</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+        <div class="row"></div>
14
+        <div class="row">
15
+          <div class="col-md-12">
16
+            <listView :items="restaurants" :displayColumns="columns" :showNew="false" />
17
+          </div>
18
+        </div>
19
+      </div>
20
+    </div>
21
+  </div>
22
+</template>
23
+
24
+<script>
25
+import listView from "../shared/listView";
26
+import { mapState, mapActions } from "vuex";
27
+
28
+export default {
29
+  name: "Restaurants",
30
+  components: {
31
+    listView
32
+  },
33
+  data() {
34
+    return {
35
+      columns: ["name", "shoppingCentre", "suburb", "city"]
36
+    };
37
+  },
38
+  methods: {
39
+    ...mapActions("restaurant", ["getRestaurants"])
40
+  },
41
+  computed: {
42
+    ...mapState("restaurant", ["restaurants"])
43
+  },
44
+  mounted() {
45
+    this.getRestaurants();
46
+  }
47
+};
48
+</script>

+ 24
- 3
src/components/shared/mapSetLocation.vue Bestand weergeven

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div>
3
-    <label>Location</label>
4
-    <div class="input-group-prepend">
3
+    <label v-if="showLocationLabel">Location</label>
4
+    <div v-if="showAutoComplete" class="input-group-prepend">
5 5
       <span class="input-group-text">
6 6
         <eva-icon name="map" fill="#60CBEB"></eva-icon>
7 7
       </span>
@@ -9,7 +9,7 @@
9 9
       <button class="btn btn-primary btn-l" @click="addMarker">Add</button>
10 10
       <br />
11 11
     </div>
12
-    <br />
12
+    <br v-if="showAutoComplete" />
13 13
     <gmap-map v-if="showMap" :center="coordinates" :zoom="18" style="width:100%;  height: 400px;">
14 14
       <gmap-marker
15 15
         :key="index"
@@ -29,6 +29,15 @@ export default {
29 29
   props: {
30 30
     showMap: {
31 31
       default: true
32
+    },
33
+    showLocationLabel: {
34
+      default: true
35
+    },
36
+    showAutoComplete: {
37
+      default: true
38
+    },
39
+    setLocation: {
40
+      default: {}
32 41
     }
33 42
   },
34 43
   data() {
@@ -138,6 +147,18 @@ export default {
138 147
         };
139 148
       });
140 149
     }
150
+  },
151
+  watch: {
152
+    setLocation: {
153
+      immediate: true,
154
+      handler(val, oldVal) {
155
+        if (val) {
156
+          this.coordinates = val;
157
+          this.markers = [];
158
+          this.markers.push({ position: val });
159
+        }
160
+      }
161
+    }
141 162
   }
142 163
 };
143 164
 </script>

+ 9
- 15
src/components/shared/navBar.vue Bestand weergeven

@@ -37,7 +37,7 @@
37 37
       <div class="col-md-1 offset-2">
38 38
         <div class="input-group-prepend">
39 39
           <input type="text" placeholder="search" />
40
-          <span class="input-group-text">
40
+          <span class="input-group-text" @click="Search">
41 41
             <i class="fa fa-search" style="color:#60CBEB"></i>
42 42
           </span>
43 43
         </div>
@@ -78,23 +78,14 @@
78 78
                 aria-haspopup="true"
79 79
                 aria-expanded="false"
80 80
                 v-if="isLoggedIn"
81
-              >
82
-                <!--{{ NAME }}-->
83
-                User
84
-              </a>
81
+              >{{ SystemRole }}</a>
85 82
               <div
86 83
                 v-if="SystemRole === 'Customer'"
87 84
                 class="dropdown-menu"
88 85
                 aria-labelledby="navbarDropdown"
89 86
               >
90
-                <a
91
-                  class="dropdown-item cursor-pointer"
92
-                  @click="routerGoTo('/status/list')"
93
-                >My Details</a>
94
-                <a
95
-                  class="dropdown-item cursor-pointer"
96
-                  @click="routerGoTo('/status/timeshareAdmin')"
97
-                >My Orders</a>
87
+                <a class="dropdown-item cursor-pointer" @click="routerGoTo('/MyDetails')">My Details</a>
88
+                <a class="dropdown-item cursor-pointer" @click="routerGoTo('/MyOrders')">My Orders</a>
98 89
               </div>
99 90
               <div
100 91
                 v-if="SystemRole === 'RestaurantAdmin' || SystemRole === 'RestaurantUser'"
@@ -126,7 +117,7 @@
126 117
               >
127 118
                 <a
128 119
                   class="dropdown-item cursor-pointer"
129
-                  @click="routerGoTo('/status/list')"
120
+                  @click="routerGoTo('/RestuarantList')"
130 121
                 >Restaurants</a>
131 122
                 <a
132 123
                   class="dropdown-item cursor-pointer"
@@ -134,7 +125,7 @@
134 125
                 >Restaurant Categories</a>
135 126
                 <a
136 127
                   class="dropdown-item cursor-pointer"
137
-                  @click="routerGoTo('/status/timeshareAdmin')"
128
+                  @click="routerGoTo('/CustomerList')"
138 129
                 >Customers</a>
139 130
               </div>
140 131
             </li>
@@ -193,6 +184,9 @@ export default {
193 184
 
194 185
     routerGoTo(goTo) {
195 186
       this.$emit("routerGoTo", goTo);
187
+    },
188
+    Search() {
189
+      this.$router.push("/search");
196 190
     }
197 191
   }
198 192
 };

+ 31
- 1
src/router/index.js Bestand weergeven

@@ -8,7 +8,12 @@ import Registration from "../components/accounts/register.vue";
8 8
 import Login from "../components/accounts/login.vue";
9 9
 import RegisterRestaurant from "../components/accounts/restaurantRegistration.vue";
10 10
 import RegistrationPage from "../components/accounts/registrationPage.vue";
11
-import RestaurantCategory from "../components/restaurants/restaurantCategories.vue"
11
+import RestaurantCategory from "../components/restaurants/restaurantCategories.vue";
12
+import RestaurantSearch from "../components/home/restaurantSearch.vue";
13
+import RestuarantList from "../components/restaurants/restaurantList.vue";
14
+import CustomerDetails from "../components/customer/customerDetails.vue";
15
+import CustomerOrders from "../components/customer/customerOrders.vue";
16
+import CustomerList from "../components/customer/customerList.vue";
12 17
 
13 18
 Vue.use(Router);
14 19
 
@@ -49,6 +54,31 @@ export default new Router({
49 54
       path: "/RestaurantCategory",
50 55
       name: "RestaurantCategory",
51 56
       component: RestaurantCategory
57
+    },
58
+    {
59
+      path: "/search",
60
+      name: "RestaurantSearch",
61
+      component: RestaurantSearch
62
+    },
63
+    {
64
+      path: "/MyDetails",
65
+      name: "MyDetails",
66
+      component: CustomerDetails
67
+    },
68
+    {
69
+      path: "/MyOrders",
70
+      name: "MyOrders",
71
+      component: CustomerOrders
72
+    },
73
+    {
74
+      path: "/RestuarantList",
75
+      name: "RestuarantList",
76
+      component: RestuarantList
77
+    },
78
+    {
79
+      path: "/CustomerList",
80
+      name: "CustomerList",
81
+      component: CustomerList
52 82
     }
53 83
   ]
54 84
 });

+ 5
- 1
src/store/index.js Bestand weergeven

@@ -5,6 +5,8 @@ import Registration from './modules/accounts/registration';
5 5
 import Authentication from './modules/accounts/authentication';
6 6
 import RestaurantSearch from './modules/restaurants/restaurantSearch';
7 7
 import RestaurantCategories from './modules/restaurants/restaurantCategories';
8
+import Restaurant from './modules/restaurants/restaurant';
9
+import User from './modules/users/user';
8 10
 
9 11
 Vue.use(Vuex);
10 12
 /* eslint no-param-reassign: ["error", { "props": false }] */
@@ -14,6 +16,8 @@ export default new Vuex.Store({
14 16
     registration: Registration,
15 17
     authentiaction: Authentication,
16 18
     restaurantSearch: RestaurantSearch,
17
-    restaurantCategories: RestaurantCategories
19
+    restaurantCategories: RestaurantCategories,
20
+    restaurant: Restaurant,
21
+    user: User
18 22
   },
19 23
 });

+ 24
- 0
src/store/modules/restaurants/restaurant.js Bestand weergeven

@@ -0,0 +1,24 @@
1
+import axios from 'axios'
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    restaurants: [],
7
+    restaurant: {}
8
+  },
9
+  mutations: {
10
+    setRestaurants(state, restaurants) {
11
+      state.restaurants = restaurants
12
+    }
13
+  },
14
+  getters: {},
15
+  actions: {
16
+    getRestaurants({
17
+      commit
18
+    }) {
19
+      axios
20
+        .get('/api/restaurant/getrestaurants')
21
+        .then(result => commit("setRestaurants", result.data))
22
+    }
23
+  }
24
+}

+ 52
- 0
src/store/modules/users/user.js Bestand weergeven

@@ -0,0 +1,52 @@
1
+import axios from 'axios'
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    user: {},
7
+    userAddress: {},
8
+    users: []
9
+  },
10
+  mutations: {
11
+    setUser(state, user) {
12
+      state.user = user;
13
+    },
14
+    setAddress(state, address) {
15
+      state.userAddress = address;
16
+    },
17
+    setUsers(state, users) {
18
+      state.users = users;
19
+    }
20
+  },
21
+  getters: {},
22
+  actions: {
23
+    getUser({
24
+      commit
25
+    }, id) {
26
+      axios
27
+        .get(`/api/user/${id}`)
28
+        .then(result => commit("setUser", result.data));
29
+    },
30
+    updateUser({
31
+      commit
32
+    }, user) {
33
+      axios
34
+        .put('/api/user', user)
35
+        .then(result => commit("setUser", result.data));
36
+    },
37
+    getUserAddress({
38
+      commit
39
+    }, userId) {
40
+      axios
41
+        .get(`/api/user/getuseraddress/${userId}`)
42
+        .then(result => commit("setAddress", result.data));
43
+    },
44
+    getUsers({
45
+      commit
46
+    }) {
47
+      axios
48
+        .get('/api/user/GetCustomers')
49
+        .then(result => commit("setUsers", result.data));
50
+    }
51
+  }
52
+}

Laden…
Annuleren
Opslaan