geethareddy commited on
Commit
71a16dc
·
verified ·
1 Parent(s): 51d5c5f

Update templates/menu.html

Browse files
Files changed (1) hide show
  1. templates/menu.html +142 -1577
templates/menu.html CHANGED
@@ -15,1393 +15,8 @@
15
  {% endfor %}
16
  {% endfor %}
17
  <style>
18
- body {
19
- font-family: Arial, sans-serif;
20
- background-color: #fdf4e3;
21
- margin: 0;
22
- padding: 0;
23
- display: flex;
24
- flex-direction: column;
25
- padding-bottom: 70px;
26
- }
27
- .container {
28
- max-width: 900px;
29
- }
30
- .menu-card {
31
- max-width: 350px;
32
- border-radius: 15px;
33
- overflow: hidden;
34
- background-color: #fff;
35
- margin: auto;
36
- display: flex;
37
- flex-direction: column;
38
- opacity: 0;
39
- transition: opacity 0.3s ease-in-out;
40
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
41
- }
42
-
43
- .menu-card.visible {
44
- opacity: 1;
45
- }
46
- .menu-card.highlighted {
47
- border: 3px solid #0FAA39;
48
- box-shadow: 0 0 10px rgba(15, 170, 57, 0.5);
49
- }
50
- .menu-video {
51
- height: 200px;
52
- width: 100%;
53
- object-fit: contain;
54
- border-radius: 15px 15px 0 0;
55
- opacity: 0;
56
- transition: opacity 0.5s ease-in-out;
57
- background-color: #000;
58
- }
59
- .menu-video.loaded {
60
- opacity: 1;
61
- }
62
- .menu-card img {
63
- width: 100%; /* Ensure image takes up full width */
64
- height: 200px; /* Set fixed height */
65
- object-fit: cover; /* Ensure the image fills the container without distortion */
66
- object-position: center; /* Center the image within the container */
67
- }
68
-
69
- .menu-card:hover .menu-video {
70
- opacity: 1;
71
- transform: scale(1.05);
72
- }
73
- .menu-card .card-body .card-title {
74
- font-size: 1.2rem;
75
- font-weight: 600;
76
- margin: 10px 0;
77
- color: #333333;
78
- }
79
- .menu-card .card-body .card-text.price {
80
- font-size: 1rem;
81
- font-weight: 500;
82
- color: #000000;
83
- margin-bottom: 5px;
84
- }
85
- .addbutton .btn {
86
- background-color: #28a745;
87
- color: white;
88
- padding: 10px 20px;
89
- font-size: 16px;
90
- font-weight: bold;
91
- border-radius: 5px;
92
- border: none;
93
- transition: background-color 0.3s ease;
94
- margin-left: 13px;
95
- }
96
- .addbutton .btn:hover {
97
- background-color: #218838;
98
- }
99
- .button-container {
100
- display: flex;
101
- flex-direction: column;
102
- align-items: center;
103
- justify-content: center;
104
- gap: 6px;
105
- }
106
- .customisable-text {
107
- color: #0FAA39;
108
- font-size: 10px;
109
- font-weight: 500;
110
- margin: 0;
111
- text-align: center;
112
- line-height: 1;
113
- }
114
- .btn-primary {
115
- font-size: 12px;
116
- font-weight: bold;
117
- border-radius: 8px;
118
- width: 70px;
119
- height: 35px;
120
- background-color: #0FAA39;
121
- border-color: #0FAA39;
122
- display: flex;
123
- align-items: center;
124
- justify-content: center;
125
- padding: 0;
126
- transition: background-color 0.3s ease, transform 0.1s ease;
127
- }
128
- .btn-primary:hover {
129
- background-color: #0D9232;
130
- border-color: #0D9232;
131
- transform: scale(1.05);
132
- }
133
- .btn-primary:active,
134
- .btn-primary:focus {
135
- background-color: #0B7A29;
136
- border-color: #0B7A29;
137
- box-shadow: none;
138
- transform: scale(0.98);
139
- }
140
- .avatar-dropdown-container {
141
- position: absolute;
142
- right: 10px;
143
- top: 50%;
144
- transform: translateY(-50%);
145
- display: flex;
146
- align-items: center;
147
- justify-content: center;
148
- }
149
- .avatar-icon {
150
- width: 40px;
151
- height: 40px;
152
- border-radius: 50%;
153
- background-color: #007bff;
154
- cursor: pointer;
155
- display: flex;
156
- align-items: center;
157
- justify-content: center;
158
- color: white;
159
- font-size: 20px;
160
- font-weight: bold;
161
- }
162
- .dropdown-menu {
163
- position: absolute;
164
- right: 0;
165
- top: 100%;
166
- background-color: #fff8f0;
167
- border-radius: 5px;
168
- width: 220px;
169
- box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
170
- display: none;
171
- border: 1px solid #ffd8b1;
172
- }
173
- .dropdown-menu .dropdown-item {
174
- padding: 12px 16px;
175
- text-decoration: none;
176
- color: #333;
177
- border-bottom: 1px solid #ffd8b1;
178
- display: block;
179
- font-size: 15px;
180
- transition: background-color 0.2s ease;
181
- }
182
- .dropdown-menu .dropdown-item:last-child {
183
- border-bottom: none;
184
- }
185
- .dropdown-menu .dropdown-item:hover {
186
- background-color: #ffe4c4;
187
- color: #333;
188
- }
189
- .fixed-top-bar {
190
- position: relative;
191
- top: 0;
192
- left: 0;
193
- width: 100%;
194
- height: 54px;
195
- background: linear-gradient(45deg, #FFA07A, #FFB347);
196
- color: white;
197
- padding: 15px;
198
- display: flex;
199
- justify-content: space-between;
200
- align-items: center;
201
- z-index: 1000;
202
- }
203
- .search-bar-container {
204
- position: absolute;
205
- left: 20px;
206
- top: 50%;
207
- transform: translateY(-50%);
208
- display: flex;
209
- align-items: center;
210
- width: 300px;
211
- max-width: 90%;
212
- position: relative;
213
- }
214
- .search-bar-container input {
215
- width: 100%;
216
- padding: 8px 40px 8px 40px;
217
- font-size: 16px;
218
- border-radius: 25px;
219
- border: none;
220
- background-color: #fff;
221
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
222
- outline: none;
223
- }
224
- .search-bar-container input::placeholder {
225
- color: #888;
226
- }
227
- .search-bar-container input:focus {
228
- border-bottom: 2px solid #FFA07A;
229
- }
230
- .search-icon {
231
- position: absolute;
232
- left: 15px;
233
- font-size: 18px;
234
- color: #888;
235
- }
236
- .mic-icon {
237
- position: absolute;
238
- right: 15px;
239
- font-size: 18px;
240
- color: #888;
241
- cursor: pointer;
242
- transition: color 0.3s ease;
243
- }
244
- .mic-icon.active {
245
- color: #007bff;
246
- }
247
- /* Addon Section */
248
- .addon-section {
249
- background-color: #fff;
250
- border-radius: 10px;
251
- margin-bottom: 15px;
252
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
253
- overflow: hidden;
254
- transition: transform 0.2s ease;
255
- }
256
- .addon-section:hover {
257
- transform: translateY(-2px);
258
- }
259
- .addon-section h6 {
260
- margin: 0;
261
- padding: 12px 15px;
262
- font-size: 1.1rem;
263
- font-weight: 600;
264
- color: #fff;
265
- background: linear-gradient(45deg, #FFA07A, #FFB347);
266
- cursor: pointer;
267
- display: flex;
268
- justify-content: space-between;
269
- align-items: center;
270
- }
271
- .addon-section h6::after {
272
- content: '\25BC';
273
- font-size: 0.9rem;
274
- transition: transform 0.2s ease;
275
- }
276
- .addon-section.collapsed h6::after {
277
- transform: rotate(180deg);
278
- }
279
- .addon-section .form-check {
280
- display: flex;
281
- flex-direction: row-reverse;
282
- align-items: center;
283
- justify-content: space-between;
284
- margin: 10px 15px;
285
- padding: 0;
286
- }
287
- .addon-section .form-check-input {
288
- -webkit-appearance: none;
289
- -moz-appearance: none;
290
- appearance: none;
291
- width: 20px;
292
- height: 20px;
293
- border: 2px solid #6c757d;
294
- border-radius: 4px;
295
- background-color: #fff;
296
- position: relative;
297
- margin-left: 10px;
298
- cursor: pointer;
299
- transition: all 0.2s ease;
300
- }
301
- .addon-section .form-check-input:checked {
302
- background-color: #0FAA39;
303
- border-color: #0FAA39;
304
- }
305
- .addon-section .form-check-input:checked::before {
306
- content: '\2713';
307
- font-size: 12px;
308
- position: absolute;
309
- top: 2px;
310
- left: 4px;
311
- color: white;
312
- animation: checkmark 0.2s ease-in-out;
313
- }
314
- .addon-section .form-check-input:hover {
315
- transform: scale(1.1);
316
- border-color: #0FAA39;
317
- }
318
- .addon-section .form-check-input:focus {
319
- outline: none;
320
- box-shadow: 0 0 0 3px rgba(15, 170, 57, 0.2);
321
- }
322
- .addon-section .form-check-label {
323
- font-size: 0.95rem;
324
- color: #343a40;
325
- cursor: pointer;
326
- flex: 1;
327
- padding: 5px 8px;
328
- border-radius: 4px;
329
- transition: background-color 0.2s ease;
330
- text-align: left;
331
- }
332
- .addon-section .form-check-label:hover {
333
- background-color: #e6f4ea;
334
- }
335
- .addon-section .form-check-label .extra-charge {
336
- color: #FFA07A;
337
- font-weight: 600;
338
- margin-left: 8px;
339
- }
340
- .addon-options {
341
- max-height: 500px;
342
- opacity: 1;
343
- overflow: hidden;
344
- transition: max-height 0.3s ease, opacity 0.3s ease;
345
- }
346
- .addon-options.collapsed {
347
- max-height: 0;
348
- opacity: 0;
349
- }
350
- .addon-loading {
351
- display: flex;
352
- justify-content: center;
353
- align-items: center;
354
- padding: 15px;
355
- }
356
- .addon-loading::after {
357
- content: '';
358
- width: 20px;
359
- height: 20px;
360
- border: 3px solid #0FAA39;
361
- border-top: 3px solid transparent;
362
- border-radius: 50%;
363
- animation: spin 1s linear infinite;
364
- }
365
- /* Soft Drinks Modal Styling */
366
- #softDrinkModal .modal-dialog {
367
- max-width: 400px;
368
- margin: 1.75rem auto;
369
- animation: fadeInModal 0.3s ease-out;
370
- }
371
- #softDrinkModal .modal-content {
372
- border-radius: 12px;
373
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
374
- background-color: #fff;
375
- overflow: hidden;
376
- }
377
- #softDrinkModal .modal-header {
378
- background: linear-gradient(45deg, #FFA07A, #FFB347);
379
- border-top-left-radius: 12px;
380
- border-top-right-radius: 12px;
381
- padding: 12px 15px;
382
- border-bottom: none;
383
- }
384
- #softDrinkModal .modal-title {
385
- font-size: 1.3rem;
386
- font-weight: 600;
387
- color: #fff;
388
- }
389
- #softDrinkModal .modal-body {
390
- padding: 20px;
391
- text-align: center;
392
- }
393
- #softDrinkModal .modal-body img {
394
- max-height: 160px;
395
- width: 100%;
396
- object-fit: cover;
397
- border-radius: 8px;
398
- margin-bottom: 15px;
399
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
400
- }
401
- #softDrinkModal .modal-body h5 {
402
- font-size: 1.4rem;
403
- font-weight: 600;
404
- color: #333333;
405
- margin-bottom: 10px;
406
- }
407
- #softDrinkModal .modal-body p {
408
- font-size: 1.2rem;
409
- font-weight: 500;
410
- color: #000000;
411
- margin-bottom: 20px;
412
- }
413
- #softDrinkModal .modal-body p::before {
414
- content: '$';
415
- color: #FFA07A;
416
- font-weight: 600;
417
- margin-right: 2px;
418
- }
419
- #softDrinkModal .quantity-controls {
420
- display: flex;
421
- justify-content: center;
422
- align-items: center;
423
- gap: 12px;
424
- margin-bottom: 20px;
425
- }
426
- #softDrinkModal .quantity-controls .btn {
427
- width: 32px;
428
- height: 32px;
429
- border-radius: 50%;
430
- padding: 0;
431
- font-size: 1.1rem;
432
- line-height: 32px;
433
- text-align: center;
434
- background-color: #e9ecef;
435
- border: none;
436
- color: #333;
437
- transition: background-color 0.2s ease, transform 0.1s ease;
438
- }
439
- #softDrinkModal .quantity-controls .btn:hover {
440
- background-color: #d1d4d7;
441
- transform: scale(1.1);
442
- }
443
- #softDrinkModal .quantity-controls .btn:active {
444
- transform: scale(0.95);
445
- }
446
- #softDrinkModal .quantity-controls input {
447
- width: 50px;
448
- height: 32px;
449
- text-align: center;
450
- font-size: 1rem;
451
- font-weight: 600;
452
- border: 1px solid #ced4da;
453
- border-radius: 6px;
454
- background-color: #f8f9fa;
455
- }
456
- #softDrinkModal .modal-footer {
457
- padding: 15px;
458
- border-top: none;
459
- display: flex;
460
- justify-content: space-between;
461
- align-items: center;
462
- }
463
- #softDrinkModal .modal-footer .btn-primary {
464
- background-color: #0FAA39;
465
- border-color: #0FAA39;
466
- padding: 12px 30px;
467
- font-size: 1.1rem;
468
- font-weight: 600;
469
- border-radius: 8px;
470
- transition: background-color 0.2s ease, transform 0.1s ease;
471
- width: auto;
472
- }
473
- #softDrinkModal .modal-footer .btn-primary:hover {
474
- background-color: #0D9232;
475
- transform: scale(1.05);
476
- }
477
- #softDrinkModal .modal-footer .btn-primary:active {
478
- background-color: #0B7A29;
479
- transform: scale(0.98);
480
- }
481
- #softDrinkModal .modal-footer .quantity-controls-footer {
482
- display: flex;
483
- gap: 12px;
484
- }
485
- #softDrinkModal .modal-footer .quantity-controls-footer .btn {
486
- width: 32px;
487
- height: 32px;
488
- border-radius: 50%;
489
- padding: 0;
490
- font-size: 1.1rem;
491
- line-height: 32px;
492
- text-align: center;
493
- background-color: #e9ecef;
494
- border: none;
495
- color: #333;
496
- transition: background-color 0.2s ease, transform 0.1s ease;
497
- }
498
- #softDrinkModal .modal-footer .quantity-controls-footer .btn:hover {
499
- background-color: #d1d4d7;
500
- transform: scale(1.1);
501
- }
502
- #softDrinkModal .modal-footer .quantity-controls-footer .btn:active {
503
- transform: scale(0.95);
504
- }
505
- /* Filter Form Styling */
506
- #filter-form {
507
- display: flex;
508
- flex-direction: column;
509
- align-items: flex-start; /* Align to the left */
510
- justify-content: flex-start; /* Align to the top */
511
- margin-bottom: 20px;
512
- margin-left: 10px; /* Added 10px gap to the left */
513
- }
514
-
515
- .form-label {
516
- font-size: 1.2rem;
517
- font-weight: 600;
518
- color: #333;
519
- margin-bottom: 10px;
520
- }
521
-
522
- .toggle-container {
523
- display: flex;
524
- align-items: center;
525
- gap: 10px;
526
- margin: 8px 0;
527
- }
528
-
529
- .custom-toggle {
530
- appearance: none;
531
- width: 48px;
532
- height: 24px;
533
- background-color: #ccc;
534
- border-radius: 12px;
535
- position: relative;
536
- cursor: pointer;
537
- transition: background-color 0.3s ease;
538
- }
539
-
540
- .custom-toggle:checked {
541
- background: linear-gradient(45deg, #32CD32, #3CB371); /* Changed to green color when checked */
542
- }
543
-
544
- .custom-toggle::before {
545
- content: '';
546
- position: absolute;
547
- top: 2px;
548
- left: 2px;
549
- width: 20px;
550
- height: 20px;
551
- background-color: #fff;
552
- border-radius: 50%;
553
- transition: transform 0.3s ease;
554
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
555
- }
556
-
557
- .custom-toggle:checked::before {
558
- transform: translateX(24px); /* Moves the toggle to the right */
559
- }
560
-
561
- .toggle-container label {
562
- font-size: 1rem;
563
- color: #333;
564
- cursor: pointer;
565
- }
566
-
567
- @keyframes checkmark {
568
- from { transform: scale(0); }
569
- to { transform: scale(1); }
570
- }
571
- @keyframes spin {
572
- 0% { transform: rotate(0deg); }
573
- 100% { transform: rotate(360deg); }
574
- }
575
- @keyframes fadeIn {
576
- from { opacity: 0; transform: translateY(10px); }
577
- to { opacity: 1; transform: translateY(0); }
578
- }
579
- @keyframes fadeInModal {
580
- from { opacity: 0; transform: translateY(-20px); }
581
- to { opacity: 1; transform: translateY(0); }
582
- }
583
- .modal-header {
584
- padding: 10px 15px;
585
- }
586
- .modal-title {
587
- font-size: 16px;
588
- font-weight: bold;
589
- }
590
- .modal-body {
591
- max-height: 60vh;
592
- overflow-y: auto;
593
- padding: 15px;
594
- }
595
- .modal-body #modal-img {
596
- max-height: 200px;
597
- width: 100%;
598
- object-fit: cover;
599
- border-radius: 8px;
600
- margin-bottom: 10px;
601
- }
602
- .modal-body #modal-name {
603
- font-size: 20px;
604
- font-weight: bold;
605
- text-align: center;
606
- margin-bottom: 5px;
607
- color: #333333;
608
- }
609
- .modal-body #modal-price {
610
- font-size: 16px;
611
- font-weight: 500;
612
- color: #000000;
613
- text-align: center;
614
- margin-bottom: 10px;
615
- }
616
- .modal-body #modal-description {
617
- font-size: 14px;
618
- color: #6c757d;
619
- margin-bottom: 15px;
620
- }
621
- .modal-body #modal-addons h5,
622
- .modal-body #first-row h6 {
623
- font-size: 1.2rem;
624
- font-weight: 600;
625
- margin-bottom: 15px;
626
- color: #343a40;
627
- }
628
- .modal-footer {
629
- display: flex;
630
- align-items: center;
631
- justify-content: space-between;
632
- padding: 10px;
633
- }
634
- .modal-footer .d-flex {
635
- display: flex;
636
- align-items: center;
637
- gap: 10px;
638
- }
639
- .modal-footer .btn {
640
- height: 40px;
641
- padding: 0 15px;
642
- }
643
- .modal-footer .form-control {
644
- width: 50px;
645
- height: 40px;
646
- text-align: center;
647
- }
648
- .modal-footer .btn-primary {
649
- background-color: #0FAA39;
650
- border-color: #0FAA39;
651
- font-weight: bold;
652
- padding: 10px 20px;
653
- height: 40px;
654
- display: flex;
655
- justify-content: center;
656
- align-items: center;
657
- width: auto;
658
- }
659
- .modal-footer .btn-outline-secondary {
660
- height: 40px;
661
- width: 40px;
662
- }
663
- .item-details {
664
- background-color: #f8f9fa;
665
- border-radius: 8px;
666
- padding: 10px;
667
- margin: 10px 15px;
668
- display: none;
669
- }
670
- .item-details.show {
671
- display: block;
672
- }
673
- .item-details h6 {
674
- font-size: 0.9rem;
675
- font-weight: bold;
676
- margin-bottom: 5px;
677
- color: #333333;
678
- }
679
- .item-details p {
680
- font-size: 0.85rem;
681
- margin-bottom: 5px;
682
- color: #333;
683
- }
684
- .item-details .nutritional-info {
685
- display: grid;
686
- grid-template-columns: 1fr 1fr;
687
- gap: 10px;
688
- background-color: #e9ecef;
689
- padding: 10px;
690
- border-radius: 5px;
691
- font-size: 0.85rem;
692
- line-height: 1.5;
693
- }
694
- .toggle-details {
695
- cursor: pointer;
696
- color: #0FAA39;
697
- font-size: 0.9rem;
698
- margin-left: 15px;
699
- margin-bottom: 10px;
700
- display: inline-block;
701
- }
702
- .toggle-details:hover {
703
- text-decoration: underline;
704
- }
705
- .quantity-selector {
706
- display: flex;
707
- align-items: center;
708
- gap: 5px;
709
- }
710
- .quantity-selector .btn {
711
- width: 25px;
712
- height: 25px;
713
- padding: 0;
714
- font-size: 12px;
715
- line-height: 25px;
716
- text-align: center;
717
- }
718
- .quantity-selector .quantity-display {
719
- width: 25px;
720
- text-align: center;
721
- font-size: 12px;
722
- font-weight: bold;
723
- line-height: 25px;
724
- }
725
- .quantity-selector .quantity-to-add,
726
- .quantity-selector .quantity-to-remove {
727
- width: 45px;
728
- height: 25px;
729
- font-size: 12px;
730
- padding: 0 5px;
731
- }
732
- .modal-dialog {
733
- max-height: 90vh;
734
- }
735
- .modal-body::-webkit-scrollbar {
736
- width: 8px;
737
- }
738
- .modal-body::-webkit-scrollbar-track {
739
- background: #f1f1f1;
740
- border-radius: 10px;
741
- }
742
- .modal-body::-webkit-scrollbar-thumb {
743
- background: #0FAA39;
744
- border-radius: 10px;
745
- }
746
- .modal-body::-webkit-scrollbar-thumb:hover {
747
- background: #0D9232;
748
- }
749
- .btn-primary:disabled {
750
- opacity: 0.65;
751
- cursor: not-allowed;
752
- }
753
- .quantity-selector select {
754
- width: 60px;
755
- height: 35px;
756
- padding: 5px;
757
- border-radius: 5px;
758
- border: 1px solid #ced4da;
759
- }
760
- #custom-dish-form {
761
- position: relative;
762
- padding-bottom: 80px;
763
- }
764
- #custom-dish-form .btn-primary {
765
- position: absolute;
766
- right: 15px;
767
- bottom: 15px;
768
- width: auto;
769
- padding: 10px 20px;
770
- }
771
- .bottom-action-bar {
772
- position: fixed;
773
- bottom: 0;
774
- left: 0;
775
- right: 0;
776
- background-color: white;
777
- padding: 10px 20px;
778
- display: flex;
779
- justify-content: space-between;
780
- align-items: center;
781
- box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
782
- z-index: 1000;
783
- max-width: 900px;
784
- margin: 0 auto;
785
- }
786
- .bottom-action-bar .btn {
787
- flex: 1;
788
- margin: 0 5px;
789
- padding: 10px 15px;
790
- border-radius: 8px;
791
- font-weight: bold;
792
- font-size: 16px;
793
- color: white;
794
- display: flex;
795
- align-items: center;
796
- justify-content: center;
797
- text-align: center;
798
- min-width: 0;
799
- white-space: nowrap;
800
- }
801
- .bottom-action-bar .btn-order-history {
802
- background-color: #FFA07A;
803
- border-color: #FFA07A;
804
- }
805
- .bottom-action-bar .btn-order-history:hover {
806
- background-color: #FF8C61;
807
- border-color: #FF8C61;
808
- }
809
- .bottom-action-bar .btn-view-cart {
810
- background-color: #0FAA39;
811
- border-color: #0FAA39;
812
- }
813
- .bottom-action-bar .btn-view-cart:hover {
814
- background-color: #0D9232;
815
- border-color: #0D9232;
816
- }
817
- .cart-icon-badge {
818
- background-color: white;
819
- color: #0FAA39;
820
- border-radius: 50%;
821
- width: 20px;
822
- height: 20px;
823
- display: inline-flex;
824
- align-items: center;
825
- justify-content: center;
826
- font-size: 12px;
827
- margin-left: 8px;
828
- }
829
- /* Mobile-Specific Styles */
830
- @media (max-width: 576px) {
831
- .fixed-top-bar {
832
- height: 60px;
833
- padding: 10px;
834
- }
835
- .search-bar-container {
836
- width: 80%;
837
- max-width: 100%;
838
- left: 10px;
839
- top: 50%;
840
- transform: translateY(-50%);
841
- }
842
- .search-bar-container input {
843
- padding: 6px 35px 6px 35px;
844
- font-size: 14px;
845
- border-radius: 20px;
846
- }
847
- .search-icon {
848
- left: 12px;
849
- font-size: 16px;
850
- }
851
- .mic-icon {
852
- right: 12px;
853
- font-size: 16px;
854
- }
855
- .avatar-dropdown-container {
856
- right: 10px;
857
- }
858
- .avatar-icon {
859
- width: 40px;
860
- height: 40px;
861
- font-size: 20px;
862
- }
863
- .dropdown-menu {
864
- width: 220px;
865
- }
866
- .dropdown-menu .dropdown-item {
867
- padding: 12px 16px;
868
- font-size: 15px;
869
- }
870
- .modal-dialog {
871
- max-width: 90%;
872
- margin: 10px auto;
873
- }
874
- .modal-header {
875
- padding: 8px 12px;
876
- }
877
- .modal-title {
878
- font-size: 14px;
879
- }
880
- .modal-body {
881
- max-height: 50vh;
882
- padding: 12px;
883
- }
884
- .modal-body #modal-img {
885
- max-height: 150px;
886
- width: 100%;
887
- max-width: 150px;
888
- margin: 0 auto 8px;
889
- display: block;
890
- }
891
- .modal-body #modal-name {
892
- font-size: 18px;
893
- margin-bottom: 5px;
894
- }
895
- .modal-body #modal-price {
896
- font-size: 14px;
897
- margin-bottom: 8px;
898
- }
899
- .modal-body #modal-description {
900
- font-size: 12px;
901
- margin-bottom: 10px;
902
- }
903
- .modal-body .nutritional-info {
904
- font-size: 10px;
905
- margin-bottom: 5px;
906
- }
907
- .modal-body #modal-addons h5,
908
- .modal-body #first-row h6 {
909
- font-size: 1rem;
910
- margin-bottom: 10px;
911
- }
912
- .modal-footer {
913
- padding: 8px;
914
- }
915
- .modal-footer .btn {
916
- height: 30px;
917
- padding: 0 10px;
918
- }
919
- .modal-footer .form-control {
920
- width: 30px;
921
- height: 30px;
922
- font-size: 12px;
923
- font-weight: bold;
924
- }
925
- .modal-footer .btn-outline-secondary {
926
- width: 25px;
927
- height: 25px;
928
- font-size: 12px;
929
- line-height: 25px;
930
- }
931
- .modal-footer .btn-primary {
932
- font-size: 12px;
933
- height: 30px;
934
- padding: 0 15px;
935
- border-radius: 5px;
936
- }
937
- .btn-primary {
938
- font-size: 10px;
939
- width: 50px;
940
- height: 25px;
941
- }
942
- .customisable-text {
943
- font-size: 8px;
944
- }
945
- .button-container {
946
- gap: 3px;
947
- }
948
- .quantity-selector .btn {
949
- width: 18px;
950
- height: 18px;
951
- font-size: 9px;
952
- line-height: 18px;
953
- }
954
- .quantity-selector .quantity-display {
955
- width: 18px;
956
- font-size: 9px;
957
- line-height: 18px;
958
- }
959
- .quantity-selector .quantity-to-add,
960
- .quantity-selector .quantity-to-remove {
961
- width: 35px;
962
- height: 18px;
963
- font-size: 9px;
964
- }
965
- .quantity-selector select {
966
- width: 50px;
967
- height: 30px;
968
- font-size: 12px;
969
- }
970
- .bottom-action-bar {
971
- padding: 8px 10px;
972
- }
973
- .bottom-action-bar .btn {
974
- padding: 8px 10px;
975
- font-size: 14px;
976
- }
977
- .cart-icon-badge {
978
- width: 18px;
979
- height: 18px;
980
- font-size: 10px;
981
- margin-left: 5px;
982
- }
983
- /* Mobile-Specific Addon Styles */
984
- .addon-section {
985
- margin-bottom: 10px;
986
- }
987
- .addon-section h6 {
988
- font-size: 1rem;
989
- padding: 10px 12px;
990
- }
991
- .addon-section .form-check {
992
- margin: 8px 12px;
993
- }
994
- .addon-section .form-check-input {
995
- width: 18px;
996
- height: 18px;
997
- margin-left: 8px;
998
- }
999
- .addon-section .form-check-input:checked::before {
1000
- font-size: 10px;
1001
- top: 2px;
1002
- left: 3px;
1003
- }
1004
- .addon-section .form-check-label {
1005
- font-size: 0.85rem;
1006
- padding: 4px 6px;
1007
- }
1008
- .addon-section .form-check-label .extra-charge {
1009
- margin-left: 6px;
1010
- font-size: 0.8rem;
1011
- }
1012
- /* Mobile-Specific Soft Drinks Modal Styles */
1013
- #softDrinkModal .modal-dialog {
1014
- max-width: 90%;
1015
- }
1016
- #softDrinkModal .modal-content {
1017
- border-radius: 10px;
1018
- }
1019
- #softDrinkModal .modal-header {
1020
- padding: 10px 12px;
1021
- }
1022
- #softDrinkModal .modal-title {
1023
- font-size: 1.2rem;
1024
- }
1025
- #softDrinkModal .modal-body {
1026
- padding: 15px;
1027
- }
1028
- #softDrinkModal .modal-body img {
1029
- max-height: 130px;
1030
- margin-bottom: 12px;
1031
- }
1032
- #softDrinkModal .modal-body h5 {
1033
- font-size: 1.2rem;
1034
- margin-bottom: 8px;
1035
- }
1036
- #softDrinkModal .modal-body p {
1037
- font-size: 1rem;
1038
- margin-bottom: 15px;
1039
- }
1040
- #softDrinkModal .quantity-controls .btn {
1041
- width: 28px;
1042
- height: 28px;
1043
- font-size: 1rem;
1044
- line-height: 28px;
1045
- }
1046
- #softDrinkModal .quantity-controls input {
1047
- width: 45px;
1048
- height: 28px;
1049
- font-size: 0.9rem;
1050
- }
1051
- #softDrinkModal .modal-footer {
1052
- padding: 10px;
1053
- }
1054
- #softDrinkModal .modal-footer .btn-primary {
1055
- padding: 10px 25px;
1056
- font-size: 1rem;
1057
- }
1058
- #softDrinkModal .modal-footer .quantity-controls-footer .btn {
1059
- width: 28px;
1060
- height: 28px;
1061
- font-size: 1rem;
1062
- line-height: 28px;
1063
- }
1064
- /* Mobile-Specific Filter Form Styles */
1065
- #filter-form {
1066
- margin-bottom: 15px;
1067
- }
1068
- .form-label {
1069
- font-size: 1rem;
1070
- }
1071
- .toggle-container {
1072
- margin: 6px 0;
1073
- }
1074
- .custom-toggle {
1075
- width: 40px;
1076
- height: 20px;
1077
- }
1078
- .custom-toggle::before {
1079
- width: 16px;
1080
- height: 16px;
1081
- top: 2px;
1082
- left: 2px;
1083
- }
1084
- .custom-toggle:checked::before {
1085
- transform: translateX(20px);
1086
- }
1087
- .toggle-container label {
1088
- font-size: 0.9rem;
1089
- }
1090
- }
1091
- .chat-container {
1092
- box-sizing: border-box;
1093
- margin: 0;
1094
- padding: 0;
1095
- }
1096
- body {
1097
- font-family: 'Segoe UI', Arial, sans-serif;
1098
- background-color: #f4f7fa;
1099
- overflow-x: hidden;
1100
- line-height: 1.5;
1101
- }
1102
- .chat-container {
1103
- width: 100%;
1104
- max-width: 800px;
1105
- height: 100vh;
1106
- margin: 0 auto;
1107
- background-color: #ffffff;
1108
- border-radius: 12px;
1109
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
1110
- display: flex;
1111
- flex-direction: column;
1112
- overflow: hidden;
1113
- }
1114
- .chat-header {
1115
- background-color: #0078d4;
1116
- color: #ffffff;
1117
- padding: 12px;
1118
- text-align: center;
1119
- font-size: 18px;
1120
- font-weight: 600;
1121
- flex-shrink: 0;
1122
- }
1123
- .chat-messages {
1124
- flex: 1;
1125
- overflow-y: auto;
1126
- padding: 15px;
1127
- scroll-behavior: smooth;
1128
- }
1129
- .bot-message, .user-message {
1130
- padding: 10px 15px;
1131
- margin: 8px 0;
1132
- border-radius: 12px;
1133
- max-width: 80%;
1134
- font-size: 14px;
1135
- line-height: 1.4;
1136
- }
1137
- .bot-message {
1138
- background-color: #e8f0fe;
1139
- color: #333;
1140
- }
1141
- .user-message {
1142
- background-color: #0078d4;
1143
- color: #ffffff;
1144
- margin-left: auto;
1145
- }
1146
- .chat-input {
1147
- display: flex;
1148
- padding: 10px;
1149
- border-top: 1px solid #e0e0e0;
1150
- background-color: #f9f9f9;
1151
- flex-shrink: 0;
1152
- }
1153
- .chat-input input {
1154
- flex: 1;
1155
- padding: 10px;
1156
- border: 1px solid #ccc;
1157
- border-radius: 8px;
1158
- font-size: 14px;
1159
- outline: none;
1160
- }
1161
- .chat-input button {
1162
- padding: 10px 20px;
1163
- margin-left: 10px;
1164
- background-color: #0078d4;
1165
- color: #ffffff;
1166
- border: none;
1167
- border-radius: 8px;
1168
- cursor: pointer;
1169
- font-size: 14px;
1170
- transition: background-color 0.2s;
1171
- }
1172
- .chat-input button:hover {
1173
- background-color: #005ea2;
1174
- }
1175
- .ingredients-list, .menu-items-list, .customization-ingredients-list {
1176
- display: flex;
1177
- flex-wrap: nowrap; /* Ensure items stay in a single row */
1178
- overflow-x: auto; /* Allow horizontal scrolling */
1179
- padding: 10px;
1180
- margin: 10px 0;
1181
- background-color: #f5f7fa;
1182
- border-radius: 10px;
1183
- gap: 15px;
1184
- scroll-behavior: smooth;
1185
- }
1186
- .ingredient-item, .menu-item {
1187
- flex: 0 0 auto; /* Ensure items don't stretch */
1188
- width: 200px; /* Set a fixed width for each item */
1189
- background-color: #ffffff;
1190
- border: 1px solid #e0e0e0;
1191
- border-radius: 10px;
1192
- padding: 10px;
1193
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
1194
- transition: transform 0.2s;
1195
- text-align: center;
1196
- }
1197
- .ingredient-item:hover, .menu-item:hover {
1198
- transform: translateY(-2px);
1199
- }
1200
- .ingredient-item img, .menu-item img {
1201
- width: 100%;
1202
- height: 120px;
1203
- object-fit: cover;
1204
- border-radius: 8px;
1205
- margin-bottom: 8px;
1206
- }
1207
- .ingredient-item div, .menu-item div {
1208
- font-size: 14px;
1209
- font-weight: 600;
1210
- color: #333;
1211
- margin-bottom: 5px;
1212
- }
1213
- .ingredient-item button, .menu-item button {
1214
- padding: 8px;
1215
- background-color: #28a745;
1216
- color: #ffffff;
1217
- border: none;
1218
- border-radius: 6px;
1219
- cursor: pointer;
1220
- font-size: 12px;
1221
- width: 100%;
1222
- }
1223
- .ingredient-item button:hover, .menu-item button:hover {
1224
- background-color: #218838;
1225
- }
1226
- .selected-ingredients, .selected-customization-ingredients {
1227
- background-color: #f1f8ff;
1228
- padding: 15px;
1229
- border: 1px solid #b3d7ff;
1230
- border-radius: 10px;
1231
- margin: 10px 0;
1232
- font-size: 14px;
1233
- display: flex;
1234
- flex-wrap: wrap;
1235
- gap: 10px;
1236
- }
1237
- .selected-ingredients div, .selected-customization-ingredients div {
1238
- background-color: #d6e9ff;
1239
- padding: 5px 10px;
1240
- border-radius: 6px;
1241
- font-size: 13px;
1242
- }
1243
- .customization-input {
1244
- margin: 10px 0;
1245
- }
1246
- .customization-input textarea, .selected-customization-ingredients textarea {
1247
- width: 100%;
1248
- padding: 8px;
1249
- border: 1px solid #b3d7ff;
1250
- border-radius: 6px;
1251
- font-size: 14px;
1252
- outline: none;
1253
- margin-bottom: 10px;
1254
- }
1255
- .customization-input button, .submit-button, .submit-customization-button, .submit-cart-button {
1256
- padding: 10px 20px;
1257
- background-color: #0078d4;
1258
- color: #ffffff;
1259
- border: none;
1260
- border-radius: 8px;
1261
- cursor: pointer;
1262
- font-size: 14px;
1263
- transition: background-color 0.2s;
1264
- }
1265
- .customization-input button:hover, .submit-button:hover, .submit-customization-button:hover, .submit-cart-button:hover {
1266
- background-color: #005ea2;
1267
- }
1268
- .option-button {
1269
- padding: 10px 20px;
1270
- color: #ffffff;
1271
- border: none;
1272
- border-radius: 8px;
1273
- cursor: pointer;
1274
- font-size: 14px;
1275
- margin: 5px;
1276
- transition: background-color 0.2s;
1277
- }
1278
- .option-button.green {
1279
- background-color: #28a745;
1280
- }
1281
- .option-button.green:hover {
1282
- background-color: #218838;
1283
- }
1284
- .option-button.red {
1285
- background-color: #dc3545;
1286
- }
1287
- .option-button.red:hover {
1288
- background-color: #c82333;
1289
- }
1290
- .cart-items {
1291
- background-color: #f1f8ff;
1292
- padding: 15px;
1293
- border: 1px solid #b3d7ff;
1294
- border-radius: 10px;
1295
- margin: 10px 0;
1296
- font-size: 14px;
1297
- }
1298
- .cart-item {
1299
- display: flex;
1300
- align-items: center;
1301
- background-color: #d6e9ff;
1302
- padding: 5px 10px;
1303
- border-radius: 6px;
1304
- font-size: 13px;
1305
- margin: 5px 0;
1306
- }
1307
- .cart-item img {
1308
- width: 30px;
1309
- height: 30px;
1310
- object-fit: cover;
1311
- border-radius: 6px;
1312
- margin-right: 8px;
1313
- }
1314
- .cart-item .remove-button {
1315
- padding: 5px 10px;
1316
- margin-left: 8px;
1317
- background-color: #dc3545;
1318
- color: #ffffff;
1319
- border: none;
1320
- border-radius: 6px;
1321
- cursor: pointer;
1322
- font-size: 12px;
1323
- }
1324
- .cart-item .remove-button:hover {
1325
- background-color: #c82333;
1326
- }
1327
- /* Responsive Design */
1328
- @media (max-width: 480px) {
1329
- .chat-container {
1330
- border-radius: 0;
1331
- box-shadow: none;
1332
- }
1333
- .chat-header {
1334
- font-size: 16px;
1335
- padding: 10px;
1336
- }
1337
- .chat-messages {
1338
- padding: 10px;
1339
- }
1340
- .bot-message, .user-message {
1341
- font-size: 13px;
1342
- padding: 8px 12px;
1343
- margin: 5px 0;
1344
- }
1345
- .chat-input input {
1346
- font-size: 13px;
1347
- padding: 8px;
1348
- }
1349
- .chat-input button {
1350
- font-size: 13px;
1351
- padding: 8px 15px;
1352
- }
1353
- .ingredients-list, .menu-items-list, .customization-ingredients-list {
1354
- flex-direction: row; /* Keep the items in a row on mobile */
1355
- gap: 10px;
1356
- }
1357
- .ingredient-item, .menu-item {
1358
- flex: 0 0 150px; /* Adjust the item width to fit smaller screens */
1359
- }
1360
- .ingredient-item img, .menu-item img {
1361
- height: 100px;
1362
- }
1363
- .ingredient-item div, .menu-item div {
1364
- font-size: 13px;
1365
- }
1366
- .ingredient-item button, .menu-item button {
1367
- font-size: 11px;
1368
- padding: 6px;
1369
- }
1370
- .option-button {
1371
- font-size: 13px;
1372
- padding: 8px 15px;
1373
- }
1374
- .selected-ingredients, .selected-customization-ingredients, .cart-items {
1375
- padding: 10px;
1376
- gap: 8px;
1377
- }
1378
- .cart-item {
1379
- font-size: 12px;
1380
- padding: 4px 8px;
1381
- }
1382
- .cart-item img {
1383
- width: 25px;
1384
- height: 25px;
1385
- }
1386
- }
1387
- @media (min-width: 481px) and (max-width: 768px) {
1388
- .chat-container {
1389
- max-width: 600px;
1390
- }
1391
- .chat-header {
1392
- font-size: 17px;
1393
- padding: 11px;
1394
- }
1395
- .chat-messages {
1396
- padding: 12px;
1397
- }
1398
- .ingredient-item, .menu-item {
1399
- flex: 0 0 180px;
1400
- }
1401
- .ingredient-item img, .menu-item img {
1402
- height: 110px;
1403
- }
1404
- }
1405
  </style>
