=== فاکتورک (Faktorak) ===
Contributors: sajjadshadloo
Tags: invoice, shipping-label, woocommerce, proforma, thermal-print
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

افزونه فاکتور، برچسب پستی و رسید حرارتی برای ووکامرس با پیش‌فاکتور، فاکتور دستی و خروجی CSV/Excel.
Printable WooCommerce invoices, shipping labels and thermal receipts with proforma invoices, manual invoicing and CSV/Excel exports.

== توضیحات (Description) ==
فاکتورک امکان چاپ فاکتور، برچسب پستی و رسید حرارتی ووکامرس را فراهم می‌کند و شامل پیش‌فاکتور اختیاری، ثبت موقعیت مکانی در نقشه هنگام تسویه‌حساب، فاکتور دستی، و خروجی CSV/Excel سفارشات و کاربران در پیشخوان وردپرس است.

Faktorak adds printable WooCommerce invoices, shipping labels, thermal receipts, optional proforma invoices, optional checkout map location capture, a manual invoice workflow, and orders/users CSV & Excel export inside wp-admin.

== امکانات (Features) ==
* چاپ فاکتور و برچسب پستی مناسب چاپگر؛ اندازه‌ی کاغذ نهایی در پنجره‌ی چاپ مرورگر/چاپگر انتخاب می‌شود.
* چاپ رسید حرارتی (۸۰mm/۵۸mm) به‌صورت تکی و گروهی.
* دو قالب فاکتور (مدرن و کلاسیک).
* پیش‌فاکتور اختیاری (وضعیت سفارش سفارشی + تبدیل به سفارش قابل پرداخت توسط مدیر).
* نقشه‌ی اختیاری در صفحه‌ی تسویه‌حساب برای ثبت موقعیت تحویل سفارش.
* فرم ساخت فاکتور دستی در پیشخوان (فاکتور رسمی یا پیش‌فاکتور از محصولات انتخابی).
* صفحه‌ی «لیست فاکتورها» با جستجو، فیلتر، حذف و کپی سریع لینک مشتری/پرداخت.
* جستجوی AJAX محصول و مشتری با تکمیل خودکار اطلاعات مشتری در فرم فاکتور دستی.
* ستون اقدامات سریع (فاکتور + برچسب پستی + رسید حرارتی) در لیست سفارشات، در هر دو حالت قدیمی و HPOS.
* خروجی CSV/Excel سفارشات به‌همراه خروجی PDF گروهی فاکتور.
* خروجی CSV/Excel کاربران با فیلتر نقش و تاریخ ثبت‌نام.
* شورت‌کدها:
  * `[faktorak_invoice_button]`
  * `[faktorak_proforma_button]`
* رندر محلی کد QR (بدون سرویس خارجی).
* محافظت لینک فاکتور/برچسب پستی بر اساس سطح دسترسی و توکن امنیتی.
* دکمه‌ی پرداخت در نمای فاکتور برای فاکتورهای دستی/پیش‌فاکتورهای پرداخت‌نشده.
* تبدیل خودکار نوع سند از پیش‌فاکتور به فاکتور رسمی پس از پرداخت.
* امکان درج تصویر امضای فروشنده در قالب‌های فاکتور.
* رابط کاربری یکپارچه و فونت استعداد (فونت فارسی آزاد/OFL) در تمام صفحات افزونه.

== نصب (Installation) ==
۱. پوشه‌ی افزونه را در مسیر `wp-content/plugins/` قرار دهید.
۲. افزونه را فعال کنید.
۳. برای تنظیم فاکتور به منوی «فاکتورک» در پیشخوان بروید.

== نحوه‌ی استفاده (Usage) ==
* مدیر: سفارش را باز کرده و از متاباکس برای چاپ فاکتور، برچسب پستی یا رسید حرارتی استفاده کنید.
* مدیر: از مسیر «فاکتورک > فاکتور دستی» فاکتور/پیش‌فاکتور دستی بسازید و از «لیست فاکتورها» مدیریت کنید.
* مدیر: از اقدامات گروهی در لیست سفارشات برای چاپ دسته‌ای فاکتور، برچسب یا رسید حرارتی استفاده کنید.
* مشتری: از دکمه‌ی شورت‌کد (یا فعال‌سازی دکمه‌ی مشتری در تنظیمات) برای مشاهده/چاپ فاکتور استفاده کنید.
* پیش‌فاکتور: گزینه‌ی پیش‌فاکتور را برای امکان ساخت پیش‌فاکتور از سبد خرید فعال کنید.
* پرداخت پیش‌فاکتور دستی: لینک پرداخت تولیدشده را برای مشتری ارسال کنید یا از دکمه‌ی پرداخت داخل نمای فاکتور استفاده کنید.
* نقشه‌ی تسویه‌حساب: گزینه‌ی نقشه را برای انتخاب موقعیت تحویل توسط مشتری در صفحه‌ی تسویه‌حساب فعال کنید.

