File size: 10,949 Bytes
cfd7e45
6cca62e
cfd7e45
6cca62e
 
cfd7e45
6cca62e
 
5808600
8e8e0f8
 
 
93699eb
8e8e0f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a3be7c
8e8e0f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a3be7c
 
 
 
 
93699eb
e3eb007
8a3be7c
 
 
 
 
8e8e0f8
8a3be7c
8e8e0f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cfd7e45
 
346957f
8a3be7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4b7dc15
 
53c7c69
8a3be7c
 
 
 
 
 
 
8e8e0f8
8a3be7c
 
 
e3eb007
8a3be7c
 
e3eb007
8a3be7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27b8a22
6cca62e
8a3be7c
6cca62e
53c7c69
 
 
6cca62e
 
8a3be7c
 
8e8e0f8
 
 
8a3be7c
8e8e0f8
813bd2f
8e8e0f8
8a3be7c
 
 
 
 
 
 
8e8e0f8
8a3be7c
 
 
 
 
813bd2f
8a3be7c
 
 
 
 
 
8e8e0f8
813bd2f
 
 
 
4841ad9
8e8e0f8
8a3be7c
 
 
793139a
93699eb
8a3be7c
 
 
 
 
 
 
 
 
 
 
 
93699eb
4841ad9
346957f
 
