Commit Graph

694 Commits

Author SHA1 Message Date
7eb2530bc9 cleanup: Remove debug console.log statements 2026-02-01 16:40:05 +01:00
b8bbd67e1f fix: Save pendingAction before closeConfirmModal zeroes it 2026-02-01 16:37:30 +01:00
4d4ca457d2 fix: Get CSRF token from meta tag for better reliability 2026-02-01 16:33:00 +01:00
2652ecdc6e fix: Add empty JSON body to accept changes request 2026-02-01 16:31:57 +01:00
d40b4b3c3e debug: Add console.log to diagnose accept changes flow 2026-02-01 16:27:40 +01:00
dcc2e470ec feat: Add visual success screen after accepting/rejecting changes
- Show full-screen success overlay with progress steps (like InPost)
- Display clear confirmation that changes were accepted/rejected
- Show workflow progress: Złożono → Weryfikacja → Rozpatrzenie → Decyzja
- Button to navigate to status page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 16:23:39 +01:00
8a8d39632f feat: Add admin notifications when user accepts/rejects changes
- Create notification for all admins when user accepts proposed changes
- Create notification for all admins when user rejects proposed changes
- Clear proposed_changes fields after user decision
- Include rejection reason in admin notification

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 16:09:30 +01:00
17eaa25805 feat: Replace confirm/alert with beautiful custom modals in review changes
- Add custom confirmation modal matching portal UX
- Replace browser confirm() with styled modal
- Replace browser alert() with flash notifications
- Add keyboard (Escape) and click-outside support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 16:06:34 +01:00
6370abb24f feat: Replace alert() with flash notifications and add bell notification
- Replace all alert() calls with showNotification() for consistent UX
- Add UserNotification creation when admin proposes changes
- User sees notification in bell icon with link to review changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 16:00:58 +01:00
193d5ad8e3 chore: Increase status column to VARCHAR(50) for flexibility
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 15:55:57 +01:00
0f2a0409a0 fix: Increase status column length to VARCHAR(30)
The status 'pending_user_approval' is 21 characters, exceeding VARCHAR(20).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 15:53:57 +01:00
e733d26e36 feat: Add user approval workflow for registry data changes
When admin proposes changes from KRS/CEIDG registry, the application
now goes to 'pending_user_approval' status. User must review and
accept/reject proposed changes before final approval.

Changes:
- New status: pending_user_approval
- New fields: proposed_changes, proposed_changes_at, proposed_changes_by_id
- Admin endpoint: POST /admin/membership/<id>/propose-changes
- User endpoints: GET/POST /membership/review-changes/<id>/accept|reject
- New template: templates/membership/review_changes.html
- Migration: 043_membership_proposed_changes.sql

Workflow: submitted → under_review → pending_user_approval → under_review → approved

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:56:16 +01:00
1f806b66b0 feat: Add registry lookup explanation to admin membership detail
- Add info box explaining how NIP→KRS lookup works
- Show real-time status during lookup (Biała Lista → KRS Open API)
- Consistent UI with user-facing membership form

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:41:42 +01:00
61ecc9c8d5 fix: Show registry info section expanded by default 2026-02-01 14:38:32 +01:00
5a611d92e1 feat: Add registry lookup explanation and real-time status
- Add expandable info section explaining the lookup workflow
- Explain why NIP→Biała Lista→KRS is needed (KRS API doesn't support NIP)
- Show real-time status during lookup process
- Better UX for understanding multi-step data retrieval

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:35:30 +01:00
c73e90bc70 feat: Add Biała Lista VAT integration for NIP→KRS lookup
- Use official Ministry of Finance API (wl-api.mf.gov.pl) to get KRS from NIP
- Add KRS field to membership application form
- Workflow: NIP → Biała Lista → KRS Open API → full company data
- Fallback to CEIDG for JDG (sole proprietorship)
- Remove rejestr.io dependency - only official government APIs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 14:32:36 +01:00
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