nordabiz/blueprints/education/routes.py
Maciej Pienczyn 700382b55d feat: add Google Reviews educational guide at /edukacja/opinie-google
Personalized guide with GBP links (write review, view profile, photos)
for each member's company. Includes tips on collecting reviews,
responding to feedback, Local Guides program, and Google policies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:04:20 +01:00

93 lines
3.4 KiB
Python

"""
Education Routes
================
Platforma Edukacyjna - materiały szkoleniowe dla członków Norda Biznes.
"""
from flask import render_template, url_for
from flask_login import login_required, current_user
from . import bp
@bp.route('/', endpoint='education_index')
@login_required
def index():
"""Strona główna Platformy Edukacyjnej."""
materials = [
{
'id': 1,
'title': 'Wprowadzenie do Norda Biznes Partner',
'description': 'Krótka prezentacja portalu - poznaj główne funkcje i możliwości platformy.',
'type': 'video',
'duration': '30 sek',
'status': 'available',
'video_url': 'videos/nordabiz-zajawka-final.mp4'
},
{
'id': 2,
'title': 'Opinie Google - jak budować reputację firmy',
'description': 'Praktyczny poradnik o opiniach w Google. Dowiedz się, jak zachęcać klientów do wystawiania opinii i jak odpowiadać na recenzje.',
'type': 'guide',
'duration': '12 min czytania',
'status': 'available',
'url': 'education.google_reviews_guide'
},
{
'id': 3,
'title': 'Skuteczny networking w Izbie',
'description': 'Najlepsze praktyki nawiązywania kontaktów biznesowych.',
'type': 'article',
'duration': '10 min czytania',
'status': 'coming_soon'
},
{
'id': 4,
'title': 'Tworzenie atrakcyjnego profilu firmy',
'description': 'Jak uzupełnić profil żeby przyciągnąć partnerów biznesowych.',
'type': 'guide',
'duration': '8 min czytania',
'status': 'coming_soon'
},
]
return render_template('education/index.html', materials=materials)
@bp.route('/opinie-google', endpoint='google_reviews_guide')
@login_required
def google_reviews_guide():
"""Poradnik o opiniach Google dla członków Izby."""
from database import db, CompanyWebsiteAnalysis, Company
# Get GBP data for the current user's company
gbp_data = None
company = None
if current_user.company_id:
company = db.session.get(Company, current_user.company_id)
if company:
analysis = (
db.session.query(CompanyWebsiteAnalysis)
.filter_by(company_id=company.id)
.order_by(CompanyWebsiteAnalysis.analyzed_at.desc())
.first()
)
if analysis and analysis.google_place_id:
links = analysis.google_maps_links or {}
gbp_data = {
'company_name': company.name,
'google_name': analysis.google_name,
'rating': float(analysis.google_rating) if analysis.google_rating else None,
'reviews_count': analysis.google_reviews_count or 0,
'photos_count': analysis.google_photos_count or 0,
'write_review_url': links.get('writeAReviewUri'),
'reviews_url': links.get('reviewsUri'),
'place_url': links.get('placeUri'),
'photos_url': links.get('photosUri'),
'google_maps_url': analysis.google_maps_url,
}
return render_template('education/google_reviews_guide.html',
gbp_data=gbp_data, company=company)