Skip to content

Commit

Permalink
Feature: Display Additional Organization and Address Data (#2478)
Browse files Browse the repository at this point in the history
* Feature: Display Additional Organization and Address Data

* fixing formatting

* adding translations

* fixing error

* fixing linting error

* fixing custom linting error

* fixing custom linting error

* fixing tests

* fixing tests

* minor change

* fixing coverage

* fixing coverage

* making required changes
  • Loading branch information
Dante291 authored Apr 18, 2024
1 parent 05b89f4 commit 2212d50
Show file tree
Hide file tree
Showing 26 changed files with 1,026 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Count lines of code in each file
run: chmod +x ./.github/workflows/countline.py
- name: Running count lines
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart
- name: setup python
uses: actions/setup-python@v5
- name: Check for presence of ignore directives corresponding to custom lints
Expand Down
Binary file added assets/images/Organisation_Default_Image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "Der Tag wurde hinzugefügt",
"Start time must be before end time": "Die Startzeit muss vor der Endzeit liegen",
"Organisation on different server, logout and scan qr again": "Organisation auf einem anderen Server, ausloggen und QR-Code erneut scannen",
"Post was deleted if you had the rights!": "Der Beitrag wurde gelöscht, wenn Sie die Berechtigungen hatten!"
"Post was deleted if you had the rights!": "Der Beitrag wurde gelöscht, wenn Sie die Berechtigungen hatten!",
"Members": "Mitglieder"
}
3 changes: 2 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "The tag was added",
"Start time must be before end time": "Start time must be before end time",
"Organisation on different server, logout and scan qr again": "Organisation on different server, logout and scan qr again",
"Post was deleted if you had the rights!": "Post was deleted if you had the rights!"
"Post was deleted if you had the rights!": "Post was deleted if you had the rights!",
"Members": "Members"
}
3 changes: 2 additions & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "Se agregó la etiqueta",
"Start time must be before end time": "La hora de inicio debe ser anterior a la hora de finalización",
"Organisation on different server, logout and scan qr again": "Organización en un servidor diferente, cierre la sesión y escanee el código QR nuevamente",
"Post was deleted if you had the rights!": "¡Se eliminó la publicación si tenías los derechos!"
"Post was deleted if you had the rights!": "¡Se eliminó la publicación si tenías los derechos!",
"Members": "Miembros"
}
3 changes: 2 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "La balise a été ajoutée",
"Start time must be before end time": "L'heure de début doit être antérieure à l'heure de fin",
"Organisation on different server, logout and scan qr again": "Organisation sur un serveur différent, déconnectez-vous et scannez à nouveau le code QR",
"Post was deleted if you had the rights!": "Le message a été supprimé si vous aviez les droits !"
"Post was deleted if you had the rights!": "Le message a été supprimé si vous aviez les droits !",
"Members": " Membres"
}
3 changes: 2 additions & 1 deletion lang/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "टैग जोड़ा गया था",
"Start time must be before end time": "शुरू समय अंत समय से पहले होना चाहिए",
"Organisation on different server, logout and scan qr again": "संगठन अलग सर्वर पर है, लॉगआउट करें और फिर से QR स्कैन करें",
"Post was deleted if you had the rights!": "यदि आपके पास अधिकार थे तो पोस्ट हटा दिया गया था!"
"Post was deleted if you had the rights!": "यदि आपके पास अधिकार थे तो पोस्ट हटा दिया गया था!",
"Members": " सदस्य"
}
3 changes: 2 additions & 1 deletion lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "タグが追加されました",
"Start time must be before end time": "開始時間は終了時間より前でなければなりません",
"Organisation on different server, logout and scan qr again": "異なるサーバー上の組織です。ログアウトして、QRコードを再びスキャンしてください。",
"Post was deleted if you had the rights!": "権限がある場合、投稿は削除されました!"
"Post was deleted if you had the rights!": "権限がある場合、投稿は削除されました!",
"Members": " メンバー "
}
3 changes: 2 additions & 1 deletion lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "A tag foi adicionada",
"Start time must be before end time": "O horário de início deve ser anterior ao horário de término",
"Organisation on different server, logout and scan qr again": "Organização em servidor diferente, faça logout e escaneie o QR novamente",
"Post was deleted if you had the rights!": "A postagem foi excluída se você tiver os direitos!"
"Post was deleted if you had the rights!": "A postagem foi excluída se você tiver os direitos!",
"Members": "Membros"
}
3 changes: 2 additions & 1 deletion lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,5 +275,6 @@
"The tag was added": "已添加标签",
"Start time must be before end time": "开始时间必须在结束时间之前",
"Organisation on different server, logout and scan qr again": "组织在不同的服务器上,请注销并重新扫描二维码",
"Post was deleted if you had the rights!": "如果您有权限,则已删除帖子!"
"Post was deleted if you had the rights!": "如果您有权限,则已删除帖子!",
"Members": "成员"
}
3 changes: 3 additions & 0 deletions lib/constants/routing_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,7 @@ class Routes {

/// static variable to access addPostScreen.
static const String addPostScreen = '/addpostscreen';

/// static variable to access org info screen.
static const String orgInfoScreen = '/OrganisationInfoScreen';
}
9 changes: 9 additions & 0 deletions lib/models/organization/org_info.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:hive/hive.dart';
import 'package:talawa/models/organization/org_info_address.dart';
import 'package:talawa/models/user/user_info.dart';

