|
@@ -0,0 +1,230 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="container">
|
|
3
|
+ <div class="row" style="text-align:left">
|
|
4
|
+ <!--Column 1 -->
|
|
5
|
+ <div class="col-md-6" style="margin-bottomL 1em">
|
|
6
|
+ <div class="row" style="text-align:left">
|
|
7
|
+ <div class="carousel-item-c">
|
|
8
|
+ <div class="card-box-b card-shadow news-box">
|
|
9
|
+ <div class="img-box-b">
|
|
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
|
+ />
|
|
18
|
+ </div>
|
|
19
|
+ <div class="card-overlay">
|
|
20
|
+ <div class="card-header-b">
|
|
21
|
+ <div class="card-title-b">
|
|
22
|
+ <h2 class="title-2" style="color: #ffffff;">{{ item.name }}</h2>
|
|
23
|
+ </div>
|
|
24
|
+ <div class="card-date">
|
|
25
|
+ <span class="date-a">{{ item.description }}</span>
|
|
26
|
+ </div>
|
|
27
|
+ <br />
|
|
28
|
+ <div class="card-category-b">
|
|
29
|
+ <span class="category-b">
|
|
30
|
+ <b>{{ item.displayPrice }}</b>
|
|
31
|
+ </span>
|
|
32
|
+ </div>
|
|
33
|
+ </div>
|
|
34
|
+ </div>
|
|
35
|
+ </div>
|
|
36
|
+ </div>
|
|
37
|
+ </div>
|
|
38
|
+ <div class="row">
|
|
39
|
+ <div class="col-md-12" style="margin-top: 1em">
|
|
40
|
+ <div class="row">
|
|
41
|
+ <div class="col-sm-3">
|
|
42
|
+ <button
|
|
43
|
+ @click="Minus()"
|
|
44
|
+ class="btn btn-b-n"
|
|
45
|
+ type="button"
|
|
46
|
+ style="border-radius:50px"
|
|
47
|
+ >
|
|
48
|
+ <eva-icon name="minus-outline" fill="white"></eva-icon>
|
|
49
|
+ </button>
|
|
50
|
+ </div>
|
|
51
|
+ <div class="col-sm-1">
|
|
52
|
+ <label style="margin-top: 0.5em">{{qty}}</label>
|
|
53
|
+ </div>
|
|
54
|
+ <div class="col-sm-3">
|
|
55
|
+ <button
|
|
56
|
+ @click="Plus()"
|
|
57
|
+ class="btn btn-b-n"
|
|
58
|
+ type="button"
|
|
59
|
+ style="border-radius:50px"
|
|
60
|
+ >
|
|
61
|
+ <eva-icon name="plus-outline" fill="white"></eva-icon>
|
|
62
|
+ </button>
|
|
63
|
+ </div>
|
|
64
|
+ <div class="col-sm-2">
|
|
65
|
+ <label style="margin-top: 0.5em">
|
|
66
|
+ <b>{{subTotal | toCurrency}}</b>
|
|
67
|
+ </label>
|
|
68
|
+ </div>
|
|
69
|
+ </div>
|
|
70
|
+ </div>
|
|
71
|
+ </div>
|
|
72
|
+ </div>
|
|
73
|
+ <!--Column 2 -->
|
|
74
|
+ <div class="col-md-6" style="margin-bottomL 1em">
|
|
75
|
+ <div class="row" style="text-align:left">
|
|
76
|
+ <div class="container" v-for="(item, i) in options" :key="i">
|
|
77
|
+ <div class="row">
|
|
78
|
+ <div class="col-sm-12">
|
|
79
|
+ <div class="title-box-d">
|
|
80
|
+ <h3 class="title-d">{{ item.description }}</h3>
|
|
81
|
+ </div>
|
|
82
|
+ </div>
|
|
83
|
+ </div>
|
|
84
|
+ <div class="row" v-if="item.subTitle">
|
|
85
|
+ <div class="col-sm-12">{{ item.subTitle }}</div>
|
|
86
|
+ </div>
|
|
87
|
+ <hr v-if="item.subTitle" />
|
|
88
|
+ <optionSelector
|
|
89
|
+ :item="item"
|
|
90
|
+ @UpdateSelection="UpdateSelection"
|
|
91
|
+ @UpdateSelectionQty="UpdateSelectionQty"
|
|
92
|
+ />
|
|
93
|
+ </div>
|
|
94
|
+ </div>
|
|
95
|
+ <hr />
|
|
96
|
+ <div class="row">
|
|
97
|
+ <div class="col-sm-12">
|
|
98
|
+ <label>Special Instructions</label>
|
|
99
|
+ <div class="input-group-prepend">
|
|
100
|
+ <textarea
|
|
101
|
+ class="form-control editor form-control-lg form-control-a"
|
|
102
|
+ v-model="item.specialInstructions"
|
|
103
|
+ />
|
|
104
|
+ </div>
|
|
105
|
+ </div>
|
|
106
|
+ </div>
|
|
107
|
+ </div>
|
|
108
|
+ </div>
|
|
109
|
+ <div class="row">
|
|
110
|
+ <br />
|
|
111
|
+ </div>
|
|
112
|
+
|
|
113
|
+ <div class="row">
|
|
114
|
+ <div class="col-md-12" style="margin-top: 1em">
|
|
115
|
+ <button @click="AddToCart()" class="btn btn-b-n" type="button">Add To Cart</button>
|
|
116
|
+ </div>
|
|
117
|
+ </div>
|
|
118
|
+ <div class="row">
|
|
119
|
+ <div class="col-md-12" style="margin-top: 1em">
|
|
120
|
+ <button @click="Close()" class="btn btn-b-n" type="button">Back</button>
|
|
121
|
+ </div>
|
|
122
|
+ </div>
|
|
123
|
+ </div>
|
|
124
|
+</template>
|
|
125
|
+
|
|
126
|
+<script>
|
|
127
|
+import { mapState, mapActions } from "vuex";
|
|
128
|
+import optionSelector from "../orders/orderOptionSelection";
|
|
129
|
+
|
|
130
|
+export default {
|
|
131
|
+ name: "MenuOptions",
|
|
132
|
+ props: {
|
|
133
|
+ showItem: { default: {} },
|
|
134
|
+ },
|
|
135
|
+ components: {
|
|
136
|
+ optionSelector,
|
|
137
|
+ },
|
|
138
|
+ data() {
|
|
139
|
+ return {
|
|
140
|
+ wait: true,
|
|
141
|
+ item: {},
|
|
142
|
+ qty: 1,
|
|
143
|
+ subTotal: 0,
|
|
144
|
+ selection: [],
|
|
145
|
+ };
|
|
146
|
+ },
|
|
147
|
+ methods: {
|
|
148
|
+ ...mapActions("homeMenu", ["getOptions"]),
|
|
149
|
+ Close() {
|
|
150
|
+ this.item.specialInstructions = "";
|
|
151
|
+ this.selection = [];
|
|
152
|
+ this.qty = 1;
|
|
153
|
+ this.$emit("CloseOptions", false);
|
|
154
|
+ },
|
|
155
|
+ Plus() {
|
|
156
|
+ this.qty = this.qty + 1;
|
|
157
|
+ },
|
|
158
|
+ Minus() {
|
|
159
|
+ this.qty = this.qty - 1;
|
|
160
|
+ if (this.qty === 0) {
|
|
161
|
+ this.qty = 1;
|
|
162
|
+ }
|
|
163
|
+ },
|
|
164
|
+ CheckItem(value) {
|
|
165
|
+ alert(JSON.stringify(value));
|
|
166
|
+ },
|
|
167
|
+ UpdateSelection(value) {
|
|
168
|
+ if (value.value) {
|
|
169
|
+ this.selection.push(value.field);
|
|
170
|
+ } else {
|
|
171
|
+ for (let i = 0; i < this.selection.length; i++) {
|
|
172
|
+ if (this.selection[i].id === value.field.id) {
|
|
173
|
+ this.selection.splice(i, 1);
|
|
174
|
+ }
|
|
175
|
+ }
|
|
176
|
+ }
|
|
177
|
+ },
|
|
178
|
+ UpdateSelectionQty(value) {
|
|
179
|
+ this.selection.find((s) => s.id == value.id).qty = value.qty;
|
|
180
|
+ },
|
|
181
|
+ AddToCart() {
|
|
182
|
+ const cartItem = {
|
|
183
|
+ id: this.item.id,
|
|
184
|
+ description: this.item.description,
|
|
185
|
+ image: this.item.image,
|
|
186
|
+ name: this.item.name,
|
|
187
|
+ subTotal: this.subTotal,
|
|
188
|
+ specialInstructions: this.specialInstructions,
|
|
189
|
+ qty: this.qty,
|
|
190
|
+ selection: this.selection,
|
|
191
|
+ };
|
|
192
|
+
|
|
193
|
+ this.cartItems.push(cartItem);
|
|
194
|
+ this.item.specialInstructions = "";
|
|
195
|
+ this.selection = [];
|
|
196
|
+ this.qty = 1;
|
|
197
|
+ this.$emit("CloseOptions", false);
|
|
198
|
+ },
|
|
199
|
+ },
|
|
200
|
+ computed: {
|
|
201
|
+ ...mapState("cart", ["cartItems"]),
|
|
202
|
+ ...mapState("homeMenu", ["options"]),
|
|
203
|
+ SubTotal() {
|
|
204
|
+ var price = this.item.price * this.qty;
|
|
205
|
+
|
|
206
|
+ for (let i = 0; i < this.selection.length; i++) {
|
|
207
|
+ if (this.selection[i].price > 0) {
|
|
208
|
+ let optionPrice = this.selection[i].price * this.selection[i].qty;
|
|
209
|
+ price = price + optionPrice;
|
|
210
|
+ }
|
|
211
|
+ }
|
|
212
|
+ return price;
|
|
213
|
+ },
|
|
214
|
+ },
|
|
215
|
+ watch: {
|
|
216
|
+ showItem: {
|
|
217
|
+ immediate: true,
|
|
218
|
+ handler(val, oldVal) {
|
|
219
|
+ if (val) {
|
|
220
|
+ this.item = val;
|
|
221
|
+ this.subTotal = this.item.price;
|
|
222
|
+ this.qty = this.item.qty;
|
|
223
|
+ this.selection = this.item.selection;
|
|
224
|
+ this.getOptions(val);
|
|
225
|
+ }
|
|
226
|
+ },
|
|
227
|
+ },
|
|
228
|
+ },
|
|
229
|
+};
|
|
230
|
+</script>
|