Pārlūkot izejas kodu

Menu View, Cart, RUsers & Roles WIP

master
George Williams 4 gadus atpakaļ
vecāks
revīzija
a19cd33aad

Binārs
public/img/DefaultImg.png Parādīt failu


+ 0
- 9
src/assets/myData.js Parādīt failu

1
-const items = {
2
-  seasons: ['Peak 1', 'Peak 2', 'Peak 3', 'Peak 4', 'Red', 'White', 'Blue', 'Flexi'],
3
-  resortBedrooms: ['Studio', '1', '2', '3', '4', '5', '6'],
4
-  maxBedrooms: ['2', '4', '6', '8', '10', '12'],
5
-  bankedEntities: ['Dial an Exchange', 'RCI', 'First Exchange', 'iExchange',
6
-    'Interval International',
7
-  ],
8
-};
9
-export default items;

+ 0
- 105
src/assets/navigationitems.js Parādīt failu

1
-const items = {
2
-  items: [
3
-    {
4
-      icon: 'T',
5
-      text: 'Test',
6
-      route: '/test',
7
-      open: false,
8
-    },
9
-    {
10
-      icon: 'H',
11
-      text: 'Home',
12
-      route: '/home',
13
-      open: true,
14
-    },
15
-    {
16
-      icon: 'A',
17
-      text: 'About',
18
-      open: false,
19
-      children: [
20
-        {
21
-          icon: 't',
22
-          text: 'About Us',
23
-          route: '/about/us',
24
-        },
25
-        {
26
-          icon: 't',
27
-          text: 'About Timeshare',
28
-          route: '/about/timeshare',
29
-        },
30
-      ],
31
-    },
32
-    {
33
-      icon: 'T',
34
-      text: 'Timeshare',
35
-      open: false,
36
-      children: [
37
-        {
38
-          icon: 's',
39
-          text: 'To Sell',
40
-          route: '/timeshare/tosell',
41
-        },
42
-        {
43
-          icon: 'b',
44
-          text: 'To Buy',
45
-          route: '/timeshare/tobuy',
46
-        },
47
-        {
48
-          icon: 'f',
49
-          text: 'FAQ',
50
-          route: '/timeshare/faq',
51
-        },
52
-      ],
53
-    },
54
-    {
55
-      icon: 'C',
56
-      text: 'Commercial',
57
-      open: false,
58
-      children: [
59
-        {
60
-          icon: 's',
61
-          text: 'Search',
62
-          route: '/commercial/search',
63
-        },
64
-        {
65
-          icon: 'r',
66
-          text: 'To Rent',
67
-          route: '/commercial/torent',
68
-        },
69
-        {
70
-          icon: 's',
71
-          text: 'To Sell',
72
-          route: '/commercial/tosell',
73
-        },
74
-      ],
75
-    },
76
-    {
77
-      icon: 'R',
78
-      text: 'Residential',
79
-      open: false,
80
-      children: [
81
-        {
82
-          icon: 's',
83
-          text: 'Search',
84
-          route: '/residential/search',
85
-        },
86
-        {
87
-          icon: 'r',
88
-          text: 'To Rent',
89
-          route: '/residential/torent',
90
-        },
91
-        {
92
-          icon: 's',
93
-          text: 'To Sell',
94
-          route: '/residential/tosell',
95
-        },
96
-      ],
97
-    },
98
-    {
99
-      icon: 'C',
100
-      text: 'Contact Us',
101
-      route: '/contactus',
102
-    },
103
-  ],
104
-};
105
-export default items;

+ 20
- 1
src/components/home/menuItems.vue Parādīt failu

4
       <div class="col-sm-12">
4
       <div class="col-sm-12">
5
         <div class="about-img-box">
5
         <div class="about-img-box">
6
           <img
6
           <img
7
+            v-if="menu.logo !== ''"
7
             :src="menu.logo"
8
             :src="menu.logo"
8
             alt="Restaurant Details"
9
             alt="Restaurant Details"
9
             class="img-fluid"
10
             class="img-fluid"
10
             style="width:800px;height:400px; border-radius:10px"
11
             style="width:800px;height:400px; border-radius:10px"
11
           />
12
           />
13
+          <img
14
+            v-else
15
+            src="../../../public/img/DefaultImg.png"
16
+            class="img-fluid"
17
+            style="width:800px;height:400px; border-radius:10px"
18
+          />
12
         </div>
19
         </div>
13
         <div class="sinse-box" style="border-radius:10px">
20
         <div class="sinse-box" style="border-radius:10px">
14
           <h3 class="sinse-title">{{ menu.name }}</h3>
21
           <h3 class="sinse-title">{{ menu.name }}</h3>
54
             <div class="carousel-item-c" @click="ShowOptions(iMenuItem)">
61
             <div class="carousel-item-c" @click="ShowOptions(iMenuItem)">
55
               <div class="card-box-b card-shadow news-box">
62
               <div class="card-box-b card-shadow news-box">
56
                 <div class="img-box-b">
63
                 <div class="img-box-b">
57
-                  <img :src="iMenuItem.image" alt class="img-b img-fluid" />
64
+                  <img
65
+                    v-if="iMenuItem.image !== ''"
66
+                    :src="iMenuItem.image"
67
+                    alt
68
+                    class="img-b img-fluid"
69
+                  />
70
+                  <img
71
+                    v-else
72
+                    src="../../../public/img/DefaultImg.png"
73
+                    alt
74
+                    class="img-b img-fluid"
75
+                    style="object-fit: cover;"
76
+                  />
58
                 </div>
77
                 </div>
59
                 <div class="card-overlay">
78
                 <div class="card-overlay">
60
                   <div class="card-header-b">
79
                   <div class="card-header-b">

+ 77
- 24
src/components/home/menuOptions.vue Parādīt failu

7
           <div class="carousel-item-c">
7
           <div class="carousel-item-c">
8
             <div class="card-box-b card-shadow news-box">
8
             <div class="card-box-b card-shadow news-box">
9
               <div class="img-box-b">
9
               <div class="img-box-b">
10
-                <img :src="item.image" alt class="img-b img-fluid" />
10
+                <img v-if="item.image !== ''" :src="item.image" alt class="img-b img-fluid" />
11
+                <img
12
+                  v-else
13
+                  src="../../../public/img/DefaultImg.png"
14
+                  alt
15
+                  class="img-b img-fluid"
16
+                  style="object-fit: cover;"
17
+                />
11
               </div>
18
               </div>
12
               <div class="card-overlay">
19
               <div class="card-overlay">
13
                 <div class="card-header-b">
20
                 <div class="card-header-b">
56
               </div>
63
               </div>
57
               <div class="col-sm-2">
64
               <div class="col-sm-2">
58
                 <label style="margin-top: 0.5em">
65
                 <label style="margin-top: 0.5em">
59
-                  <b>{{subTotal | toCurrency}}</b>
66
+                  <b>{{SubTotal | toCurrency}}</b>
60
                 </label>
67
                 </label>
61
               </div>
68
               </div>
62
             </div>
69
             </div>
74
                 </div>
81
                 </div>
75
               </div>
82
               </div>
76
             </div>
83
             </div>
77
-            <div class="row">
84
+            <div class="row" v-if="item.subTitle">
78
               <div class="col-sm-12">{{ item.subTitle }}</div>
85
               <div class="col-sm-12">{{ item.subTitle }}</div>
79
             </div>
86
             </div>
80
-            <hr />
81
-            <div class="row" v-for="(choice, i) in item.options" :key="i">
82
-              <div class="col-sm-1">
83
-                <input
84
-                  v-if="item.optionType === 'Multiple' || item.optionType === 'MultipleLimit'"
85
-                  type="checkbox"
86
-                />
87
-                <input v-else type="radio" v-model="radio" :value="choice.description" />
88
-              </div>
89
-              <div class="col-sm-7">
90
-                <label>{{ choice.description }}</label>
91
-              </div>
92
-              <div class="col-sm-2" v-if="choice.price > 0">
93
-                <label>R {{ choice.price }}</label>
94
-              </div>
95
-            </div>
96
-            <hr />
87
+            <hr v-if="item.subTitle" />
88
+            <optionSelector
89
+              :item="item"
90
+              @UpdateSelection="UpdateSelection"
91
+              @UpdateSelectionQty="UpdateSelectionQty"
92
+            />
97
           </div>
93
           </div>
98
         </div>
94
         </div>
95
+        <hr />
99
         <div class="row">
96
         <div class="row">
100
           <div class="col-sm-12">
97
           <div class="col-sm-12">
101
             <label>Special Instructions</label>
98
             <label>Special Instructions</label>
127
 </template>
124
 </template>
128
 
125
 
129
 <script>
126
 <script>
127
+import { mapState, mapActions } from "vuex";
128
+import optionSelector from "../orders/orderOptionSelection";
129
+
130
 export default {
130
 export default {
131
   name: "MenuOptions",
131
   name: "MenuOptions",
132
   props: {
132
   props: {
133
     showItem: { default: {} }
133
     showItem: { default: {} }
134
   },
134
   },
135
+  components: {
136
+    optionSelector
137
+  },
135
   data() {
138
   data() {
136
     return {
139
     return {
137
       wait: true,
140
       wait: true,
138
-      radio: "",
139
       item: {},
141
       item: {},
140
       qty: 1,
142
       qty: 1,
141
-      subTotal: 0
143
+      subTotal: 0,
144
+      selection: []
142
     };
145
     };
143
   },
146
   },
144
   methods: {
147
   methods: {
145
     Close() {
148
     Close() {
149
+      this.item.specialInstructions = "";
150
+      this.selection = [];
151
+      this.qty = 1;
146
       this.$emit("CloseOptions", false);
152
       this.$emit("CloseOptions", false);
147
     },
153
     },
148
     Plus() {
154
     Plus() {
149
       this.qty = this.qty + 1;
155
       this.qty = this.qty + 1;
150
-      this.subTotal = this.item.price * this.qty;
151
     },
156
     },
152
     Minus() {
157
     Minus() {
153
       this.qty = this.qty - 1;
158
       this.qty = this.qty - 1;
154
       if (this.qty === 0) {
159
       if (this.qty === 0) {
155
         this.qty = 1;
160
         this.qty = 1;
156
       }
161
       }
157
-      this.subTotal = this.item.price * this.qty;
162
+    },
163
+    CheckItem(value) {
164
+      alert(JSON.stringify(value));
165
+    },
166
+    UpdateSelection(value) {
167
+      if (value.value) {
168
+        this.selection.push(value.field);
169
+      } else {
170
+        for (let i = 0; i < this.selection.length; i++) {
171
+          if (this.selection[i].id === value.field.id) {
172
+            this.selection.splice(i, 1);
173
+          }
174
+        }
175
+      }
176
+    },
177
+    UpdateSelectionQty(value) {
178
+      this.selection.find(s => s.id == value.id).qty = value.qty;
179
+    },
180
+    AddToCart() {
181
+      const cartItem = {
182
+        id: this.item.id,
183
+        description: this.item.description,
184
+        image: this.item.image,
185
+        name: this.item.name,
186
+        subTotal: this.subTotal,
187
+        specialInstructions: this.specialInstructions,
188
+        qty: this.qty,
189
+        selection: this.selection
190
+      };
191
+
192
+      this.cartItems.push(cartItem);
193
+      this.item.specialInstructions = "";
194
+      this.selection = [];
195
+      this.qty = 1;
196
+      this.$emit("CloseOptions", false);
197
+    }
198
+  },
199
+  computed: {
200
+    ...mapState("cart", ["cartItems"]),
201
+    SubTotal() {
202
+      var price = this.item.price * this.qty;
203
+
204
+      for (let i = 0; i < this.selection.length; i++) {
205
+        if (this.selection[i].price > 0) {
206
+          let optionPrice = this.selection[i].price * this.selection[i].qty;
207
+          price = price + optionPrice;
208
+        }
209
+      }
210
+      return price;
158
     }
211
     }
159
   },
212
   },
160
   watch: {
213
   watch: {

+ 41
- 0
src/components/orders/cart.vue Parādīt failu

1
+<template>
2
+  <div class="container">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col-md-12 col-lg-8">
6
+          <div class="title-box-d">
7
+            <br />
8
+            <h1 class="title-d" style="text-align:left; font-size: 250%">My Cart</h1>
9
+          </div>
10
+        </div>
11
+      </div>
12
+      <!-- ListView -->
13
+      <ListView :items="cartItems" :displayColumns="columns" :displayFormats="formats" />
14
+    </div>
15
+  </div>
16
+</template>
17
+
18
+<script>
19
+import { mapState, mapActions } from "vuex";
20
+import ListView from "../shared/listView";
21
+
22
+export default {
23
+  name: "MyCart",
24
+  components: {
25
+    ListView
26
+  },
27
+  data() {
28
+    return {
29
+      wait: true,
30
+      columns: ["image", "name", "description", "qty", "subTotal"],
31
+      formats: ["image", "", "", "", "money"]
32
+    };
33
+  },
34
+  methods: {
35
+    New() {}
36
+  },
37
+  computed: {
38
+    ...mapState("cart", ["cartItems"])
39
+  }
40
+};
41
+</script>

+ 79
- 0
src/components/orders/orderOptionSelection.vue Parādīt failu

1
+<template>
2
+  <div class="container">
3
+    <div class="row" v-for="(choice, i) in item.options" :key="i">
4
+      <div class="col-sm-1">
5
+        <input
6
+          v-if="item.optionType === 'Multiple' || item.optionType === 'MultipleLimit'"
7
+          type="checkbox"
8
+          v-model="selection[i]"
9
+          @change="UpdateSelection(choice, i)"
10
+        />
11
+        <input
12
+          v-else
13
+          type="radio"
14
+          v-model="selection[i]"
15
+          name="RadioOption"
16
+          :value="choice.description"
17
+          @change="UpdateSelection(choice, i)"
18
+        />
19
+      </div>
20
+      <!-- Description -->
21
+      <div class="col-sm-6">
22
+        <label>{{ choice.description }}</label>
23
+      </div>
24
+      <!-- Qty -->
25
+      <div class="col-sm-3" v-if="choice.price > 0">
26
+        <input
27
+          class="form-control"
28
+          type="number"
29
+          :name="choice.description"
30
+          v-model="qtys[i]"
31
+          placeholder="qty"
32
+          :min="1"
33
+          @change="UpdateSelectionQty(choice, i)"
34
+        />
35
+      </div>
36
+      <!-- Price -->
37
+      <div class="col-sm-2" v-if="choice.price > 0">
38
+        <label>R {{ choice.price }}</label>
39
+      </div>
40
+    </div>
41
+  </div>
42
+</template>
43
+
44
+<script>
45
+export default {
46
+  name: "optionSelection",
47
+  props: {
48
+    item: { type: Object, default: () => {} }
49
+  },
50
+  data() {
51
+    return {
52
+      selection: [],
53
+      qtys: []
54
+    };
55
+  },
56
+  methods: {
57
+    UpdateSelection(field, index) {
58
+      this.qtys[index] = 1;
59
+      const item = {
60
+        field: field,
61
+        value: this.selection[index]
62
+      };
63
+
64
+      item.field.qty = this.qtys[index];
65
+
66
+      if (!item.value) {
67
+        this.qtys[index] = "Undefined";
68
+      }
69
+      this.$emit("UpdateSelection", item);
70
+    },
71
+    UpdateSelectionQty(field, index) {
72
+      field.qty = Number(this.qtys[index]);
73
+
74
+      //alert(JSON.stringify(field));
75
+      this.$emit("UpdateSelectionQty", field);
76
+    }
77
+  }
78
+};
79
+</script>

+ 23
- 10
src/components/restaurants/restaurantMenuOption.vue Parādīt failu

110
       <div class="col-md-12" style="margin-bottomL 1em">
110
       <div class="col-md-12" style="margin-bottomL 1em">
111
         <div class="row offset-md-5">
111
         <div class="row offset-md-5">
112
           <div class="col-md-2">
112
           <div class="col-md-2">
113
-            <button @click="Save()" class="btn btn-b-n" type="button" data-dismiss="modal">Save</button>
113
+            <button
114
+              @click="Save()"
115
+              class="btn btn-b-n"
116
+              type="button"
117
+              data-dismiss="modal"
118
+              name="SaveButton"
119
+            >Save</button>
114
           </div>
120
           </div>
115
           <div class="col-md-2">
121
           <div class="col-md-2">
116
-            <button @click="Close()" class="btn btn-b-n" type="button" data-dismiss="modal">Close</button>
122
+            <button
123
+              @click="Close()"
124
+              class="btn btn-b-n"
125
+              type="button"
126
+              data-dismiss="modal"
127
+              name="CloseButton"
128
+            >Close</button>
117
           </div>
129
           </div>
118
         </div>
130
         </div>
119
       </div>
131
       </div>
162
     },
174
     },
163
     Save() {
175
     Save() {
164
       this.wait = true;
176
       this.wait = true;
177
+      this.menuOption.restaurantId = this.restaurantId;
165
       if (this.menuOption.categoryDescription !== "All") {
178
       if (this.menuOption.categoryDescription !== "All") {
166
         var category = this.categories.find(
179
         var category = this.categories.find(
167
           c => c.description === this.menuOption.categoryDescription
180
           c => c.description === this.menuOption.categoryDescription
171
         this.menuOption.categoryId = 0;
184
         this.menuOption.categoryId = 0;
172
       }
185
       }
173
       alert(JSON.stringify(this.menuOption));
186
       alert(JSON.stringify(this.menuOption));
174
-      // if (this.menuOption.id === 0) {
175
-      //   this.addMenuOption(this.menuOption).then(result => {
176
-      //     this.$router.push("/MenuOptions");
177
-      //   });
178
-      // } else {
179
-      //   this.updateMenuOption(this.menuOption);
180
-      //   this.$router.push("/MenuOptions");
181
-      // }
187
+      if (this.menuOption.id === 0) {
188
+        this.addMenuOption(this.menuOption).then(result => {
189
+          this.$router.push("/MenuOptions");
190
+        });
191
+      } else {
192
+        this.updateMenuOption(this.menuOption);
193
+        this.$router.push("/MenuOptions");
194
+      }
182
     },
195
     },
183
     New() {
196
     New() {
184
       this.selectedItem = null;
197
       this.selectedItem = null;

+ 59
- 0
src/components/restaurants/restaurantRole.vue Parādīt failu

1
+<template>
2
+  <div class="container">
3
+    <div class="row">
4
+      <div class="col-md-12" style="margin-bottom: 1em">
5
+        <h1>Role</h1>
6
+      </div>
7
+    </div>
8
+    <div class="row" style="text-align:left">
9
+      <div class="col-md-12" style="margin-bottom: 1em">
10
+        <label>Role Name</label>
11
+        <div class="input-group-prepend">
12
+          <span class="input-group-text">
13
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
14
+          </span>
15
+          <input class="form-control" type="text" name="description" />
16
+        </div>
17
+      </div>
18
+    </div>
19
+    <div class="container">
20
+      <div class="form-group row">
21
+        <div class="col-md-12">
22
+          <ListView
23
+            :showColumnChooser="false"
24
+            :editable="true"
25
+            :hideSearch="true"
26
+            :deleteable="true"
27
+            @onEdit="Edit"
28
+            @onDelete="Delete"
29
+            @onNew="New"
30
+          />
31
+        </div>
32
+      </div>
33
+      <div v-if="wait" id="preloader"></div>
34
+    </div>
35
+    <div class="row"></div>
36
+    <div class="row">
37
+      <div class="col-md-12" style="margin-bottom: 1em">
38
+        <div class="input-group-prepend">
39
+          <b-button class="btn btn-b-n" @click="Ok">Ok</b-button>
40
+        </div>
41
+      </div>
42
+    </div>
43
+  </div>
44
+</template>
45
+
46
+<script>
47
+import ListView from "../shared/listView";
48
+export default {
49
+  name: "Role",
50
+  components: {
51
+    ListView
52
+  },
53
+  data() {
54
+    return {
55
+      wait: false
56
+    };
57
+  }
58
+};
59
+</script>

+ 95
- 0
src/components/restaurants/restaurantRoles.vue Parādīt failu

1
+<template>
2
+  <div>
3
+    <div class="container">
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%">Restaurant User Roles</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+      </div>
14
+    </div>
15
+    <div class="container">
16
+      <div class="form-group row">
17
+        <div class="col-md-12">
18
+          <ListView
19
+            :showColumnChooser="false"
20
+            :editable="true"
21
+            :hideSearch="true"
22
+            :deleteable="true"
23
+            @onEdit="Edit"
24
+            @onDelete="Delete"
25
+            @onNew="New"
26
+          />
27
+        </div>
28
+      </div>
29
+      <div v-if="wait" id="preloader"></div>
30
+    </div>
31
+  </div>
32
+</template>
33
+
34
+<script>
35
+import ListView from "../shared/listView";
36
+import { mapState, mapActions } from "vuex";
37
+import Log from "../../assets/Log";
38
+
39
+export default {
40
+  name: "RestaurantUserRoles",
41
+  components: {
42
+    ListView
43
+  },
44
+  data() {
45
+    return {
46
+      wait: false,
47
+      restaurantId: Log.restaurantId()
48
+    };
49
+  },
50
+  methods: {
51
+    // ...mapActions("restaurantUser", [
52
+    //   "getUsers",
53
+    //   "getUser",
54
+    //   "insertUser",
55
+    //   "updateUser",
56
+    //   "deleteUser"
57
+    // ]),
58
+    New() {
59
+      //   this.getUser(0);
60
+      this.$router.push("/RestaurantRole/0");
61
+    },
62
+    Edit(item) {
63
+      //   this.getUser(item.id);
64
+      //   this.$modal.show("role");
65
+    },
66
+    Delete(item) {
67
+      //   this.deleteUser(item);
68
+    }
69
+    // UpdateUser(item) {
70
+    //   const restUser = {
71
+    //     restaurantId: this.restaurantId,
72
+    //     user: item
73
+    //   };
74
+
75
+    //   if (item.id == 0) {
76
+    //     this.insertUser(restUser);
77
+    //   } else {
78
+    //     this.updateUser(restUser);
79
+    //   }
80
+    //   this.$modal.hide("User");
81
+    // }
82
+  },
83
+  computed: {
84
+    //...mapState("restaurantUser", ["restaurantUsers", "restaurantUser"]),
85
+    // CurrentUser() {
86
+    //   return this.restaurantUser.user;
87
+    // }
88
+  },
89
+  mounted() {
90
+    // this.getUsers(this.restaurantId).then(() => {
91
+    //   this.wait = false;
92
+    // });
93
+  }
94
+};
95
+</script>

+ 91
- 0
src/components/restaurants/restaurantUser.vue Parādīt failu

1
+<template>
2
+  <div class="container">
3
+    <div class="row">
4
+      <div class="col-md-12" style="margin-bottom: 1em">
5
+        <h1>User</h1>
6
+      </div>
7
+    </div>
8
+    <div class="row" style="text-align:left">
9
+      <div class="col-md-12" style="margin-bottom: 1em">
10
+        <label>Email</label>
11
+        <div class="input-group-prepend">
12
+          <span class="input-group-text">
13
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
14
+          </span>
15
+          <input class="form-control" type="text" name="description" v-model="user.emailAddress" />
16
+        </div>
17
+      </div>
18
+    </div>
19
+    <div class="row" style="text-align:left">
20
+      <div class="col-md-12" style="margin-bottom: 1em">
21
+        <label>First Name</label>
22
+        <div class="input-group-prepend">
23
+          <span class="input-group-text">
24
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
25
+          </span>
26
+          <input class="form-control" type="text" name="description" v-model="user.firstName" />
27
+        </div>
28
+      </div>
29
+    </div>
30
+    <div class="row" style="text-align:left">
31
+      <div class="col-md-12" style="margin-bottom: 1em">
32
+        <label>Surname</label>
33
+        <div class="input-group-prepend">
34
+          <span class="input-group-text">
35
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
36
+          </span>
37
+          <input class="form-control" type="text" name="description" v-model="user.surname" />
38
+        </div>
39
+      </div>
40
+    </div>
41
+    <div class="row" style="text-align:left">
42
+      <div class="col-md-12" style="margin-bottom: 1em">
43
+        <label>Cellphone</label>
44
+        <div class="input-group-prepend">
45
+          <span class="input-group-text">
46
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
47
+          </span>
48
+          <input class="form-control" type="text" name="description" v-model="user.cellphone" />
49
+        </div>
50
+      </div>
51
+    </div>
52
+    <div class="row"></div>
53
+    <div class="row">
54
+      <div class="col-md-12" style="margin-bottom: 1em">
55
+        <div class="input-group-prepend">
56
+          <b-button class="btn btn-b-n" @click="Ok">Ok</b-button>
57
+        </div>
58
+      </div>
59
+    </div>
60
+  </div>
61
+</template>
62
+
63
+<script>
64
+export default {
65
+  name: "RestaurantUser",
66
+  props: {
67
+    editUser: { default: {} }
68
+  },
69
+  data() {
70
+    return {
71
+      hasImage: false,
72
+      user: {}
73
+    };
74
+  },
75
+  methods: {
76
+    Ok() {
77
+      this.$emit("UpdateUser", this.user);
78
+    }
79
+  },
80
+  watch: {
81
+    editUser: {
82
+      immediate: true,
83
+      handler(val, oldVal) {
84
+        if (val) {
85
+          this.user = val;
86
+        }
87
+      }
88
+    }
89
+  }
90
+};
91
+</script>

+ 103
- 0
src/components/restaurants/restaurantUsers.vue Parādīt failu

1
+<template>
2
+  <div>
3
+    <div class="container">
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%">Restaurant Users</h1>
10
+            </div>
11
+          </div>
12
+        </div>
13
+      </div>
14
+    </div>
15
+    <div class="container">
16
+      <div class="form-group row">
17
+        <div class="col-md-12">
18
+          <ListView
19
+            :items="restaurantUsers"
20
+            :showColumnChooser="false"
21
+            :editable="true"
22
+            :hideSearch="true"
23
+            :deleteable="true"
24
+            :displayColumns="columns"
25
+            @onEdit="Edit"
26
+            @onDelete="Delete"
27
+            @onNew="New"
28
+          />
29
+        </div>
30
+        <modal name="User" :width="600" :height="470">
31
+          <User @UpdateUser="UpdateUser" :editUser="CurrentUser" />
32
+        </modal>
33
+      </div>
34
+      <div v-if="wait" id="preloader"></div>
35
+    </div>
36
+  </div>
37
+</template>
38
+
39
+<script>
40
+import User from "./restaurantUser";
41
+import ListView from "../shared/listView";
42
+import { mapState, mapActions } from "vuex";
43
+import Log from "../../assets/Log";
44
+
45
+export default {
46
+  name: "RestaurantCategoryList",
47
+  components: {
48
+    ListView,
49
+    User
50
+  },
51
+  data() {
52
+    return {
53
+      wait: true,
54
+      columns: ["emailAddress", "firstName", "surname", "cellphone"],
55
+      restaurantId: Log.restaurantId()
56
+    };
57
+  },
58
+  methods: {
59
+    ...mapActions("restaurantUser", [
60
+      "getUsers",
61
+      "getUser",
62
+      "insertUser",
63
+      "updateUser",
64
+      "deleteUser"
65
+    ]),
66
+    New() {
67
+      this.getUser(0);
68
+      this.$modal.show("User");
69
+    },
70
+    Edit(item) {
71
+      this.getUser(item.id);
72
+      this.$modal.show("User");
73
+    },
74
+    Delete(item) {
75
+      this.deleteUser(item);
76
+    },
77
+    UpdateUser(item) {
78
+      const restUser = {
79
+        restaurantId: this.restaurantId,
80
+        user: item
81
+      };
82
+
83
+      if (item.id == 0) {
84
+        this.insertUser(restUser);
85
+      } else {
86
+        this.updateUser(restUser);
87
+      }
88
+      this.$modal.hide("User");
89
+    }
90
+  },
91
+  computed: {
92
+    ...mapState("restaurantUser", ["restaurantUsers", "restaurantUser"]),
93
+    CurrentUser() {
94
+      return this.restaurantUser.user;
95
+    }
96
+  },
97
+  mounted() {
98
+    this.getUsers(this.restaurantId).then(() => {
99
+      this.wait = false;
100
+    });
101
+  }
102
+};
103
+</script>

+ 52
- 0
src/components/restaurants/rolePremission.vue Parādīt failu

1
+<template>
2
+  <div class="container">
3
+    <div class="row">
4
+      <div class="col-md-12" style="margin-bottom: 1em">
5
+        <h1>Premission</h1>
6
+      </div>
7
+    </div>
8
+    <div class="row" style="text-align:left">
9
+      <div class="col-md-12" style="margin-bottom: 1em">
10
+        <label>Target</label>
11
+        <div class="input-group-prepend">
12
+          <span class="input-group-text">
13
+            <eva-icon name="credit-card-outline" fill="#24aae1"></eva-icon>
14
+          </span>
15
+          <select class="form-control">
16
+            <option value="Details">Restaurant Details</option>
17
+            <option value="MenuCategories">Menu Categories</option>
18
+            <option value="MenuOptions">Menu Options</option>
19
+            <option value="Menu">Menu</option>
20
+            <option value="Orders">Orders</option>
21
+            <option value="Users">Users</option>
22
+            <option value="Roles">Roles</option>
23
+          </select>
24
+        </div>
25
+      </div>
26
+    </div>
27
+
28
+    <div class="row"></div>
29
+    <div class="row">
30
+      <div class="col-md-12" style="margin-bottom: 1em">
31
+        <div class="input-group-prepend">
32
+          <b-button class="btn btn-b-n" @click="Ok">Ok</b-button>
33
+        </div>
34
+      </div>
35
+    </div>
36
+  </div>
37
+</template>
38
+
39
+<script>
40
+import ListView from "../shared/listView";
41
+export default {
42
+  name: "Role",
43
+  components: {
44
+    ListView
45
+  },
46
+  data() {
47
+    return {
48
+      wait: false
49
+    };
50
+  }
51
+};
52
+</script>

+ 37
- 34
src/components/shared/listView.vue Parādīt failu

15
               class="btn btn-primary myBackground btn-width cursor-pointer"
15
               class="btn btn-primary myBackground btn-width cursor-pointer"
16
               data-toggle="modal"
16
               data-toggle="modal"
17
               data-target="#myModal"
17
               data-target="#myModal"
18
-            >
19
-              Column Chooser
20
-            </div>
18
+            >Column Chooser</div>
21
             <div class="col-md-12">
19
             <div class="col-md-12">
22
               <div id="myModal" class="modal fade" role="dialog">
20
               <div id="myModal" class="modal fade" role="dialog">
23
                 <div class="modal-dialog modal-lg">
21
                 <div class="modal-dialog modal-lg">
39
             <div
37
             <div
40
               class="btn btn-primary myBackground btn-width cursor-pointer"
38
               class="btn btn-primary myBackground btn-width cursor-pointer"
41
               @click="onClearSelected()"
39
               @click="onClearSelected()"
42
-            >
43
-              Clear Selected
44
-            </div>
40
+            >Clear Selected</div>
45
           </div>
41
           </div>
46
           <div class="p2" v-if="showNew">
42
           <div class="p2" v-if="showNew">
47
-            <div class="btn btn-primary myBackground btn-width cursor-pointer" @click="onNew()">
48
-              New
49
-            </div>
43
+            <div class="btn btn-primary myBackground btn-width cursor-pointer" @click="onNew()">New</div>
50
           </div>
44
           </div>
51
         </div>
45
         </div>
52
       </div>
46
       </div>
67
                 :class="{ active: hover === c }"
61
                 :class="{ active: hover === c }"
68
               >
62
               >
69
                 <div class="d-flex bd-highlight">
63
                 <div class="d-flex bd-highlight">
70
-                  <div v-if="displayHeaders.length === 0" class="p-2 w-100 bd-highlight">
71
-                    {{ column | toProper }}
72
-                  </div>
73
-                  <div v-else class="p-2 w-100 bd-highlight">
74
-                    {{ displayHeaders[c] !== "" ? displayHeaders[c] : column | toProper }}
75
-                  </div>
64
+                  <div
65
+                    v-if="displayHeaders.length === 0"
66
+                    class="p-2 w-100 bd-highlight"
67
+                  >{{ column | toProper }}</div>
68
+                  <div
69
+                    v-else
70
+                    class="p-2 w-100 bd-highlight"
71
+                  >{{ displayHeaders[c] !== "" ? displayHeaders[c] : column | toProper }}</div>
76
                   <div class="p-2 flex-shrink-1 bd-highlight">
72
                   <div class="p-2 flex-shrink-1 bd-highlight">
77
                     <img
73
                     <img
78
                       src="../../../public/img/sort-up.png"
74
                       src="../../../public/img/sort-up.png"
101
             :class="{ selected: isSelected(i), 'cursor-pointer': allowSelect }"
97
             :class="{ selected: isSelected(i), 'cursor-pointer': allowSelect }"
102
           >
98
           >
103
             <td v-for="(column, c) in Columns" :key="c">
99
             <td v-for="(column, c) in Columns" :key="c">
104
-              <div v-if="displayFormats.length === 0">
105
-                {{ isObject(item[column]) ? item[column].display : item[column] }}
106
-              </div>
100
+              <div
101
+                v-if="displayFormats.length === 0"
102
+              >{{ isObject(item[column]) ? item[column].display : item[column] }}</div>
107
               <div v-else-if="displayFormats.length > 0 && displayFormats[c] === 'date'">
103
               <div v-else-if="displayFormats.length > 0 && displayFormats[c] === 'date'">
108
-                <div v-if="item[column] !== '0001-01-01T00:00:00'">
109
-                  {{ isObject(item[column]) ? item[column].display : item[column] | toDate }}
110
-                </div>
111
-              </div>
112
-              <div v-else-if="displayFormats.length > 0 && displayFormats[c] === 'money'">
113
-                {{ isObject(item[column]) ? item[column].display : item[column] | toCurrency }}
104
+                <div
105
+                  v-if="item[column] !== '0001-01-01T00:00:00'"
106
+                >{{ isObject(item[column]) ? item[column].display : item[column] | toDate }}</div>
114
               </div>
107
               </div>
108
+              <div
109
+                v-else-if="displayFormats.length > 0 && displayFormats[c] === 'money'"
110
+              >{{ isObject(item[column]) ? item[column].display : item[column] | toCurrency }}</div>
115
               <div v-else-if="displayFormats.length > 0 && displayFormats[c] === 'image'">
111
               <div v-else-if="displayFormats.length > 0 && displayFormats[c] === 'image'">
116
                 <img :src="item[column]" style="height:100px; width:100px; object-fit: cover;" />
112
                 <img :src="item[column]" style="height:100px; width:100px; object-fit: cover;" />
117
               </div>
113
               </div>
118
               <div v-else>{{ isObject(item[column]) ? item[column].display : item[column] }}</div>
114
               <div v-else>{{ isObject(item[column]) ? item[column].display : item[column] }}</div>
119
             </td>
115
             </td>
120
             <td v-if="showCustomAction" class="my-width">
116
             <td v-if="showCustomAction" class="my-width">
121
-              <button type="button" class="btn my-btn" @click="onCustomClick(item)">
122
-                {{ CustomActionHeading }}
123
-              </button>
117
+              <button
118
+                type="button"
119
+                class="btn my-btn"
120
+                @click="onCustomClick(item)"
121
+              >{{ CustomActionHeading }}</button>
124
             </td>
122
             </td>
125
             <td v-if="editable" class="my-width">
123
             <td v-if="editable" class="my-width">
126
               <button type="button" class="btn my-btn" @click="onEdit(item)">Edit</button>
124
               <button type="button" class="btn my-btn" @click="onEdit(item)">Edit</button>
134
       <div class="d-flex justify-content-between" v-if="showPager">
132
       <div class="d-flex justify-content-between" v-if="showPager">
135
         <div class="p-1">
133
         <div class="p-1">
136
           {{
134
           {{
137
-            currentPage +
138
-              " / " +
139
-              PageCount +
140
-              (!hideItemCount ? " - (" + FilteredItems.length + " items)" : "")
135
+          currentPage +
136
+          " / " +
137
+          PageCount +
138
+          (!hideItemCount ? " - (" + FilteredItems.length + " items)" : "")
141
           }}
139
           }}
142
         </div>
140
         </div>
143
         <div class="p-1">
141
         <div class="p-1">
244
       default: []
242
       default: []
245
     },
243
     },
246
     displayFormats: {
244
     displayFormats: {
247
-      default: []
245
+      type: Array,
246
+      default: () => []
248
     },
247
     },
249
     displayHeaders: {
248
     displayHeaders: {
250
-      default: []
249
+      type: Array,
250
+      default: () => []
251
     },
251
     },
252
     showCustomAction: {
252
     showCustomAction: {
253
       default: false
253
       default: false
290
         for (const i in Object.keys(this.items)) {
290
         for (const i in Object.keys(this.items)) {
291
           const item = this.items[i];
291
           const item = this.items[i];
292
           for (const o in Object.keys(item)) {
292
           for (const o in Object.keys(item)) {
293
-            if (!listAll.includes(Object.keys(item)[o]) && !Array.isArray(Object.values(item)[o])) {
293
+            if (
294
+              !listAll.includes(Object.keys(item)[o]) &&
295
+              !Array.isArray(Object.values(item)[o])
296
+            ) {
294
               const columnName = Object.keys(item)[o];
297
               const columnName = Object.keys(item)[o];
295
               if (!listAll.some(x => x.column === columnName)) {
298
               if (!listAll.some(x => x.column === columnName)) {
296
                 listAll.push({
299
                 listAll.push({

+ 17
- 6
src/components/shared/navBar.vue Parādīt failu

24
             alt="UVProp logo"
24
             alt="UVProp logo"
25
             style="width:110px;height:60px;"
25
             style="width:110px;height:60px;"
26
           />
26
           />
27
-          Food Glorious Food
27
+          Fork-Ing Fast
28
         </div>
28
         </div>
29
         <button
29
         <button
30
           type="button"
30
           type="button"
109
                 <hr />
109
                 <hr />
110
                 <a
110
                 <a
111
                   class="dropdown-item cursor-pointer"
111
                   class="dropdown-item cursor-pointer"
112
-                  @click="routerGoTo('/status/timeshareAdmin')"
112
+                  @click="routerGoTo('/RestaurantUsers')"
113
                 >Users</a>
113
                 >Users</a>
114
                 <a
114
                 <a
115
                   class="dropdown-item cursor-pointer"
115
                   class="dropdown-item cursor-pointer"
116
-                  @click="routerGoTo('/status/timeshareAdmin')"
116
+                  @click="routerGoTo('/RestaurantRoles')"
117
                 >Roles</a>
117
                 >Roles</a>
118
               </div>
118
               </div>
119
               <div
119
               <div
152
               </span>
152
               </span>
153
             </li>
153
             </li>
154
           </ul>
154
           </ul>
155
-          <!-- <i class="fa fa-shopping-cart"></i> -->
156
         </div>
155
         </div>
157
       </div>
156
       </div>
157
+      <button type="button" class="btn btn-b-n" style="border-radius:20px" @click="GoToCart">
158
+        <eva-icon name="shopping-cart-outline" fill="white"></eva-icon>
159
+        <label>
160
+          <b>&nbsp;&nbsp;{{ CartCount }}</b>
161
+        </label>
162
+      </button>
158
     </div>
163
     </div>
159
   </nav>
164
   </nav>
160
 </template>
165
 </template>
161
 
166
 
162
 <script>
167
 <script>
163
-// import { mapState, mapActions } from "vuex";
168
+import { mapState, mapActions } from "vuex";
164
 // import Log from "../../assets/Log";
169
 // import Log from "../../assets/Log";
165
 
170
 
166
 export default {
171
 export default {
167
   computed: {
172
   computed: {
168
     //...mapState("authentication", ["user", "flag", "status", "person", "token"]),
173
     //...mapState("authentication", ["user", "flag", "status", "person", "token"]),
174
+    ...mapState("cart", ["cartItems"]),
169
     isLoggedIn() {
175
     isLoggedIn() {
170
       // console.log(Log.isLoggedIn());
176
       // console.log(Log.isLoggedIn());
171
       // return Log.isLoggedIn();
177
       // return Log.isLoggedIn();
183
     // eslint-disable-next-line vue/return-in-computed-property
189
     // eslint-disable-next-line vue/return-in-computed-property
184
     Logout() {
190
     Logout() {
185
       return this.logout();
191
       return this.logout();
192
+    },
193
+    CartCount() {
194
+      return this.cartItems.length;
186
     }
195
     }
187
   },
196
   },
188
   methods: {
197
   methods: {
189
     //...mapActions("authentication", ["logout"]),
198
     //...mapActions("authentication", ["logout"]),
190
-
191
     routerGoTo(goTo) {
199
     routerGoTo(goTo) {
192
       this.$emit("routerGoTo", goTo);
200
       this.$emit("routerGoTo", goTo);
193
     },
201
     },
194
     Search() {
202
     Search() {
195
       this.$router.push("/search");
203
       this.$router.push("/search");
204
+    },
205
+    GoToCart() {
206
+      this.$router.push("/Cart");
196
     }
207
     }
197
   }
208
   }
198
 };
209
 };

+ 24
- 0
src/router/index.js Parādīt failu

22
 import RestaurantMenuItem from "../components/restaurants/restaurantMenuItem.vue"
22
 import RestaurantMenuItem from "../components/restaurants/restaurantMenuItem.vue"
23
 import RestaurantMenuItemOptions from "../components/restaurants/restaurantMenuItemOptions.vue";
23
 import RestaurantMenuItemOptions from "../components/restaurants/restaurantMenuItemOptions.vue";
24
 import MenuItems from "../components/home/menuItems.vue";
24
 import MenuItems from "../components/home/menuItems.vue";
25
+import Cart from "../components/orders/cart.vue";
26
+import RestaurantUsers from "../components/restaurants/restaurantUsers.vue";
27
+import RestaurantRoles from "../components/restaurants/restaurantRoles.vue";
28
+import RestaurantRole from "../components/restaurants/restaurantRole.vue";
25
 
29
 
26
 Vue.use(Router);
30
 Vue.use(Router);
27
 
31
 
127
       path: "/Menu/:restautantid",
131
       path: "/Menu/:restautantid",
128
       name: "MenuItems",
132
       name: "MenuItems",
129
       component: MenuItems
133
       component: MenuItems
134
+    },
135
+    {
136
+      path: "/Cart",
137
+      name: "Cart",
138
+      component: Cart
139
+    },
140
+    {
141
+      path: "/RestaurantUsers",
142
+      name: "RestaurantUsers",
143
+      component: RestaurantUsers
144
+    },
145
+    {
146
+      path: "/RestaurantRoles",
147
+      name: "RestaurantRoles",
148
+      component: RestaurantRoles
149
+    },
150
+    {
151
+      path: "/RestaurantRole/:id",
152
+      name: "RestaurantRole",
153
+      component: RestaurantRole
130
     }
154
     }
131
   ]
155
   ]
132
 });
156
 });

+ 6
- 2
src/store/index.js Parādīt failu

11
 import MenuCategories from './modules/restaurants/restaurantMenuCategories';
11
 import MenuCategories from './modules/restaurants/restaurantMenuCategories';
12
 import MenuOptions from './modules/restaurants/restaurantMenuOptions';
12
 import MenuOptions from './modules/restaurants/restaurantMenuOptions';
13
 import Menu from './modules/restaurants/restaurantMenu';
13
 import Menu from './modules/restaurants/restaurantMenu';
14
-import HomeMenu from './modules/restaurants/menu'
14
+import HomeMenu from './modules/restaurants/menu';
15
+import Cart from './modules/orders/cart';
16
+import RestaurantUser from './modules/restaurants/restaurantUsers';
15
 
17
 
16
 Vue.use(Vuex);
18
 Vue.use(Vuex);
17
 /* eslint no-param-reassign: ["error", { "props": false }] */
19
 /* eslint no-param-reassign: ["error", { "props": false }] */
27
     menuCategories: MenuCategories,
29
     menuCategories: MenuCategories,
28
     menuOptions: MenuOptions,
30
     menuOptions: MenuOptions,
29
     menu: Menu,
31
     menu: Menu,
30
-    homeMenu: HomeMenu
32
+    homeMenu: HomeMenu,
33
+    cart: Cart,
34
+    restaurantUser: RestaurantUser
31
   },
35
   },
32
 });
36
 });

+ 11
- 0
src/store/modules/orders/cart.js Parādīt failu

1
+import axios from 'axios'
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    cartItems: []
7
+  },
8
+  mutations: {},
9
+  getters: {},
10
+  actions: {}
11
+}

+ 1
- 1
src/store/modules/restaurants/menu.js Parādīt failu

27
       commit
27
       commit
28
     }, item) {
28
     }, item) {
29
       axios
29
       axios
30
-        .get(`/api/menu/GetOptions/${item.menuId}/${item.categoryId}`)
30
+        .get(`/api/menu/GetOptions/${item.menuId}`)
31
         .then(result => commit("setOptions", result.data));
31
         .then(result => commit("setOptions", result.data));
32
     }
32
     }
33
   }
33
   }

+ 67
- 0
src/store/modules/restaurants/restaurantUsers.js Parādīt failu

1
+import axios from 'axios'
2
+
3
+export default {
4
+  namespaced: true,
5
+  state: {
6
+    restaurantUsers: [],
7
+    restaurantUser: {}
8
+  },
9
+  mutations: {
10
+    setUsers(state, users) {
11
+      state.restaurantUsers = users;
12
+    },
13
+    setUser(state, user) {
14
+      state.restaurantUser = user;
15
+    },
16
+    addUser(state, user) {
17
+      state.restaurantUsers.push(user);
18
+    },
19
+    updateUser(state, user) {
20
+      state.restaurantUser = user;
21
+      //state.restaurantUsers.find(res => res.id === user.id).cellphone = user.cellphone;
22
+      //TODO: update Restaurant Users list.
23
+    },
24
+    removeUser(state, user) {
25
+      state.restaurantUser = {};
26
+      state.restaurantUsers.pop(user);
27
+    }
28
+  },
29
+  getters: {},
30
+  actions: {
31
+    getUsers({
32
+      commit
33
+    }, restaurantId) {
34
+      axios
35
+        .get(`/api/RestaurantUser/GetRestaurantUsers/${restaurantId}`)
36
+        .then(result => commit("setUsers", result.data));
37
+    },
38
+    getUser({
39
+      commit
40
+    }, userId) {
41
+      axios
42
+        .get(`/api/RestaurantUser/${userId}`)
43
+        .then(result => commit("setUser", result.data));
44
+    },
45
+    insertUser({
46
+      commit
47
+    }, user) {
48
+      axios
49
+        .post('/api/RestaurantUser', user)
50
+        .then(result => commit("addUser", result.data));
51
+    },
52
+    updateUser({
53
+      commit
54
+    }, user) {
55
+      axios
56
+        .put('/api/RestaurantUser', user)
57
+        .then(result => commit("updateUser", user));
58
+    },
59
+    deleteUser({
60
+      commit
61
+    }, user) {
62
+      axios
63
+        .delete(`/api/RestaurantUser/${user.id}`)
64
+        .then(result => commit("removeUser", result.data));
65
+    }
66
+  }
67
+}

Notiek ielāde…
Atcelt
Saglabāt