Commit Graph

18 Commits

Author SHA1 Message Date
gitea d10b1d263f Add selector nomenclature for conditional field visibility
A selector is a nomenclature whose value decides which other nomenclatures
appear beneath it: picking "Ship" reveals the ship fields, "Warehouse"
reveals the warehouse ones. Previously every vehicle nomenclature rendered
at once, so the operator had to know which were relevant and a vehicle
could silently carry both a ship and a warehouse.

Visibility is one rule - a nomenclature is hidden if some selector option
reveals it and that selector's value is not the revealing option - kept in
nomenclatures/visibility.py and mirrored in services/nomenclatureVisibility.js.
A nomenclature no selector references always shows, so installations without
selectors are unchanged.

The serializer, not the UI, enforces the invariant: a value for a hidden
nomenclature is rejected, as is a selector value that matches no option.
The frontend clearing values on switch and pruning hidden keys before save
is convenience on top of that.

Selector values join lookups in the quick-fill combination projection, so
applying a saved combination sets the source and its revealed fields in one
click rather than collapsing "Ship + cargo" and "Warehouse + cargo" into
one indistinguishable row.

Configuration rejects nesting (a selector revealing another selector) and
double-reveal (one nomenclature revealed by two selectors, leaving its
visibility ambiguous). The admin UI filters both out of the reveal list as
well, so an invalid configuration cannot be built in the first place.

Note: introducing a selector over existing data hides values already
entered - vehicles predating the selector have no selector key, so anything
it reveals becomes invisible until a source is chosen. The values remain
stored. Worth a data check before configuring the first selector.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 19:43:13 +03:00
gitea 0a1b7c31e2 Wire new features into the main screen and navigation
Main.jsx now parses readings through the selected protocol rather than
an inline regex, shows one Measure button instead of separate tare and
gross, and colours the live weight green when the scale reports stable
and red while it moves. A reading with no stability marker counts as
unstable, so an unrecognised format fails safe.

While only one weighing exists it appears as "First weighing" rather
than filling in the Tare card, because a lighter second reading can
still move it to gross and a value visibly jumping between cards would
read as a bug.

Header gains admin links to the scale monitor and licence screens.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:58:26 +03:00
gitea 6fe9f1820c Add licence UI and vendor signing tool
Admin screen shows the machine fingerprint to send for a licence key,
installs a pasted key, and lists connected stations. A persistent banner
warns all users during the grace period.

The browser sends the station heartbeat rather than the bridge, because
the bridge deliberately has no dependency on Django; it already talks to
both. Two tabs on one station share a slot, and a station reconnecting
at the limit reclaims its own slot so a brief drop cannot lock it out
behind its own expiring registration.

license_tool.py is the only thing that can sign a licence - the
application can only verify. The private key it generates is gitignored
and must never ship: if it leaks every licence becomes forgeable, and it
cannot be rotated without reissuing to every customer, since the public
key is compiled into shipped binaries.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:58:10 +03:00
gitea 5a8527e96e Add multi-protocol scale support and admin COM monitor
The bridge becomes pure transport: it opens the port, writes a poll
string it is given at runtime, and streams raw lines. Protocol
definitions live in Django and parsing happens in the browser, so a new
scale type never means a new binary on the station PCs. The poll loop
stays in the bridge because a browser cannot be the heartbeat - hidden
tabs get throttled and a closed tab would stop the scale.

Every payload now carries a hex field. Toledo Continuous sends STX and
bit-packed status, which UTF-8 decoding silently corrupts. Fixed-column
protocols need the opposite care: a space can mean balanced, so the
trailing whitespace must survive.

Parsers for the simulator, fixed-column, Toledo Continuous and SICS
return an explicit error rather than a guess on a frame that does not
match, since a silently wrong weight on a weighbridge is worse than no
weight. Toledo and SICS are written from documented structure and have
not been validated against real hardware.

The admin monitor shows the raw stream as text and hex, sends one-off
probe commands, and builds fixed-column protocols against captured
lines. Spaces render as middots because in some protocols a space is
the stability flag.

The test writer now simulates a weighing cycle - idle, ramp, balanced,
drop - alternating empty and loaded trucks, quantised to the 20kg and
50kg divisions real truck scales use.

Bridge logging rotates and per-reading lines drop to DEBUG; the old
config had grown two log files totalling 368MB.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:58:00 +03:00
gitea 67c9531600 Add quick-fill table for vehicle extra data
Shows previously-used combinations of lookup nomenclature values above
the Additional Data fields in both the new-vehicle and edit forms.
Clicking a row merges the combination into the current values, so
free-text fields the operator already typed are preserved.

NomenclatureContext now fans extra_combination events out to
subscribers; without that they hit the unknown-object warning and were
dropped, so deletes would not have reached other open tabs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:57:36 +03:00
gitea 183908cbab Add drag-to-reorder for nomenclatures
Nomenclatures can be reordered by dragging in the left-hand list, which
PATCHes sort_order on the rows that moved. PATCH rather than PUT, since a
full update recreates the nested fields collection.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:56:21 +03:00
gitea 19945dae19 Move dev servers to ports 8002 and 5172
Backend now runs on 8002 and the frontend dev server on 5172, with the
proxy, CORS origins and the run_*.bat launchers updated to match. The
launchers also activate the venv so they work from a clean shell.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 18:56:14 +03:00
gitea ac6b1f48b4 expression field added in document editor. a few plans in plans folder 2026-02-24 11:38:56 +02:00
gitea 574de2c32d added users management and permissions 2026-02-23 15:01:58 +02:00
gitea a993f8944d removed id and _vehicle objects from editor dropdown, json is made procramatically instead of hardcored, so when entity changed, json is auto updated 2026-02-22 21:21:05 +02:00
gitea 34769a84eb added net weight, user, date etc. generates new document number with year as a prefix, restarts numbering every year 2026-02-22 13:20:18 +02:00
gitea da17562c19 added docker-compose for linux fixed 2 2026-02-21 20:04:26 +02:00
gitea 58b1ae9a5e added docker-compose for linux 2026-02-21 19:53:04 +02:00
gitea be91231b05 added vehicle creation functionality 2026-02-10 17:50:49 +02:00
gitea 6a42099169 added vehicles and vehicles extra, dynamic tables for entities, dynamic dropdowns with overlay for selecting and manage data 2026-02-10 17:32:33 +02:00
gitea ed35a90cc0 report editor has db text and bands (detail, subdetails, summary, header, footer) detail/subdetail work ok. 2026-01-26 15:15:32 +02:00
gitea fb1d4ae7ad report editor with text field, lines, frames, and table draw. multiselect etc. 2026-01-25 09:58:55 +02:00
gitea 7f04566242 barebone app with django and react, sse, jwt token, comport reader, test comport writer, requires com0com, users with groups, sample table vehicles, tokens for access and refresh 2026-01-17 13:03:21 +02:00