Skip to content

Add client-side SAP import UI and printable DT paletization report - #2

Open
hhhthiti wants to merge 1 commit into
mainfrom
codex/create-site-with-zles002-and-report-tabs-qcaw4r
Open

Add client-side SAP import UI and printable DT paletization report#2
hhhthiti wants to merge 1 commit into
mainfrom
codex/create-site-with-zles002-and-report-tabs-qcaw4r

Conversation

@hhhthiti

@hhhthiti hhhthiti commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Provide a small browser tool to paste multiple TAB-delimited SAP lines and group items by DT (numeroTransporte) for paletization reporting and printing.
  • Allow resolving per-SKU pallet padrao from a remote produtos table when available and compute pltFechado/fracao to help packing decisions.
  • Persist imported DTs in the browser so users can search, load and print reports without a backend session.

Description

  • Added a new frontend app with index.html, app.js, and styles.css implementing a tabbed UI, import area, DT summary table, DT search/select, and a print-ready report sheet.
  • Implemented SAP line parsing in app.js to read TAB-separated columns, compute padrao, pltFechado, and fracao, and group items into dtStore keyed by numeroTransporte which is persisted to localStorage under STORAGE_KEY.
  • Integrated a Supabase client (CDN @supabase/supabase-js@2) and a buscarPadraoPorSku function that queries the produtos table for fardos_por_palete to override the padrao when present, with a publishable URL/key defined at the top of app.js.
  • Added UI helpers: import loading state, status messages, rendering of resumo-importacao, DT searching by suffix, loading DT into the printable sheet (#sheet-* elements), print trigger, and a hard-coded STAR_PRODUCTS table rendered in the UI.

Testing

  • No automated tests were added or executed for this change.

Codex Task

@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
expedicao Ready Ready Preview, Comment Apr 9, 2026 7:21pm
expedicao-9pez Ready Ready Preview, Comment Apr 9, 2026 7:21pm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5504e07eb9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app.js
Comment on lines +221 to +223
tr.innerHTML = `
<td>${data.numeroTransporte || ""}</td>
<td>${item.sku || ""}</td>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Escape imported values before assigning tr.innerHTML

This row template injects item.sku (and nearby fields) directly into innerHTML even though the values come from pasted SAP text. If a pasted field contains HTML with an event handler, it will execute when the DT is rendered, turning import data into script execution in the operator’s browser. Render these values via textContent (or sanitize) instead of interpolating raw strings into HTML.

Useful? React with 👍 / 👎.

Comment thread app.js
};
}

dtStore[parsed.numeroTransporte].itens.push(parsed.item);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace existing DT items instead of always appending

For DTs already present in dtStore, imports always append new items and never reconcile old ones. Re-importing the same SAP extract (or importing a corrected extract) therefore duplicates rows and inflates totals in both the summary table and printable report. The update path should clear or de-duplicate the DT item list before adding freshly parsed lines.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant