File size: 11,674 Bytes
cfd7e45
6cca62e
cfd7e45
6cca62e
 
cfd7e45
6cca62e
 
5808600
f6a6962
 
 
 
 
 
 
 
 
 
 
 
 
b278325
f6a6962
 
 
48c94c2
f6a6962
 
 
 
 
 
48c94c2
f6a6962
 
 
 
 
b278325
f6a6962
 
 
 
 
b278325
dc198bc
 
 
 
 
 
 
 
 
 
f6a6962
 
 
 
 
 
 
 
 
b278325
dc198bc
f6a6962
 
dc198bc
f6a6962
 
b278325
f6a6962
 
 
 
 
b278325
f6a6962
 
 
 
b278325
f6a6962
 
 
 
 
 
b278325
f6a6962
 
 
 
 
 
 
 
 
 
 
 
 
9db9aae
f6a6962
 
 
 
 
cfd7e45
 
346957f
f6a6962
53c7c69
f6a6962
53c7c69
 
 
 
559170c
4feea18
53c7c69
00fc9cd
f6a6962
49f3f3a
53c7c69
 
 
 
 
f3a9c7e
53c7c69
 
 
 
 
 
 
 
 
 
f6a6962
4d845ce
53c7c69
 
 
 
 
 
f6a6962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53c7c69
 
 
 
f6a6962
53c7c69
f6a6962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b31f0bb
 
f6a6962
53c7c69
 
 
f6a6962
6d42cfd
9f871cf
f6a6962
 
 
 
 
 
d22d613
f6a6962
 
d22d613
f6a6962
dc198bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6a6962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d22d613
f6a6962
d22d613
f6a6962
 
d22d613
 
 
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!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/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        /* Add your styles for buttons and hover effects */
        .addbutton .btn {
            background-color: #28a745; /* Green background color */
            color: white; /* White text color */
            padding: 10px 20px; /* Add padding to the button */
            font-size: 16px; /* Increase font size */
            font-weight: bold; /* Make text bold */
            border-radius: 5px; /* Rounded corners */
            border: none; /* Remove border */
            transition: background-color 0.3s ease; /* Smooth transition for hover effect */
            margin-left: 13px; /* Margin for positioning */
        }

        .addbutton .btn:hover {
            background-color: #218838; /* Darker green background on hover */
        }

        .customisable-text {
            color: #28a745; /* Same color as the "ADD" button */
            font-size: 12px; /* Same font size as the "ADD" button */
            margin-left: 5px;
            margin-top: 1px;
        }

        /* Hover effect for images */
        .menu-card:hover .menu-image {
            transform: scale(1.1); /* Slight zoom effect */
            transition: transform 0.3s ease-in-out;
        }

        /* Hover effect for videos */
        .menu-card:hover .menu-video {
            opacity: 1;
            transition: opacity 0.5s ease-in-out;
        }

        /* Video container hidden by default */
        .menu-video {
            height: 200px; /* Fixed height */
            width: 100%; /* Full width of the card */
            object-fit: cover; /* Ensure the image/video covers the area */
            border-radius: 15px 15px 0 0; /* Rounded top corners */
            opacity: 0; /* Hide video initially */
            transition: opacity 0.5s ease-in-out;
        }

        .menu-card {
            max-width: 350px;
            border-radius: 15px;
            overflow: hidden;
            background-color: #fff;
            margin: auto;
            display: flex;
            flex-direction: column;
        }

        .menu-image {
            height: 200px; /* Fixed height */
            width: 100%; /* Full width of the card */
            object-fit: cover; /* Ensure the image covers the area */
            border-radius: 15px 15px 0 0; /* Rounded top corners */
        }

        .card-title {
            font-size: 1.2rem;
            font-weight: bold;
            margin: 10px 0;
        }

        .card-text {
            font-size: 1rem;
            color: #6c757d;
        }

        .view-cart-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 999;
        }

        .view-cart-button {
            background-color: #0FAA39; /* Updated View Cart button background color */
            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; /* Slightly darker shade for hover effect */
            text-decoration: none;
        }
    </style>
</head>
<body>

<div class="fixed-top-bar">
    <!-- Avatar and Dropdown -->
    <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('user_details.customer_details') }}" class="dropdown-item">View Profile</a>
            <a href="{{ url_for('orderhistory.order_history') }}" class="dropdown-item">Order History</a>
            <a href="{{ url_for('logout') }}" class="dropdown-item">Logout</a>
        </div>
    </div>

    <!-- Search Bar Section -->
    <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> <!-- Search icon inside the input -->
    </div>
</div>

<!-- Category Filter with Custom Radio Buttons -->
<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 Sections -->
<div class="container mt-4">
    {% if selected_category == "Customized Dish" %}
        <!-- Custom Dish Creation Form -->
        <div id="custom-dish-form" class="mt-4">
            <h3>Create Your Custom Dish</h3>
            <form method="POST" action="/customdish/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 %}
        <!-- Display Menu Items -->
        {% 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">
                            {% if item.Video %}
                                <!-- Display Video -->
                                <video class="menu-video" muted loop preload="auto" poster="{{ item.Image1__c }}">
                                    <source src="{{ item.Video }}" type="video/mp4">
                                </video>
                            {% else %}
                                <!-- Display Image -->
                                <img src="{{ item.Image1__c }}" class="menu-image" alt="{{ item.Name }}" onerror="this.src='/static/placeholder.jpg';" loading="lazy">
                            {% endif %}

                            <div class="addbutton">
                                <div class="card-body d-flex align-items-center justify-content-between">
                                    <div>
                                        <h5 class="card-title">{{ item.Name }}</h5>
                                        <p class="card-text">${{ item.Price__c }}</p>
                                    </div>
                                    <div class="d-flex flex-column align-items-center justify-content-center">
                                        <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>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                {% endfor %}
            </div>
        {% endfor %}
    {% endif %}
</div>

<!-- View Cart Button -->
<div class="view-cart-container">
    <a href="{{ url_for('cart.cart') }}" class="view-cart-button">
        View Cart
    </a>
</div>

<!-- Modal for Item Details -->
<!-- Add the modal as per your existing code here -->

<script>
    // Play video on hover and pause on mouseout
    const menuCards = document.querySelectorAll('.menu-card');

    menuCards.forEach(card => {
        const video = card.querySelector('.menu-video');

        // Play the video on hover
        card.addEventListener('mouseenter', () => {
            if (video) {
                video.style.opacity = '1';
                video.play();
            }
        });

        // Pause the video on mouseout
        card.addEventListener('mouseleave', () => {
            if (video) {
                video.style.opacity = '0';  // Fade out the video
                video.pause();
            }
        });
    });

    // Function to filter the menu by search bar input (if needed)
    function filterMenu() {
        let input = document.getElementById('searchBar').value.toLowerCase(); // Get the value from search bar
        let sections = document.querySelectorAll('h3'); // Select section headers
        let items = document.querySelectorAll('.menu-card'); // Select all items
        let matchedSections = new Set(); // Store matched sections

        // Hide all items initially
        items.forEach(item => {
            let itemName = item.querySelector('.card-title').innerText.toLowerCase(); // Get item name
            let itemSection = item.closest('.row').previousElementSibling.innerText.toLowerCase(); // Get section name

            // If the search matches item name or section, show the item
            if (itemName.includes(input) || (itemSection && itemSection.includes(input))) {
                item.style.display = 'block';  // Show item if it matches search
                matchedSections.add(item.closest('.row')); // Add section to matched list
            } else {
                item.style.display = 'none'; // Hide item if not matched
            }
        });

        // Show or hide sections based on matched items
        sections.forEach(section => {
            let sectionRow = section.nextElementSibling; // The row containing items
            if (matchedSections.has(sectionRow)) {
                section.style.display = 'block'; // Show section header
                sectionRow.style.display = 'flex'; // Show section items
            } else {
                section.style.display = 'none'; // Hide section header
                sectionRow.style.display = 'none'; // Hide section items
            }
        });
    }
</script>

<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>

</body>
</html>