part 'org_info.g.dart';
Expand All @@ -16,6 +17,7 @@ class OrgInfo {
this.image,
this.userRegistrationRequired,
this.name,
this.address,
});

factory OrgInfo.fromJson(
Expand Down Expand Up @@ -57,6 +59,9 @@ class OrgInfo {
)
.toList()
: null,
address: json['address'] != null
? Address.fromJson(json['address'] as Map<String, dynamic>)
: null,
);
}

Expand Down Expand Up @@ -121,4 +126,8 @@ class OrgInfo {
/// The org creatorInfo.
@HiveField(7)
User? creatorInfo;

/// Address of the Organisation.
@HiveField(8)
Address? address;
}
7 changes: 5 additions & 2 deletions lib/models/organization/org_info.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions lib/models/organization/org_info_address.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/// Model for the address of an organisation.
class Address {
/// Constructs an Address object.
Address({
this.city,
this.countryCode,
this.dependentLocality,
this.line1,
this.line2,
this.postalCode,
this.sortingCode,
this.state,
});

/// Factory method to construct an Address from a JSON object.
factory Address.fromJson(Map<String, dynamic> json) {
return Address(
city: json['city'] as String?,
countryCode: json['countryCode'] as String?,
dependentLocality: json['dependentLocality'] as String?,
line1: json['line1'] as String?,
line2: json['line2'] as String?,
postalCode: json['postalCode'] as String?,
sortingCode: json['sortingCode'] as String?,
state: json['state'] as String?,
);
}

/// The city of the address.
final String? city;

/// The country code of the address.
final String? countryCode;

/// The dependent locality of the address.
final String? dependentLocality;

/// The first line of the address.
final String? line1;

/// The second line of the address.
final String? line2;

/// The postal code of the address.
final String? postalCode;

/// The sorting code of the address.
final String? sortingCode;

/// The state of the address.
final String? state;
}
10 changes: 10 additions & 0 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:talawa/views/after_auth_screens/feed/pinned_post_page.dart';
import 'package:talawa/views/after_auth_screens/feed/pinned_post_screen.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/access_request_screen.dart';
import 'package:talawa/views/after_auth_screens/join_org_after_auth/join_organisation_after_auth.dart';
import 'package:talawa/views/after_auth_screens/org_info_screen.dart';
import 'package:talawa/views/after_auth_screens/profile/edit_profile_page.dart';
import 'package:talawa/views/after_auth_screens/profile/profile_page.dart';
import 'package:talawa/views/demo_screens/explore_events_demo.dart';
Expand Down Expand Up @@ -300,6 +301,15 @@ Route<dynamic> generateRoute(RouteSettings settings) {
),
);

case Routes.orgInfoScreen:
final OrgInfo orgInfo = settings.arguments! as OrgInfo;
return MaterialPageRoute(
builder: (context) => OrganisationInfoScreen(
orgInfo: orgInfo,
key: const Key('orginfoscreen'),
),
);

default:
return MaterialPageRoute(
builder: (context) => const DemoPageView(
Expand Down
16 changes: 16 additions & 0 deletions lib/utils/queries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,27 @@ class Queries {
_id
name
image
description
address{
city
countryCode
state
}
userRegistrationRequired
creator{
firstName
lastName
}
members{
firstName
lastName
image
}
admins{
firstName
lastName
image
}
}
}
""";
Expand Down
2 changes: 1 addition & 1 deletion lib/views/after_auth_screens/events/event_info_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class EventInfoBody extends StatelessWidget {
itemBuilder: (BuildContext context, int index) {
return CustomListTile(
key: Key(
'${AppLocalizations.of(context)!.strictTranslate("Attendee")}$index',
'Attendee$index',
),
index: index,
type: TileType.attendee,
Expand Down
Loading

0 comments on commit 2212d50

Please sign in to comment.