Spaces:
Running

File size: 39,747 Bytes
0234eaa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Frito-Lay Store Management</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #004B87 0%, #00A3E0 100%);
        }
        .store-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .time-picker {
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
        }
        .day-selector input[type="checkbox"]:checked + label {
            background-color: #004B87;
            color: white;
        }
        .slide-in {
            animation: slideIn 0.3s ease-out forwards;
        }
        @keyframes slideIn {
            from { transform: translateX(100%); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
    <!-- Login Screen -->
    <div id="loginScreen" class="fixed inset-0 flex items-center justify-center gradient-bg z-50 transition-all duration-300">
        <div class="bg-white p-8 rounded-xl shadow-2xl w-full max-w-md">
            <div class="flex justify-center mb-6">
                <img src="https://www.pepsico.com/images/pepsico-logo.svg" alt="Pepsico Logo" class="h-16">
            </div>
            <h2 class="text-2xl font-bold text-center text-gray-800 mb-2">Frito-Lay Store Management</h2>
            <p class="text-gray-600 text-center mb-8">Please sign in with your Pepsico ID</p>
            
            <form id="loginForm" class="space-y-4">
                <div>
                    <label for="pepsicoId" class="block text-sm font-medium text-gray-700 mb-1">Pepsico ID</label>
                    <input type="text" id="pepsicoId" name="pepsicoId" 
                           class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                           placeholder="Enter your Pepsico ID" required>
                </div>
                <div>
                    <label for="password" class="block text-sm font-medium text-gray-700 mb-1">Password</label>
                    <input type="password" id="password" name="password" 
                           class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                           placeholder="Enter your password" required>
                </div>
                <button type="submit" class="w-full gradient-bg text-white py-2 px-4 rounded-lg font-medium hover:opacity-90 transition duration-200">
                    Sign In
                </button>
            </form>
            
            <div class="mt-6 text-center text-sm text-gray-600">
                <p>Need help? Contact IT Support at 1-800-PEPSICO</p>
            </div>
        </div>
    </div>

    <!-- Main App -->
    <div id="appContainer" class="hidden">
        <!-- Header -->
        <header class="gradient-bg text-white shadow-md">
            <div class="container mx-auto px-4 py-3 flex justify-between items-center">
                <div class="flex items-center space-x-2">
                    <img src="https://www.fritolay.com/images/default-source/default-album/frito-lay-logo.png" alt="Frito-Lay Logo" class="h-10">
                    <span class="text-xl font-bold">Store Management</span>
                </div>
                <div class="flex items-center space-x-4">
                    <button id="shareBtn" class="bg-white text-blue-800 px-4 py-1 rounded-full text-sm font-medium flex items-center hover:bg-gray-100">
                        <i class="fas fa-share-alt mr-2"></i> Share
                    </button>
                    <div class="flex items-center space-x-2">
                        <div class="w-8 h-8 rounded-full bg-white flex items-center justify-center text-blue-800 font-bold">
                            <span id="userInitials">US</span>
                        </div>
                        <span id="userIdDisplay" class="font-medium">user@pepsico.com</span>
                    </div>
                </div>
            </div>
        </header>

        <!-- Main Content -->
        <main class="container mx-auto px-4 py-6">
            <!-- Store List Header -->
            <div class="flex justify-between items-center mb-6">
                <h1 class="text-2xl font-bold text-gray-800">My Stores</h1>
                <button id="addStoreBtn" class="gradient-bg text-white px-4 py-2 rounded-lg flex items-center hover:opacity-90">
                    <i class="fas fa-plus mr-2"></i> Add Store
                </button>
            </div>

            <!-- Store Cards Grid -->
            <div id="storeList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <!-- Store cards will be dynamically added here -->
            </div>

            <!-- Empty State -->
            <div id="emptyState" class="text-center py-16">
                <i class="fas fa-store-alt text-4xl text-gray-300 mb-4"></i>
                <h3 class="text-xl font-medium text-gray-600 mb-2">No stores added yet</h3>
                <p class="text-gray-500 mb-4">Add your first store to get started</p>
                <button id="emptyAddStoreBtn" class="gradient-bg text-white px-6 py-2 rounded-lg hover:opacity-90">
                    Add Store
                </button>
            </div>
        </main>

        <!-- Add Store Modal -->
        <div id="addStoreModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
            <div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto slide-in">
                <div class="p-6">
                    <div class="flex justify-between items-center mb-4">
                        <h3 class="text-xl font-bold text-gray-800">Add New Store</h3>
                        <button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
                            <i class="fas fa-times"></i>
                        </button>
                    </div>
                    
                    <form id="storeForm" class="space-y-4">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <label for="storeName" class="block text-sm font-medium text-gray-700 mb-1">Store Name</label>
                                <input type="text" id="storeName" name="storeName" 
                                       class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                       placeholder="e.g. Walmart #1234" required>
                            </div>
                            <div>
                                <label for="storeAddress" class="block text-sm font-medium text-gray-700 mb-1">Address</label>
                                <input type="text" id="storeAddress" name="storeAddress" 
                                       class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                       placeholder="123 Main St, City, State" required>
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <label for="storePhone" class="block text-sm font-medium text-gray-700 mb-1">Phone Number</label>
                                <input type="tel" id="storePhone" name="storePhone" 
                                       class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                       placeholder="(555) 123-4567">
                            </div>
                            <div>
                                <label for="storeManager" class="block text-sm font-medium text-gray-700 mb-1">Store Manager</label>
                                <input type="text" id="storeManager" name="storeManager" 
                                       class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                       placeholder="Manager Name">
                            </div>
                        </div>
                        
                        <div class="border-t border-gray-200 pt-4">
                            <h4 class="text-lg font-medium text-gray-800 mb-3">Delivery Schedule</h4>
                            
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                                <div>
                                    <label for="openTime" class="block text-sm font-medium text-gray-700 mb-1">Store Opens At</label>
                                    <input type="time" id="openTime" name="openTime" 
                                           class="w-full px-4 py-2 border border-gray-300 rounded-lg time-picker focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                           required>
                                </div>
                                <div>
                                    <label for="deliveryTime" class="block text-sm font-medium text-gray-700 mb-1">Delivery Window</label>
                                    <input type="time" id="deliveryTime" name="deliveryTime" 
                                           class="w-full px-4 py-2 border border-gray-300 rounded-lg time-picker focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                           required>
                                </div>
                            </div>
                            
                            <div>
                                <label class="block text-sm font-medium text-gray-700 mb-2">Delivery Days</label>
                                <div class="day-selector flex flex-wrap gap-2">
                                    <input type="checkbox" id="monday" name="deliveryDays" value="Monday" class="hidden">
                                    <label for="monday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Mon</label>
                                    
                                    <input type="checkbox" id="tuesday" name="deliveryDays" value="Tuesday" class="hidden">
                                    <label for="tuesday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Tue</label>
                                    
                                    <input type="checkbox" id="wednesday" name="deliveryDays" value="Wednesday" class="hidden">
                                    <label for="wednesday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Wed</label>
                                    
                                    <input type="checkbox" id="thursday" name="deliveryDays" value="Thursday" class="hidden">
                                    <label for="thursday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Thu</label>
                                    
                                    <input type="checkbox" id="friday" name="deliveryDays" value="Friday" class="hidden">
                                    <label for="friday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Fri</label>
                                    
                                    <input type="checkbox" id="saturday" name="deliveryDays" value="Saturday" class="hidden">
                                    <label for="saturday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Sat</label>
                                    
                                    <input type="checkbox" id="sunday" name="deliveryDays" value="Sunday" class="hidden">
                                    <label for="sunday" class="px-3 py-1 border border-gray-300 rounded-full text-sm cursor-pointer hover:bg-gray-100">Sun</label>
                                </div>
                            </div>
                        </div>
                        
                        <div class="border-t border-gray-200 pt-4">
                            <label for="storeNotes" class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
                            <textarea id="storeNotes" name="storeNotes" rows="3" 
                                      class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                      placeholder="Any special instructions or notes about this store..."></textarea>
                        </div>
                        
                        <div class="flex justify-end space-x-3 pt-4">
                            <button type="button" id="cancelStoreBtn" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
                                Cancel
                            </button>
                            <button type="submit" class="gradient-bg text-white px-6 py-2 rounded-lg hover:opacity-90">
                                Save Store
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <!-- Share Modal -->
        <div id="shareModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
            <div class="bg-white rounded-xl shadow-xl w-full max-w-md slide-in">
                <div class="p-6">
                    <div class="flex justify-between items-center mb-4">
                        <h3 class="text-xl font-bold text-gray-800">Share Store Information</h3>
                        <button id="closeShareModalBtn" class="text-gray-500 hover:text-gray-700">
                            <i class="fas fa-times"></i>
                        </button>
                    </div>
                    
                    <div class="space-y-4">
                        <div>
                            <label for="sharePepsicoId" class="block text-sm font-medium text-gray-700 mb-1">Pepsico ID to share with</label>
                            <input type="text" id="sharePepsicoId" 
                                   class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" 
                                   placeholder="Enter Pepsico ID">
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">Stores to share</label>
                            <div id="shareStoreList" class="max-h-60 overflow-y-auto border border-gray-200 rounded-lg p-2 space-y-2">
                                <!-- Stores will be added here with checkboxes -->
                            </div>
                        </div>
                        
                        <div class="flex justify-end space-x-3 pt-2">
                            <button id="cancelShareBtn" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
                                Cancel
                            </button>
                            <button id="confirmShareBtn" class="gradient-bg text-white px-6 py-2 rounded-lg hover:opacity-90">
                                Share
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Store Detail Modal -->
        <div id="storeDetailModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
            <div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto slide-in">
                <div class="p-6">
                    <div class="flex justify-between items-center mb-4">
                        <h3 id="detailStoreName" class="text-xl font-bold text-gray-800">Store Details</h3>
                        <div class="flex space-x-2">
                            <button id="editStoreBtn" class="text-blue-600 hover:text-blue-800">
                                <i class="fas fa-edit"></i>
                            </button>
                            <button id="deleteStoreBtn" class="text-red-600 hover:text-red-800">
                                <i class="fas fa-trash-alt"></i>
                            </button>
                            <button id="closeDetailModalBtn" class="text-gray-500 hover:text-gray-700">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                    
                    <div class="space-y-4">
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <p class="text-sm font-medium text-gray-500">Address</p>
                                <p id="detailStoreAddress" class="text-gray-800">123 Main St, City, State</p>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-500">Phone</p>
                                <p id="detailStorePhone" class="text-gray-800">(555) 123-4567</p>
                            </div>
                        </div>
                        
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <p class="text-sm font-medium text-gray-500">Store Manager</p>
                                <p id="detailStoreManager" class="text-gray-800">John Smith</p>
                            </div>
                            <div>
                                <p class="text-sm font-medium text-gray-500">Added By</p>
                                <p id="detailAddedBy" class="text-gray-800">user@pepsico.com</p>
                            </div>
                        </div>
                        
                        <div class="border-t border-gray-200 pt-4">
                            <h4 class="text-lg font-medium text-gray-800 mb-3">Delivery Schedule</h4>
                            
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Store Opens At</p>
                                    <p id="detailOpenTime" class="text-gray-800">8:00 AM</p>
                                </div>
                                <div>
                                    <p class="text-sm font-medium text-gray-500">Delivery Window</p>
                                    <p id="detailDeliveryTime" class="text-gray-800">10:00 AM - 2:00 PM</p>
                                </div>
                            </div>
                            
                            <div>
                                <p class="text-sm font-medium text-gray-500">Delivery Days</p>
                                <div id="detailDeliveryDays" class="flex flex-wrap gap-2 mt-1">
                                    <!-- Days will be added here -->
                                </div>
                            </div>
                        </div>
                        
                        <div class="border-t border-gray-200 pt-4">
                            <p class="text-sm font-medium text-gray-500 mb-1">Notes</p>
                            <p id="detailStoreNotes" class="text-gray-800 whitespace-pre-line">Special instructions for this store...</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- Toast Notification -->
        <div id="toast" class="fixed bottom-4 right-4 bg-green-600 text-white px-6 py-3 rounded-lg shadow-lg flex items-center space-x-3 transform translate-y-10 opacity-0 transition-all duration-300 z-50">
            <i class="fas fa-check-circle"></i>
            <span id="toastMessage">Action completed successfully</span>
        </div>
    </div>

    <script>
        // Sample data storage (in a real app, this would be replaced with API calls)
        let stores = [];
        let currentUser = null;
        let editingStoreId = null;

        // DOM Elements
        const loginScreen = document.getElementById('loginScreen');
        const appContainer = document.getElementById('appContainer');
        const loginForm = document.getElementById('loginForm');
        const pepsicoIdInput = document.getElementById('pepsicoId');
        const userInitials = document.getElementById('userInitials');
        const userIdDisplay = document.getElementById('userIdDisplay');
        const storeList = document.getElementById('storeList');
        const emptyState = document.getElementById('emptyState');
        const addStoreBtn = document.getElementById('addStoreBtn');
        const emptyAddStoreBtn = document.getElementById('emptyAddStoreBtn');
        const addStoreModal = document.getElementById('addStoreModal');
        const closeModalBtn = document.getElementById('closeModalBtn');
        const storeForm = document.getElementById('storeForm');
        const cancelStoreBtn = document.getElementById('cancelStoreBtn');
        const shareBtn = document.getElementById('shareBtn');
        const shareModal = document.getElementById('shareModal');
        const closeShareModalBtn = document.getElementById('closeShareModalBtn');
        const cancelShareBtn = document.getElementById('cancelShareBtn');
        const confirmShareBtn = document.getElementById('confirmShareBtn');
        const shareStoreList = document.getElementById('shareStoreList');
        const storeDetailModal = document.getElementById('storeDetailModal');
        const closeDetailModalBtn = document.getElementById('closeDetailModalBtn');
        const editStoreBtn = document.getElementById('editStoreBtn');
        const deleteStoreBtn = document.getElementById('deleteStoreBtn');
        const toast = document.getElementById('toast');

        // Event Listeners
        loginForm.addEventListener('submit', handleLogin);
        addStoreBtn.addEventListener('click', showAddStoreModal);
        emptyAddStoreBtn.addEventListener('click', showAddStoreModal);
        closeModalBtn.addEventListener('click', hideAddStoreModal);
        cancelStoreBtn.addEventListener('click', hideAddStoreModal);
        storeForm.addEventListener('submit', saveStore);
        shareBtn.addEventListener('click', showShareModal);
        closeShareModalBtn.addEventListener('click', hideShareModal);
        cancelShareBtn.addEventListener('click', hideShareModal);
        confirmShareBtn.addEventListener('click', shareStores);
        closeDetailModalBtn.addEventListener('click', hideStoreDetailModal);
        editStoreBtn.addEventListener('click', editStore);
        deleteStoreBtn.addEventListener('click', deleteStore);

        // Initialize the app
        function init() {
            // Check if user is already logged in (in a real app, this would check localStorage or cookies)
            const loggedIn = false;
            if (loggedIn) {
                // Load user data and stores
            } else {
                loginScreen.classList.remove('hidden');
            }
        }

        // Handle login
        function handleLogin(e) {
            e.preventDefault();
            
            const pepsicoId = pepsicoIdInput.value.trim();
            const password = document.getElementById('password').value;
            
            // Basic validation
            if (!pepsicoId || !password) {
                showToast('Please enter both Pepsico ID and password');
                return;
            }
            
            // In a real app, this would be an API call to verify credentials
            // For demo purposes, we'll just accept any non-empty credentials
            currentUser = {
                id: pepsicoId,
                email: `${pepsicoId}@pepsico.com`
            };
            
            // Update UI
            userInitials.textContent = getInitials(currentUser.email);
            userIdDisplay.textContent = currentUser.email;
            
            // Transition to main app
            loginScreen.classList.add('opacity-0');
            setTimeout(() => {
                loginScreen.classList.add('hidden');
                appContainer.classList.remove('hidden');
                loadStores();
            }, 300);
        }

        // Load stores for current user
        function loadStores() {
            // In a real app, this would fetch from an API
            // For demo, we'll use sample data
            stores = [
                {
                    id: '1',
                    name: 'Walmart #1234',
                    address: '123 Main St, Anytown, TX 75001',
                    phone: '(555) 123-4567',
                    manager: 'John Smith',
                    openTime: '08:00',
                    deliveryTime: '10:00',
                    deliveryDays: ['Monday', 'Wednesday', 'Friday'],
                    notes: 'Back door delivery only. Call manager 30 mins before arrival.',
                    addedBy: currentUser.email
                },
                {
                    id: '2',
                    name: 'Target #5678',
                    address: '456 Oak Ave, Somewhere, TX 75002',
                    phone: '(555) 987-6543',
                    manager: 'Sarah Johnson',
                    openTime: '07:30',
                    deliveryTime: '09:00',
                    deliveryDays: ['Tuesday', 'Thursday'],
                    notes: 'Use loading dock on east side.',
                    addedBy: currentUser.email
                }
            ];
            
            renderStores();
        }

        // Render stores in the UI
        function renderStores() {
            if (stores.length === 0) {
                emptyState.classList.remove('hidden');
                storeList.classList.add('hidden');
                return;
            }
            
            emptyState.classList.add('hidden');
            storeList.classList.remove('hidden');
            storeList.innerHTML = '';
            
            stores.forEach(store => {
                const storeCard = document.createElement('div');
                storeCard.className = 'bg-white rounded-xl shadow-md overflow-hidden store-card transition duration-200';
                storeCard.innerHTML = `
                    <div class="p-5">
                        <div class="flex justify-between items-start mb-2">
                            <h3 class="text-lg font-bold text-gray-800 truncate">${store.name}</h3>
                            <span class="text-xs px-2 py-1 rounded-full ${store.addedBy === currentUser.email ? 'bg-blue-100 text-blue-800' : 'bg-gray-100 text-gray-800'}">
                                ${store.addedBy === currentUser.email ? 'My Store' : 'Shared'}
                            </span>
                        </div>
                        <p class="text-sm text-gray-600 mb-1 truncate"><i class="fas fa-map-marker-alt mr-2 text-blue-500"></i>${store.address}</p>
                        <p class="text-sm text-gray-600 mb-3 truncate"><i class="fas fa-phone-alt mr-2 text-blue-500"></i>${store.phone}</p>
                        
                        <div class="flex items-center justify-between text-sm">
                            <div>
                                <p class="text-gray-500">Delivery Days</p>
                                <div class="flex flex-wrap gap-1 mt-1">
                                    ${store.deliveryDays.map(day => 
                                        `<span class="px-2 py-0.5 bg-gray-100 text-gray-800 rounded-full text-xs">${day.substring(0, 3)}</span>`
                                    ).join('')}
                                </div>
                            </div>
                            <button class="text-blue-600 hover:text-blue-800 font-medium" data-store-id="${store.id}">
                                View Details
                            </button>
                        </div>
                    </div>
                `;
                
                storeCard.querySelector('button').addEventListener('click', () => showStoreDetails(store.id));
                storeList.appendChild(storeCard);
            });
        }

        // Show add store modal
        function showAddStoreModal() {
            // Reset form
            storeForm.reset();
            editingStoreId = null;
            
            // Show modal
            addStoreModal.classList.remove('hidden');
            document.body.classList.add('overflow-hidden');
        }

        // Hide add store modal
        function hideAddStoreModal() {
            addStoreModal.classList.add('hidden');
            document.body.classList.remove('overflow-hidden');
        }

        // Save store (add or update)
        function saveStore(e) {
            e.preventDefault();
            
            const formData = new FormData(storeForm);
            const deliveryDays = [];
            document.querySelectorAll('input[name="deliveryDays"]:checked').forEach(checkbox => {
                deliveryDays.push(checkbox.value);
            });
            
            if (deliveryDays.length === 0) {
                showToast('Please select at least one delivery day');
                return;
            }
            
            const storeData = {
                name: formData.get('storeName'),
                address: formData.get('storeAddress'),
                phone: formData.get('storePhone'),
                manager: formData.get('storeManager'),
                openTime: formData.get('openTime'),
                deliveryTime: formData.get('deliveryTime'),
                deliveryDays: deliveryDays,
                notes: formData.get('storeNotes'),
                addedBy: currentUser.email
            };
            
            if (editingStoreId) {
                // Update existing store
                const index = stores.findIndex(s => s.id === editingStoreId);
                if (index !== -1) {
                    stores[index] = { ...stores[index], ...storeData };
                    showToast('Store updated successfully');
                }
            } else {
                // Add new store
                storeData.id = Date.now().toString();
                stores.push(storeData);
                showToast('Store added successfully');
            }
            
            hideAddStoreModal();
            renderStores();
        }

        // Show store details
        function showStoreDetails(storeId) {
            const store = stores.find(s => s.id === storeId);
            if (!store) return;
            
            // Populate details
            document.getElementById('detailStoreName').textContent = store.name;
            document.getElementById('detailStoreAddress').textContent = store.address;
            document.getElementById('detailStorePhone').textContent = store.phone;
            document.getElementById('detailStoreManager').textContent = store.manager;
            document.getElementById('detailAddedBy').textContent = store.addedBy;
            document.getElementById('detailOpenTime').textContent = formatTime(store.openTime);
            document.getElementById('detailDeliveryTime').textContent = formatTime(store.deliveryTime);
            document.getElementById('detailStoreNotes').textContent = store.notes;
            
            // Populate delivery days
            const daysContainer = document.getElementById('detailDeliveryDays');
            daysContainer.innerHTML = '';
            store.deliveryDays.forEach(day => {
                const dayElement = document.createElement('span');
                dayElement.className = 'px-3 py-1 bg-gray-100 text-gray-800 rounded-full text-sm';
                dayElement.textContent = day;
                daysContainer.appendChild(dayElement);
            });
            
            // Store current store ID for edit/delete
            editingStoreId = storeId;
            
            // Show modal
            storeDetailModal.classList.remove('hidden');
            document.body.classList.add('overflow-hidden');
        }

        // Hide store details modal
        function hideStoreDetailModal() {
            storeDetailModal.classList.add('hidden');
            document.body.classList.remove('overflow-hidden');
            editingStoreId = null;
        }

        // Edit store
        function editStore() {
            if (!editingStoreId) return;
            
            const store = stores.find(s => s.id === editingStoreId);
            if (!store) return;
            
            // Populate form with store data
            document.getElementById('storeName').value = store.name;
            document.getElementById('storeAddress').value = store.address;
            document.getElementById('storePhone').value = store.phone;
            document.getElementById('storeManager').value = store.manager;
            document.getElementById('openTime').value = store.openTime;
            document.getElementById('deliveryTime').value = store.deliveryTime;
            document.getElementById('storeNotes').value = store.notes;
            
            // Check the appropriate delivery days
            document.querySelectorAll('input[name="deliveryDays"]').forEach(checkbox => {
                checkbox.checked = store.deliveryDays.includes(checkbox.value);
            });
            
            // Switch to add/edit modal
            hideStoreDetailModal();
            showAddStoreModal();
        }

        // Delete store
        function deleteStore() {
            if (!editingStoreId) return;
            
            if (confirm('Are you sure you want to delete this store?')) {
                stores = stores.filter(s => s.id !== editingStoreId);
                showToast('Store deleted successfully');
                hideStoreDetailModal();
                renderStores();
            }
        }

        // Show share modal
        function showShareModal() {
            if (stores.length === 0) {
                showToast('No stores to share');
                return;
            }
            
            // Populate share store list
            shareStoreList.innerHTML = '';
            stores.forEach(store => {
                if (store.addedBy === currentUser.email) {
                    const div = document.createElement('div');
                    div.className = 'flex items-center space-x-3';
                    div.innerHTML = `
                        <input type="checkbox" id="share-${store.id}" value="${store.id}" class="rounded text-blue-600 focus:ring-blue-500">
                        <label for="share-${store.id}" class="text-sm text-gray-700">${store.name}</label>
                    `;
                    shareStoreList.appendChild(div);
                }
            });
            
            // Show modal
            shareModal.classList.remove('hidden');
            document.body.classList.add('overflow-hidden');
        }

        // Hide share modal
        function hideShareModal() {
            shareModal.classList.add('hidden');
            document.body.classList.remove('overflow-hidden');
        }

        // Share stores with another user
        function shareStores() {
            const shareToId = document.getElementById('sharePepsicoId').value.trim();
            if (!shareToId) {
                showToast('Please enter a Pepsico ID to share with');
                return;
            }
            
            const selectedStores = [];
            document.querySelectorAll('#shareStoreList input[type="checkbox"]:checked').forEach(checkbox => {
                selectedStores.push(checkbox.value);
            });
            
            if (selectedStores.length === 0) {
                showToast('Please select at least one store to share');
                return;
            }
            
            // In a real app, this would send to an API
            showToast(`Shared ${selectedStores.length} store(s) with ${shareToId}`);
            hideShareModal();
        }

        // Show toast notification
        function showToast(message) {
            const toastMessage = document.getElementById('toastMessage');
            toastMessage.textContent = message;
            
            toast.classList.remove('translate-y-10', 'opacity-0');
            toast.classList.add('translate-y-0', 'opacity-100');
            
            setTimeout(() => {
                toast.classList.remove('translate-y-0', 'opacity-100');
                toast.classList.add('translate-y-10', 'opacity-0');
            }, 3000);
        }

        // Helper function to format time
        function formatTime(timeString) {
            if (!timeString) return '';
            
            const [hours, minutes] = timeString.split(':');
            let hour = parseInt(hours, 10);
            const ampm = hour >= 12 ? 'PM' : 'AM';
            hour = hour % 12;
            hour = hour ? hour : 12; // the hour '0' should be '12'
            return `${hour}:${minutes} ${ampm}`;
        }

        // Helper function to get initials from email
        function getInitials(email) {
            if (!email) return 'US';
            
            const parts = email.split('@');
            if (parts.length === 0) return 'US';
            
            const namePart = parts[0];
            if (namePart.length === 0) return 'US';
            
            if (namePart.includes('.')) {
                const nameParts = namePart.split('.');
                return nameParts.map(p => p.charAt(0).toUpperCase()).join('').substring(0, 2);
            } else {
                return namePart.substring(0, 2).toUpperCase();
            }
        }

        // Initialize the app
        init();
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Spriddle/frito-lay-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>