{% extends "dashboard/base.html" %}
{% block title %}Optimization - Command Center{% endblock %}
{% block content %}
<div class="page-header flex justify-between items-center">
<div>
<h1 class="page-title">Optimization</h1>
<p class="page-description">Revenue optimization recommendations and results</p>
</div>
<select class="form-input" style="width: auto;" onchange="window.location.href='?company_id=' + this.value">
{% for c in companies %}
<option value="{{ c.id }}" {% if c.id == company_id %}selected{% endif %}>{{ c.name }}</option>
{% endfor %}
</select>
</div>
<!-- Recommendations -->
<div class="card mb-6">
<div class="card-header">
<h2 class="card-title">Recommendations</h2>
<p class="card-description">AI-powered optimization opportunities</p>
</div>
<div class="card-content">
{% if optimizations %}
<table class="table">
<thead>
<tr>
<th>Recommendation</th>
<th>Category</th>
<th>Impact</th>
<th>Priority</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for opt in optimizations %}
<tr>
<td>{{ opt.recommendation }}</td>
<td><span class="badge badge-default">{{ opt.category }}</span></td>
<td>{{ "{:,.0f}".format(opt.estimated_impact) if opt.estimated_impact else "—" }}</td>
<td>
<span class="badge {% if opt.priority == 'high' %}badge-destructive{% elif opt.priority == 'medium' %}badge-warning{% else %}badge-info{% endif %}">
{{ opt.priority }}
</span>
</td>
<td><span class="badge badge-default">{{ opt.status }}</span></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div style="padding: 2rem; text-align: center;">
<p class="text-muted">No optimization recommendations yet</p>
<p class="text-sm text-muted mt-2">Recommendations appear as we analyze your revenue data</p>
</div>
{% endif %}
</div>
</div>
<!-- Results -->
<div class="card">
<div class="card-header">
<h2 class="card-title">Implemented Results</h2>
<p class="card-description">Track impact of implemented optimizations</p>
</div>
<div class="card-content">
{% if results %}
<table class="table">
<thead>
<tr>
<th>Optimization</th>
<th>Date</th>
<th>Impact</th>
</tr>
</thead>
<tbody>
{% for result in results %}
<tr>
<td>{{ result.optimization_name }}</td>
<td>{{ result.implemented_at.strftime('%b %d, %Y') }}</td>
<td>{{ "{:,.0f}".format(result.measured_impact) if result.measured_impact else "—" }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div style="padding: 2rem; text-align: center;">
<p class="text-muted">No implemented optimizations yet</p>
</div>
{% endif %}
</div>
</div>
{% endblock %}