feat(settings): add GoMag API config, Oracle dropdowns, compact 2x2 layout

- Remove ID_GESTIUNE from config (unused)
- Add GoMag API settings (key, shop, days_back, limit) to SQLite — editable without restart
- sync_service reads GoMag settings from SQLite before download
- gomag_client.download_orders accepts api_key/api_shop/limit overrides
- New GET /api/settings/sectii and /api/settings/politici endpoints for Oracle dropdowns
  (nom_sectii.sectie, crm_politici_preturi.nume_lista_preturi)
- id_pol, id_sectie, transport_id_pol, discount_id_pol now use select dropdowns
- order_reader extracts discount_vat from GoMag JSON discounts[].vat
- import_service uses GoMag discount_vat as primary, settings as fallback
- settings.html redesigned to compact 2x2 grid (GoMag API | Import ROA / Transport | Discount)
- settings.js v2: loadDropdowns() sequential before loadSettings()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-16 16:39:59 +00:00
parent a0649279cf
commit 227dabd6d4
8 changed files with 268 additions and 97 deletions

View File

@@ -92,7 +92,8 @@ def build_articles_json(items, order=None, settings=None) -> str:
articles.append(article_dict)
# Discount total with quantity -1 (positive price)
if order.discount_total > 0 and discount_codmat:
discount_vat = settings.get("discount_vat", "19")
# Use GoMag JSON discount VAT if available, fallback to settings
discount_vat = getattr(order, 'discount_vat', None) or settings.get("discount_vat", "19")
article_dict = {
"sku": discount_codmat,
"quantity": "-1",