=== فاکتورک (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

Printable WooCommerce invoices, shipping labels and thermal receipts with proforma invoices, manual invoicing and CSV/Excel exports.

== Description ==
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 ==
* Print-friendly invoice and shipping label; final paper size is selected in the browser/printer print dialog.
* Thermal receipt printing with single and bulk printing.
* Two invoice templates (modern and classic).
* Optional proforma invoices (custom order status + admin action to convert to payable order).
* Optional checkout map to capture delivery location (saved in order meta).
* Manual invoice builder in wp-admin (create official invoice or proforma from selected products).
* Manual invoices list page (`لیست فاکتورها`) with search/filter/delete and quick customer/payment link copy.
* AJAX product and customer search with customer autofill in manual invoice form.
* Order list quick actions column (invoice + shipping label + thermal receipt) in both legacy and HPOS order screens.
* Orders export to CSV/Excel plus bulk invoice PDF output.
* Users export to CSV/Excel with role and registration date filters.
* Shortcodes:
  * `[faktorak_invoice_button]`
  * `[faktorak_proforma_button]`
* Local QR code rendering (no external QR service).
* Capability and token based protection for invoice/shipping label links.
* Payment button inside invoice view for unpaid manual invoices/proformas.
* Automatic conversion of paid proforma document type to official invoice.
* Optional seller signature image on invoice templates.
* Unified admin UI and Estedad typography (libre/OFL Persian font) across all plugin pages.

== Installation ==
1. Upload the plugin folder to `wp-content/plugins/`.
2. Activate the plugin.
3. Go to the Faktorak menu in wp-admin to configure invoice settings.

== Usage ==
* Admin: Open an order and use the metabox to print the invoice, shipping label or thermal receipt.
* Admin: Use `Faktorak > فاکتور دستی` to create manual invoices/proformas and manage them from `لیست فاکتورها`.
* Admin: Use the bulk actions on the orders list to print invoices, labels or thermal receipts in one batch.
* Customer: Use the shortcode button (or enable customer buttons in settings) to view/print invoices.
* Proforma: Enable the proforma option to allow creating a proforma invoice from the cart.
* Manual proforma payment: send the generated payment link to customer or use the payment button directly in invoice view.
* Checkout map: Enable the map option to let customers select their delivery location on the checkout page.

== 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.