1406
  </head>
1407
  <body>
@@ -1424,7 +39,7 @@
1424
  </div>
1425
  </div>
1426
 
1427
- <form method="get" action="/menu" class="text-center mb-4" id="filter-form">
1428
  <label class="form-label fw-bold">Filters:</label>
1429
  <div class="toggle-container">
1430
  <!-- Veg Only Toggle -->
@@ -1444,20 +59,19 @@
1444
  </div>
1445
  </form>
1446
 
1447
-
1448
  <div class="container mt-4">
1449
  {% if selected_category == "Customized Dish" %}
1450
  <div id="custom-dish-form" class="mt-4">
1451
- <div class="chat-container">
1452
- <div class="chat-header">🍳 Chef Bot</div>
1453
- <div class="chat-messages" id="chatMessages">
1454
- <!-- Initial message will be set by JavaScript based on session -->
1455
- </div>
1456
- <div class="chat-input">
1457
- <input type="text" id="userInput" placeholder="Type your name or message...">
1458
- <button onclick="sendMessage()">Send</button>
1459
- </div>
1460
- </div>
1461
  </div>
1462
  {% else %}
1463
  {% if ordered_menu.items()|length == 0 %}
@@ -1783,7 +397,6 @@
1783
  }
1784
  }
1785
 
