Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hcmpre 1250 beneficiary pagination,search and filter #617

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions apps/health_campaign_field_worker_app/lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import 'package:referral_reconciliation/router/referral_reconciliation_router.gm
import 'package:registration_delivery/registration_delivery.dart';
import 'package:registration_delivery/router/registration_delivery_router.gm.dart';
import 'package:survey_form/router/survey_form_router.gm.dart';
import 'package:digit_data_model/models/entities/household_type.dart';

import '../blocs/app_initialization/app_initialization.dart';
import '../blocs/auth/auth.dart';
Expand Down Expand Up @@ -356,10 +357,25 @@ class _HomePageState extends LocalizedState<HomePage> {
icon: Icons.all_inbox,
label: i18.home.beneficiaryLabel,
onPressed: () async {
RegistrationDeliverySingleton()
.setHouseholdType(HouseholdType.family);
await context.router.push(const RegistrationDeliveryWrapperRoute());
},
),
),

i18.home.clfLabel: homeShowcaseData.clf.buildWith(
child: HomeItemCard(
icon: Icons.account_balance,
label: i18.home.clfLabel,
onPressed: () async {
RegistrationDeliverySingleton()
.setHouseholdType(HouseholdType.community);
await context.router.push(const RegistrationDeliveryWrapperRoute());
},
),
),

