feat: calendar colleagues API uses active company context
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Replace company_id from current_user with active company from session in the colleagues API endpoint, and autofill guest org from active_company. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
762e9a7b4a
commit
026190d740
@ -32,7 +32,7 @@ def index():
|
|||||||
today = date.today()
|
today = date.today()
|
||||||
|
|
||||||
# Parametry widoku
|
# Parametry widoku
|
||||||
view_mode = request.args.get('view', 'list') # list lub grid
|
view_mode = request.args.get('view', 'cards') # cards, list lub grid
|
||||||
year = request.args.get('year', today.year, type=int)
|
year = request.args.get('year', today.year, type=int)
|
||||||
month = request.args.get('month', today.month, type=int)
|
month = request.args.get('month', today.month, type=int)
|
||||||
|
|
||||||
@ -532,14 +532,18 @@ def delete_guest(event_id, guest_id):
|
|||||||
@login_required
|
@login_required
|
||||||
def company_colleagues(event_id):
|
def company_colleagues(event_id):
|
||||||
"""Pobierz listę kolegów z firmy do dropdownu przy dodawaniu gościa"""
|
"""Pobierz listę kolegów z firmy do dropdownu przy dodawaniu gościa"""
|
||||||
if not current_user.company_id:
|
from helpers.company_context import get_active_company_id
|
||||||
|
active_cid = get_active_company_id()
|
||||||
|
if not active_cid:
|
||||||
return jsonify([])
|
return jsonify([])
|
||||||
|
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
from database import User
|
from database import User, UserCompany
|
||||||
colleagues = db.query(User).filter(
|
colleagues = db.query(User).join(
|
||||||
User.company_id == current_user.company_id,
|
UserCompany, UserCompany.user_id == User.id
|
||||||
|
).filter(
|
||||||
|
UserCompany.company_id == active_cid,
|
||||||
User.id != current_user.id,
|
User.id != current_user.id,
|
||||||
User.is_active == True
|
User.is_active == True
|
||||||
).order_by(User.name).all()
|
).order_by(User.name).all()
|
||||||
|
|||||||
@ -922,7 +922,7 @@ function onColleagueSelect() {
|
|||||||
const c = JSON.parse(select.value);
|
const c = JSON.parse(select.value);
|
||||||
document.getElementById('guest-first-name').value = c.first_name || '';
|
document.getElementById('guest-first-name').value = c.first_name || '';
|
||||||
document.getElementById('guest-last-name').value = c.last_name || '';
|
document.getElementById('guest-last-name').value = c.last_name || '';
|
||||||
document.getElementById('guest-org').value = '{{ current_user.company.name|default("", true)|e }}';
|
document.getElementById('guest-org').value = '{{ active_company.name|default(current_user.company.name|default("", true), true)|e }}';
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user