ShipStation tracking pull, status tracking, dashboard rework
This commit is contained in:
+22
-23
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
Dashboard tab: at-a-glance counts of what's come in.
|
||||
|
||||
Kept intentionally simple for now (stat cards, no charts) per the
|
||||
"just a dashboard for now" scope. The stats themselves come from
|
||||
Kept intentionally simple (stat cards, no charts) per the "just a
|
||||
dashboard for now" scope. The stats themselves come from
|
||||
app.workers.get_dashboard_stats(), so adding a new stat later is a
|
||||
matter of adding a key there and a card here - this widget doesn't
|
||||
know anything about how orders are fetched or stored.
|
||||
@@ -59,31 +59,32 @@ class DashboardWidget(QWidget):
|
||||
heading.setFont(heading_font)
|
||||
outer.addWidget(heading)
|
||||
|
||||
# Top row: overall + per-source totals
|
||||
# Top row: overall pipeline health
|
||||
top_row = QHBoxLayout()
|
||||
self.total_card = StatCard("Total Orders")
|
||||
self.jira_card = StatCard("From JIRA")
|
||||
self.shipstation_card = StatCard("From ShipStation")
|
||||
for card in (self.total_card, self.jira_card, self.shipstation_card):
|
||||
self.fulfilled_card = StatCard("Fulfilled")
|
||||
self.fulfilled_card.setStyleSheet("QLabel { color: #1a7a1a; }")
|
||||
self.cancelled_card = StatCard("Cancelled")
|
||||
self.cancelled_card.setStyleSheet("QLabel { color: #b00020; }")
|
||||
self.carryover_card = StatCard("Carryover (still open from an earlier day)")
|
||||
self.carryover_card.setStyleSheet("QLabel { color: #b06a00; }")
|
||||
for card in (self.total_card, self.fulfilled_card, self.cancelled_card, self.carryover_card):
|
||||
top_row.addWidget(card)
|
||||
outer.addLayout(top_row)
|
||||
|
||||
# Second row: per-company totals (grid so adding a 3rd company later just works)
|
||||
# Second row: tracking pull progress, since that's the 5PM task
|
||||
outer.addWidget(self._section_label("Tracking Numbers"))
|
||||
tracking_row = QHBoxLayout()
|
||||
self.tracking_received_card = StatCard("Tickets With Tracking Pulled")
|
||||
tracking_row.addWidget(self.tracking_received_card)
|
||||
outer.addLayout(tracking_row)
|
||||
|
||||
# Third row: per-company totals (grid so adding a 3rd company later just works)
|
||||
outer.addWidget(self._section_label("By Company"))
|
||||
self.company_grid = QGridLayout()
|
||||
self.company_cards: dict[str, StatCard] = {}
|
||||
outer.addLayout(self.company_grid)
|
||||
|
||||
# Third row: cross-source matching, since JIRA and ShipStation are pulled independently
|
||||
outer.addWidget(self._section_label("JIRA <-> ShipStation Matching (by ticket #)"))
|
||||
match_row = QHBoxLayout()
|
||||
self.matched_card = StatCard("Matched in Both")
|
||||
self.jira_only_card = StatCard("JIRA Only (not yet in ShipStation)")
|
||||
self.shipstation_only_card = StatCard("ShipStation Only (no matching ticket)")
|
||||
for card in (self.matched_card, self.jira_only_card, self.shipstation_only_card):
|
||||
match_row.addWidget(card)
|
||||
outer.addLayout(match_row)
|
||||
|
||||
outer.addStretch()
|
||||
|
||||
@staticmethod
|
||||
@@ -96,12 +97,10 @@ class DashboardWidget(QWidget):
|
||||
|
||||
def update_stats(self, stats: dict) -> None:
|
||||
self.total_card.set_value(stats.get("total", 0))
|
||||
self.jira_card.set_value(stats.get("by_source", {}).get("jira", 0))
|
||||
self.shipstation_card.set_value(stats.get("by_source", {}).get("shipstation", 0))
|
||||
|
||||
self.matched_card.set_value(stats.get("matched_count", 0))
|
||||
self.jira_only_card.set_value(stats.get("jira_only_count", 0))
|
||||
self.shipstation_only_card.set_value(stats.get("shipstation_only_count", 0))
|
||||
self.fulfilled_card.set_value(stats.get("fulfilled_count", 0))
|
||||
self.cancelled_card.set_value(stats.get("cancelled_count", 0))
|
||||
self.carryover_card.set_value(stats.get("carryover_count", 0))
|
||||
self.tracking_received_card.set_value(stats.get("tracking_received_count", 0))
|
||||
|
||||
by_company = stats.get("by_company", {})
|
||||
# Rebuild company cards if the set of companies changed (e.g. a 3rd company added)
|
||||
|
||||
Reference in New Issue
Block a user