{% extends "base.html" %} {% block title %}طلب - {{ proto.title }} | {{ factory.name_ar or factory.name }}{% endblock %} {% block content %}
← العودة للوحة المصنع

{{ proto.title }}

{% set status_colors = {'draft': 'bg-gray-100 text-gray-700', 'sent': 'bg-blue-100 text-blue-700', 'quoted': 'bg-yellow-100 text-yellow-700', 'accepted': 'bg-green-100 text-green-700', 'in_production': 'bg-purple-100 text-purple-700', 'delivered': 'bg-emerald-100 text-emerald-700'} %} {% set status_labels = {'draft': 'مسودة', 'sent': 'جديد', 'quoted': 'تم التسعير', 'accepted': 'مقبول', 'in_production': 'قيد التصنيع', 'delivered': 'تم التسليم'} %} {{ status_labels.get(proto.status, proto.status) }}
{% if proto.description %}

الوصف

{{ proto.description }}

{% endif %}
الكمية
{{ proto.quantity }}
الميزانية
{{ proto.budget_range or '-' }}
الموعد النهائي
{{ proto.deadline.strftime('%Y-%m-%d') if proto.deadline else '-' }}
تاريخ الطلب
{{ proto.created_at.strftime('%Y-%m-%d') }}
{% if proto.specifications_json %}

المواصفات التقنية

{% for k, v in proto.specifications_json.items() %}
{{ k }}: {% if v is iterable and v is not string %}{{ v|join('، ') }}{% else %}{{ v }}{% endif %}
{% endfor %}
{% endif %}
{% if proto.nda_html and proto.nda_status in ('pending_factory', 'approved') %}

🔒 اتفاقية عدم الإفشاء (NDA)

{% set nda_colors = {'pending_factory': 'bg-amber-100 text-amber-700', 'approved': 'bg-green-100 text-green-700'} %} {% set nda_labels = {'pending_factory': 'بانتظار موافقتك', 'approved': 'معتمدة ✅'} %} {{ nda_labels.get(proto.nda_status, '') }}
{{ proto.nda_html|safe }}
{% if proto.nda_status == 'pending_factory' %}
{% endif %}
{% endif %} {% if proto.cost_estimate_json %}

💰 تقدير التكلفة

{% set e = proto.cost_estimate_json %}
تكلفة المواد
{{ e.get('bom_cost', '-') }}
تكلفة الوحدة
{{ e.get('unit_cost', '-') }}
التكلفة الإجمالية
{{ e.get('total_cost', '-') }}
المدة المتوقعة
{{ e.get('lead_time', '-') }}
{% endif %} {% if proto.status in ('sent', 'quoted') %}

📝 إرسال عرض سعر

{% endif %}

💬 المحادثة

{% for msg in messages %}

{{ msg.message }}

{{ msg.created_at.strftime('%H:%M %Y-%m-%d') }}
{% endfor %} {% if not messages %}
لا توجد رسائل بعد
{% endif %}

👤 صاحب الطلب

{{ proto.user.name if proto.user else '-' }}
{% if proto.report %}
📊 {{ proto.report.project_name }}
{% endif %}
{% if quotes %}

💰 عروضك السابقة

{% for q in quotes %}
{{ q.total_price }} {{ q.currency }} {% set q_colors = {'pending': 'text-yellow-600', 'accepted': 'text-green-600', 'rejected': 'text-red-600'} %} {{ q.status }}
{{ q.created_at.strftime('%Y-%m-%d') }} | {{ q.lead_time_days }} يوم
{% endfor %}
{% endif %}
{% endblock %}