{% extends "scon/base.html" %}

{% block css %}
{{ block.super }}

<style>
<!--
	.parents-0 {
		color: #595959;
	}
	
	.parents-1 {
		color: #00b050;
	}
	
	.parents-2 {
		color: #1f497d;
	}
	
	.parents-3 {
		color: #7030a0;
	}
	
	.parents-4 {
		color: #e46c0a;
	}
	
	.parents-5 {
		color: #ff3399;
	}
-->
</style>

{% endblock css %}

{% block context %}

<h1>Forum</h1>

<table>
<tr>
<th>What ya wanna</th>
<th>What ya needze</th>
</tr>
{% for ore in ores %}
	<tr>
		<td>{{ ore.name }}</td>
		<td>N/A{% if ore.typ == 13 %} (This is a component you cannot craft){% endif %}</td>
	</tr>
{% endfor %}
	{% for item in items %}
	
	{% if item.primary_recipee %}
	<tr>
		{% with item.primary_recipee as recipee %}	
		<td>
			{{ recipee.output.name }}
		</td>
		
		<td>
		<ul>
				{% for ingredient in recipee.ingredients %}
				<li class="parents-{{ ingredient.item.parents|length }}">
				{% if ingredient.item != item %}
					{{ ingredient.amount }} x {{ ingredient.item.name }}
				{% else %}
					{% if ingredient.amount > 1 %}
					<b><i>{{ ingredient.amount }}</i> x {{ ingredient.item.name }}</b>
					{% else %}
					<b>{{ ingredient.amount }} x {{ ingredient.item.name }}</b>
					{% endif %}
				{% endif %}
				</li>
				{% endfor %}
		</ul>
		</td>
		{% endwith %}
	</tr>
	{% else %}
	
	{% endif %}
	
	{% endfor %}
</table>

<code>
 [table]
 [tr][th][b][font=arial, sans-serif][size=12]Crafting Result [/size][/font][/b]
 [b][font=arial, sans-serif][size=12](the components you want)[/size][/font][/b][/th][th][b][font=arial, sans-serif][size=12]Prerequisite Materials [/size][/font][/b]
 [b][font=arial, sans-serif][size=12](what you need to get the result)[/size][/font][/b][/th][/tr]
	{% for ore in ores %}
	[tr]
		[td][color=#595959]{{ ore.name }}[/color][/td]
		[td]N/A{% if ore.typ == 13 %} (This is a component you cannot craft){% endif %}[/td]
	[/tr]
	{% endfor %}
    {% for item in items %}
	{% if item.primary_recipee %}
	[tr]
		{% with item.primary_recipee as recipee %}	
		[td]
		{% with recipee.output.parents|length as depth %}
		[color={% if depth == 0 %}#595959{% elif depth == 1 %}#00b050{% elif depth == 2 %}#1f497d{% else %}#7030a0{% endif %}]{{ recipee.output.name }}[/color]
		{% endwith %}
		[/td]
		
		
		[td]
		[LIST]
		{% for ingredient in recipee.ingredients %}
		[*]{% with ingredient.item.parents|length as depth %}
		[font=arial, sans-serif][size=12]				
		{% if ingredient.item != item %}
			{{ ingredient.amount }} x [color={% if depth == 0 %}#595959{% elif depth == 1 %}#00b050{% elif depth == 2 %}#1f497d{% else %}#7030a0{% endif %}]{{ ingredient.item.name }}[/color]
		{% else %}
			{% if ingredient.amount > 1 %}
			[b][i]{{ ingredient.amount }}[/i] x [color={% if depth == 0 %}#595959{% elif depth == 1 %}#00b050{% elif depth == 2 %}#1f497d{% else %}#7030a0{% endif %}]{{ ingredient.item.name }}[/color][/b]
			{% else %}
			[b]{{ ingredient.amount }} x [color={% if depth == 0 %}#595959{% elif depth == 1 %}#00b050{% elif depth == 2 %}#1f497d{% else %}#7030a0{% endif %}]{{ ingredient.item.name }}[/color][/b]
			{% endif %}
		{% endif %}
		{% endwith %}[/size][/font][/*]
		{% endfor %}
		[/LIST]
		[/td]
		
		{% endwith %}
	[/tr]
	{% endif %}
	{% endfor %}
	[/table]
</code>
{% endblock context %}