{% extends "base.html" %} {% block title %}طلب نموذج - {{ proto.title }}{% 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', 'cancelled': 'bg-red-100 text-red-700'} %} {% set status_labels = {'draft': 'مسودة', 'sent': 'مُرسل', 'quoted': 'تم التسعير', 'accepted': 'مقبول', 'in_production': 'قيد التصنيع', 'delivered': 'تم التسليم', 'cancelled': 'ملغي'} %} {{ 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 %}

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

{% set nda_colors = {'draft': 'bg-gray-100 text-gray-700', 'pending_admin': 'bg-blue-100 text-blue-700', 'pending_factory': 'bg-yellow-100 text-yellow-700', 'approved': 'bg-green-100 text-green-700', 'rejected': 'bg-red-100 text-red-700'} %} {% set nda_labels = {'draft': 'مسودة', 'pending_admin': 'بانتظار موافقة المدير', 'pending_factory': 'بانتظار موافقة المصنع', 'approved': 'معتمدة ✅', 'rejected': 'مرفوضة'} %} {{ nda_labels.get(proto.nda_status, proto.nda_status or '-') }}
{{ proto.nda_html|safe }}
{% if proto.nda_approved_at %}

تمت الموافقة بتاريخ: {{ proto.nda_approved_at.strftime('%Y-%m-%d') }}

{% 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', '-') }}
{% if e.get('price_comparison') %}
مقارنة الأسعار: {% for k, v in e.price_comparison.items() %} {{ k }}: {{ v }} {% if not loop.last %}|{% endif %}{% endfor %}
{% endif %}
{% endif %}

💰 عروض الأسعار ({{ quotes|length }})

{% if quotes %}
{% for q in quotes %}
{{ q.factory.name_ar if q.factory else 'مصنع' }} {% if q.status == 'accepted' %} ✓ مقبول {% elif q.status == 'rejected' %} مرفوض {% endif %}
{{ q.total_price }} {{ q.currency }}
{{ q.unit_price }} / وحدة
⏱️ مدة التسليم: {{ q.lead_time_days }} يوم 📅 {{ q.created_at.strftime('%Y-%m-%d') }}
{% if q.notes %}

{{ q.notes }}

{% endif %} {% if q.status == 'pending' and proto.status != 'in_production' %}
{% endif %}
{% endfor %}
{% else %}
💬

لم تصل عروض أسعار بعد

{% endif %}

💬 المحادثة

{% for msg in messages %}

{{ msg.message }}

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

🏭 المصنع

{{ proto.factory.name_ar or proto.factory.name }}
📍 {{ proto.factory.city }}, {{ proto.factory.country }}
{% if proto.factory.email %}
📧 {{ proto.factory.email }}
{% endif %} {% if proto.factory.phone %}
📞 {{ proto.factory.phone }}
{% endif %} {% if proto.factory.website_url %} 🌐 الموقع الإلكتروني {% endif %}
{% endif %} {% if proto.report %}

📊 دراسة الجدوى

{{ proto.report.project_name }}

عرض الدراسة →
{% endif %}

📈 مراحل الطلب

{% set stage_order = ['sent', 'quoted', 'accepted', 'in_production', 'delivered'] %} {% set current_idx = stage_order.index(proto.status) if proto.status in stage_order else -1 %} {% set stages = [('sent', 'تم الإرسال', '📩'), ('quoted', 'تم التسعير', '💰'), ('accepted', 'تم القبول', '✅'), ('in_production', 'قيد التصنيع', '🏭'), ('delivered', 'تم التسليم', '📦')] %}
{% for stage_key, stage_label, stage_icon in stages %} {% set stage_idx = loop.index0 %} {% set is_active = proto.status == stage_key %} {% set is_done = current_idx > stage_idx %}
{{ stage_icon }}
{{ stage_label }}
{% endfor %}
{% endblock %}