Commit Graph

828 Commits

Author SHA1 Message Date
28affce99f feat: Add NIP lookup services for membership application
- Add ceidg_api_service.py with fetch_ceidg_by_nip() function
- Add KRSApiService class with search_by_nip() method
- KRS lookup uses rejestr.io API (unofficial) or database fallback
- CEIDG lookup uses official dane.biznes.gov.pl API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:22:01 +01:00
3e23bd3e4e fix: Add CSRF token to admin membership detail fetch requests
All AJAX calls in membership_detail.html now include X-CSRFToken header
to prevent 'Błąd połączenia' errors when performing admin actions like
start-review, approve, reject, request-changes, and registry lookup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:11:59 +01:00
ebc3dd63d3 fix: Redirect loop in membership apply + add registry lookup for admin + action legends 2026-02-01 14:05:41 +01:00
3a12c659ab feat: Add application details view to membership status page 2026-02-01 13:58:11 +01:00
969dd75701 fix: Add CSRF token to membership application form 2026-02-01 12:56:26 +01:00
28b98fe055 feat: Add membership links in user navigation
- Add "Złóż deklarację" / "Uzupełnij dane firmy" in user dropdown menu
- Add membership section in account settings sidebar
- Dynamic links based on user's company status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 12:41:21 +01:00
0f8aca1435 feat: Add membership application system
Implement full online membership application workflow:
- 3-step wizard form with KRS/CEIDG auto-fill
- Admin panel for application review (approve/reject/request changes)
- Company data update requests for existing members
- Dashboard CTA for users without company
- API endpoints for NIP lookup and draft management

New files:
- database/migrations/042_membership_applications.sql
- blueprints/membership/ (routes, templates)
- blueprints/admin/routes_membership.py
- blueprints/api/routes_membership.py
- templates/membership/ and templates/admin/membership*.html

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 12:38:31 +01:00
cc83186486 fix: Move sources_used definition before usage in AI enrichment 2026-02-01 11:13:30 +01:00
f166668f22 feat: Add AI enrichment approval workflow
- Remove confusing "Zweryfikowano 2x | Jakość: 100%" badge
- Create AiEnrichmentProposal model for pending AI suggestions
- Modify AI enrichment to create proposals instead of direct saves
- Add approve/reject API endpoints for proposals
- Update frontend to show approval buttons after AI analysis
- Proposals expire after 30 days if not reviewed

The workflow now requires owner/admin approval before AI-generated
data is applied to company profiles. This prevents unwanted data
from being automatically added.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 11:03:53 +01:00
69e71f1f05 fix: Hide duplicate sections for JDG/CEIDG companies in profile
For companies with CEIDG data, hide the redundant "Informacje prawne
i biznesowe" and "Dane kontaktowe" sections since this data is already
displayed in the "Dane z rejestrów urzędowych (CEIDG)" section.

This matches the behavior for KRS companies and eliminates duplicate
display of NIP, REGON, PKD, and contact information.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:21:51 +01:00
9b8d68348e feat: Enhanced website extraction - no limits, more categories
- Removed limits on services (was 10) and keywords (was 8)
- Added new extraction categories:
  - products: physical/digital products
  - brands: partners, certifications (VMware, Veeam, etc.)
  - specializations: specific competencies
  - target_customers: customer types (SMB, enterprise, etc.)
  - regions: geographic coverage
- Merged all data into services_extracted and main_keywords
- Increased content limit to 20000 chars for AI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:50:15 +01:00
83a33f49ff fix: Load .env file in website content updater
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:43:06 +01:00
d96cd78c47 feat: Add automatic website content updater with Gemini 3 Flash
- New script: scripts/website_content_updater.py
- Uses Gemini 3 Flash (free tier) for AI extraction
- Extracts: services_extracted, main_keywords, content_summary
- Supports: single company, batch, stale-days filtering, dry-run
- Rate limiting: 2s between API calls
- Documented cron setup in CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:42:04 +01:00
ba9cd106df feat: Hide recommendations section (pending Norda board approval)
- Wrapped recommendations section in {% if False %} condition
- Added clear comments explaining why and how to re-enable
- No code deleted, just hidden until approved

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:35:12 +01:00
fbbe305fd2 refactor: Clean up services section - keep website data, remove AI guesses
- Services section now shows only:
  - company.services (from database)
  - company.competencies (from database)
  - "Ze strony www firmy" (from website_analysis - actual website data)
