{% if scenario_mapping %}
{% set has_hier = false %}
{% for s in scenario_mapping %}{% if s.scenario or s.sub_scenario or s.scenario_item %}{% set has_hier = true %}{% endif %}{% endfor %}
{% if has_hier %}
{% set groups = namespace(dict={}) %}
{% for s in scenario_mapping %}
{% set sc = s.scenario or 'Uncategorized' %}
{% set su = s.sub_scenario or '—' %}
{% set si = s.scenario_item or '—' %}
{% if sc not in groups.dict %}{% set _ = groups.dict.update({sc: {}}) %}{% endif %}
{% if su not in groups.dict[sc] %}{% set _ = groups.dict[sc].update({su: {}}) %}{% endif %}
{% if si not in groups.dict[sc][su] %}{% set _ = groups.dict[sc][su].update({si: []}) %}{% endif %}
{% set _ = groups.dict[sc][su][si].append(s) %}
{% endfor %}
{% for sc in groups.dict|sort %}
{{ sc }}
{% for su in groups.dict[sc]|sort %}
{{ su }}
Source
Service Provider
Scenario Item
Type
Provider
Pricing
Weeks
Team
Phase
{% for si in groups.dict[sc][su]|sort %}
{% for s in groups.dict[sc][su][si] %}
{{ s.categorization }}
{{ s.service_provider }}
{{ si }}
{{ s.scenario_type }}
{{ s.provider }}
{{ s.pricing_strategy }}
{{ s.effort_weeks }}
{{ s.team_size }}
{{ s.phase }}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% else %}
Req ID
Capability
Provider
Scenario_Type
Complexity
Weeks
Team
Phase
{% for s in scenario_mapping %}
{{ s.requirement_id }}
{{ s.capability }}
{{ s.provider }}
{{ s.scenario_type }}
{{ s.complexity }}
{{ s.effort_weeks }}
{{ s.team_size }}
{{ s.phase }}
{% endfor %}
{% endif %}
{% else %}
No scenario mappings recorded.
{% endif %}
6. Cost Estimation
{% if cost_estimation %}
{% for c in cost_estimation %}
{% set phase = c.phase or '' %}
{% set bd = {} %}
{% if c.breakdown_json %}{% set bd = c.breakdown_json|json_loads %}{% endif %}
{{ phase }}
Team
Total Weeks
Total Mandays
Cost (RMB)
Cost (USD)
{{ c.team_size }}
{{ c.total_weeks }}
{{ c.total_mandays }}
¥{{ c.cost_rmb }}
${{ c.cost_usd }}
Scenario_Type
Weeks
Mandays
Cost (RMB)
Cost (USD)
{% for cls_name in bd|sort %}
{% set cd = bd[cls_name] %}
{{ cls_name }}
{{ cd.weeks }}
{{ cd.mandays }}
¥{{ cd.cost_rmb }}
${{ cd.cost_usd }}
{% endfor %}
{% endfor %}
{% else %}
No cost data. Run 'fscope cost estimate' first.
{% endif %}
7. Delivery Timeline
{% if delivery_timeline %}
{% set phases = namespace(dict={}) %}
{% for t in delivery_timeline %}
{% set p = t.phase or 'Unknown' %}
{% if p not in phases.dict %}{% set _ = phases.dict.update({p: []}) %}{% endif %}
{% set _ = phases.dict[p].append(t) %}
{% endfor %}
{% set tasks_json = [] %}
{% for phase_name in phases.dict %}
{% for t in phases.dict[phase_name] %}
{% set sub = t.sub_phase or '' %}
{% set start = t.start_date or '' %}
{% set end = t.end_date or '' %}
{% set dur = t.duration_weeks|float if t.duration_weeks else 0 %}
{% set sub_lower = sub|lower %}
{% if 'publish' in sub_lower or 'release' in sub_lower %}
{% set css = 'gantt-crit' %}
{% elif 'development' in sub_lower %}
{% set css = 'gantt-active' %}
{% else %}
{% set css = 'gantt-standard' %}
{% endif %}
{% set name = phase_name ~ ' - ' ~ sub if sub else phase_name %}
{% set task = '{id:"' ~ t.id ~ '",name:"' ~ name ~ '",start:"' ~ start ~ '",end:"' ~ end ~ '",progress:0,custom_class:"' ~ css ~ '",dependencies:""}' %}
{% set _ = tasks_json.append(task) %}
{% endfor %}
{% endfor %}
Phase
Sub-Phase
Start
End
Weeks
Deliverables
{% for phase_name in phases.dict %}
{% for t in phases.dict[phase_name] %}
{{ t.phase }}
{{ t.sub_phase }}
{{ t.start_date }}
{{ t.end_date }}
{{ t.duration_weeks }}
{{ t.deliverables }}
{% endfor %}
{% endfor %}
{% else %}
No timeline data. Run 'fscope timeline plan' first.