1786
-
1787
  window.most_common_addons = {{ most_common_addons | tojson }};
1788
  console.log("Most common add-ons: ", window.most_common_addons);
1789
  function showItemDetails(name, price, image, description, section, selectedCategory) {
@@ -1860,7 +473,6 @@
1860
  }
1861
  });
1862
  });
1863
- // Pre-select the highest-count spice level
1864
  if (window.most_common_addons && window.most_common_addons.length > 0) {
1865
  const checkboxes = document.querySelectorAll('.addon-option');
1866
  const categorySelection = {
@@ -1868,9 +480,8 @@
1868
  "Choose Spice Level": null,
1869
  "Raita/Sides": [],
1870
  };
1871
- // First pass: Find and select the highest-count spice level
1872
  for (let spice of window.most_common_addons) {
1873
- const isSpiceLevel = ["Mild", "Medium", "Spicy", "Extra Spicy"].includes(spice); // Define valid spice levels
1874
  if (isSpiceLevel) {
1875
  checkboxes.forEach(checkbox => {
1876
  const checkboxName = checkbox.getAttribute('data-name').trim();
@@ -1882,10 +493,9 @@
1882
  categorySelection[checkboxGroup] = checkboxName;
1883
  }
1884
  });
1885
- if (categorySelection["Select Spice Level"] || categorySelection["Choose Spice Level"]) break; // Stop after selecting the first spice
1886
  }
1887
  }
