wad-lab 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +472 -631
- package/package.json +1 -1
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +241 -429
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemTable.vue +177 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +150 -441
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemStats.vue +64 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemTable.vue +195 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +41 -90
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemFormModal.vue +173 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemTable.vue +102 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/NavBar.vue +57 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +132 -296
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +126 -219
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemTable.vue +104 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/SideBar.vue +59 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/App.vue +19 -70
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
- package/templates/game-bingo/script.js +1 -1
- package/templates/game-memory-cards/script.js +2 -2
- package/templates/game-rock-paper-scissors/index.html +3 -3
- package/templates/game-rock-paper-scissors/script.js +2 -2
- package/templates/game-tic-tac-toe/script.js +2 -2
- package/templates/game-whack-a-mole/index.html +9 -9
- package/templates/servlet-basic/WEB-INF/ItemServlet.java +13 -0
- package/templates/servlet-basic/WEB-INF/classes/ItemServlet.class +0 -0
- package/templates/servlet-flow/WEB-INF/HelloServlet.java +34 -25
- package/templates/servlet-flow/WEB-INF/classes/HelloServlet.class +0 -0
- package/templates/servlet-jdbc/WEB-INF/JdbcItemServlet.java +13 -0
- package/templates/servlet-jdbc/WEB-INF/classes/JdbcItemServlet.class +0 -0
- package/templates/snippets/mongo-queries-cheatsheet.txt +105 -0
- package/templates/springboot-2model-aggregation-join/.mvn/wrapper/maven-wrapper.properties +3 -0
- package/templates/springboot-2model-aggregation-join/mvnw +295 -0
- package/templates/springboot-2model-aggregation-join/mvnw.cmd +189 -0
- package/templates/springboot-2model-aggregation-join/pom.xml +54 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/AggregationApplication.java +11 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/DepartmentController.java +65 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/EmployeeController.java +65 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/DepartmentStatsDTO.java +15 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/EmployeeJoinDTO.java +19 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Department.java +20 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Employee.java +21 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/DepartmentRepository.java +9 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/EmployeeRepository.java +9 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/DepartmentService.java +81 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/EmployeeService.java +80 -0
- package/templates/springboot-2model-aggregation-join/src/main/resources/application.properties +2 -0
- package/templates/springboot-2model-aggregation-join/src/test/java/com/example/aggregation/AggregationApplicationTests.java +13 -0
- package/templates/vue-2model-crud-patch/README.md +64 -0
- package/templates/vue-2model-crud-patch/index.html +12 -0
- package/templates/vue-2model-crud-patch/package-lock.json +1785 -0
- package/templates/vue-2model-crud-patch/package.json +21 -0
- package/templates/vue-2model-crud-patch/src/App.vue +63 -0
- package/templates/vue-2model-crud-patch/src/components/AnalyticsBoard.vue +291 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentFormModal.vue +138 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentPatchModal.vue +210 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentTable.vue +133 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeeFormModal.vue +177 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeePatchModal.vue +221 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeeTable.vue +171 -0
- package/templates/vue-2model-crud-patch/src/components/NavBar.vue +156 -0
- package/templates/vue-2model-crud-patch/src/main.js +12 -0
- package/templates/vue-2model-crud-patch/src/router/index.js +33 -0
- package/templates/vue-2model-crud-patch/src/services/api.js +64 -0
- package/templates/vue-2model-crud-patch/src/stores/departmentStore.js +149 -0
- package/templates/vue-2model-crud-patch/src/stores/employeeStore.js +143 -0
- package/templates/vue-2model-crud-patch/src/style.css +415 -0
- package/templates/vue-2model-crud-patch/src/views/AnalyticsView.vue +59 -0
- package/templates/vue-2model-crud-patch/src/views/DepartmentsView.vue +135 -0
- package/templates/vue-2model-crud-patch/src/views/EmployeesView.vue +143 -0
- package/templates/vue-2model-crud-patch/vite.config.js +9 -0
- package/templates/vue-axios/src/App.vue +255 -264
- package/templates/vue-axios/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-axios/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-axios/src/components/ItemTable.vue +177 -0
- package/templates/vue-axios-basic/src/App.vue +241 -429
- package/templates/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-axios-basic/src/components/ItemTable.vue +177 -0
- package/templates/vue-axios-pinia/src/App.vue +150 -441
- package/templates/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
- package/templates/vue-axios-pinia/src/components/ItemStats.vue +64 -0
- package/templates/vue-axios-pinia/src/components/ItemTable.vue +195 -0
- package/templates/vue-axios-router/src/App.vue +41 -90
- package/templates/vue-axios-router/src/components/ItemFormModal.vue +173 -0
- package/templates/vue-axios-router/src/components/ItemTable.vue +102 -0
- package/templates/vue-axios-router/src/components/NavBar.vue +57 -0
- package/templates/vue-axios-router/src/views/DepartmentView.vue +132 -296
- package/templates/vue-axios-router/src/views/EmployeeView.vue +126 -219
- package/templates/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
- package/templates/vue-axios-router-children/src/components/ItemTable.vue +104 -0
- package/templates/vue-axios-router-children/src/components/SideBar.vue +59 -0
- package/templates/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
- package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
- package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
- package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
- package/templates/vue-axios-router-pinia/src/App.vue +19 -70
- package/templates/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
- package/templates/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
- package/templates/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
- package/templates/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
- package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
- package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
- package/templates/vue-banking-app/src/components/AccountOverview.vue +75 -0
- package/templates/vue-banking-app/src/components/TransactionForm.vue +89 -0
- package/templates/vue-banking-app/src/components/TransactionTable.vue +113 -0
- package/templates/vue-banking-app/src/stores/bankStore.js +16 -3
- package/templates/vue-banking-app/src/views/DashboardView.vue +23 -71
- package/templates/vue-banking-app/src/views/StatementView.vue +11 -158
- package/templates/vue-banking-app/src/views/TransactionFormView.vue +23 -121
- package/templates/vue-basics/src/App.vue +105 -76
- package/templates/vue-basics/src/components/CounterCard.vue +107 -0
- package/templates/vue-basics/src/components/ItemList.vue +99 -0
- package/templates/vue-basics/src/components/UserForm.vue +138 -0
- package/templates/vue-cart-router-pinia/src/components/CartSummary.vue +139 -0
- package/templates/vue-cart-router-pinia/src/components/CheckoutModal.vue +149 -0
- package/templates/vue-cart-router-pinia/src/components/ProductCard.vue +63 -0
- package/templates/vue-cart-router-pinia/src/stores/cartStore.js +11 -0
- package/templates/vue-cart-router-pinia/src/views/CartView.vue +52 -118
- package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +2 -5
- package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +20 -56
- package/templates/vue-employee-system/src/App.vue +75 -344
- package/templates/vue-employee-system/src/components/DepartmentFilter.vue +108 -0
- package/templates/vue-employee-system/src/components/EmployeeModal.vue +183 -0
- package/templates/vue-employee-system/src/components/EmployeeTable.vue +91 -0
- package/templates/vue-employee-system/src/stores/employeeStore.js +12 -0
- package/templates/vue-fetch/src/App.vue +261 -285
- package/templates/vue-fetch/src/components/FetchFormModal.vue +183 -0
- package/templates/vue-fetch/src/components/FetchPatchModal.vue +193 -0
- package/templates/vue-fetch/src/components/FetchTable.vue +177 -0
- package/templates/vue-food-ordering/src/components/CartSummary.vue +134 -0
- package/templates/vue-food-ordering/src/components/FoodMenu.vue +126 -0
- package/templates/vue-food-ordering/src/components/OrderModal.vue +150 -0
- package/templates/vue-food-ordering/src/views/MenuView.vue +11 -132
- package/templates/vue-food-ordering/src/views/OrderCartView.vue +31 -164
- package/templates/vue-game-rps/src/App.vue +29 -88
- package/templates/vue-game-tictactoe/src/App.vue +23 -53
- package/templates/vue-game-whackamole/src/App.vue +44 -63
- package/templates/vue-hospital-portal/src/components/AppointmentForm.vue +144 -0
- package/templates/vue-hospital-portal/src/components/DoctorCard.vue +73 -0
- package/templates/vue-hospital-portal/src/components/PatientTable.vue +123 -0
- package/templates/vue-hospital-portal/src/stores/hospitalStore.js +10 -1
- package/templates/vue-hospital-portal/src/views/OPDRegistrationView.vue +40 -416
- package/templates/vue-hospital-portal/src/views/PatientListView.vue +11 -301
- package/templates/vue-library-system/src/components/BookForm.vue +125 -0
- package/templates/vue-library-system/src/components/BookTable.vue +112 -0
- package/templates/vue-library-system/src/components/BorrowModal.vue +131 -0
- package/templates/vue-library-system/src/stores/libraryStore.js +26 -1
- package/templates/vue-library-system/src/views/BookCatalogView.vue +34 -415
- package/templates/vue-memory-game/src/App.vue +36 -40
- package/templates/vue-memory-game/src/stores/memoryStore.js +32 -37
- package/templates/vue-router/src/App.vue +24 -14
- package/templates/vue-router/src/components/AboutCard.vue +38 -0
- package/templates/vue-router/src/components/HomeHero.vue +75 -0
- package/templates/vue-router/src/components/NavBar.vue +54 -0
- package/templates/vue-router/src/views/ItemsLayout.vue +17 -9
- package/templates/vue-router/src/views/ListView.vue +106 -18
- package/templates/vue-router-pinia/src/App.vue +24 -14
- package/templates/vue-router-pinia/src/components/ItemFormModal.vue +163 -0
- package/templates/vue-router-pinia/src/components/ItemTable.vue +90 -0
- package/templates/vue-router-pinia/src/components/NavBar.vue +54 -0
- package/templates/vue-router-pinia/src/stores/itemStore.js +8 -1
- package/templates/vue-router-pinia/src/views/ListView.vue +78 -14
- package/templates/vue-router-pinia-springboot/frontend/src/App.vue +25 -8
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemTable.vue +177 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/NavBar.vue +54 -0
- package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +92 -76
- package/templates/vue-springboot-mongo-aggregation/frontend/src/App.vue +184 -193
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/AnalyticsCards.vue +56 -0
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/CategorySummaryTable.vue +71 -0
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/ItemTable.vue +114 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +228 -158
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemTable.vue +177 -0
- package/templates/vue-symposium-system/src/App.vue +41 -256
- package/templates/vue-symposium-system/src/components/AttendeeTable.vue +100 -0
- package/templates/vue-symposium-system/src/components/EventCard.vue +67 -0
- package/templates/vue-symposium-system/src/components/RegistrationForm.vue +118 -0
- package/templates/vue-symposium-system/src/stores/symposiumStore.js +10 -0
- package/templates/vue-todo-pinia/src/App.vue +40 -138
- package/templates/vue-todo-pinia/src/components/TodoFilter.vue +74 -0
- package/templates/vue-todo-pinia/src/components/TodoInput.vue +53 -0
- package/templates/vue-todo-pinia/src/components/TodoList.vue +101 -0
- package/templates/vue-todo-pinia/src/stores/todoStore.js +6 -0
- package/templates/vue-todo-router/src/App.vue +5 -36
- package/templates/vue-todo-router/src/components/TodoForm.vue +78 -0
- package/templates/vue-todo-router/src/components/TodoList.vue +84 -0
- package/templates/vue-todo-router/src/components/TodoNavBar.vue +47 -0
- package/templates/vue-todo-router/src/data/todoState.js +7 -0
- package/templates/vue-todo-router/src/views/AddTodoView.vue +7 -66
- package/templates/vue-todo-router/src/views/TodoDetailView.vue +15 -1
- package/templates/vue-todo-router/src/views/TodoListView.vue +22 -64
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
categories: { type: Array, required: true },
|
|
6
|
+
items: { type: Array, required: true }
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['add-to-cart'])
|
|
10
|
+
|
|
11
|
+
const selectedCategory = ref('All')
|
|
12
|
+
|
|
13
|
+
const filteredItems = computed(() => {
|
|
14
|
+
if (selectedCategory.value === 'All') return props.items
|
|
15
|
+
return props.items.filter(i => i.category === selectedCategory.value)
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="menu-container">
|
|
21
|
+
<div class="category-tabs">
|
|
22
|
+
<button
|
|
23
|
+
v-for="cat in categories"
|
|
24
|
+
:key="cat"
|
|
25
|
+
type="button"
|
|
26
|
+
class="tab-btn"
|
|
27
|
+
:class="{ active: selectedCategory === cat }"
|
|
28
|
+
@click="selectedCategory = cat"
|
|
29
|
+
>
|
|
30
|
+
{{ cat }}
|
|
31
|
+
</button>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="menu-grid">
|
|
35
|
+
<div v-for="item in filteredItems" :key="item.id" class="menu-card">
|
|
36
|
+
<div class="card-header">
|
|
37
|
+
<span class="badge">{{ item.category }}</span>
|
|
38
|
+
<span class="price">${{ Number(item.price).toFixed(2) }}</span>
|
|
39
|
+
</div>
|
|
40
|
+
<h3>{{ item.name }}</h3>
|
|
41
|
+
<p>{{ item.description }}</p>
|
|
42
|
+
<button type="button" class="btn btn-add" @click="emit('add-to-cart', item)">Add to Order</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.category-tabs {
|
|
50
|
+
display: flex;
|
|
51
|
+
gap: 8px;
|
|
52
|
+
margin-bottom: 20px;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tab-btn {
|
|
57
|
+
padding: 8px 14px;
|
|
58
|
+
border: 1px solid #cbd5e1;
|
|
59
|
+
background: #f8fafc;
|
|
60
|
+
border-radius: 6px;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.tab-btn.active {
|
|
66
|
+
background: #ea580c;
|
|
67
|
+
color: #fff;
|
|
68
|
+
border-color: #ea580c;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.menu-grid {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
|
74
|
+
gap: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.menu-card {
|
|
78
|
+
background: #ffffff;
|
|
79
|
+
border: 1px solid #e2e8f0;
|
|
80
|
+
border-radius: 8px;
|
|
81
|
+
padding: 16px;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.card-header {
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
margin-bottom: 8px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.badge {
|
|
93
|
+
font-size: 11px;
|
|
94
|
+
background: #ffedd5;
|
|
95
|
+
color: #c2410c;
|
|
96
|
+
padding: 2px 6px;
|
|
97
|
+
border-radius: 4px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.price {
|
|
101
|
+
font-weight: 700;
|
|
102
|
+
color: #0f172a;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.menu-card h3 {
|
|
106
|
+
font-size: 16px;
|
|
107
|
+
margin-bottom: 4px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.menu-card p {
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
color: #64748b;
|
|
113
|
+
flex: 1;
|
|
114
|
+
margin-bottom: 12px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.btn-add {
|
|
118
|
+
background: #ea580c;
|
|
119
|
+
color: #fff;
|
|
120
|
+
border: none;
|
|
121
|
+
padding: 8px 12px;
|
|
122
|
+
border-radius: 6px;
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps({
|
|
5
|
+
show: { type: Boolean, default: false },
|
|
6
|
+
total: { type: Number, required: true }
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['close', 'confirm'])
|
|
10
|
+
|
|
11
|
+
const form = reactive({
|
|
12
|
+
name: '',
|
|
13
|
+
tableOrAddress: '',
|
|
14
|
+
notes: ''
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
function handleSubmit() {
|
|
18
|
+
if (!form.name.trim() || !form.tableOrAddress.trim()) return
|
|
19
|
+
emit('confirm', { ...form })
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div v-if="show" class="modal-overlay" @click.self="emit('close')">
|
|
25
|
+
<div class="modal-card">
|
|
26
|
+
<div class="modal-header">
|
|
27
|
+
<h3>Complete Food Order</h3>
|
|
28
|
+
<button type="button" class="btn-close" @click="emit('close')">x</button>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<form @submit.prevent="handleSubmit" class="modal-form">
|
|
32
|
+
<div class="total-badge">
|
|
33
|
+
Payable Amount: <strong>${{ total.toFixed(2) }}</strong>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="form-group">
|
|
37
|
+
<label for="ord-name">Customer Name</label>
|
|
38
|
+
<input id="ord-name" v-model="form.name" required placeholder="Alex Smith" />
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="form-group">
|
|
42
|
+
<label for="ord-loc">Table Number or Delivery Address</label>
|
|
43
|
+
<input id="ord-loc" v-model="form.tableOrAddress" required placeholder="Table 4 / 45 Park Ave" />
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="form-group">
|
|
47
|
+
<label for="ord-notes">Special Instructions</label>
|
|
48
|
+
<textarea id="ord-notes" v-model="form.notes" rows="2" placeholder="Extra spicy, no onions, etc."></textarea>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="modal-actions">
|
|
52
|
+
<button type="button" class="btn btn-secondary" @click="emit('close')">Cancel</button>
|
|
53
|
+
<button type="submit" class="btn btn-primary">Place Order</button>
|
|
54
|
+
</div>
|
|
55
|
+
</form>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<style scoped>
|
|
61
|
+
.modal-overlay {
|
|
62
|
+
position: fixed;
|
|
63
|
+
inset: 0;
|
|
64
|
+
background: rgba(0, 0, 0, 0.4);
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
z-index: 1000;
|
|
69
|
+
padding: 16px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.modal-card {
|
|
73
|
+
background: #ffffff;
|
|
74
|
+
border-radius: 8px;
|
|
75
|
+
width: 100%;
|
|
76
|
+
max-width: 440px;
|
|
77
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.modal-header {
|
|
82
|
+
padding: 16px 20px;
|
|
83
|
+
border-bottom: 1px solid #e1e4e8;
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
align-items: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.modal-header h3 {
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
margin: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.btn-close {
|
|
95
|
+
background: none;
|
|
96
|
+
border: none;
|
|
97
|
+
font-size: 16px;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.modal-form {
|
|
102
|
+
padding: 20px;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
gap: 12px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.total-badge {
|
|
109
|
+
background: #ffedd5;
|
|
110
|
+
color: #c2410c;
|
|
111
|
+
padding: 10px;
|
|
112
|
+
border-radius: 6px;
|
|
113
|
+
font-size: 14px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.form-group {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
gap: 4px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.form-group label {
|
|
123
|
+
font-size: 13px;
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.form-group input,
|
|
128
|
+
.form-group textarea {
|
|
129
|
+
padding: 8px 12px;
|
|
130
|
+
border: 1px solid #cbd5e1;
|
|
131
|
+
border-radius: 6px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.modal-actions {
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: flex-end;
|
|
137
|
+
gap: 10px;
|
|
138
|
+
margin-top: 8px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.btn {
|
|
142
|
+
padding: 8px 14px;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
border: 1px solid transparent;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.btn-primary { background: #ea580c; color: #fff; }
|
|
149
|
+
.btn-secondary { background: #f1f5f9; color: #475569; }
|
|
150
|
+
</style>
|
|
@@ -1,145 +1,24 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed } from 'vue'
|
|
3
2
|
import { useFoodStore } from '../stores/foodStore'
|
|
3
|
+
import FoodMenu from '../components/FoodMenu.vue'
|
|
4
4
|
|
|
5
5
|
const store = useFoodStore()
|
|
6
|
-
const selectedCategory = ref('All')
|
|
7
|
-
|
|
8
|
-
const filteredItems = computed(() => {
|
|
9
|
-
if (selectedCategory.value === 'All') {
|
|
10
|
-
return store.menuItems
|
|
11
|
-
}
|
|
12
|
-
return store.menuItems.filter((item) => item.category === selectedCategory.value)
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const selectCategory = (category) => {
|
|
16
|
-
selectedCategory.value = category
|
|
17
|
-
}
|
|
18
6
|
</script>
|
|
19
7
|
|
|
20
8
|
<template>
|
|
21
|
-
<div class="menu-
|
|
22
|
-
<h2>Menu</h2>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:class="{ active: selectedCategory === cat }"
|
|
29
|
-
class="tab-btn"
|
|
30
|
-
@click="selectCategory(cat)"
|
|
31
|
-
>
|
|
32
|
-
{{ cat }}
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="menu-grid">
|
|
37
|
-
<div v-for="item in filteredItems" :key="item.id" class="menu-card">
|
|
38
|
-
<div class="card-header">
|
|
39
|
-
<h3>{{ item.name }}</h3>
|
|
40
|
-
<span class="category-tag">{{ item.category }}</span>
|
|
41
|
-
</div>
|
|
42
|
-
<p class="description">{{ item.description }}</p>
|
|
43
|
-
<div class="card-footer">
|
|
44
|
-
<span class="price">${{ item.price.toFixed(2) }}</span>
|
|
45
|
-
<button class="add-btn" @click="store.addToCart(item)">Add to Order</button>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
9
|
+
<div class="menu-page">
|
|
10
|
+
<h2>Our Menu</h2>
|
|
11
|
+
<FoodMenu
|
|
12
|
+
:categories="store.categories"
|
|
13
|
+
:items="store.menuItems"
|
|
14
|
+
@add-to-cart="store.addToCart"
|
|
15
|
+
/>
|
|
49
16
|
</div>
|
|
50
17
|
</template>
|
|
51
18
|
|
|
52
19
|
<style scoped>
|
|
53
|
-
.menu-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.category-tabs {
|
|
58
|
-
display: flex;
|
|
59
|
-
gap: 0.5rem;
|
|
60
|
-
margin-bottom: 1.5rem;
|
|
61
|
-
flex-wrap: wrap;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.tab-btn {
|
|
65
|
-
padding: 0.5rem 1rem;
|
|
66
|
-
border: 1px solid #ccc;
|
|
67
|
-
background-color: #f8f9fa;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
border-radius: 4px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.tab-btn.active {
|
|
73
|
-
background-color: #007bff;
|
|
74
|
-
color: #fff;
|
|
75
|
-
border-color: #007bff;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.menu-grid {
|
|
79
|
-
display: grid;
|
|
80
|
-
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
81
|
-
gap: 1rem;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.menu-card {
|
|
85
|
-
border: 1px solid #ddd;
|
|
86
|
-
border-radius: 6px;
|
|
87
|
-
padding: 1rem;
|
|
88
|
-
display: flex;
|
|
89
|
-
flex-direction: column;
|
|
90
|
-
justify-content: space-between;
|
|
91
|
-
background-color: #fff;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.card-header {
|
|
95
|
-
display: flex;
|
|
96
|
-
justify-content: space-between;
|
|
97
|
-
align-items: baseline;
|
|
98
|
-
margin-bottom: 0.5rem;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.card-header h3 {
|
|
102
|
-
margin: 0;
|
|
103
|
-
font-size: 1.1rem;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.category-tag {
|
|
107
|
-
font-size: 0.75rem;
|
|
108
|
-
background-color: #e9ecef;
|
|
109
|
-
padding: 0.2rem 0.5rem;
|
|
110
|
-
border-radius: 3px;
|
|
111
|
-
color: #495057;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.description {
|
|
115
|
-
color: #666;
|
|
116
|
-
font-size: 0.9rem;
|
|
117
|
-
margin: 0 0 1rem 0;
|
|
118
|
-
flex-grow: 1;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.card-footer {
|
|
122
|
-
display: flex;
|
|
123
|
-
justify-content: space-between;
|
|
124
|
-
align-items: center;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.price {
|
|
128
|
-
font-weight: bold;
|
|
129
|
-
font-size: 1.1rem;
|
|
130
|
-
color: #28a745;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.add-btn {
|
|
134
|
-
padding: 0.4rem 0.8rem;
|
|
135
|
-
background-color: #28a745;
|
|
136
|
-
color: white;
|
|
137
|
-
border: none;
|
|
138
|
-
border-radius: 4px;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.add-btn:hover {
|
|
143
|
-
background-color: #218838;
|
|
20
|
+
.menu-page h2 {
|
|
21
|
+
font-size: 22px;
|
|
22
|
+
margin-bottom: 16px;
|
|
144
23
|
}
|
|
145
24
|
</style>
|
|
@@ -1,181 +1,48 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
2
3
|
import { useRouter } from 'vue-router'
|
|
3
4
|
import { useFoodStore } from '../stores/foodStore'
|
|
5
|
+
import CartSummary from '../components/CartSummary.vue'
|
|
6
|
+
import OrderModal from '../components/OrderModal.vue'
|
|
4
7
|
|
|
5
8
|
const store = useFoodStore()
|
|
6
9
|
const router = useRouter()
|
|
10
|
+
const isModalOpen = ref(false)
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
function handleConfirmOrder() {
|
|
13
|
+
store.clearCart()
|
|
14
|
+
isModalOpen.value = false
|
|
15
|
+
router.push('/order-success')
|
|
12
16
|
}
|
|
13
17
|
</script>
|
|
14
18
|
|
|
15
19
|
<template>
|
|
16
|
-
<div class="cart-
|
|
17
|
-
<h2>Your
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<tr v-for="item in store.cart" :key="item.id">
|
|
37
|
-
<td>{{ item.name }}</td>
|
|
38
|
-
<td>${{ item.price.toFixed(2) }}</td>
|
|
39
|
-
<td class="qty-cell">
|
|
40
|
-
<button class="qty-btn" @click="store.decrementQuantity(item.id)">-</button>
|
|
41
|
-
<span class="qty-val">{{ item.quantity }}</span>
|
|
42
|
-
<button class="qty-btn" @click="store.incrementQuantity(item.id)">+</button>
|
|
43
|
-
</td>
|
|
44
|
-
<td>${{ (item.price * item.quantity).toFixed(2) }}</td>
|
|
45
|
-
<td>
|
|
46
|
-
<button class="remove-btn" @click="store.removeFromCart(item.id)">Remove</button>
|
|
47
|
-
</td>
|
|
48
|
-
</tr>
|
|
49
|
-
</tbody>
|
|
50
|
-
</table>
|
|
51
|
-
|
|
52
|
-
<div class="cart-summary">
|
|
53
|
-
<div class="summary-row">
|
|
54
|
-
<span>Subtotal:</span>
|
|
55
|
-
<span>${{ store.cartSubtotal.toFixed(2) }}</span>
|
|
56
|
-
</div>
|
|
57
|
-
<div class="summary-row">
|
|
58
|
-
<span>Tax (5%):</span>
|
|
59
|
-
<span>${{ store.taxAmount.toFixed(2) }}</span>
|
|
60
|
-
</div>
|
|
61
|
-
<div class="summary-row total-row">
|
|
62
|
-
<span>Grand Total:</span>
|
|
63
|
-
<span>${{ store.totalBill.toFixed(2) }}</span>
|
|
64
|
-
</div>
|
|
65
|
-
|
|
66
|
-
<div class="checkout-actions">
|
|
67
|
-
<button class="checkout-btn" @click="checkout">Proceed to Checkout</button>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
20
|
+
<div class="cart-page">
|
|
21
|
+
<h2>Your Cart</h2>
|
|
22
|
+
<CartSummary
|
|
23
|
+
:cart="store.cart"
|
|
24
|
+
:subtotal="store.cartSubtotal"
|
|
25
|
+
:tax="store.taxAmount"
|
|
26
|
+
:total="store.totalBill"
|
|
27
|
+
@increment="store.incrementQuantity"
|
|
28
|
+
@decrement="store.decrementQuantity"
|
|
29
|
+
@remove="store.removeFromCart"
|
|
30
|
+
@clear="store.clearCart"
|
|
31
|
+
@checkout="isModalOpen = true"
|
|
32
|
+
/>
|
|
33
|
+
|
|
34
|
+
<OrderModal
|
|
35
|
+
:show="isModalOpen"
|
|
36
|
+
:total="store.totalBill"
|
|
37
|
+
@close="isModalOpen = false"
|
|
38
|
+
@confirm="handleConfirmOrder"
|
|
39
|
+
/>
|
|
71
40
|
</div>
|
|
72
41
|
</template>
|
|
73
42
|
|
|
74
43
|
<style scoped>
|
|
75
|
-
.cart-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.empty-cart {
|
|
80
|
-
text-align: center;
|
|
81
|
-
padding: 2rem;
|
|
82
|
-
background-color: #f8f9fa;
|
|
83
|
-
border-radius: 6px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.menu-link {
|
|
87
|
-
display: inline-block;
|
|
88
|
-
margin-top: 0.5rem;
|
|
89
|
-
color: #007bff;
|
|
90
|
-
text-decoration: none;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.cart-table {
|
|
94
|
-
width: 100%;
|
|
95
|
-
border-collapse: collapse;
|
|
96
|
-
margin-bottom: 1.5rem;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.cart-table th,
|
|
100
|
-
.cart-table td {
|
|
101
|
-
border: 1px solid #ddd;
|
|
102
|
-
padding: 0.75rem;
|
|
103
|
-
text-align: left;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.cart-table th {
|
|
107
|
-
background-color: #f8f9fa;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.qty-cell {
|
|
111
|
-
display: flex;
|
|
112
|
-
align-items: center;
|
|
113
|
-
gap: 0.5rem;
|
|
114
|
-
border: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.qty-btn {
|
|
118
|
-
width: 28px;
|
|
119
|
-
height: 28px;
|
|
120
|
-
background-color: #e9ecef;
|
|
121
|
-
border: 1px solid #ced4da;
|
|
122
|
-
border-radius: 4px;
|
|
123
|
-
cursor: pointer;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.qty-val {
|
|
127
|
-
min-width: 20px;
|
|
128
|
-
text-align: center;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.remove-btn {
|
|
132
|
-
background-color: #dc3545;
|
|
133
|
-
color: white;
|
|
134
|
-
border: none;
|
|
135
|
-
padding: 0.3rem 0.6rem;
|
|
136
|
-
border-radius: 4px;
|
|
137
|
-
cursor: pointer;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.cart-summary {
|
|
141
|
-
max-width: 350px;
|
|
142
|
-
margin-left: auto;
|
|
143
|
-
border: 1px solid #ddd;
|
|
144
|
-
padding: 1rem;
|
|
145
|
-
border-radius: 6px;
|
|
146
|
-
background-color: #fff;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.summary-row {
|
|
150
|
-
display: flex;
|
|
151
|
-
justify-content: space-between;
|
|
152
|
-
margin-bottom: 0.5rem;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.total-row {
|
|
156
|
-
font-weight: bold;
|
|
157
|
-
font-size: 1.1rem;
|
|
158
|
-
border-top: 1px solid #ddd;
|
|
159
|
-
padding-top: 0.5rem;
|
|
160
|
-
margin-top: 0.5rem;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.checkout-actions {
|
|
164
|
-
margin-top: 1rem;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.checkout-btn {
|
|
168
|
-
width: 100%;
|
|
169
|
-
padding: 0.75rem;
|
|
170
|
-
background-color: #007bff;
|
|
171
|
-
color: white;
|
|
172
|
-
border: none;
|
|
173
|
-
border-radius: 4px;
|
|
174
|
-
font-size: 1rem;
|
|
175
|
-
cursor: pointer;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.checkout-btn:hover {
|
|
179
|
-
background-color: #0069d9;
|
|
44
|
+
.cart-page h2 {
|
|
45
|
+
font-size: 22px;
|
|
46
|
+
margin-bottom: 16px;
|
|
180
47
|
}
|
|
181
48
|
</style>
|