pdf task-h

This commit is contained in:
phaichayon
2026-06-19 15:09:58 +07:00
parent a85d24235c
commit fd01ebf7c7
35 changed files with 3905 additions and 133 deletions

View File

@@ -0,0 +1,34 @@
# PDF Mapping Registry
This document is the source of truth for current quotation PDF field ownership.
| PDF Field | Source Path | Transform | Example Value |
| --- | --- | --- | --- |
| `customer_name` | `customer.name` | direct | `ALLA Demo Customer` |
| `customer_addr` | `customer.address` | direct multiline | `99/9 Rama IX Road, Bangkok 10310` |
| `customer_tel` | `customer.phone` | direct | `02-000-1000` |
| `customer_email` | `customer.email` | direct | `demo-customer@local.test` |
| `customer_att` | `quotation.attention` | direct | `Task H.1 Contact` |
| `project_name` | `quotation.projectName` | direct | `Task H.5 Audit Fixture` |
| `site_location` | `quotation.projectLocation` | direct multiline | `Bangkok HQ` |
| `quotation_date` | `pdfme.quotation_date` | `formatPdfDate()` | `16 Jun 2026` |
| `quotation_code` | `quotation.code` | direct | `QT-H5-AUDIT` |
| `quotation_price` | `pdfme.quotation_price` | `formatPdfCurrency()` | `THB 128,400.00` |
| `currency` | `quotation.currency` | direct | `THB` |
| `exclusion_data` | `pdfme.exclusion_data` | `formatTopicItems()` | `[["Civil work by customer"]]` |
| `items_table` | `items` | `normalizePdfmeTable()` with table columns | item rows |
| `app1` | `signatures.preparedBy.name` | direct | `Task H.1 Admin` |
| `app1_position` | `signatures.preparedBy.position` | position resolver | `Sales Manager` |
| `app2` | `signatures.approvedBy.name` | direct | `Task H.1 Admin` |
| `app2_position` | `signatures.approvedBy.position` | position resolver | `Sales Manager` |
| `app3` | `signatures.authorizedBy.name` | direct | `Task H.1 Admin` |
| `app3_position` | `signatures.authorizedBy.position` | position resolver | `Sales Manager` |
| `topic` | dynamic topic engine | runtime schema clone | topic label table |
| `data_topic` | dynamic topic engine | runtime schema clone | topic item table |
| `topic_*` | `documentData.topics.all[*].topicType` | runtime generated | `Scope` |
| `item_topic_*` | `documentData.topics.all[*].items` | `formatTopicItems()` | topic rows |
## Alias Notes
- current PDFME schema still uses field containers named `quotation_date_data` and `quotation_code_data`
- runtime normalization now publishes both the canonical placeholder keys (`quotation_date`, `quotation_code`) and the container keys so preview/audit/render stay aligned during the freeze window

View File

@@ -0,0 +1,36 @@
# PDF Placeholder Registry
This registry freezes the placeholder naming contract for quotation PDF templates.
| Placeholder | Type | Ownership | Notes |
| --- | --- | --- | --- |
| `customer_name` | mapped | DB mapping | customer display name |
| `customer_addr` | mapped | DB mapping | multiline address |
| `customer_tel` | mapped | DB mapping | customer phone |
| `customer_email` | mapped | DB mapping | customer email |
| `customer_att` | mapped | DB mapping | quotation attention |
| `project_name` | mapped | DB mapping | project name |
| `site_location` | mapped | DB mapping | project location |
| `quotation_date` | mapped | DB mapping | formatted date |
| `quotation_code` | mapped | DB mapping | quotation document code |
| `quotation_price` | mapped | DB mapping | formatted total amount |
| `currency` | mapped | DB mapping | currency code/label |
| `exclusion_data` | mapped | DB mapping | exclusion rows as `string[][]` |
| `app1` | mapped | DB mapping | prepared by name |
| `app1_position` | mapped | DB mapping | prepared by position |
| `app2` | mapped | DB mapping | approved by name |
| `app2_position` | mapped | DB mapping | approved by position |
| `app3` | mapped | DB mapping | authorized by name |
| `app3_position` | mapped | DB mapping | authorized by position |
| `topic` | reserved | dynamic topic engine | base runtime topic label template |
| `data_topic` | reserved | dynamic topic engine | base runtime topic rows template |
| `item_topic` | legacy reserved token | dynamic topic engine | allowed in schema token inventory, not in DB mapping rows |
| `topic_*` | generated | dynamic topic engine | runtime-only generated keys |
| `item_topic_*` | generated | dynamic topic engine | runtime-only generated keys |
## Naming Rules
- do not store `topic_*` or `item_topic_*` keys in `crm_document_template_mappings`
- keep `topic` and `data_topic` reserved for runtime schema cloning
- treat typo-like names such as `quotation_date_labe` and `quotation_code_lable` as static labels, not placeholders
- keep canonical business placeholders as `quotation_date` and `quotation_code`; container aliases like `quotation_date_data` and `quotation_code_data` are tolerated only as schema field names during the current freeze window