diff --git a/backend/accounts/views.py b/backend/accounts/views.py index 68ec4a82..cc84344e 100644 --- a/backend/accounts/views.py +++ b/backend/accounts/views.py @@ -286,33 +286,61 @@ class AccountDetailView(APIView): account_object.contacts.clear() if data.get("contacts"): - contacts_list = json.loads(data.get("contacts")) + contacts_list = data.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) if contacts: account_object.contacts.add(*contacts) account_object.tags.clear() if data.get("tags"): - tags = json.loads(data.get("tags")) + tags = data.get("tags") + if isinstance(tags, str): + tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) account_object.tags.add(*tag_objs) account_object.teams.clear() if data.get("teams"): - teams_list = json.loads(data.get("teams")) - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + teams_list = data.get("teams") + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) if teams: account_object.teams.add(*teams) account_object.assigned_to.clear() if data.get("assigned_to"): - assigned_to_list = json.loads(data.get("assigned_to")) + assigned_to_list = data.get("assigned_to") + if isinstance(assigned_to_list, str): + assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) if profiles: account_object.assigned_to.add(*profiles) @@ -595,8 +623,13 @@ class AccountDetailView(APIView): if contacts_list: if isinstance(contacts_list, str): contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) account_object.contacts.add(*contacts) @@ -606,8 +639,13 @@ class AccountDetailView(APIView): if tags: if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) account_object.tags.add(*tag_objs) @@ -617,8 +655,13 @@ class AccountDetailView(APIView): if teams_list: if isinstance(teams_list, str): teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] teams = Teams.objects.filter( - id__in=teams_list, org=request.profile.org + id__in=team_ids, org=request.profile.org ) account_object.teams.add(*teams) @@ -628,8 +671,13 @@ class AccountDetailView(APIView): if assigned_to_list: if isinstance(assigned_to_list, str): assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) account_object.assigned_to.add(*profiles) diff --git a/backend/cases/views.py b/backend/cases/views.py index 1169a9e8..89f24ded 100644 --- a/backend/cases/views.py +++ b/backend/cases/views.py @@ -171,22 +171,43 @@ class CaseListView(APIView, LimitOffsetPagination): if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) if contacts: cases_obj.contacts.add(*contacts) if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) if teams.exists(): cases_obj.teams.add(*teams) if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) if profiles: cases_obj.assigned_to.add(*profiles) @@ -195,8 +216,13 @@ class CaseListView(APIView, LimitOffsetPagination): tags = params.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) cases_obj.tags.add(*tag_objs) @@ -290,8 +316,15 @@ class CaseDetailView(APIView): cases_object.contacts.clear() if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) if contacts: cases_object.contacts.add(*contacts) @@ -299,15 +332,29 @@ class CaseDetailView(APIView): cases_object.teams.clear() if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) if teams.exists(): cases_object.teams.add(*teams) cases_object.assigned_to.clear() if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) if profiles: cases_object.assigned_to.add(*profiles) @@ -317,8 +364,13 @@ class CaseDetailView(APIView): tags = params.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) cases_object.tags.add(*tag_objs) @@ -617,8 +669,15 @@ class CaseDetailView(APIView): cases_object.contacts.clear() contacts_list = params.get("contacts") if contacts_list: + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) cases_object.contacts.add(*contacts) @@ -626,8 +685,15 @@ class CaseDetailView(APIView): cases_object.teams.clear() teams_list = params.get("teams") if teams_list: + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] teams = Teams.objects.filter( - id__in=teams_list, org=request.profile.org + id__in=team_ids, org=request.profile.org ) cases_object.teams.add(*teams) @@ -635,8 +701,15 @@ class CaseDetailView(APIView): cases_object.assigned_to.clear() assigned_to_list = params.get("assigned_to") if assigned_to_list: + if isinstance(assigned_to_list, str): + assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) cases_object.assigned_to.add(*profiles) @@ -646,8 +719,13 @@ class CaseDetailView(APIView): if tags_list: if isinstance(tags_list, str): tags_list = json.loads(tags_list) + # Extract IDs if tags_list contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags_list + ] tag_objs = Tags.objects.filter( - id__in=tags_list, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) cases_object.tags.add(*tag_objs) diff --git a/backend/common/serializer.py b/backend/common/serializer.py index c2baba95..9f91dfa0 100644 --- a/backend/common/serializer.py +++ b/backend/common/serializer.py @@ -54,6 +54,13 @@ class OrgAwareRefreshToken(RefreshToken): """ token = cls.for_user(user) + # Add user info to token (avoids extra API calls for display) + if user: + token["user_email"] = user.email + # Build display name from email (User model doesn't have first/last name) + token["user_name"] = user.email.split("@")[0] if user.email else "" + token["user_profile_pic"] = user.profile_pic or "" + # Add org context to the token payload if org: org_id = str(org.id) if hasattr(org, "id") else str(org) diff --git a/backend/common/views/auth_views.py b/backend/common/views/auth_views.py index e94ff356..7c20f251 100644 --- a/backend/common/views/auth_views.py +++ b/backend/common/views/auth_views.py @@ -132,8 +132,8 @@ class GoogleOAuthCallbackView(APIView): user.last_login = timezone.now() user.save(update_fields=["last_login"]) - # Generate JWT tokens - token = RefreshToken.for_user(user) + # Generate JWT tokens (with user info embedded) + token = OrgAwareRefreshToken.for_user_and_org(user, None) return Response( { @@ -219,8 +219,8 @@ class LoginView(APIView): user, default_org, profile ) else: - # User has no orgs - generate token without org context - token = RefreshToken.for_user(user) + # User has no orgs - generate token without org context (but with user info) + token = OrgAwareRefreshToken.for_user_and_org(user, None) # Audit log successful login audit_log.login_success(user, default_org, request) @@ -387,8 +387,8 @@ class OrgAwareTokenRefreshView(APIView): new_token = OrgAwareRefreshToken.for_user_and_org(user, org, profile) audit_log.token_refresh(user, org, request) else: - # No org context - standard refresh - new_token = BaseRefreshToken.for_user(user) + # No org context - refresh with user info only + new_token = OrgAwareRefreshToken.for_user_and_org(user, None) audit_log.token_refresh(user, None, request) return Response( diff --git a/backend/common/views/document_views.py b/backend/common/views/document_views.py index 050afb3b..ed2cb4b5 100644 --- a/backend/common/views/document_views.py +++ b/backend/common/views/document_views.py @@ -164,14 +164,28 @@ class DocumentListView(APIView, LimitOffsetPagination): ) if params.get("shared_to"): assinged_to_list = params.get("shared_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) if profiles: doc.shared_to.add(*profiles) if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) if teams: doc.teams.add(*teams) @@ -333,8 +347,15 @@ class DocumentDetailView(APIView): doc.shared_to.clear() if params.get("shared_to"): assinged_to_list = params.get("shared_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) if profiles: doc.shared_to.add(*profiles) @@ -342,7 +363,14 @@ class DocumentDetailView(APIView): doc.teams.clear() if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) if teams: doc.teams.add(*teams) return Response( diff --git a/backend/contacts/views.py b/backend/contacts/views.py index b9a1f054..f8cb807a 100644 --- a/backend/contacts/views.py +++ b/backend/contacts/views.py @@ -157,13 +157,27 @@ class ContactsListView(APIView, LimitOffsetPagination): if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) contact_obj.teams.add(*teams) if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) contact_obj.assigned_to.add(*profiles) @@ -171,8 +185,13 @@ class ContactsListView(APIView, LimitOffsetPagination): tags = params.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) contact_obj.tags.add(*tag_objs) @@ -252,15 +271,29 @@ class ContactDetailView(APIView): contact_obj = contact_serializer.save() contact_obj.teams.clear() if data.get("teams"): - teams_list = json.loads(data.get("teams")) - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + teams_list = data.get("teams") + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) contact_obj.teams.add(*teams) contact_obj.assigned_to.clear() if data.get("assigned_to"): - assinged_to_list = json.loads(data.get("assigned_to")) + assinged_to_list = data.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) contact_obj.assigned_to.add(*profiles) @@ -269,8 +302,13 @@ class ContactDetailView(APIView): tags = data.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) contact_obj.tags.add(*tag_objs) @@ -566,7 +604,12 @@ class ContactDetailView(APIView): if teams_list: if isinstance(teams_list, str): teams_list = json.loads(teams_list) - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) contact_obj.teams.add(*teams) if "assigned_to" in data: @@ -575,8 +618,13 @@ class ContactDetailView(APIView): if assigned_to_list: if isinstance(assigned_to_list, str): assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) contact_obj.assigned_to.add(*profiles) @@ -586,8 +634,13 @@ class ContactDetailView(APIView): if tags_list: if isinstance(tags_list, str): tags_list = json.loads(tags_list) + # Extract IDs if tags_list contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags_list + ] tag_objs = Tags.objects.filter( - id__in=tags_list, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) contact_obj.tags.add(*tag_objs) diff --git a/backend/leads/views/lead_views.py b/backend/leads/views/lead_views.py index 098d6a11..88c49f42 100644 --- a/backend/leads/views/lead_views.py +++ b/backend/leads/views/lead_views.py @@ -247,13 +247,27 @@ class LeadListView(APIView, LimitOffsetPagination): if data.get("teams", None): teams_list = data.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) lead_obj.teams.add(*teams) if data.get("assigned_to", None): assinged_to_list = data.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) lead_obj.assigned_to.add(*profiles) @@ -578,22 +592,44 @@ class LeadDetailView(APIView): lead_obj.contacts.clear() if params.get("contacts"): + contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] obj_contact = Contact.objects.filter( - id__in=params.get("contacts"), org=request.profile.org + id__in=contact_ids, org=request.profile.org ) lead_obj.contacts.add(*obj_contact) lead_obj.teams.clear() if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) lead_obj.teams.add(*teams) lead_obj.assigned_to.clear() if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) lead_obj.assigned_to.add(*profiles) @@ -714,8 +750,15 @@ class LeadDetailView(APIView): lead_obj.tags.clear() tags = params.get("tags") if tags: + if isinstance(tags, str): + tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) lead_obj.tags.add(*tag_objs) @@ -723,8 +766,15 @@ class LeadDetailView(APIView): lead_obj.contacts.clear() contacts_list = params.get("contacts") if contacts_list: + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] obj_contact = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) lead_obj.contacts.add(*obj_contact) @@ -732,8 +782,15 @@ class LeadDetailView(APIView): lead_obj.teams.clear() teams_list = params.get("teams") if teams_list: + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] teams = Teams.objects.filter( - id__in=teams_list, org=request.profile.org + id__in=team_ids, org=request.profile.org ) lead_obj.teams.add(*teams) @@ -741,8 +798,15 @@ class LeadDetailView(APIView): lead_obj.assigned_to.clear() assigned_to_list = params.get("assigned_to") if assigned_to_list: + if isinstance(assigned_to_list, str): + assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org + id__in=assigned_ids, org=request.profile.org ) lead_obj.assigned_to.add(*profiles) diff --git a/backend/opportunity/views/opportunity_views.py b/backend/opportunity/views/opportunity_views.py index 81ad3af0..3a181621 100644 --- a/backend/opportunity/views/opportunity_views.py +++ b/backend/opportunity/views/opportunity_views.py @@ -177,15 +177,29 @@ class OpportunityListView(APIView, LimitOffsetPagination): if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) opportunity_obj.contacts.add(*contacts) if params.get("tags"): tags = params.get("tags") + if isinstance(tags, str): + tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) opportunity_obj.tags.add(*tag_objs) @@ -196,13 +210,27 @@ class OpportunityListView(APIView, LimitOffsetPagination): if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) opportunity_obj.teams.add(*teams) if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) opportunity_obj.assigned_to.add(*profiles) @@ -294,16 +322,30 @@ class OpportunityDetailView(APIView): opportunity_object.contacts.clear() if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) opportunity_object.contacts.add(*contacts) opportunity_object.tags.clear() if params.get("tags"): tags = params.get("tags") + if isinstance(tags, str): + tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) opportunity_object.tags.add(*tag_objs) @@ -315,14 +357,28 @@ class OpportunityDetailView(APIView): opportunity_object.teams.clear() if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) opportunity_object.teams.add(*teams) opportunity_object.assigned_to.clear() if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) opportunity_object.assigned_to.add(*profiles) @@ -626,8 +682,15 @@ class OpportunityDetailView(APIView): opportunity_object.contacts.clear() contacts_list = params.get("contacts") if contacts_list: + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) opportunity_object.contacts.add(*contacts) @@ -635,8 +698,15 @@ class OpportunityDetailView(APIView): opportunity_object.tags.clear() tags = params.get("tags") if tags: + if isinstance(tags, str): + tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) opportunity_object.tags.add(*tag_objs) @@ -644,8 +714,15 @@ class OpportunityDetailView(APIView): opportunity_object.teams.clear() teams_list = params.get("teams") if teams_list: + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] teams = Teams.objects.filter( - id__in=teams_list, org=request.profile.org + id__in=team_ids, org=request.profile.org ) opportunity_object.teams.add(*teams) @@ -653,8 +730,15 @@ class OpportunityDetailView(APIView): opportunity_object.assigned_to.clear() assigned_to_list = params.get("assigned_to") if assigned_to_list: + if isinstance(assigned_to_list, str): + assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) opportunity_object.assigned_to.add(*profiles) diff --git a/backend/tasks/views/task_views.py b/backend/tasks/views/task_views.py index 97518386..4f87146e 100644 --- a/backend/tasks/views/task_views.py +++ b/backend/tasks/views/task_views.py @@ -168,20 +168,41 @@ class TaskListView(APIView, LimitOffsetPagination): ) if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) task_obj.contacts.add(*contacts) if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) task_obj.teams.add(*teams) if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) task_obj.assigned_to.add(*profiles) @@ -189,8 +210,13 @@ class TaskListView(APIView, LimitOffsetPagination): tags = params.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) task_obj.tags.add(*tag_objs) @@ -450,22 +476,43 @@ class TaskDetailView(APIView): task_obj.contacts.clear() if params.get("contacts"): contacts_list = params.get("contacts") + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) task_obj.contacts.add(*contacts) task_obj.teams.clear() if params.get("teams"): teams_list = params.get("teams") - teams = Teams.objects.filter(id__in=teams_list, org=request.profile.org) + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] + teams = Teams.objects.filter(id__in=team_ids, org=request.profile.org) task_obj.teams.add(*teams) task_obj.assigned_to.clear() if params.get("assigned_to"): assinged_to_list = params.get("assigned_to") + if isinstance(assinged_to_list, str): + assinged_to_list = json.loads(assinged_to_list) + # Extract IDs if assinged_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assinged_to_list + ] profiles = Profile.objects.filter( - id__in=assinged_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) task_obj.assigned_to.add(*profiles) @@ -474,8 +521,13 @@ class TaskDetailView(APIView): tags = params.get("tags") if isinstance(tags, str): tags = json.loads(tags) + # Extract IDs if tags contains objects with 'id' field + tag_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in tags + ] tag_objs = Tags.objects.filter( - id__in=tags, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) task_obj.tags.add(*tag_objs) @@ -567,8 +619,15 @@ class TaskDetailView(APIView): task_obj.contacts.clear() contacts_list = params.get("contacts") if contacts_list: + if isinstance(contacts_list, str): + contacts_list = json.loads(contacts_list) + # Extract IDs if contacts_list contains objects with 'id' field + contact_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in contacts_list + ] contacts = Contact.objects.filter( - id__in=contacts_list, org=request.profile.org + id__in=contact_ids, org=request.profile.org ) task_obj.contacts.add(*contacts) @@ -576,8 +635,15 @@ class TaskDetailView(APIView): task_obj.teams.clear() teams_list = params.get("teams") if teams_list: + if isinstance(teams_list, str): + teams_list = json.loads(teams_list) + # Extract IDs if teams_list contains objects with 'id' field + team_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in teams_list + ] teams = Teams.objects.filter( - id__in=teams_list, org=request.profile.org + id__in=team_ids, org=request.profile.org ) task_obj.teams.add(*teams) @@ -585,8 +651,15 @@ class TaskDetailView(APIView): task_obj.assigned_to.clear() assigned_to_list = params.get("assigned_to") if assigned_to_list: + if isinstance(assigned_to_list, str): + assigned_to_list = json.loads(assigned_to_list) + # Extract IDs if assigned_to_list contains objects with 'id' field + assigned_ids = [ + item.get("id") if isinstance(item, dict) else item + for item in assigned_to_list + ] profiles = Profile.objects.filter( - id__in=assigned_to_list, org=request.profile.org, is_active=True + id__in=assigned_ids, org=request.profile.org, is_active=True ) task_obj.assigned_to.add(*profiles) @@ -596,8 +669,13 @@ class TaskDetailView(APIView): if tags_list: if isinstance(tags_list, str): tags_list = json.loads(tags_list) + # Extract IDs if tags_list contains objects with 'id' field + tag_ids = [ + tag.get("id") if isinstance(tag, dict) else tag + for tag in tags_list + ] tag_objs = Tags.objects.filter( - id__in=tags_list, org=request.profile.org, is_active=True + id__in=tag_ids, org=request.profile.org, is_active=True ) task_obj.tags.add(*tag_objs) diff --git a/frontend/src/app.css b/frontend/src/app.css index e899af15..b9009c5b 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -4,88 +4,133 @@ @custom-variant dark (&:is(.dark *)); +/* ═══════════════════════════════════════════════════════════════════════════ + OBSIDIAN LUXE - Premium Dark-First CRM Design System + A sophisticated aesthetic with vivid accents and glass-morphism effects + ═══════════════════════════════════════════════════════════════════════════ */ + +/* Google Fonts Import - Plus Jakarta Sans (geometric, modern) */ +@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,500&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap'); + :root { /* Base radius for components */ - --radius: 0.5rem; + --radius: 0.625rem; - /* shadcn color tokens (Neutral base) */ - --background: oklch(1 0 0); - --foreground: oklch(0.145 0 0); + /* ───────────────────────────────────────────────────────────────────────── + LIGHT MODE - Clean, airy with subtle warmth + ───────────────────────────────────────────────────────────────────────── */ + + /* Core surfaces */ + --background: oklch(0.985 0.002 250); + --foreground: oklch(0.15 0.02 260); --card: oklch(1 0 0); - --card-foreground: oklch(0.145 0 0); + --card-foreground: oklch(0.15 0.02 260); --popover: oklch(1 0 0); - --popover-foreground: oklch(0.145 0 0); - --primary: oklch(0.205 0 0); - --primary-foreground: oklch(0.985 0 0); - --secondary: oklch(0.97 0 0); - --secondary-foreground: oklch(0.205 0 0); - --muted: oklch(0.97 0 0); - --muted-foreground: oklch(0.556 0 0); - --accent: oklch(0.97 0 0); - --accent-foreground: oklch(0.205 0 0); - --destructive: oklch(0.577 0.245 27.325); - --border: oklch(0.922 0 0); - --input: oklch(0.922 0 0); - --ring: oklch(0.708 0 0); + --popover-foreground: oklch(0.15 0.02 260); - /* Chart colors */ - --chart-1: oklch(0.646 0.222 41.116); - --chart-2: oklch(0.6 0.118 184.704); - --chart-3: oklch(0.398 0.07 227.392); - --chart-4: oklch(0.828 0.189 84.429); - --chart-5: oklch(0.769 0.188 70.08); + /* Primary - Deep teal */ + --primary: oklch(0.55 0.15 195); + --primary-foreground: oklch(0.98 0 0); - /* Sidebar colors */ - --sidebar: oklch(0.985 0 0); - --sidebar-foreground: oklch(0.145 0 0); - --sidebar-primary: oklch(0.205 0 0); - --sidebar-primary-foreground: oklch(0.985 0 0); - --sidebar-accent: oklch(0.97 0 0); - --sidebar-accent-foreground: oklch(0.205 0 0); - --sidebar-border: oklch(0.922 0 0); - --sidebar-ring: oklch(0.708 0 0); + /* Secondary */ + --secondary: oklch(0.96 0.01 250); + --secondary-foreground: oklch(0.25 0.02 260); + + /* Muted */ + --muted: oklch(0.96 0.005 250); + --muted-foreground: oklch(0.45 0.02 260); + + /* Accent - Warm amber */ + --accent: oklch(0.96 0.02 80); + --accent-foreground: oklch(0.25 0.05 80); + + /* Destructive */ + --destructive: oklch(0.55 0.22 25); + + /* Borders & inputs */ + --border: oklch(0.91 0.005 250); + --input: oklch(0.91 0.005 250); + --ring: oklch(0.55 0.15 195); + + /* Chart colors - Vibrant palette */ + --chart-1: oklch(0.65 0.18 195); + --chart-2: oklch(0.7 0.16 145); + --chart-3: oklch(0.75 0.15 80); + --chart-4: oklch(0.6 0.2 280); + --chart-5: oklch(0.65 0.2 350); + + /* Sidebar - HubSpot Style Light */ + --sidebar: oklch(0.995 0 0); + --sidebar-foreground: oklch(0.25 0.02 250); + --sidebar-primary: oklch(0.62 0.2 25); + --sidebar-primary-foreground: oklch(0.995 0 0); + --sidebar-accent: oklch(0.97 0.005 250); + --sidebar-accent-foreground: oklch(0.2 0.02 250); + --sidebar-border: oklch(0.94 0.005 250); + --sidebar-ring: oklch(0.62 0.2 25); + + /* HubSpot Brand Colors */ + --hubspot-orange: #ff7a59; + --hubspot-orange-hover: #ff5c35; + --hubspot-orange-light: #fff1ee; + --hubspot-navy: #2d3e50; + --hubspot-navy-light: #516f90; + --hubspot-teal: #00bda5; + --hubspot-teal-light: #e5f8f6; + + /* ───────────────────────────────────────────────────────────────────────── + SEMANTIC LAYERS + ───────────────────────────────────────────────────────────────────────── */ /* Background Layers */ - --bg-base: #ffffff; - --bg-subtle: #fafafa; - --bg-muted: #f5f5f5; - --bg-emphasis: #ededed; + --bg-base: #fafbfc; + --bg-subtle: #f4f6f8; + --bg-muted: #eef1f4; + --bg-emphasis: #e4e8ec; /* Border Colors */ - --border-default: #e5e5e5; - --border-strong: #d4d4d4; - --border-subtle: #f0f0f0; + --border-default: #e2e6eb; + --border-strong: #c9d0d8; + --border-subtle: #f0f2f5; /* Text Colors */ - --text-primary: #171717; - --text-secondary: #525252; - --text-tertiary: #a3a3a3; + --text-primary: #0f172a; + --text-secondary: #475569; + --text-tertiary: #94a3b8; --text-inverse: #ffffff; - /* Accent Colors */ - --accent-primary: #2563eb; - --accent-primary-hover: #1d4ed8; - --accent-primary-subtle: #eff6ff; + /* Accent Colors - Teal/Cyan primary */ + --accent-primary: #0891b2; + --accent-primary-hover: #0e7490; + --accent-primary-subtle: #ecfeff; + + /* Secondary Accent - Warm Amber */ + --accent-secondary: #f59e0b; + --accent-secondary-hover: #d97706; + --accent-secondary-subtle: #fffbeb; /* Status Colors */ - --status-success: #16a34a; - --status-success-bg: #f0fdf4; - --status-warning: #ca8a04; - --status-warning-bg: #fefce8; + --status-success: #059669; + --status-success-bg: #ecfdf5; + --status-warning: #d97706; + --status-warning-bg: #fffbeb; --status-danger: #dc2626; --status-danger-bg: #fef2f2; - --status-info: #0284c7; - --status-info-bg: #f0f9ff; + --status-info: #0891b2; + --status-info-bg: #ecfeff; - /* Stage Colors (Pipeline) */ - --stage-prospecting: #6b7280; - --stage-qualified: #2563eb; - --stage-proposal: #7c3aed; - --stage-negotiation: #ea580c; - --stage-won: #16a34a; + /* Stage Colors (Pipeline) - Refined palette */ + --stage-prospecting: #64748b; + --stage-qualified: #0891b2; + --stage-proposal: #8b5cf6; + --stage-negotiation: #f59e0b; + --stage-won: #059669; --stage-lost: #dc2626; - /* Spacing Scale (4px base) */ + /* ───────────────────────────────────────────────────────────────────────── + SPACING & LAYOUT + ───────────────────────────────────────────────────────────────────────── */ + --space-0: 0px; --space-1: 4px; --space-2: 8px; @@ -97,11 +142,12 @@ --space-10: 40px; --space-12: 48px; - /* Border Radius */ - --radius-sm: 4px; - --radius-md: 6px; - --radius-lg: 8px; - --radius-xl: 12px; + /* Border Radius - Slightly larger for premium feel */ + --radius-sm: 6px; + --radius-md: 8px; + --radius-lg: 12px; + --radius-xl: 16px; + --radius-2xl: 20px; --radius-full: 9999px; /* Z-Index Layers */ @@ -114,81 +160,149 @@ --z-toast: 80; --z-tooltip: 90; - /* Animation Timing */ - --ease-out: cubic-bezier(0, 0, 0.2, 1); - --ease-in: cubic-bezier(0.4, 0, 1, 1); - --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); - --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275); + /* Animation Timing - Refined easing */ + --ease-out: cubic-bezier(0.16, 1, 0.3, 1); + --ease-in: cubic-bezier(0.7, 0, 0.84, 0); + --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); + --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); + --ease-bounce: cubic-bezier(0.68, -0.6, 0.32, 1.6); /* Animation Durations */ --duration-instant: 0ms; - --duration-fast: 100ms; + --duration-fast: 120ms; --duration-normal: 200ms; - --duration-slow: 300ms; - --duration-slower: 400ms; + --duration-slow: 350ms; + --duration-slower: 500ms; /* Layout Dimensions */ - --sidebar-width: 240px; - --sidebar-width-collapsed: 64px; - --drawer-width: 480px; - --header-height: 56px; - --content-padding: 24px; - --content-max-width: 1200px; + --sidebar-width: 260px; + --sidebar-width-collapsed: 72px; + --drawer-width: 520px; + --header-height: 60px; + --content-padding: 28px; + --content-max-width: 1400px; /* Typography */ - --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + --font-sans: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + --font-body: 'DM Sans', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --font-mono: 'JetBrains Mono', 'Fira Code', monospace; + + /* Glass morphism properties */ + --glass-bg: rgba(255, 255, 255, 0.8); + --glass-border: rgba(255, 255, 255, 0.3); + --glass-blur: 12px; } -/* Dark Mode */ +/* ═══════════════════════════════════════════════════════════════════════════ + DARK MODE - Obsidian Luxe + Deep, rich darks with vivid accent colors and subtle glow effects + ═══════════════════════════════════════════════════════════════════════════ */ + .dark { - /* shadcn dark mode colors */ - --background: oklch(0.145 0 0); - --foreground: oklch(0.985 0 0); - --card: oklch(0.205 0 0); - --card-foreground: oklch(0.985 0 0); - --popover: oklch(0.269 0 0); - --popover-foreground: oklch(0.985 0 0); - --primary: oklch(0.922 0 0); - --primary-foreground: oklch(0.205 0 0); - --secondary: oklch(0.269 0 0); - --secondary-foreground: oklch(0.985 0 0); - --muted: oklch(0.269 0 0); - --muted-foreground: oklch(0.708 0 0); - --accent: oklch(0.371 0 0); - --accent-foreground: oklch(0.985 0 0); - --destructive: oklch(0.704 0.191 22.216); - --border: oklch(1 0 0 / 10%); - --input: oklch(1 0 0 / 15%); - --ring: oklch(0.556 0 0); - --chart-1: oklch(0.488 0.243 264.376); - --chart-2: oklch(0.696 0.17 162.48); - --chart-3: oklch(0.769 0.188 70.08); - --chart-4: oklch(0.627 0.265 303.9); - --chart-5: oklch(0.645 0.246 16.439); - --sidebar: oklch(0.205 0 0); - --sidebar-foreground: oklch(0.985 0 0); - --sidebar-primary: oklch(0.488 0.243 264.376); - --sidebar-primary-foreground: oklch(0.985 0 0); - --sidebar-accent: oklch(0.269 0 0); - --sidebar-accent-foreground: oklch(0.985 0 0); - --sidebar-border: oklch(1 0 0 / 10%); - --sidebar-ring: oklch(0.439 0 0); + /* Core surfaces - Deep obsidian with subtle blue undertone */ + --background: oklch(0.12 0.015 260); + --foreground: oklch(0.95 0.005 250); + --card: oklch(0.16 0.015 260); + --card-foreground: oklch(0.95 0.005 250); + --popover: oklch(0.18 0.018 260); + --popover-foreground: oklch(0.95 0.005 250); - /* BottleCRM dark mode overrides */ - --bg-base: #191919; - --bg-subtle: #212121; - --bg-muted: #2a2a2a; - --bg-emphasis: #333333; - --border-default: #333333; - --border-strong: #404040; - --border-subtle: #262626; - --text-primary: #fafafa; - --text-secondary: #a3a3a3; - --text-tertiary: #737373; + /* Primary - Vivid cyan */ + --primary: oklch(0.75 0.16 195); + --primary-foreground: oklch(0.12 0.015 260); + + /* Secondary */ + --secondary: oklch(0.22 0.015 260); + --secondary-foreground: oklch(0.92 0.005 250); + + /* Muted */ + --muted: oklch(0.22 0.012 260); + --muted-foreground: oklch(0.65 0.01 260); + + /* Accent - Amber glow */ + --accent: oklch(0.25 0.04 80); + --accent-foreground: oklch(0.85 0.12 80); + + /* Destructive */ + --destructive: oklch(0.65 0.2 25); + + /* Borders & inputs - Subtle with glow potential */ + --border: oklch(0.28 0.015 260); + --input: oklch(0.24 0.015 260); + --ring: oklch(0.7 0.14 195); + + /* Chart colors - Vibrant neon-ish */ + --chart-1: oklch(0.75 0.18 195); + --chart-2: oklch(0.72 0.18 155); + --chart-3: oklch(0.78 0.15 85); + --chart-4: oklch(0.7 0.2 290); + --chart-5: oklch(0.72 0.2 10); + + /* Sidebar - HubSpot Style Dark */ + --sidebar: oklch(0.16 0.015 250); + --sidebar-foreground: oklch(0.92 0.005 250); + --sidebar-primary: oklch(0.7 0.18 25); + --sidebar-primary-foreground: oklch(0.12 0.015 260); + --sidebar-accent: oklch(0.22 0.02 250); + --sidebar-accent-foreground: oklch(0.92 0.005 250); + --sidebar-border: oklch(0.28 0.015 250); + --sidebar-ring: oklch(0.7 0.18 25); + + /* Background Layers - Obsidian depth */ + --bg-base: #0c0d12; + --bg-subtle: #121318; + --bg-muted: #181a21; + --bg-emphasis: #1f222b; + + /* Border Colors */ + --border-default: #262a36; + --border-strong: #363b4a; + --border-subtle: #1c1f28; + + /* Text Colors */ + --text-primary: #f1f5f9; + --text-secondary: #94a3b8; + --text-tertiary: #64748b; + --text-inverse: #0c0d12; + + /* Accent Colors - Cyan glow */ + --accent-primary: #22d3ee; + --accent-primary-hover: #06b6d4; + --accent-primary-subtle: rgba(34, 211, 238, 0.1); + + /* Secondary Accent - Warm Amber */ + --accent-secondary: #fbbf24; + --accent-secondary-hover: #f59e0b; + --accent-secondary-subtle: rgba(251, 191, 36, 0.1); + + /* Status Colors - Vivid in dark */ + --status-success: #34d399; + --status-success-bg: rgba(52, 211, 153, 0.12); + --status-warning: #fbbf24; + --status-warning-bg: rgba(251, 191, 36, 0.12); + --status-danger: #f87171; + --status-danger-bg: rgba(248, 113, 113, 0.12); + --status-info: #22d3ee; + --status-info-bg: rgba(34, 211, 238, 0.12); + + /* Stage Colors - Neon variants */ + --stage-prospecting: #94a3b8; + --stage-qualified: #22d3ee; + --stage-proposal: #a78bfa; + --stage-negotiation: #fbbf24; + --stage-won: #34d399; + --stage-lost: #f87171; + + /* Glass morphism - Dark variant */ + --glass-bg: rgba(18, 19, 24, 0.8); + --glass-border: rgba(255, 255, 255, 0.08); + --glass-blur: 16px; } -/* Tailwind theme inline configuration */ +/* ═══════════════════════════════════════════════════════════════════════════ + TAILWIND THEME INTEGRATION + ═══════════════════════════════════════════════════════════════════════════ */ + @theme inline { --radius-sm: calc(var(--radius) - 4px); --radius-md: calc(var(--radius) - 2px); @@ -227,14 +341,304 @@ --color-sidebar-ring: var(--sidebar-ring); } -/* Base layer styles */ +/* ═══════════════════════════════════════════════════════════════════════════ + BASE STYLES + ═══════════════════════════════════════════════════════════════════════════ */ + @layer base { * { @apply border-border outline-ring/50; } + html { + font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11'; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + body { @apply bg-background text-foreground; font-family: var(--font-sans); + letter-spacing: -0.01em; + } + + /* Refined scrollbar */ + ::-webkit-scrollbar { + width: 8px; + height: 8px; + } + + ::-webkit-scrollbar-track { + background: transparent; + } + + ::-webkit-scrollbar-thumb { + background: var(--border-strong); + border-radius: var(--radius-full); + border: 2px solid transparent; + background-clip: content-box; + } + + ::-webkit-scrollbar-thumb:hover { + background: var(--text-tertiary); + border: 2px solid transparent; + background-clip: content-box; + } + + /* Selection styling */ + ::selection { + background: var(--accent-primary); + color: var(--text-inverse); } } + +/* ═══════════════════════════════════════════════════════════════════════════ + UTILITY CLASSES - Premium Effects + ═══════════════════════════════════════════════════════════════════════════ */ + +@layer utilities { + /* Glass morphism card */ + .glass-card { + background: var(--glass-bg); + backdrop-filter: blur(var(--glass-blur)); + -webkit-backdrop-filter: blur(var(--glass-blur)); + border: 1px solid var(--glass-border); + } + + /* Glow effects */ + .glow-sm { + box-shadow: 0 0 15px -3px var(--accent-primary); + } + + .glow-md { + box-shadow: 0 0 25px -5px var(--accent-primary); + } + + .glow-lg { + box-shadow: 0 0 40px -8px var(--accent-primary); + } + + /* Gradient text */ + .text-gradient { + background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + } + + /* Subtle noise texture overlay */ + .noise-overlay { + position: relative; + } + + .noise-overlay::before { + content: ''; + position: absolute; + inset: 0; + background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E"); + opacity: 0.03; + pointer-events: none; + mix-blend-mode: overlay; + } + + .dark .noise-overlay::before { + opacity: 0.04; + } + + /* Gradient mesh background */ + .gradient-mesh { + background: + radial-gradient(at 40% 20%, var(--accent-primary-subtle) 0px, transparent 50%), + radial-gradient(at 80% 0%, var(--accent-secondary-subtle) 0px, transparent 50%), + radial-gradient(at 0% 50%, var(--accent-primary-subtle) 0px, transparent 50%), + radial-gradient(at 80% 80%, var(--accent-secondary-subtle) 0px, transparent 50%), + var(--background); + } + + /* Animated border gradient */ + .border-gradient { + position: relative; + background: var(--card); + border-radius: var(--radius-lg); + } + + .border-gradient::before { + content: ''; + position: absolute; + inset: 0; + padding: 1px; + border-radius: inherit; + background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary)); + background-size: 200% 200%; + -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); + mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); + -webkit-mask-composite: xor; + mask-composite: exclude; + animation: border-rotate 4s linear infinite; + } + + @keyframes border-rotate { + 0% { background-position: 0% 0%; } + 100% { background-position: 200% 200%; } + } + + /* Shimmer loading effect */ + .shimmer { + background: linear-gradient( + 90deg, + var(--muted) 0%, + var(--bg-emphasis) 50%, + var(--muted) 100% + ); + background-size: 200% 100%; + animation: shimmer 1.5s ease-in-out infinite; + } + + @keyframes shimmer { + 0% { background-position: 200% 0; } + 100% { background-position: -200% 0; } + } + + /* Smooth fade in animation */ + .animate-in-up { + animation: fade-in-up 0.4s var(--ease-out) forwards; + } + + @keyframes fade-in-up { + from { + opacity: 0; + transform: translateY(10px); + } + to { + opacity: 1; + transform: translateY(0); + } + } + + /* Staggered animation delays */ + .stagger-1 { animation-delay: 50ms; } + .stagger-2 { animation-delay: 100ms; } + .stagger-3 { animation-delay: 150ms; } + .stagger-4 { animation-delay: 200ms; } + .stagger-5 { animation-delay: 250ms; } + .stagger-6 { animation-delay: 300ms; } + + /* Hover lift effect */ + .hover-lift { + transition: transform var(--duration-normal) var(--ease-out), + box-shadow var(--duration-normal) var(--ease-out); + } + + .hover-lift:hover { + transform: translateY(-2px); + box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), + 0 4px 10px -3px rgba(0, 0, 0, 0.05); + } + + .dark .hover-lift:hover { + box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.4), + 0 0 20px -5px var(--accent-primary-subtle); + } + + /* Premium card style */ + .premium-card { + @apply glass-card rounded-xl; + transition: all var(--duration-normal) var(--ease-out); + } + + .premium-card:hover { + border-color: var(--border-strong); + } + + .dark .premium-card:hover { + border-color: var(--accent-primary); + box-shadow: 0 0 30px -10px var(--accent-primary); + } +} + +/* ═══════════════════════════════════════════════════════════════════════════ + COMPONENT OVERRIDES + ═══════════════════════════════════════════════════════════════════════════ */ + +/* Card refinements */ +[data-slot="card"] { + transition: all var(--duration-normal) var(--ease-out); +} + +/* Button refinements */ +button, [role="button"] { + font-family: var(--font-sans); + font-weight: 500; + letter-spacing: -0.01em; +} + +/* Input refinements */ +input, textarea, select { + font-family: var(--font-body); +} + +/* Badge refinements */ +[data-slot="badge"] { + font-weight: 600; + letter-spacing: 0.02em; +} + +/* ═══════════════════════════════════════════════════════════════════════════ + HUBSPOT-STYLE SIDEBAR ENHANCEMENTS + ═══════════════════════════════════════════════════════════════════════════ */ + +/* Sidebar base styling */ +[data-slot="sidebar"] { + transition: width 0.2s ease, transform 0.2s ease; +} + +/* HubSpot-style menu button refinements */ +[data-slot="sidebar-menu-button"] { + letter-spacing: -0.01em; +} + +/* HubSpot-style active state with left accent bar */ +[data-slot="sidebar-menu-button"][data-active="true"] { + position: relative; +} + +/* Smooth hover transitions */ +[data-slot="sidebar-menu-button"]:hover { + transform: translateX(1px); +} + +[data-slot="sidebar-menu-button"][data-active="true"]:hover { + transform: none; +} + +/* Group label styling - HubSpot uppercase sections */ +[data-slot="sidebar-group-label"] { + font-size: 10px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 0.08em; + color: var(--sidebar-foreground); + opacity: 0.4; + padding: 0 12px; + margin-bottom: 4px; +} + +/* Submenu refinements */ +[data-slot="sidebar-menu-sub"] { + margin-top: 4px; +} + +/* Rail hover effect */ +[data-slot="sidebar-rail"]:hover { + background: linear-gradient(90deg, transparent, rgba(255, 122, 89, 0.1)); +} + +/* Collapsed state icon centering */ +[data-collapsible="icon"] [data-slot="sidebar-menu-button"] { + justify-content: center; +} + +/* Footer divider */ +[data-slot="sidebar-footer"] { + background: linear-gradient(180deg, transparent, var(--sidebar) 8px); +} diff --git a/frontend/src/hooks.server.js b/frontend/src/hooks.server.js index f734eedb..0b40dc84 100644 --- a/frontend/src/hooks.server.js +++ b/frontend/src/hooks.server.js @@ -16,7 +16,7 @@ const API_BASE_URL = `${env.PUBLIC_DJANGO_API_URL}/api`; /** * @typedef {{ default_currency?: string, currency_symbol?: string, default_country?: string|null }} OrgSettingsPayload - * @typedef {{ org_id?: string, org_name?: string, role?: string, user_id?: string, exp?: number, iat?: number, org_settings?: OrgSettingsPayload }} JWTPayload + * @typedef {{ org_id?: string, org_name?: string, role?: string, user_id?: string, user_name?: string, user_email?: string, user_profile_pic?: string, exp?: number, iat?: number, org_settings?: OrgSettingsPayload }} JWTPayload * @typedef {{ id: string, name: string }} OrgInfo * @typedef {{ org: OrgInfo, role?: string }} ProfileInfo * @typedef {{ id?: string, organizations?: Array<{ id: string, name: string }> }} UserInfo @@ -158,7 +158,12 @@ export async function handle({ event, resolve }) { // Set user in locals from JWT payload (no API call needed!) if (jwtPayload) { // Build user object from JWT claims - event.locals.user = { id: jwtPayload.user_id }; + event.locals.user = { + id: jwtPayload.user_id, + name: jwtPayload.user_name || '', + email: jwtPayload.user_email || '', + profilePhoto: jwtPayload.user_profile_pic || '' + }; // Check if org cookie is set and token has org context if (orgId) { diff --git a/frontend/src/lib/components/dashboard/ActivityFeed.svelte b/frontend/src/lib/components/dashboard/ActivityFeed.svelte index 47ae5a8c..bd966959 100644 --- a/frontend/src/lib/components/dashboard/ActivityFeed.svelte +++ b/frontend/src/lib/components/dashboard/ActivityFeed.svelte @@ -1,5 +1,4 @@ - - -
- - Recent Activity +
+ +
+
+
+ +
+

Recent Activity

- - - +
+ + +
{#if activities.length === 0} -
- -

No recent activity

+
+
+ +
+

No recent activity

+

Actions will appear here

{:else} -
+
{#each groupedActivities as group}
-

+

{group.category}

{#each group.items as activity (activity.id)} - {@const Icon = actionIcons[activity.action || ''] || Activity} - {@const colorClass = - actionColors[activity.action || ''] || 'bg-muted text-muted-foreground'} + {@const config = actionConfig[activity.action || ''] || defaultConfig} + {@const Icon = config.icon}
+
- +
+ +
-

+

{activity.description || activity.message || `${activity.action} ${activity.entityType}: ${activity.entityName}`}

-

- {activity.user?.name || 'System'} · {formatTime( - activity.timestamp || activity.createdAt - )} -

+
+ {activity.user?.name || 'System'} + · + {formatTime(activity.timestamp || activity.createdAt)} +
{/each} @@ -166,16 +195,17 @@
{/each}
+ {#if activities.length > 5 && !showAll} {/if} {/if} - - +
+
diff --git a/frontend/src/lib/components/dashboard/FocusBar.svelte b/frontend/src/lib/components/dashboard/FocusBar.svelte index 807454e7..6735c439 100644 --- a/frontend/src/lib/components/dashboard/FocusBar.svelte +++ b/frontend/src/lib/components/dashboard/FocusBar.svelte @@ -1,5 +1,5 @@ - - -
- - Hot Leads +
+ +
+
+
+ +
+

Hot Leads

- - - +
+ + +
{#if leads.length === 0} -
- -

No hot leads

+
+
+ +
+

No hot leads

Mark leads as "Hot" to see them here

{:else} - diff --git a/frontend/src/lib/components/dashboard/KPICard.svelte b/frontend/src/lib/components/dashboard/KPICard.svelte index 58f34b55..b2892cca 100644 --- a/frontend/src/lib/components/dashboard/KPICard.svelte +++ b/frontend/src/lib/components/dashboard/KPICard.svelte @@ -1,7 +1,6 @@ - -
-
-

+ +

+
+
+ +
+
+ +

{label}

-

+ + +

{value}

+ + {#if subtitle} -

{subtitle}

+

{subtitle}

{/if} + + {#if hasTrend} -
+
{#if isPositive} - - - +{trend}% - +
+ + + +{trend}% + +
{:else} - - - {trend}% - +
+ + + {trend}% + +
{/if} {#if trendLabel} - {trendLabel} + {trendLabel} {/if}
{/if}
+ + {#if icon}
-
+
{@render icon()}
{/if}
- +
diff --git a/frontend/src/lib/components/dashboard/MiniPipeline.svelte b/frontend/src/lib/components/dashboard/MiniPipeline.svelte index 9545970d..de095db2 100644 --- a/frontend/src/lib/components/dashboard/MiniPipeline.svelte +++ b/frontend/src/lib/components/dashboard/MiniPipeline.svelte @@ -1,6 +1,6 @@
-
+
{#each stages as stage, index} {@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }} - diff --git a/frontend/src/lib/components/dashboard/OpportunitiesTable.svelte b/frontend/src/lib/components/dashboard/OpportunitiesTable.svelte index b8803b93..eba539de 100644 --- a/frontend/src/lib/components/dashboard/OpportunitiesTable.svelte +++ b/frontend/src/lib/components/dashboard/OpportunitiesTable.svelte @@ -1,9 +1,8 @@ - - -
- - My Opportunities +
+ +
+
+
+ +
+

My Opportunities

- - - +
+ + +
{#if openOpportunities.length === 0} -
- -

No open opportunities

+
+
+ +
+

No open opportunities

+

Create one to start tracking

{:else} -
+
{#each openOpportunities.slice(0, 5) as opp (opp.id)} {@const daysUntilClose = getDaysUntilClose(opp.closed_on)} + {@const config = stageConfig[opp.stage] || stageConfig.PROSPECTING} -
+ +
-

+

{opp.name}

-

+

{opp.account?.name || 'No account'}

- + {formatCurrency(opp.amount, opp.currency || 'USD')}
+ +
- - {stageConfig[opp.stage]?.label || opp.stage} + + + {config.label} + +
- + {opp.probability || 0}%
+ + {#if daysUntilClose !== null} -
- +
+ {formatDaysUntilClose(daysUntilClose)} @@ -155,5 +184,5 @@ {/each}
{/if} - - +
+
diff --git a/frontend/src/lib/components/dashboard/PipelineChart.svelte b/frontend/src/lib/components/dashboard/PipelineChart.svelte index cfa8655a..1baca16d 100644 --- a/frontend/src/lib/components/dashboard/PipelineChart.svelte +++ b/frontend/src/lib/components/dashboard/PipelineChart.svelte @@ -1,5 +1,5 @@ - - - Pipeline by Stage - - -
- {#each stages as stage} - {@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }} - {@const percentage = maxValue > 0 ? (data.value / maxValue) * 100 : 0} -
-
- {data.label || stage.id} - {formatCurrency(data.value, currency, true)} -
-
-
+
+ +
+
+ +
+

Pipeline by Stage

+
+ + +
+ {#each stages as stage} + {@const data = pipelineData[stage.id] || { count: 0, value: 0, label: stage.id }} + {@const percentage = maxValue > 0 ? (data.value / maxValue) * 100 : 0} +
+ +
+
+
+ {data.label || stage.id}
+ + {formatCurrency(data.value, currency, true)} +
- {/each} -
- -
- Total Open Pipeline - - {formatCurrency( - stages.reduce((sum, s) => sum + (pipelineData[s.id]?.value || 0), 0), - currency, - true - )} - -
- - + + +
+
+ +
+
+
+ {/each} +
+ + +
+ Total Open Pipeline + + {formatCurrency(totalPipeline, currency, true)} + +
+
diff --git a/frontend/src/lib/components/dashboard/TaskList.svelte b/frontend/src/lib/components/dashboard/TaskList.svelte index 5372b69c..b1a7f242 100644 --- a/frontend/src/lib/components/dashboard/TaskList.svelte +++ b/frontend/src/lib/components/dashboard/TaskList.svelte @@ -1,8 +1,7 @@ - - - My Tasks - - -
- - - -
- + + +
+ {#each filterButtons as btn} + + {/each} +
+ + +
{#if filteredTasks().length === 0} - diff --git a/frontend/src/lib/components/layout/AppSidebar.svelte b/frontend/src/lib/components/layout/AppSidebar.svelte index bf9325c2..3f920b3b 100644 --- a/frontend/src/lib/components/layout/AppSidebar.svelte +++ b/frontend/src/lib/components/layout/AppSidebar.svelte @@ -17,8 +17,9 @@ CheckSquare, HelpCircle, ChevronRight, - ChevronsLeft, - ChevronsRight, + ChevronDown, + PanelLeftClose, + PanelLeft, Moon, Sun, Monitor, @@ -32,7 +33,11 @@ RefreshCw, FileCode, BarChart3, - Tag + Tag, + Sparkles, + Search, + Star, + Home } from '@lucide/svelte'; /** @@ -106,6 +111,22 @@ /** @type {{ [key: string]: boolean }} */ let openDropdowns = $state({}); + /** Track if profile image failed to load */ + let profileImageError = $state(false); + + /** + * Get user initials from name + * @param {string} name + */ + const getInitials = (name) => { + if (!name) return '?'; + const parts = name.trim().split(/\s+/); + if (parts.length >= 2) { + return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); + } + return name.slice(0, 2).toUpperCase(); + }; + // Auto-open dropdown if a child is active $effect(() => { navigationItems.forEach((item) => { @@ -125,12 +146,12 @@ } }); - // Disable prefetch on all nav links - CRM pages load data that shouldn't be prefetched on hover - const navigationItems = [ + // HubSpot-style navigation structure with sections + const crmItems = [ { href: '/', label: 'Dashboard', - icon: LayoutDashboard, + icon: Home, type: 'link', preload: 'off' }, @@ -150,21 +171,21 @@ }, { href: '/accounts', - label: 'Accounts', + label: 'Companies', icon: Building, type: 'link', preload: 'off' }, { href: '/opportunities', - label: 'Opportunities', - icon: Target, + label: 'Deals', + icon: Sparkles, type: 'link', preload: 'off' }, { href: '/cases', - label: 'Cases', + label: 'Tickets', icon: Briefcase, type: 'link', preload: 'off' @@ -175,7 +196,10 @@ icon: CheckSquare, type: 'link', preload: 'off' - }, + } + ]; + + const salesItems = [ { key: 'invoices', label: 'Invoices', @@ -189,16 +213,22 @@ { href: '/invoices/templates', label: 'Templates', icon: FileCode, preload: 'off' }, { href: '/invoices/reports', label: 'Reports', icon: BarChart3, preload: 'off' } ] - }, + } + ]; + + const supportItems = [ { href: '/support', - label: 'Support', + label: 'Help Desk', icon: HelpCircle, type: 'link', preload: 'off' } ]; + // Combine for iteration + const navigationItems = [...crmItems, ...salesItems, ...supportItems]; + /** * Check if any child route is active * @param {Array<{href: string}>} children @@ -218,77 +248,98 @@ }; - - + + + - + {#snippet child({ props })} - + +
- Logo + Logo
-
- {org_name} - CRM +
+ {org_name} + + CRM Platform +
{/snippet} - - - - - - + +
+ +
+ + + + + CRM + - - {#each navigationItems as item} - {#if item.type === 'link'} - - - {#snippet child({ props })} - - - {item.label} - - {/snippet} - - - {:else if item.type === 'dropdown' && item.children} + + {#each crmItems as item} + + + {#snippet child({ props })} + + + {#if currentPath === item.href} +
+ {/if} +
+ +
+ {item.label} +
+ {/snippet} +
+
+ {/each} +
+
+
+ + + + + Sales + + + + {#each salesItems as item} + {#if item.type === 'dropdown' && item.children} { @@ -303,24 +354,40 @@ {...props} isActive={hasActiveChild(item.children ?? [])} tooltipContent={item.label} + class="hubspot-menu-item group/item h-9 rounded-lg px-3 transition-all duration-150 + {hasActiveChild(item.children ?? []) + ? 'text-[#ff5c35] dark:text-[#ff7a59]' + : 'text-sidebar-foreground/80 hover:bg-sidebar-accent hover:text-sidebar-foreground'}" > - - {item.label} - +
+
+ +
+ {item.label} + +
{/snippet} - + {#each item.children as navChild} - + {#snippet child({ props })} - - - {navChild.label} + +
+ +
+ {navChild.label}
{/snippet}
@@ -335,46 +402,142 @@
+ + + + + Support + + + + {#each supportItems as item} + + + {#snippet child({ props })} + + {#if currentPath === item.href} +
+ {/if} +
+ +
+ {item.label} +
+ {/snippet} +
+
+ {/each} +
+
+
- - + + + + + sidebar.toggle()} + tooltipContent="Collapse sidebar" + class="h-8 rounded-lg px-3 text-sidebar-foreground/60 transition-all duration-150 hover:bg-sidebar-accent hover:text-sidebar-foreground" + > + {#snippet child({ props })} + + {/snippet} + + + + + + {#snippet child({ props })} - - {#if theme === 'dark'} - - {:else if theme === 'light'} - - {:else} - - {/if} - Theme - {theme} + +
+ {#if theme === 'dark'} + + {:else if theme === 'light'} + + {:else} + + {/if} +
+ Theme + + {theme} +
{/snippet}
- - setTheme('light')}> - + + setTheme('light')} class="gap-2.5"> + Light + {#if theme === 'light'} +
+ {/if}
- setTheme('dark')}> - + setTheme('dark')} class="gap-2.5"> + Dark + {#if theme === 'dark'} +
+ {/if}
- setTheme('system')}> - + setTheme('system')} class="gap-2.5"> + System + {#if theme === 'system'} +
+ {/if}
- + +
+ + @@ -382,18 +545,30 @@ - User avatar -
- {user.name} - {user.email} + +
+ {#if user.profilePhoto && !profileImageError} + User avatar profileImageError = true} + /> + {:else} +
+ {getInitials(user.name)} +
+ {/if} + +
- +
+ {user.name} + {user.email} +
+ {/snippet} @@ -402,45 +577,43 @@ align="start" class="w-[--bits-dropdown-menu-anchor-width] min-w-56" > - My Account - - - navigateTo('/profile')}> - + + My Account + + + + navigateTo('/profile')} class="gap-2.5"> + Profile - navigateTo('/users')}> - + navigateTo('/users')} class="gap-2.5"> + Users & Teams - navigateTo('/org')}> - + navigateTo('/org')} class="gap-2.5"> + Organizations navigateTo('/settings/organization')} + class="gap-2.5" > - + Settings - navigateTo('/settings/tags')} - > - + navigateTo('/settings/tags')} class="gap-2.5"> + Tags - + navigateTo('/logout')} > - + Sign out @@ -449,5 +622,50 @@ - + + + diff --git a/frontend/src/lib/components/layout/PageHeader.svelte b/frontend/src/lib/components/layout/PageHeader.svelte index 6b7f0e72..4e6c7b24 100644 --- a/frontend/src/lib/components/layout/PageHeader.svelte +++ b/frontend/src/lib/components/layout/PageHeader.svelte @@ -11,19 +11,53 @@
-
-
-

{title}

+ + + +
+ +
+
+

+ {title} +

+ {#if subtitle} + + {/if} +
{#if subtitle} -

{subtitle}

+

{subtitle}

{/if}
+ + {#if actions} -
+
{@render actions()}
{/if}
+ + +
diff --git a/frontend/src/lib/components/ui/case-kanban/CaseCard.svelte b/frontend/src/lib/components/ui/case-kanban/CaseCard.svelte index 4502b0af..4b83b554 100644 --- a/frontend/src/lib/components/ui/case-kanban/CaseCard.svelte +++ b/frontend/src/lib/components/ui/case-kanban/CaseCard.svelte @@ -1,5 +1,5 @@
- -
-
- {name} + +
+ + + {#if priority === 'Urgent' || isSlaBreached} +
+ {/if} + +
+ +
+

+ {name} +

+ + {#if isSlaBreached} +
+ + SLA +
+ {/if}
- {#if isSlaBreached} - - - + + + {#if accountName} +
+ + {accountName} +
+ {/if} + + +
+ {#if typeConfig} + {@const TypeIcon = typeConfig.icon} +
+ + {typeConfig.label} +
+ {/if} + + {#if config} + {@const PriorityIcon = config.icon} +
+ + {priority} +
+ {/if} +
+ + + {#if assignees.length > 0} +
+
+ {#each assignees.slice(0, 3) as assignee, i (assignee.id)} +
+ {getAssigneeInitials(assignee)} +
+ {/each} + {#if assignees.length > 3} +
+ +{assignees.length - 3} +
+ {/if} +
+ + + {#if priority === 'Urgent' && !isSlaBreached} +
+ +
+ {/if} +
{/if}
- - - {#if accountName} -
- - {accountName} -
- {/if} - - -
-
- {#if caseType} - - {caseTypeLabels[caseType] || caseType} - - {/if} - {#if priority} - - {priority} - - {/if} -
-
- - - {#if assignees.length > 0} -
- {#each assignees.slice(0, 3) as assignee (assignee.id)} -
- {getAssigneeInitials(assignee)} -
- {/each} - {#if assignees.length > 3} -
- +{assignees.length - 3} -
- {/if} -
- {/if}
diff --git a/frontend/src/lib/components/ui/crm-drawer/CrmDrawer.svelte b/frontend/src/lib/components/ui/crm-drawer/CrmDrawer.svelte index 8519db47..48dadf95 100644 --- a/frontend/src/lib/components/ui/crm-drawer/CrmDrawer.svelte +++ b/frontend/src/lib/components/ui/crm-drawer/CrmDrawer.svelte @@ -168,26 +168,30 @@ onOpenChange?.(value)}> {#if loading} - +
-
- - -
-
-
- + +
+
+ +
-
+
+ + +
+
+ +
+
{#each { length: 6 } as _} -
- - +
+ + +
{/each}
@@ -195,97 +199,60 @@
{:else}
- -
- {headerLabel} - + +
+ + + +
+
+ + {headerLabel} + + {#if mode === 'create'} + New + {/if} +
+ +
- -
+ +
{#if titleEditable} {:else} -

+

{titleValue || titlePlaceholder}

{/if}
- -
+ +
{#if enableProgressiveDisclosure && essentialColumns.length > 0} - - {#each essentialColumns as col (col.key)} - handleFieldChange(col.key, value)} - /> - {/each} - - - {#if hiddenFieldsCount > 0 || showAllFields} - - {/if} - - - {#each visibleAdditionalColumns as col (col.key)} - handleFieldChange(col.key, value)} - /> - {/each} - {:else} - - {#each columns as col (col.key)} - {#if col.key !== titleKey} + +
+ {#each essentialColumns as col (col.key)} handleFieldChange(col.key, value)} /> - {/if} - {/each} + {/each} +
+ + + {#if hiddenFieldsCount > 0 || showAllFields} + + {/if} + + + {#if visibleAdditionalColumns.length > 0} +
+ {#each visibleAdditionalColumns as col (col.key)} + handleFieldChange(col.key, value)} + /> + {/each} +
+ {/if} + {:else} + +
+ {#each columns as col (col.key)} + {#if col.key !== titleKey} + handleFieldChange(col.key, value)} + /> + {/if} + {/each} +
{/if}
- + {#if activitySection} - -
+
+
{@render activitySection()}
{/if}
- -
-
+ +
+
{#if onDelete && mode !== 'create'} {:else} diff --git a/frontend/src/lib/components/ui/crm-drawer/CrmPropertyRow.svelte b/frontend/src/lib/components/ui/crm-drawer/CrmPropertyRow.svelte index 1fa4edb0..2bb6c735 100644 --- a/frontend/src/lib/components/ui/crm-drawer/CrmPropertyRow.svelte +++ b/frontend/src/lib/components/ui/crm-drawer/CrmPropertyRow.svelte @@ -184,14 +184,16 @@
-
+
{#if Icon} - +
+ +
{/if} {label}
@@ -205,12 +207,12 @@ oninput={handleInput} {placeholder} disabled={!editable} - class="w-full rounded border-0 bg-transparent px-2 py-1 text-sm transition-colors outline-none placeholder:text-gray-400 focus:bg-gray-50 dark:focus:bg-gray-800" + class="w-full rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-sm font-medium text-foreground transition-all outline-none placeholder:text-muted-foreground/40 focus:bg-muted/30 focus:ring-1 focus:ring-primary/20" /> {:else if type === 'number'}
{#if prefix} - {prefix} + {prefix} {/if}
{:else if type === 'date'} @@ -229,11 +231,11 @@ {...props} type="button" class={cn( - 'inline-flex w-full items-center gap-2 rounded px-2 py-0.5 text-sm transition-colors hover:bg-gray-50 dark:hover:bg-gray-800', - !value && 'text-gray-400' + 'inline-flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all hover:bg-muted/30', + !value ? 'text-muted-foreground/50' : 'text-foreground' )} > - + {formatDateDisplay(value)} {/snippet} @@ -247,8 +249,8 @@ oninput={handleInput} {placeholder} disabled={!editable} - rows={2} - class="w-full resize-none rounded border-0 bg-transparent px-2 py-1 text-sm transition-colors outline-none placeholder:text-gray-400 focus:bg-gray-50 dark:focus:bg-gray-800" + rows={3} + class="w-full resize-none rounded-lg border-0 bg-transparent px-2.5 py-1.5 text-sm text-foreground transition-all outline-none placeholder:text-muted-foreground/40 focus:bg-muted/30 focus:ring-1 focus:ring-primary/20" >{value || ''} {:else if type === 'select'} @@ -258,26 +260,26 @@ {/snippet} - + {#each options as option (option.value)} handleSelectChange(option.value)} - class="flex items-center gap-2" + class="flex items-center gap-2.5 rounded-lg px-2.5 py-2" > - - {option.label} + {option.label} {#if value === option.value} - + {/if} {/each} @@ -288,24 +290,24 @@ type="button" onclick={handleCheckboxToggle} disabled={!editable} - class="flex h-5 w-5 items-center justify-center rounded border transition-colors duration-75 {value - ? 'border-blue-500 bg-blue-500' - : 'border-gray-300 hover:border-gray-400 dark:border-gray-600'}" + class="flex h-5 w-5 items-center justify-center rounded-md border-2 transition-all duration-150 {value + ? 'border-primary bg-primary shadow-sm shadow-primary/25' + : 'border-muted-foreground/30 hover:border-muted-foreground/50'}" > {#if value} - + {/if} {:else if type === 'color'} -
+
- {value || '#3B82F6'} + {value || '#3B82F6'}
{:else if type === 'multiselect'} {:else if type === 'readonly'} - + {#if value} {value} {:else} - {emptyText || 'Empty'} + {emptyText || '—'} {/if} {/if} diff --git a/frontend/src/lib/components/ui/filter/DateRangeFilter.svelte b/frontend/src/lib/components/ui/filter/DateRangeFilter.svelte index 874886da..79a1d48b 100644 --- a/frontend/src/lib/components/ui/filter/DateRangeFilter.svelte +++ b/frontend/src/lib/components/ui/filter/DateRangeFilter.svelte @@ -1,5 +1,5 @@ -
+
{#if label} - {label} + + {label} + {/if}
- - + + {displayText}
-
+ +
{#if hasValue} - + +
+ {/if} - +
{/snippet} - + +
-
- {#each presets as preset} +
+
+ + Quick select + +
+ {#each presets as preset, i} {/each}
- -
-
+ + +
+ +
+ {#if startDate} +
+
+ + {formatDateShort(startDate)} + +
+ {:else} + Start date + {/if} + + + + {#if endDate} +
+
+ + {formatDateShort(endDate)} + +
+ {:else} + + {selectingEnd ? 'Select end' : 'End date'} + + {/if} +
+ + +
{#if selectingEnd} - Select end date + Click to select end date {:else} Select start date {/if}
- - {#if startDate && !endDate} -
- Start: {formatDate(startDate)} -
- {/if} + + +
+ +
+ + diff --git a/frontend/src/lib/components/ui/filter/FilterBar.svelte b/frontend/src/lib/components/ui/filter/FilterBar.svelte index 0df25850..e070c031 100644 --- a/frontend/src/lib/components/ui/filter/FilterBar.svelte +++ b/frontend/src/lib/components/ui/filter/FilterBar.svelte @@ -1,8 +1,7 @@ {#if minimal} - + {#if isExpanded} -
- {@render children?.()} +
+ +
+ + +
+ {@render children?.()} +
+ + {#if activeCount > 0 && onClear} - +
+
+ + + {activeCount} active + +
+ +
{/if}
{/if} {:else} -
+ +
-
+
+ {#if activeCount > 0 && onClear} - {/if}
- + {#if !collapsible || isExpanded} -
-
+
+
{@render children?.()}
{/if}
{/if} + + diff --git a/frontend/src/lib/components/ui/filter/SearchInput.svelte b/frontend/src/lib/components/ui/filter/SearchInput.svelte index 3d74a86e..4595500c 100644 --- a/frontend/src/lib/components/ui/filter/SearchInput.svelte +++ b/frontend/src/lib/components/ui/filter/SearchInput.svelte @@ -1,11 +1,14 @@ -
- - - {#if inputValue} - + {label} + {/if} + +
+ +
+ +
+ + + + + +
+ {#if inputValue} + + + {:else if showShortcut} + +
+ + K +
+ {/if} +
+ + +
+
+ + diff --git a/frontend/src/lib/components/ui/filter/SelectFilter.svelte b/frontend/src/lib/components/ui/filter/SelectFilter.svelte index 5d2d53e3..fe566f26 100644 --- a/frontend/src/lib/components/ui/filter/SelectFilter.svelte +++ b/frontend/src/lib/components/ui/filter/SelectFilter.svelte @@ -1,13 +1,13 @@ -
+
{#if label} - {label} + + {label} + {/if} @@ -95,17 +97,43 @@ {/snippet} - + + + {#if !multiple} +
{/if} - {#each options as option} - {@const isSelected = multiple - ? selectedValues.includes(option.value) - : value === option.value} - - {/each} + + +
+ {#each options as option, i} + {@const isSelected = multiple + ? selectedValues.includes(option.value) + : value === option.value} + + {/each} +
+ {#if multiple && selectedValues.length > 0} -
- {#each selectedValues as val} +
+ {#each selectedValues as val, i} {@const opt = options.find((o) => o.value === val)} - + {opt?.label || val} - + {/each}
{/if} + + diff --git a/frontend/src/lib/components/ui/filter/TagFilter.svelte b/frontend/src/lib/components/ui/filter/TagFilter.svelte index a8ea7ecb..f12a6010 100644 --- a/frontend/src/lib/components/ui/filter/TagFilter.svelte +++ b/frontend/src/lib/components/ui/filter/TagFilter.svelte @@ -1,8 +1,7 @@ -
+
{#if label} - {label} + + {label} + {/if} @@ -75,17 +95,59 @@ {/snippet} - + + {#if tags.length === 0} -

No tags available

+
+ +

No tags available

+

Create tags to organize your leads

+
{:else} - {#each tags as tag (tag.id)} - {@const isSelected = selectedIds.includes(tag.id)} - - {/each} + + {selectedIds.length} tag{selectedIds.length > 1 ? 's' : ''} selected + + +
+ {/if} + + +
+ {#each tags as tag, i (tag.id)} + {@const isSelected = selectedIds.includes(tag.id)} + + {/each} +
{/if}
+ {#if selectedTags.length > 0} -
- {#each selectedTags as tag (tag.id)} - +
+ {#each selectedTags as tag, i (tag.id)} + + {tag.name} - + {/each}
{/if} + + diff --git a/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte b/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte index 29f96056..99ae5474 100644 --- a/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte +++ b/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte @@ -1,7 +1,7 @@ {#if loading} -
- +
+
+
+
+ +
+
+

Loading pipeline...

{:else if !data || sortedColumns.length === 0} -
-

{emptyMessage}

+
+
+ +
+
+

{emptyMessage}

+

Add some {itemNamePlural} to get started

+
{:else} - -
- {totalCount} - {totalCount !== 1 ? itemNamePlural : itemName} total +
+
+ + {totalCount} {totalCount !== 1 ? itemNamePlural : itemName} across {sortedColumns.length} stages + +
{/if} + + diff --git a/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte b/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte index 5ecbb886..367d8bf4 100644 --- a/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte +++ b/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte @@ -1,4 +1,6 @@
- -
-

- {column.name} -

-
- - {itemCount} - - {#if column.wip_limit} - - /{column.wip_limit} - + +
+ +
+ + +
+
+

+ {column.name} +

+
+ + {itemCount} + + {#if column.wip_limit} + + max {column.wip_limit} + + {/if} +
+
+ + + {#if columnValue() > 0} +
+ + + {formatColumnValue(columnValue())} + +
{/if}
- -
- {#each column.items as item (item.id)} - {#if CardComponent} - onCardClick(item)} - ondragstart={(e) => onCardDragStart(e, item)} - ondragend={onCardDragEnd} - /> - {:else} - -
onCardClick(item)} - onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)} - ondragstart={(e) => onCardDragStart(e, item)} - ondragend={onCardDragEnd} - role="button" - tabindex="0" - > -
- {item.title || item.name || 'Untitled'} + +
+ {#each column.items as item, index (item.id)} +
+ {#if CardComponent} + onCardClick(item)} + ondragstart={(e) => onCardDragStart(e, item)} + ondragend={onCardDragEnd} + /> + {:else} + +
onCardClick(item)} + onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)} + ondragstart={(e) => onCardDragStart(e, item)} + ondragend={onCardDragEnd} + role="button" + tabindex="0" + > +
+ {item.title || item.name || 'Untitled'} +
-
- {/if} + {/if} +
{/each} {#if column.items.length === 0}
- No {itemName}s +
📭
+ + No {itemName}s yet +
{/if}
+ + +
diff --git a/frontend/src/lib/components/ui/lead-kanban/LeadCard.svelte b/frontend/src/lib/components/ui/lead-kanban/LeadCard.svelte index b89c23f7..0b242be4 100644 --- a/frontend/src/lib/components/ui/lead-kanban/LeadCard.svelte +++ b/frontend/src/lib/components/ui/lead-kanban/LeadCard.svelte @@ -1,6 +1,5 @@
- -
- {title} -
+ +
- - {#if company} -
- - {company} -
+ + {#if rating === 'HOT'} +
{/if} - - {#if amount} -
- - {formatAmount(amount, currency)} -
- {/if} +
+ +
+

+ {title} +

- -
- {#if rating} - - {rating} - - {:else} - - {/if} - - {#if followUp} - - - {formatDate(followUp)} - - {/if} -
- - - {#if assignees.length > 0} -
- {#each assignees.slice(0, 3) as assignee (assignee.id)} -
- {getAssigneeInitials(assignee)} -
- {/each} - {#if assignees.length > 3} -
- +{assignees.length - 3} + {#if config} + {@const RatingIcon = config.icon} +
+ + {rating}
{/if}
- {/if} + + + {#if company} +
+ + {company} +
+ {/if} + + + {#if amount} +
+
+ + + {formatAmount(amount, currency)} + +
+
+ {/if} + + + {#if assignees.length > 0} +
+
+ {#each assignees.slice(0, 3) as assignee, i (assignee.id)} +
+ {getAssigneeInitials(assignee)} +
+ {/each} + {#if assignees.length > 3} +
+ +{assignees.length - 3} +
+ {/if} +
+ + + {#if amount && parseFloat(String(amount)) > 300000} +
+ +
+ {/if} +
+ {/if} +
diff --git a/frontend/src/lib/components/ui/pagination/Pagination.svelte b/frontend/src/lib/components/ui/pagination/Pagination.svelte index 819293e5..b7702b9d 100644 --- a/frontend/src/lib/components/ui/pagination/Pagination.svelte +++ b/frontend/src/lib/components/ui/pagination/Pagination.svelte @@ -1,5 +1,5 @@
- -
- {title} -
+ +
- - {#if relatedEntity} -
- - - {entityLabels[relatedEntity.type] || relatedEntity.type}: {relatedEntity.name} - -
+ + {#if priority === 'High'} +
{/if} - -
- {#if priority} - - {priority} - - {:else} - - {/if} +
+ +
+

+ {title} +

- {#if dueDate} - - {#if isOverdue} - - {:else} - - {/if} - {formatDate(dueDate)} - - {/if} -
- - - {#if assignees.length > 0} -
- {#each assignees.slice(0, 3) as assignee (assignee.id)} -
- {getAssigneeInitials(assignee)} -
- {/each} - {#if assignees.length > 3} -
- +{assignees.length - 3} + {#if config} + {@const PriorityIcon = config.icon} +
+ + {priority}
{/if}
- {/if} + + + {#if relatedEntity} +
+ + + {entityLabels[relatedEntity.type] || relatedEntity.type}: {relatedEntity.name} + +
+ {/if} + + + {#if dueDate} +
+
+ {#if isOverdue} + + + Overdue: {formatDate(dueDate)} + + {:else} + + + {formatDate(dueDate)} + + {/if} +
+
+ {/if} + + +
+ {#if assignees.length > 0} +
+ {#each assignees.slice(0, 3) as assignee, i (assignee.id)} +
+ {getAssigneeInitials(assignee)} +
+ {/each} + {#if assignees.length > 3} +
+ +{assignees.length - 3} +
+ {/if} +
+ {:else} +
+ {/if} + + + {#if statusCfg} + {@const StatusIcon = statusCfg.icon} +
+ +
+ {/if} +
+
diff --git a/frontend/src/routes/(app)/+page.svelte b/frontend/src/routes/(app)/+page.svelte index c1715245..a242c913 100644 --- a/frontend/src/routes/(app)/+page.svelte +++ b/frontend/src/routes/(app)/+page.svelte @@ -1,5 +1,5 @@ Dashboard - BottleCRM -
- -
-
-

Dashboard

-

- Welcome back! Here's what's happening with your CRM. -

-
-
+
+ +
- {#if data.error} -
- - {data.error} -
- {:else} - - - - -
-
-

Sales Pipeline

- {currencyNote} +
+ +
+
+
+
+
+ +
+
+

{getGreeting()}

+

+ Dashboard +

+
+
+

+ Here's what's happening with your CRM today. Stay on top of your pipeline and close more deals. +

+
- -
+ - -
- -
+ {#if data.error} +
+
+ +
+
+

Error loading dashboard

+

{data.error}

+
+
+ {:else} + +
+ +
+ + +
+
+
+
+ +
+
+

Sales Pipeline

+

{currencyNote}

+
+
+
+ +
+ + +
{#snippet icon()} - + {/snippet} {#snippet icon()} - + {/snippet} {#snippet icon()} - + {/snippet} {#snippet icon()} - + {/snippet}
- - -
+ +
+
+ +
+
+ +
+
- -
- - -
+ +
+ + +
- -
- - -
- {/if} + +
+ +
+ {/if} +
diff --git a/frontend/src/routes/(app)/leads/+page.svelte b/frontend/src/routes/(app)/leads/+page.svelte index e228a994..d1d4ab96 100644 --- a/frontend/src/routes/(app)/leads/+page.svelte +++ b/frontend/src/routes/(app)/leads/+page.svelte @@ -1571,6 +1571,7 @@ updateFilters({ ...filters, search: value })} class="w-64" /> diff --git a/frontend/src/routes/(app)/settings/organization/+page.svelte b/frontend/src/routes/(app)/settings/organization/+page.svelte index 9d176f8e..49a455af 100644 --- a/frontend/src/routes/(app)/settings/organization/+page.svelte +++ b/frontend/src/routes/(app)/settings/organization/+page.svelte @@ -2,10 +2,19 @@ import { enhance } from '$app/forms'; import { invalidateAll } from '$app/navigation'; import { toast } from 'svelte-sonner'; - import { Settings, Building2, Globe, Banknote } from '@lucide/svelte'; + import { + Building2, + Globe, + Banknote, + Sparkles, + Check, + MapPin, + Hash, + FileText, + Loader2 + } from '@lucide/svelte'; import { PageHeader } from '$lib/components/layout'; import { Button } from '$lib/components/ui/button/index.js'; - import * as Card from '$lib/components/ui/card/index.js'; import { Input } from '$lib/components/ui/input/index.js'; import { Label } from '$lib/components/ui/label/index.js'; import { CURRENCY_CODES } from '$lib/constants/filters.js'; @@ -19,28 +28,28 @@ // Currency options for select const currencyOptions = CURRENCY_CODES.filter((c) => c.value); - // Country options (simplified list of common countries) + // Country options with flag emojis const countryOptions = [ - { value: '', label: 'Select Country' }, - { value: 'US', label: 'United States' }, - { value: 'GB', label: 'United Kingdom' }, - { value: 'CA', label: 'Canada' }, - { value: 'AU', label: 'Australia' }, - { value: 'DE', label: 'Germany' }, - { value: 'FR', label: 'France' }, - { value: 'IN', label: 'India' }, - { value: 'JP', label: 'Japan' }, - { value: 'SG', label: 'Singapore' }, - { value: 'AE', label: 'United Arab Emirates' }, - { value: 'BR', label: 'Brazil' }, - { value: 'MX', label: 'Mexico' }, - { value: 'CH', label: 'Switzerland' }, - { value: 'NL', label: 'Netherlands' }, - { value: 'ES', label: 'Spain' }, - { value: 'IT', label: 'Italy' } + { value: '', label: 'Select Country', flag: '' }, + { value: 'US', label: 'United States', flag: '🇺🇸' }, + { value: 'GB', label: 'United Kingdom', flag: '🇬🇧' }, + { value: 'CA', label: 'Canada', flag: '🇨🇦' }, + { value: 'AU', label: 'Australia', flag: '🇦🇺' }, + { value: 'DE', label: 'Germany', flag: '🇩🇪' }, + { value: 'FR', label: 'France', flag: '🇫🇷' }, + { value: 'IN', label: 'India', flag: '🇮🇳' }, + { value: 'JP', label: 'Japan', flag: '🇯🇵' }, + { value: 'SG', label: 'Singapore', flag: '🇸🇬' }, + { value: 'AE', label: 'United Arab Emirates', flag: '🇦🇪' }, + { value: 'BR', label: 'Brazil', flag: '🇧🇷' }, + { value: 'MX', label: 'Mexico', flag: '🇲🇽' }, + { value: 'CH', label: 'Switzerland', flag: '🇨🇭' }, + { value: 'NL', label: 'Netherlands', flag: '🇳🇱' }, + { value: 'ES', label: 'Spain', flag: '🇪🇸' }, + { value: 'IT', label: 'Italy', flag: '🇮🇹' } ]; - // Form state - initialized from settings via $effect + // Form state let formName = $state(''); let formDomain = $state(''); let formDescription = $state(''); @@ -65,22 +74,148 @@ toast.error(form.error); } }); + + // Get current country flag + const currentCountryFlag = $derived( + countryOptions.find(c => c.value === formCountry)?.flag || '' + ); + + // Get currency symbol + const currencySymbol = $derived(() => { + try { + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: formCurrency + }).format(0).replace(/[\d.,\s]/g, ''); + } catch { + return '$'; + } + }); + + // Generate initials from org name + const orgInitials = $derived( + formName + .split(' ') + .map(word => word[0]) + .join('') + .toUpperCase() + .slice(0, 2) || 'OR' + ); Organization Settings - BottleCRM + + {#snippet actions()} -
- -
+ {/snippet}
-
+
{ @@ -90,137 +225,248 @@ isLoading = false; }; }} + class="mx-auto max-w-4xl space-y-8" > - - - - - - Organization Details - - Basic information about your organization - - -
-
- - + +
+
+
+ +
+
+
-
- -
- - + +
+ +
+
+ +
+ + +
+ {orgInitials} +
+
+
+ + +
+
+
+ + Organization Identity +
+
+ +
+ +
+ +
+ +
+
+ + +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+ +
+ +
+
-
- - -
- - +
+
- - - - - - Locale Settings - - - Configure default currency and country for your organization - - - -
-
- -
- - -
-

- This will be the default currency for new opportunities, leads, and invoices. -

+ +
+
+
+ +
+
-
- -
- - +
+ +
+
+
+ + Regional Settings +
+

Currency & Locale

+

Configure default currency and regional preferences

+
-

- Default country for addresses and locale formatting. -

+ +
+ +
+ +
+
+ +
+
+

+ Applied to opportunities, invoices, and financial reports +

+
+ + +
+ +
+
+ +
+
+

+ Used for addresses, date formats, and locale settings +

+
+
+ + + {#if formCurrency} +
+
+
+
+ + Currency Preview +
+
+ + {new Intl.NumberFormat('en-US', { + style: 'currency', + currency: formCurrency, + minimumFractionDigits: 0, + maximumFractionDigits: 0 + }).format(125000)} + + + {currentCountryFlag} + +
+
+ Sample: {new Intl.NumberFormat('en-US', { + style: 'currency', + currency: formCurrency + }).format(12345.67)} +
+
+
+ {/if}
+
+
- - {#if formCurrency} -
-

Preview

-

- {new Intl.NumberFormat('en-US', { - style: 'currency', - currency: formCurrency - }).format(12345.67)} -

+ +
+
+
+
+
+ Settings synced
- {/if} - - - - -
- -
+
+ Last updated: {new Date().toLocaleDateString('en-US', { + month: 'short', + day: 'numeric', + year: 'numeric' + })} +
+
+ +
+
diff --git a/frontend/src/routes/(app)/settings/tags/+page.svelte b/frontend/src/routes/(app)/settings/tags/+page.svelte index 7ea3a9c1..7783715e 100644 --- a/frontend/src/routes/(app)/settings/tags/+page.svelte +++ b/frontend/src/routes/(app)/settings/tags/+page.svelte @@ -2,15 +2,14 @@ import { enhance } from '$app/forms'; import { invalidateAll } from '$app/navigation'; import { toast } from 'svelte-sonner'; - import { Tag, Plus, Archive, RotateCcw, Pencil } from '@lucide/svelte'; + import { Tag, Plus, Archive, RotateCcw, Pencil, Search, MoreHorizontal, Check, X } from '@lucide/svelte'; import { PageHeader } from '$lib/components/layout'; import { Button } from '$lib/components/ui/button/index.js'; - import * as Card from '$lib/components/ui/card/index.js'; import * as Dialog from '$lib/components/ui/dialog/index.js'; + import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js'; import { Input } from '$lib/components/ui/input/index.js'; import { Label } from '$lib/components/ui/label/index.js'; - import { Badge } from '$lib/components/ui/badge/index.js'; - import { TAG_COLORS, getTagColorClass } from '$lib/constants/colors.js'; + import { TAG_COLORS } from '$lib/constants/colors.js'; /** @type {{ data: any, form: any }} */ let { data, form } = $props(); @@ -19,6 +18,22 @@ const activeTags = $derived(tags.filter((/** @type {any} */ t) => t.is_active)); const archivedTags = $derived(tags.filter((/** @type {any} */ t) => !t.is_active)); + // Search and filter + let searchQuery = $state(''); + let showArchived = $state(false); + + const filteredActiveTags = $derived( + activeTags.filter((/** @type {any} */ tag) => + tag.name.toLowerCase().includes(searchQuery.toLowerCase()) + ) + ); + + const filteredArchivedTags = $derived( + archivedTags.filter((/** @type {any} */ tag) => + tag.name.toLowerCase().includes(searchQuery.toLowerCase()) + ) + ); + // Dialog state let createDialogOpen = $state(false); let editDialogOpen = $state(false); @@ -71,107 +86,301 @@ toast.error(form.error); } }); + + // HubSpot-style color mapping - simple, clean colors + /** + * @param {string} color + */ + function getHubspotBadgeClass(color) { + const colorMap = { + gray: 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300', + red: 'bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-400', + orange: 'bg-orange-50 text-orange-700 dark:bg-orange-950 dark:text-orange-400', + amber: 'bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-400', + yellow: 'bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400', + lime: 'bg-lime-50 text-lime-700 dark:bg-lime-950 dark:text-lime-400', + green: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400', + emerald: 'bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400', + teal: 'bg-teal-50 text-teal-700 dark:bg-teal-950 dark:text-teal-400', + cyan: 'bg-cyan-50 text-cyan-700 dark:bg-cyan-950 dark:text-cyan-400', + sky: 'bg-sky-50 text-sky-700 dark:bg-sky-950 dark:text-sky-400', + blue: 'bg-blue-50 text-blue-700 dark:bg-blue-950 dark:text-blue-400', + indigo: 'bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-400', + violet: 'bg-violet-50 text-violet-700 dark:bg-violet-950 dark:text-violet-400', + purple: 'bg-purple-50 text-purple-700 dark:bg-purple-950 dark:text-purple-400', + fuchsia: 'bg-fuchsia-50 text-fuchsia-700 dark:bg-fuchsia-950 dark:text-fuchsia-400', + pink: 'bg-pink-50 text-pink-700 dark:bg-pink-950 dark:text-pink-400', + rose: 'bg-rose-50 text-rose-700 dark:bg-rose-950 dark:text-rose-400' + }; + return colorMap[color] || colorMap.blue; + } + + /** + * @param {string} color + */ + function getColorDotClass(color) { + const colorMap = { + gray: 'bg-slate-500', + red: 'bg-red-500', + orange: 'bg-orange-500', + amber: 'bg-amber-500', + yellow: 'bg-yellow-500', + lime: 'bg-lime-500', + green: 'bg-emerald-500', + emerald: 'bg-emerald-500', + teal: 'bg-teal-500', + cyan: 'bg-cyan-500', + sky: 'bg-sky-500', + blue: 'bg-blue-500', + indigo: 'bg-indigo-500', + violet: 'bg-violet-500', + purple: 'bg-purple-500', + fuchsia: 'bg-fuchsia-500', + pink: 'bg-pink-500', + rose: 'bg-rose-500' + }; + return colorMap[color] || colorMap.blue; + } - Tag Management - BottleCRM + Tags - BottleCRM - - {#snippet actions()} - - {/snippet} - - -
- - - - - - Active Tags ({activeTags.length}) - - Tags available for use across all entities - - - {#if activeTags.length === 0} -

- No tags created yet. Click "New Tag" to create your first tag. + +

+
+
+
+

Tags

+

+ Create and manage tags to organize contacts, companies, deals, and tickets.

- {:else} -
- {#each activeTags as tag (tag.id)} -
-
- {tag.name} - {#if tag.description} - - {tag.description} - - {/if} -
-
- -
- - -
-
-
- {/each} -
- {/if} - - - - - {#if archivedTags.length > 0} - - - - - Archived Tags ({archivedTags.length}) - - Hidden from selection but preserved in existing associations - - -
- {#each archivedTags as tag (tag.id)} -
- {tag.name} -
- - -
-
- {/each} -
-
-
- {/if} +
+ +
+
- +
+ +
+
+
+ + +
+
+ + +
+
+
+ + +
+ {#if !showArchived} + {#if filteredActiveTags.length === 0} +
+
+ +
+ {#if searchQuery} +

No tags found

+

+ No tags match "{searchQuery}". Try a different search term. +

+ {:else} +

No tags yet

+

+ Tags help you organize and filter your CRM records. Create your first tag to get started. +

+ + {/if} +
+ {:else} +
+ + + + + + + + + + {#each filteredActiveTags as tag (tag.id)} + + + + + + {/each} + +
+ Tag name + + Description + + Actions +
+
+ + + {tag.name} + +
+
+ + {tag.description || '—'} + + +
+ + + + + + +
+ + + + +
+
+
+
+
+
+

+ Showing {filteredActiveTags.length} of {activeTags.length} active tags +

+ {/if} + {:else} + {#if filteredArchivedTags.length === 0} +
+
+ +
+ {#if searchQuery} +

No archived tags found

+

+ No archived tags match "{searchQuery}". +

+ {:else} +

No archived tags

+

+ Archived tags will appear here. +

+ {/if} +
+ {:else} +
+ + + + + + + + + + {#each filteredArchivedTags as tag (tag.id)} + + + + + + {/each} + +
+ Tag name + + Description + + Actions +
+
+ + + {tag.name} + +
+
+ + {tag.description || '—'} + + +
+ + +
+
+
+

+ Showing {filteredArchivedTags.length} of {archivedTags.length} archived tags +

+ {/if} + {/if} +
+
+ + - - - Create New Tag - Add a new tag to organize your CRM entities - + +
+ Create a tag + + Tags help you organize and segment your records. + +
-
-
- +
+
+
-
- + +
+
{#each TAG_COLORS as color} {/each}
-
- + +
+
+ + +
+ +
+ + + {formName || 'Tag name'} + +
+
- - - - + +
- + - - - Edit Tag - Update tag details - + +
+ Edit tag + + Update the tag name, color, or description. + +
-
-
- - +
+
+ +
-
- + +
+
{#each TAG_COLORS as color} {/each}
-
- - + +
+ + +
+ + +
+ +
+ + + {formName || 'Tag name'} + +
- - - - + +
diff --git a/frontend/src/routes/(app)/support/+page.svelte b/frontend/src/routes/(app)/support/+page.svelte index c0ffebba..f209a7a8 100644 --- a/frontend/src/routes/(app)/support/+page.svelte +++ b/frontend/src/routes/(app)/support/+page.svelte @@ -9,12 +9,13 @@ Heart, Users, ExternalLink, - MessageCircle + Sparkles, + ArrowRight, + Zap, + Code2, + MessageSquareHeart } from '@lucide/svelte'; - import PageHeader from '$lib/components/layout/PageHeader.svelte'; import { Button } from '$lib/components/ui/button/index.js'; - import * as Card from '$lib/components/ui/card/index.js'; - import { Separator } from '$lib/components/ui/separator/index.js'; /** @type {{ data: import('./$types').PageData }} */ let { data } = $props(); @@ -24,228 +25,699 @@ Support - BottleCRM - +
+ +
+
+
+
+ + Open Source • Forever Free +
+

+ Help & Support +

+

+ Join thousands of businesses using BottleCRM to manage customer relationships without the enterprise price tag. +

+
+
-
-
- - - -
-
- -
-
-

Our Mission

-

- BottleCRM addresses the high subscription costs of commercial CRM alternatives by - providing a completely free, open-source, and highly customizable solution. Clone it, - self-host it, and make it yours - forever free. -

-
-
-
-
- - -
- - - -
-
- -
- Community Support -
-
- -

- Join our open-source community for free support, discussions, and collaboration. -

- -
-
- - - - -
-
- -
- Professional Support -
-
- -

- Get priority support, hosting assistance, and custom development services. -

- -
-
+ +
+
+
+ +
+
+

Our Mission

+

+ BottleCRM addresses the high subscription costs of commercial CRM alternatives by providing a + completely free, open-source, and highly customizable solution. Clone it, self-host it, + and make it yours — forever free. +

+
+
- - - -
-
- + +
+ + + + +
+
+
+ +
+
+

Professional Support

+

+ Priority support, hosting assistance, and custom development services from the core team.

+
+ + +
+
+
+ +
+
+

Feature Requests

+

+ Have an idea? Share your requests and help shape the future of BottleCRM. +

+ - - +
- - - -
-
- -
-
- Bug Reports - Found a bug? Help us improve BottleCRM + +
+
+
+
- - -

- Your feedback helps make the platform more stable for everyone. +

Bug Reports

+

+ Found an issue? Your feedback helps make the platform more stable for everyone.

-
- +
- - - -
-
- -
-
- Security Issues - Report security vulnerabilities privately + +
+
+
+
+
+
Critical
- - -

- Security is our priority. If you discover any security vulnerabilities, please - report them privately. Do not create public GitHub issues for security concerns. +

Security Issues

+

+ Security is our priority. Report vulnerabilities privately. + Never create public issues for security concerns.

-
- +
+
- - - -
-
- -
-
- Custom CRM Development - Tailored to your specific business needs -
+ +
+ -
+ + +
+ BottleCRM + • + v1.0.0 +
+
+ + diff --git a/frontend/src/routes/(no-layout)/login/+page.svelte b/frontend/src/routes/(no-layout)/login/+page.svelte index 982d923b..878ca0d0 100644 --- a/frontend/src/routes/(no-layout)/login/+page.svelte +++ b/frontend/src/routes/(no-layout)/login/+page.svelte @@ -3,44 +3,33 @@ import imgGoogle from '$lib/assets/images/google.svg'; import imgLogo from '$lib/assets/images/logo.png'; - import { - Users, - BarChart3, - CheckCircle2, - TrendingUp, - Shield, - Lock, - ArrowRight, - Sparkles, - Building2, - Target, - PieChart - } from '@lucide/svelte'; + import { ArrowRight, Users, Target, BarChart3, Building2, CheckCircle2 } from '@lucide/svelte'; let { data } = $props(); let isLoading = $state(false); + let mousePosition = $state({ x: 50, y: 50 }); const features = [ { icon: Users, title: 'Contact Management', - description: 'Organize and track all your customer relationships in one place' + description: 'Organize and track all your customer relationships' }, { icon: Target, title: 'Sales Pipeline', - description: 'Visualize deals and track progress through custom stages' + description: 'Visualize deals and track progress through stages' }, { icon: BarChart3, title: 'Analytics & Reports', - description: 'Get insights with powerful dashboards and reporting' + description: 'Get insights with powerful dashboards' }, { icon: Building2, title: 'Multi-Organization', - description: 'Manage multiple businesses from a single account' + description: 'Manage multiple businesses from one account' } ]; @@ -53,6 +42,14 @@ function handleGoogleLogin() { isLoading = true; } + + function handleMouseMove(e) { + const rect = e.currentTarget.getBoundingClientRect(); + mousePosition = { + x: ((e.clientX - rect.left) / rect.width) * 100, + y: ((e.clientY - rect.top) / rect.height) * 100 + }; + } @@ -61,204 +58,806 @@ name="description" content="Sign in to BottleCRM - the open-source CRM solution for startups and growing businesses. Manage contacts, track deals, and grow your business." /> + + + -
- -