- Removed AI-generated data:
  - ai_insights.services_list
  - ai_insights.industry_tags
  - ai_insights.suggested_category
  - ai_insights.target_market
- Website data clearly labeled with source URL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:34:06 +01:00
11f5219434 refactor: Remove AI-generated "Wyróżniki" section
- Removed USPs (unique_selling_points) and company values
- These were AI guesses from website analysis, not verified data

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:25:39 +01:00
609f131d81 refactor: Remove AI/crawler metadata footer
- Removed "Źródło", "Analiza", "Pewność AI" info card
- This was metadata about website crawling, not useful for users

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:21:12 +01:00
b1d285aada refactor: Remove AI-guessed certifications section
- Removed "Certyfikaty i uprawnienia" section
- This was AI (Gemini) guessing certifications from website content
- Not verified data, just crawler-based inference

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:20:00 +01:00
edceea39b4 refactor: Remove website features and last modified sections
- Removed "Funkcje strony" section (Blog, Portfolio, Contact form, etc.)
- Removed "Ostatnia modyfikacja" timestamp
- These were crawler-based data with low business value

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:18:33 +01:00
d320552835 refactor: Consolidate contact info in KRS section
- Move phone number to KRS "Dane kontaktowe" section
- Hide legacy "Dane kontaktowe" section for companies with KRS API data
- Show (KRS) badge next to email/www from official registry
- Phone is unique data not available in KRS API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:13:14 +01:00
ea17cdd106 refactor: Remove duplicate sections for KRS companies
- Hide "Zarząd i Wspólnicy" section for companies with KRS API data
  (data is now in "Dane z rejestrów urzędowych" section)
- Hide "Informacje prawne i biznesowe" section for companies with KRS API data
  (NIP, REGON, forma prawna, kapitał - all in KRS section)
- Remove rejestr.io links (we now have official KRS API data)
- Keep PDF download button in legacy section
- Add CRBR and SUDOP registries to TODO for future integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:06:40 +01:00
66bb66dd36 feat: Add all 10 missing KRS data fields
Extend KRS data collection and display:
1. NIP - displayed in company profile
2. REGON - displayed in company profile
3. Email from KRS (adresPocztyElektronicznej)
4. WWW from KRS (adresStronyInternetowej)
5. ePUAP address (adresDoDoreczenElektronicznychWpisanyDoBAE)
6. Company agreement date (data zawarcia umowy)
7. Company duration (czas trwania spółki)
8. Share information (informacja o udziałach)
9. Financial statements history (sprawozdania finansowe)
10. Full PKD codes with class/subclass (e.g., 62.03.Z)
11. Court registry data (sygnatura, sąd, rok obrotowy)

Updated krs_api_service.py:
- Extended KRSCompanyData dataclass with new fields
- Updated parse_krs_response() to extract all data
- PKD now returns dict with kod, opis, glowna

Updated templates/company_detail.html:
- Display NIP and REGON from KRS
- Contact section with email, www, ePUAP
- Company agreement section
- Financial statements history grid
- Court registry information
- Improved PKD display with full codes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:56:56 +01:00
30e3883704 docs: Add production script execution guidance for DATABASE_URL
Document that `source .env` doesn't work via SSH and
provide correct patterns for running Python scripts
that need database access on production.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:48:58 +01:00
52061fa949 feat: Display ALL KRS data in company profile
- Add krs_raw_data, krs_fetched_at, krs_registration_date,
  krs_representation, krs_activities columns to Company model
- Save complete KRS API response for full data access
- Display in company profile:
  - Board members (zarząd) with functions and avatars
  - Shareholders (wspólnicy) with share amounts
  - Representation method (sposób reprezentacji)
  - Business activities (PKD codes)
  - Registration date with years active
  - KRS address with region info
  - OPP (public benefit) status
  - Metadata (stan_z_dnia, data_odpisu)