i18.home.closedHouseHoldLabel: homeShowcaseData.closedHouseHold.buildWith(
child: HomeItemCard(
icon: Icons.home,
Expand Down Expand Up @@ -511,7 +527,8 @@ class _HomePageState extends LocalizedState<HomePage> {
homeShowcaseData.warehouseManagerManageStock.showcaseKey,
i18.home.stockReconciliationLabel:
homeShowcaseData.wareHouseManagerStockReconciliation.showcaseKey,
i18.home.mySurveyForm: homeShowcaseData.supervisorMySurveyForm.showcaseKey,
i18.home.mySurveyForm:
homeShowcaseData.supervisorMySurveyForm.showcaseKey,
i18.home.fileComplaint:
homeShowcaseData.distributorFileComplaint.showcaseKey,
i18.home.syncDataLabel: homeShowcaseData.distributorSyncData.showcaseKey,
Expand All @@ -524,11 +541,13 @@ class _HomePageState extends LocalizedState<HomePage> {
i18.home.closedHouseHoldLabel:
homeShowcaseData.closedHouseHold.showcaseKey,
i18.home.dashboard: homeShowcaseData.dashBoard.showcaseKey,
i18.home.clfLabel: homeShowcaseData.clf.showcaseKey,
};

final homeItemsLabel = <String>[
// INFO: Need to add items label of package Here
i18.home.beneficiaryLabel,
i18.home.clfLabel,
i18.home.closedHouseHoldLabel,
i18.home.manageStockLabel,
i18.home.stockReconciliationLabel,
Expand Down Expand Up @@ -725,14 +744,18 @@ void setPackagesSingleton(BuildContext context) {
loggedInIndividualId: context.loggedInIndividualId ?? '',
loggedInUserUuid: context.loggedInUserUuid,
appVersion: Constants().version,
isHealthFacilityWorker: context.loggedInUserRoles.where((role) => role.code == RolesType.healthFacilityWorker.toValue()).toList().isNotEmpty,
isHealthFacilityWorker: context.loggedInUserRoles
.where((role) =>
role.code == RolesType.healthFacilityWorker.toValue())
.toList()
.isNotEmpty,
roles: context.read<AuthBloc>().state.maybeMap(
orElse: () => const Offstage(),
authenticated: (res) {
return res.userModel.roles
.map((e) => e.code.snakeCase.toUpperCase())
.toList();
}),
orElse: () => const Offstage(),
authenticated: (res) {
return res.userModel.roles
.map((e) => e.code.snakeCase.toUpperCase())
.toList();
}),
);

ReferralReconSingleton().setInitialData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class HomeShowcase {
String get deleteAll {
return 'WAREHOUSE_MANAGER_HOME_SHOWCASE_DELETE_ALL';
}

String get clf {
return "COMMUNAL_LIVING_FACILITY_SHOWCASE";
}
}

class SelectStockShowcase {
Expand Down Expand Up @@ -510,7 +514,6 @@ class ComplaintsInboxShowcase {
}
}


class ForgotPassword {
const ForgotPassword();

Expand Down Expand Up @@ -561,6 +564,8 @@ class Home {
String get manageAttendanceLabel => 'HOME_MANAGE_ATTENDANCE_LABEL';

String get closedHouseHoldLabel => 'HOME_CLOSE_HOUSEHOLD_LABEL';

String get clfLabel => "HOME_COMMUNAL_LIVING_FACILITIES_LABEL";
}

class AcknowledgementSuccess {
Expand Down Expand Up @@ -1014,7 +1019,6 @@ class PrivacyPolicy {
String get privacyNoticeText => 'PRIVACY_POLICY_TEXT';
String get privacyPolicyLinkText => 'PRIVACY_POLICY_LINK_TEXT';
String get privacyPolicyValidationText => 'PRIVACY_POLICY_VALIDATION_TEXT';

}

class Dashboard {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ class _HomePageShowcaseData {
final closedHouseHold = ShowcaseItemBuilder(
messageLocalizationKey: i18.home.closedHouseHoldLabel,
);

final clf = ShowcaseItemBuilder(messageLocalizationKey: i18.homeShowcase.clf);
}
10 changes: 5 additions & 5 deletions apps/health_campaign_field_worker_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ packages:
path: "../../packages/closed_household"
relative: true
source: path
version: "1.0.1+1"
version: "1.0.2-dev.1"
code_builder:
dependency: transitive
description:
Expand Down Expand Up @@ -1343,10 +1343,10 @@ packages:
dependency: "direct main"
description:
name: intl
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.18.1"
version: "0.19.0"
inventory_management:
dependency: "direct main"
description:
Expand Down Expand Up @@ -1550,10 +1550,10 @@ packages:
dependency: "direct main"
description:
name: package_info_plus
sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79"
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
url: "https://pub.dev"
source: hosted
version: "5.0.1"
version: "4.2.0"
package_info_plus_platform_interface:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Importing necessary packages and files.
import 'dart:io';

import 'package:digit_components/utils/app_logger.dart';
import 'package:digit_data_model/data/local_store/sql_store/tables/localization.dart';
import 'package:drift/drift.dart';
import 'package:drift/native.dart';
Expand All @@ -12,6 +13,7 @@ import '../../../models/entities/beneficiary_type.dart';
import '../../../models/entities/blood_group.dart';
import '../../../models/entities/gender.dart';
import '../../../models/entities/pgr_application_status.dart';
import '../../../models/entities/household_type.dart';
import 'tables/address.dart';
import 'tables/attributes.dart';
import 'tables/boundary.dart';
Expand Down Expand Up @@ -108,7 +110,7 @@ class LocalSqlDataStore extends _$LocalSqlDataStore {

/// The `schemaVersion` getter returns the schema version of the database.
@override
int get schemaVersion => 4;
int get schemaVersion => 5;
yashita-egov marked this conversation as resolved.
Show resolved Hide resolved

/// The `_openConnection` method opens a connection to the database.
/// It returns a `LazyDatabase` that opens the database when it is first accessed.
Expand All @@ -123,4 +125,24 @@ class LocalSqlDataStore extends _$LocalSqlDataStore {
return NativeDatabase(file, logStatements: true, setup: (data) {});
});
}

@override
MigrationStrategy get migration {
return MigrationStrategy(onCreate: (Migrator m) async {
await m.createAll();
}, onUpgrade: (Migrator m, int from, int to) async {
//Add column for householdType for facility based campaign
if (from < 5) {
try {
AppLogger.instance.info('Apply migration $from to $to');
await m.addColumn(household, household.householdType);
} catch (e) {
AppLogger.instance.error(
title: 'migration',
message: e.toString(),
);
}
}
});
}
}
Loading