1888
- // Second pass: Select other non-spice add-ons (e.g., Raita/Sides)
1889
  checkboxes.forEach(checkbox => {
1890
  const checkboxName = checkbox.getAttribute('data-name').trim();
1891
  const checkboxGroup = checkbox.getAttribute('data-group');
@@ -1986,10 +596,8 @@
1986
  }
1987
  form.submit();
1988
  }
1989
-
1990
-
1991
 
1992
- document.addEventListener('DOMContentLoaded', function () {
1993
  const avatarContainer = document.querySelector('.avatar-dropdown-container');
1994
  const dropdownMenu = document.querySelector('.dropdown-menu');
1995
  avatarContainer.addEventListener('click', function (event) {
@@ -2117,59 +725,6 @@
2117
  }
2118
  });
2119
  });
2120
- const descriptionTextarea = document.getElementById('custom-dish-description');
2121
- const descriptionSuggestions = document.getElementById('descriptionSuggestions');
2122
- if (descriptionTextarea && descriptionSuggestions) {
2123
- let usedIngredients = new Set();
2124
- function updateUsedIngredients() {
2125
- const inputText = descriptionTextarea.value.trim();
2126
- usedIngredients.clear();
2127
- if (inputText) {
2128
- const words = inputText.split(/,\s*/).map(word => word.trim());
2129
- words.forEach(word => {
2130
- if (word && ingredientsList.includes(word)) {
2131
- usedIngredients.add(word);
2132
- }
2133
- });
2134
- }
2135
- }
2136
- descriptionTextarea.addEventListener('input', function () {
2137
- const inputText = this.value.trim();
2138
- const words = inputText.split(/,\s*/);
2139
- const lastWord = words[words.length - 1].trim().toLowerCase();
2140
- descriptionSuggestions.innerHTML = '';
2141
- descriptionSuggestions.style.display = 'none';
2142
- updateUsedIngredients();
2143
- if (lastWord) {
2144
- const filteredIngredients = ingredientsList.filter(ingredient =>
2145
- ingredient.toLowerCase().includes(lastWord) && !usedIngredients.has(ingredient)
2146
- );
2147
- if (filteredIngredients.length > 0) {
2148
- filteredIngredients.forEach(ingredient => {
2149
- const suggestionDiv = document.createElement('div');
2150
- suggestionDiv.classList.add('suggestion-item');
2151
- suggestionDiv.innerText = ingredient;
2152
- suggestionDiv.addEventListener('click', function () {
2153
- const currentValue = descriptionTextarea.value;
2154
- const lastCommaIndex = currentValue.lastIndexOf(',');
2155
- const baseText = lastCommaIndex !== -1 ? currentValue.substring(0, lastCommaIndex + 1) : '';
2156
- descriptionTextarea.value = baseText + (baseText ? ' ' : '') + ingredient + ', ';
2157
- descriptionSuggestions.style.display = 'none';
2158
- descriptionTextarea.focus();
2159
- updateUsedIngredients();
2160
- });
2161
- descriptionSuggestions.appendChild(suggestionDiv);
2162
- });
2163
- descriptionSuggestions.style.display = 'block';
2164
- }
2165
- }
2166
- });
2167
- document.addEventListener('click', function (event) {
2168
- if (!descriptionTextarea.contains(event.target) && !descriptionSuggestions.contains(event.target)) {
2169
- descriptionSuggestions.style.display = 'none';
2170
- }
2171
- });
2172
- }
2173
  fetch('/cart/get')
