""" 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 utils.decorators import member_required from . import bp @bp.route('/', endpoint='education_index') @login_required @member_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 @member_required def google_reviews_guide(): """Poradnik o opiniach Google dla członków Izby.""" from database import SessionLocal, CompanyWebsiteAnalysis, Company # Get GBP data for the current user's company gbp_data = None company = None if current_user.company_id: db = SessionLocal() try: company = db.get(Company, current_user.company_id) if company: analysis = ( db.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, } finally: db.close() return render_template('education/google_reviews_guide.html', gbp_data=gbp_data, company=company)