-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProductList2.txt
More file actions
978 lines (914 loc) · 39.8 KB
/
Copy pathProductList2.txt
File metadata and controls
978 lines (914 loc) · 39.8 KB
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
@model IEnumerable<ResultProductDto>
@using System.Text.Json
@{
ViewData["Title"] = "Hastane Market";
// Serialize model to JSON with camelCase property names for JS consumption
var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
var productsJson = JsonSerializer.Serialize(Model, jsonOptions);
// Build unique category list from model for the dropdown
var categories = Model.Select(p => p.Category).Distinct().OrderBy(c => c).ToList();
}
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hastane Market</title>
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Bootstrap Icons -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css" rel="stylesheet" />
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet" />
<style>
/* ─── Root Tokens ─────────────────────────────── */
:root {
--hm-primary: #1A7F64;
--hm-primary-dk: #145F4B;
--hm-primary-lt: #E8F5F1;
--hm-accent: #2EBFA5;
--hm-accent-lt: #D4F5EF;
--hm-warning: #F59E0B;
--hm-surface: #F8FAFB;
--hm-border: #E5EAF0;
--hm-text: #1B2332;
--hm-muted: #7B8FA6;
--hm-white: #FFFFFF;
--hm-card-radius: 16px;
--hm-hero-h: 220px;
--shadow-card: 0 2px 8px rgba(0,0,0,.06);
--shadow-hover: 0 12px 32px rgba(26,127,100,.18);
--transition: .22s cubic-bezier(.4,0,.2,1);
}
* { box-sizing: border-box; }
body {
font-family: 'Inter', sans-serif;
background: var(--hm-surface);
color: var(--hm-text);
margin: 0;
}
/* ─── Top Bar ─────────────────────────────────── */
.top-bar {
background: var(--hm-white);
border-bottom: 1px solid var(--hm-border);
padding: 10px 0;
font-size: .82rem;
color: var(--hm-muted);
}
.top-bar .bi { margin-right: 4px; color: var(--hm-primary); }
/* ─── Hero / Header ───────────────────────────── */
.hero {
background: linear-gradient(135deg, #0D5C48 0%, #1A7F64 55%, #2EBFA5 100%);
min-height: var(--hm-hero-h);
position: relative;
overflow: hidden;
display: flex;
align-items: center;
padding: 40px 0 56px;
}
.hero::before {
content: '';
position: absolute;
right: -80px; top: -80px;
width: 420px; height: 420px;
border-radius: 50%;
background: rgba(255,255,255,.06);
pointer-events: none;
}
.hero::after {
content: '';
position: absolute;
right: 60px; bottom: -140px;
width: 300px; height: 300px;
border-radius: 50%;
background: rgba(255,255,255,.04);
pointer-events: none;
}
.hero-badge {
display: inline-flex;
align-items: center;
gap: 6px;
background: rgba(255,255,255,.18);
backdrop-filter: blur(8px);
border: 1px solid rgba(255,255,255,.28);
color: #fff;
font-size: .75rem;
font-weight: 600;
letter-spacing: .04em;
text-transform: uppercase;
border-radius: 50px;
padding: 5px 14px;
margin-bottom: 16px;
}
.hero h1 {
font-size: clamp(1.9rem, 4vw, 2.9rem);
font-weight: 700;
color: #fff;
line-height: 1.15;
margin: 0 0 12px;
}
.hero p {
color: rgba(255,255,255,.82);
font-size: 1rem;
max-width: 480px;
margin: 0;
line-height: 1.6;
}
/* Cart FAB on hero */
.cart-btn {
position: relative;
background: rgba(255,255,255,.15);
backdrop-filter: blur(12px);
border: 1.5px solid rgba(255,255,255,.35);
color: #fff;
border-radius: 14px;
padding: 12px 22px;
font-size: .92rem;
font-weight: 600;
display: inline-flex;
align-items: center;
gap: 8px;
cursor: pointer;
transition: var(--transition);
text-decoration: none;
}
.cart-btn:hover {
background: rgba(255,255,255,.28);
color: #fff;
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.cart-count {
background: var(--hm-warning);
color: #fff;
font-size: .7rem;
font-weight: 700;
border-radius: 50px;
padding: 2px 7px;
min-width: 20px;
text-align: center;
line-height: 1.4;
}
/* Stats row inside hero */
.hero-stats {
display: flex;
gap: 28px;
margin-top: 28px;
}
.hero-stat { color: rgba(255,255,255,.9); }
.hero-stat strong { display: block; font-size: 1.25rem; font-weight: 700; color: #fff; }
.hero-stat span { font-size: .78rem; opacity: .75; }
/* ─── Sticky Filter Bar ───────────────────────── */
.filter-bar {
background: var(--hm-white);
border-bottom: 1px solid var(--hm-border);
padding: 16px 0;
position: sticky;
top: 0;
z-index: 100;
box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.filter-bar .form-control,
.filter-bar .form-select {
border-radius: 12px;
border: 1.5px solid var(--hm-border);
font-size: .9rem;
padding: 10px 16px;
transition: var(--transition);
background: var(--hm-surface);
}
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
border-color: var(--hm-primary);
box-shadow: 0 0 0 3px rgba(26,127,100,.12);
background: var(--hm-white);
}
.search-wrap { position: relative; }
.search-wrap .bi {
position: absolute;
left: 14px; top: 50%;
transform: translateY(-50%);
color: var(--hm-muted);
font-size: 1rem;
pointer-events: none;
}
.search-wrap .form-control { padding-left: 40px; }
/* Category chips */
.cat-chips {
display: flex;
gap: 8px;
flex-wrap: nowrap;
overflow-x: auto;
padding-bottom: 2px;
scrollbar-width: none;
}
.cat-chips::-webkit-scrollbar { display: none; }
.cat-chip {
display: inline-flex;
align-items: center;
gap: 6px;
white-space: nowrap;
border: 1.5px solid var(--hm-border);
background: var(--hm-white);
color: var(--hm-text);
border-radius: 50px;
padding: 6px 16px;
font-size: .82rem;
font-weight: 500;
cursor: pointer;
transition: var(--transition);
user-select: none;
}
.cat-chip:hover, .cat-chip.active {
background: var(--hm-primary-lt);
border-color: var(--hm-primary);
color: var(--hm-primary);
}
.cat-chip .bi { font-size: .9rem; }
/* ─── Product Section ─────────────────────────── */
.products-section { padding: 32px 0 60px; }
.section-label {
font-size: .75rem;
font-weight: 600;
letter-spacing: .08em;
text-transform: uppercase;
color: var(--hm-primary);
margin-bottom: 4px;
}
.section-title {
font-size: 1.35rem;
font-weight: 700;
color: var(--hm-text);
margin-bottom: 24px;
}
/* ─── Product Card ────────────────────────────── */
.product-card {
background: var(--hm-white);
border-radius: var(--hm-card-radius);
border: 1px solid var(--hm-border);
box-shadow: var(--shadow-card);
overflow: hidden;
transition: var(--transition);
cursor: pointer;
height: 100%;
display: flex;
flex-direction: column;
}
.product-card:hover {
box-shadow: var(--shadow-hover);
transform: translateY(-4px);
border-color: rgba(26,127,100,.2);
}
.product-card .img-wrap {
width: 100%;
height: 180px;
overflow: hidden;
background: var(--hm-surface);
position: relative;
}
.product-card img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform .35s ease;
}
.product-card:hover img { transform: scale(1.06); }
/* favourite button */
.fav-btn {
position: absolute;
top: 10px; right: 10px;
background: rgba(255,255,255,.9);
border: none;
border-radius: 50%;
width: 32px; height: 32px;
display: flex; align-items: center; justify-content: center;
font-size: .9rem;
color: var(--hm-muted);
cursor: pointer;
transition: var(--transition);
z-index: 2;
}
.fav-btn:hover { color: #E53E3E; background: #fff; transform: scale(1.1); }
.product-body {
padding: 14px 16px 16px;
display: flex;
flex-direction: column;
flex: 1;
}
.product-cat {
display: inline-block;
font-size: .7rem;
font-weight: 600;
letter-spacing: .05em;
text-transform: uppercase;
border-radius: 50px;
padding: 3px 10px;
margin-bottom: 8px;
}
.product-name {
font-size: .93rem;
font-weight: 600;
color: var(--hm-text);
line-height: 1.35;
margin-bottom: 10px;
flex: 1;
}
.product-price {
font-size: 1.2rem;
font-weight: 700;
color: var(--hm-primary-dk);
margin-bottom: 12px;
}
.product-price small {
font-size: .72rem;
color: var(--hm-muted);
font-weight: 400;
margin-left: 3px;
}
/* Add to cart btn */
.btn-add {
background: var(--hm-primary);
color: #fff;
border: none;
border-radius: 10px;
padding: 9px 0;
font-size: .85rem;
font-weight: 600;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
cursor: pointer;
transition: var(--transition);
}
.btn-add:hover {
background: var(--hm-primary-dk);
transform: scale(1.03);
box-shadow: 0 6px 18px rgba(26,127,100,.32);
}
.btn-add:active { transform: scale(.98); }
/* ─── Category badge colour map ───────────────── */
.badge-atistirmalik { background: #FEF3C7; color: #B45309; }
.badge-icecek { background: #DBEAFE; color: #1D4ED8; }
.badge-kahvaltilik { background: #FCE7F3; color: #9D174D; }
.badge-meyve { background: #D1FAE5; color: #065F46; }
.badge-temizlik { background: #EDE9FE; color: #5B21B6; }
.badge-kisisel { background: #FEE2E2; color: #991B1B; }
.badge-default { background: #F3F4F6; color: #374151; }
/* ─── Skeleton ────────────────────────────────── */
.skeleton-card {
background: var(--hm-white);
border-radius: var(--hm-card-radius);
border: 1px solid var(--hm-border);
overflow: hidden;
height: 340px;
}
.skeleton-img {
width: 100%; height: 180px;
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 1.4s infinite;
}
.skeleton-body { padding: 14px 16px; }
.skeleton-line {
border-radius: 6px;
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 1.4s infinite;
margin-bottom: 10px;
}
@keyframes shimmer {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* ─── Empty State ─────────────────────────────── */
.empty-state {
text-align: center;
padding: 80px 24px;
}
.empty-icon {
width: 100px; height: 100px;
background: var(--hm-primary-lt);
border-radius: 50%;
display: flex; align-items: center; justify-content: center;
margin: 0 auto 24px;
font-size: 2.8rem;
color: var(--hm-primary);
}
.empty-state h4 { font-weight: 700; color: var(--hm-text); margin-bottom: 8px; }
.empty-state p { color: var(--hm-muted); font-size: .95rem; }
/* ─── Modal ───────────────────────────────────── */
.modal-content {
border-radius: 20px;
border: none;
overflow: hidden;
}
.modal-header {
background: var(--hm-primary-lt);
border-bottom: 1px solid var(--hm-border);
padding: 16px 24px;
}
.modal-title { font-weight: 700; font-size: 1rem; color: var(--hm-primary-dk); }
.modal-img-wrap {
height: 260px;
overflow: hidden;
border-radius: 14px;
}
.modal-img-wrap img {
width: 100%; height: 100%;
object-fit: cover;
}
.modal-price {
font-size: 1.6rem;
font-weight: 700;
color: var(--hm-primary-dk);
}
.qty-control {
display: flex;
align-items: center;
gap: 0;
border: 1.5px solid var(--hm-border);
border-radius: 10px;
overflow: hidden;
width: fit-content;
}
.qty-btn {
background: var(--hm-surface);
border: none;
padding: 8px 16px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
color: var(--hm-primary);
transition: var(--transition);
}
.qty-btn:hover { background: var(--hm-primary-lt); }
.qty-val {
padding: 8px 18px;
font-weight: 700;
font-size: 1rem;
border-left: 1.5px solid var(--hm-border);
border-right: 1.5px solid var(--hm-border);
min-width: 50px;
text-align: center;
}
.total-price-box {
background: var(--hm-primary-lt);
border-radius: 12px;
padding: 14px 18px;
display: flex;
justify-content: space-between;
align-items: center;
}
.btn-modal-add {
background: var(--hm-primary);
color: #fff;
border: none;
border-radius: 12px;
padding: 12px 28px;
font-size: .95rem;
font-weight: 700;
display: flex; align-items: center; gap: 8px;
cursor: pointer;
transition: var(--transition);
width: 100%;
justify-content: center;
}
.btn-modal-add:hover {
background: var(--hm-primary-dk);
transform: translateY(-1px);
box-shadow: 0 6px 18px rgba(26,127,100,.3);
}
/* ─── Toast ───────────────────────────────────── */
.toast-container { z-index: 9999; }
.toast {
border-radius: 14px;
border: none;
box-shadow: 0 8px 32px rgba(0,0,0,.14);
min-width: 280px;
}
.toast-header {
background: var(--hm-primary);
color: #fff;
border-radius: 14px 14px 0 0;
border: none;
}
.toast-header .btn-close { filter: invert(1); opacity: .85; }
/* ─── Footer ──────────────────────────────────── */
.site-footer {
background: var(--hm-white);
border-top: 1px solid var(--hm-border);
padding: 28px 0;
color: var(--hm-muted);
font-size: .83rem;
}
.footer-logo {
display: flex; align-items: center; gap: 10px;
font-weight: 700;
color: var(--hm-primary);
font-size: 1rem;
}
/* ─── Utility ─────────────────────────────────── */
.divider-wave {
background: var(--hm-white);
height: 28px;
margin-top: -1px;
clip-path: ellipse(55% 100% at 50% 100%);
}
.fade-in {
animation: fadeUp .35s ease both;
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(14px); }
to { opacity: 1; transform: translateY(0); }
}
/* ─── Responsive tweaks ───────────────────────── */
@media (max-width: 575px) {
.hero h1 { font-size: 1.6rem; }
.hero p { font-size: .9rem; }
.hero-stats { gap: 18px; }
.hero-stat strong { font-size: 1rem; }
.section-title { font-size: 1.15rem; }
}
</style>
</head>
<body>
@* @Html.AntiForgeryToken() — uncomment if POST forms are added *@
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ TOP INFO BAR ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<div class="top-bar d-none d-md-block">
<div class="container d-flex justify-content-between align-items-center">
<span><i class="bi bi-hospital"></i>Şehir Hastanesi — Hasta Hizmetleri</span>
<div class="d-flex gap-4">
<span><i class="bi bi-clock"></i>Teslimat: 20–35 dk</span>
<span><i class="bi bi-shield-check"></i>Güvenli Ödeme</span>
<span><i class="bi bi-telephone"></i>Dahili: 1234</span>
</div>
</div>
</div>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ HERO HEADER ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<header class="hero">
<div class="container">
<div class="d-flex justify-content-between align-items-start flex-wrap gap-3">
<div>
<div class="hero-badge">
<i class="bi bi-bag-heart-fill"></i> Hastane Market
</div>
<h1>İhtiyacınız olan her şey<br />odanıza geliyor.</h1>
<p>Atıştırmalıktan kişisel bakıma, içecekten kahvaltılığa — birkaç dokunuşla siparişiniz yolda.</p>
<div class="hero-stats">
<div class="hero-stat"><strong>200+</strong><span>Ürün</span></div>
<div class="hero-stat"><strong>20 dk</strong><span>Ortalama teslimat</span></div>
<div class="hero-stat"><strong>7/24</strong><span>Hizmet</span></div>
</div>
</div>
<a href="#cart" class="cart-btn" id="headerCartBtn">
<i class="bi bi-bag-fill fs-5"></i>
Sepetim
<span class="cart-count" id="cartBadge">0</span>
</a>
</div>
</div>
</header>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ STICKY FILTER BAR ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<nav class="filter-bar" id="filterBar">
<div class="container">
<div class="row g-3 align-items-center mb-3">
<!-- Search -->
<div class="col-12 col-sm-7 col-md-6">
<div class="search-wrap">
<i class="bi bi-search"></i>
<input type="text" id="searchInput" class="form-control" placeholder="Ürün ara… (ör. su, bisküvi, şampuan)" />
</div>
</div>
<!-- Category select -->
<div class="col-12 col-sm-5 col-md-4">
<select id="categorySelect" class="form-select">
<option value="">Tüm Kategoriler</option>
@foreach (var cat in categories)
{
<option value="@cat">@cat</option>
}
</select>
</div>
<!-- Result count -->
<div class="col-12 col-md-2 text-md-end">
<span id="resultCount" class="text-muted" style="font-size:.83rem;"></span>
</div>
</div>
<!-- Chip row -->
<div class="cat-chips">
<div class="cat-chip active" data-cat="">
<i class="bi bi-grid-3x3-gap-fill"></i> Tümü
</div>
@foreach (var cat in categories)
{
<div class="cat-chip" data-cat="@cat">
<i class="bi bi-tag"></i> @cat
</div>
}
</div>
</div>
</nav>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ PRODUCT GRID ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<section class="products-section">
<div class="container">
<div class="section-label">Tüm Ürünler</div>
<div class="section-title" id="sectionTitle">Günün Önerileri</div>
<!-- Skeleton (shown while loading) -->
<div id="skeletonGrid" class="row g-3 g-md-4">
<!-- 8 skeleton cards -->
</div>
<!-- Product grid -->
<div id="productGrid" class="row g-3 g-md-4" style="display:none;"></div>
<!-- Empty state -->
<div id="emptyState" class="empty-state" style="display:none;">
<div class="empty-icon"><i class="bi bi-search-heart"></i></div>
<h4>Ürün bulunamadı</h4>
<p>Aradığınız kriterlere uygun ürün bulunamadı.<br />Filtreleri temizleyerek tekrar deneyebilirsiniz.</p>
<button class="btn btn-outline-secondary mt-3 rounded-pill" onclick="clearFilters()">
<i class="bi bi-arrow-counterclockwise me-2"></i>Filtreleri Temizle
</button>
</div>
</div>
</section>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ PRODUCT DETAIL MODAL ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<div class="modal fade" id="productModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<span class="modal-title"><i class="bi bi-bag-heart me-2"></i>Ürün Detayı</span>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-4">
<div class="row g-4">
<div class="col-md-5">
<div class="modal-img-wrap">
<img id="modalImg" src="" alt="" />
</div>
</div>
<div class="col-md-7">
<span id="modalCatBadge" class="product-cat mb-2 d-inline-block"></span>
<h3 id="modalName" class="fw-700 mb-1" style="font-size:1.35rem;font-weight:700;"></h3>
<p class="text-muted" style="font-size:.88rem;line-height:1.6;" id="modalDesc">
Hastane marketimizin özenle seçilmiş ürünlerinden biri. Yüksek kalite standartlarımızla temin edilen bu ürün, hastanemizde konaklayan tüm hastalarımız ve refakatçileri için hazırlanmıştır.
</p>
<div class="modal-price mb-3" id="modalPrice"></div>
<!-- Qty -->
<div class="mb-3">
<div class="fw-600 mb-2" style="font-size:.88rem;color:var(--hm-muted);">ADET</div>
<div class="qty-control">
<button class="qty-btn" onclick="changeQty(-1)">−</button>
<div class="qty-val" id="qtyDisplay">1</div>
<button class="qty-btn" onclick="changeQty(1)">+</button>
</div>
</div>
<!-- Total -->
<div class="total-price-box mb-4">
<span class="fw-600" style="color:var(--hm-primary);">Toplam</span>
<span id="totalPrice" class="fw-700 fs-5" style="color:var(--hm-primary-dk);"></span>
</div>
<button class="btn-modal-add" id="modalAddBtn">
<i class="bi bi-cart-plus-fill fs-5"></i> Sepete Ekle
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ TOAST NOTIFICATION ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="cartToast" class="toast" role="alert" aria-live="assertive" data-bs-delay="2800">
<div class="toast-header">
<i class="bi bi-bag-check-fill me-2"></i>
<strong class="me-auto">Sepete Eklendi</strong>
<button type="button" class="btn-close" data-bs-dismiss="toast"></button>
</div>
<div class="toast-body d-flex align-items-center gap-2">
<i class="bi bi-check-circle-fill text-success fs-5"></i>
<span id="toastMsg">Ürün sepete eklendi.</span>
</div>
</div>
</div>
<!-- ╔══════════════════════════════════════════════╗ -->
<!-- ║ FOOTER ║ -->
<!-- ╚══════════════════════════════════════════════╝ -->
<footer class="site-footer">
<div class="container d-flex flex-column flex-md-row justify-content-between align-items-center gap-3">
<div class="footer-logo">
<i class="bi bi-hospital-fill fs-4"></i>
Hastane Market
</div>
<div>Tüm siparişler 20–35 dakika içinde odanıza teslim edilir. Destek: Dahili 1234</div>
<div class="d-flex gap-3">
<a href="#" class="text-muted text-decoration-none"><i class="bi bi-shield-lock me-1"></i>Gizlilik</a>
<a href="#" class="text-muted text-decoration-none"><i class="bi bi-file-text me-1"></i>Koşullar</a>
</div>
</div>
</footer>
<!-- ─── Scripts ──────────────────────────────────────── -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
/* ══════════════════════════════════════════════════════
DATA — Mock ResultProductDto list
In production this comes from:
@JsonSerializer.Serialize(Model, …) or an API call
══════════════════════════════════════════════════════ */
// ── Razor injects the server-side model as a camelCase JSON array ──
// Properties map exactly to ResultProductDto:
// productId | productName | price | category | imageUrl
const products = @Html.Raw(productsJson);
/* ══════════════════════════════════════════════════════
STATE
══════════════════════════════════════════════════════ */
let cartCount = 0;
let currentQty = 1;
let currentProduct = null;
const catBadgeMap = {
"Atıştırmalık": "badge-atistirmalik",
"İçecek": "badge-icecek",
"Kahvaltılık": "badge-kahvaltilik",
"Meyve": "badge-meyve",
"Temizlik": "badge-temizlik",
"Kişisel Bakım":"badge-kisisel",
};
/* ══════════════════════════════════════════════════════
SKELETON
══════════════════════════════════════════════════════ */
function buildSkeleton() {
const grid = document.getElementById('skeletonGrid');
let html = '';
for (let i = 0; i < 8; i++) {
html += `
<div class="col-6 col-md-4 col-lg-3">
<div class="skeleton-card">
<div class="skeleton-img"></div>
<div class="skeleton-body">
<div class="skeleton-line" style="width:40%;height:14px;"></div>
<div class="skeleton-line" style="width:80%;height:16px;"></div>
<div class="skeleton-line" style="width:60%;height:16px;"></div>
<div class="skeleton-line" style="width:35%;height:22px;margin-top:8px;"></div>
<div class="skeleton-line" style="width:100%;height:36px;border-radius:10px;"></div>
</div>
</div>
</div>`;
}
grid.innerHTML = html;
}
/* ══════════════════════════════════════════════════════
RENDER PRODUCTS
══════════════════════════════════════════════════════ */
function renderProducts(list) {
const grid = document.getElementById('productGrid');
const empty = document.getElementById('emptyState');
const count = document.getElementById('resultCount');
if (!list.length) {
grid.style.display = 'none';
empty.style.display = 'block';
count.textContent = '';
return;
}
empty.style.display = 'none';
grid.style.display = '';
count.textContent = list.length + ' ürün';
grid.innerHTML = list.map((p, i) => {
const badgeCls = catBadgeMap[p.category] || 'badge-default';
return `
<div class="col-6 col-md-4 col-lg-3 fade-in" style="animation-delay:${i * 40}ms">
<div class="product-card h-100" onclick="openModal(${p.productId})">
<div class="img-wrap">
<img src="${p.imageUrl}" alt="${p.productName}" loading="lazy" />
<button class="fav-btn" onclick="event.stopPropagation()" title="Favorilere ekle">
<i class="bi bi-heart"></i>
</button>
</div>
<div class="product-body">
<span class="product-cat ${badgeCls}">${p.category}</span>
<div class="product-name">${p.productName}</div>
<div class="product-price">₺${p.price.toFixed(2)}</div>
<button class="btn-add" onclick="event.stopPropagation(); quickAdd(${p.productId})">
<i class="bi bi-cart-plus-fill"></i> Sepete Ekle
</button>
</div>
</div>
</div>`;
}).join('');
}
/* ══════════════════════════════════════════════════════
FILTER
══════════════════════════════════════════════════════ */
function applyFilters() {
const query = document.getElementById('searchInput').value.toLowerCase().trim();
const category = document.getElementById('categorySelect').value;
const filtered = products.filter(p => {
const matchName = p.productName.toLowerCase().includes(query);
const matchCat = !category || p.category === category;
return matchName && matchCat;
});
const title = category || query
? (category || 'Arama sonuçları')
: 'Günün Önerileri';
document.getElementById('sectionTitle').textContent = title;
renderProducts(filtered);
}
function clearFilters() {
document.getElementById('searchInput').value = '';
document.getElementById('categorySelect').value = '';
document.querySelectorAll('.cat-chip').forEach(c => c.classList.remove('active'));
document.querySelector('.cat-chip[data-cat=""]').classList.add('active');
applyFilters();
}
/* ══════════════════════════════════════════════════════
CHIP CLICK
══════════════════════════════════════════════════════ */
document.querySelectorAll('.cat-chip').forEach(chip => {
chip.addEventListener('click', () => {
document.querySelectorAll('.cat-chip').forEach(c => c.classList.remove('active'));
chip.classList.add('active');
const cat = chip.dataset.cat;
document.getElementById('categorySelect').value = cat;
applyFilters();
});
});
document.getElementById('searchInput').addEventListener('input', applyFilters);
document.getElementById('categorySelect').addEventListener('change', function() {
// sync chips
document.querySelectorAll('.cat-chip').forEach(c => c.classList.remove('active'));
const active = document.querySelector(`.cat-chip[data-cat="${this.value}"]`);
if (active) active.classList.add('active');
applyFilters();
});
/* ══════════════════════════════════════════════════════
MODAL
══════════════════════════════════════════════════════ */
function openModal(id) {
const p = products.find(x => x.productId === id);
if (!p) return;
currentProduct = p;
currentQty = 1;
const badgeCls = catBadgeMap[p.category] || 'badge-default';
document.getElementById('modalImg').src = p.imageUrl;
document.getElementById('modalImg').alt = p.productName;
document.getElementById('modalName').textContent = p.productName;
document.getElementById('modalPrice').textContent= '₺' + p.price.toFixed(2);
document.getElementById('modalCatBadge').textContent = p.category;
document.getElementById('modalCatBadge').className = `product-cat ${badgeCls} d-inline-block mb-2`;
document.getElementById('qtyDisplay').textContent = 1;
updateTotal();
document.getElementById('modalAddBtn').onclick = () => {
addToCart(p, currentQty);
bootstrap.Modal.getInstance(document.getElementById('productModal')).hide();
};
new bootstrap.Modal(document.getElementById('productModal')).show();
}
function changeQty(delta) {
currentQty = Math.max(1, currentQty + delta);
document.getElementById('qtyDisplay').textContent = currentQty;
updateTotal();
}
function updateTotal() {
if (!currentProduct) return;
const total = (currentProduct.price * currentQty).toFixed(2);
document.getElementById('totalPrice').textContent = '₺' + total;
}
/* ══════════════════════════════════════════════════════
CART
══════════════════════════════════════════════════════ */
function quickAdd(id) {
const p = products.find(x => x.productId === id);
if (p) addToCart(p, 1);
}
function addToCart(product, qty) {
cartCount += qty;
document.getElementById('cartBadge').textContent = cartCount;
// Toast
document.getElementById('toastMsg').textContent =
`"${product.productName}" sepete eklendi.`;
const toastEl = document.getElementById('cartToast');
const toast = bootstrap.Toast.getOrCreateInstance(toastEl);
toast.show();
}
/* ══════════════════════════════════════════════════════
INIT — show skeleton, then render after short delay
══════════════════════════════════════════════════════ */
buildSkeleton();
setTimeout(() => {
document.getElementById('skeletonGrid').style.display = 'none';
renderProducts(products);
}, 900);
</script>
</body>
</html>