From eb186cac3c847f685cfb996fde945d3756814dcb Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Wed, 27 May 2026 12:50:06 -0400 Subject: [PATCH] feat(fusion_repairs): Bundle 11 - CS guided troubleshooting flowcharts + vendor PO Two big workflow additions: 1. Visual drag-and-drop flowchart designer (Drawflow) + card-by-card runner (with show-whole-tree toggle) so admins build per-(category, symptom) decision trees with embedded photos/videos and CS walks callers through them on the phone. Resolved-on-call closes the repair; escalated copies the full transcript into internal_notes so the dispatched tech sees what was already tried before they arrive at the client. 2. Vendor + draft-PO + factory-tracking on the part-order capture. Tech on the phone with the factory picks the vendor from contacts, types the OEM part #, cost, ETA date (calendar widget), factory ticket #, RA #, ticks under_warranty, and the system auto-creates a draft purchase.order with the right product (looked up or created from OEM) + activity for the office on the ETA day + client email with ETA prominently shown and cost intentionally omitted. NEW MODELS fusion.repair.symptom.class - lookup table (category + name + code). Replaces the flat x_fc_issue_category Char on repair.order. Seeded with 7 stairlift symptoms + lighter coverage for hospital bed / porch lift / lift chair. Equipment Class added to fusion.repair.product.category (this carried over from the Bundle 10 plan). fusion.repair.flowchart + .node + .edge - design-time graph. - flowchart has name, category, symptom, version, published flag, canvas_layout (Drawflow JSON), node_ids, edge_ids, computed start_node - node has node_type (question / suggestion / info / outcome), content_html, media_ids (M2M ir.attachment for photos + videos), is_start, outcome_kind (resolved / escalate / order_part), canvas_x/y for Drawflow round-trip - edge has source, target, label, sequence - supports N-ary branching (not just Yes/No) - designer_load() and designer_save(payload) RPC API the OWL component consumes; save is atomic-replace + bumps version + soft-validates fusion.repair.flowchart.run + .step - runtime sessions. - One run per repair, audited; runtime_start_or_resume() returns the existing in-progress run or creates a fresh one for the matching chart - runtime_choose(edge_id, cs_note) records a step + advances current_node - runtime_complete(outcome) snapshots final node + calls _apply_outcome: resolved -> auto-close via action_repair_start + action_repair_end, set x_fc_resolved_on_call, post transcript to chatter escalated -> prepend transcript to repair.internal_notes so the tech sees it first when they open the form order_part -> chatter note; tech opens visit-report wizard next abandoned -> just save transcript - Each step snapshots node_name + chosen_label at write time so the transcript survives later chart edits without breaking. REPAIR.ORDER EXTENSIONS - x_fc_symptom_class_id (M2O) - new structured symptom field - x_fc_resolved_on_call (Boolean, tracked) - true after a resolved outcome - x_fc_flowchart_run_ids + x_fc_flowchart_run_count - action_start_troubleshoot() - opens the runner client action, raises a helpful UserError if no symptom set or no published chart exists - action_view_flowchart_runs() smart button - x_fc_issue_category renamed string to "(legacy)" - kept for back-compat + AI prompt context; new intakes set the M2O DRAWFLOW DESIGNER (OWL) static/src/lib/drawflow/drawflow.min.{js,css} - vendored Drawflow 0.0.59 (MIT). Loaded only in web.assets_backend, ~48KB total. components/flowchart_designer/flowchart_designer.{js,xml,scss}: - Client action "fusion_repair_flowchart_designer" with full drag-drop canvas + zoom + pan - 4 custom node templates color-banded by type (question blue, suggestion green, info gray, outcome red/green/amber per outcome_kind) - Right-panel editor for selected node: title, type, outcome kind, content (HTML), media uploader (drag-drop or click), set-as-start toggle, per-outgoing-edge label editor - Save serializes Drawflow JSON to canvas_layout + atomic-replaces the structured node/edge rows via the designer_save RPC CARD RUNNER (OWL) components/flowchart_runner/flowchart_runner.{js,xml,scss}: - Client action "fusion_repair_flowchart_runner" - DEFAULT MODE: card-by-card. One big card per node, embedded photos + inline