diff --git a/performancewest_erpnext/performancewest_erpnext/www/orders.html b/performancewest_erpnext/performancewest_erpnext/www/orders.html index aa39b83..bcfc965 100644 --- a/performancewest_erpnext/performancewest_erpnext/www/orders.html +++ b/performancewest_erpnext/performancewest_erpnext/www/orders.html @@ -164,7 +164,7 @@ {% if order.is_delivered %}
- Order complete — binder delivered + Order complete — documents delivered
{% endif %} diff --git a/performancewest_erpnext/performancewest_erpnext/www/orders.py b/performancewest_erpnext/performancewest_erpnext/www/orders.py index cfe6a4c..5510560 100644 --- a/performancewest_erpnext/performancewest_erpnext/www/orders.py +++ b/performancewest_erpnext/performancewest_erpnext/www/orders.py @@ -58,6 +58,19 @@ CRTC_PIPELINE = [ CRTC_STATE_INDEX = {state: i for i, (state, _) in enumerate(CRTC_PIPELINE)} +# Compliance (FCC) order workflow states +COMPLIANCE_PIPELINE = [ + ("Received", "Order Received"), + ("Processing", "Generating Documents"), + ("Pending eSign", "Awaiting Your Signature"), + ("Review", "Admin Review"), + ("Filing", "Filing with FCC/USAC"), + ("Filed", "Filed — Confirmation Received"), + ("Delivered", "Complete"), +] + +COMPLIANCE_STATE_INDEX = {state: i for i, (state, _) in enumerate(COMPLIANCE_PIPELINE)} + def get_context(context): # Must be logged in as a Customer portal user @@ -132,6 +145,23 @@ def get_context(context): action_label = "Sign CRTC Letter →" else: action_label = None + elif order_type == "compliance": + pipeline = COMPLIANCE_PIPELINE + step_index = COMPLIANCE_STATE_INDEX.get(state, 0) + total_steps = len(COMPLIANCE_PIPELINE) + # Show the service items as the type label + so_items = frappe.get_all( + "Sales Order Item", + filters={"parent": so["name"]}, + fields=["item_name"], + limit=6, + ) + if so_items: + type_label = ", ".join(i.get("item_name", "") for i in so_items if "PROCESSING" not in (i.get("item_name") or "").upper()) + else: + type_label = "FCC Compliance Services" + action_url = None + action_label = None else: pipeline = [] step_index = 0 @@ -179,8 +209,8 @@ def get_context(context): "invoices": invoices, "action_url": action_url, "action_label": action_label, - "is_delivered": state == "Delivered", - "is_cancelled": so.get("status") in ("Cancelled", "Closed"), + "is_delivered": state in ("Delivered", "Filed", "Complete"), + "is_cancelled": so.get("status") == "Cancelled", }) context.orders = orders