2174
  .then(response => {
2175
  if (!response.ok) {
@@ -2211,70 +766,63 @@
2211
  quantityInput.value = quantity;
2212
  });
2213
  });
2214
- let currentStep = 'greeting'; // other possible values: 'food_type', 'select_ingredients', 'menu_display', 'customization', 'post_cart'
2215
- let conversation = [];
2216
- let selectedIngredients = [];
2217
- let selectedMenuItem = null;
2218
- let cart = [];
2219
- // Get the user name passed from Flask (via Jinja)
2220
- const userName = "{{ user_name }}"; // Jinja syntax to inject user_name from Flask session
2221
- window.onload = function() {
2222
- if (userName) {
2223
- // If user_name exists, greet the user directly and proceed to food preference
2224
- conversation.push({ role: 'bot', message: `Nice to meet you, ${userName}! 😊 Let's create your perfect meal! What type of food would you prefer?` });
2225
- displayConversation(); // Display the current conversation
2226
- displayOptions([
2227
- { text: 'Vegetarian', class: 'green' },
2228
- { text: 'Non-Vegetarian', class: 'red' }
2229
- ]);
2230
- } else {
2231
- // Ask for the name if it's not found
2232
- conversation.push({ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" });
2233
- displayConversation(); // Display the conversation
2234
- }
2235
- };
2236
- // Function to add messages to the chat
2237
- function addMessage(role, message) {
2238
- const chatMessages = document.getElementById('chatMessages');
2239
- if (!chatMessages) {
2240
- console.error('Chat messages container not found!');
2241
- return;
2242
- }
2243
- const messageDiv = document.createElement('div');
2244
- messageDiv.className = role === 'bot' ? 'bot-message' : 'user-message';
2245
- messageDiv.textContent = message;
2246
- chatMessages.appendChild(messageDiv);
2247
- chatMessages.scrollTop = chatMessages.scrollHeight;
2248
- }
2249
- // Function to display all conversation messages
2250
- function displayConversation() {
2251
- const chatMessages = document.getElementById('chatMessages');
2252
- chatMessages.innerHTML = ''; // Clear previous messages
2253
- conversation.forEach(msg => {
2254
  const messageDiv = document.createElement('div');
2255
- messageDiv.className = msg.role === 'bot' ? 'bot-message' : 'user-message';
2256
- messageDiv.textContent = msg.message;
2257
  chatMessages.appendChild(messageDiv);
2258
- });
2259
- chatMessages.scrollTop = chatMessages.scrollHeight; // Scroll to bottom
2260
- }
2261
- // Function to handle user input
2262
- function sendMessage() {
2263
- const userInput = document.getElementById('userInput').value.trim();
2264
- if (userInput) {
2265
- addMessage('user', userInput);
2266
- conversation.push({ role: 'user', message: userInput });
2267
- document.getElementById('userInput').value = ''; // Clear input field
2268
- setTimeout(() => handleResponse(userInput), 500);
2269
- } else {
2270
- console.warn('Empty message!');
 
 
 
 
 
 
 
 
 
 
2271
  }
2272
- }
2273
  function handleResponse(userInput) {
2274
  const lastMessage = conversation[conversation.length - 1].message.toLowerCase();
2275
  let botResponse = '';
2276
  let options = [];
2277
- // If user has already selected food type, proceed without repeating the question
2278
  if (lastMessage.includes('non-vegetarian')) {
2279
  conversation.push({ role: 'user', message: 'Non-Vegetarian' });
2280
  console.log("Food preference selected: Non-Vegetarian");
@@ -2298,11 +846,9 @@
2298
  handleYesResponse();
2299
  return;
2300
  } else if (lastMessage.includes('no') && selectedMenuItem) {
2301
- // Submit the dish without customization
2302
  submitCustomizationIngredients();
2303
  return;
2304
  } else if (lastMessage.includes('yes') && currentStep === 'post_cart') {
2305
- // After user says 'yes', ask again for food preference (veg or non-veg)
2306
  botResponse = `Let's get started again! What type of food would you prefer this time?`;
2307
  options = [
2308
  { text: 'Vegetarian', class: 'green' },
@@ -2313,14 +859,12 @@
2313
  displayOptions(options);
2314
  return;
2315
  } else if (lastMessage.includes('non-vegetarian') && currentStep === 'food_type') {
2316
- // Handle non-vegetarian selection
2317
  conversation.push({ role: 'user', message: 'Non-Vegetarian' });
2318
  console.log("Food preference selected: Non-Vegetarian");
2319
  botResponse = 'Great choice! 🍽️ Please select a non-vegetarian option:';
2320
  fetchIngredients('non-vegetarian');
2321
  return;
2322
  } else if (lastMessage.includes('vegetarian') && currentStep === 'food_type') {
2323
- // Handle vegetarian selection
2324
  conversation.push({ role: 'user', message: 'Vegetarian' });
2325
  console.log("Food preference selected: Vegetarian");
2326
  botResponse = 'Great choice! 🍽️ Here are some vegetarian ingredients:';
@@ -2328,7 +872,7 @@
2328
  return;
2329
  } else if (lastMessage.includes('no') && currentStep === 'post_cart') {
2330
  addMessage('bot', 'Awesome! 🧾 Here’s your final cart:');
2331
- displayCart(); // Optional: show final cart again
2332
  addMessage('bot', 'Thank you for your order! 👨‍🍳🍲');
2333
  currentStep = 'end';
2334
  return;
@@ -2346,7 +890,6 @@
2346
  }
2347
  const botResponse = `Here is your selected dish: ${selectedMenuItem.name}`;
2348
  addMessage('bot', botResponse);
2349
- // Display selected menu item
2350
  const chatMessages = document.getElementById('chatMessages');
2351
  const menuItemDiv = document.createElement('div');
2352
  menuItemDiv.className = 'menu-item';
@@ -2358,11 +901,10 @@
2358
  menuItemDiv.appendChild(img);
2359
  menuItemDiv.appendChild(name);
2360
  chatMessages.appendChild(menuItemDiv);
2361
- // Fetch ingredients for customization
2362
  fetchIngredientsForCustomization('both');
2363
  }
2364
  function fetchIngredientsForCustomization(foodPreference) {
2365
- fetch('/get_ingredients', { // Reuse existing endpoint
2366
  method: 'POST',
2367
  headers: { 'Content-Type': 'application/json' },
2368
  body: JSON.stringify({ dietary_preference: foodPreference })
@@ -2476,32 +1018,62 @@
2476
 
2477
  const textarea = document.querySelector('.selected-customization-ingredients textarea');
2478
  const instructions = textarea ? textarea.value.trim() : '';
 
 
 
2479
 
2480
- fetch('/submit_customization_ingredients', {
 
 
 
 
 
 
 
 
 
2481
  method: 'POST',
2482
  headers: { 'Content-Type': 'application/json' },
2483
- body: JSON.stringify({
2484
- menu_item: selectedMenuItem,
2485
- ingredients: selectedIngredients,
2486
- instructions: instructions
2487
- })
2488
  })
2489
- .then(response => response.json())
2490
- .then(data => {
2491
- if (data.success) {
2492
- addToCart({ ...selectedMenuItem, instructions, ingredients: selectedIngredients });
2493
- currentStep = 'post_cart';
2494
- addMessage('bot', 'Customization submitted successfully! Item added to cart.');
2495
-
2496
- // Redirect to the cart page
2497
- window.location.href = '/cart/cart'; // This will redirect the user to the cart page
2498
- } else {
2499
- addMessage('bot', `Error: ${data.error}`);
2500
- }
2501
- })
2502
- .catch(error => {
2503
- addMessage('bot', `Error submitting customization: ${error.message}`);
 
 
 
 
 
 
2504
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2505
  }
2506
  function fetchIngredients(foodPreference) {
2507
  fetch('/get_ingredients', {
@@ -2754,28 +1326,28 @@
2754
  });
2755
  }
2756
  function displayOptions(options) {
2757
- const chatMessages = document.getElementById('chatMessages');
2758
- if (!chatMessages) {
2759
- console.error('Chat messages container not found for options!');
2760
- return;
2761
- }
2762
- console.log('Displaying options:', options);
2763
- options.forEach(opt => {
2764
- const button = document.createElement('button');
2765
- button.textContent = opt.text;
2766
- button.className = `option-button ${opt.class}`;
2767
- button.onclick = () => {
2768
- addMessage('user', opt.text);
2769
- conversation.push({ role: 'user', message: opt.text });
2770
- console.log(`User selected option: ${opt.text}`);
2771
- setTimeout(() => handleResponse(opt.text), 500);
2772
- };
2773
- chatMessages.appendChild(button);
2774
- });
2775
- chatMessages.appendChild(document.createElement('br'));
2776
- chatMessages.scrollTop = chatMessages.scrollHeight;
2777
- console.log('Options displayed');
2778
- }
2779
 
2780
  document.getElementById('userInput').addEventListener('keypress', function(e) {
2781
  if (e.key === 'Enter') {
@@ -2785,11 +1357,4 @@
2785
  console.log('Script loaded successfully');
2786
  </script>
2787
  </body>
2788
- </html>
2789
-
2790
-
2791
-
2792
-
2793
-
2794
-
2795
-
 
15
  {% endfor %}
16
  {% endfor %}
17
  <style>
18
+ /* Existing styles remain unchanged */
19
+ /* ... (keeping all your existing CSS) ... */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  </style>
21
  </head>
22
  <body>
 
39
  </div>
40
  </div>
41
 
42
+ <form method="get" action="/menu" class="text-center mb-4" id="filter-form">
43
  <label class="form-label fw-bold">Filters:</label>
44
  <div class="toggle-container">
45
  <!-- Veg Only Toggle -->
 
59
  </div>
60
  </form>
61
 
 
62
  <div class="container mt-4">
63
  {% if selected_category == "Customized Dish" %}
64
  <div id="custom-dish-form" class="mt-4">
65
+ <div class="chat-container">
66
+ <div class="chat-header">🍳 Chef Bot</div>
67
+ <div class="chat-messages" id="chatMessages">
68
+ <!-- Initial message will be set by JavaScript based on session -->
69
+ </div>
70
+ <div class="chat-input">
71
+ <input type="text" id="userInput" placeholder="Type your name or message...">
72
+ <button onclick="sendMessage()">Send</button>
73
+ </div>
74
+ </div>
75
  </div>
76
  {% else %}
77
  {% if ordered_menu.items()|length == 0 %}
 
397
  }
398
  }
399
 
 
400
  window.most_common_addons = {{ most_common_addons | tojson }};
401
  console.log("Most common add-ons: ", window.most_common_addons);
402
  function showItemDetails(name, price, image, description, section, selectedCategory) {
 
473
  }
474
  });
475
  });
 
476
  if (window.most_common_addons && window.most_common_addons.length > 0) {
477
  const checkboxes = document.querySelectorAll('.addon-option');
478
  const categorySelection = {
 
480
  "Choose Spice Level": null,
481
  "Raita/Sides": [],
482
  };
 
483
  for (let spice of window.most_common_addons) {
484
+ const isSpiceLevel = ["Mild", "Medium", "Spicy", "Extra Spicy"].includes(spice);
485
  if (isSpiceLevel) {
486
  checkboxes.forEach(checkbox => {
487
  const checkboxName = checkbox.getAttribute('data-name').trim();
 
493
  categorySelection[checkboxGroup] = checkboxName;
494
  }
495
  });
496
+ if (categorySelection["Select Spice Level"] || categorySelection["Choose Spice Level"]) break;
497
  }
498
  }
 
499
  checkboxes.forEach(checkbox => {
500
  const checkboxName = checkbox.getAttribute('data-name').trim();
501
  const checkboxGroup = checkbox.getAttribute('data-group');
 
596
  }
597
  form.submit();
598
  }
 
 
599
 
600
+ document.addEventListener('DOMContentLoaded', function () {
601
  const avatarContainer = document.querySelector('.avatar-dropdown-container');
602
  const dropdownMenu = document.querySelector('.dropdown-menu');
603
  avatarContainer.addEventListener('click', function (event) {
 
725
  }
726
  });
727
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  fetch('/cart/get')
729
  .then(response => {
730
  if (!response.ok) {
 
766
  quantityInput.value = quantity;
767
  });
768
  });
769
+ let currentStep = 'greeting';
770
+ let conversation = [];
771
+ let selectedIngredients = [];
772
+ let selectedMenuItem = null;
773
+ let cart = [];
774
+ const userName = "{{ user_name }}";
775
+ window.onload = function() {
776
+ if (userName) {
777
+ conversation.push({ role: 'bot', message: `Nice to meet you, ${userName}! 😊 Let's create your perfect meal! What type of food would you prefer?` });
778
+ displayConversation();
779
+ displayOptions([
780
+ { text: 'Vegetarian', class: 'green' },
781
+ { text: 'Non-Vegetarian', class: 'red' }
782
+ ]);
783
+ } else {
784
+ conversation.push({ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" });
785
+ displayConversation();
786
+ }
787
+ };
788
+ function addMessage(role, message) {
789
+ const chatMessages = document.getElementById('chatMessages');
790
+ if (!chatMessages) {
791
+ console.error('Chat messages container not found!');
792
+ return;
793
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
794
  const messageDiv = document.createElement('div');
795
+ messageDiv.className = role === 'bot' ? 'bot-message' : 'user-message';
796
+ messageDiv.textContent = message;
797
  chatMessages.appendChild(messageDiv);
798
+ chatMessages.scrollTop = chatMessages.scrollHeight;
799
+ }
800
+ function displayConversation() {
801
+ const chatMessages = document.getElementById('chatMessages');
802
+ chatMessages.innerHTML = '';
803
+ conversation.forEach(msg => {
804
+ const messageDiv = document.createElement('div');
805
+ messageDiv.className = msg.role === 'bot' ? 'bot-message' : 'user-message';
806
+ messageDiv.textContent = msg.message;
807
+ chatMessages.appendChild(messageDiv);
808
+ });
809
+ chatMessages.scrollTop = chatMessages.scrollHeight;
810
+ }
811
+ function sendMessage() {
812
+ const userInput = document.getElementById('userInput').value.trim();
813
+ if (userInput) {
814
+ addMessage('user', userInput);
815
+ conversation.push({ role: 'user', message: userInput });
816
+ document.getElementById('userInput').value = '';
817
+ setTimeout(() => handleResponse(userInput), 500);
818
+ } else {
819
+ console.warn('Empty message!');
820
+ }
821
  }
 
822
  function handleResponse(userInput) {
823
  const lastMessage = conversation[conversation.length - 1].message.toLowerCase();
824
  let botResponse = '';
825
  let options = [];
 
826
  if (lastMessage.includes('non-vegetarian')) {
827
  conversation.push({ role: 'user', message: 'Non-Vegetarian' });
828
  console.log("Food preference selected: Non-Vegetarian");
 
846
  handleYesResponse();
847
  return;
848
  } else if (lastMessage.includes('no') && selectedMenuItem) {
 
849
  submitCustomizationIngredients();
850
  return;
851
  } else if (lastMessage.includes('yes') && currentStep === 'post_cart') {
 
852
  botResponse = `Let's get started again! What type of food would you prefer this time?`;
853
  options = [
854
  { text: 'Vegetarian', class: 'green' },
 
859
  displayOptions(options);
860
  return;
861
  } else if (lastMessage.includes('non-vegetarian') && currentStep === 'food_type') {
 
862
  conversation.push({ role: 'user', message: 'Non-Vegetarian' });
863
  console.log("Food preference selected: Non-Vegetarian");
864
  botResponse = 'Great choice! 🍽️ Please select a non-vegetarian option:';
865
  fetchIngredients('non-vegetarian');
866
  return;
867
  } else if (lastMessage.includes('vegetarian') && currentStep === 'food_type') {
 
868
  conversation.push({ role: 'user', message: 'Vegetarian' });
869
  console.log("Food preference selected: Vegetarian");
870
  botResponse = 'Great choice! 🍽️ Here are some vegetarian ingredients:';
 
872
  return;
873
  } else if (lastMessage.includes('no') && currentStep === 'post_cart') {
874
  addMessage('bot', 'Awesome! 🧾 Here’s your final cart:');
875
+ displayCart();
876
  addMessage('bot', 'Thank you for your order! 👨‍🍳🍲');
877
  currentStep = 'end';
878
  return;
 
890
  }
891
  const botResponse = `Here is your selected dish: ${selectedMenuItem.name}`;
892
  addMessage('bot', botResponse);
 
893
  const chatMessages = document.getElementById('chatMessages');
894
  const menuItemDiv = document.createElement('div');
895
  menuItemDiv.className = 'menu-item';
 
901
  menuItemDiv.appendChild(img);
902
  menuItemDiv.appendChild(name);
903
  chatMessages.appendChild(menuItemDiv);
 
904
  fetchIngredientsForCustomization('both');
905
  }
906
  function fetchIngredientsForCustomization(foodPreference) {
907
+ fetch('/get_ingredients', {
908
  method: 'POST',
909
  headers: { 'Content-Type': 'application/json' },
910
  body: JSON.stringify({ dietary_preference: foodPreference })
 
1018
 
1019
  const textarea = document.querySelector('.selected-customization-ingredients textarea');
1020
  const instructions = textarea ? textarea.value.trim() : '';
1021
+ const ingredientsList = selectedIngredients.map(ingredient => ingredient.name).join(', ');
1022
+ const itemPrice = 10.00; // Fixed price for custom dishes; adjust as needed
1023
+ const itemImage = selectedMenuItem.image_url || 'https://via.placeholder.com/120';
1024
 
1025
+ const customDishPayload = {
1026
+ menu_item: selectedMenuItem,
1027
+ ingredients: selectedIngredients,
1028
+ instructions: instructions,
1029
+ itemPrice: itemPrice,
1030
+ itemImage: itemImage
1031
+ };
1032
+
1033
+ // First, store the custom dish in Salesforce
1034
+ fetch('/menu/save_custom_dish', {
1035
  method: 'POST',
1036
  headers: { 'Content-Type': 'application/json' },
1037
+ body: JSON.stringify(customDishPayload)
 
 
 
 
1038
  })
1039
+ .then(response => response.json())
1040
+ .then(data => {
1041
+ if (!data.success) {
1042
+ throw new Error(data.error || 'Failed to save custom dish');
1043
+ }
1044
+ // After saving, add to cart
1045
+ const cartPayload = {
1046
+ itemName: selectedMenuItem.name,
1047
+ itemPrice: itemPrice,
1048
+ itemImage: itemImage,
1049
+ section: 'Customized Dish',
1050
+ category: 'Custom',
1051
+ addons: [],
1052
+ instructions: instructions,
1053
+ quantity: 1,
1054
+ ingredients: ingredientsList
1055
+ };
1056
+ return fetch('/cart/add', {
1057
+ method: 'POST',
1058
+ headers: { 'Content-Type': 'application/json' },
1059
+ body: JSON.stringify(cartPayload)
1060
  });
1061
+ })
1062
+ .then(response => response.json())
1063
+ .then(data => {
1064
+ if (data.success) {
1065
+ addMessage('bot', 'Customization submitted successfully! Item added to cart.');
1066
+ updateCartUI(data.cart);
1067
+ currentStep = 'post_cart';
1068
+ // Redirect to the menu page to see the custom dish
1069
+ window.location.href = '/menu?category=Customized+Dish';
1070
+ } else {
1071
+ throw new Error(data.error || 'Failed to add item to cart');
1072
+ }
1073
+ })
1074
+ .catch(error => {
1075
+ addMessage('bot', `Error: ${error.message}`);
1076
+ });
1077
  }
1078
  function fetchIngredients(foodPreference) {
1079
  fetch('/get_ingredients', {
 
1326
  });
1327
  }
1328
  function displayOptions(options) {
1329
+ const chatMessages = document.getElementById('chatMessages');
1330
+ if (!chatMessages) {
1331
+ console.error('Chat messages container not found for options!');
1332
+ return;
1333
+ }
1334
+ console.log('Displaying options:', options);
1335
+ options.forEach(opt => {
1336
+ const button = document.createElement('button');
1337
+ button.textContent = opt.text;
1338
+ button.className = `option-button ${opt.class}`;
1339
+ button.onclick = () => {
1340
+ addMessage('user', opt.text);
1341
+ conversation.push({ role: 'user', message: opt.text });
1342
+ console.log(`User selected option: ${opt.text}`);
1343
+ setTimeout(() => handleResponse(opt.text), 500);
1344
+ };
1345
+ chatMessages.appendChild(button);
1346
+ });
1347
+ chatMessages.appendChild(document.createElement('br'));
1348
+ chatMessages.scrollTop = chatMessages.scrollHeight;
1349
+ console.log('Options displayed');
1350
+ }
1351
 
1352
  document.getElementById('userInput').addEventListener('keypress', function(e) {
1353
  if (e.key === 'Enter') {
 
1357
  console.log('Script loaded successfully');
1358
  </script>
1359
  </body>
1360
+ </html>