- Add migration 037_krs_extended_data.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:44:33 +01:00
a73117ad4a feat: Add dedicated 'Dane z rejestrów urzędowych' section to company profile
- Display all CEIDG data: status, owner, PKD codes, contacts, addresses
- Display all KRS data: legal form, capital, KRS number
- Show data source banner with fetch timestamp and registry link
- Display additional business locations from CEIDG
- Show succession manager (zarządca sukcesyjny) if present
- All PKD codes displayed as tags with main PKD highlighted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:37:06 +01:00
7bfbfa6279 feat: Auto-switch between CEIDG and KRS APIs for company enrichment
- Add enrich_companies_from_registries() that tries KRS first for companies
  with KRS number, then falls back to CEIDG
- Add update_company_from_krs() to save KRS data to Company model
- Fix CEIDG search to use 'nip' parameter directly
- Keep enrich_companies_from_ceidg() as alias for compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:27:50 +01:00
448937dabd fix: Rename pkd_codes column to ceidg_pkd_list to avoid backref conflict
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:22:32 +01:00
9f2b261df2 feat: Extend CEIDG data storage and enrichment
- Add new Company fields: ceidg_id, ceidg_status, pkd_codes (JSONB),
  correspondence address, owner_citizenships, ceidg_raw_data
- Add enrich_companies_from_ceidg() to fetch full CEIDG details
- Add fetch_full_ceidg_details() for detailed API calls
- Add update_company_from_ceidg() to save all CEIDG fields
- Add --enrich and --apply flags for batch enrichment
- Add migration 036_ceidg_extended_data.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:21:21 +01:00
79a1a60621 feat: Add CEIDG API name search and --missing-nip option
- Add search_ceidg_by_name() for API v3 name-based queries
- Add search_missing_nip_companies() to find NIP for companies without NIP
- Add --missing-nip flag to search for all companies missing NIP
- Add --apply-nip flag to save found NIPs to database
- Fix API endpoint: /api/ceidg/v3/firmy (not /firma)
- Correctly extract NIP from wlasciciel object in response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:16:22 +01:00
99f7a5a88a fix: Remove sticky sidebar on account pages + add Companies to admin menu
Changes:
- Remove position: sticky from konto sidebar (dane, prywatnosc, bezpieczenstwo, blokady)
- Add "Firmy" link to admin dropdown menu (before "Użytkownicy")
- Add scan_websites_for_nip.py script for data quality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:03:55 +01:00
a325e1b2e4 feat: Add role management UI in admin panel
- Add role dropdown column in users table
- Add /admin/users-api/change-role endpoint
- Sync is_admin flag when role changes
- Auto-create UserCompanyPermissions for EMPLOYEE
- Prevent self-demotion from admin

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 06:48:26 +01:00
ae70ad326e feat: Add hierarchical role system with delegated permissions
Implements 6-tier role hierarchy:
- ADMIN (100): Full system access
- OFFICE_MANAGER (50): Admin panel without user management
- MANAGER (40): Full company control + user management
- EMPLOYEE (30): Edit company data (with delegated permissions)
- MEMBER (20): Full content access (forum, contacts, chat)
- UNAFFILIATED (10): Public profiles only

Features:
- SystemRole and CompanyRole enums in database.py
- UserCompanyPermissions model for delegation
- New decorators: @role_required(), @company_permission()
- Auto-detection of MANAGER role from KRS data
- Backward compatible with is_admin flag

