{
  "format": "jmeryar-print-template",
  "version": 1,
  "id": "delivery-sticker-ar",
  "doc_type": "delivery_invoice",
  "locale": "ar",
  "name": {
    "en": "Delivery sticker (A5)",
    "ku": "ستیکەری گەیاندن (A5)",
    "ar": "ملصق التوصيل (A5)",
    "fa": "برچسب تحویل (A5)",
    "de": "Lieferetikett (A5)"
  },
  "description": {
    "en": "A5 landscape label for the parcel at the counter: logo and barcode, the invoice number in large type and the customer. Each line shows the branch its stock came from, the preparation note and its delivery status — items the customer took away are shaded, open ones have boxes for the cashier to tick.",
    "ku": "ستیکەرێکی A5ی پانی بۆ سەر پاکەتەکە لە کاشێر: لۆگۆ و بارکۆد، ژمارەی پسوڵە بە پیتی گەورە و کڕیار. هەر دێڕێک ئەو لقە نیشان دەدات کە کاڵاکەی لێ دەرچووە، تێبینی ئامادەکردن و دۆخی گەیاندن — ئەوەی کڕیار خۆی بردوویەتی ڕەنگ کراوە، ئەوانی تر چوارگۆشەیان هەیە بۆ کاشێر.",
    "ar": "ملصق A5 أفقي للطرد عند الكاشير: الشعار والباركود ورقم الفاتورة بخط كبير والعميل. يبيّن كل سطر الفرع الذي خرج منه المخزون وملاحظة التجهيز وحالة التوصيل — تُظلَّل الأصناف التي أخذها العميل، ولغيرها مربعات يؤشّرها الكاشير.",
    "fa": "برچسب A5 افقی برای بسته در صندوق: لوگو و بارکد، شمارهٔ فاکتور با حروف درشت و خریدار. هر ردیف شعبه‌ای که کالا از آن برداشت شده، یادداشت آماده‌سازی و وضعیت تحویل را نشان می‌دهد — کالاهایی که خریدار با خود برده رنگی‌اند و بقیه خانهٔ تیک برای صندوق‌دار دارند.",
    "de": "A5-Etikett im Querformat für das Paket an der Kasse: Logo und Barcode, die Rechnungsnummer groß und der Kunde. Jede Zeile nennt die Filiale, aus deren Lager die Ware kam, den Vorbereitungshinweis und den Lieferstatus — vom Kunden mitgenommene Artikel sind hinterlegt, offene haben Kästchen für die Kasse."
  },
  "content": "{%- comment -%}\n  Delivery STICKER (العربية), A5 landscape. From the jmeryar template library.\n  The label stuck on the parcel at the counter: the business's logo and the invoice\n  number as a barcode, the number itself big enough to read across the room, and who\n  it is for. Every line says where its stock was taken from (Location), the line\n  note and the storekeeper's preparation note, and where its delivery stands — lines\n  the customer took away over the counter are shaded and say so; open lines leave\n  the cashier a choice to tick. Printed for one delivery of an invoice, the lines on\n  other deliveries are struck through.\n  Change the shading in one place: --picked below. Every figure arrives already\n  written the way this install writes numbers and dates; .ltr keeps a figure in one\n  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=\"ar\" dir=\"rtl\">\n<head>\n<meta charset=\"utf-8\">\n<title>ملصق التوصيل {{ sell_invoice.invoice_number_series }}</title>\n<style>\n  :root { --ink:#000; --muted:#475569; --picked:#fdf6c3; --line:#000; }\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: 11px; line-height: 1.4; background: #e2e8f0;\n    -webkit-print-color-adjust: exact; print-color-adjust: exact;\n  }\n  .sheet { width: 210mm; min-height: 148mm; margin: 12px auto; padding: 6mm 7mm; 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: A5 landscape; margin: 0 0 7mm;\n    @bottom-center { content: \"صفحة \" counter(page, {{ page_digits }}) \" / \" counter(pages, {{ page_digits }}); font: 8px Tahoma, \"Segoe UI\", \"Noto Naskh Arabic\", \"Noto Sans Arabic\", Arial, sans-serif; color: #94a3b8; }\n  }\n\n  /* The box across the top: logo and barcode, the number, the buyer. */\n  .head { display: flex; align-items: center; gap: 12px; border: 2.5px solid var(--ink); border-radius: 7px; padding: 8px 14px; }\n  .mark { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }\n  .logo { max-height: 40px; max-width: 110px; object-fit: contain; }\n  .org { font-size: 11px; font-weight: 800; text-align: center; }\n  .bars { display: block; height: 15mm; width: auto; max-width: 52mm; image-rendering: pixelated; }\n  .bars-no { font-size: 10px; letter-spacing: 1.5px; text-align: center; }\n  .no { flex: 1; text-align: center; font-size: 34px; font-weight: 900; line-height: 1.1; }\n  .badge { display: block; margin-top: 2px; font-size: 11px; font-weight: 800; color: #b91c1c; }\n  .who { flex: 0 1 34%; min-width: 0; text-align: end; }\n  .who .name { font-size: 19px; font-weight: 900; line-height: 1.25; }\n  .who .city { font-size: 16px; font-weight: 800; }\n  .who .ph { font-size: 10px; color: var(--muted); }\n\n  .facts { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 3px 22px; font-size: 11.5px; }\n  .facts > div { white-space: nowrap; }\n  .facts .addr { white-space: normal; flex-basis: 100%; }\n  .banner { margin-top: 4px; font-size: 10.5px; font-weight: 700; }\n  .banner .hint { font-weight: 400; color: var(--muted); }\n\n  table.lines { width: 100%; border-collapse: collapse; margin-top: 7px; }\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(--ink); color: #fff; font-size: 11px; font-weight: 700; text-align: center; padding: 5px 4px; border: 1px solid var(--line); border-inline: 1.5px solid #fff; }\n  table.lines td { padding: 5px 4px; border: 1px solid var(--line); text-align: center; vertical-align: middle; }\n  /* What the customer took away at the counter. */\n  tr.picked td { background: var(--picked); }\n  .c-qty { font-weight: 800; }\n  .c-note { text-align: start !important; font-size: 10px; min-width: 24mm; }\n  .ln { white-space: pre-wrap; }\n  .prep { white-space: pre-wrap; }\n  .prep b { font-weight: 800; }\n  .ready { font-size: 9px; font-weight: 700; color: #15803d; }\n  .st { font-size: 10px; font-weight: 700; }\n  .st.ok { color: #15803d; }\n  .st.bad { color: #b91c1c; }\n  .opts { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 9.5px; }\n  .opts span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n  .box { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; border: 1.5px solid var(--ink); border-radius: 2px; }\n  /* A line that is not on this delivery: faded and struck, its reason left unstruck. */\n  tr.off td { color: #94a3b8; }\n  tr.off .strike { text-decoration: line-through; }\n  .why { display: block; font-size: 9px; font-style: italic; color: #b45309; }\n  .why .ltr { white-space: nowrap; }\n\n  .note { margin-top: 6px; font-size: 10.5px; white-space: pre-wrap; break-inside: avoid; }\n  .note b { font-weight: 800; }\n  .stamp { margin-top: 6px; text-align: end; font-size: 8.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=\"head\">\n    <div class=\"mark\">\n      {% if branch.logo and branch.logo != \"\" %}<img class=\"logo\" src=\"{{ branch.logo }}\" alt=\"\">{% else %}<div class=\"org\"><bdi>{{ org_name }}</bdi></div>{% endif %}\n      {% if barcode_data_url and barcode_data_url != \"\" %}\n      <img class=\"bars\" src=\"{{ barcode_data_url }}\" alt=\"\">\n      <div class=\"bars-no ltr\">{{ sell_invoice.invoice_number_series }}</div>\n      {% endif %}\n    </div>\n    <div class=\"no\"><span class=\"ltr\">{{ sell_invoice.invoice_number_series }}</span>\n      {% case sell_invoice.status %}{% when \"draft\" %}<span class=\"badge\">مسودة</span>{% when \"canceled\" %}<span class=\"badge\">ملغاة</span>{% endcase %}</div>\n    <div class=\"who\">\n      <div class=\"name\"><bdi>{{ customer.name | default: sell_invoice.customer.name | default: \"—\" }}</bdi></div>\n      {%- assign city = sell_invoice.city.name | default: sell_invoice.city.name_en -%}\n      {% if city and city != \"\" %}<div class=\"city\"><bdi>{{ city }}</bdi></div>{% endif %}\n      {% if customer.phones.size > 0 %}<div class=\"ph\">{% for p in customer.phones %}{% unless forloop.first %} · {% endunless %}<span class=\"ltr\">{{ p }}</span>{% endfor %}</div>{% endif %}\n    </div>\n  </header>\n\n  <section class=\"facts\">\n    {% if sell_invoice.created_by.name_en and sell_invoice.created_by.name_en != \"\" %}<div>الموظف: <b>{{ sell_invoice.created_by.name_en }}</b></div>{% endif %}\n    {% if sell_invoice.total and sell_invoice.total != \"\" %}<div>السعر الإجمالي: <b class=\"ltr\">{{ sell_invoice.total }}</b>{% if sell_invoice.currency and sell_invoice.currency != \"\" %} {{ sell_invoice.currency }}{% endif %}</div>{% endif %}\n    <div>التاريخ: <span class=\"ltr\">{{ sell_invoice.invoice_date }}</span></div>\n    {% if sell_invoice.delivery_date and sell_invoice.delivery_date != \"\" %}<div>تاريخ التوصيل: <b class=\"ltr\">{{ sell_invoice.delivery_date }}{% if sell_invoice.delivery_time and sell_invoice.delivery_time != \"\" %} {{ sell_invoice.delivery_time }}{% endif %}</b></div>{% endif %}\n    {% if lines_total and lines_total != \"\" %}<div>مُجهَّز: <span class=\"ltr\">{{ lines_prepared }} / {{ lines_total }}</span></div>{% endif %}\n    {% if sell_invoice.delivery_address and sell_invoice.delivery_address != \"\" %}<div class=\"addr\">التوصيل إلى: {{ sell_invoice.delivery_address }}</div>{% endif %}\n  </section>\n\n  {% if delivery %}\n  <div class=\"banner\">هذا التوصيل: <span class=\"ltr\">{{ delivery.when }}</span> — <span class=\"ltr\">{{ delivery.items }} / {{ delivery.items_total }}</span> صنف\n    {% if delivery.partial %}<span class=\"hint\">· الأصناف المشطوبة ليست ضمن هذا التوصيل.</span>{% endif %}\n    {% if delivery.note and delivery.note != \"\" %}<span class=\"hint\">· {{ delivery.note }}</span>{% endif %}</div>\n  {% endif %}\n\n  <table class=\"lines\">\n    <thead>\n      <tr><th>الفئة</th><th>الشركة</th><th>الاسم</th><th>الموديل</th><th>الموقع</th><th>الكمية</th><th>الحالة</th><th>ملاحظات</th></tr>\n    </thead>\n    <tbody>\n      {% for p in si_products %}\n      {%- assign brand = p.brand.name | default: p.brand.name_en -%}\n      {%- assign model = p.model | default: p.proto.name_en -%}\n      {%- comment -%} What the customer already took is shaded, not struck: it is theirs, not elsewhere. {%- endcomment -%}\n      <tr class=\"{% if p.picked_up %}picked{% elsif p.included == false %}off{% endif %}\">\n        <td class=\"strike\"><bdi>{{ p.category.name | default: \"—\" }}</bdi></td>\n        <td class=\"strike\"><bdi>{{ brand | default: \"—\" }}</bdi></td>\n        <td class=\"strike\"><bdi>{{ p.product_name | default: p.product_name_en | default: \"—\" }}</bdi></td>\n        <td class=\"strike\"><bdi>{{ model | default: \"—\" }}</bdi></td>\n        <td><bdi>{{ p.stock_branch.name | default: p.branch.name_en | default: \"—\" }}</bdi>\n          {% if p.prepared %}<div class=\"ready\">✓ مُجهَّز</div>{% endif %}</td>\n        <td class=\"c-qty strike\"><span class=\"ltr\">{{ p.qty }}</span></td>\n        <td>\n          {%- comment -%} Settled lines say so; open ones leave the cashier a choice to tick. {%- endcomment -%}\n          {% case p.delivery_status %}\n            {% when \"done_by_customer\" %}<div class=\"st ok\">استلمه العميل</div>\n            {% when \"done\" %}<div class=\"st ok\">تم التوصيل</div>\n            {% when \"canceled\" %}<div class=\"st bad\">أُلغي التوصيل</div>\n            {% else %}\n              {% if p.delivery_status == \"in_progress\" %}<div class=\"st\">في الطريق</div>{% elsif p.delivery_status == \"planned\" %}<div class=\"st\">سيُوصَّل</div>{% endif %}\n              {% if p.included != false %}<div class=\"opts\"><span><span class=\"box\"></span> توصيل</span><span><span class=\"box\"></span> يأخذه العميل</span></div>{% endif %}\n          {% endcase %}\n          {% if p.included == false and p.picked_up != true %}<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=\"c-note\">\n          {% if p.notes and p.notes != \"\" %}<div class=\"ln\">{{ p.notes }}</div>{% endif %}\n          {% if p.prep_note and p.prep_note != \"\" %}<div class=\"prep\"><b>التجهيز:</b> {{ p.prep_note }}</div>{% endif %}\n        </td>\n      </tr>\n      {% endfor %}\n    </tbody>\n  </table>\n\n  {% if sell_invoice.notes and sell_invoice.notes != \"\" %}<div class=\"note\"><b>ملاحظات:</b> {{ sell_invoice.notes }}</div>{% endif %}\n  <div class=\"stamp\">طُبعت في <span class=\"ltr\">{{ generated_at }}</span></div>\n</div>\n</body>\n</html>\n"
}