5ac8a7d
8e8e0f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Menu</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #fdf4e3;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
        }
        .container {
            max-width: 900px;
        }
        .menu-card {
            max-width: 350px;
            border-radius: 15px;
            overflow: hidden;
            background-color: #fff;
            margin: auto;
            display: flex;
            flex-direction: column;
            position: relative;
        }
        .menu-image {
            height: 200px;
            width: 100%;
            object-fit: fill;
            border-radius: 15px 15px 0 0;
        }
        .card-title {
            font-size: 1.2rem;
            font-weight: bold;
            margin: 10px 0;
        }
        .card-text {
            font-size: 1rem;
            color: #6c757d;
        }
        .btn-primary {
            font-size: 13px;
            font-weight: bold;
            border-radius: 5px;
            width: 100px;
            background-color: #0FAA39;
            border-color: #0FAA39;
        }
        .btn-customize {
            font-size: 13px;
            font-weight: bold;
            border-radius: 5px;
            background-color: #0FAA39;
            border-color: #0FAA39;
            position: absolute;
            right: 10px;  /* Align the Customize button to the right */
            bottom: 10px; /* Place it at the bottom right corner of the image */
            display: inline-flex;
            justify-content: center;
            align-items: center;
            padding: 5px 15px;
        }
        .btn-customize i {
            margin-left: 5px;
        }
        .btn-primary:hover, .btn-customize:hover {
            background-color: #0FAA39;
            border-color: #0FAA39;
        }
        .view-cart-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 999;
        }
        .view-cart-button {
            background-color: #0FAA39;
            color: #fff;
            padding: 10px 20px;
            border-radius: 30px;
            font-size: 1rem;
            font-weight: bold;
            text-decoration: none;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .view-cart-button:hover {
            background-color: #109835;
            text-decoration: none;
        }
    </style>
</head>
<body>

    <!-- Fixed Top Bar -->
    <div class="fixed-top-bar">
        <div class="avatar-dropdown-container">
            <div class="avatar-icon">
                <span>{{ first_letter }}</span> <!-- Display the first letter of the customer's name -->
            </div>
            <div class="dropdown-menu">
                <a href="{{ url_for('customer_details') }}" class="dropdown-item">View Profile</a>
                <a href="{{ url_for('order_history') }}" class="dropdown-item">Order History</a>
                <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
            </div>
        </div>

        <div class="search-bar-container">
            <input type="text" id="searchBar" class="form-control" placeholder="Search items or sections..." onkeyup="filterMenu()">
            <i class="bi bi-search search-icon"></i>
        </div>
    </div>

    <!-- Category Filter -->
    <form method="get" action="/menu" class="text-center mb-4">
        <label class="form-label fw-bold">Select a Category:</label>
        <div class="form-check form-check-inline">
            {% for category in categories %}
                <input type="radio" id="category-{{ category }}" name="category" value="{{ category }}" class="custom-radio"
                    {% if selected_category == category %}checked{% endif %} onchange="this.form.submit()">
                <label class="form-check-label" for="category-{{ category }}">{{ category }}</label>
            {% endfor %}
        </div>
        <div class="form-check">
            <input type="radio" id="category-CustomizedDish" name="category" value="Customized Dish" class="custom-radio"
                {% if selected_category == "Customized Dish" %}checked{% endif %} onchange="this.form.submit()">
            <label class="form-check-label" for="category-CustomizedDish">Customized Dish</label>
        </div>
    </form>

    <!-- Menu Section -->
    <div class="container mt-4">
        <h1 class="text-center">Menu</h1>

        {% if selected_category == "Customized Dish" %}
            <div id="custom-dish-form" class="mt-4">
                <h3>Create Your Custom Dish</h3>
                <form method="POST" action="/generate_custom_dish">
                    <div class="mb-3">
                        <label for="custom-dish-name" class="form-label">Dish Name</label>
                        <input type="text" class="form-control" id="custom-dish-name" name="name" required>
                    </div>
                    <div class="mb-3">
                        <label for="custom-dish-description" class="form-label">Dish Description</label>
                        <textarea class="form-control" id="custom-dish-description" name="description" required></textarea>
                    </div>
                    <button type="submit" class="btn btn-primary">Submit</button>
                </form>
            </div>
        {% else %}
            {% for section, items in ordered_menu.items() %}
                <h3>{{ section }}</h3>
                <div class="row">
                    {% for item in items %}
                        <div class="col-md-6 mb-4">
                            <div class="card menu-card">
                                <img src="{{ item.Image1__c }}" class="card-img-top menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';">
                                <div class="card-body">
                                    <h5 class="card-title">{{ item.Name }}</h5>
                                    <p class="card-text">${{ item.Price__c }}</p>
                                    <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#itemModal" 
                                        onclick="showItemDetails('{{ item.Name }}', '{{ item.Price__c }}', '{{ item.Image2__c }}', '{{ item.Description__c }}', '{{ item.Section__c }}','{{ selected_category }}')">
                                        Add
                                    </button>
                                    <!-- Customize Button -->
                                    <button class="btn btn-customize" onclick="customizeItem('{{ item.Name }}', '{{ item.Price__c }}')">
                                        <i class="bi bi-pencil-square"></i> Customize
                                    </button>
                                </div>
                            </div>
                        </div>
                    {% endfor %}
                </div>
            {% endfor %}
        {% endif %}
    </div>

    <!-- View Cart Button -->
    <div class="view-cart-container">
        <a href="/cart" class="view-cart-button">
            View Cart
        </a>
    </div>

    <!-- Modal for Item Details -->
    <div class="modal fade" id="itemModal" tabindex="-1" aria-labelledby="itemModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="itemModalLabel">Item Details</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <img id="modal-img" class="img-fluid rounded mb-3 d-block mx-auto" alt="Item Image" style="max-height: 200px; object-fit: cover;">
                    <h5 id="modal-name" class="fw-bold text-center"></h5>
                    <p id="modal-price" class="text-muted text-center"></p>
                    <p id="modal-description" class="text-secondary"></p>
                    <div id="modal-addons" class="modal-addons mt-4">
                        <h6>Customization Options</h6>
                        <div id="addons-list" class="addons-container">Loading customization options...</div>
                    </div>
                    <div class="mt-4">
                        <h6>Custom Request</h6>
                        <textarea id="modal-instructions" class="form-control" placeholder="Enter any special instructions here..."></textarea>
                    </div>
                    <span id="modal-section" data-section="" data-category="" style="display: none;"></span>
                </div>
                <div class="modal-footer d-flex align-items-center justify-content-between">
                    <div class="d-flex align-items-center gap-2">
                        <button type="button" class="btn btn-outline-secondary" id="decreaseQuantity">-</button>
                        <input type="text" class="form-control text-center" id="quantityInput" value="1" readonly style="width: 50px;"/>
                        <button type="button" class="btn btn-outline-secondary" id="increaseQuantity">+</button>
                    </div>
                    <button type="button" class="btn btn-primary" onclick="addToCartFromModal()">Add to Cart</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        // Customize Item Action
        function customizeItem(itemName, itemPrice) {
            alert(`Customizing your ${itemName} for $${itemPrice}`);
        }

        // Handle Search Filtering (optional)
        function filterMenu() {
            let input = document.getElementById('searchBar').value.toLowerCase();
            let items = document.querySelectorAll('.menu-card');
            items.forEach(item => {
                let itemName = item.querySelector('.card-title').innerText.toLowerCase();
                if (itemName.includes(input)) {
                    item.style.display = 'block';
                } else {
                    item.style.display = 'none';
                }
            });
        }
    </script>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>