Migration: 035_add_role_system.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 06:42:39 +01:00
1bf56148f5 docs: Merge v1.22.0 and v1.23.0 release notes into single v1.22.0
Combined all January 31st changes into one release.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:19:35 +01:00
2c5e2dc4af docs: Add v1.23.0 release notes
- B2B classifieds interactions (interest, Q&A, context messages)
- Forum and B2B read tracking with seen-by avatars
- Admin modules for Companies and People management
- Status dashboard with SSL, deploy, security metrics
- Audit logging for login/logout events

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:17:42 +01:00
830ef0ea1e feat: Add B2B classifieds interactions (interest, Q&A, context messages)
- Add ClassifiedInterest model for tracking user interest in listings
- Add ClassifiedQuestion model for public Q&A on listings
- Add context_type/context_id to PrivateMessage for B2B linking
- Add interest toggle button and interests list modal
- Add Q&A section with ask/answer/hide functionality
- Update messages to show B2B context badge
- Create migration 034_classified_interactions.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:15:30 +01:00
062a152a50 fix: Show seen-by avatars for each forum reply, not just topic
Uses reply.readers backref to display who viewed each reply.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:52:49 +01:00
e87ba8ee09 feat: Add read tracking for Forum topics/replies and B2B classifieds
- Add ForumTopicRead, ForumReplyRead, ClassifiedRead models
- Add SQL migration for new tables
- Record reads when user views forum topic (topic + all visible replies)
- Record reads when user views B2B classified
- Display "Seen by" avatars in forum topic and B2B detail pages

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:50:27 +01:00
53c7535d92 fix: Show (Ty) label for current user, not first reader
Changed condition from loop.first to checking if reader
matches current_user.id for correct "You" indicator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:44:02 +01:00
1d62934b57 feat: Add audit logging for login/logout events
- Log successful logins (password and 2FA) to audit_logs
- Log failed login attempts to audit_logs
- Log logout events to audit_logs
- Enables tracking of login activity in admin status dashboard

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:42:42 +01:00
c505a35f8f fix: SSL card layout - 2 columns + issuer row below
Prevents text clipping in third column by moving issuer
to a separate centered row below the date stats.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:40:31 +01:00
873453061e fix: Improve SSL certificate card layout with 3-column grid
Move issuer info into metric-stats grid instead of separate
info-row to prevent text clipping.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:33:21 +01:00
0530d096b0 fix: Add db.rollback() after SQL exceptions in status dashboard
Prevents "transaction is aborted" cascade errors when
pg_stat_statements extension is not installed or other
SQL queries fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:30:52 +01:00
fca0e9d51e feat: Enhance status dashboard with SSL, deploy, security and API metrics
- Add load average display (1/5/15 min)
- Add SSL certificate monitoring (expiry, issuer, days left)
- Add Git/deploy info (branch, commit, date)
- Add extended DB metrics (cache hit ratio, slow queries, deadlocks)
- Add security metrics (failed logins, GeoIP blocks, rate limits, locked accounts)
- Add external APIs status with latency (Google, Gemini, Gravatar)
- Add servers ping monitoring (R11-REVPROXY-01, NORDABIZ-01, R11-DNS-01)
- Fix pgrep path for Gunicorn worker detection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:28:26 +01:00
edcb755588 fix: Use full path for pgrep in gunicorn detection 2026-01-31 20:21:41 +01:00
4cdc5214f6 debug: Add logging for gunicorn status detection 2026-01-31 20:20:51 +01:00
d5273a8e6a feat: Add admin modules for Companies and People management
- Add /admin/companies with CRUD operations, filters, CSV export
- Add /admin/people with person-company relationship management
- Companies: add, edit, toggle status, archive, view linked people
- People: add, edit, delete, link/unlink companies by role
- Both panels follow existing admin UI patterns (stats, filters, modals)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:13:51 +01:00
9d422ceb64 docs: Expand v1.22.0 release notes with full changelog
Added:
- Forum reactions, subscriptions, editing, reporting
- Solution marking, user stats, markdown, mentions
- Bulk actions, soft-delete, restore
- Architecture refactoring to blueprints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:51:17 +01:00
eb45504f1b docs: Add v1.22.0 release notes (31 Jan 2026)
- Forum admin analytics dashboard
- CSV export, topic move/merge, admin search
- User activity log
- Admin menu links (Forum, Announcements, Insights)
- NordaGPT input area fix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:48:23 +01:00
009bcbfc72 fix: Adjust chat height for admin bar (#21)
- Added CSS variable --header-height (109px for admin, 73px for regular users)
- Fixed chat container height calculation to account for admin bar
- Fixed mobile sidebar position

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:40:58 +01:00
333dc20717 fix: Add bottom padding to chat input area (#21)
Fixes issue where chat input field was cut off at the bottom of the screen.
Added safe-area-inset-bottom support for iOS devices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 19:39:13 +01:00