== External services ==
This plugin includes an optional “Checkout Map” feature. When it is enabled, the customer’s browser connects to the following third‑party services in order to display the map and provide address search:

1) OpenStreetMap Tile Servers (https://tile.openstreetmap.org/)

* Used for: Loading map tiles on the checkout page.
* Data sent: The customer’s IP address and the requested tile coordinates (as part of normal HTTP requests).
* Terms/Policies: https://osmfoundation.org/wiki/Terms_of_Use, https://wiki.osmfoundation.org/wiki/Privacy_Policy, https://operations.osmfoundation.org/policies/tiles/

2) Nominatim (OpenStreetMap) (https://nominatim.openstreetmap.org/)

* Used for: Address/city search in the map geocoder.
* Data sent: The customer’s search query text and the customer’s IP address (as part of normal HTTP requests).
* Terms/Policies: https://operations.osmfoundation.org/policies/nominatim/, https://wiki.osmfoundation.org/wiki/Privacy_Policy

The selected latitude/longitude is saved to the WooCommerce order meta (`_delivery_location`) only after the customer interacts with the map. In the admin order screen, a Google Maps link (https://www.google.com/maps) may be shown for convenience; it is only opened when an admin clicks the link.

No other external requests are made by this plugin. The plugin does not collect or transmit any data about your site or its visitors.

== Source code of bundled libraries ==
The plugin bundles the following third‑party libraries locally (no CDN). Human-readable source code is available at their official repositories:

* Leaflet 1.9.x — https://github.com/Leaflet/Leaflet (BSD-2-Clause)
* Leaflet Control Geocoder — https://github.com/perliedman/leaflet-control-geocoder (BSD-2-Clause)
* Leaflet.Locate — https://github.com/domoritz/leaflet-locatecontrol (MIT)
* QRCode.js — https://github.com/davidshimjs/qrcodejs (MIT)
* Estedad font — https://github.com/aminabedi68/Estedad (SIL OFL 1.1)

== Changelog ==
= 1.6 =
* New: Optional shipping cost and custom discount fields in the manual invoice builder.
* New: Thermal receipt template (80mm / 58mm) with single and bulk printing.
* Changed: Paper size selection is handled by the browser/printer print dialog instead of an in-page switcher.
* New: Users export to CSV/Excel alongside orders export.
* New: Unified admin design system (one palette, consistent borders, full-width pages).
* Changed: Replaced the proprietary IRANYekan webfont with the libre Estedad font (SIL OFL).
* Security: Hardened access control for invoice and shipping label links (capability checks instead of URL context).
* Removed: Remote server ping and promotional admin notice.
* Fixed: Plugin no longer registers WooCommerce-dependent hooks when WooCommerce is inactive.
* Performance: Settings are now loaded once per request (singleton).

= 1.5 =
* New: WooCommerce orders export.
* New: CSV and Excel export for orders.
* New: Bulk PDF export for selected orders.
* New: ZIP export with a separate invoice file for each order.
* New: Manual order selection for exports.
* New: Order filters by status, count and date range.
* New: Selectable export fields.
* New: HPOS compatibility.
* Changed: Unified Faktorak admin interface.
* Changed: Improved settings, manual invoice, invoice list and order export admin pages.
* Changed: Improved buttons, filters, tables and admin page layouts.
* Changed: Simplified internal plugin notices.
* Fixed: Reported visual issues.
* Changed: Improved admin user experience.
* Changed: Improved CSS asset loading and cache-busting.

= 1.4 =
* Added manual invoice workflow in wp-admin (create/list/delete; official invoice or proforma).
* Added AJAX product/customer search and customer autofill for manual invoice creation.
* Added order list quick actions column for invoice/shipping label on both legacy and HPOS order screens.
* Added token validation for frontend invoice/proforma links to harden document access.
* Added payment links for manual proformas plus payment button in invoice view.
* Added automatic document-type conversion from proforma to official after successful payment.
* Added customer-note rendering in both classic and modern invoice templates.
* Improved webfont coverage across plugin admin pages and submenu typography.
* Renamed the manual list label to `لیست فاکتورها`.
* Added optional signature support improvements in invoice templates.
* Added compatibility improvements for print rendering and HPOS environments.

= 1.3.1 =
* Improvements and security hardening.
