-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
752 lines (701 loc) · 37.8 KB
/
index.html
File metadata and controls
752 lines (701 loc) · 37.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BrandyWise Search</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&display=swap">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
<link rel="icon" type="image/png" href="/EasySearchTests/static/favicon.png">
<link rel="stylesheet" href="/EasySearchTests/static/styles.css">
</head>
<body>
<h1 class="app-title text-center my-3 glowing-text">BrandyWise</h1>
<button id="userDisplayName" class="btn btn-outline-secondary position-absolute top-0 end-0 m-3"></button>
<!-- Logout Button (moved outside appContainer) -->
<button id="signOutButton" class="btn btn-outline-secondary position-absolute top-0 start-0 m-3">
<i class="fas fa-sign-out-alt"></i> Sign Out
</button>
<!-- Login Container -->
<div id="loginContainer">
<div class="card shadow" style="max-width: 400px; width: 100%; margin-top: 30px;">
<div class="card-body text-center p-5">
<h2 class="mb-4">Welcome!</h2>
<p class="text-muted mb-4">Sign in with your BrandyWine Microsoft account</p>
<button id="signInButton" class="btn btn-primary">
<i class="fab fa-microsoft me-2"></i>Sign in with Microsoft
</button>
</div>
</div>
</div>
<!-- App Container -->
<div id="appContainer" class="container py-4 position-relative" style="display:none; margin-top: 30px;">
<!-- Tabs for Search and Customer Info -->
<ul class="nav nav-tabs align-items-end" id="mainTabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="search-tab" data-bs-toggle="tab" data-bs-target="#searchView" type="button" role="tab" aria-controls="searchView" aria-selected="true">Search</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="customer-info-tab" data-bs-toggle="tab" data-bs-target="#customerInfoView" type="button" role="tab" aria-controls="customerInfoView" aria-selected="false">Customer Info</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="order-sample-tab" data-bs-toggle="tab" data-bs-target="#orderSampleView" type="button" role="tab" aria-controls="orderSampleView" aria-selected="false">Recent Activity</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="crm-tab" data-bs-toggle="tab" data-bs-target="#crmView" type="button" role="tab">
Leads
<span id="crmActionBadge" class="badge rounded-pill bg-danger ms-1 d-none" style="font-size: 0.6em; vertical-align: middle;">!</span>
</button>
</li>
<!-- Reports Buttons -->
<li class="nav-item ms-auto d-flex align-items-end pe-2 gap-2" role="presentation">
<button id="strategicBuyBtn" title="Strategic Forward Buy" class="generate-reports-btn" style="color: #5f6368">
<i class="fas fa-cart-flatbed"></i>
</button>
<button id="generateReportsBtn" title="Open Reports Dashboard" class="generate-reports-btn">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368">
<path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h360v80H200v560h560v-360h80v360q0 33-23.5 56.5T760-120H200Zm80-160h80v-280h-80v280Zm160 0h80v-400h-80v400Zm160 0h80v-160h-80v160Zm80-320v-80h-80v-80h80v-80h80v80h80v80h-80ZM480-480Z"/>
</svg>
<div id="reportNotificationBadge" class="report-badge"></div>
</button>
</li>
</ul>
<div class="card bg-white p-3 rounded shadow">
<!-- Tab Content -->
<div class="tab-content" id="mainTabsContent">
<!-- Search View Tab Pane -->
<div class="tab-pane fade show active" id="searchView" role="tabpanel" aria-labelledby="search-tab">
<!-- Main Structural Row -->
<div class="row">
<!-- ====== Left Column: Customer & Order History ====== -->
<div class="col-md-4">
<!-- Customer Title -->
<div class="d-flex align-items-center gap-2">
<h4 class="m-0">Customer</h4>
<a id="salesFileLink" class="file-link d-none" target="_blank" title="Open latest Sales workbook">
<i class="fa-solid fa-link"></i>
</a>
</div>
<!-- Customer Dropdown -->
<div class="dropdown position-relative my-3">
<input type="text" id="customerSearch" class="form-control" placeholder="Search Customer..." autocomplete="off">
<ul id="customerDropdown" class="dropdown-menu w-100"></ul>
</div>
<!-- Order History Subtitle -->
<h5 class="mt-3">Order History</h5>
<!-- Order History Table -->
<div class="table-responsive" style="max-height: 500px;">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Date</th>
<th>Product</th>
<th>Description</th>
<th>Qty</th>
<th>Price</th>
</tr>
</thead>
<tbody id="orderHistoryTable">
<tr>
<td colspan="5" class="text-muted fst-italic">
search for a customer to display order history
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- ====== Right Column: Product, Pricing, Calculator ====== -->
<div class="col-md-8">
<!-- Nested Row for Titles -->
<div class="row">
<!-- Product Title & Search -->
<div class="col-md-7">
<div class="d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center gap-2">
<h4 class="m-0">Product</h4>
<a id="dbFileLink" class="file-link d-none" target="_blank" title="Open latest Inventory workbook">
<i class="fa-solid fa-link"></i>
</a>
</div>
<div class="form-check form-switch m-0">
<label class="form-check-label" for="filterOrdersToggle">Filter Orders</label>
<input class="form-check-input" type="checkbox" id="filterOrdersToggle">
</div>
</div>
<div class="dropdown position-relative my-3">
<input type="text" id="productSearch" class="form-control" placeholder="Search Product...">
<ul id="productDropdown" class="dropdown-menu w-100"></ul>
</div>
</div>
<!-- Pricing Title & Toggle -->
<div class="col-md-5">
<div class="d-flex align-items-center gap-2">
<h4 class="m-0">Pricing</h4>
<a id="pricingFileLink" class="file-link d-none" target="_blank" title="Open latest Pricing workbook">
<i class="fa-solid fa-link"></i>
</a>
</div>
<div class="toggle-container my-3">
<input type="checkbox" class="toggle-checkbox" id="pricingToggle">
<label for="pricingToggle" class="toggle-label">
<div class="toggle-switch"></div>
<span class="b2b">B2C</span>
<span class="b2c">B2B</span>
</label>
<a id="competitorPriceLink" class="price-check-link ms-3" style="display: none; margin-left: auto !important;">
View competitor pricing
<i class="bi bi-bar-chart-line-fill ms-1"></i>
</a>
</div>
</div>
</div>
<!-- Nested Row for Tables -->
<div class="row">
<!-- Matching Products Table -->
<div class="col-md-7">
<h5 class="d-flex align-items-center gap-2">
Matching Products
<div id="genericContainer" class="position-relative" style="display: none; margin-left: auto;">
<i id="genericBulb" class="fas fa-lightbulb text-warning" style="cursor: pointer;"></i>
<div id="genericSlideText" class="generic-slide-text fst-italic">Generic: XYZ123</div>
</div>
</h5>
<div class="table-responsive" style="max-height: 300px;">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Product</th>
<th>Description</th>
<th>QtyAvailable</th>
<th>
UnitCost
<i class="fas fa-info-circle text-muted ms-1"
style="font-size: 0.8rem; cursor: help;"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Based on latest purchase history (falls back to static DB cost).">
</i>
</th>
<th>Units/Box</th>
</tr>
</thead>
<tbody id="productTable">
<tr>
<td colspan="5" class="text-muted fst-italic">
search for a product
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Prices Table -->
<div class="col-md-5">
<h5>Prices</h5>
<div class="table-responsive" style="max-height: 300px;">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>FB Price</th>
<th>HB Price</th>
<th>LTB Price</th>
</tr>
</thead>
<tbody id="priceTable">
<tr>
<td colspan="3" class="text-muted fst-italic">
select a product
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Nested Row for Quote Calculator -->
<div class="row mt-4">
<div class="col-12">
<div class="accordion" id="quoteAccordion">
<div class="accordion-item">
<h2 class="accordion-header" id="quoteAccordionHeader">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#quoteCalculatorCollapse" aria-expanded="false" aria-controls="quoteCalculatorCollapse">
<strong>Quote & Profit Calculator</strong>
</button>
</h2>
<div id="quoteCalculatorCollapse" class="accordion-collapse collapse" aria-labelledby="quoteAccordionHeader">
<div class="accordion-body">
<div class="table-responsive">
<table class="table table-bordered" id="quoteCalculatorTable">
<thead class="table-light">
<tr>
<th style="width: 15%;">Product</th>
<th style="width: 10%;">Quantity</th>
<th style="width: 10%;">Unit Cost</th>
<th style="width: 10%;">Price</th>
<th style="width: 15%;">Order Total</th>
<th style="width: 10%;">Profit Margin</th>
<th style="width: 15%;">Total Profit</th>
</tr>
</thead>
<tbody id="quoteCalculatorBody">
<!-- Row 1 (Main) -->
<tr>
<td data-col="product"></td>
<td data-col="quantity" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="unitcost" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="price" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="ordertotal" class="fw-bold"></td>
<td data-col="margin" class="fw-bold text-primary" contenteditable="true" oninput="quoteCalculator.updateFromMargin(this.parentElement)"></td>
<td data-col="totalprofit" class="fw-bold"></td>
</tr>
<!-- Row 2 (Placeholder) -->
<tr class="placeholder-row">
<td data-col="product"></td>
<td data-col="quantity" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="unitcost" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="price" contenteditable="true" oninput="quoteCalculator.updateRow(this.parentElement)"></td>
<td data-col="ordertotal" class="fw-bold"></td>
<td data-col="margin" class="fw-bold text-primary" contenteditable="true" oninput="quoteCalculator.updateFromMargin(this.parentElement)"></td>
<td data-col="totalprofit" class="fw-bold"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Customer Info View Tab Pane -->
<div class="tab-pane fade" id="customerInfoView" role="tabpanel" aria-labelledby="customer-info-tab">
<div class="row">
<!-- Column 1: Customer Search and Order History -->
<div class="col-md-4">
<h4 class="mb-3">Customer</h4>
<a id="salesFileLinkCustomerInfo" class="file-link d-none" target="_blank"
title="Open latest Sales workbook">
<i class="fa-solid fa-link"></i>
</a>
<div class="dropdown position-relative mb-3">
<input type="text" id="customerInfoSearch" class="form-control" placeholder="Search Customer..." autocomplete="off">
<ul id="customerInfoDropdown" class="dropdown-menu w-100"></ul>
</div>
<div id="customerOrderHistoryContainer" class="customer-info-content-hidden mt-3"> <!-- Added mt-3 here -->
<h5>Order History</h5>
<div class="table-responsive" style="max-height: 300px;">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Date</th>
<th>Product</th>
<th>Description</th>
<th>Qty</th>
<th>Price</th>
</tr>
</thead>
<tbody id="customerInfoOrderHistoryTable">
<tr>
<td colspan="5" class="text-muted fst-italic">
select a customer to display order history
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Column 2: Customer Details -->
<div class="col-md-5">
<h4 class="mb-3">Customer Details</h4>
<div id="customerFieldsContainer" class="customer-info-content-hidden mt-3"> <!-- Added mt-3 here -->
<div class="customer-info-field d-flex flex-column">
<strong>Sales by Year:</strong>
<canvas id="salesByYearChart" style="width:100%;max-width:320px;aspect-ratio:2/1"></canvas>
</div>
<div class="customer-info-field"><strong>Location:</strong> <span id="customerLocation">N/A</span></div>
<div class="customer-info-field"><strong>Business:</strong> <span id="customerBusiness">N/A</span></div>
<div class="customer-info-field"><strong>Type:</strong> <span id="customerType">N/A</span></div>
<div class="customer-info-field"><strong>Remarks:</strong> <span id="customerRemarks">N/A</span></div>
<div class="customer-info-field"><strong>Website:</strong> <span id="customerWebsite">N/A</span></div>
<!-- AI Confirmation Box -->
<div id="aiConfirmationBox"></div>
</div>
</div>
<!-- Column 3: Contact Cards -->
<div class="col-md-3">
<h4 class="mb-3">Contacts</h4>
<div id="contactCardsContainer" class="customer-info-content-hidden mt-3"> <!-- Added mt-3 here -->
<p class="text-muted fst-italic">No contacts available</p>
</div>
</div>
</div>
</div>
<!-- Orders & Samples View Tab Pane -->
<div class="tab-pane fade" id="orderSampleView" role="tabpanel" aria-labelledby="order-sample-tab">
<div class="os-filter-bar">
<div class="row g-2 align-items-end"> <div class="col-auto">
<label class="os-filter-label">Type</label>
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="osType" id="osTypeAll" value="all" checked>
<label class="btn btn-outline-secondary btn-sm" for="osTypeAll">All</label>
<input type="radio" class="btn-check" name="osType" id="osTypeOrder" value="Order">
<label class="btn btn-outline-secondary btn-sm" for="osTypeOrder">Orders</label>
<input type="radio" class="btn-check" name="osType" id="osTypeSample" value="Sample">
<label class="btn btn-outline-secondary btn-sm" for="osTypeSample">Samples</label>
</div>
</div>
<div class="col-md-2">
<label class="os-filter-label">Order ID</label>
<div class="input-group input-group-sm">
<span class="input-group-text bg-light border-end-0"><i class="fas fa-hashtag text-muted"></i></span>
<input type="text" class="form-control border-start-0 ps-0" id="osSearchId" placeholder="ID...">
</div>
</div>
<div class="col-md-2">
<label class="os-filter-label">Customer</label>
<div class="input-group input-group-sm">
<span class="input-group-text bg-light border-end-0"><i class="fas fa-user text-muted"></i></span>
<input type="text" class="form-control border-start-0 ps-0" id="osSearchCustomer" placeholder="Name...">
</div>
</div>
<div class="col-auto">
<label class="os-filter-label">Date Range</label>
<div class="input-group input-group-sm" style="max-width: 240px;">
<input type="date" class="form-control" id="osDateStart">
<span class="input-group-text bg-light text-muted border-start-0 border-end-0 px-1">-</span>
<input type="date" class="form-control" id="osDateEnd">
</div>
</div>
<div class="col-auto ms-auto d-flex gap-2 os-order-only-field">
<div>
<label class="os-filter-label">Price ($)</label>
<div class="input-group input-group-sm">
<input type="number" class="form-control" id="osPriceMin" placeholder="Min" style="width: 55px;">
<span class="input-group-text bg-light text-muted border-start-0 border-end-0 px-1">-</span>
<input type="number" class="form-control" id="osPriceMax" placeholder="Max" style="width: 55px;">
</div>
</div>
<div>
<label class="os-filter-label">PO #</label>
<input type="text" class="form-control form-control-sm" id="osSearchPO" placeholder="PO..." style="width: 100px;">
</div>
</div>
</div>
</div>
<div class="os-table-container">
<div class="table-responsive" style="height: 65vh; overflow-y: auto;">
<table class="table os-table mb-0" id="osTable">
<thead class="sticky-top">
<tr>
<th width="100">Type</th>
<th>Order ID</th>
<th>Customer</th>
<th>Date</th>
<th>PO Number</th>
<th class="text-end">Total Amount</th>
<th width="50"></th>
</tr>
</thead>
<tbody id="osTableBody">
</tbody>
</table>
</div>
</div>
</div>
<!-- CRM (Leads) View -->
<div class="tab-pane fade" id="crmView" role="tabpanel">
<div class="row g-0" style="height: calc(100vh - 160px); min-height: 600px;">
<div class="col-md-3 border-end bg-white d-flex flex-column h-100">
<div class="p-3 border-bottom bg-light">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0 fw-bold">My Leads</h5>
<button id="crmAddLeadBtn" class="btn btn-sm btn-primary rounded-circle shadow-sm" style="width: 32px; height: 32px;" title="Add New Lead">
<i class="fas fa-plus"></i>
</button>
</div>
<!-- Search -->
<div class="input-group input-group-sm mb-3 shadow-sm">
<span class="input-group-text bg-white border-end-0"><i class="fas fa-search text-muted"></i></span>
<input type="text" id="crmSearch" class="form-control border-start-0 ps-0" placeholder="Filter leads...">
</div>
<!-- Sort Buttons -->
<div class="d-flex gap-2 mb-1 align-items-center">
<div class="d-flex gap-2 flex-grow-1">
<button id="crmSortRecent" class="btn btn-sm btn-outline-primary flex-grow-1 active">
<i class="fas fa-clock me-1"></i> Recent
</button>
<button id="crmSortValue" class="btn btn-sm btn-outline-success flex-grow-1">
<i class="fas fa-dollar-sign me-1"></i> Value
</button>
</div>
<div class="form-check form-switch m-0 ms-1" title="Show open leads only">
<input class="form-check-input" type="checkbox" id="crmFilterActiveToggle" checked style="cursor: pointer;">
<label class="form-check-label text-muted fw-bold" for="crmFilterActiveToggle" style="font-size: 0.7rem; cursor: pointer;">OPEN</label>
</div>
</div>
</div>
<div id="crmLeadList" class="flex-grow-1 overflow-auto p-2 bg-light bg-opacity-50"></div>
</div>
<!-- CRM Header, Timeline and Summary -->
<div class="col-md-9 bg-light h-100 d-flex flex-column position-relative">
<div id="crmDetailHeader" class="p-3 bg-white border-bottom shadow-sm d-flex justify-content-between align-items-center" style="display:none !important;">
<div style="flex: .90;">
<h4 class="mb-0" id="crmDetailTitle">Select a Lead</h4>
<div class="small text-muted" id="crmDetailCompany"></div>
</div>
<div class="d-flex gap-2 align-items-center">
</div>
</div>
<div class="d-flex flex-grow-1 overflow-hidden">
<div id="crmTimeline" class="flex-grow-1 overflow-auto p-4" style="background: #f8f9fa;">
<div class="d-flex flex-column align-items-center justify-content-center h-100 text-muted opacity-50">
<i class="fas fa-hand-pointer fa-3x mb-3"></i>
<h5>Select a lead</h5>
</div>
</div>
<div id="crmLeadSummary" class="border-start bg-white overflow-auto p-3 shadow-sm flex-shrink-0" style="width: 280px; display: none;">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Reports modal -->
<div class="modal fade" id="reportsModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-centered"> <div class="modal-content" style="background-color: #f4f6f8;"> <div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold text-dark"><i class="fas fa-chart-line text-primary me-2"></i>Reports Dashboard</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="container-fluid px-0">
<div id="reportsDashboardGrid" class="row g-4">
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Product Info Modal -->
<div class="modal fade" id="productInfoModal" tabindex="-1" aria-labelledby="productInfoModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-centered">
<div class="modal-content">
<div class="modal-header modal-header-details">
<div>
<h5 class="modal-title part-number" id="productInfoModalLabel">Product Details</h5>
<div id="productInfoModalDescription" class="description"></div>
</div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="productInfoModalBody">
<div class="row">
<!-- Column 1: Inventory & Key Metrics -->
<div class="col-lg-5 col-md-6">
<!-- Inventory Details -->
<dl class="row modal-dl" id="productInfoModalInventoryList">
<!-- This content will be generated by uiRenderer.js -->
</dl>
<!-- Key Metrics -->
<div class="row g-2">
<div class="col-6">
<div class="metric-card">
<h6>
Months of Supply
<i class="fas fa-info-circle text-muted ms-1"
style="font-size: 0.8rem; cursor: help;"
data-bs-toggle="tooltip"
data-bs-html="true"
data-bs-placement="top"
title="<b>Calculation:</b> Current Inventory ÷ Monthly Sales Average<br>
<i>(Monthly Sales Average = Total Sales Last 12 Months ÷ 12)</i>">
</i>
</h6>
<div class="metric-value" id="productMonthsOfSupply">
<div class="spinner-border spinner-border-sm text-primary" role="status"></div>
</div>
</div>
</div>
</div>
<!-- History Card (Purchases / Sales) -->
<div class="metric-card mt-3">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="mb-0">History</h6>
<!-- Sliding Toggle -->
<div class="toggle-container" style="height: 24px;">
<input type="checkbox" class="toggle-checkbox" id="historyToggle">
<label for="historyToggle" class="toggle-label history-toggle-label">
<div class="toggle-switch"></div>
<span class="b2b">Purchases</span>
<span class="b2c">Sales</span>
</label>
</div>
</div>
<div class="table-responsive" style="height: 210px !important; font-size: 0.85rem; overflow-y: auto;">
<table class="table table-sm table-hover mb-0" style="border-collapse: separate; border-spacing: 0;">
<thead class="table-light sticky-top">
<tr>
<th style="width: 30%;">Date</th>
<th id="histColEntity" style="width: 45%;">Vendor</th>
<th class="text-end" style="width: 25%;">Price</th>
</tr>
</thead>
<tbody id="productHistoryTableBody">
<!-- Content generated by JS -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Column 2: Sales BI -->
<div class="col-lg-7 col-md-6">
<div class="row g-2">
<div class="col-6">
<div class="metric-card">
<h6>
Sales (Last 12 Mo)
<i class="fas fa-info-circle text-muted ms-1"
style="font-size: 0.8rem; cursor: help;"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Total units sold in the past 365 days. The percentage shows the growth or decline compared to the previous year.">
</i>
</h6>
<div class="metric-value" id="productYoYSales">
<div class="spinner-border spinner-border-sm text-primary" role="status"></div>
</div>
</div>
</div>
<div class="col-6">
<div class="metric-card">
<h6>
Avg. Order Qty
<i class="fas fa-info-circle text-muted ms-1"
style="font-size: 0.8rem; cursor: help;"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="The average number of units purchased in a single order (Total Units Sold / Total Number of Orders) across all history.">
</i>
</h6>
<div class="metric-value" id="productAvgOrderQty">
<div class="spinner-border spinner-border-sm text-primary" role="status"></div>
</div>
</div>
</div>
</div>
<div class="metric-card">
<h6>Sales History (Last 24 Months)</h6>
<div style="position: relative; width: 100%; padding-top: 50%;">
<canvas id="productSalesChart" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></canvas>
</div>
</div>
<!-- Top Customers -->
<div class="metric-card">
<h6>Top 5 Customers (Last 12 Mo)</h6>
<ul class="top-customer-list" id="productTopCustomersList">
<!-- This content will be generated by uiRenderer.js -->
</ul>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Warning Modal -->
<div class="modal fade show" id="pricingWarningModal" tabindex="-1" style="display: none;" aria-modal="true" role="dialog">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content" style="background-color: #fffbe6; border: 2px solid #ffe58f;">
<div class="modal-header">
<h5 class="modal-title text-warning fw-bold">Notice About Pricing Data</h5>
</div>
<div class="modal-body fs-5 text-dark">
While pricing lists are being reorganized some pricing data may be incorrect or temporarily unavailable.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-warning" data-bs-dismiss="modal">ok</button>
</div>
</div>
</div>
</div>
<!-- Competitor Pricing Modal -->
<div class="modal fade" id="competitorPriceModal" tabindex="-1" aria-labelledby="competitorPriceModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content shadow-lg">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title" id="competitorPriceModalLabel">Competitor Pricing</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body p-4" id="competitorPriceModalBody">
</div>
<div class="modal-footer border-0 bg-light">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- CRM New Lead Modal -->
<div class="modal fade" id="crmNewLeadModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content border-0 shadow-lg" style="border-radius: 12px; overflow: hidden;">
<div class="modal-body p-0" id="crmNewLeadModalBody">
<!-- The form will be rendered here by JS -->
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
<script src="/EasySearchTests/static/msal/msal-browser.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xlsx/dist/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js"></script>
<script src="auth.js"></script>
<script src="utils/contactUtils.js"></script>
<script src="utils/idbUtil.js"></script>
<script src="utils/reportUtils.js"></script>
<script src="utils/spUtils.js"></script>
<script src="utils/mailUtils.js"></script>
<script src="dataLoader.js"></script>
<script src="/EasySearchTests/reports/revenueDropReport.js"></script>
<script src="/EasySearchTests/reports/lapsedCustomersReport.js"></script>
<script src="/EasySearchTests/reports/productRevenueDropReport.js"></script>
<script src="/EasySearchTests/reports/productLapsedReport.js"></script>
<script src="/EasySearchTests/reports/productStuckInventoryReport.js"></script>
<script src="/EasySearchTests/reports/profitReport.js"></script>
<script src="/EasySearchTests/reports/topCustomersRevenueReport.js"></script>
<script src="/EasySearchTests/reports/bmReplacementReport.js"></script>
<script src="/EasySearchTests/reports/potentialLeadsReport.js"></script>
<script src="/EasySearchTests/reports/strategicBuyAnalysis.js"></script>
<script src="reports.js"></script>
<script src="providers/provider.js"></script>
<script src="providers/gluegunProvider.js"></script>
<script src="providers/perigreeProvider.js"></script>
<script src="providers/ellsworthProvider.js"></script>
<script src="providers/chemicalConceptsProvider.js"></script>
<script src="uiRenderer.js"></script>
<script src="recentActivity.js"></script>
<script src="/EasySearchTests/leads/crmService.js"></script>
<script src="/EasySearchTests/leads/crmView.js"></script>
<script src="/EasySearchTests/leads/crmNewLead.js"></script>
<script src="app.js"></script>
<script>document.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(el => {
new bootstrap.Tooltip(el);
});
</script>
</body>
</html>