Add API endpoint for getting IT audit collaboration matches for a company.
- Admin-only access (matches are not visible to regular users per spec)
- Returns all matches where company is either party A or B
- Includes partner company info, match type/score/reason, status
- Follows existing API patterns (login_required, try/finally, jsonify)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implemented POST endpoint at /it-audit/save that:
- Accepts JSON or form data with IT audit fields
- Validates company access (admin for any, users for their own)
- Parses boolean, array, and string fields with proper type handling
- Uses ITAuditService to save audit with scoring calculation
- Returns JSON with audit scores and redirect URL
- Includes rate limiting (30 per hour)
- Handles errors with rollback and logging
Added helper function _parse_it_audit_form_data() to properly parse:
- Boolean fields (checkboxes)
- Array fields (multi-select)
- String fields
- JSON fields (zabbix_integration)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Flask route for IT audit form display:
- GET /it-audit/form with optional company_id query parameter
- Access control: admin can access any company, users only their own
- Defaults to current user's company if no company_id provided
- Pre-fills form with existing audit data if available
- Renders it_audit_form.html template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implemented the IT audit admin dashboard route at /admin/it-audit that:
- Checks for admin authentication (is_admin flag)
- Queries all active companies with their latest IT audit data
- Calculates statistics (audit count, avg scores, maturity distribution)
- Provides technology adoption stats (Azure AD, M365, PBS, Zabbix, EDR, DR)
- Queries collaboration flags from IT audits
- Retrieves and organizes collaboration matches by type
- Renders admin/it_audit_dashboard.html template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added collaboration matrix section to IT audit dashboard with:
- CSS styles for match type cards following combo-grid pattern
- Six match type categories: M365 licensing, backup replication,
Teams federation, shared monitoring, collective purchasing,
and knowledge sharing
- Company pairs display with status badges (suggested, contacted,
active, declined)
- Empty state with friendly message when no matches exist
- Responsive grid layout matching social_media.html patterns
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create IT Audit admin dashboard template with:
- Header with title, description, and action buttons
- Stats grid showing: total audits, avg overall score, avg security
score, avg collaboration score, companies without audit
- Maturity level distribution (basic, developing, established, advanced)
- Technology stats grid (Azure AD, M365, Proxmox PBS, Zabbix, EDR, DR Plan)
- Collaboration flags section (6 cooperation types)
- Empty states for all sections when no data
- Responsive design following patterns from admin_seo_dashboard.html
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Enhanced updateProgress() function to track section-by-section completion
- Added calculateSectionCompletion() helper for per-section field analysis
- Added updateSectionProgress() for section-level progress indicators
- Implemented real-time progress tracking with input event listeners
- Added debounced input handlers for text/email/textarea fields
- Added keyboard navigation support for progress dots (accessibility)
- Progress bar color changes based on completion percentage:
- Primary (blue) for <50%
- Warning (yellow) for 50-79%
- Success (green) for >=80%
- Section dots and numbers turn green when section is 70%+ complete
- Properly handles conditional fields visibility in completion calculation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added three new form sections to IT audit form:
- Section 4: Endpoints (Workstations) - device types, OS, MDM, encryption
- Section 5: Security - antivirus/EDR, VPN, MFA, password policy, training
- Section 6: Backup & DR - backup solutions, targets, frequency, retention, DR plan
Features:
- Dropdowns for single-select options (MDM solution, VPN, antivirus, etc.)
- Chip-select for multi-select options (endpoint types, OS, MFA methods, etc.)
- Toggle switches for yes/no questions with conditional fields
- Full JavaScript support for new chip selections and conditional mappings
- Initialization support for editing existing audits
- Executed it_audit_migration.sql against DEV PostgreSQL (localhost:5433)
- Created it_audits and it_collaboration_matches tables
- Created 12 indexes for performance optimization
- Created 4 views: v_company_it_overview, v_it_audit_history,
v_it_collaboration_overview, v_it_technology_stats
- Added missing document_management column to match SQLAlchemy model
- Applied grants for nordabiz_app user
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added ITCollaborationMatch model to database.py for storing company match pairs:
- company_a_id, company_b_id: Foreign keys to companies table
- match_type: Type of collaboration (shared_licensing, backup_replication, etc.)
- match_reason: Human-readable explanation of the match
- match_score: 0-100 strength score
- status: suggested, contacted, in_progress, completed, declined
- shared_attributes: JSONB for flexible attribute storage
- Helper properties for Polish labels (match_type_label, status_label)
- UniqueConstraint on (company_a_id, company_b_id, match_type)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add 'channel', 'c', 'user', '@' etc. to YouTube exclusion list
- Add 'bold_themes', 'boldthemes' to Twitter/Facebook exclusions (theme creators)
- Fix pattern matching loop to stop after first valid match per platform
- Prevents fallback pattern from overwriting correct channel ID with 'channel'
Fixes issue where youtube.com/channel/ID was being overwritten with
youtube.com/channel/channel by the second fallback pattern.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add detailed logging to SocialMediaAuditor (website scan, Brave search, results)
- Slow down progress bar animation (400ms instead of 200ms) for better readability
- Bold "ZNALEZIONO" text for found platforms
- Display Google rating and review count in progress
- Increase wait time before modal close (4 seconds)
- Add console.log for debugging audit response
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import and use SocialMediaAuditor from scripts/social_media_audit.py
- Audit now scans website HTML for social media links
- Discovers profiles via Brave Search API (if configured)
- Fetches Google Business Profile data via Google Places API
- Saves discovered profiles to database
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add "Uruchom audyt" button to social_audit.html
- Create POST /api/social/audit endpoint to verify profile URLs
- Add loading overlay and modal for audit progress/results
- Audit verifies each social media URL and updates check_status
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create /audit/social/<slug> route with platform presence analysis
- Create social_audit.html template with 6 platforms (FB, IG, LinkedIn, YT, X, TikTok)
- Add purple "Audyt Social" button on company profile next to GBP and SEO audits
- Show score based on platforms count, profile details and recommendations
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create /audit/seo/<slug> route with access control (admin or company owner)
- Create seo_audit.html template with score visualization
- Add green "Audyt SEO" button next to GBP audit button on company profile
- Match styling and UX patterns from GBP audit feature
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show "Google" badge next to each field in progress steps
- Blue badge indicates data comes from Google Places API
- Helps users understand where audit data originates
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add new columns to CompanyWebsiteAnalysis: google_name, google_address,
google_phone, google_website, google_types, google_maps_url
- Update _check_name(), _check_address(), _check_phone(), _check_website(),
_check_categories() to use Google data instead of NordaBiz database
- All audit fields now show real data from Google Business Profile
- Fallback to NordaBiz data only when Google data unavailable
Migration: database/migrations/add_google_gbp_fields.sql
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Clearer breakdown showing:
- What points user already earned (✓)
- What's still pending (○)
- Actionable tip for zero reviews
- Goal reminder for partial scores
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add fetch_google_business_data() to fetch fresh data from Google Places API
- Progress overlay shows all 10 data fields with actual values:
* Place search, Rating, Reviews, Photos, Hours, Phone, Website, Status
- 5-second delay after completion for user to read results
- Fix opening hours display (show formatted weekday_text)
- Fix reviews scoring (integer-based: 3 base + 1/review + 1 bonus)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database migration to support opening hours and photos fields.
Update GBP audit service to properly fetch and validate these fields
from Google Business Profile API. Add comprehensive test coverage.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Verified production health endpoint is running
- Confirmed code implementation is correct:
- gbp_audit_service.py uses google_opening_hours for hours field
- gbp_audit_service.py uses google_photos_count for photos field
- gbp_audit_service.py uses google_rating/google_reviews_count for reviews
- Manual browser verification required (page requires authentication)
- Instructions documented in build-progress.txt
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Migration code complete:
- database/migrations/add_gbp_hours_photos_columns.sql
- run_migration.py helper script
SSH access to production (10.22.68.249) is blocked from sandbox.
User must run the documented command to complete migration.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added a Python migration script that can be run on the production server
to add the google_opening_hours and google_photos_count columns.
Script connects to localhost (127.0.0.1) as required by PostgreSQL config.
Usage on production server:
cd /var/www/nordabiznes && python3 run_migration.py
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Created tests/test_gbp_audit_field_checks.py with comprehensive tests
- Tests verify _check_hours() correctly uses google_opening_hours field
- Tests verify _check_photos() correctly uses google_photos_count field
- Tests cover edge cases: null values, missing analysis, partial data
- All field check logic validated: complete/partial/missing status
- Field weights verified: hours=8, photos=15, total=100
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixed a bug where google_opening_hours and google_photos_count were being
fetched from the Google Places API but not passed through to the result
dictionary correctly:
- Changed 'opening_hours' key to 'google_opening_hours' to match what
save_audit_result() expects
- Added 'google_photos_count' to the result dictionary
Verified with dry-run: INPI company now shows opening hours schedule
and 10 photos count from Google Business Profile.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add database migration script to add google_opening_hours (JSONB) and
google_photos_count (INTEGER) columns to company_website_analysis table.
These columns are needed for storing GBP data from Google Places API:
- google_opening_hours: stores weekday_text, open_now, and periods data
- google_photos_count: stores count of photos from Google Business profile
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed _check_photos method to read from analysis.google_photos_count
instead of total_images. This provides actual GBP photo count rather
than estimated website images.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed _check_hours() in GBP Audit Service to read opening hours from
google_opening_hours field instead of google_business_status. The method
now properly returns the actual hours value when available.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added google_opening_hours and google_photos_count to INSERT column list
- Added corresponding placeholders to VALUES list
- Added to ON CONFLICT UPDATE SET clause
- Added to parameter dictionary reading from google_reviews result
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add google_photos_count to result dictionary initialization
- Extract photos count from API response using len(place['photos'])
- Update logging to include photos count in output
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>