task p-4.5

This commit is contained in:
phaichayon
2026-06-29 16:07:03 +07:00
parent aa73b9aed2
commit a1cac84e2b
19 changed files with 4812 additions and 413 deletions

View File

@@ -135,6 +135,9 @@ async function main() {
const priceTable = payload.templateInput.quotation_price_data;
const priceTableRows = Array.isArray(priceTable) ? priceTable : [];
const firstPriceRow = Array.isArray(priceTableRows[0]) ? (priceTableRows[0] as unknown[]) : [];
const itemsTable = payload.templateInput.items_table;
const itemsTableRows = Array.isArray(itemsTable) ? itemsTable : [];
const firstItemsRow = Array.isArray(itemsTableRows[0]) ? (itemsTableRows[0] as unknown[]) : [];
pushFinding(findings, {
field: 'templateInput.quotation_price_data',
@@ -172,6 +175,24 @@ async function main() {
value: firstPriceRow[3] ?? null,
message: 'Price table currency code cell is populated'
});
if (itemsTable !== undefined) {
pushFinding(findings, {
field: 'templateInput.items_table',
source: 'templateInput',
status: Array.isArray(itemsTable) ? 'PASS' : 'FAIL',
value: Array.isArray(itemsTable) ? `rows:${itemsTable.length}` : itemsTable,
message: Array.isArray(itemsTable)
? 'Product items table input is present'
: 'Product items table input is missing or not table'
});
pushFinding(findings, {
field: 'templateInput.items_table[0]',
source: 'templateInput',
status: firstItemsRow.length === 7 ? 'PASS' : 'FAIL',
value: firstItemsRow.length,
message: 'Product items table row shape uses seven columns'
});
}
const staticLabelFindings = [...PDFME_STATIC_LABEL_FIELD_KEYS].map((fieldName) => {
const value = payload.templateInput[fieldName];