{% extends "base.html" %} {% from "components/ui.html" import page_header %} {% block title %}{{ quote.title }} - {{ app_name }}{% endblock %} {% block content %} {% set breadcrumbs = [ {'text': 'Quotes', 'url': url_for('quotes.list_quotes')}, {'text': quote.quote_number} ] %} {% set actions_html %}
{{ _('Back to Quotes') }} {% if quote.status == 'draft' and (current_user.is_admin or has_permission('edit_quotes')) %} {{ _('Edit Quote') }} {% endif %} {% if current_user.is_admin or has_permission('create_quotes') %} {{ _('Duplicate') }} {% endif %} {{ _('Export PDF') }}
{% endset %} {{ page_header( icon_class='fas fa-file-contract', title_text=quote.title, subtitle_text=quote.quote_number, breadcrumbs=breadcrumbs, actions_html=actions_html ) }}

{{ _('Quote Details') }}

{% if quote.description %}

{{ _('Description') }}

{{ quote.description }}

{% endif %}

{{ _('Status') }}

{% if quote.status == 'draft' %} {{ _('Draft') }} {% elif quote.status == 'sent' %} {{ _('Sent') }} {% elif quote.status == 'accepted' %} {{ _('Accepted') }} {% elif quote.status == 'rejected' %} {{ _('Rejected') }} {% elif quote.status == 'expired' %} {{ _('Expired') }} {% endif %}

{{ _('Client') }}

{{ quote.client.name }}

{% if quote.payment_terms %}

{{ _('Payment Terms') }}

{{ quote.payment_terms }}

{% endif %}
{% if quote.items %}

{{ _('Quote Items') }}

{% for item in quote.items %} {% endfor %} {% if quote.discount_value > 0 %} {% endif %} {% if quote.tax_amount > 0 %} {% endif %}
{{ _('Description') }} {{ _('Quantity') }} {{ _('Unit Price') }} {{ _('Total') }}
{{ item.description }} {{ "%.2f"|format(item.quantity) }} {% if item.unit %}{{ item.unit }}{% endif %} {{ "%.2f"|format(item.unit_price) }} {{ quote.currency_code }} {{ "%.2f"|format(item.total_amount) }} {{ quote.currency_code }}
{{ _('Subtotal') }}: {{ "%.2f"|format(quote.subtotal) }} {{ quote.currency_code }}
{{ _('Discount') }} {% if quote.discount_type == 'percentage' %} ({{ "%.2f"|format(quote.discount_amount) }}%) {% endif %} {% if quote.coupon_code %} - {{ quote.coupon_code }} {% endif %} {% if quote.discount_reason %}
({{ quote.discount_reason }}) {% endif %}
-{{ "%.2f"|format(quote.discount_value) }} {{ quote.currency_code }}
{{ _('Subtotal After Discount') }}: {{ "%.2f"|format(quote.subtotal_after_discount) }} {{ quote.currency_code }}
{{ _('Tax') }} ({{ "%.2f"|format(quote.tax_rate) }}%): {{ "%.2f"|format(quote.tax_amount) }} {{ quote.currency_code }}
{{ _('Total') }}: {{ "%.2f"|format(quote.total_amount) }} {{ quote.currency_code }}
{% endif %} {% if quote.terms %}

{{ _('Terms and Conditions') }}

{{ quote.terms }}

{% endif %}
{% if quote.has_project %}

{{ _('Related Project') }}

{{ _('View Project') }}

{% endif %}

{{ _('Actions') }}

{% if quote.requires_approval %}

{{ _('Approval Status') }}

{% if quote.approval_status == 'none' %}

{{ _('Approval not yet requested') }}

{% if quote.status == 'draft' and (current_user.is_admin or has_permission('edit_quotes')) %}
{% endif %} {% elif quote.approval_status == 'pending' %}

{{ _('Pending approval') }}

{% if current_user.is_admin or has_permission('approve_quotes') %}
{% endif %} {% elif quote.approval_status == 'approved' %}

{{ _('Approved by') }} {{ quote.approver.full_name or quote.approver.username if quote.approver else 'N/A' }} {% if quote.approved_at %} {{ _('on') }} {{ quote.approved_at|user_datetime('%Y-%m-%d %H:%M') }} {% endif %}

{% elif quote.approval_status == 'rejected' %}

{{ _('Rejected by') }} {{ quote.rejecter.full_name or quote.rejecter.username if quote.rejecter else 'N/A' }} {% if quote.rejected_at %} {{ _('on') }} {{ quote.rejected_at|user_datetime('%Y-%m-%d %H:%M') }} {% endif %}

{% if quote.rejection_reason %}

{{ quote.rejection_reason }}

{% endif %} {% if quote.status == 'draft' and (current_user.is_admin or has_permission('edit_quotes')) %}
{% endif %} {% endif %}
{% endif %} {% if quote.status == 'draft' and quote.can_be_sent and (current_user.is_admin or has_permission('edit_quotes')) %}
{% endif %} {% if quote.can_be_accepted and (current_user.is_admin or has_permission('accept_quotes')) %} {{ _('Accept Quote') }} {% endif %} {% if quote.status in ['sent', 'draft'] and (current_user.is_admin or has_permission('edit_quotes')) %}
{% endif %} {% if quote.status in ['draft', 'rejected'] and (current_user.is_admin or has_permission('delete_quotes')) %} {% endif %}

{{ _('Comments') }} {% if comments %} ({{ comments|length }}) {% endif %}

{% if comments %} {% for comment in comments %} {% if not comment.parent_id %}
{{ comment.author.full_name or comment.author.username }} {% if comment.is_internal %} {{ _('Internal') }} {% else %} {{ _('Client Visible') }} {% endif %} {{ comment.created_at|user_datetime('%Y-%m-%d %H:%M') }}
{% if comment.can_edit(current_user) %}
{{ _('Edit') }}
{% endif %}
{{ comment.content }}
{% if comment.replies %}
{% for reply in comment.replies %}
{{ reply.author.full_name or reply.author.username }} {% if reply.is_internal %} {{ _('Internal') }} {% endif %} {{ reply.created_at|user_datetime('%Y-%m-%d %H:%M') }}
{% if reply.can_edit(current_user) %}
{{ _('Edit') }}
{% endif %}
{{ reply.content }}
{% endfor %}
{% endif %}
{% endif %} {% endfor %} {% else %}

{{ _('No comments yet. Start the conversation by adding the first comment.') }}

{% endif %}

{{ _('Information') }}

{{ _('Created') }}
{{ quote.created_at.strftime('%Y-%m-%d %H:%M') if quote.created_at else '' }}
{% if quote.valid_until %}
{{ _('Valid Until') }}
{{ quote.valid_until.strftime('%Y-%m-%d') if quote.valid_until else '' }} {% if quote.valid_until and quote.valid_until < now() %} {{ _('Expired') }} {% endif %}
{% endif %} {% if quote.sent_at %}
{{ _('Sent At') }}
{{ quote.sent_at.strftime('%Y-%m-%d %H:%M') if quote.sent_at else '' }}
{% endif %} {% if quote.accepted_at %}
{{ _('Accepted At') }}
{{ quote.accepted_at.strftime('%Y-%m-%d %H:%M') if quote.accepted_at else '' }}
{% endif %}
{% endblock %}