47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
"""
|
|
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.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
from PyQt6.QtWidgets import QDialog, QVBoxLayout, QTextEdit, QLabel, QPushButton
|
|
|
|
from app.models import Order
|
|
|
|
|
|
class OrderDetailDialog(QDialog):
|
|
def __init__(self, order: Order, parent=None):
|
|
super().__init__(parent)
|
|
self.setWindowTitle(f"Order Detail - {order.ticket_number or order.external_id}")
|
|
self.resize(700, 600)
|
|
|
|
layout = QVBoxLayout(self)
|
|
|
|
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}",
|
|
]
|
|
summary_label = QLabel("\n".join(summary_lines))
|
|
layout.addWidget(summary_label)
|
|
|
|
layout.addWidget(QLabel("Raw payload from source system:"))
|
|
text = QTextEdit()
|
|
text.setReadOnly(True)
|
|
text.setFontFamily("Courier New")
|
|
text.setPlainText(json.dumps(order.raw_data, indent=2, default=str))
|
|
layout.addWidget(text)
|
|
|
|
close_button = QPushButton("Close")
|
|
close_button.clicked.connect(self.accept)
|
|
layout.addWidget(close_button)
|