{% macro render_quotation_details(quotation, show_actions=true) %}
<div class="quotation-details">
    <div class="detail-card">
        <h3>Basic Information</h3>
        <div class="detail-grid">
            <div class="detail-item">
                <label>ID</label>
                <span>{{ quotation.id }}</span>
            </div>
            <div class="detail-item">
                <label>User</label>
                <span>{{ quotation.user.username }}</span>
            </div>
            <div class="detail-item">
                <label>Created</label>
                <span>{{ quotation.created_at.strftime('%Y-%m-%d %H:%M') }}</span>
            </div>
            <div class="detail-item">
                <label>Status</label>
                <span class="badge badge-success">Completed</span>
            </div>
        </div>
    </div>
    
    <div class="detail-card">
        <h3>Project Details</h3>
        <div class="detail-grid">
            <div class="detail-item">
                <label>Model Name</label>
                <span>{{ quotation.model_name }}</span>
            </div>
            <div class="detail-item">
                <label>Tooling ID</label>
                <span>{{ quotation.tooling_id }}</span>
            </div>
            <div class="detail-item">
                <label>Season</label>
                <span>{{ quotation.season }}</span>
            </div>
            <div class="detail-item">
                <label>Stage</label>
                <span>{{ quotation.stage }}</span>
            </div>
            <div class="detail-item">
                <label>Country</label>
                <span>{{ quotation.country }}</span>
            </div>
            <div class="detail-item">
                <label>Issue Date</label>
                <span>{{ quotation.issue_date.strftime('%Y-%m-%d') }}</span>
            </div>
        </div>
    </div>
    
    <div class="detail-card">
        <h3>Mold Specifications</h3>
        <div class="detail-grid">
            <div class="detail-item">
                <label>Mold Main Type</label>
                <span>{{ quotation.mold_main_type }}</span>
            </div>
            <div class="detail-item">
                <label>Mold Sub Type</label>
                <span>{{ quotation.mold_sub_type }}</span>
            </div>
            <div class="detail-item">
                <label>High Sidewall Complexity</label>
                <span>{{ 'Yes' if quotation.complexity_high_sidewall else 'No' }}</span>
            </div>
            <div class="detail-item">
                <label>Number of Sliders</label>
                <span>{{ quotation.sliders_count }}</span>
            </div>
            <div class="detail-item">
                <label>Number of Cavities</label>
                <span>{{ quotation.cavity_count }}</span>
            </div>
            <div class="detail-item">
                <label>Digital Texture Type</label>
                <span>{{ quotation.digital_texture_type }}</span>
            </div>
        </div>
    </div>
    
    <div class="detail-card">
        <h3>Cost Breakdown</h3>
        <div class="cost-breakdown">
            <div class="cost-item">
                <label>Net Base Price</label>
                <span>${{ "%.2f"|format(quotation.net_base_price) }}</span>
            </div>
            <div class="cost-item">
                <label>Tax Rate</label>
                <span>{{ "%.1f"|format(quotation.tax_rate * 100) }}%</span>
            </div>
            <div class="cost-item total">
                <label>Total Cost</label>
                <span>${{ "%.2f"|format(quotation.total_cost) }}</span>
            </div>
        </div>
    </div>
    
    <div class="detail-card">
        <h3>Factory Information</h3>
        <div class="detail-grid">
            <div class="detail-item">
                <label>Mold Shop Name</label>
                <span>{{ quotation.mold_shop_name }}</span>
            </div>
            <div class="detail-item">
                <label>T1 Factory Name</label>
                <span>{{ quotation.t1_factory_name or 'N/A' }}</span>
            </div>
            <div class="detail-item">
                <label>T2 Component Factory</label>
                <span>{{ quotation.t2_component_factory or 'N/A' }}</span>
            </div>
        </div>
    </div>

    {% if show_actions %}
    <div class="detail-actions">
        <a href="{{ url_for('admin.quotations') }}" class="btn btn-secondary">
            <i class="fas fa-arrow-left"></i> Back to Quotations
        </a>
        <button class="btn btn-primary" onclick="window.print()">
            <i class="fas fa-print"></i> Print Quotation
        </button>
    </div>
    {% endif %}
</div>

<style>
.quotation-details {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.detail-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-card h3 {
    margin: 0 0 20px;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item label {
    color: #6c757d;
    font-size: 0.9rem;
}

.detail-item span {
    font-size: 1.1rem;
    color: #2c3e50;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.cost-item:last-child {
    border-bottom: none;
}

.cost-item label {
    color: #6c757d;
    font-size: 1rem;
}

.cost-item span {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 500;
}

.cost-item.total {
    margin-top: 10px;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
}

.cost-item.total label {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.cost-item.total span {
    font-size: 1.4rem;
    font-weight: 700;
    color: #28a745;
}

.detail-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: #28a745;
    color: white;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media print {
    .detail-actions {
        display: none;
    }
    
    .detail-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
</style>
{% endmacro %} 