{
  "format": "jmeryar-print-template",
  "version": 1,
  "id": "delivery-modern-fa",
  "doc_type": "delivery_invoice",
  "locale": "fa",
  "name": {
    "en": "Modern delivery invoice",
    "ku": "پسوڵەی گەیاندنی مۆدێرن",
    "ar": "فاتورة توصيل عصرية",
    "fa": "فاکتور تحویل مدرن",
    "de": "Lieferschein „Modern“"
  },
  "description": {
    "en": "A4 delivery invoice for the driver: a coloured header, the address and delivery date up front, a tick box on every line and signatures for the customer and the driver. No prices.",
    "ku": "پسوڵەی گەیاندنی A4 بۆ شۆفێر: سەرپەڕەیەکی ڕەنگاوڕەنگ، ناونیشان و بەرواری گەیاندن لە سەرەوە، چوارگۆشەیەکی نیشانەکردن لە هەر دێڕێکدا و واژووی کڕیار و شۆفێر. بێ نرخ.",
    "ar": "فاتورة توصيل بحجم A4 للسائق: ترويسة ملوّنة، العنوان وتاريخ التوصيل في الأعلى، مربع تأشير لكل سطر وتوقيعا العميل والسائق. بدون أسعار.",
    "fa": "فاکتور تحویل A4 برای راننده: سربرگ رنگی، نشانی و تاریخ تحویل در بالا، خانهٔ تیک برای هر ردیف و امضای خریدار و راننده. بدون قیمت.",
    "de": "A4-Lieferschein für den Fahrer: farbiger Kopf, Adresse und Liefertermin ganz oben, ein Kästchen zum Abhaken je Zeile und Unterschriften von Kunde und Fahrer. Ohne Preise."
  },
  "content": "{%- comment -%}\n  Delivery invoice — MODERN (فارسی). From the jmeryar template library.\n  A4 sheet the driver carries: where and when up front, a tick box on every line,\n  signatures for the customer and the driver, and no prices. Change the colour in\n  one place: --accent below. Printed for one delivery of an invoice, the lines on\n  other deliveries are struck through with the reason under them.\n  Every figure arrives already written the way this install writes numbers and\n  dates; .ltr keeps a figure in one piece inside right-to-left text.\n{%- endcomment -%}\n{%- assign org_name = branch.invoice_title | default: branch.company_name | default: branch.name | default: sell_invoice.branch.name_en -%}\n{%- case digits -%}{%- when \"persian\" -%}{%- assign page_digits = \"persian\" -%}{%- when \"arabic\" -%}{%- assign page_digits = \"arabic-indic\" -%}{%- else -%}{%- assign page_digits = \"decimal\" -%}{%- endcase -%}\n<!doctype html>\n<html lang=\"fa\" dir=\"rtl\">\n<head>\n<meta charset=\"utf-8\">\n<title>فاکتور تحویل {{ sell_invoice.invoice_number_series }}</title>\n<style>\n  :root { --accent:#4338ca; --accent-soft:#e0e7ff; --ink:#0f172a; --muted:#64748b; --line:#e2e8f0; --zebra:#f8fafc; }\n  * { box-sizing: border-box; }\n  html, body { margin: 0; padding: 0; }\n  body {\n    font-family: Tahoma, \"Segoe UI\", \"Noto Naskh Arabic\", \"Noto Sans Arabic\", Arial, sans-serif; color: var(--ink); font-size: 11.5px; line-height: 1.55; background: #e2e8f0;\n    -webkit-print-color-adjust: exact; print-color-adjust: exact;\n  }\n  .sheet { width: 210mm; min-height: 297mm; margin: 12px auto; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.15); }\n  .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }\n  @page {\n    size: A4; margin: 0 0 14mm;\n    @bottom-center { content: \"صفحه \" counter(page, {{ page_digits }}) \" / \" counter(pages, {{ page_digits }}); font: 8.5px Tahoma, \"Segoe UI\", \"Noto Naskh Arabic\", \"Noto Sans Arabic\", Arial, sans-serif; color: #94a3b8; }\n  }\n\n  .band { background: var(--accent); color: #fff; padding: 11mm 14mm 8mm; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }\n  .org { display: flex; align-items: center; gap: 14px; min-width: 0; }\n  .logo { max-height: 54px; max-width: 140px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }\n  .org-name { font-size: 20px; font-weight: 800; line-height: 1.2; }\n  .org-meta { font-size: 10px; opacity: .85; margin-top: 3px; }\n  .doc { text-align: end; flex: 0 0 auto; }\n  .doc .kind { font-size: 24px; font-weight: 800; letter-spacing: .4px; line-height: 1; }\n  .doc .no { margin-top: 6px; font-size: 13px; font-weight: 700; opacity: .95; }\n  .badge { display: inline-block; margin-top: 6px; padding: 1px 10px; border-radius: 999px; background: #fff; color: #b91c1c; font-size: 10px; font-weight: 800; }\n\n  .body { padding: 8mm 14mm 14mm; }\n  .cards { display: flex; gap: 12px; margin-bottom: 14px; }\n  .card { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }\n  .card.to { border-color: var(--accent); background: var(--accent-soft); }\n  .label { font-size: 9.5px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }\n  .card .name { font-size: 15px; font-weight: 800; }\n  .card .addr { margin-top: 3px; font-size: 12.5px; font-weight: 600; }\n  .card .line { margin-top: 2px; color: var(--muted); }\n  .when { font-size: 16px; font-weight: 800; margin-bottom: 4px; }\n  .facts { width: 100%; border-collapse: collapse; }\n  .facts td { padding: 1px 0; vertical-align: top; }\n  .facts td.k { color: var(--muted); padding-inline-end: 10px; white-space: nowrap; }\n  .facts td.v { text-align: end; font-weight: 600; }\n\n  .banner { border: 1px dashed var(--accent); border-radius: 8px; padding: 7px 12px; margin-bottom: 12px; }\n  .banner b { color: var(--accent); }\n  .banner .hint, .banner .bn { color: var(--muted); font-size: 10.5px; margin-top: 2px; }\n\n  table.lines { width: 100%; border-collapse: separate; border-spacing: 0; }\n  table.lines thead { display: table-header-group; }\n  table.lines tr { break-inside: avoid; page-break-inside: avoid; }\n  table.lines th { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; text-align: start; padding: 8px 9px; }\n  table.lines th:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }\n  table.lines th:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }\n  table.lines td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }\n  table.lines tbody tr:nth-child(even) td { background: var(--zebra); }\n  table.lines tfoot td { font-weight: 800; padding: 9px; border-top: 2px solid var(--accent); }\n  .num { text-align: center; white-space: nowrap; }\n  .c-no { width: 8mm; color: var(--muted); }\n  .c-qty { width: 18mm; font-size: 13px; font-weight: 800; }\n  .c-chk { width: 14mm; text-align: center; }\n  .box { display: inline-block; width: 15px; height: 15px; border: 1.5px solid var(--ink); border-radius: 3px; vertical-align: middle; }\n  .brand { font-size: 9.5px; font-weight: 700; color: var(--accent); }\n  .pn { font-weight: 600; }\n  .ln { font-size: 10px; color: var(--muted); white-space: pre-wrap; }\n  /* A line that is not on this delivery: faded and struck, its reason left unstruck\n     (an inline-block, which a parent's line-through does not reach). */\n  tr.off td { color: #94a3b8; }\n  tr.off .pn, tr.off .brand, tr.off .c-qty { text-decoration: line-through; color: #94a3b8; }\n  tr.off .box { border-color: #cbd5e1; }\n  .why { display: inline-block; margin-top: 2px; font-size: 10px; font-style: italic; color: #b45309; }\n\n  .closing { break-inside: avoid; page-break-inside: avoid; display: flex; gap: 14px; margin-top: 16px; align-items: stretch; }\n  .aside { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }\n  .note { border-inline-start: 3px solid var(--accent); background: var(--zebra); border-radius: 6px; padding: 8px 12px; white-space: pre-wrap; }\n  .cond { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }\n  .cond .opts { display: flex; gap: 22px; margin-top: 2px; }\n  .cond .opts span { display: inline-flex; align-items: center; gap: 6px; }\n  .qr { flex: 0 0 auto; width: 40mm; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }\n  .qr img { width: 30mm; height: 30mm; image-rendering: pixelated; display: block; margin: 0 auto; }\n  .qr .cap { font-size: 9px; color: var(--muted); margin-top: 4px; }\n\n  .statement { margin-top: 18px; padding: 9px 12px; background: var(--accent-soft); border-radius: 8px; font-weight: 600; break-inside: avoid; }\n  .signs { display: flex; gap: 28px; margin-top: 40px; break-inside: avoid; }\n  .signs .s { flex: 1; text-align: center; border-top: 1px dashed #94a3b8; padding-top: 5px; color: var(--muted); font-size: 10.5px; }\n  .stamp { margin-top: 18px; text-align: center; font-size: 9.5px; color: #94a3b8; }\n\n  @media print {\n    body { background: #fff; }\n    .sheet { margin: 0; width: auto; min-height: 0; box-shadow: none; }\n  }\n</style>\n</head>\n<body>\n<div class=\"sheet\">\n  <header class=\"band\">\n    <div class=\"org\">\n      {% if branch.logo and branch.logo != \"\" %}<img class=\"logo\" src=\"{{ branch.logo }}\" alt=\"\">{% endif %}\n      <div>\n        <div class=\"org-name\"><bdi>{{ org_name }}</bdi></div>\n        <div class=\"org-meta\">\n          {% if branch.address and branch.address != \"\" %}{{ branch.address }}{% endif %}\n          {% if branch.phone1 and branch.phone1 != \"\" %} · <span class=\"ltr\">{{ branch.phone1 }}</span>{% endif %}\n          {% if branch.phone2 and branch.phone2 != \"\" %} · <span class=\"ltr\">{{ branch.phone2 }}</span>{% endif %}\n        </div>\n      </div>\n    </div>\n    <div class=\"doc\">\n      <div class=\"kind\">فاکتور تحویل</div>\n      <div class=\"no\"><span class=\"ltr\">{{ sell_invoice.invoice_number_series }}</span></div>\n      {% case sell_invoice.status %}{% when \"draft\" %}<span class=\"badge\">پیش‌نویس</span>{% when \"canceled\" %}<span class=\"badge\">باطل‌شده</span>{% endcase %}\n    </div>\n  </header>\n\n  <div class=\"body\">\n    <section class=\"cards\">\n      <div class=\"card to\">\n        <div class=\"label\">تحویل به</div>\n        <div class=\"name\"><bdi>{{ customer.name | default: sell_invoice.customer.name | default: \"—\" }}</bdi></div>\n        {% if customer.phones.size > 0 %}\n        <div class=\"line\">{% for p in customer.phones %}{% unless forloop.first %} · {% endunless %}<span class=\"ltr\">{{ p }}</span>{% endfor %}</div>\n        {% elsif sell_invoice.customer.contacts.size > 0 %}\n        <div class=\"line\">{% for c in sell_invoice.customer.contacts %}{% unless forloop.first %} · {% endunless %}<span class=\"ltr\">{{ c.phone_display | default: c.phone_number }}</span>{% endfor %}</div>\n        {% endif %}\n        {% if sell_invoice.delivery_address and sell_invoice.delivery_address != \"\" %}<div class=\"addr\">{{ sell_invoice.delivery_address }}</div>{% endif %}\n      </div>\n      <div class=\"card\">\n        <div class=\"label\">تاریخ تحویل</div>\n        <div class=\"when\"><span class=\"ltr\">{{ sell_invoice.delivery_date | default: \"—\" }}{% if sell_invoice.delivery_time and sell_invoice.delivery_time != \"\" %} {{ sell_invoice.delivery_time }}{% endif %}</span></div>\n        <table class=\"facts\">\n          <tr><td class=\"k\">شمارهٔ فاکتور</td><td class=\"v\"><span class=\"ltr\">{{ sell_invoice.invoice_number_series }}</span></td></tr>\n          <tr><td class=\"k\">تاریخ</td><td class=\"v\"><span class=\"ltr\">{{ sell_invoice.invoice_date }}</span></td></tr>\n          {% if sell_invoice.branch.name_en and sell_invoice.branch.name_en != \"\" %}<tr><td class=\"k\">شعبه</td><td class=\"v\">{{ sell_invoice.branch.name_en }}</td></tr>{% endif %}\n          {% if sell_invoice.created_by.name_en and sell_invoice.created_by.name_en != \"\" %}<tr><td class=\"k\">حسابدار</td><td class=\"v\">{{ sell_invoice.created_by.name_en }}</td></tr>{% endif %}\n        </table>\n      </div>\n    </section>\n\n    {% if delivery %}\n    <div class=\"banner\">\n      <b>این تحویل:</b> <span class=\"ltr\">{{ delivery.when }}</span> — <span class=\"ltr\">{{ delivery.items }} / {{ delivery.items_total }}</span> قلم\n      {% if delivery.partial %}<div class=\"hint\">اقلام خط‌خورده جزو این تحویل نیستند.</div>{% endif %}\n      {% if delivery.note and delivery.note != \"\" %}<div class=\"bn\">{{ delivery.note }}</div>{% endif %}\n    </div>\n    {% endif %}\n\n    <table class=\"lines\">\n      <thead>\n        <tr><th class=\"c-no\">#</th><th>شرح کالا</th><th class=\"num\">تعداد</th><th class=\"c-chk\">✓</th></tr>\n      </thead>\n      <tbody>\n        {% for p in si_products %}\n        <tr{% if p.included == false %} class=\"off\"{% endif %}>\n          <td class=\"c-no\"><span class=\"ltr\">{{ p.no }}</span></td>\n          <td>\n            {%- assign brand = p.brand.name | default: p.brand.name_en -%}\n            {% if brand and brand != \"\" %}<div class=\"brand\"><bdi>{{ brand }}</bdi></div>{% endif %}\n            <div class=\"pn\"><bdi>{{ p.product_name | default: p.product_name_en | default: \"—\" }}</bdi></div>\n            {% if p.notes and p.notes != \"\" %}<div class=\"ln\">{{ p.notes }}</div>{% endif %}\n            {% if p.included == false %}<span class=\"why\">در این تحویل نیست —\n              {% case p.delivery_state %}{% when \"delivered\" %}قبلاً تحویل شده{% when \"earlier\" %}در تحویل قبلی{% when \"later\" %}در تحویل بعدی{% when \"same_day\" %}در تحویل دیگری در همان روز{% else %}هنوز زمان‌بندی نشده{% endcase %}{% if p.delivery_when and p.delivery_when != \"\" %} (<span class=\"ltr\">{{ p.delivery_when }}</span>){% endif %}</span>{% endif %}\n          </td>\n          <td class=\"num c-qty\"><span class=\"ltr\">{{ p.qty }}</span></td>\n          <td class=\"c-chk\"><span class=\"box\"></span></td>\n        </tr>\n        {% endfor %}\n      </tbody>\n      <tfoot>\n        <tr><td></td><td>جمع تعداد</td><td class=\"num\"><span class=\"ltr\">{{ total_qty }}</span></td><td></td></tr>\n      </tfoot>\n    </table>\n\n    <div class=\"closing\">\n      <div class=\"aside\">\n        {% if sell_invoice.notes and sell_invoice.notes != \"\" %}<div class=\"note\"><div class=\"label\">توضیحات</div>{{ sell_invoice.notes }}</div>{% endif %}\n        <div class=\"cond\">\n          <div class=\"label\">وضعیت کالا هنگام تحویل</div>\n          <div class=\"opts\"><span><span class=\"box\"></span> سالم</span><span><span class=\"box\"></span> آسیب‌دیده</span></div>\n        </div>\n      </div>\n      {% if qr_data_url and qr_data_url != \"\" %}\n      <div class=\"qr\">\n        <img src=\"{{ qr_data_url }}\" alt=\"\">\n        <div class=\"cap\">{% if qr_is_link %}برای دیدن فاکتور خود اسکن کنید{% else %}<span class=\"ltr\">{{ sell_invoice.invoice_number_series }}</span>{% endif %}</div>\n      </div>\n      {% endif %}\n    </div>\n\n    <div class=\"statement\">{% if delivery and delivery.partial %}اقلام بالا را، به‌جز موارد خط‌خورده، به‌طور کامل و سالم تحویل گرفتم.{% else %}اقلام بالا را به‌طور کامل و سالم تحویل گرفتم.{% endif %}</div>\n    <section class=\"signs\">\n      <div class=\"s\">نام تحویل‌گیرنده</div>\n      <div class=\"s\">امضای خریدار</div>\n      <div class=\"s\">امضای راننده</div>\n    </section>\n    <div class=\"stamp\">چاپ در <span class=\"ltr\">{{ generated_at }}</span></div>\n  </div>\n</div>\n</body>\n</html>\n"
}