ShipStation tracking pull, status tracking, dashboard rework
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
"""
|
||||
Order detail dialog.
|
||||
|
||||
Mainly a debugging aid: shows exactly what the source system (JIRA or
|
||||
ShipStation) sent back for this order, so field-shape mismatches - like
|
||||
the "Hardware Needed" single-select vs. "Deliverables" multi-select
|
||||
issue - are easy to spot by just double-clicking a row instead of
|
||||
reading logs or re-running a script.
|
||||
Mainly a debugging aid: shows exactly what JIRA sent back for this
|
||||
ticket (raw payload), plus the tracking numbers ShipStation supplied
|
||||
and the JIRA status they suggest - handy for the end-of-day close-out
|
||||
without having to piece it together by hand.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -14,6 +13,14 @@ import json
|
||||
from PyQt6.QtWidgets import QDialog, QVBoxLayout, QTextEdit, QLabel, QPushButton
|
||||
|
||||
from app.models import Order
|
||||
from app.tracking import suggest_jira_status
|
||||
|
||||
|
||||
def _format_tracking_line(t: dict) -> str:
|
||||
kind = "RETURN" if t.get("is_return") else "outgoing"
|
||||
carrier = t.get("carrier")
|
||||
carrier_suffix = f" ({carrier})" if carrier else ""
|
||||
return f" {t.get('number')} - {kind}{carrier_suffix}"
|
||||
|
||||
|
||||
class OrderDetailDialog(QDialog):
|
||||
@@ -24,13 +31,23 @@ class OrderDetailDialog(QDialog):
|
||||
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
tracking = order.tracking_numbers or []
|
||||
tracking_lines = [_format_tracking_line(t) for t in tracking]
|
||||
suggested = suggest_jira_status(tracking)
|
||||
|
||||
summary_lines = [
|
||||
f"Source: {order.source}",
|
||||
f"Ticket #: {order.ticket_number or '(none found)'}",
|
||||
f"Company: {order.company}",
|
||||
f"SKUs: {', '.join(order.skus or []) or '(none extracted)'}",
|
||||
f"Status: {order.status}",
|
||||
"",
|
||||
"Tracking numbers:",
|
||||
]
|
||||
summary_lines.extend(tracking_lines or [" (none pulled yet)"])
|
||||
if suggested:
|
||||
summary_lines.append("")
|
||||
summary_lines.append(f"Suggested JIRA status: {suggested}")
|
||||
|
||||
summary_label = QLabel("\n".join(summary_lines))
|
||||
layout.addWidget(summary_label)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user