From 43084180a946ecb43068a343bd57761627297b2e Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 25 Nov 2024 17:10:45 +0530 Subject: [PATCH 01/47] added pagination for household_overview --- .../household_overview.dart | 90 +- .../household_overview.freezed.dart | 171 ++- .../repositories/local/household_member.dart | 3 + .../lib/models/entities/household_member.dart | 4 + .../entities/household_member.mapper.dart | 8 + .../pages/beneficiary/household_overview.dart | 1245 +++++++++-------- 6 files changed, 866 insertions(+), 655 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 96fc6d58bb..21c8437c71 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -67,14 +67,24 @@ class HouseholdOverviewBloc emit(state.copyWith(loading: true)); // Retrieve household members based on certain criteria. - final members = await householdMemberRepository.search( - HouseholdMemberSearchModel( - householdClientReferenceId: - state.householdMemberWrapper.household != null + final members = event.limit != null + ? await householdMemberRepository.search( + HouseholdMemberSearchModel( + householdClientReferenceId: state + .householdMemberWrapper.household != + null + ? [state.householdMemberWrapper.household!.clientReferenceId] + : [], + limit: event.limit, + offset: event.offset, + ), + ) + : await householdMemberRepository.search(HouseholdMemberSearchModel( + householdClientReferenceId: state + .householdMemberWrapper.household != + null ? [state.householdMemberWrapper.household!.clientReferenceId] - : [], - ), - ); + : [])); // Group household members by household ID. final groupedHouseholds = members.groupListsBy( @@ -120,7 +130,9 @@ class HouseholdOverviewBloc // Search for individuals based on their client reference IDs. final individuals = await individualRepository.search( - IndividualSearchModel(clientReferenceId: individualIds), + IndividualSearchModel( + clientReferenceId: individualIds, + ), ); // Search for project beneficiaries based on specified criteria. @@ -164,14 +176,6 @@ class HouseholdOverviewBloc ?.individualClientReferenceId, ); - // Check if a head of household was found. - if (head == null) { - // If no head of household was found, stop loading and return. - emit(state.copyWith(loading: false)); - - return; - } - // Search for tasks associated with project beneficiaries. var tasks = await taskDataRepository.search(TaskSearchModel( projectBeneficiaryClientReferenceId: @@ -197,6 +201,48 @@ class HouseholdOverviewBloc beneficiaryIndividuals.sort((a, b) => (a.clientAuditDetails?.createdTime ?? 0) .compareTo(b.clientAuditDetails?.createdTime ?? 0)); + + // Check if a head of household was found. + if (head == null) { + // If head is not found, append the new data to the existing state. + + emit(state.copyWith( + loading: false, + offset: members.isNotEmpty && members.length == (event.limit ?? 10) + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + householdMemberWrapper: state.householdMemberWrapper.copyWith( + members: (event.projectBeneficiaryType == BeneficiaryType.individual) + ? [ + ...state.householdMemberWrapper.members ?? [], + ...beneficiaryIndividuals, + ] + : [ + ...state.householdMemberWrapper.members ?? [], + ...individuals, + ], + projectBeneficiaries: [ + ...state.householdMemberWrapper.projectBeneficiaries ?? [], + ...projectBeneficiaries, + ], + tasks: [ + ...?state.householdMemberWrapper.tasks, + ...tasks, + ], + sideEffects: [ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + ], + referrals: [ + ...?state.householdMemberWrapper.referrals, + ...referrals, + ], + ), + )); + + return; + } + // Update the state with the loaded data and stop loading. emit( state.copyWith( @@ -212,6 +258,7 @@ class HouseholdOverviewBloc referrals: referrals, ), loading: false, + offset: members.isNotEmpty ? (event.offset ?? 10) : null, ), ); } @@ -393,10 +440,11 @@ class HouseholdOverviewEvent with _$HouseholdOverviewEvent { required IndividualModel individualModel, }) = HouseholdOverviewSelectIndividualEvent; - const factory HouseholdOverviewEvent.reload({ - required String projectId, - required BeneficiaryType projectBeneficiaryType, - }) = HouseholdOverviewReloadEvent; + const factory HouseholdOverviewEvent.reload( + {required String projectId, + required BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit}) = HouseholdOverviewReloadEvent; } @freezed @@ -405,5 +453,7 @@ class HouseholdOverviewState with _$HouseholdOverviewState { @Default(false) bool loading, required HouseholdMemberWrapper householdMemberWrapper, IndividualModel? selectedIndividual, + int? offset, + int? limit, }) = _HouseholdOverviewState; } diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart index cbaabf4254..ad05e9a9ba 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart @@ -39,8 +39,8 @@ mixin _$HouseholdOverviewEvent { setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) => throw _privateConstructorUsedError; @@ -66,7 +66,8 @@ mixin _$HouseholdOverviewEvent { BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) => throw _privateConstructorUsedError; @@ -92,7 +93,8 @@ mixin _$HouseholdOverviewEvent { BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) => @@ -306,8 +308,8 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) { return deleteHousehold(projectId, householdModel, members, @@ -337,7 +339,8 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) { return deleteHousehold?.call(projectId, householdModel, members, @@ -367,7 +370,8 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) { @@ -578,8 +582,8 @@ class _$HouseholdOverviewDeleteIndividualEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) { return deleteIndividual( @@ -609,7 +613,8 @@ class _$HouseholdOverviewDeleteIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) { return deleteIndividual?.call( @@ -639,7 +644,8 @@ class _$HouseholdOverviewDeleteIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) { @@ -847,8 +853,8 @@ class _$HouseholdOverviewSetAsHeadEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) { return setAsHead( @@ -878,7 +884,8 @@ class _$HouseholdOverviewSetAsHeadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) { return setAsHead?.call( @@ -908,7 +915,8 @@ class _$HouseholdOverviewSetAsHeadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) { @@ -1082,8 +1090,8 @@ class _$HouseholdOverviewSelectIndividualEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) { return selectedIndividual(individualModel); @@ -1112,7 +1120,8 @@ class _$HouseholdOverviewSelectIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) { return selectedIndividual?.call(individualModel); @@ -1141,7 +1150,8 @@ class _$HouseholdOverviewSelectIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) { @@ -1221,7 +1231,11 @@ abstract class _$$HouseholdOverviewReloadEventImplCopyWith<$Res> { $Res Function(_$HouseholdOverviewReloadEventImpl) then) = __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res>; @useResult - $Res call({String projectId, BeneficiaryType projectBeneficiaryType}); + $Res call( + {String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit}); } /// @nodoc @@ -1239,6 +1253,8 @@ class __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res> $Res call({ Object? projectId = null, Object? projectBeneficiaryType = null, + Object? offset = freezed, + Object? limit = freezed, }) { return _then(_$HouseholdOverviewReloadEventImpl( projectId: null == projectId @@ -1249,6 +1265,14 @@ class __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res> ? _value.projectBeneficiaryType : projectBeneficiaryType // ignore: cast_nullable_to_non_nullable as BeneficiaryType, + offset: freezed == offset + ? _value.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, )); } } @@ -1258,16 +1282,23 @@ class __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res> class _$HouseholdOverviewReloadEventImpl implements HouseholdOverviewReloadEvent { const _$HouseholdOverviewReloadEventImpl( - {required this.projectId, required this.projectBeneficiaryType}); + {required this.projectId, + required this.projectBeneficiaryType, + this.offset, + this.limit}); @override final String projectId; @override final BeneficiaryType projectBeneficiaryType; + @override + final int? offset; + @override + final int? limit; @override String toString() { - return 'HouseholdOverviewEvent.reload(projectId: $projectId, projectBeneficiaryType: $projectBeneficiaryType)'; + return 'HouseholdOverviewEvent.reload(projectId: $projectId, projectBeneficiaryType: $projectBeneficiaryType, offset: $offset, limit: $limit)'; } @override @@ -1278,12 +1309,14 @@ class _$HouseholdOverviewReloadEventImpl (identical(other.projectId, projectId) || other.projectId == projectId) && (identical(other.projectBeneficiaryType, projectBeneficiaryType) || - other.projectBeneficiaryType == projectBeneficiaryType)); + other.projectBeneficiaryType == projectBeneficiaryType) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.limit, limit) || other.limit == limit)); } @override - int get hashCode => - Object.hash(runtimeType, projectId, projectBeneficiaryType); + int get hashCode => Object.hash( + runtimeType, projectId, projectBeneficiaryType, offset, limit); @JsonKey(ignore: true) @override @@ -1317,11 +1350,11 @@ class _$HouseholdOverviewReloadEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function( - String projectId, BeneficiaryType projectBeneficiaryType) + required TResult Function(String projectId, + BeneficiaryType projectBeneficiaryType, int? offset, int? limit) reload, }) { - return reload(projectId, projectBeneficiaryType); + return reload(projectId, projectBeneficiaryType, offset, limit); } @override @@ -1347,10 +1380,11 @@ class _$HouseholdOverviewReloadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, }) { - return reload?.call(projectId, projectBeneficiaryType); + return reload?.call(projectId, projectBeneficiaryType, offset, limit); } @override @@ -1376,12 +1410,13 @@ class _$HouseholdOverviewReloadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType)? + TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, + int? offset, int? limit)? reload, required TResult orElse(), }) { if (reload != null) { - return reload(projectId, projectBeneficiaryType); + return reload(projectId, projectBeneficiaryType, offset, limit); } return orElse(); } @@ -1438,12 +1473,15 @@ class _$HouseholdOverviewReloadEventImpl abstract class HouseholdOverviewReloadEvent implements HouseholdOverviewEvent { const factory HouseholdOverviewReloadEvent( - {required final String projectId, - required final BeneficiaryType projectBeneficiaryType}) = - _$HouseholdOverviewReloadEventImpl; + {required final String projectId, + required final BeneficiaryType projectBeneficiaryType, + final int? offset, + final int? limit}) = _$HouseholdOverviewReloadEventImpl; String get projectId; BeneficiaryType get projectBeneficiaryType; + int? get offset; + int? get limit; @JsonKey(ignore: true) _$$HouseholdOverviewReloadEventImplCopyWith< _$HouseholdOverviewReloadEventImpl> @@ -1456,6 +1494,8 @@ mixin _$HouseholdOverviewState { HouseholdMemberWrapper get householdMemberWrapper => throw _privateConstructorUsedError; IndividualModel? get selectedIndividual => throw _privateConstructorUsedError; + int? get offset => throw _privateConstructorUsedError; + int? get limit => throw _privateConstructorUsedError; @JsonKey(ignore: true) $HouseholdOverviewStateCopyWith get copyWith => @@ -1471,7 +1511,9 @@ abstract class $HouseholdOverviewStateCopyWith<$Res> { $Res call( {bool loading, HouseholdMemberWrapper householdMemberWrapper, - IndividualModel? selectedIndividual}); + IndividualModel? selectedIndividual, + int? offset, + int? limit}); $HouseholdMemberWrapperCopyWith<$Res> get householdMemberWrapper; } @@ -1493,6 +1535,8 @@ class _$HouseholdOverviewStateCopyWithImpl<$Res, Object? loading = null, Object? householdMemberWrapper = null, Object? selectedIndividual = freezed, + Object? offset = freezed, + Object? limit = freezed, }) { return _then(_value.copyWith( loading: null == loading @@ -1507,6 +1551,14 @@ class _$HouseholdOverviewStateCopyWithImpl<$Res, ? _value.selectedIndividual : selectedIndividual // ignore: cast_nullable_to_non_nullable as IndividualModel?, + offset: freezed == offset + ? _value.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } @@ -1532,7 +1584,9 @@ abstract class _$$HouseholdOverviewStateImplCopyWith<$Res> $Res call( {bool loading, HouseholdMemberWrapper householdMemberWrapper, - IndividualModel? selectedIndividual}); + IndividualModel? selectedIndividual, + int? offset, + int? limit}); @override $HouseholdMemberWrapperCopyWith<$Res> get householdMemberWrapper; @@ -1554,6 +1608,8 @@ class __$$HouseholdOverviewStateImplCopyWithImpl<$Res> Object? loading = null, Object? householdMemberWrapper = null, Object? selectedIndividual = freezed, + Object? offset = freezed, + Object? limit = freezed, }) { return _then(_$HouseholdOverviewStateImpl( loading: null == loading @@ -1568,6 +1624,14 @@ class __$$HouseholdOverviewStateImplCopyWithImpl<$Res> ? _value.selectedIndividual : selectedIndividual // ignore: cast_nullable_to_non_nullable as IndividualModel?, + offset: freezed == offset + ? _value.offset + : offset // ignore: cast_nullable_to_non_nullable + as int?, + limit: freezed == limit + ? _value.limit + : limit // ignore: cast_nullable_to_non_nullable + as int?, )); } } @@ -1578,7 +1642,9 @@ class _$HouseholdOverviewStateImpl implements _HouseholdOverviewState { const _$HouseholdOverviewStateImpl( {this.loading = false, required this.householdMemberWrapper, - this.selectedIndividual}); + this.selectedIndividual, + this.offset, + this.limit}); @override @JsonKey() @@ -1587,10 +1653,14 @@ class _$HouseholdOverviewStateImpl implements _HouseholdOverviewState { final HouseholdMemberWrapper householdMemberWrapper; @override final IndividualModel? selectedIndividual; + @override + final int? offset; + @override + final int? limit; @override String toString() { - return 'HouseholdOverviewState(loading: $loading, householdMemberWrapper: $householdMemberWrapper, selectedIndividual: $selectedIndividual)'; + return 'HouseholdOverviewState(loading: $loading, householdMemberWrapper: $householdMemberWrapper, selectedIndividual: $selectedIndividual, offset: $offset, limit: $limit)'; } @override @@ -1602,12 +1672,14 @@ class _$HouseholdOverviewStateImpl implements _HouseholdOverviewState { (identical(other.householdMemberWrapper, householdMemberWrapper) || other.householdMemberWrapper == householdMemberWrapper) && (identical(other.selectedIndividual, selectedIndividual) || - other.selectedIndividual == selectedIndividual)); + other.selectedIndividual == selectedIndividual) && + (identical(other.offset, offset) || other.offset == offset) && + (identical(other.limit, limit) || other.limit == limit)); } @override - int get hashCode => Object.hash( - runtimeType, loading, householdMemberWrapper, selectedIndividual); + int get hashCode => Object.hash(runtimeType, loading, householdMemberWrapper, + selectedIndividual, offset, limit); @JsonKey(ignore: true) @override @@ -1619,10 +1691,11 @@ class _$HouseholdOverviewStateImpl implements _HouseholdOverviewState { abstract class _HouseholdOverviewState implements HouseholdOverviewState { const factory _HouseholdOverviewState( - {final bool loading, - required final HouseholdMemberWrapper householdMemberWrapper, - final IndividualModel? selectedIndividual}) = - _$HouseholdOverviewStateImpl; + {final bool loading, + required final HouseholdMemberWrapper householdMemberWrapper, + final IndividualModel? selectedIndividual, + final int? offset, + final int? limit}) = _$HouseholdOverviewStateImpl; @override bool get loading; @@ -1631,6 +1704,10 @@ abstract class _HouseholdOverviewState implements HouseholdOverviewState { @override IndividualModel? get selectedIndividual; @override + int? get offset; + @override + int? get limit; + @override @JsonKey(ignore: true) _$$HouseholdOverviewStateImplCopyWith<_$HouseholdOverviewStateImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/packages/registration_delivery/lib/data/repositories/local/household_member.dart b/packages/registration_delivery/lib/data/repositories/local/household_member.dart index 5815eb473d..6f4ecd9805 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household_member.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household_member.dart @@ -20,6 +20,9 @@ class HouseholdMemberLocalRepository ]) async { return retryLocalCallOperation>(() async { final selectQuery = sql.select(sql.householdMember).join([]); + if (query.limit != null && query.offset != null) { + selectQuery.limit(query.limit!, offset: query.offset); + } final results = await (selectQuery ..where( buildAnd( diff --git a/packages/registration_delivery/lib/models/entities/household_member.dart b/packages/registration_delivery/lib/models/entities/household_member.dart index 740e30753f..b832ddbf1c 100644 --- a/packages/registration_delivery/lib/models/entities/household_member.dart +++ b/packages/registration_delivery/lib/models/entities/household_member.dart @@ -18,6 +18,8 @@ class HouseholdMemberSearchModel extends EntitySearchModel final bool? isHeadOfHousehold; final List? clientReferenceId; final String? tenantId; + int? offset; + int? limit; HouseholdMemberSearchModel({ this.id, @@ -30,6 +32,8 @@ class HouseholdMemberSearchModel extends EntitySearchModel this.isHeadOfHousehold, this.clientReferenceId, this.tenantId, + this.limit, + this.offset, super.boundaryCode, super.isDeleted, }) : super(); diff --git a/packages/registration_delivery/lib/models/entities/household_member.mapper.dart b/packages/registration_delivery/lib/models/entities/household_member.mapper.dart index 83b8174d64..332394459e 100644 --- a/packages/registration_delivery/lib/models/entities/household_member.mapper.dart +++ b/packages/registration_delivery/lib/models/entities/household_member.mapper.dart @@ -85,6 +85,12 @@ class HouseholdMemberSearchModelMapper static const Field _f$additionalFields = Field('additionalFields', _$additionalFields, mode: FieldMode.member); + static int? _$offset(HouseholdMemberSearchModel v) => v.offset; + static const Field _f$offset = + Field('offset', _$offset, mode: FieldMode.member); + static int? _$limit(HouseholdMemberSearchModel v) => v.limit; + static const Field _f$limit = + Field('limit', _$limit, mode: FieldMode.member); @override final MappableFields fields = const { @@ -101,6 +107,8 @@ class HouseholdMemberSearchModelMapper #boundaryCode: _f$boundaryCode, #auditDetails: _f$auditDetails, #additionalFields: _f$additionalFields, + #offset: _f$offset, + #limit: _f$limit, }; @override final bool ignoreNull = true; diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 755e1ca86f..88be60211f 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -41,16 +41,11 @@ class HouseholdOverviewPage extends LocalizedStatefulWidget { class _HouseholdOverviewPageState extends LocalizedState { + int offset = 0; + int limit = 10; @override void initState() { - final bloc = context.read(); - bloc.add( - HouseholdOverviewReloadEvent( - projectId: RegistrationDeliverySingleton().projectId!, - projectBeneficiaryType: - RegistrationDeliverySingleton().beneficiaryType!, - ), - ); + callReloadEvent(offset: offset, limit: limit); super.initState(); } @@ -73,80 +68,115 @@ class _HouseholdOverviewPageState return Scaffold( body: state.loading ? const Center(child: CircularProgressIndicator()) - : ScrollableContent( - header: BackNavigationHelpHeaderWidget( - handleBack: (){ - context.read().add(const SearchHouseholdsEvent.clear()); - }, - ), - enableFixedButton: true, - footer: Offstage( - offstage: beneficiaryType == BeneficiaryType.individual || isOutsideProjectDateRange(), - child: BlocBuilder( - builder: (context, serviceDefinitionState) => - BlocBuilder( - builder: (ctx, deliverInterventionState) => DigitCard( - margin: - const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [state.householdMemberWrapper.tasks?.lastOrNull?.status == - Status.administeredSuccess.toValue() - ? Padding( - padding: const EdgeInsets.symmetric( - vertical: spacer2), - child: Button( - label: localizations.translate( - i18.memberCard - .deliverDetailsUpdateLabel, - ), - isDisabled: state.householdMemberWrapper.tasks?.lastOrNull?.status == Status.administeredSuccess.toValue() - ? true : false, - type: ButtonType.secondary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - serviceDefinitionState.when( - empty: () {}, - isloading: () {}, - serviceDefinitionFetch: - (value, model) { - if (value - .where((element) => element - .code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) - .toList() - .isEmpty) { - context.router.push( - DeliverInterventionRoute(), - ); - } else { - navigateToChecklist(ctx); - } - }); - }, - ), - ) - : Button( - label: localizations.translate( - i18.householdOverView - .householdOverViewActionText, - ), - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - isDisabled: (state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isEmpty || - state.householdMemberWrapper.tasks - ?.lastOrNull?.status == - Status.closeHousehold.toValue() - ? true : false, - onPressed: () async { + : NotificationListener( + onNotification: (scrollNotification) { + if (scrollNotification is ScrollUpdateNotification) { + final metrics = scrollNotification.metrics; + if (metrics.atEdge && metrics.pixels != 0) { + callReloadEvent(offset: offset + limit, limit: limit); + offset += limit; + } + } + return true; + }, + child: ScrollableContent( + header: BackNavigationHelpHeaderWidget( + handleBack: () { + context + .read() + .add(const SearchHouseholdsEvent.clear()); + }, + ), + enableFixedButton: true, + footer: Offstage( + offstage: + beneficiaryType == BeneficiaryType.individual || + isOutsideProjectDateRange(), + child: BlocBuilder( + builder: (context, serviceDefinitionState) => + BlocBuilder( + builder: (ctx, deliverInterventionState) => + DigitCard( + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + state.householdMemberWrapper.tasks?.lastOrNull + ?.status == + Status.administeredSuccess.toValue() + ? Padding( + padding: const EdgeInsets.symmetric( + vertical: spacer2), + child: Button( + label: localizations.translate( + i18.memberCard + .deliverDetailsUpdateLabel, + ), + isDisabled: state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status.administeredSuccess + .toValue() + ? true + : false, + type: ButtonType.secondary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + serviceDefinitionState.when( + empty: () {}, + isloading: () {}, + serviceDefinitionFetch: + (value, model) { + if (value + .where((element) => element + .code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) + .toList() + .isEmpty) { + context.router.push( + DeliverInterventionRoute(), + ); + } else { + navigateToChecklist(ctx); + } + }); + callReloadEvent( + offset: state + .householdMemberWrapper + .members! + .length, + limit: limit); + }, + ), + ) + : Button( + label: localizations.translate( + i18.householdOverView + .householdOverViewActionText, + ), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + isDisabled: (state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isEmpty || + state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status.closeHousehold + .toValue() + ? true + : false, + onPressed: () async { final bloc = ctx .read(); @@ -183,339 +213,32 @@ class _HouseholdOverviewPageState } }); }, - ),] + ), + ]), ), ), ), - ), - slivers: [ - SliverToBoxAdapter( - child: DigitCard( - children: [Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - if ((state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isNotEmpty) - Align( - alignment: Alignment.centerLeft, - child: Button( - onPressed: () { - final projectId = - RegistrationDeliverySingleton() - .projectId!; - - final bloc = - context.read(); - bloc.add( - HouseholdOverviewReloadEvent( - projectId: projectId, - projectBeneficiaryType: - beneficiaryType, - ), - ); - showDialog( - context: context, - builder: (ctx)=> ActionCard( - actions: [ - Button( - prefixIcon: Icons.edit, - label: localizations.translate( - i18.householdOverView - .householdOverViewEditLabel, - ), - type: ButtonType.secondary, - size: ButtonSize.large, - onPressed: () async { - Navigator.of( - context, - rootNavigator: true, - ).pop(); - - HouseholdMemberWrapper wrapper = - state - .householdMemberWrapper; - - final timestamp = wrapper - .headOfHousehold - ?.clientAuditDetails - ?.createdTime; - final date = DateTime - .fromMillisecondsSinceEpoch( - timestamp ?? - DateTime.now() - .millisecondsSinceEpoch, - ); - - final address = - wrapper.household?.address; - - if (address == null) return; - - final projectBeneficiary = state - .householdMemberWrapper - .projectBeneficiaries - ?.firstWhereOrNull( - (element) => - element - .beneficiaryClientReferenceId == - wrapper.household - ?.clientReferenceId, - ); - - await context.router.root.push( - BeneficiaryRegistrationWrapperRoute( - initialState: - BeneficiaryRegistrationEditHouseholdState( - addressModel: address, - individualModel: state - .householdMemberWrapper - .members ?? - [], - householdModel: state - .householdMemberWrapper - .household!, - registrationDate: date, - projectBeneficiaryModel: - projectBeneficiary, - ), - children: [ - HouseholdLocationRoute(), - ], - ), - ); - }, - ), - ], - ), - ); - }, - label: localizations.translate( - i18.householdOverView - .householdOverViewEditIconText, - ), - type: ButtonType.tertiary, - size: ButtonSize.medium, - prefixIcon: Icons.edit, - ), - ), - // BlocBuilder( - // builder: (ctx, deliverInterventionState) => - // Offstage( - // offstage: beneficiaryType == - // BeneficiaryType.individual, - // child: Align( - // alignment: Alignment.centerLeft, - // child: DigitIconButton( - // icon: getStatusAttributes(state, - // deliverInterventionState)['icon'], - // iconText: localizations.translate( - // getStatusAttributes(state, - // deliverInterventionState)[ - // 'textLabel'], - // ), // [TODO: map task status accordingly based on projectBeneficiaries and tasks] - // iconTextColor: getStatusAttributes(state, - // deliverInterventionState)['color'], - // iconColor: getStatusAttributes(state, - // deliverInterventionState)['color'], - // ), - // ), - // ), - // ), - Padding( - padding: const EdgeInsets.all( - spacer2 - ), - child: Text( - localizations.translate(i18.householdOverView - .householdOverViewLabel), - style: textTheme.headingXl, - ), - ), - Padding( - padding: const EdgeInsets.only( - left: spacer2, - right: spacer2, - ), - child: BlocBuilder( - builder: (ctx, deliverInterventionState) { - - bool shouldShowStatus = beneficiaryType == BeneficiaryType.household; - - return Column( - children: [ - DigitTableCard( - element: { - localizations.translate(i18 - .householdOverView - .householdOverViewHouseholdHeadNameLabel): - state - .householdMemberWrapper - .headOfHousehold - ?.name - ?.givenName ?? - localizations.translate( - i18.common.coreCommonNA), - localizations.translate( - i18.householdLocation - .administrationAreaFormLabel, - ): state.householdMemberWrapper.headOfHousehold?.address?.first.locality?.code, - localizations.translate( - i18.deliverIntervention - .memberCountText, - ): state.householdMemberWrapper - .household?.memberCount, - if(shouldShowStatus) - localizations.translate(i18 - .beneficiaryDetails - .status): localizations.translate( - getStatusAttributes(state, - deliverInterventionState)[ - 'textLabel'], - ) - }, - ), - ], - ); - }), - ), - Column( - children: - (state.householdMemberWrapper.members ?? []) - .map( - (e) { - final isHead = state - .householdMemberWrapper - .headOfHousehold - ?.clientReferenceId == - e.clientReferenceId; - final projectBeneficiaryId = state - .householdMemberWrapper - .projectBeneficiaries - ?.firstWhereOrNull((b) => - b.beneficiaryClientReferenceId == - e.clientReferenceId) - ?.clientReferenceId; - - final projectBeneficiary = state - .householdMemberWrapper - .projectBeneficiaries - ?.where( - (element) => - element - .beneficiaryClientReferenceId == - (RegistrationDeliverySingleton() - .beneficiaryType == - BeneficiaryType.individual - ? e.clientReferenceId - : state - .householdMemberWrapper - .household - ?.clientReferenceId), - ) - .toList(); - - final taskData = (projectBeneficiary ?? []) - .isNotEmpty - ? state.householdMemberWrapper.tasks - ?.where((element) => - element - .projectBeneficiaryClientReferenceId == - projectBeneficiary - ?.first.clientReferenceId) - .toList() - : null; - final referralData = (projectBeneficiary ?? - []) - .isNotEmpty - ? state.householdMemberWrapper.referrals - ?.where((element) => - element - .projectBeneficiaryClientReferenceId == - projectBeneficiary - ?.first.clientReferenceId) - .toList() - : null; - final sideEffectData = taskData != null && - taskData.isNotEmpty - ? state - .householdMemberWrapper.sideEffects - ?.where((element) => - element.taskClientReferenceId == - taskData.lastOrNull?.clientReferenceId) - .toList() - : null; - final ageInYears = e.dateOfBirth != null - ? DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).years - : 0; - final ageInMonths = e.dateOfBirth != null - ? DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).months - : 0; - final currentCycle = - RegistrationDeliverySingleton() - .projectType - ?.cycles - ?.firstWhereOrNull( - (e) => - (e.startDate) < - DateTime.now() - .millisecondsSinceEpoch && - (e.endDate) > - DateTime.now() - .millisecondsSinceEpoch, - ); - - final isBeneficiaryRefused = - checkIfBeneficiaryRefused( - taskData, - ); - final isBeneficiaryReferred = - checkIfBeneficiaryReferred( - referralData, - currentCycle, - ); - - return MemberCard( - isHead: isHead, - individual: e, - projectBeneficiaries: - projectBeneficiary ?? [], - tasks: taskData, - sideEffects: sideEffectData, - editMemberAction: () async { - final bloc = - ctx.read(); - - Navigator.of( - context, - rootNavigator: true, - ).pop(); - - final address = e.address; - if (address == null || - address.isEmpty) { - return; - } - + slivers: [ + SliverToBoxAdapter( + child: DigitCard(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + if ((state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isNotEmpty) + Align( + alignment: Alignment.centerLeft, + child: Button( + onPressed: () { final projectId = RegistrationDeliverySingleton() .projectId!; + + final bloc = context + .read(); bloc.add( HouseholdOverviewReloadEvent( projectId: projectId, @@ -523,205 +246,533 @@ class _HouseholdOverviewPageState beneficiaryType, ), ); - - await context.router.root.push( - BeneficiaryRegistrationWrapperRoute( - initialState: - BeneficiaryRegistrationEditIndividualState( - individualModel: e, - householdModel: state - .householdMemberWrapper - .household!, - addressModel: address.first, - projectBeneficiaryModel: state - .householdMemberWrapper - .projectBeneficiaries - ?.firstWhereOrNull( - (element) => - element - .beneficiaryClientReferenceId == - (RegistrationDeliverySingleton() - .beneficiaryType == - BeneficiaryType - .individual - ? e.clientReferenceId - : state + showDialog( + context: context, + builder: (ctx) => ActionCard( + actions: [ + Button( + prefixIcon: Icons.edit, + label: localizations.translate( + i18.householdOverView + .householdOverViewEditLabel, + ), + type: ButtonType.secondary, + size: ButtonSize.large, + onPressed: () async { + Navigator.of( + context, + rootNavigator: true, + ).pop(); + + HouseholdMemberWrapper + wrapper = state + .householdMemberWrapper; + + final timestamp = wrapper + .headOfHousehold + ?.clientAuditDetails + ?.createdTime; + final date = DateTime + .fromMillisecondsSinceEpoch( + timestamp ?? + DateTime.now() + .millisecondsSinceEpoch, + ); + + final address = wrapper + .household?.address; + + if (address == null) return; + + final projectBeneficiary = + state + .householdMemberWrapper + .projectBeneficiaries + ?.firstWhereOrNull( + (element) => + element + .beneficiaryClientReferenceId == + wrapper.household + ?.clientReferenceId, + ); + + await context.router.root + .push( + BeneficiaryRegistrationWrapperRoute( + initialState: + BeneficiaryRegistrationEditHouseholdState( + addressModel: address, + individualModel: state + .householdMemberWrapper + .members ?? + [], + householdModel: state .householdMemberWrapper - .household - ?.clientReferenceId), - ), - ), - children: [ - IndividualDetailsRoute( - isHeadOfHousehold: isHead, + .household!, + registrationDate: date, + projectBeneficiaryModel: + projectBeneficiary, + ), + children: [ + HouseholdLocationRoute(), + ], + ), + ); + callReloadEvent( + offset: 0, limit: 10); + }, ), ], ), ); }, - setAsHeadAction: () { - ctx.read().add( - HouseholdOverviewSetAsHeadEvent( - individualModel: e, - projectId: - RegistrationDeliverySingleton() - .projectId!, - householdModel: state - .householdMemberWrapper - .household!, - projectBeneficiaryType: - beneficiaryType, - ), - ); - - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - deleteMemberAction: () { - showPopup( - context: context, - title: localizations.translate(i18 - .householdOverView - .householdOverViewActionCardTitle), - type: PopUpType.simple, - actions: [ - Button( - label: localizations.translate(i18.householdOverView - .householdOverViewPrimaryActionLabel), - onPressed: () { - Navigator.of( - context, - rootNavigator: true, - ) - ..pop() - ..pop(); - context - .read< - HouseholdOverviewBloc>() - .add( - HouseholdOverviewEvent - .selectedIndividual( - individualModel: e, - ), - ); - context.router.push( - ReasonForDeletionRoute( - isHousholdDelete: false, - ), - ); - }, - type: ButtonType.primary, - size: ButtonSize.large - ), - Button( - label: localizations.translate(i18.householdOverView - .householdOverViewSecondaryActionLabel), - onPressed: () { - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - type: ButtonType.tertiary, - size: ButtonSize.large + label: localizations.translate( + i18.householdOverView + .householdOverViewEditIconText, + ), + type: ButtonType.tertiary, + size: ButtonSize.medium, + prefixIcon: Icons.edit, + ), + ), + // BlocBuilder( + // builder: (ctx, deliverInterventionState) => + // Offstage( + // offstage: beneficiaryType == + // BeneficiaryType.individual, + // child: Align( + // alignment: Alignment.centerLeft, + // child: DigitIconButton( + // icon: getStatusAttributes(state, + // deliverInterventionState)['icon'], + // iconText: localizations.translate( + // getStatusAttributes(state, + // deliverInterventionState)[ + // 'textLabel'], + // ), // [TODO: map task status accordingly based on projectBeneficiaries and tasks] + // iconTextColor: getStatusAttributes(state, + // deliverInterventionState)['color'], + // iconColor: getStatusAttributes(state, + // deliverInterventionState)['color'], + // ), + // ), + // ), + // ), + Padding( + padding: const EdgeInsets.all(spacer2), + child: Text( + localizations.translate(i18 + .householdOverView + .householdOverViewLabel), + style: textTheme.headingXl, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: spacer2, + right: spacer2, + ), + child: BlocBuilder( + builder: (ctx, deliverInterventionState) { + bool shouldShowStatus = beneficiaryType == + BeneficiaryType.household; + + return Column( + children: [ + DigitTableCard( + element: { + localizations.translate(i18 + .householdOverView + .householdOverViewHouseholdHeadNameLabel): + state + .householdMemberWrapper + .headOfHousehold + ?.name + ?.givenName ?? + localizations.translate(i18 + .common.coreCommonNA), + localizations.translate( + i18.householdLocation + .administrationAreaFormLabel, + ): state + .householdMemberWrapper + .headOfHousehold + ?.address + ?.first + .locality + ?.code, + localizations.translate( + i18.deliverIntervention + .memberCountText, + ): state.householdMemberWrapper + .household?.memberCount, + if (shouldShowStatus) + localizations.translate(i18 + .beneficiaryDetails + .status): + localizations.translate( + getStatusAttributes(state, + deliverInterventionState)[ + 'textLabel'], ) - ] - ); - }, - isNotEligible: RegistrationDeliverySingleton() - .projectType - ?.cycles != - null - ? !checkEligibilityForAgeAndSideEffect( - DigitDOBAgeConvertor( - years: ageInYears, - months: ageInMonths, - ), - RegistrationDeliverySingleton() - .projectType, - (taskData ?? []).isNotEmpty - ? taskData?.lastOrNull - : null, - sideEffectData, - ) - : false, - name: e.name?.givenName ?? ' - - ', - years: (e.dateOfBirth == null - ? null - : DigitDateUtils.calculateAge( + }, + ), + ], + ); + }), + ), + Column( + children: + (state.householdMemberWrapper.members ?? + []) + .map( + (e) { + final isHead = state + .householdMemberWrapper + .headOfHousehold + ?.clientReferenceId == + e.clientReferenceId; + final projectBeneficiaryId = state + .householdMemberWrapper + .projectBeneficiaries + ?.firstWhereOrNull((b) => + b.beneficiaryClientReferenceId == + e.clientReferenceId) + ?.clientReferenceId; + + final projectBeneficiary = state + .householdMemberWrapper + .projectBeneficiaries + ?.where( + (element) => + element + .beneficiaryClientReferenceId == + (RegistrationDeliverySingleton() + .beneficiaryType == + BeneficiaryType + .individual + ? e.clientReferenceId + : state + .householdMemberWrapper + .household + ?.clientReferenceId), + ) + .toList(); + + final taskData = (projectBeneficiary ?? + []) + .isNotEmpty + ? state.householdMemberWrapper.tasks + ?.where((element) => + element + .projectBeneficiaryClientReferenceId == + projectBeneficiary + ?.first.clientReferenceId) + .toList() + : null; + final referralData = (projectBeneficiary ?? + []) + .isNotEmpty + ? state + .householdMemberWrapper.referrals + ?.where((element) => + element + .projectBeneficiaryClientReferenceId == + projectBeneficiary + ?.first.clientReferenceId) + .toList() + : null; + final sideEffectData = taskData != null && + taskData.isNotEmpty + ? state.householdMemberWrapper + .sideEffects + ?.where((element) => + element + .taskClientReferenceId == + taskData.lastOrNull + ?.clientReferenceId) + .toList() + : null; + final ageInYears = e.dateOfBirth != null + ? DigitDateUtils.calculateAge( DigitDateUtils .getFormattedDateToDateTime( e.dateOfBirth!, ) ?? DateTime.now(), - ).years), - months: (e.dateOfBirth == null - ? null - : DigitDateUtils.calculateAge( + ).years + : 0; + final ageInMonths = e.dateOfBirth != null + ? DigitDateUtils.calculateAge( DigitDateUtils .getFormattedDateToDateTime( e.dateOfBirth!, ) ?? DateTime.now(), - ).months), - gender: e.gender?.name, - isBeneficiaryRefused: - isBeneficiaryRefused && - !checkStatus( - taskData, - currentCycle, + ).months + : 0; + final currentCycle = + RegistrationDeliverySingleton() + .projectType + ?.cycles + ?.firstWhereOrNull( + (e) => + (e.startDate) < + DateTime.now() + .millisecondsSinceEpoch && + (e.endDate) > + DateTime.now() + .millisecondsSinceEpoch, + ); + + final isBeneficiaryRefused = + checkIfBeneficiaryRefused( + taskData, + ); + final isBeneficiaryReferred = + checkIfBeneficiaryReferred( + referralData, + currentCycle, + ); + + return MemberCard( + isHead: isHead, + individual: e, + projectBeneficiaries: + projectBeneficiary ?? [], + tasks: taskData, + sideEffects: sideEffectData, + editMemberAction: () async { + final bloc = + ctx.read(); + + Navigator.of( + context, + rootNavigator: true, + ).pop(); + + final address = e.address; + if (address == null || + address.isEmpty) { + return; + } + + final projectId = + RegistrationDeliverySingleton() + .projectId!; + bloc.add( + HouseholdOverviewReloadEvent( + projectId: projectId, + projectBeneficiaryType: + beneficiaryType, + ), + ); + + await context.router.root.push( + BeneficiaryRegistrationWrapperRoute( + initialState: + BeneficiaryRegistrationEditIndividualState( + individualModel: e, + householdModel: state + .householdMemberWrapper + .household!, + addressModel: address.first, + projectBeneficiaryModel: state + .householdMemberWrapper + .projectBeneficiaries + ?.firstWhereOrNull( + (element) => + element + .beneficiaryClientReferenceId == + (RegistrationDeliverySingleton() + .beneficiaryType == + BeneficiaryType + .individual + ? e.clientReferenceId + : state + .householdMemberWrapper + .household + ?.clientReferenceId), + ), ), - isBeneficiaryReferred: - isBeneficiaryReferred, - isDelivered: taskData == null - ? false - : taskData.isNotEmpty && - !checkStatus( - taskData, - currentCycle, - ) - ? true - : false, - localizations: localizations, - projectBeneficiaryClientReferenceId: - projectBeneficiaryId, - ); - }, - ).toList(), - ), - const SizedBox( - height: spacer2, - ), - Center( - child: Button( - isDisabled: (state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isEmpty, - onPressed: () => addIndividual( + children: [ + IndividualDetailsRoute( + isHeadOfHousehold: isHead, + ), + ], + ), + ); + callReloadEvent(offset: 0, limit: 10); + }, + setAsHeadAction: () { + ctx.read().add( + HouseholdOverviewSetAsHeadEvent( + individualModel: e, + projectId: + RegistrationDeliverySingleton() + .projectId!, + householdModel: state + .householdMemberWrapper + .household!, + projectBeneficiaryType: + beneficiaryType, + ), + ); + + Navigator.of( context, - state.householdMemberWrapper - .household!, - ), - label: localizations.translate( - i18.householdOverView - .householdOverViewAddActionText, + rootNavigator: true, + ).pop(); + }, + deleteMemberAction: () { + showPopup( + context: context, + title: localizations.translate(i18 + .householdOverView + .householdOverViewActionCardTitle), + type: PopUpType.simple, + actions: [ + Button( + label: localizations + .translate(i18 + .householdOverView + .householdOverViewPrimaryActionLabel), + onPressed: () { + Navigator.of( + context, + rootNavigator: true, + ) + ..pop() + ..pop(); + context + .read< + HouseholdOverviewBloc>() + .add( + HouseholdOverviewEvent + .selectedIndividual( + individualModel: + e, + ), + ); + context.router.push( + ReasonForDeletionRoute( + isHousholdDelete: + false, + ), + ); + }, + type: ButtonType.primary, + size: ButtonSize.large), + Button( + label: localizations + .translate(i18 + .householdOverView + .householdOverViewSecondaryActionLabel), + onPressed: () { + Navigator.of( + context, + rootNavigator: true, + ).pop(); + }, + type: ButtonType.tertiary, + size: ButtonSize.large) + ]); + }, + isNotEligible: + RegistrationDeliverySingleton() + .projectType + ?.cycles != + null + ? !checkEligibilityForAgeAndSideEffect( + DigitDOBAgeConvertor( + years: ageInYears, + months: ageInMonths, + ), + RegistrationDeliverySingleton() + .projectType, + (taskData ?? []).isNotEmpty + ? taskData?.lastOrNull + : null, + sideEffectData, + ) + : false, + name: e.name?.givenName ?? ' - - ', + years: (e.dateOfBirth == null + ? null + : DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).years), + months: (e.dateOfBirth == null + ? null + : DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).months), + gender: e.gender?.name, + isBeneficiaryRefused: + isBeneficiaryRefused && + !checkStatus( + taskData, + currentCycle, + ), + isBeneficiaryReferred: + isBeneficiaryReferred, + isDelivered: taskData == null + ? false + : taskData.isNotEmpty && + !checkStatus( + taskData, + currentCycle, + ) + ? true + : false, + localizations: localizations, + projectBeneficiaryClientReferenceId: + projectBeneficiaryId, + ); + }, + ).toList(), + ), + const SizedBox( + height: spacer2, + ), + Center( + child: Button( + isDisabled: (state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isEmpty, + onPressed: () => addIndividual( + context, + state.householdMemberWrapper.household!, + ), + label: localizations.translate( + i18.householdOverView + .householdOverViewAddActionText, + ), + prefixIcon: Icons.add_circle, + type: ButtonType.tertiary, + size: ButtonSize.medium, ), - prefixIcon: Icons.add_circle, - type: ButtonType.tertiary, - size: ButtonSize.medium, ), - ), - const SizedBox( - height: spacer2, - ), - ], - ),] + const SizedBox( + height: spacer2, + ), + ], + ), + ]), ), - ), - ], + ], + ), ), ); }, @@ -761,7 +812,7 @@ class _HouseholdOverviewPageState if (project?.startDate != null && project?.endDate != null) { final now = DateTime.now().millisecondsSinceEpoch; final startDate = project!.startDate!; - final endDate = project!.endDate!; + final endDate = project.endDate!; return now < startDate || now > endDate; } @@ -769,7 +820,6 @@ class _HouseholdOverviewPageState return false; } - getStatusAttributes(HouseholdOverviewState state, DeliverInterventionState deliverInterventionState) { var textLabel = @@ -807,4 +857,23 @@ class _HouseholdOverviewPageState void navigateToChecklist(BuildContext ctx) async { await context.router.push(BeneficiaryChecklistRoute()); } + + void callReloadEvent({ + required int offset, + required int limit, + }) { + if (mounted) { + final bloc = context.read(); + + bloc.add( + HouseholdOverviewReloadEvent( + projectId: RegistrationDeliverySingleton().projectId!, + projectBeneficiaryType: + RegistrationDeliverySingleton().beneficiaryType!, + offset: offset, + limit: limit, + ), + ); + } + } } From a0cea61a3b2a13133b07084c50949f5e69c23e2b Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Wed, 27 Nov 2024 14:50:29 +0530 Subject: [PATCH 02/47] added search and filter functionality in household_overview --- .../household_overview.dart | 472 ++++++++++------ .../household_overview.freezed.dart | 224 ++++++-- .../local/individual_global_search.dart | 81 ++- .../beneficiary/beneficiary_wrapper.dart | 11 +- .../pages/beneficiary/household_overview.dart | 513 ++++++++++++------ .../beneficiary_registration_wrapper.dart | 5 + .../lib/utils/global_search_parameters.dart | 25 +- 7 files changed, 930 insertions(+), 401 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 21c8437c71..92599b6ed9 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -6,7 +6,10 @@ import 'package:digit_data_model/data_model.dart'; import 'package:digit_data_model/utils/typedefs.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:registration_delivery/registration_delivery.dart'; +import 'package:registration_delivery/utils/global_search_parameters.dart'; +import '../../data/repositories/local/individual_global_search.dart'; import '../../models/entities/household.dart'; import '../../models/entities/household_member.dart'; import '../../models/entities/project_beneficiary.dart'; @@ -30,6 +33,7 @@ class HouseholdOverviewBloc final TaskDataRepository taskDataRepository; final SideEffectDataRepository sideEffectDataRepository; final ReferralDataRepository referralDataRepository; + final IndividualGlobalSearchRepository individualGlobalSearchRepository; HouseholdOverviewBloc( super.initialState, { @@ -41,6 +45,7 @@ class HouseholdOverviewBloc required this.sideEffectDataRepository, required this.referralDataRepository, required this.beneficiaryType, + required this.individualGlobalSearchRepository, }) { on(_handleDeleteHousehold); on(_handleDeleteIndividual); @@ -66,201 +71,344 @@ class HouseholdOverviewBloc // Set the loading state to indicate that data is being loaded. emit(state.copyWith(loading: true)); - // Retrieve household members based on certain criteria. - final members = event.limit != null - ? await householdMemberRepository.search( - HouseholdMemberSearchModel( + if (event.searchByName == null && + (event.selectedFilter == null || event.selectedFilter!.isEmpty)) { + // Retrieve household members based on certain criteria. + final members = event.limit != null + ? await householdMemberRepository.search( + HouseholdMemberSearchModel( + householdClientReferenceId: + state.householdMemberWrapper.household != null + ? [ + state.householdMemberWrapper.household! + .clientReferenceId + ] + : [], + limit: event.limit, + offset: event.offset, + ), + ) + : await householdMemberRepository.search(HouseholdMemberSearchModel( householdClientReferenceId: state .householdMemberWrapper.household != null ? [state.householdMemberWrapper.household!.clientReferenceId] - : [], - limit: event.limit, - offset: event.offset, - ), - ) - : await householdMemberRepository.search(HouseholdMemberSearchModel( - householdClientReferenceId: state - .householdMemberWrapper.household != - null - ? [state.householdMemberWrapper.household!.clientReferenceId] - : [])); - - // Group household members by household ID. - final groupedHouseholds = members.groupListsBy( - (element) => element.householdClientReferenceId, - ); + : [])); - final householdId = - state.householdMemberWrapper.household?.clientReferenceId; + // Group household members by household ID. + final groupedHouseholds = members.groupListsBy( + (element) => element.householdClientReferenceId, + ); - // Check if the current household has any members. - if (!groupedHouseholds.containsKey(householdId)) { - // If there are no members, stop loading and return. - emit(state.copyWith(loading: false)); + final householdId = + state.householdMemberWrapper.household?.clientReferenceId; - return; - } + // Check if the current household has any members. + if (!groupedHouseholds.containsKey(householdId)) { + // If there are no members, stop loading and return. + emit(state.copyWith(loading: false)); - // Retrieve the list of household members for the current household. - final householdMemberList = groupedHouseholds[householdId]!; + return; + } - // Extract individual IDs from the household member list. - final individualIds = householdMemberList - .map((e) => e.individualClientReferenceId) - .whereNotNull() - .toList(); + // Retrieve the list of household members for the current household. + final householdMemberList = groupedHouseholds[householdId]!; - // Search for households with the specified client reference ID. - final households = await householdRepository.search( - HouseholdSearchModel( - clientReferenceId: householdId != null ? [householdId] : []), - ); + // Extract individual IDs from the household member list. + final individualIds = householdMemberList + .map((e) => e.individualClientReferenceId) + .whereNotNull() + .toList(); - // Check if any households were found. - if (households.isEmpty) { - // If no households were found, stop loading and return. - emit(state.copyWith(loading: false)); + // Search for households with the specified client reference ID. + final households = await householdRepository.search( + HouseholdSearchModel( + clientReferenceId: householdId != null ? [householdId] : []), + ); - return; - } + // Check if any households were found. + if (households.isEmpty) { + // If no households were found, stop loading and return. + emit(state.copyWith(loading: false)); - // Retrieve the result household (assuming there's only one). - final resultHousehold = households.first; + return; + } - // Search for individuals based on their client reference IDs. - final individuals = await individualRepository.search( - IndividualSearchModel( - clientReferenceId: individualIds, - ), - ); + // Retrieve the result household (assuming there's only one). + final resultHousehold = households.first; - // Search for project beneficiaries based on specified criteria. - final projectBeneficiaries = await projectBeneficiaryRepository.search( - ProjectBeneficiarySearchModel( - beneficiaryClientReferenceId: - event.projectBeneficiaryType == BeneficiaryType.individual - ? individualIds - : [resultHousehold.clientReferenceId], - projectId: [event.projectId], - // [TODO] Need to pass as a based on Beneficiary Type - ), - ); + // Search for individuals based on their client reference IDs. + final individuals = await individualRepository.search( + IndividualSearchModel( + clientReferenceId: individualIds, + ), + ); + + // Search for project beneficiaries based on specified criteria. + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: + event.projectBeneficiaryType == BeneficiaryType.individual + ? individualIds + : [resultHousehold.clientReferenceId], + projectId: [event.projectId], + // [TODO] Need to pass as a based on Beneficiary Type + ), + ); - // Check if any project beneficiaries were found. - if (projectBeneficiaries.isEmpty) { - // If no project beneficiaries were found, stop loading and return. - emit(state.copyWith(loading: false)); + // Check if any project beneficiaries were found. + if (projectBeneficiaries.isEmpty) { + // If no project beneficiaries were found, stop loading and return. + emit(state.copyWith(loading: false)); - return; - } + return; + } - final beneficiaryClientReferenceIds = projectBeneficiaries - .map((e) => e.beneficiaryClientReferenceId) - .toList(); - - final List beneficiaryIndividuals = individuals - .where((element) => - beneficiaryClientReferenceIds.contains(element.clientReferenceId)) - .toList(); - - // Find the head of the household. - final head = (event.projectBeneficiaryType == BeneficiaryType.individual - ? beneficiaryIndividuals - : individuals) - .firstWhereOrNull( - (i) => - i.clientReferenceId == - householdMemberList - .firstWhereOrNull((h) => h.isHeadOfHousehold) - ?.individualClientReferenceId, - ); + final beneficiaryClientReferenceIds = projectBeneficiaries + .map((e) => e.beneficiaryClientReferenceId) + .toList(); - // Search for tasks associated with project beneficiaries. - var tasks = await taskDataRepository.search(TaskSearchModel( - projectBeneficiaryClientReferenceId: - projectBeneficiaries.map((e) => e.clientReferenceId).toList())); + final List beneficiaryIndividuals = individuals + .where((element) => + beneficiaryClientReferenceIds.contains(element.clientReferenceId)) + .toList(); - // Search for adverse events associated with tasks. - final sideEffects = - await sideEffectDataRepository.search(SideEffectSearchModel( - taskClientReferenceId: - tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), - )); + // Find the head of the household. + final head = (event.projectBeneficiaryType == BeneficiaryType.individual + ? beneficiaryIndividuals + : individuals) + .firstWhereOrNull( + (i) => + i.clientReferenceId == + householdMemberList + .firstWhereOrNull((h) => h.isHeadOfHousehold) + ?.individualClientReferenceId, + ); - final referrals = await referralDataRepository.search(ReferralSearchModel( - projectBeneficiaryClientReferenceId: projectBeneficiaries - .map((e) => e.clientReferenceId) - .whereNotNull() - .toList(), - )); + // Search for tasks associated with project beneficiaries. + var tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList())); + + // Search for adverse events associated with tasks. + final sideEffects = + await sideEffectDataRepository.search(SideEffectSearchModel( + taskClientReferenceId: + tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), + )); + + final referrals = await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: projectBeneficiaries + .map((e) => e.clientReferenceId) + .whereNotNull() + .toList(), + )); - individuals.sort((a, b) => (a.clientAuditDetails?.createdTime ?? 0) - .compareTo(b.clientAuditDetails?.createdTime ?? 0)); + individuals.sort((a, b) => (a.clientAuditDetails?.createdTime ?? 0) + .compareTo(b.clientAuditDetails?.createdTime ?? 0)); - beneficiaryIndividuals.sort((a, b) => - (a.clientAuditDetails?.createdTime ?? 0) - .compareTo(b.clientAuditDetails?.createdTime ?? 0)); + beneficiaryIndividuals.sort((a, b) => + (a.clientAuditDetails?.createdTime ?? 0) + .compareTo(b.clientAuditDetails?.createdTime ?? 0)); - // Check if a head of household was found. - if (head == null) { - // If head is not found, append the new data to the existing state. + // Check if a head of household was found. + if (head == null) { + // If head is not found, append the new data to the existing state. + + emit(state.copyWith( + loading: false, + offset: members.isNotEmpty && members.length == (event.limit ?? 10) + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + householdMemberWrapper: state.householdMemberWrapper.copyWith( + members: + (event.projectBeneficiaryType == BeneficiaryType.individual) + ? [ + ...state.householdMemberWrapper.members ?? [], + ...beneficiaryIndividuals, + ] + : [ + ...state.householdMemberWrapper.members ?? [], + ...individuals, + ], + projectBeneficiaries: [ + ...state.householdMemberWrapper.projectBeneficiaries ?? [], + ...projectBeneficiaries, + ], + tasks: [ + ...?state.householdMemberWrapper.tasks, + ...tasks, + ], + sideEffects: [ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + ], + referrals: [ + ...?state.householdMemberWrapper.referrals, + ...referrals, + ], + ), + )); + + return; + } + + // Update the state with the loaded data and stop loading. + emit( + state.copyWith( + householdMemberWrapper: HouseholdMemberWrapper( + household: resultHousehold, + headOfHousehold: head, + members: (event.projectBeneficiaryType == BeneficiaryType.individual + ? beneficiaryIndividuals + : individuals), + tasks: tasks.isEmpty ? null : tasks, + projectBeneficiaries: projectBeneficiaries, + sideEffects: sideEffects, + referrals: referrals, + ), + loading: false, + offset: members.isNotEmpty + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + // limit: event.limit, + ), + ); + } else { + final totalResult = await individualGlobalSearchRepository + .individualGlobalSearch(GlobalSearchParameters( + householdClientReferenceId: + state.householdMemberWrapper.household!.clientReferenceId, + isProximityEnabled: false, + projectId: RegistrationDeliverySingleton().projectId, + latitude: null, + longitude: null, + maxRadius: null, + nameSearch: event.searchByName, + offset: event.offset, + limit: event.limit, + filter: event.selectedFilter)); + var result = totalResult['data'].map((e) => e).toList(); + + if (result.isEmpty) { + emit(state.copyWith( + loading: false, + householdMemberWrapper: HouseholdMemberWrapper( + household: state.householdMemberWrapper.household, + headOfHousehold: state.householdMemberWrapper.headOfHousehold, + members: [], + tasks: null, + projectBeneficiaries: null, + sideEffects: null, + referrals: null, + ), + )); + return; + } + + late List individualClientReferenceIds = []; + + result.forEach((e) { + individualClientReferenceIds.add(e.clientReferenceId); + }); + + List individuals = await individualRepository.search( + IndividualSearchModel( + clientReferenceId: individualClientReferenceIds + .map((e) => e.toString()) + .toList())); + + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: + event.projectBeneficiaryType == BeneficiaryType.individual + ? individualClientReferenceIds + : [state.householdMemberWrapper.household!.clientReferenceId], + projectId: [event.projectId], + ), + ); + + final beneficiaryClientReferenceIds = projectBeneficiaries + .map((e) => e.beneficiaryClientReferenceId) + .toList(); + + final List beneficiaryIndividuals = individuals + .where((element) => + beneficiaryClientReferenceIds.contains(element.clientReferenceId)) + .toList(); + + final tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList(), + projectId: event.projectId, + )); + + // Search for adverse events associated with tasks. + final sideEffects = + await sideEffectDataRepository.search(SideEffectSearchModel( + taskClientReferenceId: + tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), + )); + + final referrals = await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: projectBeneficiaries + .map((e) => e.clientReferenceId) + .whereNotNull() + .toList(), + )); emit(state.copyWith( loading: false, - offset: members.isNotEmpty && members.length == (event.limit ?? 10) + offset: individuals.isNotEmpty ? (event.offset ?? 0) + (event.limit ?? 10) : null, householdMemberWrapper: state.householdMemberWrapper.copyWith( - members: (event.projectBeneficiaryType == BeneficiaryType.individual) - ? [ - ...state.householdMemberWrapper.members ?? [], - ...beneficiaryIndividuals, - ] + members: event.offset == 0 + ? (event.projectBeneficiaryType == BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals + : [ + ...{ + ...state.householdMemberWrapper.members ?? [], + ...((event.projectBeneficiaryType == + BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals), + }, + ], + projectBeneficiaries: event.offset == 0 + ? projectBeneficiaries + : [ + ...{ + ...state.householdMemberWrapper.projectBeneficiaries ?? [], + ...projectBeneficiaries, + }, + ], + tasks: event.offset == 0 + ? tasks + : [ + ...{...?state.householdMemberWrapper.tasks, ...tasks}, + ], + sideEffects: event.offset == 0 + ? sideEffects : [ - ...state.householdMemberWrapper.members ?? [], - ...individuals, + ...{ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + }, + ], + referrals: event.offset == 0 + ? referrals + : [ + ...{ + ...?state.householdMemberWrapper.referrals, + ...referrals, + }, ], - projectBeneficiaries: [ - ...state.householdMemberWrapper.projectBeneficiaries ?? [], - ...projectBeneficiaries, - ], - tasks: [ - ...?state.householdMemberWrapper.tasks, - ...tasks, - ], - sideEffects: [ - ...?state.householdMemberWrapper.sideEffects, - ...sideEffects, - ], - referrals: [ - ...?state.householdMemberWrapper.referrals, - ...referrals, - ], ), + limit: event.limit, )); - - return; } - - // Update the state with the loaded data and stop loading. - emit( - state.copyWith( - householdMemberWrapper: HouseholdMemberWrapper( - household: resultHousehold, - headOfHousehold: head, - members: (event.projectBeneficiaryType == BeneficiaryType.individual - ? beneficiaryIndividuals - : individuals), - tasks: tasks.isEmpty ? null : tasks, - projectBeneficiaries: projectBeneficiaries, - sideEffects: sideEffects, - referrals: referrals, - ), - loading: false, - offset: members.isNotEmpty ? (event.offset ?? 10) : null, - ), - ); } // This function handles the deletion of a household and its associated members and beneficiaries. @@ -444,7 +592,9 @@ class HouseholdOverviewEvent with _$HouseholdOverviewEvent { {required String projectId, required BeneficiaryType projectBeneficiaryType, int? offset, - int? limit}) = HouseholdOverviewReloadEvent; + int? limit, + List? selectedFilter, + String? searchByName}) = HouseholdOverviewReloadEvent; } @freezed diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart index ad05e9a9ba..6dead0f03a 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.freezed.dart @@ -39,8 +39,13 @@ mixin _$HouseholdOverviewEvent { setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) => throw _privateConstructorUsedError; @@ -66,8 +71,13 @@ mixin _$HouseholdOverviewEvent { BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) => throw _privateConstructorUsedError; @@ -93,8 +103,13 @@ mixin _$HouseholdOverviewEvent { BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) => @@ -308,8 +323,13 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) { return deleteHousehold(projectId, householdModel, members, @@ -339,8 +359,13 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) { return deleteHousehold?.call(projectId, householdModel, members, @@ -370,8 +395,13 @@ class _$HouseholdOverviewDeleteHouseholdEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) { @@ -582,8 +612,13 @@ class _$HouseholdOverviewDeleteIndividualEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) { return deleteIndividual( @@ -613,8 +648,13 @@ class _$HouseholdOverviewDeleteIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) { return deleteIndividual?.call( @@ -644,8 +684,13 @@ class _$HouseholdOverviewDeleteIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) { @@ -853,8 +898,13 @@ class _$HouseholdOverviewSetAsHeadEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) { return setAsHead( @@ -884,8 +934,13 @@ class _$HouseholdOverviewSetAsHeadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) { return setAsHead?.call( @@ -915,8 +970,13 @@ class _$HouseholdOverviewSetAsHeadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) { @@ -1090,8 +1150,13 @@ class _$HouseholdOverviewSelectIndividualEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) { return selectedIndividual(individualModel); @@ -1120,8 +1185,13 @@ class _$HouseholdOverviewSelectIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) { return selectedIndividual?.call(individualModel); @@ -1150,8 +1220,13 @@ class _$HouseholdOverviewSelectIndividualEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) { @@ -1235,7 +1310,9 @@ abstract class _$$HouseholdOverviewReloadEventImplCopyWith<$Res> { {String projectId, BeneficiaryType projectBeneficiaryType, int? offset, - int? limit}); + int? limit, + List? selectedFilter, + String? searchByName}); } /// @nodoc @@ -1255,6 +1332,8 @@ class __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res> Object? projectBeneficiaryType = null, Object? offset = freezed, Object? limit = freezed, + Object? selectedFilter = freezed, + Object? searchByName = freezed, }) { return _then(_$HouseholdOverviewReloadEventImpl( projectId: null == projectId @@ -1273,6 +1352,14 @@ class __$$HouseholdOverviewReloadEventImplCopyWithImpl<$Res> ? _value.limit : limit // ignore: cast_nullable_to_non_nullable as int?, + selectedFilter: freezed == selectedFilter + ? _value._selectedFilter + : selectedFilter // ignore: cast_nullable_to_non_nullable + as List?, + searchByName: freezed == searchByName + ? _value.searchByName + : searchByName // ignore: cast_nullable_to_non_nullable + as String?, )); } } @@ -1285,7 +1372,10 @@ class _$HouseholdOverviewReloadEventImpl {required this.projectId, required this.projectBeneficiaryType, this.offset, - this.limit}); + this.limit, + final List? selectedFilter, + this.searchByName}) + : _selectedFilter = selectedFilter; @override final String projectId; @@ -1295,10 +1385,22 @@ class _$HouseholdOverviewReloadEventImpl final int? offset; @override final int? limit; + final List? _selectedFilter; + @override + List? get selectedFilter { + final value = _selectedFilter; + if (value == null) return null; + if (_selectedFilter is EqualUnmodifiableListView) return _selectedFilter; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + final String? searchByName; @override String toString() { - return 'HouseholdOverviewEvent.reload(projectId: $projectId, projectBeneficiaryType: $projectBeneficiaryType, offset: $offset, limit: $limit)'; + return 'HouseholdOverviewEvent.reload(projectId: $projectId, projectBeneficiaryType: $projectBeneficiaryType, offset: $offset, limit: $limit, selectedFilter: $selectedFilter, searchByName: $searchByName)'; } @override @@ -1311,12 +1413,22 @@ class _$HouseholdOverviewReloadEventImpl (identical(other.projectBeneficiaryType, projectBeneficiaryType) || other.projectBeneficiaryType == projectBeneficiaryType) && (identical(other.offset, offset) || other.offset == offset) && - (identical(other.limit, limit) || other.limit == limit)); + (identical(other.limit, limit) || other.limit == limit) && + const DeepCollectionEquality() + .equals(other._selectedFilter, _selectedFilter) && + (identical(other.searchByName, searchByName) || + other.searchByName == searchByName)); } @override int get hashCode => Object.hash( - runtimeType, projectId, projectBeneficiaryType, offset, limit); + runtimeType, + projectId, + projectBeneficiaryType, + offset, + limit, + const DeepCollectionEquality().hash(_selectedFilter), + searchByName); @JsonKey(ignore: true) @override @@ -1350,11 +1462,17 @@ class _$HouseholdOverviewReloadEventImpl setAsHead, required TResult Function(IndividualModel individualModel) selectedIndividual, - required TResult Function(String projectId, - BeneficiaryType projectBeneficiaryType, int? offset, int? limit) + required TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName) reload, }) { - return reload(projectId, projectBeneficiaryType, offset, limit); + return reload(projectId, projectBeneficiaryType, offset, limit, + selectedFilter, searchByName); } @override @@ -1380,11 +1498,17 @@ class _$HouseholdOverviewReloadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult? Function(IndividualModel individualModel)? selectedIndividual, - TResult? Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult? Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, }) { - return reload?.call(projectId, projectBeneficiaryType, offset, limit); + return reload?.call(projectId, projectBeneficiaryType, offset, limit, + selectedFilter, searchByName); } @override @@ -1410,13 +1534,19 @@ class _$HouseholdOverviewReloadEventImpl BeneficiaryType projectBeneficiaryType)? setAsHead, TResult Function(IndividualModel individualModel)? selectedIndividual, - TResult Function(String projectId, BeneficiaryType projectBeneficiaryType, - int? offset, int? limit)? + TResult Function( + String projectId, + BeneficiaryType projectBeneficiaryType, + int? offset, + int? limit, + List? selectedFilter, + String? searchByName)? reload, required TResult orElse(), }) { if (reload != null) { - return reload(projectId, projectBeneficiaryType, offset, limit); + return reload(projectId, projectBeneficiaryType, offset, limit, + selectedFilter, searchByName); } return orElse(); } @@ -1476,12 +1606,16 @@ abstract class HouseholdOverviewReloadEvent implements HouseholdOverviewEvent { {required final String projectId, required final BeneficiaryType projectBeneficiaryType, final int? offset, - final int? limit}) = _$HouseholdOverviewReloadEventImpl; + final int? limit, + final List? selectedFilter, + final String? searchByName}) = _$HouseholdOverviewReloadEventImpl; String get projectId; BeneficiaryType get projectBeneficiaryType; int? get offset; int? get limit; + List? get selectedFilter; + String? get searchByName; @JsonKey(ignore: true) _$$HouseholdOverviewReloadEventImplCopyWith< _$HouseholdOverviewReloadEventImpl> diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index abd395fef5..68eb625a02 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -225,23 +225,44 @@ class IndividualGlobalSearchRepository extends LocalRepository { .select() .join([joinName(sql), joinIndividualAddress(sql)]); await searchByName(selectQuery, params, sql); - selectQuery = selectQuery.join([ - leftOuterJoin( - sql.householdMember, - sql.householdMember.individualClientReferenceId - .equalsExp(sql.individual.clientReferenceId)) - ]) - ..where(sql.householdMember.isHeadOfHousehold.equals(true)); - selectQuery.join([ - leftOuterJoin( - sql.household, - sql.household.clientReferenceId - .equalsExp(sql.householdMember.householdClientReferenceId)), - leftOuterJoin( - sql.projectBeneficiary, - sql.projectBeneficiary.beneficiaryClientReferenceId - .equalsExp(sql.household.clientReferenceId)) - ]); + if (params.householdClientReferenceId != null) { + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.household, + sql.household.clientReferenceId + .equals(params.householdClientReferenceId ?? '')), + leftOuterJoin( + sql.projectBeneficiary, + sql.projectBeneficiary.beneficiaryClientReferenceId + .equalsExp(sql.individual.clientReferenceId)), + ]); + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)) + ]) + ..where(sql.householdMember.householdClientReferenceId + .equals(params.householdClientReferenceId ?? '')); + } else { + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)) + ]) + ..where(sql.householdMember.isHeadOfHousehold.equals(true)); + selectQuery.join([ + leftOuterJoin( + sql.household, + sql.household.clientReferenceId + .equalsExp(sql.householdMember.householdClientReferenceId)), + leftOuterJoin( + sql.projectBeneficiary, + sql.projectBeneficiary.beneficiaryClientReferenceId + .equalsExp(sql.household.clientReferenceId)) + ]); + } } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && selectQuery != null) { @@ -281,11 +302,33 @@ class IndividualGlobalSearchRepository extends LocalRepository { ..where(filter == Status.registered.name ? sql.projectBeneficiary.beneficiaryClientReferenceId.isNotNull() : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull()); + + if (params.householdClientReferenceId != null) { + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)) + ]) + ..where(sql.householdMember.householdClientReferenceId + .equals(params.householdClientReferenceId ?? '')); + } } else { var filterSearchQuery = await filterTasks(selectQuery, filter, sql, params); selectQuery = filterSearchQuery; + + if (params.householdClientReferenceId != null) { + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)) + ]) + ..where(sql.householdMember.householdClientReferenceId + .equals(params.householdClientReferenceId ?? '')); + } } } else if (selectQuery != null) { if (filter == Status.registered.name || @@ -333,8 +376,8 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equalsExp(sql.task.projectBeneficiaryClientReferenceId)), leftOuterJoin( sql.individual, - sql.individual.clientReferenceId - .equalsExp(sql.projectBeneficiary.beneficiaryClientReferenceId)), + sql.individual.clientReferenceId.equalsExp( + sql.projectBeneficiary.beneficiaryClientReferenceId)), ]) ..where(sql.task.status.equals( statusMap[applyFilter]!.toValue(), diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart index 9b2c4b0801..2fe8488730 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart @@ -10,6 +10,7 @@ import '../../blocs/household_overview/household_overview.dart'; import '../../blocs/referral_management/referral_management.dart'; import '../../blocs/search_households/search_households.dart'; import '../../blocs/side_effects/side_effects.dart'; +import '../../data/repositories/local/individual_global_search.dart'; import '../../models/entities/household.dart'; import '../../models/entities/household_member.dart'; import '../../models/entities/project_beneficiary.dart'; @@ -60,6 +61,9 @@ class BeneficiaryWrapperPage extends StatelessWidget { final serviceDefinationRepo = context.repository(context); + final individualGlobalSearchRepository = + context.read(); + return MultiBlocProvider( providers: [ BlocProvider( @@ -102,6 +106,8 @@ class BeneficiaryWrapperPage extends StatelessWidget { taskDataRepository: task, sideEffectDataRepository: sideEffect, referralDataRepository: referral, + individualGlobalSearchRepository: + individualGlobalSearchRepository, beneficiaryType: RegistrationDeliverySingleton().beneficiaryType!), ), @@ -142,7 +148,10 @@ class BeneficiaryWrapperPage extends StatelessWidget { )..add(DeliverInterventionSearchEvent( taskSearch: TaskSearchModel( projectBeneficiaryClientReferenceId: houseHoldOverviewState - .householdMemberWrapper.projectBeneficiaries?.where((element) => element.projectId == RegistrationDeliverySingleton().projectId) + .householdMemberWrapper.projectBeneficiaries + ?.where((element) => + element.projectId == + RegistrationDeliverySingleton().projectId) .map((e) => e.clientReferenceId) .toList(), ))), diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 88be60211f..51e8e874dc 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -8,6 +8,9 @@ import 'package:digit_ui_components/theme/spacers.dart'; import 'package:digit_ui_components/utils/date_utils.dart'; import 'package:digit_ui_components/widgets/atoms/digit_action_card.dart'; import 'package:digit_ui_components/widgets/atoms/digit_button.dart'; +import 'package:digit_ui_components/widgets/atoms/digit_chip.dart'; +import 'package:digit_ui_components/widgets/atoms/digit_search_bar.dart'; +import 'package:digit_ui_components/widgets/atoms/pop_up_card.dart'; import 'package:digit_ui_components/widgets/molecules/digit_card.dart'; import 'package:digit_ui_components/widgets/molecules/show_pop_up.dart'; import 'package:digit_ui_components/widgets/scrollable_content.dart'; @@ -30,6 +33,7 @@ import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/member_card/member_card.dart'; import '../../widgets/table_card/table_card.dart'; +import '/widgets/status_filter/status_filter.dart'; @RoutePage() class HouseholdOverviewPage extends LocalizedStatefulWidget { @@ -41,8 +45,14 @@ class HouseholdOverviewPage extends LocalizedStatefulWidget { class _HouseholdOverviewPageState extends LocalizedState { + final TextEditingController searchController = TextEditingController(); int offset = 0; int limit = 10; + + String? householdClientReferenceId; + + List selectedFilters = []; + @override void initState() { callReloadEvent(offset: offset, limit: limit); @@ -73,10 +83,13 @@ class _HouseholdOverviewPageState if (scrollNotification is ScrollUpdateNotification) { final metrics = scrollNotification.metrics; if (metrics.atEdge && metrics.pixels != 0) { - callReloadEvent(offset: offset + limit, limit: limit); - offset += limit; + if (state.offset != null) { + callReloadEvent( + offset: state.offset ?? 0, limit: limit); + } } } + //Return true to allow the notification to continue to be dispatched to further ancestors. return true; }, child: ScrollableContent( @@ -88,136 +101,161 @@ class _HouseholdOverviewPageState }, ), enableFixedButton: true, - footer: Offstage( - offstage: - beneficiaryType == BeneficiaryType.individual || - isOutsideProjectDateRange(), - child: BlocBuilder( - builder: (context, serviceDefinitionState) => - BlocBuilder( - builder: (ctx, deliverInterventionState) => - DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [ - state.householdMemberWrapper.tasks?.lastOrNull - ?.status == - Status.administeredSuccess.toValue() - ? Padding( - padding: const EdgeInsets.symmetric( - vertical: spacer2), - child: Button( - label: localizations.translate( - i18.memberCard - .deliverDetailsUpdateLabel, - ), - isDisabled: state - .householdMemberWrapper - .tasks - ?.lastOrNull - ?.status == - Status.administeredSuccess - .toValue() - ? true - : false, - type: ButtonType.secondary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - serviceDefinitionState.when( - empty: () {}, - isloading: () {}, - serviceDefinitionFetch: - (value, model) { - if (value - .where((element) => element - .code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) - .toList() - .isEmpty) { - context.router.push( - DeliverInterventionRoute(), - ); - } else { - navigateToChecklist(ctx); - } - }); - callReloadEvent( - offset: state - .householdMemberWrapper - .members! - .length, - limit: limit); - }, - ), - ) - : Button( - label: localizations.translate( - i18.householdOverView - .householdOverViewActionText, - ), - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - isDisabled: (state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isEmpty || - state + footer: DigitCard( + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + Button( + mainAxisSize: MainAxisSize.max, + onPressed: () => addIndividual( + context, + state.householdMemberWrapper.household!, + ), + label: localizations.translate( + i18.householdOverView + .householdOverViewAddActionText, + ), + prefixIcon: Icons.add_circle, + type: ButtonType.secondary, + size: ButtonSize.medium, + ), + Offstage( + offstage: beneficiaryType == + BeneficiaryType.individual || + isOutsideProjectDateRange(), + child: BlocBuilder( + builder: (context, serviceDefinitionState) => + BlocBuilder( + builder: (ctx, deliverInterventionState) => + state.householdMemberWrapper.tasks + ?.lastOrNull?.status == + Status.administeredSuccess + .toValue() + ? Padding( + padding: + const EdgeInsets.symmetric( + vertical: spacer2), + child: Button( + label: localizations.translate( + i18.memberCard + .deliverDetailsUpdateLabel, + ), + isDisabled: state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status + .administeredSuccess + .toValue() + ? true + : false, + type: ButtonType.secondary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + serviceDefinitionState.when( + empty: () {}, + isloading: () {}, + serviceDefinitionFetch: + (value, model) { + if (value + .where((element) => + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) + .toList() + .isEmpty) { + context.router.push( + DeliverInterventionRoute(), + ); + } else { + navigateToChecklist( + ctx); + } + }); + callReloadEvent( + offset: state .householdMemberWrapper - .tasks - ?.lastOrNull - ?.status == - Status.closeHousehold - .toValue() - ? true - : false, - onPressed: () async { - final bloc = ctx - .read(); - - final projectId = - RegistrationDeliverySingleton() - .projectId!; - - bloc.add( - HouseholdOverviewReloadEvent( - projectId: projectId, - projectBeneficiaryType: - beneficiaryType, + .members! + .length, + limit: limit); + }, ), - ); - - serviceDefinitionState.when( - empty: () {}, - isloading: () {}, - serviceDefinitionFetch: - (value, model) { - if (value - .where((element) => element - .code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) - .toList() - .isEmpty) { - context.router.push( - DeliverInterventionRoute(), - ); - } else { - navigateToChecklist(ctx); - } - }); - }, - ), - ]), - ), - ), - ), + ) + : Button( + label: localizations.translate( + i18.householdOverView + .householdOverViewActionText, + ), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + isDisabled: (state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isEmpty || + state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status.closeHousehold + .toValue() + ? true + : false, + onPressed: () async { + final bloc = ctx.read< + HouseholdOverviewBloc>(); + + final projectId = + RegistrationDeliverySingleton() + .projectId!; + + bloc.add( + HouseholdOverviewReloadEvent( + projectId: projectId, + projectBeneficiaryType: + beneficiaryType, + ), + ); + + serviceDefinitionState.when( + empty: () {}, + isloading: () {}, + serviceDefinitionFetch: + (value, model) { + if (value + .where((element) => + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) + .toList() + .isEmpty) { + context.router.push( + DeliverInterventionRoute(), + ); + } else { + navigateToChecklist( + ctx); + } + }); + callReloadEvent( + offset: state + .householdMemberWrapper + .members! + .length, + limit: limit); + }, + ), + ), + ), + ), + ]), slivers: [ SliverToBoxAdapter( child: DigitCard(children: [ @@ -359,15 +397,56 @@ class _HouseholdOverviewPageState // ), // ), // ), - Padding( - padding: const EdgeInsets.all(spacer2), - child: Text( - localizations.translate(i18 - .householdOverView - .householdOverViewLabel), - style: textTheme.headingXl, - ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(spacer2), + child: Text( + localizations.translate(i18 + .householdOverView + .householdOverViewLabel), + style: textTheme.headingXl, + ), + ), + ), + Column( + children: [ + RegistrationDeliverySingleton() + .searchHouseHoldFilter != + null && + RegistrationDeliverySingleton() + .searchHouseHoldFilter! + .isNotEmpty + ? Align( + alignment: Alignment.topLeft, + child: Padding( + padding: const EdgeInsets.all( + spacer2), + child: Button( + label: + getFilterIconNLabel()[ + 'label'], + size: ButtonSize.medium, + type: ButtonType.tertiary, + suffixIcon: + getFilterIconNLabel()[ + 'icon'], + onPressed: () => + showFilterDialog(), + ), + ), + ) + : const Offstage(), + ], + ), + ], ), + Padding( padding: const EdgeInsets.only( left: spacer2, @@ -423,6 +502,61 @@ class _HouseholdOverviewPageState ); }), ), + Padding( + padding: const EdgeInsets.only( + top: spacer2, bottom: spacer2), + child: DigitSearchBar( + controller: searchController, + hintText: localizations.translate( + i18.common.searchByName, + ), + textCapitalization: + TextCapitalization.words, + onChanged: (value) { + if (value.length >= 3) { + callReloadEvent(offset: 0, limit: 10); + } else if (searchController + .value.text.isEmpty) { + callReloadEvent(offset: 0, limit: 10); + } + }, + ), + ), + selectedFilters.isNotEmpty + ? Align( + alignment: Alignment.topLeft, + child: SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.06, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + itemCount: selectedFilters.length, + itemBuilder: (context, index) { + return Padding( + padding: const EdgeInsets.all( + spacer1), + child: DigitChip( + label: + '${localizations.translate(getStatus(selectedFilters[index]))}' + ' (${state.householdMemberWrapper.members!.length})', + onItemDelete: () { + setState(() { + selectedFilters.remove( + selectedFilters[ + index]); + }); + callReloadEvent( + offset: 0, limit: 10); + }, + ), + ); + }), + ), + ) + : const Offstage(), Column( children: (state.householdMemberWrapper.members ?? @@ -742,31 +876,6 @@ class _HouseholdOverviewPageState }, ).toList(), ), - const SizedBox( - height: spacer2, - ), - Center( - child: Button( - isDisabled: (state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isEmpty, - onPressed: () => addIndividual( - context, - state.householdMemberWrapper.household!, - ), - label: localizations.translate( - i18.householdOverView - .householdOverViewAddActionText, - ), - prefixIcon: Icons.add_circle, - type: ButtonType.tertiary, - size: ButtonSize.medium, - ), - ), - const SizedBox( - height: spacer2, - ), ], ), ]), @@ -872,8 +981,86 @@ class _HouseholdOverviewPageState RegistrationDeliverySingleton().beneficiaryType!, offset: offset, limit: limit, + searchByName: + searchController.text.isNotEmpty ? searchController.text : null, + selectedFilter: selectedFilters, ), ); } } + + getFilterIconNLabel() { + return { + 'label': localizations.translate( + i18.searchBeneficiary.filterLabel, + ), + 'icon': Icons.filter_alt + }; + } + + showFilterDialog() async { + var filters = await showDialog( + context: context, + builder: (ctx) => Popup( + title: getFilterIconNLabel()['label'], + titleIcon: Icon( + getFilterIconNLabel()['icon'], + color: DigitTheme.instance.colorScheme.primary, + ), + onCrossTap: () { + Navigator.of( + context, + rootNavigator: true, + ).pop(); + }, + additionalWidgets: [ + StatusFilter( + selectedFilters: selectedFilters, + ), + ])); + + if (filters != null && filters.isNotEmpty) { + setState(() { + selectedFilters = []; + }); + setState(() { + selectedFilters.addAll(filters); + }); + callReloadEvent(offset: 0, limit: 10); + } else { + setState(() { + selectedFilters = []; + }); + // blocWrapper.clearEvent(); + callReloadEvent(offset: 0, limit: 10); + } + } + + String getStatus(String selectedFilter) { + final statusMap = { + Status.delivered.toValue(): Status.delivered, + Status.notAdministered.toValue(): Status.notAdministered, + Status.visited.toValue(): Status.visited, + Status.notVisited.toValue(): Status.notVisited, + Status.beneficiaryRefused.toValue(): Status.beneficiaryRefused, + Status.beneficiaryReferred.toValue(): Status.beneficiaryReferred, + Status.administeredSuccess.toValue(): Status.administeredSuccess, + Status.administeredFailed.toValue(): Status.administeredFailed, + Status.inComplete.toValue(): Status.inComplete, + Status.toAdminister.toValue(): Status.toAdminister, + Status.closeHousehold.toValue(): Status.closeHousehold, + Status.registered.toValue(): Status.registered, + Status.notRegistered.toValue(): Status.notRegistered, + }; + + var mappedStatus = statusMap.entries + .where((element) => element.value.name == selectedFilter) + .first + .key; + if (mappedStatus != null) { + return mappedStatus; + } else { + return selectedFilter; + } + } } diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_registration_wrapper.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_registration_wrapper.dart index 09f6adf47c..059a523e2e 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_registration_wrapper.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_registration_wrapper.dart @@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/models/entities/individual.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:registration_delivery/data/repositories/local/individual_global_search.dart'; import 'package:registration_delivery/registration_delivery.dart'; import '../../utils/extensions/extensions.dart'; @@ -41,6 +42,9 @@ class BeneficiaryRegistrationWrapperPage extends StatelessWidget final referral = context.repository(context); + final individualGlobalSearch = + context.read(); + return BlocProvider( create: (_) => HouseholdOverviewBloc( HouseholdOverviewState( @@ -89,6 +93,7 @@ class BeneficiaryRegistrationWrapperPage extends StatelessWidget beneficiaryType: RegistrationDeliverySingleton().beneficiaryType!, taskDataRepository: task, sideEffectDataRepository: sideEffect, + individualGlobalSearchRepository: individualGlobalSearch, referralDataRepository: referral) ..add(HouseholdOverviewReloadEvent( projectId: RegistrationDeliverySingleton().selectedProject!.id, diff --git a/packages/registration_delivery/lib/utils/global_search_parameters.dart b/packages/registration_delivery/lib/utils/global_search_parameters.dart index dfee00637f..69bfadbbab 100644 --- a/packages/registration_delivery/lib/utils/global_search_parameters.dart +++ b/packages/registration_delivery/lib/utils/global_search_parameters.dart @@ -1,4 +1,5 @@ class GlobalSearchParameters { + final String? householdClientReferenceId; final bool isProximityEnabled; final double? latitude; final String? projectId; @@ -10,16 +11,16 @@ class GlobalSearchParameters { final List? filter; final int? totalCount; - GlobalSearchParameters({ - required this.isProximityEnabled, - required this.latitude, - required this.longitude, - required this.maxRadius, - required this.nameSearch, - required this.offset, - required this.limit, - required this.filter, - this.totalCount, - this.projectId - }); + GlobalSearchParameters( + {required this.isProximityEnabled, + required this.latitude, + required this.longitude, + required this.maxRadius, + required this.nameSearch, + required this.offset, + required this.limit, + required this.filter, + this.totalCount, + this.projectId, + this.householdClientReferenceId}); } From 4d1caa7d151cc582cb0db73c6d2f39ebcbd552a4 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 28 Nov 2024 11:00:09 +0530 Subject: [PATCH 03/47] fixed issues with test --- .../test/household_overview_test.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/registration_delivery/test/household_overview_test.dart b/packages/registration_delivery/test/household_overview_test.dart index 23bed6d480..aa5be5c248 100644 --- a/packages/registration_delivery/test/household_overview_test.dart +++ b/packages/registration_delivery/test/household_overview_test.dart @@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:registration_delivery/blocs/household_overview/household_overview.dart'; +import 'package:registration_delivery/data/repositories/local/individual_global_search.dart'; import 'package:registration_delivery/models/entities/household.dart'; import 'package:registration_delivery/models/entities/household_member.dart'; import 'package:registration_delivery/models/entities/project_beneficiary.dart'; @@ -34,6 +35,9 @@ class MockSideEffectDataRepository extends Mock class MockReferralDataRepository extends Mock implements ReferralDataRepository {} +class MockIndividualGlobalSearchRepository extends Mock + implements IndividualGlobalSearchRepository {} + void main() { late MockHouseholdDataRepository mockHouseholdDataRepository; late MockIndividualDataRepository mockIndividualDataRepository; @@ -44,6 +48,8 @@ void main() { late MockSideEffectDataRepository mockSideEffectDataRepository; late MockReferralDataRepository mockReferralDataRepository; late HouseholdOverviewBloc householdOverviewBloc; + late MockIndividualGlobalSearchRepository + mockIndividualGlobalSearchRepository; setUp(() { mockHouseholdDataRepository = MockHouseholdDataRepository(); @@ -54,6 +60,8 @@ void main() { mockTaskDataRepository = MockTaskDataRepository(); mockSideEffectDataRepository = MockSideEffectDataRepository(); mockReferralDataRepository = MockReferralDataRepository(); + mockIndividualGlobalSearchRepository = + MockIndividualGlobalSearchRepository(); householdOverviewBloc = HouseholdOverviewBloc( HouseholdOverviewState( householdMemberWrapper: @@ -66,6 +74,7 @@ void main() { sideEffectDataRepository: mockSideEffectDataRepository, referralDataRepository: mockReferralDataRepository, beneficiaryType: BeneficiaryType.individual, + individualGlobalSearchRepository: mockIndividualGlobalSearchRepository, ); }); From 47d0ef9d65ae22b8ab85d344b2a1234c2aaa0f87 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 19 Nov 2024 12:58:49 +0530 Subject: [PATCH 04/47] hcmpre-1259-added homepage card for institution --- .../lib/pages/home.dart | 35 ++++++++++++++----- .../lib/utils/i18_key_constants.dart | 8 +++-- .../showcase/config/home_showcase.dart | 3 ++ .../pubspec.lock | 9 ++++- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index 51477d1041..b09584a51f 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -360,6 +360,15 @@ class _HomePageState extends LocalizedState { }, ), ), + + i18.home.institutionLabel: homeShowcaseData.instituteCampaign.buildWith( + child: HomeItemCard( + icon: Icons.account_balance, + label: i18.home.institutionLabel, + onPressed: () {}, + ), + ), + i18.home.closedHouseHoldLabel: homeShowcaseData.closedHouseHold.buildWith( child: HomeItemCard( icon: Icons.home, @@ -511,7 +520,8 @@ class _HomePageState extends LocalizedState { 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, @@ -524,11 +534,13 @@ class _HomePageState extends LocalizedState { i18.home.closedHouseHoldLabel: homeShowcaseData.closedHouseHold.showcaseKey, i18.home.dashboard: homeShowcaseData.dashBoard.showcaseKey, + i18.home.institutionLabel: homeShowcaseData.instituteCampaign.showcaseKey, }; final homeItemsLabel = [ // INFO: Need to add items label of package Here i18.home.beneficiaryLabel, + i18.home.institutionLabel, i18.home.closedHouseHoldLabel, i18.home.manageStockLabel, i18.home.stockReconciliationLabel, @@ -548,7 +560,8 @@ class _HomePageState extends LocalizedState { .map((e) => e.displayName) .toList() .contains(element) || - element == i18.home.db) + element == i18.home.db || + element == i18.home.institutionLabel) .toList(); final showcaseKeys = filteredLabels @@ -725,14 +738,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().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( diff --git a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart index 6e09406123..f36b3b91a8 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart @@ -203,6 +203,10 @@ class HomeShowcase { String get deleteAll { return 'WAREHOUSE_MANAGER_HOME_SHOWCASE_DELETE_ALL'; } + + String get instituteCampaign { + return "INSTITUTE_CAMPAIGN_SHOWCASE"; + } } class SelectStockShowcase { @@ -510,7 +514,6 @@ class ComplaintsInboxShowcase { } } - class ForgotPassword { const ForgotPassword(); @@ -561,6 +564,8 @@ class Home { String get manageAttendanceLabel => 'HOME_MANAGE_ATTENDANCE_LABEL'; String get closedHouseHoldLabel => 'HOME_CLOSE_HOUSEHOLD_LABEL'; + + String get institutionLabel => "HOME_INSTITUTION_CAMPAIGN_LABEL"; } class AcknowledgementSuccess { @@ -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 { diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart index c5bc7380e9..ba804af85d 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart @@ -105,4 +105,7 @@ class _HomePageShowcaseData { final closedHouseHold = ShowcaseItemBuilder( messageLocalizationKey: i18.home.closedHouseHoldLabel, ); + + final instituteCampaign = ShowcaseItemBuilder( + messageLocalizationKey: i18.homeShowcase.instituteCampaign); } diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index d096797b29..e49f4e151b 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -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: @@ -1334,6 +1334,13 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.1+1" + institution_campaign: + dependency: "direct overridden" + description: + path: "../../packages/institution_campaign" + relative: true + source: path + version: "0.0.1" integration_test: dependency: "direct dev" description: flutter From 0b4ea208edf22756ef1a7a95c518aaf770d78f15 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 28 Nov 2024 16:42:02 +0530 Subject: [PATCH 05/47] added enum householdType for facility based campaign --- .../data/local_store/sql_store/sql_store.dart | 24 +- .../local_store/sql_store/sql_store.g.dart | 50 ++++ .../tables/package_tables/household.dart | 16 +- .../digit_data_model/lib/data_model.init.dart | 144 +++++------ .../lib/models/entities/household_type.dart | 14 ++ .../entities/household_type.mapper.dart | 57 +++++ packages/digit_data_model/pubspec.lock | 236 ++++++++++++++++++ packages/digit_data_model/pubspec.yaml | 1 + .../lib/models/entities/household.dart | 7 + .../lib/models/entities/household.mapper.dart | 19 ++ packages/registration_delivery/pubspec.lock | 14 +- 11 files changed, 497 insertions(+), 85 deletions(-) create mode 100644 packages/digit_data_model/lib/models/entities/household_type.dart create mode 100644 packages/digit_data_model/lib/models/entities/household_type.mapper.dart diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart index 3bb9ed6c17..ad544fbdf9 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart @@ -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'; @@ -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'; @@ -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; /// The `_openConnection` method opens a connection to the database. /// It returns a `LazyDatabase` that opens the database when it is first accessed. @@ -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(), + ); + } + } + }); + } } diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart index 37daa8c694..7ba3256f82 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart @@ -32927,6 +32927,14 @@ class $HouseholdTable extends Household late final GeneratedColumn rowVersion = GeneratedColumn( 'row_version', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _householdTypeMeta = + const VerificationMeta('householdType'); + @override + late final GeneratedColumnWithTypeConverter + householdType = GeneratedColumn('household_type', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false) + .withConverter( + $HouseholdTable.$converterhouseholdTypen); static const VerificationMeta _additionalFieldsMeta = const VerificationMeta('additionalFields'); @override @@ -32952,6 +32960,7 @@ class $HouseholdTable extends Household tenantId, isDeleted, rowVersion, + householdType, additionalFields ]; @override @@ -33057,6 +33066,7 @@ class $HouseholdTable extends Household rowVersion.isAcceptableOrUnknown( data['row_version']!, _rowVersionMeta)); } + context.handle(_householdTypeMeta, const VerificationResult.success()); if (data.containsKey('additional_fields')) { context.handle( _additionalFieldsMeta, @@ -33106,6 +33116,9 @@ class $HouseholdTable extends Household .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted']), rowVersion: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}row_version']), + householdType: $HouseholdTable.$converterhouseholdTypen.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.int, data['${effectivePrefix}household_type'])), additionalFields: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}additional_fields']), ); @@ -33115,6 +33128,12 @@ class $HouseholdTable extends Household $HouseholdTable createAlias(String alias) { return $HouseholdTable(attachedDatabase, alias); } + + static JsonTypeConverter2 $converterhouseholdType = + const EnumIndexConverter(HouseholdType.values); + static JsonTypeConverter2 + $converterhouseholdTypen = + JsonTypeConverter2.asNullable($converterhouseholdType); } class HouseholdData extends DataClass implements Insertable { @@ -33135,6 +33154,7 @@ class HouseholdData extends DataClass implements Insertable { final String? tenantId; final bool? isDeleted; final int? rowVersion; + final HouseholdType? householdType; final String? additionalFields; const HouseholdData( {this.id, @@ -33154,6 +33174,7 @@ class HouseholdData extends DataClass implements Insertable { this.tenantId, this.isDeleted, this.rowVersion, + this.householdType, this.additionalFields}); @override Map toColumns(bool nullToAbsent) { @@ -33207,6 +33228,10 @@ class HouseholdData extends DataClass implements Insertable { if (!nullToAbsent || rowVersion != null) { map['row_version'] = Variable(rowVersion); } + if (!nullToAbsent || householdType != null) { + map['household_type'] = Variable( + $HouseholdTable.$converterhouseholdTypen.toSql(householdType)); + } if (!nullToAbsent || additionalFields != null) { map['additional_fields'] = Variable(additionalFields); } @@ -33262,6 +33287,9 @@ class HouseholdData extends DataClass implements Insertable { rowVersion: rowVersion == null && nullToAbsent ? const Value.absent() : Value(rowVersion), + householdType: householdType == null && nullToAbsent + ? const Value.absent() + : Value(householdType), additionalFields: additionalFields == null && nullToAbsent ? const Value.absent() : Value(additionalFields), @@ -33290,6 +33318,8 @@ class HouseholdData extends DataClass implements Insertable { tenantId: serializer.fromJson(json['tenantId']), isDeleted: serializer.fromJson(json['isDeleted']), rowVersion: serializer.fromJson(json['rowVersion']), + householdType: $HouseholdTable.$converterhouseholdTypen + .fromJson(serializer.fromJson(json['householdType'])), additionalFields: serializer.fromJson(json['additionalFields']), ); } @@ -33314,6 +33344,8 @@ class HouseholdData extends DataClass implements Insertable { 'tenantId': serializer.toJson(tenantId), 'isDeleted': serializer.toJson(isDeleted), 'rowVersion': serializer.toJson(rowVersion), + 'householdType': serializer.toJson( + $HouseholdTable.$converterhouseholdTypen.toJson(householdType)), 'additionalFields': serializer.toJson(additionalFields), }; } @@ -33336,6 +33368,7 @@ class HouseholdData extends DataClass implements Insertable { Value tenantId = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), + Value householdType = const Value.absent(), Value additionalFields = const Value.absent()}) => HouseholdData( id: id.present ? id.value : this.id, @@ -33372,6 +33405,8 @@ class HouseholdData extends DataClass implements Insertable { tenantId: tenantId.present ? tenantId.value : this.tenantId, isDeleted: isDeleted.present ? isDeleted.value : this.isDeleted, rowVersion: rowVersion.present ? rowVersion.value : this.rowVersion, + householdType: + householdType.present ? householdType.value : this.householdType, additionalFields: additionalFields.present ? additionalFields.value : this.additionalFields, @@ -33396,6 +33431,7 @@ class HouseholdData extends DataClass implements Insertable { ..write('tenantId: $tenantId, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') + ..write('householdType: $householdType, ') ..write('additionalFields: $additionalFields') ..write(')')) .toString(); @@ -33420,6 +33456,7 @@ class HouseholdData extends DataClass implements Insertable { tenantId, isDeleted, rowVersion, + householdType, additionalFields); @override bool operator ==(Object other) => @@ -33442,6 +33479,7 @@ class HouseholdData extends DataClass implements Insertable { other.tenantId == this.tenantId && other.isDeleted == this.isDeleted && other.rowVersion == this.rowVersion && + other.householdType == this.householdType && other.additionalFields == this.additionalFields); } @@ -33463,6 +33501,7 @@ class HouseholdCompanion extends UpdateCompanion { final Value tenantId; final Value isDeleted; final Value rowVersion; + final Value householdType; final Value additionalFields; final Value rowid; const HouseholdCompanion({ @@ -33483,6 +33522,7 @@ class HouseholdCompanion extends UpdateCompanion { this.tenantId = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), + this.householdType = const Value.absent(), this.additionalFields = const Value.absent(), this.rowid = const Value.absent(), }); @@ -33504,6 +33544,7 @@ class HouseholdCompanion extends UpdateCompanion { this.tenantId = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), + this.householdType = const Value.absent(), this.additionalFields = const Value.absent(), this.rowid = const Value.absent(), }) : clientReferenceId = Value(clientReferenceId); @@ -33525,6 +33566,7 @@ class HouseholdCompanion extends UpdateCompanion { Expression? tenantId, Expression? isDeleted, Expression? rowVersion, + Expression? householdType, Expression? additionalFields, Expression? rowid, }) { @@ -33548,6 +33590,7 @@ class HouseholdCompanion extends UpdateCompanion { if (tenantId != null) 'tenant_id': tenantId, if (isDeleted != null) 'is_deleted': isDeleted, if (rowVersion != null) 'row_version': rowVersion, + if (householdType != null) 'household_type': householdType, if (additionalFields != null) 'additional_fields': additionalFields, if (rowid != null) 'rowid': rowid, }); @@ -33571,6 +33614,7 @@ class HouseholdCompanion extends UpdateCompanion { Value? tenantId, Value? isDeleted, Value? rowVersion, + Value? householdType, Value? additionalFields, Value? rowid}) { return HouseholdCompanion( @@ -33591,6 +33635,7 @@ class HouseholdCompanion extends UpdateCompanion { tenantId: tenantId ?? this.tenantId, isDeleted: isDeleted ?? this.isDeleted, rowVersion: rowVersion ?? this.rowVersion, + householdType: householdType ?? this.householdType, additionalFields: additionalFields ?? this.additionalFields, rowid: rowid ?? this.rowid, ); @@ -33650,6 +33695,10 @@ class HouseholdCompanion extends UpdateCompanion { if (rowVersion.present) { map['row_version'] = Variable(rowVersion.value); } + if (householdType.present) { + map['household_type'] = Variable( + $HouseholdTable.$converterhouseholdTypen.toSql(householdType.value)); + } if (additionalFields.present) { map['additional_fields'] = Variable(additionalFields.value); } @@ -33679,6 +33728,7 @@ class HouseholdCompanion extends UpdateCompanion { ..write('tenantId: $tenantId, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') + ..write('householdType: $householdType, ') ..write('additionalFields: $additionalFields, ') ..write('rowid: $rowid') ..write(')')) diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/household.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/household.dart index a0e743bd06..7eae8fa782 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/household.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/household.dart @@ -2,6 +2,7 @@ import 'package:drift/drift.dart'; +import '../../../../../models/entities/household_type.dart'; class Household extends Table { TextColumn get id => text().nullable()(); @@ -9,7 +10,8 @@ class Household extends Table { RealColumn get latitude => real().nullable()(); RealColumn get longitude => real().nullable()(); TextColumn get auditCreatedBy => text().nullable()(); - BoolColumn get nonRecoverableError => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get nonRecoverableError => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get auditCreatedTime => integer().nullable()(); IntColumn get clientCreatedTime => integer().nullable()(); TextColumn get clientModifiedBy => text().nullable()(); @@ -19,11 +21,15 @@ class Household extends Table { IntColumn get auditModifiedTime => integer().nullable()(); TextColumn get clientReferenceId => text()(); TextColumn get tenantId => text().nullable()(); - BoolColumn get isDeleted => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get isDeleted => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get rowVersion => integer().nullable()(); - + IntColumn get householdType => intEnum().nullable()(); TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { auditCreatedBy, clientReferenceId, }; -} \ No newline at end of file + Set get primaryKey => { + auditCreatedBy, + clientReferenceId, + }; +} diff --git a/packages/digit_data_model/lib/data_model.init.dart b/packages/digit_data_model/lib/data_model.init.dart index b1d6fe772a..f7068b0a2e 100644 --- a/packages/digit_data_model/lib/data_model.init.dart +++ b/packages/digit_data_model/lib/data_model.init.dart @@ -13,23 +13,24 @@ import 'models/entities/boundary.dart' as p6; import 'models/entities/document.dart' as p7; import 'models/entities/facility.dart' as p8; import 'models/entities/gender.dart' as p9; -import 'models/entities/identifier.dart' as p10; -import 'models/entities/individual.dart' as p11; -import 'models/entities/locality.dart' as p12; -import 'models/entities/name.dart' as p13; -import 'models/entities/pgr_application_status.dart' as p14; -import 'models/entities/product.dart' as p15; -import 'models/entities/product_variant.dart' as p16; -import 'models/entities/project.dart' as p17; -import 'models/entities/project_facility.dart' as p18; -import 'models/entities/project_product_variant.dart' as p19; -import 'models/entities/project_resource.dart' as p20; -import 'models/entities/project_staff.dart' as p21; -import 'models/entities/project_type.dart' as p22; -import 'models/entities/target.dart' as p23; -import 'models/entities/user.dart' as p24; -import 'models/entities/user_action.dart' as p25; -import 'models/oplog/oplog_entry.dart' as p26; +import 'models/entities/household_type.dart' as p10; +import 'models/entities/identifier.dart' as p11; +import 'models/entities/individual.dart' as p12; +import 'models/entities/locality.dart' as p13; +import 'models/entities/name.dart' as p14; +import 'models/entities/pgr_application_status.dart' as p15; +import 'models/entities/product.dart' as p16; +import 'models/entities/product_variant.dart' as p17; +import 'models/entities/project.dart' as p18; +import 'models/entities/project_facility.dart' as p19; +import 'models/entities/project_product_variant.dart' as p20; +import 'models/entities/project_resource.dart' as p21; +import 'models/entities/project_staff.dart' as p22; +import 'models/entities/project_type.dart' as p23; +import 'models/entities/target.dart' as p24; +import 'models/entities/user.dart' as p25; +import 'models/entities/user_action.dart' as p26; +import 'models/oplog/oplog_entry.dart' as p27; void initializeMappers() { p0.EntityModelMapper.ensureInitialized(); @@ -56,58 +57,59 @@ void initializeMappers() { p8.FacilityModelMapper.ensureInitialized(); p8.FacilityAdditionalFieldsMapper.ensureInitialized(); p9.GenderMapper.ensureInitialized(); - p10.IdentifierSearchModelMapper.ensureInitialized(); - p10.IdentifierModelMapper.ensureInitialized(); - p10.IdentifierAdditionalFieldsMapper.ensureInitialized(); - p11.IndividualSearchModelMapper.ensureInitialized(); - p11.IndividualModelMapper.ensureInitialized(); - p11.IndividualAdditionalFieldsMapper.ensureInitialized(); - p12.LocalitySearchModelMapper.ensureInitialized(); - p12.LocalityModelMapper.ensureInitialized(); - p12.LocalityAdditionalFieldsMapper.ensureInitialized(); - p13.NameSearchModelMapper.ensureInitialized(); - p13.NameModelMapper.ensureInitialized(); - p13.NameAdditionalFieldsMapper.ensureInitialized(); - p14.PgrServiceApplicationStatusMapper.ensureInitialized(); - p15.ProductSearchModelMapper.ensureInitialized(); - p15.ProductModelMapper.ensureInitialized(); - p15.ProductAdditionalFieldsMapper.ensureInitialized(); - p16.ProductVariantSearchModelMapper.ensureInitialized(); - p16.ProductVariantModelMapper.ensureInitialized(); - p16.ProductVariantAdditionalFieldsMapper.ensureInitialized(); - p17.ProjectSearchModelMapper.ensureInitialized(); - p17.ProjectModelMapper.ensureInitialized(); - p17.ProjectAdditionalFieldsMapper.ensureInitialized(); - p17.ProjectAdditionalDetailsMapper.ensureInitialized(); - p18.ProjectFacilitySearchModelMapper.ensureInitialized(); - p18.ProjectFacilityModelMapper.ensureInitialized(); - p18.ProjectFacilityAdditionalFieldsMapper.ensureInitialized(); - p19.ProjectProductVariantSearchModelMapper.ensureInitialized(); - p19.ProjectProductVariantModelMapper.ensureInitialized(); - p19.ProjectProductVariantAdditionalFieldsMapper.ensureInitialized(); - p20.ProjectResourceSearchModelMapper.ensureInitialized(); - p20.ProjectResourceModelMapper.ensureInitialized(); - p20.ProjectResourceAdditionalFieldsMapper.ensureInitialized(); - p21.ProjectStaffSearchModelMapper.ensureInitialized(); - p21.ProjectStaffModelMapper.ensureInitialized(); - p21.ProjectStaffAdditionalFieldsMapper.ensureInitialized(); - p22.ProjectTypeModelMapper.ensureInitialized(); - p22.ProjectTypeAdditionalFieldsMapper.ensureInitialized(); - p22.ProjectCycleMapper.ensureInitialized(); - p22.ProjectCycleDeliveryMapper.ensureInitialized(); - p22.DeliveryDoseCriteriaMapper.ensureInitialized(); - p22.DeliveryProductVariantMapper.ensureInitialized(); - p23.TargetSearchModelMapper.ensureInitialized(); - p23.TargetModelMapper.ensureInitialized(); - p23.TargetAdditionalFieldsMapper.ensureInitialized(); - p24.UserSearchModelMapper.ensureInitialized(); - p24.UserModelMapper.ensureInitialized(); - p24.UserAdditionalFieldsMapper.ensureInitialized(); - p25.UserActionSearchModelMapper.ensureInitialized(); - p25.UserActionModelMapper.ensureInitialized(); - p25.UserActionAdditionalFieldsMapper.ensureInitialized(); - p26.OpLogEntryMapper.ensureInitialized(); - p26.AdditionalIdMapper.ensureInitialized(); - p26.DataOperationMapper.ensureInitialized(); - p26.ApiOperationMapper.ensureInitialized(); + p10.HouseholdTypeMapper.ensureInitialized(); + p11.IdentifierSearchModelMapper.ensureInitialized(); + p11.IdentifierModelMapper.ensureInitialized(); + p11.IdentifierAdditionalFieldsMapper.ensureInitialized(); + p12.IndividualSearchModelMapper.ensureInitialized(); + p12.IndividualModelMapper.ensureInitialized(); + p12.IndividualAdditionalFieldsMapper.ensureInitialized(); + p13.LocalitySearchModelMapper.ensureInitialized(); + p13.LocalityModelMapper.ensureInitialized(); + p13.LocalityAdditionalFieldsMapper.ensureInitialized(); + p14.NameSearchModelMapper.ensureInitialized(); + p14.NameModelMapper.ensureInitialized(); + p14.NameAdditionalFieldsMapper.ensureInitialized(); + p15.PgrServiceApplicationStatusMapper.ensureInitialized(); + p16.ProductSearchModelMapper.ensureInitialized(); + p16.ProductModelMapper.ensureInitialized(); + p16.ProductAdditionalFieldsMapper.ensureInitialized(); + p17.ProductVariantSearchModelMapper.ensureInitialized(); + p17.ProductVariantModelMapper.ensureInitialized(); + p17.ProductVariantAdditionalFieldsMapper.ensureInitialized(); + p18.ProjectSearchModelMapper.ensureInitialized(); + p18.ProjectModelMapper.ensureInitialized(); + p18.ProjectAdditionalFieldsMapper.ensureInitialized(); + p18.ProjectAdditionalDetailsMapper.ensureInitialized(); + p19.ProjectFacilitySearchModelMapper.ensureInitialized(); + p19.ProjectFacilityModelMapper.ensureInitialized(); + p19.ProjectFacilityAdditionalFieldsMapper.ensureInitialized(); + p20.ProjectProductVariantSearchModelMapper.ensureInitialized(); + p20.ProjectProductVariantModelMapper.ensureInitialized(); + p20.ProjectProductVariantAdditionalFieldsMapper.ensureInitialized(); + p21.ProjectResourceSearchModelMapper.ensureInitialized(); + p21.ProjectResourceModelMapper.ensureInitialized(); + p21.ProjectResourceAdditionalFieldsMapper.ensureInitialized(); + p22.ProjectStaffSearchModelMapper.ensureInitialized(); + p22.ProjectStaffModelMapper.ensureInitialized(); + p22.ProjectStaffAdditionalFieldsMapper.ensureInitialized(); + p23.ProjectTypeModelMapper.ensureInitialized(); + p23.ProjectTypeAdditionalFieldsMapper.ensureInitialized(); + p23.ProjectCycleMapper.ensureInitialized(); + p23.ProjectCycleDeliveryMapper.ensureInitialized(); + p23.DeliveryDoseCriteriaMapper.ensureInitialized(); + p23.DeliveryProductVariantMapper.ensureInitialized(); + p24.TargetSearchModelMapper.ensureInitialized(); + p24.TargetModelMapper.ensureInitialized(); + p24.TargetAdditionalFieldsMapper.ensureInitialized(); + p25.UserSearchModelMapper.ensureInitialized(); + p25.UserModelMapper.ensureInitialized(); + p25.UserAdditionalFieldsMapper.ensureInitialized(); + p26.UserActionSearchModelMapper.ensureInitialized(); + p26.UserActionModelMapper.ensureInitialized(); + p26.UserActionAdditionalFieldsMapper.ensureInitialized(); + p27.OpLogEntryMapper.ensureInitialized(); + p27.AdditionalIdMapper.ensureInitialized(); + p27.DataOperationMapper.ensureInitialized(); + p27.ApiOperationMapper.ensureInitialized(); } diff --git a/packages/digit_data_model/lib/models/entities/household_type.dart b/packages/digit_data_model/lib/models/entities/household_type.dart new file mode 100644 index 0000000000..2e6d1b21c0 --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/household_type.dart @@ -0,0 +1,14 @@ +import 'package:dart_mappable/dart_mappable.dart'; + +part 'household_type.mapper.dart'; + +@MappableEnum(caseStyle: CaseStyle.upperCase) +enum HouseholdType { + @MappableValue("FAMILY") + family, + @MappableValue("COMMUNITY") + community, + @MappableValue("OTHER") + other, + ; +} diff --git a/packages/digit_data_model/lib/models/entities/household_type.mapper.dart b/packages/digit_data_model/lib/models/entities/household_type.mapper.dart new file mode 100644 index 0000000000..30ea5cb898 --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/household_type.mapper.dart @@ -0,0 +1,57 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, unnecessary_cast +// ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter + +part of 'household_type.dart'; + +class HouseholdTypeMapper extends EnumMapper { + HouseholdTypeMapper._(); + + static HouseholdTypeMapper? _instance; + static HouseholdTypeMapper ensureInitialized() { + if (_instance == null) { + MapperContainer.globals.use(_instance = HouseholdTypeMapper._()); + } + return _instance!; + } + + static HouseholdType fromValue(dynamic value) { + ensureInitialized(); + return MapperContainer.globals.fromValue(value); + } + + @override + HouseholdType decode(dynamic value) { + switch (value) { + case "FAMILY": + return HouseholdType.family; + case "COMMUNITY": + return HouseholdType.community; + case "OTHER": + return HouseholdType.other; + default: + throw MapperException.unknownEnumValue(value); + } + } + + @override + dynamic encode(HouseholdType self) { + switch (self) { + case HouseholdType.family: + return "FAMILY"; + case HouseholdType.community: + return "COMMUNITY"; + case HouseholdType.other: + return "OTHER"; + } + } +} + +extension HouseholdTypeMapperExtension on HouseholdType { + dynamic toValue() { + HouseholdTypeMapper.ensureInitialized(); + return MapperContainer.globals.toValue(this); + } +} diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index cafc857b17..638fab2f7b 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" args: dependency: transitive description: @@ -217,6 +225,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + cupertino_icons: + dependency: transitive + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" dart_mappable: dependency: "direct main" description: @@ -266,6 +282,13 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" + digit_components: + dependency: "direct main" + description: + path: "../digit_components" + relative: true + source: path + version: "1.0.2+1" dio: dependency: "direct main" description: @@ -298,6 +321,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.15.0" + easy_stepper: + dependency: transitive + description: + name: easy_stepper + sha256: "77f3ab4ee3c867b5a2236bf712abb08fed2b1c533cf24cf3fcd46c2821072ffd" + url: "https://pub.dev" + source: hosted + version: "0.5.2+1" fake_async: dependency: transitive description: @@ -343,6 +374,62 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.5" + flutter_focus_watcher: + dependency: transitive + description: + name: flutter_focus_watcher + sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -351,11 +438,40 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: d2696eed13732831414595b98863260e33e8882fc069ee80ec35d4ac9ddb0472 + url: "https://pub.dev" + source: hosted + version: "5.2.1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_typeahead: + dependency: transitive + description: + name: flutter_typeahead + sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: transitive + description: + name: fluttertoast + sha256: "81b68579e23fcbcada2db3d50302813d2371664afe6165bc78148050ab94bf66" + url: "https://pub.dev" + source: hosted + version: "8.2.5" freezed: dependency: "direct dev" description: @@ -388,6 +504,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" + url: "https://pub.dev" + source: hosted + version: "4.0.5" graphs: dependency: transitive description: @@ -396,6 +520,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + horizontal_data_table: + dependency: transitive + description: + name: horizontal_data_table + sha256: c8ab5256bbced698a729f3e0ff2cb0e8e97416cdbb082860370eaf883badf722 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" http_multi_server: dependency: transitive description: @@ -412,6 +552,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" io: dependency: transitive description: @@ -476,6 +624,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.0" + location: + dependency: transitive + description: + name: location + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + location_web: + dependency: transitive + description: + name: location_web + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" + source: hosted + version: "4.2.0" logging: dependency: transitive description: @@ -484,6 +656,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: a93542cc2d60a7057255405f62252533f8e8956e7e06754955669fd32fb4b216 + url: "https://pub.dev" + source: hosted + version: "2.7.0" matcher: dependency: transitive description: @@ -540,6 +720,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + overlay_builder: + dependency: transitive + description: + name: overlay_builder + sha256: "58b97bc5f67a2e2bb7006dd88e697ac757dfffc9dbd1e7dfc1917fb510a4b5c8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" package_config: dependency: transitive description: @@ -548,6 +736,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + url: "https://pub.dev" + source: hosted + version: "2.0.1" path: dependency: "direct main" description: @@ -620,6 +824,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" pool: dependency: transitive description: @@ -652,6 +864,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" + reactive_flutter_typeahead: + dependency: transitive + description: + name: reactive_flutter_typeahead + sha256: ef91627df8cef70e603e8a6458749d8a99a385b78854332602fd08ad905cdab8 + url: "https://pub.dev" + source: hosted + version: "0.8.1" + reactive_forms: + dependency: transitive + description: + name: reactive_forms + sha256: "5aa9c48a0626c20d00a005e597cb10efbdebbfeecb9c4227b03a5945fbb91ec4" + url: "https://pub.dev" + source: hosted + version: "14.3.0" recase: dependency: "direct main" description: @@ -660,6 +888,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + remove_emoji_input_formatter: + dependency: transitive + description: + name: remove_emoji_input_formatter + sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" + url: "https://pub.dev" + source: hosted + version: "0.0.1+1" shelf: dependency: transitive description: diff --git a/packages/digit_data_model/pubspec.yaml b/packages/digit_data_model/pubspec.yaml index f0a627dfc6..7f37b835f8 100644 --- a/packages/digit_data_model/pubspec.yaml +++ b/packages/digit_data_model/pubspec.yaml @@ -26,6 +26,7 @@ dependencies: dio: ^5.1.2 mocktail: ^1.0.2 collection: ^1.16.0 + digit_components: ^1.0.2 dev_dependencies: flutter_test: diff --git a/packages/registration_delivery/lib/models/entities/household.dart b/packages/registration_delivery/lib/models/entities/household.dart index 28e2c6adbd..34ac9de94e 100644 --- a/packages/registration_delivery/lib/models/entities/household.dart +++ b/packages/registration_delivery/lib/models/entities/household.dart @@ -1,6 +1,7 @@ // Generated using mason. Do not modify by hand import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:drift/drift.dart'; part 'household.mapper.dart'; @@ -16,6 +17,7 @@ class HouseholdSearchModel extends EntitySearchModel final bool? isProximityEnabled; final List? clientReferenceId; final String? tenantId; + final HouseholdType? householdType; HouseholdSearchModel({ this.id, @@ -26,6 +28,7 @@ class HouseholdSearchModel extends EntitySearchModel this.isProximityEnabled, this.clientReferenceId, this.tenantId, + this.householdType, super.boundaryCode, super.isDeleted, }) : super(); @@ -40,6 +43,7 @@ class HouseholdSearchModel extends EntitySearchModel this.isProximityEnabled, this.clientReferenceId, this.tenantId, + this.householdType, super.boundaryCode, }) : super(isDeleted: false); } @@ -58,6 +62,7 @@ class HouseholdModel extends EntityModel with HouseholdModelMappable { final int? rowVersion; final AddressModel? address; final HouseholdAdditionalFields? additionalFields; + final HouseholdType? householdType; HouseholdModel({ this.additionalFields, @@ -70,6 +75,7 @@ class HouseholdModel extends EntityModel with HouseholdModelMappable { this.tenantId, this.rowVersion, this.address, + this.householdType, super.auditDetails, super.clientAuditDetails, super.isDeleted = false, @@ -95,6 +101,7 @@ class HouseholdModel extends EntityModel with HouseholdModelMappable { clientReferenceId: Value(clientReferenceId), tenantId: Value(tenantId), rowVersion: Value(rowVersion), + householdType: Value(householdType), ); } } diff --git a/packages/registration_delivery/lib/models/entities/household.mapper.dart b/packages/registration_delivery/lib/models/entities/household.mapper.dart index 17d2a4ef97..62496bee3a 100644 --- a/packages/registration_delivery/lib/models/entities/household.mapper.dart +++ b/packages/registration_delivery/lib/models/entities/household.mapper.dart @@ -47,6 +47,10 @@ class HouseholdSearchModelMapper static String? _$tenantId(HouseholdSearchModel v) => v.tenantId; static const Field _f$tenantId = Field('tenantId', _$tenantId, opt: true); + static HouseholdType? _$householdType(HouseholdSearchModel v) => + v.householdType; + static const Field _f$householdType = + Field('householdType', _$householdType, opt: true); static String? _$boundaryCode(HouseholdSearchModel v) => v.boundaryCode; static const Field _f$boundaryCode = Field('boundaryCode', _$boundaryCode, opt: true); @@ -69,6 +73,7 @@ class HouseholdSearchModelMapper #isProximityEnabled: _f$isProximityEnabled, #clientReferenceId: _f$clientReferenceId, #tenantId: _f$tenantId, + #householdType: _f$householdType, #boundaryCode: _f$boundaryCode, #auditDetails: _f$auditDetails, #additionalFields: _f$additionalFields, @@ -94,6 +99,7 @@ class HouseholdSearchModelMapper isProximityEnabled: data.dec(_f$isProximityEnabled), clientReferenceId: data.dec(_f$clientReferenceId), tenantId: data.dec(_f$tenantId), + householdType: data.dec(_f$householdType), boundaryCode: data.dec(_f$boundaryCode)); } @@ -169,6 +175,7 @@ abstract class HouseholdSearchModelCopyWith< bool? isProximityEnabled, List? clientReferenceId, String? tenantId, + HouseholdType? householdType, String? boundaryCode}); HouseholdSearchModelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( Then<$Out2, $R2> t); @@ -206,6 +213,7 @@ class _HouseholdSearchModelCopyWithImpl<$R, $Out> Object? isProximityEnabled = $none, Object? clientReferenceId = $none, Object? tenantId = $none, + Object? householdType = $none, Object? boundaryCode = $none}) => $apply(FieldCopyWithData({ if (id != $none) #id: id, @@ -217,6 +225,7 @@ class _HouseholdSearchModelCopyWithImpl<$R, $Out> #isProximityEnabled: isProximityEnabled, if (clientReferenceId != $none) #clientReferenceId: clientReferenceId, if (tenantId != $none) #tenantId: tenantId, + if (householdType != $none) #householdType: householdType, if (boundaryCode != $none) #boundaryCode: boundaryCode })); @override @@ -232,6 +241,7 @@ class _HouseholdSearchModelCopyWithImpl<$R, $Out> clientReferenceId: data.get(#clientReferenceId, or: $value.clientReferenceId), tenantId: data.get(#tenantId, or: $value.tenantId), + householdType: data.get(#householdType, or: $value.householdType), boundaryCode: data.get(#boundaryCode, or: $value.boundaryCode)); @override @@ -287,6 +297,9 @@ class HouseholdModelMapper extends SubClassMapperBase { static AddressModel? _$address(HouseholdModel v) => v.address; static const Field _f$address = Field('address', _$address, opt: true); + static HouseholdType? _$householdType(HouseholdModel v) => v.householdType; + static const Field _f$householdType = + Field('householdType', _$householdType, opt: true); static AuditDetails? _$auditDetails(HouseholdModel v) => v.auditDetails; static const Field _f$auditDetails = Field('auditDetails', _$auditDetails, opt: true); @@ -310,6 +323,7 @@ class HouseholdModelMapper extends SubClassMapperBase { #tenantId: _f$tenantId, #rowVersion: _f$rowVersion, #address: _f$address, + #householdType: _f$householdType, #auditDetails: _f$auditDetails, #clientAuditDetails: _f$clientAuditDetails, #isDeleted: _f$isDeleted, @@ -337,6 +351,7 @@ class HouseholdModelMapper extends SubClassMapperBase { tenantId: data.dec(_f$tenantId), rowVersion: data.dec(_f$rowVersion), address: data.dec(_f$address), + householdType: data.dec(_f$householdType), auditDetails: data.dec(_f$auditDetails), clientAuditDetails: data.dec(_f$clientAuditDetails), isDeleted: data.dec(_f$isDeleted)); @@ -417,6 +432,7 @@ abstract class HouseholdModelCopyWith<$R, $In extends HouseholdModel, $Out> String? tenantId, int? rowVersion, AddressModel? address, + HouseholdType? householdType, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); @@ -459,6 +475,7 @@ class _HouseholdModelCopyWithImpl<$R, $Out> Object? tenantId = $none, Object? rowVersion = $none, Object? address = $none, + Object? householdType = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => @@ -474,6 +491,7 @@ class _HouseholdModelCopyWithImpl<$R, $Out> if (tenantId != $none) #tenantId: tenantId, if (rowVersion != $none) #rowVersion: rowVersion, if (address != $none) #address: address, + if (householdType != $none) #householdType: householdType, if (auditDetails != $none) #auditDetails: auditDetails, if (clientAuditDetails != $none) #clientAuditDetails: clientAuditDetails, @@ -494,6 +512,7 @@ class _HouseholdModelCopyWithImpl<$R, $Out> tenantId: data.get(#tenantId, or: $value.tenantId), rowVersion: data.get(#rowVersion, or: $value.rowVersion), address: data.get(#address, or: $value.address), + householdType: data.get(#householdType, or: $value.householdType), auditDetails: data.get(#auditDetails, or: $value.auditDetails), clientAuditDetails: data.get(#clientAuditDetails, or: $value.clientAuditDetails), diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index f43c0acdf2..589a63578e 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -413,10 +413,9 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "63c878bfe49e3e8db190dd5cd35d7a7b93b2e3b6663cebaaee25ff0089c1112b" - url: "https://pub.dev" - source: hosted + path: "../digit_data_model" + relative: true + source: path version: "1.0.5-dev.1" digit_scanner: dependency: "direct main" @@ -1486,10 +1485,9 @@ packages: survey_form: dependency: "direct main" description: - name: survey_form - sha256: "52532fb3fae06883828d22f870045587bf7122f67cb4de236c82ad4d6de1d7d7" - url: "https://pub.dev" - source: hosted + path: "../survey_form" + relative: true + source: path version: "0.0.1-dev.2" synchronized: dependency: transitive From 8592a363d3814722ea2a7c093256009c8ca0e8cf Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 3 Dec 2024 10:47:56 +0530 Subject: [PATCH 06/47] hcmpre-1421: ui changes for search and overview page --- .../lib/pages/home.dart | 19 +++-- .../lib/utils/i18_key_constants.dart | 6 +- .../showcase/config/home_showcase.dart | 3 +- .../pages/beneficiary/household_overview.dart | 76 +++++++++++++++---- .../lib/pages/search_beneficiary.dart | 57 ++++++++------ 5 files changed, 112 insertions(+), 49 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index b09584a51f..017cf43cac 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -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'; @@ -356,16 +357,22 @@ class _HomePageState extends LocalizedState { icon: Icons.all_inbox, label: i18.home.beneficiaryLabel, onPressed: () async { + RegistrationDeliverySingleton() + .setHouseholdType(HouseholdType.family); await context.router.push(const RegistrationDeliveryWrapperRoute()); }, ), ), - i18.home.institutionLabel: homeShowcaseData.instituteCampaign.buildWith( + i18.home.clfLabel: homeShowcaseData.clf.buildWith( child: HomeItemCard( icon: Icons.account_balance, - label: i18.home.institutionLabel, - onPressed: () {}, + label: i18.home.clfLabel, + onPressed: () async { + RegistrationDeliverySingleton() + .setHouseholdType(HouseholdType.community); + await context.router.push(const RegistrationDeliveryWrapperRoute()); + }, ), ), @@ -534,13 +541,13 @@ class _HomePageState extends LocalizedState { i18.home.closedHouseHoldLabel: homeShowcaseData.closedHouseHold.showcaseKey, i18.home.dashboard: homeShowcaseData.dashBoard.showcaseKey, - i18.home.institutionLabel: homeShowcaseData.instituteCampaign.showcaseKey, + i18.home.clfLabel: homeShowcaseData.clf.showcaseKey, }; final homeItemsLabel = [ // INFO: Need to add items label of package Here i18.home.beneficiaryLabel, - i18.home.institutionLabel, + i18.home.clfLabel, i18.home.closedHouseHoldLabel, i18.home.manageStockLabel, i18.home.stockReconciliationLabel, @@ -561,7 +568,7 @@ class _HomePageState extends LocalizedState { .toList() .contains(element) || element == i18.home.db || - element == i18.home.institutionLabel) + element == i18.home.clfLabel) .toList(); final showcaseKeys = filteredLabels diff --git a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart index f36b3b91a8..f9495640e1 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/i18_key_constants.dart @@ -204,8 +204,8 @@ class HomeShowcase { return 'WAREHOUSE_MANAGER_HOME_SHOWCASE_DELETE_ALL'; } - String get instituteCampaign { - return "INSTITUTE_CAMPAIGN_SHOWCASE"; + String get clf { + return "COMMUNAL_LIVING_FACILITY_SHOWCASE"; } } @@ -565,7 +565,7 @@ class Home { String get closedHouseHoldLabel => 'HOME_CLOSE_HOUSEHOLD_LABEL'; - String get institutionLabel => "HOME_INSTITUTION_CAMPAIGN_LABEL"; + String get clfLabel => "HOME_COMMUNAL_LIVING_FACILITIES_LABEL"; } class AcknowledgementSuccess { diff --git a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart index ba804af85d..ca0f302f0f 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/showcase/config/home_showcase.dart @@ -106,6 +106,5 @@ class _HomePageShowcaseData { messageLocalizationKey: i18.home.closedHouseHoldLabel, ); - final instituteCampaign = ShowcaseItemBuilder( - messageLocalizationKey: i18.homeShowcase.instituteCampaign); + final clf = ShowcaseItemBuilder(messageLocalizationKey: i18.homeShowcase.clf); } diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 51e8e874dc..2f68a7998e 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/enum/app_enums.dart'; import 'package:digit_ui_components/theme/digit_extended_theme.dart'; import 'package:digit_ui_components/theme/digit_theme.dart'; @@ -407,9 +408,18 @@ class _HouseholdOverviewPageState child: Padding( padding: const EdgeInsets.all(spacer2), child: Text( - localizations.translate(i18 - .householdOverView - .householdOverViewLabel), + RegistrationDeliverySingleton() + .householdType != + null && + RegistrationDeliverySingleton() + .householdType == + HouseholdType.community + ? localizations.translate(i18 + .householdOverView + .clfOverviewLabel) + : localizations.translate(i18 + .householdOverView + .householdOverViewLabel), style: textTheme.headingXl, ), ), @@ -458,6 +468,49 @@ class _HouseholdOverviewPageState bool shouldShowStatus = beneficiaryType == BeneficiaryType.household; + if (RegistrationDeliverySingleton() + .householdType != + null && + RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + return Column( + children: [ + DigitTableCard(element: { + localizations.translate(i18 + .householdOverView + .instituteNameLabel): state + .householdMemberWrapper + .headOfHousehold + ?.name + ?.givenName ?? + localizations.translate( + i18.common.coreCommonNA), + localizations.translate(i18 + .householdOverView + .instituteTypeLabel): + RegistrationDeliverySingleton() + .householdType, + localizations.translate( + i18.deliverIntervention + .memberCountText, + ): state.householdMemberWrapper + .household?.memberCount, + localizations.translate( + i18.householdLocation + .administrationAreaFormLabel, + ): state + .householdMemberWrapper + .headOfHousehold + ?.address + ?.first + .locality + ?.code, + }), + ], + ); + } + return Column( children: [ DigitTableCard( @@ -543,11 +596,9 @@ class _HouseholdOverviewPageState '${localizations.translate(getStatus(selectedFilters[index]))}' ' (${state.householdMemberWrapper.members!.length})', onItemDelete: () { - setState(() { - selectedFilters.remove( - selectedFilters[ - index]); - }); + selectedFilters.remove( + selectedFilters[ + index]); callReloadEvent( offset: 0, limit: 10); }, @@ -1020,18 +1071,13 @@ class _HouseholdOverviewPageState ])); if (filters != null && filters.isNotEmpty) { - setState(() { - selectedFilters = []; - }); - setState(() { - selectedFilters.addAll(filters); - }); + selectedFilters.addAll(filters); callReloadEvent(offset: 0, limit: 10); } else { setState(() { selectedFilters = []; }); - // blocWrapper.clearEvent(); + callReloadEvent(offset: 0, limit: 10); } } diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index cb2a671a78..47a246b2e6 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_scanner/blocs/scanner.dart'; import 'package:digit_scanner/pages/qr_scanner.dart'; import 'package:digit_ui_components/blocs/fetch_location_bloc.dart'; @@ -109,11 +110,19 @@ class _SearchBeneficiaryPageState alignment: Alignment.topLeft, child: Text( localizations.translate( - RegistrationDeliverySingleton().beneficiaryType != - BeneficiaryType.individual - ? i18.searchBeneficiary.statisticsLabelText - : i18.searchBeneficiary - .searchIndividualLabelText, + RegistrationDeliverySingleton().householdType != + null && + RegistrationDeliverySingleton() + .householdType == + HouseholdType.community + ? i18.searchBeneficiary.searchCLFLabel + : RegistrationDeliverySingleton() + .beneficiaryType != + BeneficiaryType.individual + ? i18 + .searchBeneficiary.statisticsLabelText + : i18.searchBeneficiary + .searchIndividualLabelText, ), style: textTheme.headingXl, textAlign: TextAlign.left, @@ -489,31 +498,33 @@ class _SearchBeneficiaryPageState limit: isPagination ? blocWrapper.individualGlobalSearchBloc.state.limit : limit, + householdType: RegistrationDeliverySingleton().householdType, ))); } } else { if (isProximityEnabled || selectedFilters.isNotEmpty || searchController.text.isNotEmpty) { - blocWrapper.houseHoldGlobalSearchBloc - .add(SearchHouseholdsEvent.houseHoldGlobalSearch( + blocWrapper.houseHoldGlobalSearchBloc.add( + SearchHouseholdsEvent.houseHoldGlobalSearch( globalSearchParams: GlobalSearchParameters( - isProximityEnabled: isProximityEnabled, - latitude: lat, - longitude: long, - projectId: RegistrationDeliverySingleton().projectId!, - maxRadius: RegistrationDeliverySingleton().maxRadius, - nameSearch: searchController.text.trim().length > 2 - ? searchController.text.trim() - : blocWrapper.searchHouseholdsBloc.state.searchQuery, - filter: selectedFilters, - offset: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.offset - : offset, - limit: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.limit - : limit, - ))); + isProximityEnabled: isProximityEnabled, + latitude: lat, + longitude: long, + projectId: RegistrationDeliverySingleton().projectId!, + maxRadius: RegistrationDeliverySingleton().maxRadius, + nameSearch: searchController.text.trim().length > 2 + ? searchController.text.trim() + : blocWrapper.searchHouseholdsBloc.state.searchQuery, + filter: selectedFilters, + offset: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.offset + : offset, + limit: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.limit + : limit, + householdType: + RegistrationDeliverySingleton().householdType))); } } } From 72d22f97fbc53e7936144a56e1af80d6f08a9cb3 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 3 Dec 2024 10:48:56 +0530 Subject: [PATCH 07/47] localization code added --- .../lib/utils/i18_key_constants.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 880ce5f22a..c8e4c62b03 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -125,6 +125,8 @@ class Common { class SearchBeneficiary { const SearchBeneficiary(); + String get searchCLFLabel => 'BENEFICIARY_SEARCH_CLF_LABEL_TEXT'; + String get statisticsLabelText => 'BENEFICIARY_STATISTICS_LABEL_TEXT'; String get searchIndividualLabelText => @@ -405,6 +407,12 @@ class HouseholdOverView { String get householdOverViewLabel => 'HOUSEHOLD_OVER_VIEW_LABEL'; + String get instituteNameLabel => 'HOUSEHOLD_OVER_VIEW_INSTITUTE_NAME_LABEL'; + + String get instituteTypeLabel => 'HOUSEHOLD_OVER_VIEW_INSTITUTE_TYPE_LABEL'; + + String get clfOverviewLabel => 'HOUSEHOLD_OVER_VIEW_CLF_LABEL'; + String get householdOverViewEditLabel => 'HOUSEHOLD_OVER_VIEW_EDIT_ICON_LABEL'; From 589c6f5ab0e392835ba3b27735bdfefcca344912 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 3 Dec 2024 11:14:16 +0530 Subject: [PATCH 08/47] hcmpre-1249: mapping search query based on the household type --- .../household_overview.dart | 427 ++++++++++++++---- .../individual_global_search.dart | 1 + .../local/household_global_search.dart | 23 +- .../local/individual_global_search.dart | 17 +- .../house_details.dart | 289 ++++++------ .../lib/utils/global_search_parameters.dart | 6 +- .../lib/utils/utils.dart | 12 +- 7 files changed, 535 insertions(+), 240 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 92599b6ed9..897f2ea7a7 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -15,6 +15,7 @@ import '../../models/entities/household_member.dart'; import '../../models/entities/project_beneficiary.dart'; import '../../models/entities/referral.dart'; import '../../models/entities/side_effect.dart'; +import '../../models/entities/status.dart'; import '../../models/entities/task.dart'; import '../../utils/typedefs.dart'; import '../search_households/search_households.dart'; @@ -305,109 +306,351 @@ class HouseholdOverviewBloc )); return; } + if (event.selectedFilter!.contains(Status.registered.name) || + event.selectedFilter!.contains(Status.notRegistered.name)) { + late List individualClientReferenceIds = []; + + result.forEach((e) { + individualClientReferenceIds.add(e.clientReferenceId); + }); + + List individuals = await individualRepository.search( + IndividualSearchModel( + clientReferenceId: individualClientReferenceIds + .map((e) => e.toString()) + .toList())); + + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: event.projectBeneficiaryType == + BeneficiaryType.individual + ? individualClientReferenceIds + : [state.householdMemberWrapper.household!.clientReferenceId], + projectId: [event.projectId], + ), + ); + + final beneficiaryClientReferenceIds = projectBeneficiaries + .map((e) => e.beneficiaryClientReferenceId) + .toList(); + + final List beneficiaryIndividuals = individuals + .where((element) => beneficiaryClientReferenceIds + .contains(element.clientReferenceId)) + .toList(); + + final tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList(), + projectId: event.projectId, + )); + + // Search for adverse events associated with tasks. + final sideEffects = + await sideEffectDataRepository.search(SideEffectSearchModel( + taskClientReferenceId: + tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), + )); + + final referrals = + await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: projectBeneficiaries + .map((e) => e.clientReferenceId) + .whereNotNull() + .toList(), + )); + + emit(state.copyWith( + loading: false, + offset: individuals.isNotEmpty + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + householdMemberWrapper: state.householdMemberWrapper.copyWith( + members: event.offset == 0 + ? (event.projectBeneficiaryType == BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals + : [ + ...{ + ...state.householdMemberWrapper.members ?? [], + ...((event.projectBeneficiaryType == + BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals), + }, + ], + projectBeneficiaries: event.offset == 0 + ? projectBeneficiaries + : [ + ...{ + ...state.householdMemberWrapper.projectBeneficiaries ?? + [], + ...projectBeneficiaries, + }, + ], + tasks: event.offset == 0 + ? tasks + : [ + ...{...?state.householdMemberWrapper.tasks, ...tasks}, + ], + sideEffects: event.offset == 0 + ? sideEffects + : [ + ...{ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + }, + ], + referrals: event.offset == 0 + ? referrals + : [ + ...{ + ...?state.householdMemberWrapper.referrals, + ...referrals, + }, + ], + ), + limit: event.limit, + )); + } else if (event.selectedFilter != null && + event.selectedFilter!.isNotEmpty) { + late List listOfBeneficiaries = []; + for (var e in result) { + !listOfBeneficiaries.contains(e.projectBeneficiaryClientReferenceId) + ? listOfBeneficiaries.add(e.projectBeneficiaryClientReferenceId) + : null; + } + + List projectBeneficiariesList = + await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel(projectId: [ + RegistrationDeliverySingleton().projectId.toString() + ], clientReferenceId: listOfBeneficiaries)); + + late List listOfMembers = []; + + listOfMembers = projectBeneficiariesList + .map((e) => e.beneficiaryClientReferenceId.toString()) + .toList(); - late List individualClientReferenceIds = []; + List householdMemberList = + await householdMemberRepository.search(HouseholdMemberSearchModel( + individualClientReferenceId: listOfMembers)); - result.forEach((e) { - individualClientReferenceIds.add(e.clientReferenceId); - }); + final List individualClientReferenceIds = householdMemberList + .map((e) => e.individualClientReferenceId.toString()) + .toList(); - List individuals = await individualRepository.search( + final List individualsList = + await individualRepository.search( IndividualSearchModel( - clientReferenceId: individualClientReferenceIds - .map((e) => e.toString()) - .toList())); + clientReferenceId: individualClientReferenceIds), + ); - final projectBeneficiaries = await projectBeneficiaryRepository.search( - ProjectBeneficiarySearchModel( - beneficiaryClientReferenceId: - event.projectBeneficiaryType == BeneficiaryType.individual - ? individualClientReferenceIds - : [state.householdMemberWrapper.household!.clientReferenceId], - projectId: [event.projectId], - ), - ); + late List householdClientReferenceIds = []; - final beneficiaryClientReferenceIds = projectBeneficiaries - .map((e) => e.beneficiaryClientReferenceId) - .toList(); + householdClientReferenceIds = householdMemberList + .map((e) => e.householdClientReferenceId.toString()) + .toList(); - final List beneficiaryIndividuals = individuals - .where((element) => - beneficiaryClientReferenceIds.contains(element.clientReferenceId)) - .toList(); + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: event.projectBeneficiaryType == + BeneficiaryType.individual + ? individualClientReferenceIds + : [state.householdMemberWrapper.household!.clientReferenceId], + projectId: [event.projectId], + ), + ); - final tasks = await taskDataRepository.search(TaskSearchModel( - projectBeneficiaryClientReferenceId: - projectBeneficiaries.map((e) => e.clientReferenceId).toList(), - projectId: event.projectId, - )); + final beneficiaryClientReferenceIds = projectBeneficiaries + .map((e) => e.beneficiaryClientReferenceId) + .toList(); - // Search for adverse events associated with tasks. - final sideEffects = - await sideEffectDataRepository.search(SideEffectSearchModel( - taskClientReferenceId: - tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), - )); + final List beneficiaryIndividuals = individualsList + .where((element) => beneficiaryClientReferenceIds + .contains(element.clientReferenceId)) + .toList(); - final referrals = await referralDataRepository.search(ReferralSearchModel( - projectBeneficiaryClientReferenceId: projectBeneficiaries - .map((e) => e.clientReferenceId) - .whereNotNull() - .toList(), - )); + final tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList(), + projectId: event.projectId, + )); - emit(state.copyWith( - loading: false, - offset: individuals.isNotEmpty - ? (event.offset ?? 0) + (event.limit ?? 10) - : null, - householdMemberWrapper: state.householdMemberWrapper.copyWith( - members: event.offset == 0 - ? (event.projectBeneficiaryType == BeneficiaryType.individual) - ? beneficiaryIndividuals - : individuals - : [ - ...{ - ...state.householdMemberWrapper.members ?? [], - ...((event.projectBeneficiaryType == - BeneficiaryType.individual) - ? beneficiaryIndividuals - : individuals), - }, - ], - projectBeneficiaries: event.offset == 0 - ? projectBeneficiaries - : [ - ...{ - ...state.householdMemberWrapper.projectBeneficiaries ?? [], - ...projectBeneficiaries, - }, - ], - tasks: event.offset == 0 - ? tasks - : [ - ...{...?state.householdMemberWrapper.tasks, ...tasks}, - ], - sideEffects: event.offset == 0 - ? sideEffects - : [ - ...{ - ...?state.householdMemberWrapper.sideEffects, - ...sideEffects, - }, - ], - referrals: event.offset == 0 - ? referrals - : [ - ...{ - ...?state.householdMemberWrapper.referrals, - ...referrals, - }, - ], - ), - limit: event.limit, - )); + // Search for adverse events associated with tasks. + final sideEffects = + await sideEffectDataRepository.search(SideEffectSearchModel( + taskClientReferenceId: + tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), + )); + + final referrals = + await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: projectBeneficiaries + .map((e) => e.clientReferenceId) + .whereNotNull() + .toList(), + )); + + emit(state.copyWith( + loading: false, + offset: individualsList.isNotEmpty + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + householdMemberWrapper: state.householdMemberWrapper.copyWith( + members: event.offset == 0 + ? (event.projectBeneficiaryType == BeneficiaryType.individual) + ? beneficiaryIndividuals + : individualsList + : [ + ...{ + ...state.householdMemberWrapper.members ?? [], + ...((event.projectBeneficiaryType == + BeneficiaryType.individual) + ? beneficiaryIndividuals + : individualsList), + }, + ], + projectBeneficiaries: event.offset == 0 + ? projectBeneficiaries + : [ + ...{ + ...state.householdMemberWrapper.projectBeneficiaries ?? + [], + ...projectBeneficiaries, + }, + ], + tasks: event.offset == 0 + ? tasks + : [ + ...{...?state.householdMemberWrapper.tasks, ...tasks}, + ], + sideEffects: event.offset == 0 + ? sideEffects + : [ + ...{ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + }, + ], + referrals: event.offset == 0 + ? referrals + : [ + ...{ + ...?state.householdMemberWrapper.referrals, + ...referrals, + }, + ], + ), + limit: event.limit, + )); + } else { + late List individualClientReferenceIds = []; + + result.forEach((e) { + individualClientReferenceIds.add(e.clientReferenceId); + }); + + List individuals = await individualRepository.search( + IndividualSearchModel( + clientReferenceId: individualClientReferenceIds + .map((e) => e.toString()) + .toList())); + + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: event.projectBeneficiaryType == + BeneficiaryType.individual + ? individualClientReferenceIds + : [state.householdMemberWrapper.household!.clientReferenceId], + projectId: [event.projectId], + ), + ); + + final beneficiaryClientReferenceIds = projectBeneficiaries + .map((e) => e.beneficiaryClientReferenceId) + .toList(); + + final List beneficiaryIndividuals = individuals + .where((element) => beneficiaryClientReferenceIds + .contains(element.clientReferenceId)) + .toList(); + + final tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList(), + projectId: event.projectId, + )); + + // Search for adverse events associated with tasks. + final sideEffects = + await sideEffectDataRepository.search(SideEffectSearchModel( + taskClientReferenceId: + tasks.map((e) => e.clientReferenceId).whereNotNull().toList(), + )); + + final referrals = + await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: projectBeneficiaries + .map((e) => e.clientReferenceId) + .whereNotNull() + .toList(), + )); + + emit(state.copyWith( + loading: false, + offset: individuals.isNotEmpty + ? (event.offset ?? 0) + (event.limit ?? 10) + : null, + householdMemberWrapper: state.householdMemberWrapper.copyWith( + members: event.offset == 0 + ? (event.projectBeneficiaryType == BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals + : [ + ...{ + ...state.householdMemberWrapper.members ?? [], + ...((event.projectBeneficiaryType == + BeneficiaryType.individual) + ? beneficiaryIndividuals + : individuals), + }, + ], + projectBeneficiaries: event.offset == 0 + ? projectBeneficiaries + : [ + ...{ + ...state.householdMemberWrapper.projectBeneficiaries ?? + [], + ...projectBeneficiaries, + }, + ], + tasks: event.offset == 0 + ? tasks + : [ + ...{...?state.householdMemberWrapper.tasks, ...tasks}, + ], + sideEffects: event.offset == 0 + ? sideEffects + : [ + ...{ + ...?state.householdMemberWrapper.sideEffects, + ...sideEffects, + }, + ], + referrals: event.offset == 0 + ? referrals + : [ + ...{ + ...?state.householdMemberWrapper.referrals, + ...referrals, + }, + ], + ), + limit: event.limit, + )); + } } } diff --git a/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart b/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart index 696df872ef..a474b4c654 100644 --- a/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart +++ b/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart @@ -61,6 +61,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { offset: event.globalSearchParams.offset, limit: event.globalSearchParams.limit, totalCount: state.totalResults, + householdType: event.globalSearchParams.householdType, ), ); diff --git a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart index 26ffbd2257..b3945bb112 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart @@ -196,6 +196,7 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { params.maxRadius != null) sql.address.longitude.isNotNull(), sql.address.latitude.isNotNull(), + sql.household.householdType.equalsValue(params.householdType) ])) ..orderBy([ if (params.latitude != null && @@ -245,7 +246,7 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.household.clientReferenceId)) - ]); + ]).where(sql.household.householdType.equalsValue(params.householdType)); } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && selectQuery != null) { @@ -283,9 +284,13 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.household.clientReferenceId)) ]) - ..where(filter == Status.registered.name - ? sql.projectBeneficiary.beneficiaryClientReferenceId.isNotNull() - : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull()); + ..where(buildAnd([ + sql.household.householdType.equalsValue(params.householdType), + filter == Status.registered.name + ? sql.projectBeneficiary.beneficiaryClientReferenceId + .isNotNull() + : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull() + ])); } else { var filterSearchQuery = await filterTasks(selectQuery, filter, sql, params); @@ -341,9 +346,12 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { sql.household.clientReferenceId .equalsExp(sql.projectBeneficiary.beneficiaryClientReferenceId)) ]) - ..where(sql.task.status.equals( - statusMap[applyFilter]!.toValue(), - )); + ..where(buildAnd([ + sql.household.householdType.equalsValue(params.householdType), + sql.task.status.equals( + statusMap[applyFilter]!.toValue(), + ) + ])); if (!(params.filter!.contains(Status.notRegistered.name))) { selectQuery .where(sql.projectBeneficiary.projectId.equals(params.projectId!)); @@ -409,6 +417,7 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { final address = e.readTableOrNull(sql.address); return HouseholdModel( + householdType: household.householdType, id: household.id, tenantId: household.tenantId, clientReferenceId: household.clientReferenceId, diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index 68eb625a02..c1729bb28b 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -169,6 +169,12 @@ class IndividualGlobalSearchRepository extends LocalRepository { } else if (params.isProximityEnabled) { selectQuery = super.sql.individual.select().join([ joinIndividualAddress(sql), + leftOuterJoin(sql.household, + sql.household.householdType.equalsValue(params.householdType)), + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)), leftOuterJoin( sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId @@ -192,6 +198,8 @@ class IndividualGlobalSearchRepository extends LocalRepository { params.maxRadius != null) sql.address.longitude.isNotNull(), sql.address.latitude.isNotNull(), + sql.householdMember.householdClientReferenceId + .equalsExp(sql.household.clientReferenceId), ])) ..orderBy([ if (params.latitude != null && @@ -242,8 +250,11 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.householdMember.individualClientReferenceId .equalsExp(sql.individual.clientReferenceId)) ]) - ..where(sql.householdMember.householdClientReferenceId - .equals(params.householdClientReferenceId ?? '')); + ..where(buildAnd([ + sql.household.householdType.equalsValue(params.householdType), + sql.householdMember.householdClientReferenceId + .equals(params.householdClientReferenceId ?? '') + ])); } else { selectQuery = selectQuery.join([ leftOuterJoin( @@ -261,7 +272,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.household.clientReferenceId)) - ]); + ]).where(sql.household.householdType.equalsValue(params.householdType)); } } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index e276896409..0c55f4ba9c 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -65,69 +65,122 @@ class HouseDetailsPageState extends LocalizedState { ], ), footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: - const EdgeInsets.all(spacer2), - children: [Button( - onPressed: () { - form.markAllAsTouched(); - if (form.control(_householdStructureKey).value == - null) { - setState(() { - form - .control(_householdStructureKey) - .setErrors({'': true}); - }); - } + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + Button( + onPressed: () { + form.markAllAsTouched(); + if (form.control(_householdStructureKey).value == + null) { + setState(() { + form + .control(_householdStructureKey) + .setErrors({'': true}); + }); + } - if (!form.valid) return; - selectedHouseStructureTypes = - form.control(_householdStructureKey).value; + if (!form.valid) return; + selectedHouseStructureTypes = + form.control(_householdStructureKey).value; - final noOfRooms = - form.control(_noOfRoomsKey).value as int; - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - address, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var houseModel = HouseholdModel( - clientReferenceId: IdGen.i.identifier, - tenantId: - RegistrationDeliverySingleton().tenantId, - rowVersion: 1, - auditDetails: AuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: - context.millisecondsSinceEpoch(), - ), - memberCount: householdModel?.memberCount, - clientAuditDetails: ClientAuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: - context.millisecondsSinceEpoch(), - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - additionalFields: HouseholdAdditionalFields( - version: 1, - fields: [ + final noOfRooms = + form.control(_noOfRoomsKey).value as int; + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + address, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var houseModel = HouseholdModel( + householdType: + RegistrationDeliverySingleton() + .householdType, + clientReferenceId: IdGen.i.identifier, + tenantId: RegistrationDeliverySingleton() + .tenantId, + rowVersion: 1, + auditDetails: AuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + ), + memberCount: householdModel?.memberCount, + clientAuditDetails: ClientAuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ + ...?householdModel + ?.additionalFields?.fields + .where((e) => + e.key != + AdditionalFieldsType + .houseStructureTypes + .toValue() && + e.key != + AdditionalFieldsType + .noOfRooms + .toValue()), + AdditionalField( + AdditionalFieldsType + .houseStructureTypes + .toValue(), + selectedHouseStructureTypes + ?.join("|") + .toString(), + ), + AdditionalField( + AdditionalFieldsType.noOfRooms + .toValue(), + noOfRooms, + ) + ])); + + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, + ), + ); + router.push(HouseHoldDetailsRoute()); + }, + editHousehold: ( + address, + householdModel, + individuals, + registrationDate, + projectBeneficiaryModel, + loading, + headOfHousehold, + ) { + var houseModel = householdModel.copyWith( + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ ...?householdModel - ?.additionalFields?.fields + .additionalFields?.fields .where((e) => e.key != AdditionalFieldsType @@ -151,72 +204,29 @@ class HouseDetailsPageState extends LocalizedState { noOfRooms, ) ])); + // TODO [Linking of Voucher for Household based project need to be handled] - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), - ); - router.push(HouseHoldDetailsRoute()); - }, - editHousehold: ( - address, - householdModel, - individuals, - registrationDate, - projectBeneficiaryModel, - loading, - headOfHousehold, - ) { - var houseModel = householdModel.copyWith( - additionalFields: HouseholdAdditionalFields( - version: 1, - fields: [ - ...?householdModel.additionalFields?.fields - .where((e) => - e.key != - AdditionalFieldsType - .houseStructureTypes - .toValue() && - e.key != - AdditionalFieldsType.noOfRooms - .toValue()), - AdditionalField( - AdditionalFieldsType.houseStructureTypes - .toValue(), - selectedHouseStructureTypes - ?.join("|") - .toString(), + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, ), - AdditionalField( - AdditionalFieldsType.noOfRooms.toValue(), - noOfRooms, - ) - ])); - // TODO [Linking of Voucher for Household based project need to be handled] - - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), + ); + router.push(HouseHoldDetailsRoute()); + }, ); - router.push(HouseHoldDetailsRoute()); }, - ); - }, - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - label: localizations.translate( - i18.householdLocation.actionLabel, - ), - ),] - ), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + label: localizations.translate( + i18.householdLocation.actionLabel, + ), + ), + ]), slivers: [ SliverToBoxAdapter( - child: DigitCard( - children: [ - Padding( + child: DigitCard(children: [ + Padding( padding: const EdgeInsets.all(spacer2), child: Text( localizations.translate( @@ -235,15 +245,22 @@ class HouseDetailsPageState extends LocalizedState { options: RegistrationDeliverySingleton() .houseStructureTypes ?? [], - initialSelection: form.control(_householdStructureKey).value!= null ? [...form.control(_householdStructureKey).value ] : [], + initialSelection: + form.control(_householdStructureKey).value != + null + ? [ + ...form + .control(_householdStructureKey) + .value + ] + : [], onSelectionChanged: (values) { form .control(_householdStructureKey) .markAsTouched(); if (values.isEmpty) { - form - .control(_householdStructureKey) - .value = null; + form.control(_householdStructureKey).value = + null; setState(() { form .control(_householdStructureKey) @@ -251,9 +268,8 @@ class HouseDetailsPageState extends LocalizedState { }); } else { setState(() { - form - .control(_householdStructureKey) - .value = values; + form.control(_householdStructureKey).value = + values; }); } }, @@ -267,8 +283,7 @@ class HouseDetailsPageState extends LocalizedState { form .control(_householdStructureKey) .touched - ? localizations.translate(i18 - .householdDetails + ? localizations.translate(i18.householdDetails .selectStructureTypeError) : null, ), @@ -276,23 +291,27 @@ class HouseDetailsPageState extends LocalizedState { houseShowcaseData.noOfRooms.buildWith( child: ReactiveWrapperField( formControlName: _noOfRoomsKey, - builder:(field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdDetails.noOfRoomsLabel, ), child: DigitNumericFormInput( minValue: 1, maxValue: 20, - initialValue: form.control(_noOfRoomsKey).value.toString(), + initialValue: form + .control(_noOfRoomsKey) + .value + .toString(), step: 1, - onChange: (value){ - form.control(_noOfRoomsKey).value=int.parse(value); + onChange: (value) { + form.control(_noOfRoomsKey).value = + int.parse(value); }, ), ), ), - ),] - ), + ), + ]), ), ], ); diff --git a/packages/registration_delivery/lib/utils/global_search_parameters.dart b/packages/registration_delivery/lib/utils/global_search_parameters.dart index 69bfadbbab..68aeea3f1e 100644 --- a/packages/registration_delivery/lib/utils/global_search_parameters.dart +++ b/packages/registration_delivery/lib/utils/global_search_parameters.dart @@ -1,3 +1,5 @@ +import 'package:digit_data_model/models/entities/household_type.dart'; + class GlobalSearchParameters { final String? householdClientReferenceId; final bool isProximityEnabled; @@ -10,6 +12,7 @@ class GlobalSearchParameters { final int? limit; final List? filter; final int? totalCount; + final HouseholdType? householdType; GlobalSearchParameters( {required this.isProximityEnabled, @@ -22,5 +25,6 @@ class GlobalSearchParameters { required this.filter, this.totalCount, this.projectId, - this.householdClientReferenceId}); + this.householdClientReferenceId, + this.householdType}); } diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index b631564449..f577295703 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/utils/date_utils.dart'; import 'package:formula_parser/formula_parser.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -132,9 +133,10 @@ bool checkEligibilityForAgeAndSideEffect( : false : false; } else { - if(projectType?.validMaxAge!=null && projectType?.validMinAge!=null){ + if (projectType?.validMaxAge != null && + projectType?.validMinAge != null) { return totalAgeMonths >= projectType!.validMinAge! && - totalAgeMonths <= projectType.validMaxAge! + totalAgeMonths <= projectType.validMaxAge! ? true : false; } @@ -328,6 +330,7 @@ class RegistrationDeliverySingleton { List? _referralReasons; List? _houseStructureTypes; List? _refusalReasons; + HouseholdType? _householdType; void setBoundary({required BoundaryModel boundary}) { _boundaryModel = boundary; @@ -381,6 +384,10 @@ class RegistrationDeliverySingleton { _tenantId = tenantId; } + void setHouseholdType(HouseholdType? householdType) { + _householdType = householdType; + } + String? get tenantId => _tenantId; String? get loggedInUserUuid => _loggedInUserUuid; double? get maxRadius => _maxRadius; @@ -404,6 +411,7 @@ class RegistrationDeliverySingleton { List? get houseStructureTypes => _houseStructureTypes; List? get refusalReasons => _refusalReasons; UserModel? get loggedInUser => _loggedInUser; + HouseholdType? get householdType => _householdType; } bool allDosesDelivered( From 78aab22aab5f023e032952150b2a030287ba933f Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 3 Dec 2024 12:14:32 +0530 Subject: [PATCH 09/47] fix issues with filter ui and query --- .../household_global_seach.dart | 1 + .../local/individual_global_search.dart | 17 ++- .../pages/beneficiary/household_overview.dart | 144 +++++++++--------- 3 files changed, 88 insertions(+), 74 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/search_households/household_global_seach.dart b/packages/registration_delivery/lib/blocs/search_households/household_global_seach.dart index 11e5761133..97bb6ed40d 100644 --- a/packages/registration_delivery/lib/blocs/search_households/household_global_seach.dart +++ b/packages/registration_delivery/lib/blocs/search_households/household_global_seach.dart @@ -51,6 +51,7 @@ class HouseHoldGlobalSearchBloc extends SearchHouseholdsBloc { final results = await houseHoldGlobalSearchRepository.houseHoldGlobalSearch( GlobalSearchParameters( + householdType: event.globalSearchParams.householdType, projectId: event.globalSearchParams.projectId, isProximityEnabled: event.globalSearchParams.isProximityEnabled, latitude: event.globalSearchParams.latitude, diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index c1729bb28b..9a8db602e6 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -304,15 +304,26 @@ class IndividualGlobalSearchRepository extends LocalRepository { if (filter == Status.registered.name || filter == Status.notRegistered.name) { selectQuery = sql.individual.select().join([ + leftOuterJoin(sql.household, + sql.household.householdType.equalsValue(params.householdType)), + leftOuterJoin( + sql.householdMember, + sql.householdMember.individualClientReferenceId + .equalsExp(sql.individual.clientReferenceId)), if (params.nameSearch == null || !params.isProximityEnabled) leftOuterJoin( sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.individual.clientReferenceId)) ]) - ..where(filter == Status.registered.name - ? sql.projectBeneficiary.beneficiaryClientReferenceId.isNotNull() - : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull()); + ..where(buildAnd([ + sql.householdMember.householdClientReferenceId + .equalsExp(sql.household.clientReferenceId), + filter == Status.registered.name + ? sql.projectBeneficiary.beneficiaryClientReferenceId + .isNotNull() + : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull() + ])); if (params.householdClientReferenceId != null) { selectQuery = selectQuery.join([ diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 2f68a7998e..1902ce5210 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -398,63 +398,26 @@ class _HouseholdOverviewPageState // ), // ), // ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(spacer2), - child: Text( - RegistrationDeliverySingleton() - .householdType != - null && - RegistrationDeliverySingleton() - .householdType == - HouseholdType.community - ? localizations.translate(i18 - .householdOverView - .clfOverviewLabel) - : localizations.translate(i18 - .householdOverView - .householdOverViewLabel), - style: textTheme.headingXl, - ), - ), - ), - Column( - children: [ - RegistrationDeliverySingleton() - .searchHouseHoldFilter != - null && - RegistrationDeliverySingleton() - .searchHouseHoldFilter! - .isNotEmpty - ? Align( - alignment: Alignment.topLeft, - child: Padding( - padding: const EdgeInsets.all( - spacer2), - child: Button( - label: - getFilterIconNLabel()[ - 'label'], - size: ButtonSize.medium, - type: ButtonType.tertiary, - suffixIcon: - getFilterIconNLabel()[ - 'icon'], - onPressed: () => - showFilterDialog(), - ), - ), - ) - : const Offstage(), - ], + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(spacer2), + child: Text( + RegistrationDeliverySingleton() + .householdType != + null && + RegistrationDeliverySingleton() + .householdType == + HouseholdType.community + ? localizations.translate(i18 + .householdOverView + .clfOverviewLabel) + : localizations.translate(i18 + .householdOverView + .householdOverViewLabel), + style: textTheme.headingXl, ), - ], + ), ), Padding( @@ -558,21 +521,60 @@ class _HouseholdOverviewPageState Padding( padding: const EdgeInsets.only( top: spacer2, bottom: spacer2), - child: DigitSearchBar( - controller: searchController, - hintText: localizations.translate( - i18.common.searchByName, - ), - textCapitalization: - TextCapitalization.words, - onChanged: (value) { - if (value.length >= 3) { - callReloadEvent(offset: 0, limit: 10); - } else if (searchController - .value.text.isEmpty) { - callReloadEvent(offset: 0, limit: 10); - } - }, + child: Row( + children: [ + Expanded( + child: DigitSearchBar( + controller: searchController, + hintText: localizations.translate( + i18.common.searchByName, + ), + textCapitalization: + TextCapitalization.words, + onChanged: (value) { + if (value.length >= 3) { + callReloadEvent( + offset: 0, limit: 10); + } else if (searchController + .value.text.isEmpty) { + callReloadEvent( + offset: 0, limit: 10); + } + }, + ), + ), + Column( + children: [ + RegistrationDeliverySingleton() + .searchHouseHoldFilter != + null && + RegistrationDeliverySingleton() + .searchHouseHoldFilter! + .isNotEmpty + ? Align( + alignment: Alignment.topLeft, + child: Padding( + padding: + const EdgeInsets.all( + spacer2), + child: Button( + label: + getFilterIconNLabel()[ + 'label'], + size: ButtonSize.medium, + type: ButtonType.tertiary, + suffixIcon: + getFilterIconNLabel()[ + 'icon'], + onPressed: () => + showFilterDialog(), + ), + ), + ) + : const Offstage(), + ], + ), + ], ), ), selectedFilters.isNotEmpty From f5510130a6bfc8ad0b56af9776c3bb1598df1762 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 5 Dec 2024 07:46:59 +0530 Subject: [PATCH 10/47] added ui changes and mapping head of household search for clf --- .../household_overview.dart | 1 + .../search_households/search_households.dart | 6 + .../local/individual_global_search.dart | 14 +- .../pages/beneficiary/household_overview.dart | 12 +- .../house_details.dart | 22 +- .../household_details.dart | 613 +++++------ .../household_location.dart | 379 +++---- .../individual_details.dart | 990 +++++++++--------- .../lib/pages/search_beneficiary.dart | 193 ++-- .../lib/pages/summary_page.dart | 383 +++---- .../lib/utils/i18_key_constants.dart | 13 + .../beneficiary/view_beneficiary_card.dart | 76 +- 12 files changed, 1415 insertions(+), 1287 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 897f2ea7a7..86209f1f3d 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -278,6 +278,7 @@ class HouseholdOverviewBloc } else { final totalResult = await individualGlobalSearchRepository .individualGlobalSearch(GlobalSearchParameters( + householdType: RegistrationDeliverySingleton().householdType, householdClientReferenceId: state.householdMemberWrapper.household!.clientReferenceId, isProximityEnabled: false, diff --git a/packages/registration_delivery/lib/blocs/search_households/search_households.dart b/packages/registration_delivery/lib/blocs/search_households/search_households.dart index ed259aa842..0a14359fed 100644 --- a/packages/registration_delivery/lib/blocs/search_households/search_households.dart +++ b/packages/registration_delivery/lib/blocs/search_households/search_households.dart @@ -3,9 +3,11 @@ import 'dart:async'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_data_model/utils/typedefs.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import 'package:registration_delivery/registration_delivery.dart'; import 'package:stream_transform/stream_transform.dart'; import '../../data/repositories/local/household_global_search.dart'; @@ -184,6 +186,10 @@ class SearchHouseholdsBloc HouseholdMemberSearchModel( individualClientReferenceIds: individualClientReferenceIds, householdClientReferenceIds: householdClientReferenceIds, + isHeadOfHousehold: RegistrationDeliverySingleton().householdType == + HouseholdType.community + ? true + : null, ), ); } diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index 9a8db602e6..79161d7565 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:math' as math; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:drift/drift.dart'; import 'package:flutter/material.dart'; @@ -181,6 +182,8 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equalsExp(sql.individual.clientReferenceId)) ]) ..where(buildAnd([ + if (params.householdType == HouseholdType.community) + sql.householdMember.isHeadOfHousehold.equals(true), sql.address.relatedClientReferenceId.isNotNull(), sql.individual.clientReferenceId.isNotNull(), if (params.latitude != null && @@ -261,8 +264,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.householdMember, sql.householdMember.individualClientReferenceId .equalsExp(sql.individual.clientReferenceId)) - ]) - ..where(sql.householdMember.isHeadOfHousehold.equals(true)); + ]); selectQuery.join([ leftOuterJoin( sql.household, @@ -272,7 +274,11 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.household.clientReferenceId)) - ]).where(sql.household.householdType.equalsValue(params.householdType)); + ]).where(buildAnd([ + if (params.householdType == HouseholdType.community) + sql.householdMember.isHeadOfHousehold.equals(true), + sql.household.householdType.equalsValue(params.householdType) + ])); } } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && @@ -317,6 +323,8 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equalsExp(sql.individual.clientReferenceId)) ]) ..where(buildAnd([ + if (params.householdType == HouseholdType.community) + sql.householdMember.isHeadOfHousehold.equals(true), sql.householdMember.householdClientReferenceId .equalsExp(sql.household.clientReferenceId), filter == Status.registered.name diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 1902ce5210..a90de0ed60 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -432,11 +432,8 @@ class _HouseholdOverviewPageState BeneficiaryType.household; if (RegistrationDeliverySingleton() - .householdType != - null && - RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { + .householdType == + HouseholdType.community) { return Column( children: [ DigitTableCard(element: { @@ -449,11 +446,6 @@ class _HouseholdOverviewPageState ?.givenName ?? localizations.translate( i18.common.coreCommonNA), - localizations.translate(i18 - .householdOverView - .instituteTypeLabel): - RegistrationDeliverySingleton() - .householdType, localizations.translate( i18.deliverIntervention .memberCountText, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 0c55f4ba9c..076be78f40 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/theme/digit_extended_theme.dart'; import 'package:digit_ui_components/widgets/atoms/selection_card.dart'; @@ -163,7 +164,14 @@ class HouseDetailsPageState extends LocalizedState { model: houseModel, ), ); - router.push(HouseHoldDetailsRoute()); + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + router.push(IndividualDetailsRoute( + isHeadOfHousehold: true)); + } else { + router.push(HouseHoldDetailsRoute()); + } }, editHousehold: ( address, @@ -211,7 +219,17 @@ class HouseDetailsPageState extends LocalizedState { model: houseModel, ), ); - router.push(HouseHoldDetailsRoute()); + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + router.push(IndividualDetailsRoute( + isHeadOfHousehold: + headOfHousehold != null + ? true + : false)); + } else { + router.push(HouseHoldDetailsRoute()); + } }, ); }, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart index c4946bafee..62245ad9ba 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart @@ -58,28 +58,24 @@ class HouseHoldDetailsPageState extends LocalizedState { return BlocConsumer( listener: (context, state) { - if (state is BeneficiaryRegistrationPersistedState && state.isEdit) { - final overviewBloc = - context.read(); + if (state is BeneficiaryRegistrationPersistedState && + state.isEdit) { + final overviewBloc = context.read(); overviewBloc.add( HouseholdOverviewReloadEvent( - projectId: RegistrationDeliverySingleton() - .projectId - .toString(), + projectId: + RegistrationDeliverySingleton().projectId.toString(), projectBeneficiaryType: - RegistrationDeliverySingleton() - .beneficiaryType ?? - BeneficiaryType.household, + RegistrationDeliverySingleton().beneficiaryType ?? + BeneficiaryType.household, ), ); HouseholdMemberWrapper memberWrapper = overviewBloc.state.householdMemberWrapper; final route = router.parent() as StackRouter; - route.popUntilRouteWithName( - SearchBeneficiaryRoute.name); - route.push(BeneficiaryWrapperRoute( - wrapper: memberWrapper)); + route.popUntilRouteWithName(SearchBeneficiaryRoute.name); + route.push(BeneficiaryWrapperRoute(wrapper: memberWrapper)); } }, builder: (context, registrationState) { @@ -92,282 +88,294 @@ class HouseHoldDetailsPageState extends LocalizedState { ]), enableFixedButton: true, footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [Button( - label: registrationState.mapOrNull( - editHousehold: (value) => localizations - .translate(i18.common.coreCommonSave), - ) ?? - localizations - .translate(i18.householdDetails.actionLabel), - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - form.markAllAsTouched(); - if (!form.valid) return; + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + Button( + label: registrationState.mapOrNull( + editHousehold: (value) => localizations + .translate(i18.common.coreCommonSave), + ) ?? + localizations + .translate(i18.householdDetails.actionLabel), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + form.markAllAsTouched(); + if (!form.valid) return; - final memberCount = - form.control(_memberCountKey).value as int; + final memberCount = + form.control(_memberCountKey).value as int; - final dateOfRegistration = form - .control(_dateOfRegistrationKey) - .value as DateTime; - //[TODO: Use pregnant women form value based on project config - final pregnantWomen = - form.control(_pregnantWomenCountKey).value as int; - final children = - form.control(_childrenCountKey).value as int; + final dateOfRegistration = form + .control(_dateOfRegistrationKey) + .value as DateTime; + //[TODO: Use pregnant women form value based on project config + final pregnantWomen = + form.control(_pregnantWomenCountKey).value as int; + final children = + form.control(_childrenCountKey).value as int; - if (memberCount < (pregnantWomen + children)) { - Toast.showToast( - context, - message: localizations.translate( + if (memberCount < (pregnantWomen + children)) { + Toast.showToast(context, + message: localizations.translate( i18.householdDetails.memberCountError), - type: ToastType.error - ); - } else { - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - addressModel, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var household = householdModel; - household ??= HouseholdModel( - tenantId: - RegistrationDeliverySingleton().tenantId, - clientReferenceId: - householdModel?.clientReferenceId ?? - IdGen.i.identifier, - rowVersion: 1, - clientAuditDetails: ClientAuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - auditDetails: AuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - ); + type: ToastType.error); + } else { + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + addressModel, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var household = householdModel; + household ??= HouseholdModel( + tenantId: + RegistrationDeliverySingleton().tenantId, + clientReferenceId: + householdModel?.clientReferenceId ?? + IdGen.i.identifier, + rowVersion: 1, + clientAuditDetails: ClientAuditDetails( + createdBy: RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + auditDetails: AuditDetails( + createdBy: RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + ); - household = household.copyWith( - rowVersion: 1, - tenantId: - RegistrationDeliverySingleton().tenantId, - clientReferenceId: - householdModel?.clientReferenceId ?? - IdGen.i.identifier, - memberCount: memberCount, - clientAuditDetails: ClientAuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid - .toString(), - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: - RegistrationDeliverySingleton() + household = household.copyWith( + rowVersion: 1, + tenantId: RegistrationDeliverySingleton() + .tenantId, + clientReferenceId: + householdModel?.clientReferenceId ?? + IdGen.i.identifier, + memberCount: memberCount, + clientAuditDetails: ClientAuditDetails( + createdBy: RegistrationDeliverySingleton() .loggedInUserUuid .toString(), - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - auditDetails: AuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid - .toString(), - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: - RegistrationDeliverySingleton() + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid + .toString(), + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + auditDetails: AuditDetails( + createdBy: RegistrationDeliverySingleton() .loggedInUserUuid .toString(), - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - address: addressModel, - additionalFields: HouseholdAdditionalFields( - version: 1, - fields: [ - //[TODO: Use pregnant women form value based on project config - ...?householdModel - ?.additionalFields?.fields - .where((e) => - e.key != - AdditionalFieldsType - .pregnantWomen - .toValue() && - e.key != - AdditionalFieldsType.children - .toValue()), - AdditionalField( - AdditionalFieldsType.pregnantWomen - .toValue(), - pregnantWomen, - ), - AdditionalField( - AdditionalFieldsType.children.toValue(), - children, - ) - ])); + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid + .toString(), + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + address: addressModel, + additionalFields: HouseholdAdditionalFields( + version: 1, + fields: [ + //[TODO: Use pregnant women form value based on project config + ...?householdModel + ?.additionalFields?.fields + .where((e) => + e.key != + AdditionalFieldsType + .pregnantWomen + .toValue() && + e.key != + AdditionalFieldsType + .children + .toValue()), + AdditionalField( + AdditionalFieldsType.pregnantWomen + .toValue(), + pregnantWomen, + ), + AdditionalField( + AdditionalFieldsType.children + .toValue(), + children, + ) + ])); - bloc.add( - BeneficiaryRegistrationSaveHouseholdDetailsEvent( - household: household, - registrationDate: dateOfRegistration, - ), - ); - context.router.push( - IndividualDetailsRoute(isHeadOfHousehold: true), - ); - }, - editHousehold: ( - addressModel, - householdModel, - individuals, - registrationDate, - projectBeneficiaryModel, - loading, - isHeadOfHousehold, - ) { - var household = householdModel.copyWith( - memberCount: memberCount, - address: addressModel, - clientAuditDetails: (householdModel - .clientAuditDetails - ?.createdBy != - null && - householdModel.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: householdModel - .clientAuditDetails!.createdBy, - createdTime: householdModel - .clientAuditDetails!.createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: DateTime.now() - .millisecondsSinceEpoch, - ) - : null, - rowVersion: householdModel.rowVersion, - additionalFields: HouseholdAdditionalFields( - version: householdModel - .additionalFields?.version ?? - 1, - fields: [ - //[TODO: Use pregnant women form value based on project config - ...?householdModel - .additionalFields?.fields - .where((e) => - e.key != - AdditionalFieldsType - .pregnantWomen - .toValue() && - e.key != - AdditionalFieldsType.children - .toValue()), - AdditionalField( - AdditionalFieldsType.pregnantWomen - .toValue(), - pregnantWomen, - ), - AdditionalField( - AdditionalFieldsType.children.toValue(), - children, - ) - ])); + bloc.add( + BeneficiaryRegistrationSaveHouseholdDetailsEvent( + household: household, + registrationDate: dateOfRegistration, + ), + ); + context.router.push( + IndividualDetailsRoute( + isHeadOfHousehold: true), + ); + }, + editHousehold: ( + addressModel, + householdModel, + individuals, + registrationDate, + projectBeneficiaryModel, + loading, + isHeadOfHousehold, + ) { + var household = householdModel.copyWith( + memberCount: memberCount, + address: addressModel, + clientAuditDetails: (householdModel + .clientAuditDetails + ?.createdBy != + null && + householdModel.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: householdModel + .clientAuditDetails!.createdBy, + createdTime: householdModel + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: DateTime.now() + .millisecondsSinceEpoch, + ) + : null, + rowVersion: householdModel.rowVersion, + additionalFields: HouseholdAdditionalFields( + version: householdModel + .additionalFields?.version ?? + 1, + fields: [ + //[TODO: Use pregnant women form value based on project config + ...?householdModel + .additionalFields?.fields + .where((e) => + e.key != + AdditionalFieldsType + .pregnantWomen + .toValue() && + e.key != + AdditionalFieldsType + .children + .toValue()), + AdditionalField( + AdditionalFieldsType.pregnantWomen + .toValue(), + pregnantWomen, + ), + AdditionalField( + AdditionalFieldsType.children + .toValue(), + children, + ) + ])); - bloc.add( - BeneficiaryRegistrationUpdateHouseholdDetailsEvent( - household: household.copyWith( - clientAuditDetails: (addressModel - .clientAuditDetails - ?.createdBy != - null && - addressModel.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: addressModel - .clientAuditDetails!.createdBy, - createdTime: addressModel - .clientAuditDetails!.createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ) - : null, - ), - addressModel: addressModel.copyWith( - clientAuditDetails: (addressModel - .clientAuditDetails - ?.createdBy != - null && - addressModel.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: addressModel - .clientAuditDetails!.createdBy, - createdTime: addressModel - .clientAuditDetails!.createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ) - : null, - ), - ), + bloc.add( + BeneficiaryRegistrationUpdateHouseholdDetailsEvent( + household: household.copyWith( + clientAuditDetails: (addressModel + .clientAuditDetails + ?.createdBy != + null && + addressModel.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: addressModel + .clientAuditDetails! + .createdBy, + createdTime: addressModel + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ) + : null, + ), + addressModel: addressModel.copyWith( + clientAuditDetails: (addressModel + .clientAuditDetails + ?.createdBy != + null && + addressModel.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: addressModel + .clientAuditDetails! + .createdBy, + createdTime: addressModel + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ) + : null, + ), + ), + ); + }, ); - - }, - ); - } - }, - ),] - ), + } + }, + ), + ]), slivers: [ SliverToBoxAdapter( - child: DigitCard( - children: [ - DigitTextBlock( - padding: const EdgeInsets.all(spacer2), - heading: localizations.translate( - i18.householdDetails.householdDetailsLabel, - ), - description: localizations.translate( - i18.householdDetails.householdDetailsDescription, + child: DigitCard(children: [ + DigitTextBlock( + padding: const EdgeInsets.all(spacer2), + heading: localizations.translate( + i18.householdDetails.householdDetailsLabel, + ), + description: localizations.translate( + i18.householdDetails.householdDetailsDescription, ), ), - householdDetailsShowcaseData.dateOfRegistration - .buildWith( + householdDetailsShowcaseData.dateOfRegistration.buildWith( child: ReactiveWrapperField( formControlName: _dateOfRegistrationKey, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdDetails.dateOfRegistrationLabel, ), @@ -379,8 +387,12 @@ class HouseHoldDetailsPageState extends LocalizedState { cancelText: localizations.translate( i18.common.coreCommonCancel, ), - initialValue: DateFormat(Constants().dateMonthYearFormat) - .format(form.control(_dateOfRegistrationKey).value).toString(), + initialValue: + DateFormat(Constants().dateMonthYearFormat) + .format(form + .control(_dateOfRegistrationKey) + .value) + .toString(), ), ), ), @@ -391,21 +403,23 @@ class HouseHoldDetailsPageState extends LocalizedState { .buildWith( child: ReactiveWrapperField( formControlName: _pregnantWomenCountKey, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( - i18.householdDetails - .noOfPregnantWomenCountLabel, + i18.householdDetails.noOfPregnantWomenCountLabel, ), child: DigitNumericFormInput( minValue: 0, maxValue: 10, step: 1, - initialValue: form.control(_pregnantWomenCountKey).value.toString(), + initialValue: form + .control(_pregnantWomenCountKey) + .value + .toString(), onChange: (value) { - form.control(_pregnantWomenCountKey).value=int.parse(value); - int pregnantWomen = form - .control(_pregnantWomenCountKey) - .value; + form.control(_pregnantWomenCountKey).value = + int.parse(value); + int pregnantWomen = + form.control(_pregnantWomenCountKey).value; int children = form.control(_childrenCountKey).value; int memberCount = @@ -424,21 +438,23 @@ class HouseHoldDetailsPageState extends LocalizedState { .buildWith( child: ReactiveWrapperField( formControlName: _childrenCountKey, - builder: (field)=>LabeledField( + builder: (field) => LabeledField( label: localizations.translate( - i18.householdDetails - .noOfChildrenBelow5YearsLabel, + i18.householdDetails.noOfChildrenBelow5YearsLabel, ), child: DigitNumericFormInput( minValue: 0, maxValue: 20, step: 1, - initialValue: form.control(_childrenCountKey).value.toString(), + initialValue: form + .control(_childrenCountKey) + .value + .toString(), onChange: (value) { - form.control(_childrenCountKey).value=int.parse(value); - int pregnantWomen = form - .control(_pregnantWomenCountKey) - .value; + form.control(_childrenCountKey).value = + int.parse(value); + int pregnantWomen = + form.control(_pregnantWomenCountKey).value; int children = form.control(_childrenCountKey).value; int memberCount = @@ -457,7 +473,7 @@ class HouseHoldDetailsPageState extends LocalizedState { .buildWith( child: ReactiveWrapperField( formControlName: _memberCountKey, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdDetails.noOfMembersCountLabel, ), @@ -467,12 +483,15 @@ class HouseHoldDetailsPageState extends LocalizedState { : 1, maxValue: 30, step: 1, - initialValue: form.control(_memberCountKey).value.toString(), + initialValue: form + .control(_memberCountKey) + .value + .toString(), onChange: (value) { - form.control(_memberCountKey).value=int.parse(value); - int pregnantWomen = form - .control(_pregnantWomenCountKey) - .value; + form.control(_memberCountKey).value = + int.parse(value); + int pregnantWomen = + form.control(_pregnantWomenCountKey).value; int children = form.control(_childrenCountKey).value; int memberCount = @@ -486,8 +505,8 @@ class HouseHoldDetailsPageState extends LocalizedState { ), ), ), - const SizedBox(height: 16),] - ), + const SizedBox(height: 16), + ]), ), ], ); diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index ab80f99dc2..f17024fa8d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:digit_data_model/models/entities/address_type.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/blocs/fetch_location_bloc.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/utils/component_utils.dart'; @@ -117,184 +118,197 @@ class HouseholdLocationPageState extends LocalizedState { ], ), footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [BlocBuilder( - builder: (context, locationState) { - return Button( - label: localizations.translate( - i18.householdLocation.actionLabel, - ), - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - form.markAllAsTouched(); - if (!form.valid) return; + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + BlocBuilder( + builder: (context, locationState) { + return Button( + label: localizations.translate( + i18.householdLocation.actionLabel, + ), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + form.markAllAsTouched(); + if (!form.valid) return; - final addressLine1 = - form.control(_addressLine1Key).value as String?; - final addressLine2 = - form.control(_addressLine2Key).value as String?; - final landmark = - form.control(_landmarkKey).value as String?; - final postalCode = - form.control(_postalCodeKey).value as String?; - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - address, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var addressModel = AddressModel( - addressLine1: addressLine1 != null && - addressLine1.trim().isNotEmpty - ? addressLine1 - : null, - addressLine2: addressLine2 != null && - addressLine2.trim().isNotEmpty - ? addressLine2 - : null, - landmark: - landmark != null && landmark.trim().isNotEmpty + final addressLine1 = + form.control(_addressLine1Key).value as String?; + final addressLine2 = + form.control(_addressLine2Key).value as String?; + final landmark = + form.control(_landmarkKey).value as String?; + final postalCode = + form.control(_postalCodeKey).value as String?; + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + address, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var addressModel = AddressModel( + addressLine1: addressLine1 != null && + addressLine1.trim().isNotEmpty + ? addressLine1 + : null, + addressLine2: addressLine2 != null && + addressLine2.trim().isNotEmpty + ? addressLine2 + : null, + landmark: landmark != null && + landmark.trim().isNotEmpty ? landmark : null, - pincode: postalCode != null && - postalCode.trim().isNotEmpty - ? postalCode - : null, - type: AddressType.correspondence, - latitude: form.control(_latKey).value ?? - locationState.latitude, - longitude: form.control(_lngKey).value ?? - locationState.longitude, - locationAccuracy: - form.control(_accuracyKey).value ?? - locationState.accuracy, - locality: LocalityModel( - code: RegistrationDeliverySingleton() - .boundary! - .code!, - name: RegistrationDeliverySingleton() - .boundary! - .name, - ), - tenantId: - RegistrationDeliverySingleton().tenantId, - rowVersion: 1, - auditDetails: AuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context.millisecondsSinceEpoch(), - ), - clientAuditDetails: ClientAuditDetails( - createdBy: RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context.millisecondsSinceEpoch(), - lastModifiedBy: RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - ); + pincode: postalCode != null && + postalCode.trim().isNotEmpty + ? postalCode + : null, + type: AddressType.correspondence, + latitude: form.control(_latKey).value ?? + locationState.latitude, + longitude: form.control(_lngKey).value ?? + locationState.longitude, + locationAccuracy: + form.control(_accuracyKey).value ?? + locationState.accuracy, + locality: LocalityModel( + code: RegistrationDeliverySingleton() + .boundary! + .code!, + name: RegistrationDeliverySingleton() + .boundary! + .name, + ), + tenantId: + RegistrationDeliverySingleton().tenantId, + rowVersion: 1, + auditDetails: AuditDetails( + createdBy: RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + ), + clientAuditDetails: ClientAuditDetails( + createdBy: RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + ); - bloc.add( - BeneficiaryRegistrationSaveAddressEvent( - addressModel, - ), - ); - router.push(HouseDetailsRoute()); - }, - editHousehold: ( - address, - householdModel, - individuals, - registrationDate, - projectBeneficiaryModel, - loading, - headOfHousehold, - ) { - var addressModel = address.copyWith( - addressLine1: addressLine1 != null && - addressLine1.trim().isNotEmpty - ? addressLine1 - : null, - addressLine2: addressLine2 != null && - addressLine2.trim().isNotEmpty - ? addressLine2 - : null, - landmark: - landmark != null && landmark.trim().isNotEmpty + bloc.add( + BeneficiaryRegistrationSaveAddressEvent( + addressModel, + ), + ); + router.push(HouseDetailsRoute()); + }, + editHousehold: ( + address, + householdModel, + individuals, + registrationDate, + projectBeneficiaryModel, + loading, + headOfHousehold, + ) { + var addressModel = address.copyWith( + addressLine1: addressLine1 != null && + addressLine1.trim().isNotEmpty + ? addressLine1 + : null, + addressLine2: addressLine2 != null && + addressLine2.trim().isNotEmpty + ? addressLine2 + : null, + landmark: landmark != null && + landmark.trim().isNotEmpty ? landmark : null, - locality: address.locality, - pincode: postalCode != null && - postalCode.trim().isNotEmpty - ? postalCode - : null, - type: AddressType.correspondence, - latitude: form.control(_latKey).value, - longitude: form.control(_lngKey).value, - locationAccuracy: - form.control(_accuracyKey).value, - ); - // TODO [Linking of Voucher for Household based project need to be handled] + locality: address.locality, + pincode: postalCode != null && + postalCode.trim().isNotEmpty + ? postalCode + : null, + type: AddressType.correspondence, + latitude: form.control(_latKey).value, + longitude: form.control(_lngKey).value, + locationAccuracy: + form.control(_accuracyKey).value, + ); + // TODO [Linking of Voucher for Household based project need to be handled] - bloc.add( - BeneficiaryRegistrationSaveAddressEvent( - addressModel, - ), + bloc.add( + BeneficiaryRegistrationSaveAddressEvent( + addressModel, + ), + ); + router.push(HouseDetailsRoute()); + }, ); - router.push(HouseDetailsRoute()); }, ); }, - ); - }, - ),] - ), + ), + ]), slivers: [ SliverToBoxAdapter( - child: DigitCard( - children: [ - DigitTextBlock( + child: DigitCard(children: [ + DigitTextBlock( padding: const EdgeInsets.only(top: spacer2), - heading: localizations.translate( - i18.householdLocation.householdLocationLabelText, - ), - description: localizations.translate( - i18.householdLocation - .householdLocationDescriptionText, - )), - householdLocationShowcaseData.administrativeArea - .buildWith( + heading: + (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? localizations.translate( + i18.householdLocation.clfLocationLabelText) + : localizations.translate( + i18.householdLocation + .householdLocationLabelText, + ), + description: + (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? null + : localizations.translate( + i18.householdLocation + .householdLocationDescriptionText, + )), + householdLocationShowcaseData.administrativeArea.buildWith( child: ReactiveWrapperField( formControlName: _administrationAreaKey, validationMessages: { 'required': (_) => localizations.translate( - i18.householdLocation - .administrationAreaRequiredValidation, - ), + i18.householdLocation + .administrationAreaRequiredValidation, + ), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( - i18.householdLocation - .administrationAreaFormLabel, + i18.householdLocation.administrationAreaFormLabel, ), child: DigitTextFormInput( readOnly: true, errorMessage: field.errorText, - initialValue: form.control(_administrationAreaKey).value, - onChange: (value){ - form.control(_administrationAreaKey).value=value; + initialValue: + form.control(_administrationAreaKey).value, + onChange: (value) { + form.control(_administrationAreaKey).value = + value; }, ), ), @@ -305,17 +319,18 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _accuracyKey, validationMessages: { 'required': (_) => localizations.translate( - i18.common.corecommonRequired, - ), + i18.common.corecommonRequired, + ), }, - builder: (field)=>LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdLocation.gpsAccuracyLabel, ), child: DigitTextFormInput( readOnly: true, errorMessage: field.errorText, - initialValue: form.control(_accuracyKey).value.toString(), + initialValue: + form.control(_accuracyKey).value.toString(), ), ), ), @@ -325,21 +340,21 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _addressLine1Key, validationMessages: { 'required': (_) => localizations.translate( - i18.common.min2CharsRequired, - ), + i18.common.min2CharsRequired, + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', maxLength.toString()), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdLocation .householdAddressLine1LabelText, ), child: DigitTextFormInput( errorMessage: field.errorText, - onChange: (value){ - form.control(_addressLine1Key).value=value; + onChange: (value) { + form.control(_addressLine1Key).value = value; }, initialValue: form.control(_addressLine1Key).value, ), @@ -351,21 +366,21 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _addressLine2Key, validationMessages: { 'required': (_) => localizations.translate( - i18.common.min2CharsRequired, - ), + i18.common.min2CharsRequired, + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', maxLength.toString()), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdLocation .householdAddressLine2LabelText, ), child: DigitTextFormInput( errorMessage: field.errorText, - onChange: (value){ - form.control(_addressLine2Key).value=value; + onChange: (value) { + form.control(_addressLine2Key).value = value; }, initialValue: form.control(_addressLine2Key).value, ), @@ -377,20 +392,20 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _landmarkKey, validationMessages: { 'required': (_) => localizations.translate( - i18.common.min2CharsRequired, - ), + i18.common.min2CharsRequired, + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', maxLength.toString()), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdLocation.landmarkFormLabel, ), child: DigitTextFormInput( errorMessage: field.errorText, - onChange: (value){ - form.control(_landmarkKey).value=value; + onChange: (value) { + form.control(_landmarkKey).value = value; }, initialValue: form.control(_landmarkKey).value, ), @@ -402,13 +417,13 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _postalCodeKey, validationMessages: { 'required': (_) => localizations.translate( - i18.common.min2CharsRequired, - ), + i18.common.min2CharsRequired, + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', '6'), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( i18.householdLocation.postalCodeFormLabel, ), @@ -418,16 +433,16 @@ class HouseholdLocationPageState extends LocalizedState { FilteringTextInputFormatter.digitsOnly, ], errorMessage: field.errorText, - onChange: (value){ - form.control(_postalCodeKey).value=value; + onChange: (value) { + form.control(_postalCodeKey).value = value; }, maxLength: 6, initialValue: form.control(_postalCodeKey).value, ), ), ), - ),] - ), + ), + ]), ), ], ), @@ -444,8 +459,8 @@ class HouseholdLocationPageState extends LocalizedState { return fb.group({ _administrationAreaKey: FormControl( - value: localizations.translate( - RegistrationDeliverySingleton().boundary!.code ?? ''), + value: localizations + .translate(RegistrationDeliverySingleton().boundary!.code ?? ''), validators: [Validators.required], ), _addressLine1Key: diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index a77e1f777a..4da08d07bf 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -1,6 +1,7 @@ import 'package:auto_route/auto_route.dart'; import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_scanner/blocs/scanner.dart'; import 'package:digit_scanner/pages/qr_scanner.dart'; import 'package:digit_ui_components/digit_components.dart'; @@ -75,15 +76,15 @@ class IndividualDetailsPageState extends LocalizedState { overviewBloc.add( HouseholdOverviewReloadEvent( projectId: - RegistrationDeliverySingleton().projectId.toString(), + RegistrationDeliverySingleton().projectId.toString(), projectBeneficiaryType: - RegistrationDeliverySingleton().beneficiaryType ?? - BeneficiaryType.household, + RegistrationDeliverySingleton().beneficiaryType ?? + BeneficiaryType.household, ), ); await overviewBloc.stream.firstWhere((element) => - element.loading == false && + element.loading == false && element.householdMemberWrapper.household != null); HouseholdMemberWrapper memberWrapper = overviewBloc.state.householdMemberWrapper; @@ -106,44 +107,45 @@ class IndividualDetailsPageState extends LocalizedState { footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), padding: const EdgeInsets.all(spacer2), - children: [ValueListenableBuilder( - valueListenable: clickedStatus, - builder: (context, bool isClicked, _) { - return Button( - label: state.mapOrNull( - editIndividual: (value) => localizations - .translate(i18.common.coreCommonSave), - ) ?? - localizations - .translate(i18.common.coreCommonSubmit), - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () async { - if(form.control(_dobKey).value==null){ - form.control(_dobKey).setErrors({'':true}); - } - if (form.control(_idTypeKey).value == null) { - form.control(_idTypeKey).setErrors({'': true}); - } - if (form.control(_genderKey).value == null) { - setState(() { - form.control(_genderKey).setErrors({'': true}); - }); - } - final userId = - RegistrationDeliverySingleton().loggedInUserUuid; - final projectId = - RegistrationDeliverySingleton().projectId; - form.markAllAsTouched(); - if (!form.valid) return; - FocusManager.instance.primaryFocus?.unfocus(); + children: [ + ValueListenableBuilder( + valueListenable: clickedStatus, + builder: (context, bool isClicked, _) { + return Button( + label: state.mapOrNull( + editIndividual: (value) => localizations + .translate(i18.common.coreCommonSave), + ) ?? + localizations + .translate(i18.common.coreCommonSubmit), + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () async { + if (form.control(_dobKey).value == null) { + form.control(_dobKey).setErrors({'': true}); + } + if (form.control(_idTypeKey).value == null) { + form.control(_idTypeKey).setErrors({'': true}); + } + if (form.control(_genderKey).value == null) { + setState(() { + form.control(_genderKey).setErrors({'': true}); + }); + } + final userId = RegistrationDeliverySingleton() + .loggedInUserUuid; + final projectId = + RegistrationDeliverySingleton().projectId; + form.markAllAsTouched(); + if (!form.valid) return; + FocusManager.instance.primaryFocus?.unfocus(); - state.maybeWhen( - orElse: () { - return; - }, - create: ( + state.maybeWhen( + orElse: () { + return; + }, + create: ( addressModel, householdModel, individualModel, @@ -152,498 +154,502 @@ class IndividualDetailsPageState extends LocalizedState { searchQuery, loading, isHeadOfHousehold, - ) async { - final individual = _getIndividualModel( - context, - form: form, - oldIndividual: null, - ); + ) async { + final individual = _getIndividualModel( + context, + form: form, + oldIndividual: null, + ); - final boundary = - RegistrationDeliverySingleton().boundary; + final boundary = + RegistrationDeliverySingleton().boundary; - bloc.add( - BeneficiaryRegistrationSaveIndividualDetailsEvent( - model: individual, - isHeadOfHousehold: widget.isHeadOfHousehold, - ), - ); - final scannerBloc = - context.read(); - - if (scannerBloc.state.duplicate) { - Toast.showToast( - context, - message: localizations.translate( - i18.deliverIntervention - .resourceAlreadyScanned, - ), - type: ToastType.error - ); - } else { - clickedStatus.value = true; - final scannerBloc = - context.read(); bloc.add( - BeneficiaryRegistrationSummaryEvent( - projectId: projectId!, - userUuid: userId!, - boundary: boundary!, - tag: scannerBloc.state.qrCodes.isNotEmpty - ? scannerBloc.state.qrCodes.first - : null, + BeneficiaryRegistrationSaveIndividualDetailsEvent( + model: individual, + isHeadOfHousehold: widget.isHeadOfHousehold, ), ); - router.push(SummaryRoute()); - } - }, - editIndividual: ( - householdModel, - individualModel, - addressModel, - projectBeneficiaryModel, - loading, - ) { - final scannerBloc = - context.read(); - final individual = _getIndividualModel( - context, - form: form, - oldIndividual: individualModel, - ); - final tag = scannerBloc.state.qrCodes.isNotEmpty - ? scannerBloc.state.qrCodes.first - : null; + final scannerBloc = + context.read(); - if (tag != null && - tag != projectBeneficiaryModel?.tag && - scannerBloc.state.duplicate) { - Toast.showToast( - context, - message: localizations.translate( - i18.deliverIntervention - .resourceAlreadyScanned, - ), - type: ToastType.error - ); - } else { - bloc.add( - BeneficiaryRegistrationUpdateIndividualDetailsEvent( - addressModel: addressModel, - householdModel: householdModel, - model: individual.copyWith( - clientAuditDetails: (individual - .clientAuditDetails - ?.createdBy != - null && - individual.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: individual - .clientAuditDetails!.createdBy, - createdTime: individual - .clientAuditDetails! - .createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: context - .millisecondsSinceEpoch(), - ) + if (scannerBloc.state.duplicate) { + Toast.showToast(context, + message: localizations.translate( + i18.deliverIntervention + .resourceAlreadyScanned, + ), + type: ToastType.error); + } else { + clickedStatus.value = true; + final scannerBloc = + context.read(); + bloc.add( + BeneficiaryRegistrationSummaryEvent( + projectId: projectId!, + userUuid: userId!, + boundary: boundary!, + tag: scannerBloc.state.qrCodes.isNotEmpty + ? scannerBloc.state.qrCodes.first : null, ), - tag: scannerBloc.state.qrCodes.isNotEmpty - ? scannerBloc.state.qrCodes.first - : null, - ), - ); - } - }, - addMember: ( - addressModel, + ); + router.push(SummaryRoute()); + } + }, + editIndividual: ( householdModel, + individualModel, + addressModel, + projectBeneficiaryModel, loading, - ) { - final individual = _getIndividualModel( - context, - form: form, - ); - - if (context.mounted) { + ) { final scannerBloc = - context.read(); + context.read(); + final individual = _getIndividualModel( + context, + form: form, + oldIndividual: individualModel, + ); + final tag = scannerBloc.state.qrCodes.isNotEmpty + ? scannerBloc.state.qrCodes.first + : null; - if (scannerBloc.state.duplicate) { - Toast.showToast( - context, - message: localizations.translate( - i18.deliverIntervention - .resourceAlreadyScanned, - ), - type: ToastType.error, - ); + if (tag != null && + tag != projectBeneficiaryModel?.tag && + scannerBloc.state.duplicate) { + Toast.showToast(context, + message: localizations.translate( + i18.deliverIntervention + .resourceAlreadyScanned, + ), + type: ToastType.error); } else { bloc.add( - BeneficiaryRegistrationAddMemberEvent( - beneficiaryType: - RegistrationDeliverySingleton() - .beneficiaryType!, - householdModel: householdModel, - individualModel: individual, + BeneficiaryRegistrationUpdateIndividualDetailsEvent( addressModel: addressModel, - userUuid: RegistrationDeliverySingleton() - .loggedInUserUuid!, - projectId: RegistrationDeliverySingleton() - .projectId!, + householdModel: householdModel, + model: individual.copyWith( + clientAuditDetails: (individual + .clientAuditDetails + ?.createdBy != + null && + individual.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: individual + .clientAuditDetails! + .createdBy, + createdTime: individual + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ) + : null, + ), tag: scannerBloc.state.qrCodes.isNotEmpty ? scannerBloc.state.qrCodes.first : null, ), ); } - } - }, - ); - }, - ); - }, - ),] - ), + }, + addMember: ( + addressModel, + householdModel, + loading, + ) { + final individual = _getIndividualModel( + context, + form: form, + ); + + if (context.mounted) { + final scannerBloc = + context.read(); + + if (scannerBloc.state.duplicate) { + Toast.showToast( + context, + message: localizations.translate( + i18.deliverIntervention + .resourceAlreadyScanned, + ), + type: ToastType.error, + ); + } else { + bloc.add( + BeneficiaryRegistrationAddMemberEvent( + beneficiaryType: + RegistrationDeliverySingleton() + .beneficiaryType!, + householdModel: householdModel, + individualModel: individual, + addressModel: addressModel, + userUuid: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + projectId: + RegistrationDeliverySingleton() + .projectId!, + tag: scannerBloc + .state.qrCodes.isNotEmpty + ? scannerBloc.state.qrCodes.first + : null, + ), + ); + } + } + }, + ); + }, + ); + }, + ), + ]), slivers: [ SliverToBoxAdapter( - child: DigitCard( - children: [ - Padding( - padding: const EdgeInsets.only(bottom: spacer2), - child: Text( - localizations.translate( - i18.individualDetails.individualsDetailsLabelText, - ), - style: textTheme.headingXl, - ), - ), - individualDetailsShowcaseData.nameOfIndividual - .buildWith( - child: ReactiveWrapperField( - formControlName: _individualNameKey, - validationMessages: { - 'required': (object) => localizations.translate( - '${i18.individualDetails.nameLabelText}_IS_REQUIRED', - ), - 'maxLength': (object) => localizations - .translate(i18.common.maxCharsRequired) - .replaceAll('{}', maxLength.toString()), - }, - builder: (field)=> LabeledField( - label: localizations.translate( - i18.individualDetails.nameLabelText, - ), - isRequired: true, - child: DigitTextFormInput( - initialValue: form.control(_individualNameKey).value, - onChange: (value){ - form.control(_individualNameKey).value=value; - }, - errorMessage: field.errorText, - ), - ), + child: DigitCard(children: [ + Padding( + padding: const EdgeInsets.only(bottom: spacer2), + child: Text( + localizations.translate( + i18.individualDetails.individualsDetailsLabelText, ), + style: textTheme.headingXl, ), - Offstage( - offstage: !widget.isHeadOfHousehold, - child: DigitCheckbox( - label: localizations.translate( - i18.individualDetails.checkboxLabelText, - ), - value: widget.isHeadOfHousehold, - readOnly: widget.isHeadOfHousehold, - onChanged: (_){}, - ), - ), - ReactiveWrapperField( - formControlName: _idTypeKey, + ), + individualDetailsShowcaseData.nameOfIndividual.buildWith( + child: ReactiveWrapperField( + formControlName: _individualNameKey, validationMessages: { - 'required': (_)=> localizations.translate( - i18.common.corecommonRequired, - ), + 'required': (object) => localizations.translate( + '${i18.individualDetails.nameLabelText}_IS_REQUIRED', + ), + 'maxLength': (object) => localizations + .translate(i18.common.maxCharsRequired) + .replaceAll('{}', maxLength.toString()), }, - builder: (field)=> LabeledField( + builder: (field) => LabeledField( label: localizations.translate( - i18.individualDetails.idTypeLabelText, + i18.individualDetails.nameLabelText, ), isRequired: true, - child: DigitDropdown( - selectedOption: (form.control(_idTypeKey).value!=null)? - DropdownItem( - name: localizations.translate(form.control(_idTypeKey).value), - code: form.control(_idTypeKey).value - ):const DropdownItem(name: '', code: ''), - items: RegistrationDeliverySingleton() - .idTypeOptions! - .map( - (e) => DropdownItem( - name: localizations.translate(e), - code: e - ), - ).toList(), - onSelect: (value) { - form.control(_idTypeKey).value=value.code; - setState(() { - if (value.code == 'DEFAULT') { - form.control(_idNumberKey).value = - IdGen.i.identifier.toString(); - } else { - form.control(_idNumberKey).value = null; - } - }); + child: DigitTextFormInput( + initialValue: + form.control(_individualNameKey).value, + onChange: (value) { + form.control(_individualNameKey).value = value; }, - emptyItemText: localizations - .translate(i18.common.noMatchFound), - errorMessage: form.control(_idTypeKey).hasErrors - ? localizations.translate( - i18.common.corecommonRequired, - ):null, + errorMessage: field.errorText, ), ), ), - if (form.control(_idTypeKey).value != 'DEFAULT') - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ReactiveFormConsumer( - builder: (context, formGroup, child) { - return ReactiveWrapperField( - formControlName: _idNumberKey, - validationMessages: { - 'required': (object) => - localizations.translate( - '${i18.individualDetails.idNumberLabelText}_IS_REQUIRED', - ), - }, - builder: (field)=> LabeledField( - label: localizations.translate( - i18.individualDetails.idNumberLabelText, - ), - isRequired: form.control(_idNumberKey).validators.isNotEmpty, - child: DigitTextFormInput( - readOnly: - form.control(_idTypeKey).value == - 'DEFAULT', - initialValue: form.control(_idNumberKey).value, - onChange: (value){ - form.control(_idNumberKey).value=value; - }, - errorMessage: field.errorText, - ), - ), - ); - }, + ), + Offstage( + offstage: !widget.isHeadOfHousehold, + child: DigitCheckbox( + label: (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? localizations.translate( + i18.individualDetails.clfCheckboxLabelText) + : localizations.translate( + i18.individualDetails.checkboxLabelText, + ), + value: widget.isHeadOfHousehold, + readOnly: widget.isHeadOfHousehold, + onChanged: (_) {}, + ), + ), + ReactiveWrapperField( + formControlName: _idTypeKey, + validationMessages: { + 'required': (_) => localizations.translate( + i18.common.corecommonRequired, ), - const SizedBox(height: 4), - ], - ), - if (form.control(_idTypeKey).value == 'DEFAULT') - const SizedBox( - height: spacer2, + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.idTypeLabelText, ), - individualDetailsShowcaseData.dateOfBirth.buildWith( - child: DigitDobPicker( - datePickerFormControl: _dobKey, - datePickerLabel: localizations.translate( - i18.individualDetails.dobLabelText, - ), - ageFieldLabel: localizations.translate( - i18.individualDetails.ageLabelText, - ), - yearsHintLabel: localizations.translate( - i18.individualDetails.yearsHintText, - ), - monthsHintLabel: localizations.translate( - i18.individualDetails.monthsHintText, - ), - separatorLabel: localizations.translate( - i18.individualDetails.separatorLabelText, - ), - yearsAndMonthsErrMsg: localizations.translate( - i18.individualDetails.yearsAndMonthsErrorText, - ), - errorMessage: form.control(_dobKey).hasErrors? - localizations.translate(i18.common.corecommonRequired):null, - initialDate: before150Years, - onChangeOfFormControl: (value) { - if(value!=null){ - setState(() { - form.control(_dobKey).setErrors({'' : false}); - }); - } - // Handle changes to the control's value here - form.control(_dobKey).value=value; + isRequired: true, + child: DigitDropdown( + selectedOption: + (form.control(_idTypeKey).value != null) + ? DropdownItem( + name: localizations.translate( + form.control(_idTypeKey).value), + code: form.control(_idTypeKey).value) + : const DropdownItem(name: '', code: ''), + items: RegistrationDeliverySingleton() + .idTypeOptions! + .map( + (e) => DropdownItem( + name: localizations.translate(e), code: e), + ) + .toList(), + onSelect: (value) { + form.control(_idTypeKey).value = value.code; + setState(() { + if (value.code == 'DEFAULT') { + form.control(_idNumberKey).value = + IdGen.i.identifier.toString(); + } else { + form.control(_idNumberKey).value = null; + } + }); }, - cancelText: localizations - .translate(i18.common.coreCommonCancel), - confirmText: localizations - .translate(i18.common.coreCommonOk), + emptyItemText: + localizations.translate(i18.common.noMatchFound), + errorMessage: form.control(_idTypeKey).hasErrors + ? localizations.translate( + i18.common.corecommonRequired, + ) + : null, ), ), - SelectionCard( - isRequired: true, - title: localizations.translate( - i18.individualDetails.genderLabelText, + ), + if (form.control(_idTypeKey).value != 'DEFAULT') + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ReactiveFormConsumer( + builder: (context, formGroup, child) { + return ReactiveWrapperField( + formControlName: _idNumberKey, + validationMessages: { + 'required': (object) => + localizations.translate( + '${i18.individualDetails.idNumberLabelText}_IS_REQUIRED', + ), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.idNumberLabelText, + ), + isRequired: form + .control(_idNumberKey) + .validators + .isNotEmpty, + child: DigitTextFormInput( + readOnly: form.control(_idTypeKey).value == + 'DEFAULT', + initialValue: + form.control(_idNumberKey).value, + onChange: (value) { + form.control(_idNumberKey).value = value; + }, + errorMessage: field.errorText, + ), + ), + ); + }, + ), + const SizedBox(height: 4), + ], + ), + if (form.control(_idTypeKey).value == 'DEFAULT') + const SizedBox( + height: spacer2, + ), + individualDetailsShowcaseData.dateOfBirth.buildWith( + child: DigitDobPicker( + datePickerFormControl: _dobKey, + datePickerLabel: localizations.translate( + i18.individualDetails.dobLabelText, ), - allowMultipleSelection: false, - width: 126, - initialSelection: - form.control(_genderKey).value != null - ? [form.control(_genderKey).value] - : [], - options: RegistrationDeliverySingleton() - .genderOptions! - .map( - (e) => e, - ) - .toList(), - onSelectionChanged: (value) { - setState(() { - if (value.isNotEmpty) { - form.control(_genderKey).value = value.first; - } else { - form.control(_genderKey).value = null; - setState(() { - form - .control(_genderKey) - .setErrors({'': true}); - }); - } - }); - }, - valueMapper: (value) { - return localizations.translate(value); - }, - errorMessage: form.control(_genderKey).hasErrors + ageFieldLabel: localizations.translate( + i18.individualDetails.ageLabelText, + ), + yearsHintLabel: localizations.translate( + i18.individualDetails.yearsHintText, + ), + monthsHintLabel: localizations.translate( + i18.individualDetails.monthsHintText, + ), + separatorLabel: localizations.translate( + i18.individualDetails.separatorLabelText, + ), + yearsAndMonthsErrMsg: localizations.translate( + i18.individualDetails.yearsAndMonthsErrorText, + ), + errorMessage: form.control(_dobKey).hasErrors ? localizations - .translate(i18.common.corecommonRequired) + .translate(i18.common.corecommonRequired) : null, + initialDate: before150Years, + onChangeOfFormControl: (value) { + if (value != null) { + setState(() { + form.control(_dobKey).setErrors({'': false}); + }); + } + // Handle changes to the control's value here + form.control(_dobKey).value = value; + }, + cancelText: localizations + .translate(i18.common.coreCommonCancel), + confirmText: + localizations.translate(i18.common.coreCommonOk), ), - individualDetailsShowcaseData.mobile.buildWith( - child: ReactiveWrapperField( - formControlName: _mobileNumberKey, - validationMessages: { - 'maxLength': (object) => localizations.translate( - i18.individualDetails - .mobileNumberLengthValidationMessage), - 'minLength': (object) => localizations.translate( - i18.individualDetails - .mobileNumberLengthValidationMessage), - }, - builder: (field)=> LabeledField( - label: localizations.translate( - i18.individualDetails.mobileNumberLabelText, - ), - child: DigitTextFormInput( - keyboardType: TextInputType.number, - maxLength: 10, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - initialValue: form.control(_mobileNumberKey).value, - onChange: (value){ - form.control(_mobileNumberKey).value=value; - }, - ), + ), + SelectionCard( + isRequired: true, + title: localizations.translate( + i18.individualDetails.genderLabelText, + ), + allowMultipleSelection: false, + width: 126, + initialSelection: form.control(_genderKey).value != null + ? [form.control(_genderKey).value] + : [], + options: RegistrationDeliverySingleton() + .genderOptions! + .map( + (e) => e, + ) + .toList(), + onSelectionChanged: (value) { + setState(() { + if (value.isNotEmpty) { + form.control(_genderKey).value = value.first; + } else { + form.control(_genderKey).value = null; + setState(() { + form.control(_genderKey).setErrors({'': true}); + }); + } + }); + }, + valueMapper: (value) { + return localizations.translate(value); + }, + errorMessage: form.control(_genderKey).hasErrors + ? localizations + .translate(i18.common.corecommonRequired) + : null, + ), + individualDetailsShowcaseData.mobile.buildWith( + child: ReactiveWrapperField( + formControlName: _mobileNumberKey, + validationMessages: { + 'maxLength': (object) => localizations.translate(i18 + .individualDetails + .mobileNumberLengthValidationMessage), + 'minLength': (object) => localizations.translate(i18 + .individualDetails + .mobileNumberLengthValidationMessage), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.mobileNumberLabelText, + ), + child: DigitTextFormInput( + keyboardType: TextInputType.number, + maxLength: 10, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + initialValue: form.control(_mobileNumberKey).value, + onChange: (value) { + form.control(_mobileNumberKey).value = value; + }, ), ), ), - const SizedBox(height: 16), - if ((RegistrationDeliverySingleton().beneficiaryType == - BeneficiaryType.household && - widget.isHeadOfHousehold) || - (RegistrationDeliverySingleton().beneficiaryType == - BeneficiaryType.individual)) - BlocBuilder( - buildWhen: (p, c) { - return true; - }, - builder: (context, state) => state - .qrCodes.isNotEmpty - ? Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - width: - MediaQuery.of(context).size.width / - 3, - child: Text( - localizations.translate( - i18.deliverIntervention.voucherCode, + ), + const SizedBox(height: 16), + if ((RegistrationDeliverySingleton().beneficiaryType == + BeneficiaryType.household && + widget.isHeadOfHousehold) || + (RegistrationDeliverySingleton().beneficiaryType == + BeneficiaryType.individual)) + BlocBuilder( + buildWhen: (p, c) { + return true; + }, + builder: (context, state) => state.qrCodes.isNotEmpty + ? Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: + MediaQuery.of(context).size.width / 3, + child: Text( + localizations.translate( + i18.deliverIntervention.voucherCode, + ), + style: theme.textTheme.headlineSmall, + ), ), - style: theme.textTheme.headlineSmall, - ), - ), - Flexible( - child: Text( - overflow: TextOverflow.ellipsis, - localizations - .translate(state.qrCodes.last), - ), - ), - Padding( - padding: const EdgeInsets.only( - bottom: spacer2 * 2, - ), - child: IconButton( - color: theme.colorScheme.secondary, - icon: const Icon(Icons.edit), - onPressed: () { - Navigator.of(context).push( - //[TODO: Add the route to auto_route] - MaterialPageRoute( - builder: (context) => - const DigitScannerPage( - quantity: 1, - isGS1code: false, - singleValue: true, - isEditEnabled: true, - ), - settings: const RouteSettings( - name: '/qr-scanner'), + Flexible( + child: Text( + overflow: TextOverflow.ellipsis, + localizations + .translate(state.qrCodes.last), + ), + ), + Padding( + padding: const EdgeInsets.only( + bottom: spacer2 * 2, + ), + child: IconButton( + color: theme.colorScheme.secondary, + icon: const Icon(Icons.edit), + onPressed: () { + Navigator.of(context).push( + //[TODO: Add the route to auto_route] + MaterialPageRoute( + builder: (context) => + const DigitScannerPage( + quantity: 1, + isGS1code: false, + singleValue: true, + isEditEnabled: true, + ), + settings: const RouteSettings( + name: '/qr-scanner'), + ), + ); + }, + ), + ), + ], + + // ignore: no-empty-block + ) + : Button( + type: ButtonType.secondary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + Navigator.of(context).push( + // [TODO: Add the route to auto_route] + MaterialPageRoute( + builder: (context) => + const DigitScannerPage( + quantity: 1, + isGS1code: false, + singleValue: true, ), - ); - }, + settings: const RouteSettings( + name: '/qr-scanner'), + ), + ); + }, + prefixIcon: Icons.qr_code, + label: localizations.translate( + i18.individualDetails.linkVoucherToIndividual, ), ), - ], - - // ignore: no-empty-block - ) - : Button( - type: ButtonType.secondary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - Navigator.of(context).push( - // [TODO: Add the route to auto_route] - MaterialPageRoute( - builder: (context) => - const DigitScannerPage( - quantity: 1, - isGS1code: false, - singleValue: true, - ), - settings: const RouteSettings( - name: '/qr-scanner'), - ), - ); - }, - prefixIcon: Icons.qr_code, - label: localizations.translate( - i18.individualDetails - .linkVoucherToIndividual, - ), - ), - ),] - ), + ), + ]), ), ], ); @@ -654,10 +660,10 @@ class IndividualDetailsPageState extends LocalizedState { } IndividualModel _getIndividualModel( - BuildContext context, { - required FormGroup form, - IndividualModel? oldIndividual, - }) { + BuildContext context, { + required FormGroup form, + IndividualModel? oldIndividual, + }) { final dob = form.control(_dobKey).value as DateTime?; String? dobString; if (dob != null) { @@ -732,7 +738,7 @@ class IndividualDetailsPageState extends LocalizedState { gender: form.control(_genderKey).value == null ? null : Gender.values - .byName(form.control(_genderKey).value.toString().toLowerCase()), + .byName(form.control(_genderKey).value.toString().toLowerCase()), mobileNumber: form.control(_mobileNumberKey).value, dateOfBirth: dobString, identifiers: [ @@ -789,13 +795,13 @@ class IndividualDetailsPageState extends LocalizedState { _dobKey: FormControl( value: individual?.dateOfBirth != null ? DateFormat(Constants().dateFormat).parse( - individual!.dateOfBirth!, - ) + individual!.dateOfBirth!, + ) : null, ), _genderKey: FormControl(value: getGenderOptions(individual)), _mobileNumberKey: - FormControl(value: individual?.mobileNumber, validators: [ + FormControl(value: individual?.mobileNumber, validators: [ CustomValidator.validMobileNumber, CustomValidator.minPhoneNumValidation, Validators.maxLength(10) @@ -808,6 +814,6 @@ class IndividualDetailsPageState extends LocalizedState { return options?.map((e) => e).firstWhereOrNull( (element) => element.toLowerCase() == individual?.gender?.name, - ); + ); } } diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 47a246b2e6..d526104a55 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -12,6 +12,7 @@ import 'package:digit_ui_components/widgets/atoms/pop_up_card.dart'; import 'package:digit_ui_components/widgets/atoms/switch.dart'; import 'package:digit_ui_components/widgets/molecules/digit_card.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; import 'package:registration_delivery/registration_delivery.dart'; @@ -139,9 +140,17 @@ class _SearchBeneficiaryPageState child: CustomSwitch( mainAxisAlignment: MainAxisAlignment.start, - label: localizations.translate( - i18.searchBeneficiary.proximityLabel, - ), + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate( + i18.searchBeneficiary + .communityProximityLabel, + ) + : localizations.translate( + i18.searchBeneficiary + .proximityLabel, + ), value: isProximityEnabled, onChanged: (value) { searchController.clear(); @@ -172,10 +181,15 @@ class _SearchBeneficiaryPageState padding: const EdgeInsets.all(spacer2), child: DigitSearchBar( controller: searchController, - hintText: localizations.translate( - i18.searchBeneficiary - .beneficiarySearchHintText, - ), + hintText: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .searchBeneficiary.clfSearchHintText) + : localizations.translate( + i18.searchBeneficiary + .beneficiarySearchHintText, + ), textCapitalization: TextCapitalization.words, onChanged: (value) { if (value.isEmpty || @@ -248,9 +262,15 @@ class _SearchBeneficiaryPageState !searchHouseholdsState.loading) InfoCard( type: InfoType.info, - description: localizations.translate( - i18.searchBeneficiary.beneficiaryInfoDescription, - ), + description: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations + .translate(i18.searchBeneficiary.clfInfoTitle) + : localizations.translate( + i18.searchBeneficiary + .beneficiaryInfoDescription, + ), title: localizations.translate( i18.searchBeneficiary.beneficiaryInfoTitle, ), @@ -365,61 +385,72 @@ class _SearchBeneficiaryPageState ], ), ), - bottomNavigationBar: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [ - Button( - label: localizations.translate( - i18.searchBeneficiary.beneficiaryAddActionLabel, + bottomNavigationBar: Offstage( + offstage: RegistrationDeliverySingleton().householdType == + HouseholdType.community && + (searchHouseholdsState.searchQuery == null) || + (searchHouseholdsState.searchQuery != null && + searchHouseholdsState.householdMembers.isNotEmpty), + child: DigitCard( + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + Button( + label: (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? localizations + .translate(i18.searchBeneficiary.clfAddActionLabel) + : localizations.translate( + i18.searchBeneficiary.beneficiaryAddActionLabel, + ), + mainAxisSize: MainAxisSize.max, + type: ButtonType.primary, + size: ButtonSize.large, + isDisabled: searchHouseholdsState.searchQuery != null && + searchHouseholdsState.searchQuery!.isNotEmpty + ? false + : true, + onPressed: () { + FocusManager.instance.primaryFocus?.unfocus(); + context.read().add( + const DigitScannerEvent.handleScanner(), + ); + context.router.push(BeneficiaryRegistrationWrapperRoute( + initialState: BeneficiaryRegistrationCreateState( + searchQuery: searchHouseholdsState.searchQuery, + ), + )); + searchController.clear(); + selectedFilters = []; + blocWrapper.clearEvent(); + }, ), - mainAxisSize: MainAxisSize.max, - type: ButtonType.primary, - size: ButtonSize.large, - isDisabled: searchHouseholdsState.searchQuery != null && - searchHouseholdsState.searchQuery!.isNotEmpty - ? false - : true, - onPressed: () { - FocusManager.instance.primaryFocus?.unfocus(); - context.read().add( - const DigitScannerEvent.handleScanner(), - ); - context.router.push(BeneficiaryRegistrationWrapperRoute( - initialState: BeneficiaryRegistrationCreateState( - searchQuery: searchHouseholdsState.searchQuery, - ), - )); - searchController.clear(); - selectedFilters = []; - blocWrapper.clearEvent(); - }, - ), - Button( - type: ButtonType.secondary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - blocWrapper.clearEvent(); - selectedFilters = []; - searchController.clear(); - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const DigitScannerPage( - quantity: 1, - isGS1code: false, - singleValue: true, + Button( + type: ButtonType.secondary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + blocWrapper.clearEvent(); + selectedFilters = []; + searchController.clear(); + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => const DigitScannerPage( + quantity: 1, + isGS1code: false, + singleValue: true, + ), + settings: const RouteSettings(name: '/qr-scanner'), ), - settings: const RouteSettings(name: '/qr-scanner'), - ), - ); - }, - prefixIcon: Icons.qr_code, - label: localizations.translate( - i18.deliverIntervention.scannerLabel, + ); + }, + prefixIcon: Icons.qr_code, + label: localizations.translate( + i18.deliverIntervention.scannerLabel, + ), ), - ), - ]), + ]), + ), ), ); } @@ -505,26 +536,26 @@ class _SearchBeneficiaryPageState if (isProximityEnabled || selectedFilters.isNotEmpty || searchController.text.isNotEmpty) { - blocWrapper.houseHoldGlobalSearchBloc.add( - SearchHouseholdsEvent.houseHoldGlobalSearch( + blocWrapper.houseHoldGlobalSearchBloc + .add(SearchHouseholdsEvent.houseHoldGlobalSearch( globalSearchParams: GlobalSearchParameters( - isProximityEnabled: isProximityEnabled, - latitude: lat, - longitude: long, - projectId: RegistrationDeliverySingleton().projectId!, - maxRadius: RegistrationDeliverySingleton().maxRadius, - nameSearch: searchController.text.trim().length > 2 - ? searchController.text.trim() - : blocWrapper.searchHouseholdsBloc.state.searchQuery, - filter: selectedFilters, - offset: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.offset - : offset, - limit: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.limit - : limit, - householdType: - RegistrationDeliverySingleton().householdType))); + isProximityEnabled: isProximityEnabled, + latitude: lat, + longitude: long, + projectId: RegistrationDeliverySingleton().projectId!, + maxRadius: RegistrationDeliverySingleton().maxRadius, + nameSearch: searchController.text.trim().length > 2 + ? searchController.text.trim() + : blocWrapper.searchHouseholdsBloc.state.searchQuery, + filter: selectedFilters, + offset: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.offset + : offset, + limit: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.limit + : limit, + householdType: RegistrationDeliverySingleton().householdType, + ))); } } } diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index 0b37f644fe..54c449b1a8 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/utils/date_utils.dart'; import 'package:digit_ui_components/widgets/atoms/label_value_list.dart'; @@ -202,208 +203,214 @@ class SummaryPageState extends LocalizedState { child: Column( children: [ DigitCard( - margin: const EdgeInsets.all(spacer2), + margin: const EdgeInsets.all(spacer2), children: [ - LabelValueList( - heading: localizations.translate(i18 - .householdLocation.householdLocationLabelText), - - labelFlex: 6, - maxLines: 2, - items: [ - LabelValuePair( - label: localizations.translate( - i18.householdLocation.villageLabel), - value: householdState.householdModel?.address - ?.locality?.code ?? - localizations - .translate(i18.common.coreCommonNA), - isInline: true), - LabelValuePair( - label: localizations.translate( - i18.householdLocation.landmarkFormLabel), - value: householdState - .householdModel?.address?.landmark ?? - localizations - .translate(i18.common.coreCommonNA), - isInline: true), - ]), - ]), - DigitCard( - margin: const EdgeInsets.all(spacer2), - children: [ - LabelValueList( - heading: localizations.translate( - i18.householdDetails.householdDetailsLabel), - labelFlex: 6, - items: [ - LabelValuePair( - label: localizations.translate( - i18.beneficiaryDetails.totalMembers), - value: householdState - .householdModel?.memberCount - .toString() ?? - '0', - isInline: true), - LabelValuePair( - label: localizations.translate(i18 - .householdDetails - .noOfPregnantWomenCountLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.pregnantWomen - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), - LabelValuePair( - label: localizations.translate(i18 - .householdDetails - .noOfChildrenBelow5YearsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.children - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), + LabelValueList( + heading: localizations.translate(i18 + .householdLocation + .householdLocationLabelText), + labelFlex: 6, + maxLines: 2, + items: [ + LabelValuePair( + label: localizations.translate( + i18.householdLocation.villageLabel), + value: householdState.householdModel + ?.address?.locality?.code ?? + localizations.translate( + i18.common.coreCommonNA), + isInline: true), + LabelValuePair( + label: localizations.translate(i18 + .householdLocation.landmarkFormLabel), + value: householdState.householdModel + ?.address?.landmark ?? + localizations.translate( + i18.common.coreCommonNA), + isInline: true), + ]), + ]), + if (RegistrationDeliverySingleton().householdType != + HouseholdType.community) + DigitCard( + margin: const EdgeInsets.all(spacer2), + children: [ + LabelValueList( + heading: localizations.translate(i18 + .householdDetails.householdDetailsLabel), + labelFlex: 6, + items: [ + LabelValuePair( + label: localizations.translate(i18 + .beneficiaryDetails.totalMembers), + value: householdState + .householdModel?.memberCount + .toString() ?? + '0', + isInline: true), + LabelValuePair( + label: localizations.translate(i18 + .householdDetails + .noOfPregnantWomenCountLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .pregnantWomen + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true), + LabelValuePair( + label: localizations.translate(i18 + .householdDetails + .noOfChildrenBelow5YearsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .children + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true), + ]), ]), - ]), DigitCard( - margin: const EdgeInsets.all(spacer2), + margin: const EdgeInsets.all(spacer2), children: [ - LabelValueList( - heading: localizations.translate( - i18.householdDetails.houseDetailsLabel), - labelFlex: 6, - items: [ - LabelValuePair( - label: localizations.translate( - i18.householdDetails.noOfRoomsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.noOfRooms - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), - LabelValuePair( - label: localizations.translate( - i18.householdDetails.typeOfStructure), - value: (householdState.householdModel + LabelValueList( + heading: localizations.translate( + i18.householdDetails.houseDetailsLabel), + labelFlex: 6, + items: [ + LabelValuePair( + label: localizations.translate( + i18.householdDetails.noOfRoomsLabel), + value: householdState.householdModel ?.additionalFields?.fields .where((h) => h.key == - AdditionalFieldsType - .houseStructureTypes + AdditionalFieldsType.noOfRooms .toValue()) .firstOrNull - ?.value ?? - []) - .toString() - .split('|') - .map((item) => getLocalizedMessage(item)) - .toList() - .join(', '), - isInline: true), - ]), - ]), + ?.value + .toString() ?? + '0', + isInline: true), + LabelValuePair( + label: localizations.translate( + i18.householdDetails.typeOfStructure), + value: (householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .houseStructureTypes + .toValue()) + .firstOrNull + ?.value ?? + []) + .toString() + .split('|') + .map((item) => + getLocalizedMessage(item)) + .toList() + .join(', '), + isInline: true), + ]), + ]), DigitCard( - margin: const EdgeInsets.all(spacer2), + margin: const EdgeInsets.all(spacer2), children: [ - LabelValueList( - heading: localizations.translate(i18 - .individualDetails.individualsDetailsLabelText), - labelFlex: 6, - items: [ - LabelValuePair( - label: localizations.translate( - i18.individualDetails.nameLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.name?.givenName ?? - localizations.translate( - i18.common.coreCommonNA)), - ), - LabelValuePair( - label: localizations.translate( - i18.individualDetails.dobLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.dateOfBirth != null - ? DigitDateUtils.getFilteredDate( - DigitDateUtils - .getFormattedDateToDateTime( + LabelValueList( + heading: localizations.translate(i18 + .individualDetails + .individualsDetailsLabelText), + labelFlex: 6, + items: [ + LabelValuePair( + label: localizations.translate( + i18.individualDetails.nameLabelText), + value: householdState.maybeWhen( + orElse: () => localizations + .translate(i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel?.name?.givenName ?? + localizations.translate( + i18.common.coreCommonNA)), + ), + LabelValuePair( + label: localizations.translate( + i18.individualDetails.dobLabelText), + value: householdState.maybeWhen( + orElse: () => localizations + .translate(i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel?.dateOfBirth != null + ? DigitDateUtils.getFilteredDate( + DigitDateUtils.getFormattedDateToDateTime( individualModel ?.dateOfBirth ?? '') - .toString(), - dateFormat: Constants() - .dateMonthYearFormat) - .toString() - : localizations.translate( - i18.common.coreCommonNA)), - ), - LabelValuePair( - label: localizations.translate( - i18.individualDetails.genderLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.gender != null - ? localizations.translate( - individualModel?.gender?.name - .toUpperCase() ?? - '') - : localizations.translate( - i18.common.coreCommonNA)), - ), - ]), - ]), + .toString(), + dateFormat: Constants() + .dateMonthYearFormat) + .toString() + : localizations.translate( + i18.common.coreCommonNA)), + ), + LabelValuePair( + label: localizations.translate( + i18.individualDetails.genderLabelText), + value: householdState.maybeWhen( + orElse: () => localizations + .translate(i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel?.gender != null + ? localizations.translate( + individualModel + ?.gender?.name + .toUpperCase() ?? + '') + : localizations.translate( + i18.common.coreCommonNA)), + ), + ]), + ]), ], ), ) diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index c8e4c62b03..3572c01429 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -125,6 +125,11 @@ class Common { class SearchBeneficiary { const SearchBeneficiary(); + String get communityProximityLabel => + 'BENEFICIARY_SEARCH_COMMUNITY_PROXIMITY_LABEL_TEXT'; + + String get clfSearchHintText => 'BENEFICIARY_CLF_SEARCH_HINT_TEXT'; + String get searchCLFLabel => 'BENEFICIARY_SEARCH_CLF_LABEL_TEXT'; String get statisticsLabelText => 'BENEFICIARY_STATISTICS_LABEL_TEXT'; @@ -145,8 +150,12 @@ class SearchBeneficiary { String get beneficiaryInfoTitle => 'BENEFICIARY_INFO_TITLE'; + String get clfInfoTitle => 'BENEFICIARY_CLF_INFO_TITLE'; + String get beneficiaryAddActionLabel => 'BENEFICIARY_ADD_ACTION_LABEL'; + String get clfAddActionLabel => 'BENEFICIARY_ADD_CLF_ACTION_LABEL'; + String get iconLabel => 'ICON_LABEL'; String get filterLabel => 'FILTER_LABEL'; @@ -248,6 +257,8 @@ class BeneficiaryDetails { class IndividualDetails { const IndividualDetails(); + String get clfCheckboxLabelText => 'INDIVIDUAL_CLF_CHECKBOX_LABEL_TEXT'; + String get individualsDetailsLabelText => 'INDIVIDUAL_LABEL_TEXT'; String get nameLabelText => 'INDIVIDUAL_NAME_LABEL_TEXT'; @@ -297,6 +308,8 @@ class IndividualDetails { class HouseholdLocation { const HouseholdLocation(); + String get clfLocationLabelText => 'CLF_LOCATION_LABEL_TEXT'; + String get householdLocationLabelText => 'HOUSEHOLD_LOCATION_LABEL_TEXT'; String get householdLocationDescriptionText => diff --git a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart index ea60ce2d12..ef1fe44f86 100644 --- a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart +++ b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart @@ -1,5 +1,6 @@ import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/utils/date_utils.dart'; import 'package:digit_ui_components/widgets/atoms/table_cell.dart'; @@ -304,17 +305,25 @@ class ViewBeneficiaryCardState extends LocalizedState { householdMember.household?.address?.city, householdMember.household?.address?.pincode, ].whereNotNull().take(2).join(' '), - subtitle: widget.distance != null - ? '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}\n${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' - : '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}', - status: getStatus( - tasks ?? [], - householdMember.projectBeneficiaries ?? [], - RegistrationDeliverySingleton().beneficiaryType == - BeneficiaryType.individual - ? isNotEligible - : false, - isBeneficiaryRefused), + subtitle: (RegistrationDeliverySingleton().householdType == + HouseholdType.family) + ? widget.distance != null + ? '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}\n${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' + : '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}' + : (widget.distance != null) + ? '(${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' + : null, + status: (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? null + : getStatus( + tasks ?? [], + householdMember.projectBeneficiaries ?? [], + RegistrationDeliverySingleton().beneficiaryType == + BeneficiaryType.individual + ? isNotEligible + : false, + isBeneficiaryRefused), title: [ householdMember.headOfHousehold?.name?.givenName ?? localizations.translate(i18.common.coreCommonNA), @@ -333,31 +342,34 @@ class ViewBeneficiaryCardState extends LocalizedState { ), ], ), - Offstage( - offstage: !isCardExpanded, - child: DigitTable( - enableBorder: true, - showPagination: false, - columns: filteredHeaderList, - rows: tableData ?? [], + if (RegistrationDeliverySingleton().householdType == + HouseholdType.family) ...[ + Offstage( + offstage: !isCardExpanded, + child: DigitTable( + enableBorder: true, + showPagination: false, + columns: filteredHeaderList, + rows: tableData ?? [], + ), ), - ), - Container( - height: 24, - margin: const EdgeInsets.all(4), - child: Center( - child: IconButton( - padding: EdgeInsets.zero, - icon: Icon( - isCardExpanded - ? Icons.keyboard_arrow_up - : Icons.keyboard_arrow_down, - size: 24, + Container( + height: 24, + margin: const EdgeInsets.all(4), + child: Center( + child: IconButton( + padding: EdgeInsets.zero, + icon: Icon( + isCardExpanded + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + size: 24, + ), + onPressed: () => isCardExpanded = !isCardExpanded, ), - onPressed: () => isCardExpanded = !isCardExpanded, ), ), - ), + ] ]); } From c36c17ca5b5afa3ba46728244001bf8250b835a7 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 5 Dec 2024 11:29:57 +0530 Subject: [PATCH 11/47] individual global search to show all total members --- .../individual_global_search.dart | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart b/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart index a474b4c654..1d65e01c91 100644 --- a/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart +++ b/packages/registration_delivery/lib/blocs/search_households/individual_global_search.dart @@ -95,11 +95,19 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { ), ); + var finalHouseholdMembersList = await fetchHouseholdMembersBulk( + null, householdList.map((e) => e.clientReferenceId).toList()); + + individualsList = await individual.search(IndividualSearchModel( + clientReferenceId: finalHouseholdMembersList + .map((e) => e.individualClientReferenceId!) + .toList())); + projectBeneficiariesList = await projectBeneficiary.search( ProjectBeneficiarySearchModel( projectId: [RegistrationDeliverySingleton().projectId.toString()], beneficiaryClientReferenceId: - individualClientReferenceIds.map((e) => e).toList())); + individualsList.map((e) => e.clientReferenceId).toList())); List tasksRelated = await _processTasksAndRelatedData( projectBeneficiariesList, taskList, sideEffectsList, referralsList); @@ -109,7 +117,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { referralsList = tasksRelated[2]; await _processHouseholdEntries( - householdMembers, + finalHouseholdMembersList, householdList, individualsList, projectBeneficiariesList, @@ -160,6 +168,20 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { clientReferenceId: houseHoldClientReferenceIds, )); + var finalHouseholdMembersList = await fetchHouseholdMembersBulk( + null, householdList.map((e) => e.clientReferenceId).toList()); + + individualsList = await individual.search(IndividualSearchModel( + clientReferenceId: finalHouseholdMembersList + .map((e) => e.individualClientReferenceId!) + .toList())); + + projectBeneficiariesList = await projectBeneficiary.search( + ProjectBeneficiarySearchModel( + projectId: [RegistrationDeliverySingleton().projectId.toString()], + beneficiaryClientReferenceId: + individualsList.map((e) => e.clientReferenceId).toList())); + finalResults.forEach((element) { taskList.add(element); }); @@ -173,7 +195,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { // Process household entries and add to containers await _processHouseholdEntries( - householdMembersList, + finalHouseholdMembersList, householdList, individualsList, projectBeneficiariesList, @@ -206,11 +228,19 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { .toList(), )); + var finalHouseholdMembersList = await fetchHouseholdMembersBulk( + null, householdList.map((e) => e.clientReferenceId).toList()); + + individualsList = await individual.search(IndividualSearchModel( + clientReferenceId: finalHouseholdMembersList + .map((e) => e.individualClientReferenceId!) + .toList())); + projectBeneficiariesList = await projectBeneficiary.search( ProjectBeneficiarySearchModel( projectId: [RegistrationDeliverySingleton().projectId.toString()], beneficiaryClientReferenceId: - individualClientReferenceIds.map((e) => e).toList())); + individualsList.map((e) => e.clientReferenceId).toList())); List tasksRelated = await _processTasksAndRelatedData( projectBeneficiariesList, taskList, sideEffectsList, referralsList); @@ -220,7 +250,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { referralsList = tasksRelated[2]; await _processHouseholdEntries( - householdMembers, + finalHouseholdMembersList, householdList, individualsList, projectBeneficiariesList, From c9a7b24537286fcb7e03bbf88010468c33902683 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 5 Dec 2024 16:49:00 +0530 Subject: [PATCH 12/47] added search by building name --- .../data/repositories/local/household.dart | 1 + .../local/household_global_search.dart | 30 ++++++++++++++--- .../local/individual_global_search.dart | 33 ++++++++++++++++--- .../pages/beneficiary/household_overview.dart | 6 ++-- .../lib/pages/search_beneficiary.dart | 5 ++- 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/packages/registration_delivery/lib/data/repositories/local/household.dart b/packages/registration_delivery/lib/data/repositories/local/household.dart index 31de2a1e8c..8e19969878 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household.dart @@ -102,6 +102,7 @@ class HouseholdLocalRepository ? null : AddressModel( id: address.id, + buildingName: address.buildingName, relatedClientReferenceId: household.clientReferenceId, tenantId: address.tenantId, doorNo: address.doorNo, diff --git a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart index b3945bb112..3433e975a7 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:math' as math; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:drift/drift.dart'; import 'package:flutter/material.dart'; import 'package:registration_delivery/models/entities/task.dart'; @@ -229,7 +230,12 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { .individual .select() .join([joinName(sql), joinIndividualAddress(sql)]); - await searchByName(selectQuery, params, sql); + if (params.householdType == HouseholdType.community) { + await searchByBuildingName(selectQuery, params, sql); + } else { + await searchByName(selectQuery, params, sql); + } + selectQuery = selectQuery.join([ leftOuterJoin( sql.householdMember, @@ -250,10 +256,14 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && selectQuery != null) { - selectQuery = selectQuery.join([ - joinName(sql), - ]); - selectQuery = searchByName(selectQuery, params, sql); + if (params.householdType == HouseholdType.community) { + selectQuery = searchByBuildingName(selectQuery, params, sql); + } else { + selectQuery = selectQuery.join([ + joinName(sql), + ]); + selectQuery = searchByName(selectQuery, params, sql); + } } return selectQuery; } @@ -383,6 +393,16 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { ); } + searchByBuildingName( + selectQuery, GlobalSearchParameters params, LocalSqlDataStore sql) { + return selectQuery.where(buildAnd([ + if (params.nameSearch != null) + buildOr([ + sql.address.buildingName.contains(params.nameSearch!), + ]), + ])); + } + joinHouseHoldAddress(LocalSqlDataStore sql) { return leftOuterJoin( sql.household, diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index 79161d7565..909bbfa740 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -235,8 +235,10 @@ class IndividualGlobalSearchRepository extends LocalRepository { .individual .select() .join([joinName(sql), joinIndividualAddress(sql)]); - await searchByName(selectQuery, params, sql); + if (params.householdClientReferenceId != null) { + await searchByName(selectQuery, params, sql); + selectQuery = selectQuery.join([ leftOuterJoin( sql.household, @@ -259,6 +261,12 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equals(params.householdClientReferenceId ?? '') ])); } else { + if (params.householdType == HouseholdType.community) { + await searchByBuildingName(selectQuery, params, sql); + } else { + await searchByName(selectQuery, params, sql); + } + selectQuery = selectQuery.join([ leftOuterJoin( sql.householdMember, @@ -283,10 +291,15 @@ class IndividualGlobalSearchRepository extends LocalRepository { } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && selectQuery != null) { - selectQuery = selectQuery.join([ - joinName(sql), - ]); - selectQuery = searchByName(selectQuery, params, sql); + if (params.householdType == HouseholdType.community && + params.householdClientReferenceId == null) { + selectQuery = searchByBuildingName(selectQuery, params, sql); + } else { + selectQuery = selectQuery.join([ + joinName(sql), + ]); + selectQuery = searchByName(selectQuery, params, sql); + } } return selectQuery; } @@ -303,6 +316,16 @@ class IndividualGlobalSearchRepository extends LocalRepository { ])); } + searchByBuildingName( + selectQuery, GlobalSearchParameters params, LocalSqlDataStore sql) { + return selectQuery.where(buildAnd([ + if (params.nameSearch != null) + buildOr([ + sql.address.buildingName.contains(params.nameSearch!), + ]), + ])); + } + filterSearch(selectQuery, GlobalSearchParameters params, String filter, LocalSqlDataStore sql) async { var sql = super.sql; diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index a90de0ed60..057a4b00e7 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -441,9 +441,9 @@ class _HouseholdOverviewPageState .householdOverView .instituteNameLabel): state .householdMemberWrapper - .headOfHousehold - ?.name - ?.givenName ?? + .household + ?.address + ?.buildingName ?? localizations.translate( i18.common.coreCommonNA), localizations.translate( diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index d526104a55..1d30e3999d 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -204,7 +204,10 @@ class _SearchBeneficiaryPageState null && RegistrationDeliverySingleton() .searchHouseHoldFilter! - .isNotEmpty + .isNotEmpty && + RegistrationDeliverySingleton() + .householdType != + HouseholdType.community ? Align( alignment: Alignment.topLeft, child: Padding( From 77fbcbe51796646101ec0531cd857d95348788fe Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 5 Dec 2024 16:50:03 +0530 Subject: [PATCH 13/47] added test case for household overview bloc --- .../test/constants/test_constants.dart | 8 +- .../test/household_overview_test.dart | 76 +++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/packages/registration_delivery/test/constants/test_constants.dart b/packages/registration_delivery/test/constants/test_constants.dart index 3783e71f5f..bf25929118 100644 --- a/packages/registration_delivery/test/constants/test_constants.dart +++ b/packages/registration_delivery/test/constants/test_constants.dart @@ -48,6 +48,7 @@ class RegistrationDeliveryTestConstants { static IndividualModel individualModel = IndividualModel( clientReferenceId: '1ce2-3f4g-5h6i-7j8k-9l0m', + name: NameModel(givenName: 'test'), address: [mockAddress], ); @@ -64,6 +65,9 @@ class RegistrationDeliveryTestConstants { static HouseholdMemberWrapper householdMemberWrapper = HouseholdMemberWrapper( household: mockHousehold, headOfHousehold: mockIndividual, - members: [], - projectBeneficiaries: []); + members: [individualModel], + projectBeneficiaries: [mockProjectBeneficiary], + tasks: [], + sideEffects: [], + referrals: []); } diff --git a/packages/registration_delivery/test/household_overview_test.dart b/packages/registration_delivery/test/household_overview_test.dart index aa5be5c248..dc9503113b 100644 --- a/packages/registration_delivery/test/household_overview_test.dart +++ b/packages/registration_delivery/test/household_overview_test.dart @@ -1,4 +1,5 @@ import 'package:bloc_test/bloc_test.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_data_model/utils/typedefs.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mocktail/mocktail.dart'; @@ -11,6 +12,7 @@ import 'package:registration_delivery/models/entities/project_beneficiary.dart'; import 'package:registration_delivery/models/entities/referral.dart'; import 'package:registration_delivery/models/entities/side_effect.dart'; import 'package:registration_delivery/models/entities/task.dart'; +import 'package:registration_delivery/utils/global_search_parameters.dart'; import 'package:registration_delivery/utils/typedefs.dart'; import 'constants/test_constants.dart'; @@ -52,6 +54,8 @@ void main() { mockIndividualGlobalSearchRepository; setUp(() { + mockIndividualGlobalSearchRepository = + MockIndividualGlobalSearchRepository(); mockHouseholdDataRepository = MockHouseholdDataRepository(); mockIndividualDataRepository = MockIndividualDataRepository(); mockHouseholdMemberDataRepository = MockHouseholdMemberDataRepository(); @@ -79,6 +83,18 @@ void main() { }); setUpAll(() { + registerFallbackValue(GlobalSearchParameters( + householdType: HouseholdType.community, + householdClientReferenceId: '1ce2-3f4g-5h6i-7j8k-9l0m', + isProximityEnabled: false, + latitude: null, + longitude: null, + maxRadius: null, + nameSearch: 'test', + offset: null, + limit: null, + filter: [], + )); registerFallbackValue(HouseholdSearchModel()); registerFallbackValue(HouseholdMemberSearchModel()); registerFallbackValue(IndividualSearchModel()); @@ -124,4 +140,64 @@ void main() { ) ], ); + + //Test case for when search is performed + blocTest( + 'emits [loading: true, search results] when search is performed', + build: () { + // Mock search behavior for individual and household members + when(() => + mockIndividualGlobalSearchRepository + .individualGlobalSearch(any())).thenAnswer((_) async => { + 'total_count': 0, + 'data': [RegistrationDeliveryTestConstants.individualModel] + }); + + when(() => mockHouseholdMemberDataRepository.search(any())) + .thenAnswer((_) async => [ + RegistrationDeliveryTestConstants.mockHouseholdMember, + ]); + when(() => mockHouseholdDataRepository.search(any())) + .thenAnswer((_) async => [ + RegistrationDeliveryTestConstants.mockHousehold, + ]); + when(() => mockIndividualDataRepository.search(any())) + .thenAnswer((_) async => [ + RegistrationDeliveryTestConstants.mockIndividual, + ]); + when(() => mockProjectBeneficiaryDataRepository.search(any())) + .thenAnswer((_) async => [ + RegistrationDeliveryTestConstants.mockProjectBeneficiary, + ]); + when(() => mockTaskDataRepository.search(any())) + .thenAnswer((_) async => []); + when(() => mockSideEffectDataRepository.search(any())) + .thenAnswer((_) async => []); + when(() => mockReferralDataRepository.search(any())) + .thenAnswer((_) async => []); + + return householdOverviewBloc; + }, + act: (bloc) { + // Perform a search query + bloc.add(const HouseholdOverviewReloadEvent( + projectId: RegistrationDeliveryTestConstants.testProjectId, + projectBeneficiaryType: BeneficiaryType.individual, + searchByName: 'test', + selectedFilter: [], + )); + }, + expect: () => [ + HouseholdOverviewState( + loading: true, + householdMemberWrapper: + RegistrationDeliveryTestConstants.householdMemberWrapper, + ), + HouseholdOverviewState( + loading: false, + householdMemberWrapper: + RegistrationDeliveryTestConstants.householdMemberWrapper, + offset: 10), + ], + ); } From 8bf341cc8c72863eceaef3a2f11875a48b867ae5 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 6 Dec 2024 10:26:27 +0530 Subject: [PATCH 14/47] removed clf hard-coded value --- apps/health_campaign_field_worker_app/lib/pages/home.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index 017cf43cac..798440eac4 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -567,8 +567,7 @@ class _HomePageState extends LocalizedState { .map((e) => e.displayName) .toList() .contains(element) || - element == i18.home.db || - element == i18.home.clfLabel) + element == i18.home.db) .toList(); final showcaseKeys = filteredLabels From 779356017a541a9b90e23bf9367b12860bc326ab Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 16 Dec 2024 17:29:51 +0530 Subject: [PATCH 15/47] added placeholder for building name for clf --- .../pubspec.lock | 15 ++------ .../household_location.dart | 37 +++++++++++++++++++ .../lib/utils/i18_key_constants.dart | 6 +++ .../showcase/config/household_location.dart | 4 ++ 4 files changed, 51 insertions(+), 11 deletions(-) diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index e49f4e151b..83b799cf22 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -1334,13 +1334,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.1+1" - institution_campaign: - dependency: "direct overridden" - description: - path: "../../packages/institution_campaign" - relative: true - source: path - version: "0.0.1" integration_test: dependency: "direct dev" description: flutter @@ -1350,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: @@ -1557,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: diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index f17024fa8d..078b2a46a6 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -43,6 +43,7 @@ class HouseholdLocationPageState extends LocalizedState { static const _lngKey = 'lng'; static const _accuracyKey = 'accuracy'; static const maxLength = 64; + static const _buildingNameKey = 'buildingName'; @override void initState() { @@ -192,6 +193,11 @@ class HouseholdLocationPageState extends LocalizedState { tenantId: RegistrationDeliverySingleton().tenantId, rowVersion: 1, + buildingName: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? form.control(_buildingNameKey).value + : null, auditDetails: AuditDetails( createdBy: RegistrationDeliverySingleton() .loggedInUserUuid!, @@ -248,6 +254,11 @@ class HouseholdLocationPageState extends LocalizedState { type: AddressType.correspondence, latitude: form.control(_latKey).value, longitude: form.control(_lngKey).value, + buildingName: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? form.control(_buildingNameKey).value + : null, locationAccuracy: form.control(_accuracyKey).value, ); @@ -335,6 +346,27 @@ class HouseholdLocationPageState extends LocalizedState { ), ), ), + if (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + householdLocationShowcaseData.buildingName.buildWith( + child: ReactiveWrapperField( + formControlName: _buildingNameKey, + validationMessages: { + 'required': (_) => localizations.translate( + i18.common.min2CharsRequired, + ), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.householdLocation.buildingNameLabel), + isRequired: true, + child: DigitTextFormInput( + errorMessage: field.errorText, + onChange: (value) { + form.control(_buildingNameKey).value = + value; + }, + )))), householdLocationShowcaseData.addressLine1.buildWith( child: ReactiveWrapperField( formControlName: _addressLine1Key, @@ -494,6 +526,11 @@ class HouseholdLocationPageState extends LocalizedState { _accuracyKey: FormControl( value: addressModel?.locationAccuracy, ), + if (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + _buildingNameKey: FormControl( + validators: [Validators.required], + ), }); } } diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 3572c01429..7331f72bab 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -308,6 +308,8 @@ class IndividualDetails { class HouseholdLocation { const HouseholdLocation(); + String get buildingNameLabel => 'CLF_BUILDING_NAME_LABEL_TEXT'; + String get clfLocationLabelText => 'CLF_LOCATION_LABEL_TEXT'; String get householdLocationLabelText => 'HOUSEHOLD_LOCATION_LABEL_TEXT'; @@ -758,6 +760,10 @@ String get registerNewHousehold { class HouseholdLocationShowcase { const HouseholdLocationShowcase(); + String get buildingName { + return 'HOUSEHOLD_LOCATION_SHOWCASE_BUILDING_NAME'; + } + String get administrativeArea { return 'HOUSEHOLD_LOCATION_SHOWCASE_ADMINISTRATIVE_AREA'; } diff --git a/packages/registration_delivery/lib/widgets/showcase/config/household_location.dart b/packages/registration_delivery/lib/widgets/showcase/config/household_location.dart index 5a164ce5af..bd3f6e6250 100644 --- a/packages/registration_delivery/lib/widgets/showcase/config/household_location.dart +++ b/packages/registration_delivery/lib/widgets/showcase/config/household_location.dart @@ -29,6 +29,10 @@ class _HouseholdLocationShowcaseData { messageLocalizationKey: i18.householdLocationShowcase.landmark, ); + final buildingName = ShowcaseItemBuilder( + messageLocalizationKey: i18.householdLocationShowcase.buildingName, + ); + final addressLine1 = ShowcaseItemBuilder( messageLocalizationKey: i18.householdLocationShowcase.address, ); From ce7745a223201b0132dc56e5f9e4ceb01c097bb1 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 19 Dec 2024 10:13:07 +0530 Subject: [PATCH 16/47] fix member count --- .../pages/beneficiary_registration/house_details.dart | 9 ++++++++- .../beneficiary_registration/household_location.dart | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 076be78f40..8f51457a70 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -116,7 +116,14 @@ class HouseDetailsPageState extends LocalizedState { createdTime: context.millisecondsSinceEpoch(), ), - memberCount: householdModel?.memberCount, + + ///[TODO]: NEED TO FIX THIS + memberCount: + (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? 0 + : householdModel?.memberCount, clientAuditDetails: ClientAuditDetails( createdBy: RegistrationDeliverySingleton() diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index 078b2a46a6..a4cb28bfe2 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -346,6 +346,8 @@ class HouseholdLocationPageState extends LocalizedState { ), ), ), + + ///[TODO]: NEED TO REMOVE THIS if (RegistrationDeliverySingleton().householdType == HouseholdType.community) householdLocationShowcaseData.buildingName.buildWith( From fafc934c049a795e0a44886c5803b38d3f8fed48 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 20 Dec 2024 10:25:21 +0530 Subject: [PATCH 17/47] fix issues with pagination and filter --- .../household_overview.dart | 7 +- .../local/individual_global_search.dart | 18 +- .../pages/beneficiary/household_overview.dart | 131 ++-- .../house_details.dart | 580 ++++++++++-------- .../household_location.dart | 17 +- .../lib/utils/i18_key_constants.dart | 8 + .../lib/utils/utils.dart | 6 + .../beneficiary/view_beneficiary_card.dart | 16 +- 8 files changed, 452 insertions(+), 331 deletions(-) diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 86209f1f3d..cddee0f66d 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -363,7 +363,7 @@ class HouseholdOverviewBloc emit(state.copyWith( loading: false, - offset: individuals.isNotEmpty + offset: individuals.isNotEmpty && individuals.length == event.limit ? (event.offset ?? 0) + (event.limit ?? 10) : null, householdMemberWrapper: state.householdMemberWrapper.copyWith( @@ -496,7 +496,8 @@ class HouseholdOverviewBloc emit(state.copyWith( loading: false, - offset: individualsList.isNotEmpty + offset: individualsList.isNotEmpty && + individualsList.length == event.limit ? (event.offset ?? 0) + (event.limit ?? 10) : null, householdMemberWrapper: state.householdMemberWrapper.copyWith( @@ -601,7 +602,7 @@ class HouseholdOverviewBloc emit(state.copyWith( loading: false, - offset: individuals.isNotEmpty + offset: individuals.isNotEmpty && individuals.length == event.limit ? (event.offset ?? 0) + (event.limit ?? 10) : null, householdMemberWrapper: state.householdMemberWrapper.copyWith( diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index 909bbfa740..681f90b6d2 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -346,26 +346,16 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equalsExp(sql.individual.clientReferenceId)) ]) ..where(buildAnd([ - if (params.householdType == HouseholdType.community) - sql.householdMember.isHeadOfHousehold.equals(true), sql.householdMember.householdClientReferenceId .equalsExp(sql.household.clientReferenceId), filter == Status.registered.name ? sql.projectBeneficiary.beneficiaryClientReferenceId .isNotNull() - : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull() + : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull(), + if (params.householdClientReferenceId != null) + sql.householdMember.householdClientReferenceId + .equals(params.householdClientReferenceId ?? '') ])); - - if (params.householdClientReferenceId != null) { - selectQuery = selectQuery.join([ - leftOuterJoin( - sql.householdMember, - sql.householdMember.individualClientReferenceId - .equalsExp(sql.individual.clientReferenceId)) - ]) - ..where(sql.householdMember.householdClientReferenceId - .equals(params.householdClientReferenceId ?? '')); - } } else { var filterSearchQuery = await filterTasks(selectQuery, filter, sql, params); diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 057a4b00e7..9231ed6caf 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -365,10 +365,16 @@ class _HouseholdOverviewPageState ), ); }, - label: localizations.translate( - i18.householdOverView - .householdOverViewEditIconText, - ), + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .householdOverView + .clfOverViewEditIconText) + : localizations.translate( + i18.householdOverView + .householdOverViewEditIconText, + ), type: ButtonType.tertiary, size: ButtonSize.medium, prefixIcon: Icons.edit, @@ -510,65 +516,71 @@ class _HouseholdOverviewPageState ); }), ), - Padding( - padding: const EdgeInsets.only( - top: spacer2, bottom: spacer2), - child: Row( - children: [ - Expanded( - child: DigitSearchBar( - controller: searchController, - hintText: localizations.translate( - i18.common.searchByName, + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) ...[ + Padding( + padding: const EdgeInsets.only( + top: spacer2, bottom: spacer2), + child: Row( + children: [ + Expanded( + child: DigitSearchBar( + controller: searchController, + hintText: localizations.translate( + i18.common.searchByName, + ), + textCapitalization: + TextCapitalization.words, + onChanged: (value) { + if (value.length >= 3) { + callReloadEvent( + offset: 0, limit: 10); + } else if (searchController + .value.text.isEmpty) { + callReloadEvent( + offset: 0, limit: 10); + } + }, ), - textCapitalization: - TextCapitalization.words, - onChanged: (value) { - if (value.length >= 3) { - callReloadEvent( - offset: 0, limit: 10); - } else if (searchController - .value.text.isEmpty) { - callReloadEvent( - offset: 0, limit: 10); - } - }, ), - ), - Column( - children: [ - RegistrationDeliverySingleton() - .searchHouseHoldFilter != - null && - RegistrationDeliverySingleton() - .searchHouseHoldFilter! - .isNotEmpty - ? Align( - alignment: Alignment.topLeft, - child: Padding( - padding: - const EdgeInsets.all( - spacer2), - child: Button( - label: - getFilterIconNLabel()[ - 'label'], - size: ButtonSize.medium, - type: ButtonType.tertiary, - suffixIcon: - getFilterIconNLabel()[ - 'icon'], - onPressed: () => - showFilterDialog(), + Column( + children: [ + RegistrationDeliverySingleton() + .searchHouseHoldFilter != + null && + RegistrationDeliverySingleton() + .searchHouseHoldFilter! + .isNotEmpty + ? Align( + alignment: + Alignment.topLeft, + child: Padding( + padding: + const EdgeInsets.all( + spacer2), + child: Button( + label: + getFilterIconNLabel()[ + 'label'], + size: ButtonSize.medium, + type: + ButtonType.tertiary, + suffixIcon: + getFilterIconNLabel()[ + 'icon'], + onPressed: () => + showFilterDialog(), + ), ), - ), - ) - : const Offstage(), - ], - ), - ], + ) + : const Offstage(), + ], + ), + ], + ), ), - ), + ], selectedFilters.isNotEmpty ? Align( alignment: Alignment.topLeft, @@ -1065,6 +1077,7 @@ class _HouseholdOverviewPageState ])); if (filters != null && filters.isNotEmpty) { + selectedFilters.clear(); selectedFilters.addAll(filters); callReloadEvent(offset: 0, limit: 10); } else { diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 8f51457a70..58a0d0c7f4 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -49,99 +49,183 @@ class HouseDetailsPageState extends LocalizedState { final router = context.router; final textTheme = theme.digitTextTheme(context); - return Scaffold( - body: ReactiveFormBuilder( - form: () => buildForm(bloc.state), - builder: (_, form, __) => BlocBuilder( - builder: (context, registrationState) { - return ScrollableContent( - enableFixedButton: true, - header: const Column( - children: [ - BackNavigationHelpHeaderWidget( - showcaseButton: ShowcaseButton(), - showHelp: false, + return BlocConsumer( + listener: (context, state) { + if (state is BeneficiaryRegistrationPersistedState && state.isEdit) { + final overviewBloc = context.read(); + + overviewBloc.add( + HouseholdOverviewReloadEvent( + projectId: RegistrationDeliverySingleton().projectId.toString(), + projectBeneficiaryType: + RegistrationDeliverySingleton().beneficiaryType ?? + BeneficiaryType.household, + ), + ); + HouseholdMemberWrapper memberWrapper = + overviewBloc.state.householdMemberWrapper; + final route = router.parent() as StackRouter; + route.popUntilRouteWithName(SearchBeneficiaryRoute.name); + route.push(BeneficiaryWrapperRoute(wrapper: memberWrapper)); + } + }, + listenWhen: (previous, current) => + RegistrationDeliverySingleton().householdType == + HouseholdType.community, + builder: (context, registrationState) { + return Scaffold( + body: ReactiveFormBuilder( + form: () => buildForm(bloc.state), + builder: (_, form, __) => BlocBuilder( + builder: (context, registrationState) { + return ScrollableContent( + enableFixedButton: true, + header: const Column( + children: [ + BackNavigationHelpHeaderWidget( + showcaseButton: ShowcaseButton(), + showHelp: false, + ), + ], ), - ], - ), - footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [ - Button( - onPressed: () { - form.markAllAsTouched(); - if (form.control(_householdStructureKey).value == - null) { - setState(() { - form + footer: DigitCard( + margin: const EdgeInsets.only(top: spacer2), + padding: const EdgeInsets.all(spacer2), + children: [ + Button( + onPressed: () { + form.markAllAsTouched(); + if (form + .control(_householdStructureKey) + .value == + null) { + setState(() { + form + .control(_householdStructureKey) + .setErrors({'': true}); + }); + } + + if (!form.valid) return; + selectedHouseStructureTypes = form .control(_householdStructureKey) - .setErrors({'': true}); - }); - } + .value; - if (!form.valid) return; - selectedHouseStructureTypes = - form.control(_householdStructureKey).value; + final noOfRooms = + form.control(_noOfRoomsKey).value as int; + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + address, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var houseModel = HouseholdModel( + householdType: + RegistrationDeliverySingleton() + .householdType, + clientReferenceId: IdGen.i.identifier, + tenantId: + RegistrationDeliverySingleton() + .tenantId, + rowVersion: 1, + auditDetails: AuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: context + .millisecondsSinceEpoch(), + ), - final noOfRooms = - form.control(_noOfRoomsKey).value as int; - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - address, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var houseModel = HouseholdModel( - householdType: - RegistrationDeliverySingleton() - .householdType, - clientReferenceId: IdGen.i.identifier, - tenantId: RegistrationDeliverySingleton() - .tenantId, - rowVersion: 1, - auditDetails: AuditDetails( - createdBy: - RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: - context.millisecondsSinceEpoch(), - ), + ///[TODO]: NEED TO FIX THIS + memberCount: + (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? 0 + : householdModel?.memberCount, + clientAuditDetails: + ClientAuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: context + .millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ), + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ + ...?householdModel + ?.additionalFields?.fields + .where((e) => + e.key != + AdditionalFieldsType + .houseStructureTypes + .toValue() && + e.key != + AdditionalFieldsType + .noOfRooms + .toValue()), + AdditionalField( + AdditionalFieldsType + .houseStructureTypes + .toValue(), + selectedHouseStructureTypes + ?.join("|") + .toString(), + ), + AdditionalField( + AdditionalFieldsType.noOfRooms + .toValue(), + noOfRooms, + ) + ])); - ///[TODO]: NEED TO FIX THIS - memberCount: - (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? 0 - : householdModel?.memberCount, - clientAuditDetails: ClientAuditDetails( - createdBy: - RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: - context.millisecondsSinceEpoch(), - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: - context.millisecondsSinceEpoch(), - ), - additionalFields: - HouseholdAdditionalFields( - version: 1, - fields: [ + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, + ), + ); + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + router.push(IndividualDetailsRoute( + isHeadOfHousehold: true)); + } else { + router.push(HouseHoldDetailsRoute()); + } + }, + editHousehold: ( + address, + householdModel, + individuals, + registrationDate, + projectBeneficiaryModel, + loading, + headOfHousehold, + ) { + var houseModel = householdModel.copyWith( + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ ...?householdModel - ?.additionalFields?.fields + .additionalFields?.fields .where((e) => e.key != AdditionalFieldsType @@ -165,113 +249,114 @@ class HouseDetailsPageState extends LocalizedState { noOfRooms, ) ])); + // TODO [Linking of Voucher for Household based project need to be handled] - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), - ); - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { - router.push(IndividualDetailsRoute( - isHeadOfHousehold: true)); - } else { - router.push(HouseHoldDetailsRoute()); - } - }, - editHousehold: ( - address, - householdModel, - individuals, - registrationDate, - projectBeneficiaryModel, - loading, - headOfHousehold, - ) { - var houseModel = householdModel.copyWith( - additionalFields: - HouseholdAdditionalFields( - version: 1, - fields: [ - ...?householdModel - .additionalFields?.fields - .where((e) => - e.key != - AdditionalFieldsType - .houseStructureTypes - .toValue() && - e.key != - AdditionalFieldsType - .noOfRooms - .toValue()), - AdditionalField( - AdditionalFieldsType - .houseStructureTypes - .toValue(), - selectedHouseStructureTypes - ?.join("|") - .toString(), - ), - AdditionalField( - AdditionalFieldsType.noOfRooms - .toValue(), - noOfRooms, - ) - ])); - // TODO [Linking of Voucher for Household based project need to be handled] - - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + bloc.add( + BeneficiaryRegistrationUpdateHouseholdDetailsEvent( + household: houseModel.copyWith( + clientAuditDetails: (address + .clientAuditDetails + ?.createdBy != + null && + address.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: address + .clientAuditDetails! + .createdBy, + createdTime: address + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ) + : null, + ), + addressModel: address.copyWith( + clientAuditDetails: (address + .clientAuditDetails + ?.createdBy != + null && + address.clientAuditDetails + ?.createdTime != + null) + ? ClientAuditDetails( + createdBy: address + .clientAuditDetails! + .createdBy, + createdTime: address + .clientAuditDetails! + .createdTime, + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ) + : null, + ), + ), + ); + } else { + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, + ), + ); + router.push(HouseHoldDetailsRoute()); + } + }, ); - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { - router.push(IndividualDetailsRoute( - isHeadOfHousehold: - headOfHousehold != null - ? true - : false)); - } else { - router.push(HouseHoldDetailsRoute()); - } }, - ); - }, - type: ButtonType.primary, - size: ButtonSize.large, - mainAxisSize: MainAxisSize.max, - label: localizations.translate( - i18.householdLocation.actionLabel, - ), - ), - ]), - slivers: [ - SliverToBoxAdapter( - child: DigitCard(children: [ - Padding( - padding: const EdgeInsets.all(spacer2), - child: Text( - localizations.translate( - i18.householdDetails.houseDetailsLabel, + type: ButtonType.primary, + size: ButtonSize.large, + mainAxisSize: MainAxisSize.max, + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? registrationState.mapOrNull( + editHousehold: (value) => + localizations.translate( + i18.common.coreCommonSave), + ) ?? + localizations.translate( + i18.householdDetails.actionLabel) + : localizations.translate( + i18.householdDetails.actionLabel), ), - style: textTheme.headingXl, - ), - ), - houseShowcaseData.typeOfStructure.buildWith( - child: SelectionCard( - isRequired: true, - title: localizations.translate( - i18.householdDetails.typeOfStructure), - equalWidthOptions: true, - allowMultipleSelection: false, - options: RegistrationDeliverySingleton() - .houseStructureTypes ?? - [], - initialSelection: - form.control(_householdStructureKey).value != + ]), + slivers: [ + SliverToBoxAdapter( + child: DigitCard(children: [ + Padding( + padding: const EdgeInsets.all(spacer2), + child: Text( + localizations.translate( + i18.householdDetails.houseDetailsLabel, + ), + style: textTheme.headingXl, + ), + ), + houseShowcaseData.typeOfStructure.buildWith( + child: SelectionCard( + isRequired: true, + title: localizations.translate( + i18.householdDetails.typeOfStructure), + equalWidthOptions: true, + allowMultipleSelection: false, + options: RegistrationDeliverySingleton() + .houseStructureTypes ?? + [], + initialSelection: form + .control(_householdStructureKey) + .value != null ? [ ...form @@ -279,69 +364,74 @@ class HouseDetailsPageState extends LocalizedState { .value ] : [], - onSelectionChanged: (values) { - form - .control(_householdStructureKey) - .markAsTouched(); - if (values.isEmpty) { - form.control(_householdStructureKey).value = - null; - setState(() { + onSelectionChanged: (values) { form .control(_householdStructureKey) - .setErrors({'': true}); - }); - } else { - setState(() { - form.control(_householdStructureKey).value = - values; - }); - } - }, - valueMapper: (value) { - return localizations - .translate(value.toString()); - }, - errorMessage: form - .control(_householdStructureKey) - .hasErrors && + .markAsTouched(); + if (values.isEmpty) { form .control(_householdStructureKey) - .touched - ? localizations.translate(i18.householdDetails - .selectStructureTypeError) - : null, - ), - ), - houseShowcaseData.noOfRooms.buildWith( - child: ReactiveWrapperField( - formControlName: _noOfRoomsKey, - builder: (field) => LabeledField( - label: localizations.translate( - i18.householdDetails.noOfRoomsLabel, - ), - child: DigitNumericFormInput( - minValue: 1, - maxValue: 20, - initialValue: form - .control(_noOfRoomsKey) - .value - .toString(), - step: 1, - onChange: (value) { - form.control(_noOfRoomsKey).value = - int.parse(value); + .value = null; + setState(() { + form + .control(_householdStructureKey) + .setErrors({'': true}); + }); + } else { + setState(() { + form + .control(_householdStructureKey) + .value = values; + }); + } + }, + valueMapper: (value) { + return localizations + .translate(value.toString()); }, + errorMessage: form + .control(_householdStructureKey) + .hasErrors && + form + .control(_householdStructureKey) + .touched + ? localizations.translate(i18 + .householdDetails + .selectStructureTypeError) + : null, ), ), - ), + houseShowcaseData.noOfRooms.buildWith( + child: ReactiveWrapperField( + formControlName: _noOfRoomsKey, + builder: (field) => LabeledField( + label: localizations.translate( + i18.householdDetails.noOfRoomsLabel, + ), + child: DigitNumericFormInput( + minValue: 1, + maxValue: 20, + initialValue: form + .control(_noOfRoomsKey) + .value + .toString(), + step: 1, + onChange: (value) { + form.control(_noOfRoomsKey).value = + int.parse(value); + }, + ), + ), + ), + ), + ]), ), - ]), - ), - ], - ); - }, - )), + ], + ); + }, + )), + ); + }, ); } diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index a4cb28bfe2..cf430b12a8 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -355,8 +355,13 @@ class HouseholdLocationPageState extends LocalizedState { formControlName: _buildingNameKey, validationMessages: { 'required': (_) => localizations.translate( - i18.common.min2CharsRequired, + i18.common.corecommonRequired, ), + 'sizeLessThan2': (_) => localizations + .translate(i18.common.min3CharsRequired), + 'maxLength': (object) => localizations + .translate(i18.common.maxCharsRequired) + .replaceAll('{}', maxLength.toString()), }, builder: (field) => LabeledField( label: localizations.translate( @@ -368,6 +373,8 @@ class HouseholdLocationPageState extends LocalizedState { form.control(_buildingNameKey).value = value; }, + initialValue: + form.control(_buildingNameKey).value, )))), householdLocationShowcaseData.addressLine1.buildWith( child: ReactiveWrapperField( @@ -530,9 +537,11 @@ class HouseholdLocationPageState extends LocalizedState { ), if (RegistrationDeliverySingleton().householdType == HouseholdType.community) - _buildingNameKey: FormControl( - validators: [Validators.required], - ), + _buildingNameKey: FormControl(validators: [ + Validators.required, + CustomValidator.sizeLessThan2, + Validators.maxLength(64), + ], value: addressModel?.buildingName), }); } } diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 7331f72bab..7cd59ab8d4 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -91,6 +91,8 @@ class Common { String get min2CharsRequired => 'MIN_2_CHARS_REQUIRED'; + String get min3CharsRequired => 'MIN_3_CHARS_REQUIRED'; + String get maxCharsRequired => 'MAX_CHARS_ALLOWED'; String get maxValue => 'MAX_VALUE_ALLOWED'; @@ -431,12 +433,16 @@ class HouseholdOverView { String get householdOverViewEditLabel => 'HOUSEHOLD_OVER_VIEW_EDIT_ICON_LABEL'; + String get clfOverViewEditLabel => 'CLF_OVER_VIEW_EDIT_ICON_LABEL'; + String get householdOverViewDeleteLabel => 'HOUSEHOLD_OVER_VIEW_DELETE_ICON_LABEL'; String get householdOverViewEditIconText => 'HOUSEHOLD_OVER_VIEW_EDIT_ICON_LABEL_TEXT'; + String get clfOverViewEditIconText => 'CLF_OVER_VIEW_EDIT_ICON_LABEL_TEXT'; + String get householdOverViewActionCardTitle => 'HOUSEHOLD_OVER_VIEW_ACTION_CARD_TITLE'; @@ -485,6 +491,8 @@ class MemberCard { String get assignAsHouseholdhead => 'MEMBER_CARD_ASSIGN_AS_HEAD'; + String get assignAsClfhead => 'MEMBER_CARD_ASSIGN_AS_CLF'; + String get editIndividualDetails => 'MEMBER_CARD_EDIT_INDIVIDUAL_DETAILS'; String get deleteIndividualActionText => diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index f577295703..dc6d032696 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -28,6 +28,12 @@ class CustomValidator { : {'required': true}; } + static Map? sizeLessThan2(AbstractControl control) { + return control.value != null && control.value.toString().length <= 2 + ? {'sizeLessThan2': true} + : null; + } + static Map? validMobileNumber( AbstractControl control, ) { diff --git a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart index ef1fe44f86..79258c5ff9 100644 --- a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart +++ b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart @@ -311,7 +311,7 @@ class ViewBeneficiaryCardState extends LocalizedState { ? '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}\n${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' : '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}' : (widget.distance != null) - ? '(${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' + ? '${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' : null, status: (RegistrationDeliverySingleton().householdType == HouseholdType.community) @@ -324,11 +324,15 @@ class ViewBeneficiaryCardState extends LocalizedState { ? isNotEligible : false, isBeneficiaryRefused), - title: [ - householdMember.headOfHousehold?.name?.givenName ?? - localizations.translate(i18.common.coreCommonNA), - householdMember.headOfHousehold?.name?.familyName, - ].whereNotNull().join(''), + title: (RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? householdMember.household?.address?.buildingName ?? + localizations.translate(i18.common.coreCommonNA) + : [ + householdMember.headOfHousehold?.name?.givenName ?? + localizations.translate(i18.common.coreCommonNA), + householdMember.headOfHousehold?.name?.familyName, + ].whereNotNull().join(''), ), ), Flexible( From c90f7a4800097907f7c57a62c1a59825038f4cb2 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 20 Dec 2024 14:52:37 +0530 Subject: [PATCH 18/47] resolved review comments --- .../data/local_store/sql_store/sql_store.dart | 6 +- packages/digit_data_model/pubspec.lock | 433 +++++++++++++++++- packages/digit_data_model/pubspec.yaml | 2 +- .../local/household_global_search.dart | 4 +- .../pages/beneficiary/household_overview.dart | 43 +- .../household_location.dart | 19 +- .../individual_details.dart | 7 +- .../lib/pages/search_beneficiary.dart | 30 +- .../lib/utils/utils.dart | 28 ++ .../lib/widgets/member_card/member_card.dart | 15 +- 10 files changed, 507 insertions(+), 80 deletions(-) diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart index ad544fbdf9..ce33c8ef42 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart @@ -1,8 +1,8 @@ // 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:digit_ui_components/utils/app_logger.dart'; import 'package:drift/drift.dart'; import 'package:drift/native.dart'; import 'package:path/path.dart' as p; @@ -110,7 +110,7 @@ class LocalSqlDataStore extends _$LocalSqlDataStore { /// The `schemaVersion` getter returns the schema version of the database. @override - int get schemaVersion => 5; + int get schemaVersion => 6; /// The `_openConnection` method opens a connection to the database. /// It returns a `LazyDatabase` that opens the database when it is first accessed. @@ -132,7 +132,7 @@ class LocalSqlDataStore extends _$LocalSqlDataStore { await m.createAll(); }, onUpgrade: (Migrator m, int from, int to) async { //Add column for householdType for facility based campaign - if (from < 5) { + if (from < 6) { try { AppLogger.instance.info('Apply migration $from to $to'); await m.addColumn(household, household.householdType); diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index 638fab2f7b..be17ed537c 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -145,6 +145,46 @@ packages: url: "https://pub.dev" source: hosted version: "8.9.2" + camera: + dependency: transitive + description: + name: camera + sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" + url: "https://pub.dev" + source: hosted + version: "0.10.5+9" + camera_android: + dependency: transitive + description: + name: camera_android + sha256: b350ac087f111467e705b2b76cc1322f7f5bdc122aa83b4b243b0872f390d229 + url: "https://pub.dev" + source: hosted + version: "0.10.9+2" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: "608b56b0880722f703871329c4d7d4c2f379c8e2936940851df7fc041abc6f51" + url: "https://pub.dev" + source: hosted + version: "0.9.13+10" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061 + url: "https://pub.dev" + source: hosted + version: "2.8.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: b9235ec0a2ce949daec546f1f3d86f05c3921ed31c7d9ab6b7c03214d152fc2d + url: "https://pub.dev" + source: hosted + version: "0.3.4" characters: dependency: transitive description: @@ -217,6 +257,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + url: "https://pub.dev" + source: hosted + version: "0.3.3+8" crypto: dependency: transitive description: @@ -225,6 +273,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" cupertino_icons: dependency: transitive description: @@ -283,12 +339,20 @@ packages: source: hosted version: "0.4.1" digit_components: - dependency: "direct main" + dependency: "direct overridden" description: path: "../digit_components" relative: true source: path version: "1.0.2+1" + digit_ui_components: + dependency: "direct main" + description: + name: digit_ui_components + sha256: e38f163515aa6a6c5283754e741b21f33fb3a6c0a1fc171a1e4e6620510d46ae + url: "https://pub.dev" + source: hosted + version: "0.0.1+7" dio: dependency: "direct main" description: @@ -297,6 +361,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.4.3+1" + dotted_border: + dependency: transitive + description: + name: dotted_border + sha256: "108837e11848ca776c53b30bc870086f84b62ed6e01c503ed976e8f8c7df9c04" + url: "https://pub.dev" + source: hosted + version: "2.1.0" drift: dependency: "direct main" description: @@ -353,6 +425,46 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" + file_picker: + dependency: transitive + description: + name: file_picker + sha256: d1d0ac3966b36dc3e66eeefb40280c17feb87fa2099c6e22e6a1fc959327bd03 + url: "https://pub.dev" + source: hosted + version: "8.0.0+1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "2ad726953f6e8affbc4df8dc78b77c3b4a060967a291e528ef72ae846c60fb69" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" fixnum: dependency: transitive description: @@ -374,6 +486,30 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.5" + flutter_dropzone: + dependency: transitive + description: + name: flutter_dropzone + sha256: b399c60411f9bf9c4c2f97933c6a3a185859e75aade8897831e76cee4346c8e1 + url: "https://pub.dev" + source: hosted + version: "3.0.7" + flutter_dropzone_platform_interface: + dependency: transitive + description: + name: flutter_dropzone_platform_interface + sha256: "96d2c51c86063ba150551c3b40fd26c5a18785bee071c0c751502d28a545df3b" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter_dropzone_web: + dependency: transitive + description: + name: flutter_dropzone_web + sha256: c5a0fdb63b7216352a01761ec1b6eba1982e49541e60675735e2d3d95e207b19 + url: "https://pub.dev" + source: hosted + version: "3.0.13" flutter_focus_watcher: dependency: transitive description: @@ -438,6 +574,19 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" + url: "https://pub.dev" + source: hosted + version: "2.0.19" flutter_spinkit: dependency: transitive description: @@ -446,6 +595,22 @@ packages: url: "https://pub.dev" source: hosted version: "5.2.1" + flutter_styled_toast: + dependency: transitive + description: + name: flutter_styled_toast + sha256: e667f13a665820eb0fa8506547e47eacbcddf1948d6d3036cfd3b089bd4b0516 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + url: "https://pub.dev" + source: hosted + version: "2.0.10+1" flutter_test: dependency: "direct dev" description: flutter @@ -496,6 +661,54 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + geolocator: + dependency: transitive + description: + name: geolocator + sha256: f4efb8d3c4cdcad2e226af9661eb1a0dd38c71a9494b22526f9da80ab79520e5 + url: "https://pub.dev" + source: hosted + version: "10.1.1" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807" + url: "https://pub.dev" + source: hosted + version: "2.3.8+1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" glob: dependency: transitive description: @@ -528,6 +741,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.3.1" + html: + dependency: transitive + description: + name: html + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + url: "https://pub.dev" + source: hosted + version: "0.15.5" http: dependency: transitive description: @@ -552,6 +773,70 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image_picker: + dependency: transitive + description: + name: image_picker + sha256: "1f498d086203360cca099d20ffea2963f48c39ce91bdd8a3b6d4a045786b02c8" + url: "https://pub.dev" + source: hosted + version: "1.0.8" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "844c6da4e4f2829dffdab97816bca09d0e0977e8dcef7450864aba4e07967a58" + url: "https://pub.dev" + source: hosted + version: "0.8.9+6" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + url: "https://pub.dev" + source: hosted + version: "0.8.9+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + url: "https://pub.dev" + source: hosted + version: "2.9.3" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" intl: dependency: transitive description: @@ -760,6 +1045,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" path_provider: dependency: "direct main" description: @@ -808,6 +1109,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" platform: dependency: transitive description: @@ -1093,6 +1402,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_html: + dependency: transitive + description: + name: universal_html + sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + url: "https://pub.dev" + source: hosted + version: "2.2.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + url: "https://pub.dev" + source: hosted + version: "3.1.2" uuid: dependency: "direct main" description: @@ -1101,6 +1490,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" vector_math: dependency: transitive description: @@ -1109,6 +1522,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" vm_service: dependency: transitive description: @@ -1165,6 +1586,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" xxh3: dependency: transitive description: @@ -1182,5 +1611,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.2.0 <=3.9.0" flutter: ">=3.16.0" diff --git a/packages/digit_data_model/pubspec.yaml b/packages/digit_data_model/pubspec.yaml index 7f37b835f8..f14497251a 100644 --- a/packages/digit_data_model/pubspec.yaml +++ b/packages/digit_data_model/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: dio: ^5.1.2 mocktail: ^1.0.2 collection: ^1.16.0 - digit_components: ^1.0.2 + digit_ui_components: ^0.0.1+7 dev_dependencies: flutter_test: diff --git a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart index 3433e975a7..b595abe385 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household_global_search.dart @@ -397,9 +397,7 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { selectQuery, GlobalSearchParameters params, LocalSqlDataStore sql) { return selectQuery.where(buildAnd([ if (params.nameSearch != null) - buildOr([ - sql.address.buildingName.contains(params.nameSearch!), - ]), + sql.address.buildingName.contains(params.nameSearch!), ])); } diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 9231ed6caf..47459c5ce3 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -291,10 +291,16 @@ class _HouseholdOverviewPageState actions: [ Button( prefixIcon: Icons.edit, - label: localizations.translate( - i18.householdOverView - .householdOverViewEditLabel, - ), + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .householdOverView + .clfOverViewEditLabel) + : localizations.translate( + i18.householdOverView + .householdOverViewEditLabel, + ), type: ButtonType.secondary, size: ButtonSize.large, onPressed: () async { @@ -378,6 +384,7 @@ class _HouseholdOverviewPageState type: ButtonType.tertiary, size: ButtonSize.medium, prefixIcon: Icons.edit, + capitalizeLetters: false, ), ), // BlocBuilder element.value.name == selectedFilter) - .first - .key; - if (mappedStatus != null) { - return mappedStatus; - } else { - return selectedFilter; - } - } } diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index cf430b12a8..54b68c09f0 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -498,6 +498,12 @@ class HouseholdLocationPageState extends LocalizedState { editHousehold: (value) => value.addressModel, ); + final searchQuery = state.mapOrNull( + create: (value) { + return value.searchQuery; + }, + ); + return fb.group({ _administrationAreaKey: FormControl( value: localizations @@ -537,11 +543,14 @@ class HouseholdLocationPageState extends LocalizedState { ), if (RegistrationDeliverySingleton().householdType == HouseholdType.community) - _buildingNameKey: FormControl(validators: [ - Validators.required, - CustomValidator.sizeLessThan2, - Validators.maxLength(64), - ], value: addressModel?.buildingName), + _buildingNameKey: FormControl( + validators: [ + Validators.required, + CustomValidator.sizeLessThan2, + Validators.maxLength(64), + ], + value: addressModel?.buildingName ?? searchQuery?.trim(), + ), }); } } diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index 4da08d07bf..ee88ef53cf 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -354,6 +354,7 @@ class IndividualDetailsPageState extends LocalizedState { Offstage( offstage: !widget.isHeadOfHousehold, child: DigitCheckbox( + capitalizeFirstLetter: false, label: (RegistrationDeliverySingleton().householdType == HouseholdType.community) ? localizations.translate( @@ -783,7 +784,11 @@ class IndividualDetailsPageState extends LocalizedState { CustomValidator.requiredMin, Validators.maxLength(200), ], - value: individual?.name?.givenName ?? searchQuery?.trim(), + value: individual?.name?.givenName ?? + ((RegistrationDeliverySingleton().householdType == + HouseholdType.community) + ? null + : searchQuery?.trim()), ), _idTypeKey: FormControl( value: individual?.identifiers?.firstOrNull?.identifierType, diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 1d30e3999d..c1ee1b24d1 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -399,6 +399,7 @@ class _SearchBeneficiaryPageState padding: const EdgeInsets.all(spacer2), children: [ Button( + capitalizeLetters: false, label: (RegistrationDeliverySingleton().householdType == HouseholdType.community) ? localizations @@ -429,6 +430,7 @@ class _SearchBeneficiaryPageState }, ), Button( + capitalizeLetters: false, type: ButtonType.secondary, size: ButtonSize.large, mainAxisSize: MainAxisSize.max, @@ -562,32 +564,4 @@ class _SearchBeneficiaryPageState } } } - - String getStatus(String selectedFilter) { - final statusMap = { - Status.delivered.toValue(): Status.delivered, - Status.notAdministered.toValue(): Status.notAdministered, - Status.visited.toValue(): Status.visited, - Status.notVisited.toValue(): Status.notVisited, - Status.beneficiaryRefused.toValue(): Status.beneficiaryRefused, - Status.beneficiaryReferred.toValue(): Status.beneficiaryReferred, - Status.administeredSuccess.toValue(): Status.administeredSuccess, - Status.administeredFailed.toValue(): Status.administeredFailed, - Status.inComplete.toValue(): Status.inComplete, - Status.toAdminister.toValue(): Status.toAdminister, - Status.closeHousehold.toValue(): Status.closeHousehold, - Status.registered.toValue(): Status.registered, - Status.notRegistered.toValue(): Status.notRegistered, - }; - - var mappedStatus = statusMap.entries - .where((element) => element.value.name == selectedFilter) - .first - .key; - if (mappedStatus != null) { - return mappedStatus; - } else { - return selectedFilter; - } - } } diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index dc6d032696..faff9eb457 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -493,3 +493,31 @@ Status getTaskStatus(Iterable tasks) { return Status.registered.toValue(); } + +String getStatus(String selectedFilter) { + final statusMap = { + Status.delivered.toValue(): Status.delivered, + Status.notAdministered.toValue(): Status.notAdministered, + Status.visited.toValue(): Status.visited, + Status.notVisited.toValue(): Status.notVisited, + Status.beneficiaryRefused.toValue(): Status.beneficiaryRefused, + Status.beneficiaryReferred.toValue(): Status.beneficiaryReferred, + Status.administeredSuccess.toValue(): Status.administeredSuccess, + Status.administeredFailed.toValue(): Status.administeredFailed, + Status.inComplete.toValue(): Status.inComplete, + Status.toAdminister.toValue(): Status.toAdminister, + Status.closeHousehold.toValue(): Status.closeHousehold, + Status.registered.toValue(): Status.registered, + Status.notRegistered.toValue(): Status.notRegistered, + }; + + var mappedStatus = statusMap.entries + .where((element) => element.value.name == selectedFilter) + .first + .key; + if (mappedStatus != null) { + return mappedStatus; + } else { + return selectedFilter; + } +} diff --git a/packages/registration_delivery/lib/widgets/member_card/member_card.dart b/packages/registration_delivery/lib/widgets/member_card/member_card.dart index f3334c9e80..0b97c1a849 100644 --- a/packages/registration_delivery/lib/widgets/member_card/member_card.dart +++ b/packages/registration_delivery/lib/widgets/member_card/member_card.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/theme/digit_extended_theme.dart'; import 'package:digit_ui_components/widgets/atoms/digit_action_card.dart'; @@ -116,9 +117,14 @@ class MemberCard extends StatelessWidget { actions: [ Button( prefixIcon: Icons.person, - label: localizations.translate( - i18.memberCard.assignAsHouseholdhead, - ), + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate( + i18.memberCard.assignAsClfhead) + : localizations.translate( + i18.memberCard.assignAsHouseholdhead, + ), isDisabled: isHead ? true : false, onPressed: setAsHeadAction, type: ButtonType.secondary, @@ -181,8 +187,7 @@ class MemberCard extends StatelessWidget { ), ), Padding( - padding: - const EdgeInsets.only(left: spacer1, bottom: spacer2), + padding: const EdgeInsets.only(left: spacer1, bottom: spacer2), child: Offstage( offstage: beneficiaryType != BeneficiaryType.individual, child: !isDelivered || From 832fbbb347012f545bf139a9ddc52a61a43ff040 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 20 Dec 2024 16:03:00 +0530 Subject: [PATCH 19/47] fix address issues --- .../pages/beneficiary/household_overview.dart | 1 + .../household_location.dart | 1 + .../lib/pages/search_beneficiary.dart | 29 ++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 47459c5ce3..ba3b22b759 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -290,6 +290,7 @@ class _HouseholdOverviewPageState builder: (ctx) => ActionCard( actions: [ Button( + capitalizeLetters: false, prefixIcon: Icons.edit, label: (RegistrationDeliverySingleton() .householdType == diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index 54b68c09f0..a20d0cf11d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -495,6 +495,7 @@ class HouseholdLocationPageState extends LocalizedState { FormGroup buildForm(BeneficiaryRegistrationState state) { final addressModel = state.mapOrNull( + create: (value) => value.addressModel, editHousehold: (value) => value.addressModel, ); diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index c1ee1b24d1..30b3cfe99f 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -511,7 +511,34 @@ class _SearchBeneficiaryPageState if (!isPagination) { blocWrapper.clearEvent(); } - if (RegistrationDeliverySingleton().beneficiaryType == + + if (RegistrationDeliverySingleton().householdType == + HouseholdType.community) { + if (isProximityEnabled || + selectedFilters.isNotEmpty || + searchController.text.isNotEmpty) { + blocWrapper.houseHoldGlobalSearchBloc + .add(SearchHouseholdsEvent.houseHoldGlobalSearch( + globalSearchParams: GlobalSearchParameters( + isProximityEnabled: isProximityEnabled, + latitude: lat, + longitude: long, + projectId: RegistrationDeliverySingleton().projectId!, + maxRadius: RegistrationDeliverySingleton().maxRadius, + nameSearch: searchController.text.trim().length > 2 + ? searchController.text.trim() + : blocWrapper.searchHouseholdsBloc.state.searchQuery, + filter: selectedFilters, + offset: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.offset + : offset, + limit: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.limit + : limit, + householdType: RegistrationDeliverySingleton().householdType, + ))); + } + } else if (RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.individual) { if (isProximityEnabled || selectedFilters.isNotEmpty || From 8c20de1467da8b435a272418bb22ae3edec57897 Mon Sep 17 00:00:00 2001 From: Naveen Renati <154230258+naveenr-egov@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:35:19 +0530 Subject: [PATCH 20/47] new mdms data for search clf filters --- .../app_initialization.dart | 3 +- .../models/app_config/app_config_model.dart | 14 + .../app_config/app_config_model.freezed.dart | 173 ++++ .../models/app_config/app_config_model.g.dart | 16 + .../models/entities/mdms_master_enums.dart | 2 + .../entities/mdms_master_enums.mapper.dart | 4 + .../pubspec.lock | 40 +- packages/attendance_management/pubspec.lock | 7 - packages/complaints/example/pubspec.lock | 2 +- packages/digit_components/pubspec.lock | 31 - packages/digit_data_model/pubspec.lock | 55 -- packages/digit_dss/pubspec.lock | 467 +++++++++- packages/digit_firebase_services/pubspec.lock | 392 +-------- packages/digit_location_tracker/pubspec.lock | 832 +++++++++++++++++- packages/forms_engine/pubspec.lock | 11 +- packages/inventory_management/pubspec.lock | 7 +- packages/referral_reconciliation/pubspec.lock | 14 +- .../pages/beneficiary/household_overview.dart | 51 +- .../lib/utils/utils.dart | 26 +- .../beneficiary/view_beneficiary_card.dart | 4 +- .../widgets/status_filter/status_filter.dart | 9 +- packages/registration_delivery/pubspec.lock | 7 +- 22 files changed, 1606 insertions(+), 561 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart index 9388198891..83391bf041 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/app_initialization/app_initialization.dart @@ -106,6 +106,7 @@ class AppInitializationBloc MasterEnums.transportTypes.toValue(), MasterEnums.firebaseConfig.toValue(), MasterEnums.searchHouseHoldFilters.toValue(), + MasterEnums.searchCLFFilters.toValue() ]), ), MdmsModuleDetailModel( @@ -242,6 +243,7 @@ class AppInitializationState with _$AppInitializationState { const factory AppInitializationState.uninitialized() = AppUninitialized; const factory AppInitializationState.loading() = AppInitializing; + const factory AppInitializationState.failed() = AppInitializationFailed; const factory AppInitializationState.initialized({ @@ -313,7 +315,6 @@ class MdmsConfig { final List serviceRegistryList; final DashboardConfigSchema? dashboardConfigSchema; - const MdmsConfig( {required this.appConfigs, required this.serviceRegistryList, diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart index 09eb3d39c7..61275e5e68 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart @@ -205,6 +205,7 @@ class BandWidthBatchSize with _$BandWidthBatchSize { @JsonKey(name: 'MAX_RANGE') required double maxRange, @JsonKey(name: 'BATCH_SIZE') required int batchSize, }) = _BandWidthBatchSize; + factory BandWidthBatchSize.fromJson(Map json) => _$BandWidthBatchSizeFromJson(json); } @@ -341,6 +342,18 @@ class SearchHouseHoldFilters with _$SearchHouseHoldFilters { _$SearchHouseHoldFiltersFromJson(json); } +@freezed +class SearchCLFFilters with _$SearchCLFFilters { + factory SearchCLFFilters({ + required String name, + required String code, + required bool active, + }) = _SearchCLFFilters; + + factory SearchCLFFilters.fromJson(Map json) => + _$SearchCLFFiltersFromJson(json); +} + @freezed class TransportTypes with _$TransportTypes { factory TransportTypes({ @@ -358,6 +371,7 @@ class RowVersions with _$RowVersions { required String module, required String version, }) = _RowVersions; + factory RowVersions.fromJson(Map json) => _$RowVersionsFromJson(json); } diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart index 2215021c2b..8f636d2cfc 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart @@ -5247,6 +5247,179 @@ abstract class _SearchHouseHoldFilters implements SearchHouseHoldFilters { get copyWith => throw _privateConstructorUsedError; } +SearchCLFFilters _$SearchCLFFiltersFromJson(Map json) { + return _SearchCLFFilters.fromJson(json); +} + +/// @nodoc +mixin _$SearchCLFFilters { + String get name => throw _privateConstructorUsedError; + String get code => throw _privateConstructorUsedError; + bool get active => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SearchCLFFiltersCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SearchCLFFiltersCopyWith<$Res> { + factory $SearchCLFFiltersCopyWith( + SearchCLFFilters value, $Res Function(SearchCLFFilters) then) = + _$SearchCLFFiltersCopyWithImpl<$Res, SearchCLFFilters>; + @useResult + $Res call({String name, String code, bool active}); +} + +/// @nodoc +class _$SearchCLFFiltersCopyWithImpl<$Res, $Val extends SearchCLFFilters> + implements $SearchCLFFiltersCopyWith<$Res> { + _$SearchCLFFiltersCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? code = null, + Object? active = null, + }) { + return _then(_value.copyWith( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String, + active: null == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SearchCLFFiltersImplCopyWith<$Res> + implements $SearchCLFFiltersCopyWith<$Res> { + factory _$$SearchCLFFiltersImplCopyWith(_$SearchCLFFiltersImpl value, + $Res Function(_$SearchCLFFiltersImpl) then) = + __$$SearchCLFFiltersImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String name, String code, bool active}); +} + +/// @nodoc +class __$$SearchCLFFiltersImplCopyWithImpl<$Res> + extends _$SearchCLFFiltersCopyWithImpl<$Res, _$SearchCLFFiltersImpl> + implements _$$SearchCLFFiltersImplCopyWith<$Res> { + __$$SearchCLFFiltersImplCopyWithImpl(_$SearchCLFFiltersImpl _value, + $Res Function(_$SearchCLFFiltersImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? name = null, + Object? code = null, + Object? active = null, + }) { + return _then(_$SearchCLFFiltersImpl( + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + code: null == code + ? _value.code + : code // ignore: cast_nullable_to_non_nullable + as String, + active: null == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SearchCLFFiltersImpl implements _SearchCLFFilters { + _$SearchCLFFiltersImpl( + {required this.name, required this.code, required this.active}); + + factory _$SearchCLFFiltersImpl.fromJson(Map json) => + _$$SearchCLFFiltersImplFromJson(json); + + @override + final String name; + @override + final String code; + @override + final bool active; + + @override + String toString() { + return 'SearchCLFFilters(name: $name, code: $code, active: $active)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SearchCLFFiltersImpl && + (identical(other.name, name) || other.name == name) && + (identical(other.code, code) || other.code == code) && + (identical(other.active, active) || other.active == active)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, name, code, active); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SearchCLFFiltersImplCopyWith<_$SearchCLFFiltersImpl> get copyWith => + __$$SearchCLFFiltersImplCopyWithImpl<_$SearchCLFFiltersImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$SearchCLFFiltersImplToJson( + this, + ); + } +} + +abstract class _SearchCLFFilters implements SearchCLFFilters { + factory _SearchCLFFilters( + {required final String name, + required final String code, + required final bool active}) = _$SearchCLFFiltersImpl; + + factory _SearchCLFFilters.fromJson(Map json) = + _$SearchCLFFiltersImpl.fromJson; + + @override + String get name; + @override + String get code; + @override + bool get active; + @override + @JsonKey(ignore: true) + _$$SearchCLFFiltersImplCopyWith<_$SearchCLFFiltersImpl> get copyWith => + throw _privateConstructorUsedError; +} + TransportTypes _$TransportTypesFromJson(Map json) { return _TransportTypes.fromJson(json); } diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart index 5003c3424b..3cd523aa9b 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart @@ -477,6 +477,22 @@ Map _$$SearchHouseHoldFiltersImplToJson( 'active': instance.active, }; +_$SearchCLFFiltersImpl _$$SearchCLFFiltersImplFromJson( + Map json) => + _$SearchCLFFiltersImpl( + name: json['name'] as String, + code: json['code'] as String, + active: json['active'] as bool, + ); + +Map _$$SearchCLFFiltersImplToJson( + _$SearchCLFFiltersImpl instance) => + { + 'name': instance.name, + 'code': instance.code, + 'active': instance.active, + }; + _$TransportTypesImpl _$$TransportTypesImplFromJson(Map json) => _$TransportTypesImpl( name: json['name'] as String, diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.dart b/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.dart index b426355d09..c986b15e60 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.dart @@ -49,6 +49,8 @@ enum MasterEnums { firebaseConfig, @MappableValue("SEARCH_HOUSEHOLD_FILTERS") searchHouseHoldFilters, + @MappableValue("SEARCH_CLF_FILTERS") + searchCLFFilters, @MappableValue("PrivacyPolicy") privacyPolicy, @MappableValue("dashboardConfig") diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.mapper.dart index 870f84eebe..cc61baa2d4 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/mdms_master_enums.mapper.dart @@ -69,6 +69,8 @@ class MasterEnumsMapper extends EnumMapper { return MasterEnums.firebaseConfig; case "SEARCH_HOUSEHOLD_FILTERS": return MasterEnums.searchHouseHoldFilters; + case "SEARCH_CLF_FILTERS": + return MasterEnums.searchCLFFilters; case "PrivacyPolicy": return MasterEnums.privacyPolicy; case "dashboardConfig": @@ -125,6 +127,8 @@ class MasterEnumsMapper extends EnumMapper { return "FIREBASE_CONFIG"; case MasterEnums.searchHouseHoldFilters: return "SEARCH_HOUSEHOLD_FILTERS"; + case MasterEnums.searchCLFFilters: + return "SEARCH_CLF_FILTERS"; case MasterEnums.privacyPolicy: return "PrivacyPolicy"; case MasterEnums.dashboardConfig: diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index 83b799cf22..372da02014 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -506,9 +506,10 @@ packages: digit_components: dependency: "direct main" description: - path: "../../packages/digit_components" - relative: true - source: path + name: digit_components + sha256: "07b585e5d8010639366da72a4a8b215ce9b8790c75b2162b66af3cea57ca35d9" + url: "https://pub.dev" + source: hosted version: "1.0.2+1" digit_data_model: dependency: "direct main" @@ -527,17 +528,19 @@ packages: digit_firebase_services: dependency: "direct main" description: - path: "../../packages/digit_firebase_services" - relative: true - source: path + name: digit_firebase_services + sha256: ce76521d797e123b6fc95c9dfad7d4a918a93b97f57aecd0e1d517b46190909d + url: "https://pub.dev" + source: hosted version: "0.0.1" digit_location_tracker: dependency: "direct main" description: - path: "../../packages/digit_location_tracker" - relative: true - source: path - version: "0.0.1-dev.1" + name: digit_location_tracker + sha256: ee5531b9b9442820d48d1ddd86177602eb425f742b0d9c29b57325ef157fa886 + url: "https://pub.dev" + source: hosted + version: "0.0.1-dev.2" digit_scanner: dependency: "direct main" description: @@ -548,9 +551,10 @@ packages: digit_showcase: dependency: "direct main" description: - path: "../../packages/digit_showcase" - relative: true - source: path + name: digit_showcase + sha256: "75b67298f1860ad757827b15af752b677f934b5275b887e36b15e25a5285e498" + url: "https://pub.dev" + source: hosted version: "1.0.0" digit_ui_components: dependency: "direct main" @@ -1343,10 +1347,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" inventory_management: dependency: "direct main" description: @@ -1550,10 +1554,10 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" + sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" url: "https://pub.dev" source: hosted - version: "4.2.0" + version: "5.0.1" package_info_plus_platform_interface: dependency: transitive description: @@ -2397,5 +2401,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <=3.9.0" + dart: ">=3.2.3 <3.9.0" flutter: ">=3.16.0" diff --git a/packages/attendance_management/pubspec.lock b/packages/attendance_management/pubspec.lock index de4b65da02..461317ac1a 100644 --- a/packages/attendance_management/pubspec.lock +++ b/packages/attendance_management/pubspec.lock @@ -362,13 +362,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" - digit_components: - dependency: "direct main" - description: - path: "../digit_components" - relative: true - source: path - version: "1.0.2+1" digit_data_model: dependency: "direct main" description: diff --git a/packages/complaints/example/pubspec.lock b/packages/complaints/example/pubspec.lock index e78473cf30..41b7336278 100644 --- a/packages/complaints/example/pubspec.lock +++ b/packages/complaints/example/pubspec.lock @@ -175,7 +175,7 @@ packages: path: ".." relative: true source: path - version: "0.0.1-dev.1" + version: "0.0.1-dev.2" convert: dependency: transitive description: diff --git a/packages/digit_components/pubspec.lock b/packages/digit_components/pubspec.lock index e9d52e3a2c..7c84c45c4f 100644 --- a/packages/digit_components/pubspec.lock +++ b/packages/digit_components/pubspec.lock @@ -17,14 +17,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.2.0" - ansicolor: - dependency: transitive - description: - name: ansicolor - sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" - url: "https://pub.dev" - source: hosted - version: "2.0.3" archive: dependency: transitive description: @@ -209,21 +201,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" - dart_mappable: - dependency: transitive - description: - name: dart_mappable - sha256: "47269caf2060533c29b823ff7fa9706502355ffcb61e7f2a374e3a0fb2f2c3f0" - url: "https://pub.dev" - source: hosted - version: "4.2.2" - dart_mappable_builder: - dependency: "direct overridden" - description: - path: "../dart_mappable_builder" - relative: true - source: path - version: "4.2.0" dart_style: dependency: transitive description: @@ -932,14 +909,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - type_plus: - dependency: transitive - description: - name: type_plus - sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 - url: "https://pub.dev" - source: hosted - version: "2.1.1" typed_data: dependency: transitive description: diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index be17ed537c..960fd1df76 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -281,14 +281,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" dart_mappable: dependency: "direct main" description: @@ -338,13 +330,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" - digit_components: - dependency: "direct overridden" - description: - path: "../digit_components" - relative: true - source: path - version: "1.0.2+1" digit_ui_components: dependency: "direct main" description: @@ -393,14 +378,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.15.0" - easy_stepper: - dependency: transitive - description: - name: easy_stepper - sha256: "77f3ab4ee3c867b5a2236bf712abb08fed2b1c533cf24cf3fcd46c2821072ffd" - url: "https://pub.dev" - source: hosted - version: "0.5.2+1" fake_async: dependency: transitive description: @@ -510,14 +487,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.13" - flutter_focus_watcher: - dependency: transitive - description: - name: flutter_focus_watcher - sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 - url: "https://pub.dev" - source: hosted - version: "2.0.0" flutter_keyboard_visibility: dependency: transitive description: @@ -1021,22 +990,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" - package_info_plus: - dependency: transitive - description: - name: package_info_plus - sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79" - url: "https://pub.dev" - source: hosted - version: "5.0.1" - package_info_plus_platform_interface: - dependency: transitive - description: - name: package_info_plus_platform_interface - sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" - url: "https://pub.dev" - source: hosted - version: "2.0.1" path: dependency: "direct main" description: @@ -1197,14 +1150,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" - remove_emoji_input_formatter: - dependency: transitive - description: - name: remove_emoji_input_formatter - sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" - url: "https://pub.dev" - source: hosted - version: "0.0.1+1" shelf: dependency: transitive description: diff --git a/packages/digit_dss/pubspec.lock b/packages/digit_dss/pubspec.lock index cedd551475..ace2f5a15a 100644 --- a/packages/digit_dss/pubspec.lock +++ b/packages/digit_dss/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "61.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "4eec93681221723a686ad580c2e7d960e1017cf1a4e0a263c2573c2c6b0bf5cd" + url: "https://pub.dev" + source: hosted + version: "1.3.25" analyzer: dependency: transitive description: @@ -60,11 +68,10 @@ packages: attendance_management: dependency: "direct main" description: - name: attendance_management - sha256: f1b4373e8d0d9f8227ede0d25d4141f0d16d18ac2525c0347b844098cdab080f - url: "https://pub.dev" - source: hosted - version: "1.0.2+1" + path: "../attendance_management" + relative: true + source: path + version: "1.0.3-dev.1" auto_route: dependency: "direct main" description: @@ -169,6 +176,46 @@ packages: url: "https://pub.dev" source: hosted version: "8.9.2" + camera: + dependency: transitive + description: + name: camera + sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" + url: "https://pub.dev" + source: hosted + version: "0.10.5+9" + camera_android: + dependency: transitive + description: + name: camera_android + sha256: b350ac087f111467e705b2b76cc1322f7f5bdc122aa83b4b243b0872f390d229 + url: "https://pub.dev" + source: hosted + version: "0.10.9+2" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: "608b56b0880722f703871329c4d7d4c2f379c8e2936940851df7fc041abc6f51" + url: "https://pub.dev" + source: hosted + version: "0.9.13+10" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061 + url: "https://pub.dev" + source: hosted + version: "2.8.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: b9235ec0a2ce949daec546f1f3d86f05c3921ed31c7d9ab6b7c03214d152fc2d + url: "https://pub.dev" + source: hosted + version: "0.3.4" characters: dependency: transitive description: @@ -257,6 +304,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + url: "https://pub.dev" + source: hosted + version: "0.3.3+8" crypto: dependency: transitive description: @@ -265,6 +320,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" cupertino_icons: dependency: transitive description: @@ -332,17 +395,32 @@ packages: dependency: "direct main" description: name: digit_components - sha256: "9cca4d9a546037080afe02b6ade82fdf01574e11f5656ad12120fd6966578616" + sha256: "07b585e5d8010639366da72a4a8b215ce9b8790c75b2162b66af3cea57ca35d9" url: "https://pub.dev" source: hosted - version: "1.0.1+1" + version: "1.0.2+1" digit_data_model: dependency: "direct main" description: path: "../digit_data_model" relative: true source: path - version: "1.0.4" + version: "1.0.5-dev.1" + digit_firebase_services: + dependency: "direct overridden" + description: + path: "../digit_firebase_services" + relative: true + source: path + version: "0.0.1" + digit_ui_components: + dependency: transitive + description: + name: digit_ui_components + sha256: e38f163515aa6a6c5283754e741b21f33fb3a6c0a1fc171a1e4e6620510d46ae + url: "https://pub.dev" + source: hosted + version: "0.0.1+7" dio: dependency: "direct main" description: @@ -359,6 +437,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + dotted_border: + dependency: transitive + description: + name: dotted_border + sha256: "108837e11848ca776c53b30bc870086f84b62ed6e01c503ed976e8f8c7df9c04" + url: "https://pub.dev" + source: hosted + version: "2.1.0" drift: dependency: transitive description: @@ -415,6 +501,86 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" + file_picker: + dependency: transitive + description: + name: file_picker + sha256: d1d0ac3966b36dc3e66eeefb40280c17feb87fa2099c6e22e6a1fc959327bd03 + url: "https://pub.dev" + source: hosted + version: "8.0.0+1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "2ad726953f6e8affbc4df8dc78b77c3b4a060967a291e528ef72ae846c60fb69" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + firebase_core: + dependency: transitive + description: + name: firebase_core + sha256: "53316975310c8af75a96e365f9fccb67d1c544ef0acdbf0d88bbe30eedd1c4f9" + url: "https://pub.dev" + source: hosted + version: "2.27.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf + url: "https://pub.dev" + source: hosted + version: "5.4.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492 + url: "https://pub.dev" + source: hosted + version: "2.11.5" + firebase_crashlytics: + dependency: transitive + description: + name: firebase_crashlytics + sha256: c4f1b723d417bc9c4774810e774ff91df8fb0032d33fb2888b2c887e865581b8 + url: "https://pub.dev" + source: hosted + version: "3.4.18" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + sha256: c5a11fca3df76a98e3fa68fde8b10a08aacb9a7639f619fbfd4dad6c67a08643 + url: "https://pub.dev" + source: hosted + version: "3.6.25" fixnum: dependency: transitive description: @@ -436,6 +602,30 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.6" + flutter_dropzone: + dependency: transitive + description: + name: flutter_dropzone + sha256: b399c60411f9bf9c4c2f97933c6a3a185859e75aade8897831e76cee4346c8e1 + url: "https://pub.dev" + source: hosted + version: "3.0.7" + flutter_dropzone_platform_interface: + dependency: transitive + description: + name: flutter_dropzone_platform_interface + sha256: "96d2c51c86063ba150551c3b40fd26c5a18785bee071c0c751502d28a545df3b" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter_dropzone_web: + dependency: transitive + description: + name: flutter_dropzone_web + sha256: c5a0fdb63b7216352a01761ec1b6eba1982e49541e60675735e2d3d95e207b19 + url: "https://pub.dev" + source: hosted + version: "3.0.13" flutter_focus_watcher: dependency: transitive description: @@ -500,6 +690,19 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" + url: "https://pub.dev" + source: hosted + version: "2.0.19" flutter_spinkit: dependency: transitive description: @@ -508,14 +711,22 @@ packages: url: "https://pub.dev" source: hosted version: "5.2.1" + flutter_styled_toast: + dependency: transitive + description: + name: flutter_styled_toast + sha256: e667f13a665820eb0fa8506547e47eacbcddf1948d6d3036cfd3b089bd4b0516 + url: "https://pub.dev" + source: hosted + version: "2.2.1" flutter_svg: dependency: "direct main" description: name: flutter_svg - sha256: d39e7f95621fc84376bc0f7d504f05c3a41488c562f4a8ad410569127507402c + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" url: "https://pub.dev" source: hosted - version: "2.0.9" + version: "2.0.10+1" flutter_test: dependency: "direct dev" description: flutter @@ -566,6 +777,54 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + geolocator: + dependency: transitive + description: + name: geolocator + sha256: f4efb8d3c4cdcad2e226af9661eb1a0dd38c71a9494b22526f9da80ab79520e5 + url: "https://pub.dev" + source: hosted + version: "10.1.1" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807" + url: "https://pub.dev" + source: hosted + version: "2.3.8+1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" glob: dependency: transitive description: @@ -578,10 +837,10 @@ packages: dependency: transitive description: name: google_fonts - sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" url: "https://pub.dev" source: hosted - version: "4.0.4" + version: "4.0.5" graphs: dependency: transitive description: @@ -598,14 +857,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.3.1" + html: + dependency: transitive + description: + name: html + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + url: "https://pub.dev" + source: hosted + version: "0.15.5" http: dependency: transitive description: name: http - sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba url: "https://pub.dev" source: hosted - version: "0.13.6" + version: "1.2.0" http_multi_server: dependency: transitive description: @@ -622,6 +889,70 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image_picker: + dependency: transitive + description: + name: image_picker + sha256: "1f498d086203360cca099d20ffea2963f48c39ce91bdd8a3b6d4a045786b02c8" + url: "https://pub.dev" + source: hosted + version: "1.0.8" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "844c6da4e4f2829dffdab97816bca09d0e0977e8dcef7450864aba4e07967a58" + url: "https://pub.dev" + source: hosted + version: "0.8.9+6" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + url: "https://pub.dev" + source: hosted + version: "0.8.9+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + url: "https://pub.dev" + source: hosted + version: "2.9.3" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" intl: dependency: "direct main" description: @@ -838,6 +1169,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" path_parsing: dependency: transitive description: @@ -1187,6 +1526,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_html: + dependency: transitive + description: + name: universal_html + sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + url: "https://pub.dev" + source: hosted + version: "2.2.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + url: "https://pub.dev" + source: hosted + version: "3.1.2" uuid: dependency: transitive description: @@ -1199,26 +1618,26 @@ packages: dependency: transitive description: name: vector_graphics - sha256: "4ac59808bbfca6da38c99f415ff2d3a5d7ca0a6b4809c71d9cf30fba5daf9752" + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" url: "https://pub.dev" source: hosted - version: "1.1.10+1" + version: "1.1.11+1" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: f3247e7ab0ec77dc759263e68394990edc608fb2b480b80db8aa86ed09279e33 + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da url: "https://pub.dev" source: hosted - version: "1.1.10+1" + version: "1.1.11+1" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "18489bdd8850de3dd7ca8a34e0c446f719ec63e2bab2e7a8cc66a9028dd76c5a" + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" url: "https://pub.dev" source: hosted - version: "1.1.10+1" + version: "1.1.11+1" vector_math: dependency: transitive description: @@ -1227,6 +1646,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" vm_service: dependency: transitive description: diff --git a/packages/digit_firebase_services/pubspec.lock b/packages/digit_firebase_services/pubspec.lock index bf1e0562eb..cea3a2c324 100644 --- a/packages/digit_firebase_services/pubspec.lock +++ b/packages/digit_firebase_services/pubspec.lock @@ -1,14 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 - url: "https://pub.dev" - source: hosted - version: "64.0.0" _flutterfire_internals: dependency: transitive description: @@ -17,30 +9,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.25" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" - url: "https://pub.dev" - source: hosted - version: "6.2.0" - ansicolor: - dependency: transitive - description: - name: ansicolor - sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" - url: "https://pub.dev" - source: hosted - version: "2.0.3" - args: - dependency: transitive - description: - name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" - source: hosted - version: "2.5.0" async: dependency: transitive description: @@ -49,14 +17,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" - bloc: - dependency: transitive - description: - name: bloc - sha256: "106842ad6569f0b60297619e9e0b1885c2fb9bf84812935490e6c5275777804e" - url: "https://pub.dev" - source: hosted - version: "8.1.4" boolean_selector: dependency: transitive description: @@ -65,14 +25,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - build: - dependency: transitive - description: - name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" - url: "https://pub.dev" - source: hosted - version: "2.4.1" characters: dependency: transitive description: @@ -97,92 +49,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - dart_mappable: - dependency: transitive - description: - name: dart_mappable - sha256: f69a961ae8589724ebb542e588f228ae844c5f78028899cbe2cc718977c1b382 - url: "https://pub.dev" - source: hosted - version: "4.3.0" - dart_mappable_builder: - dependency: "direct overridden" - description: - path: "../dart_mappable_builder" - relative: true - source: path - version: "4.2.0" - dart_style: - dependency: transitive - description: - name: dart_style - sha256: "99e066ce75c89d6b29903d788a7bb9369cf754f7b24bf70bf4b6d6d6b26853b9" - url: "https://pub.dev" - source: hosted - version: "2.3.6" - db_viewer: - dependency: transitive - description: - name: db_viewer - sha256: "5f7e3cfcde9663321797d8f6f0c876f7c13f0825a2e77ec1ef065656797144d9" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - digit_data_model: - dependency: "direct overridden" - description: - path: "../digit_data_model" - relative: true - source: path - version: "1.0.4" - dio: - dependency: transitive - description: - name: dio - sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" - url: "https://pub.dev" - source: hosted - version: "5.7.0" - dio_web_adapter: - dependency: transitive - description: - name: dio_web_adapter - sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac" - url: "https://pub.dev" - source: hosted - version: "1.0.1" - drift: - dependency: transitive - description: - name: drift - sha256: b50a8342c6ddf05be53bda1d246404cbad101b64dc73e8d6d1ac1090d119b4e2 - url: "https://pub.dev" - source: hosted - version: "2.15.0" - drift_db_viewer: - dependency: transitive - description: - name: drift_db_viewer - sha256: "5ea77858c52b55460a1e8f34ab5f88324621d486717d876fd745765fbc227f3f" - url: "https://pub.dev" - source: hosted - version: "2.1.0" fake_async: dependency: transitive description: @@ -191,22 +57,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" - ffi: - dependency: transitive - description: - name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - file: - dependency: transitive - description: - name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 - url: "https://pub.dev" - source: hosted - version: "7.0.1" firebase_core: dependency: "direct main" description: @@ -252,14 +102,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_bloc: - dependency: transitive - description: - name: flutter_bloc - sha256: b594505eac31a0518bdcb4b5b79573b8d9117b193cc80cc12e17d639b10aa27a - url: "https://pub.dev" - source: hosted - version: "8.1.6" flutter_lints: dependency: "direct dev" description: @@ -278,46 +120,6 @@ packages: description: flutter source: sdk version: "0.0.0" - freezed_annotation: - dependency: transitive - description: - name: freezed_annotation - sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2 - url: "https://pub.dev" - source: hosted - version: "2.4.4" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - isar: - dependency: transitive - description: - name: isar - sha256: "99165dadb2cf2329d3140198363a7e7bff9bbd441871898a87e26914d25cf1ea" - url: "https://pub.dev" - source: hosted - version: "3.1.0+1" - isar_flutter_libs: - dependency: transitive - description: - name: isar_flutter_libs - sha256: bc6768cc4b9c61aabff77152e7f33b4b17d2fc93134f7af1c3dd51500fe8d5e8 - url: "https://pub.dev" - source: hosted - version: "3.1.0+1" js: dependency: transitive description: @@ -326,14 +128,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" - source: hosted - version: "4.9.0" lints: dependency: transitive description: @@ -342,14 +136,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" matcher: dependency: transitive description: @@ -374,30 +160,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" - mocktail: - dependency: transitive - description: - name: mocktail - sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" path: dependency: transitive description: @@ -406,62 +168,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" - path_provider: - dependency: transitive - description: - name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 - url: "https://pub.dev" - source: hosted - version: "2.1.4" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d - url: "https://pub.dev" - source: hosted - version: "2.2.4" - path_provider_foundation: - dependency: transitive - description: - name: path_provider_foundation - sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 - url: "https://pub.dev" - source: hosted - version: "2.2.1" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 - url: "https://pub.dev" - source: hosted - version: "2.3.0" - platform: - dependency: transitive - description: - name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" - url: "https://pub.dev" - source: hosted - version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -470,43 +176,11 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - provider: - dependency: transitive - description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c - url: "https://pub.dev" - source: hosted - version: "6.1.2" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_gen: - dependency: transitive - description: - name: source_gen - sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" - url: "https://pub.dev" - source: hosted - version: "1.5.0" source_span: dependency: transitive description: @@ -515,22 +189,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" - sqlite3: - dependency: transitive - description: - name: sqlite3 - sha256: "072128763f1547e3e9b4735ce846bfd226d68019ccda54db4cd427b12dfdedc9" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - sqlite3_flutter_libs: - dependency: transitive - description: - name: sqlite3_flutter_libs - sha256: "7ae52b23366e5295005022e62fa093f64bfe190810223ea0ebf733a4cd140bce" - url: "https://pub.dev" - source: hosted - version: "0.5.26" stack_trace: dependency: transitive description: @@ -571,30 +229,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.1" - type_plus: - dependency: transitive - description: - name: type_plus - sha256: d5d1019471f0d38b91603adb9b5fd4ce7ab903c879d2fbf1a3f80a630a03fcc9 - url: "https://pub.dev" - source: hosted - version: "2.1.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - uuid: - dependency: transitive - description: - name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" - url: "https://pub.dev" - source: hosted - version: "3.0.7" vector_math: dependency: transitive description: @@ -603,14 +237,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" web: dependency: transitive description: @@ -619,22 +245,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d - url: "https://pub.dev" - source: hosted - version: "1.0.4" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" sdks: dart: ">=3.2.0 <4.0.0" - flutter: ">=3.16.0" + flutter: ">=3.3.0" diff --git a/packages/digit_location_tracker/pubspec.lock b/packages/digit_location_tracker/pubspec.lock index ddd73fe05c..681e60acf6 100644 --- a/packages/digit_location_tracker/pubspec.lock +++ b/packages/digit_location_tracker/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "64.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "4eec93681221723a686ad580c2e7d960e1017cf1a4e0a263c2573c2c6b0bf5cd" + url: "https://pub.dev" + source: hosted + version: "1.3.25" analyzer: dependency: transitive description: @@ -25,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" args: dependency: transitive description: @@ -65,6 +81,102 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: transitive + description: + name: build_runner + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" + url: "https://pub.dev" + source: hosted + version: "2.4.9" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" + source: hosted + version: "7.3.0" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" + url: "https://pub.dev" + source: hosted + version: "8.9.3" + camera: + dependency: transitive + description: + name: camera + sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" + url: "https://pub.dev" + source: hosted + version: "0.10.5+9" + camera_android: + dependency: transitive + description: + name: camera_android + sha256: b350ac087f111467e705b2b76cc1322f7f5bdc122aa83b4b243b0872f390d229 + url: "https://pub.dev" + source: hosted + version: "0.10.9+2" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: "608b56b0880722f703871329c4d7d4c2f379c8e2936940851df7fc041abc6f51" + url: "https://pub.dev" + source: hosted + version: "0.9.13+10" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061 + url: "https://pub.dev" + source: hosted + version: "2.8.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: b9235ec0a2ce949daec546f1f3d86f05c3921ed31c7d9ab6b7c03214d152fc2d + url: "https://pub.dev" + source: hosted + version: "0.3.4" characters: dependency: transitive description: @@ -73,6 +185,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" clock: dependency: transitive description: @@ -81,6 +209,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" collection: dependency: transitive description: @@ -97,6 +233,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + url: "https://pub.dev" + source: hosted + version: "0.3.3+8" crypto: dependency: transitive description: @@ -105,6 +249,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" dart_mappable: dependency: transitive description: @@ -142,7 +294,22 @@ packages: path: "../digit_data_model" relative: true source: path - version: "1.0.4" + version: "1.0.5-dev.1" + digit_firebase_services: + dependency: "direct overridden" + description: + path: "../digit_firebase_services" + relative: true + source: path + version: "0.0.1" + digit_ui_components: + dependency: transitive + description: + name: digit_ui_components + sha256: e38f163515aa6a6c5283754e741b21f33fb3a6c0a1fc171a1e4e6620510d46ae + url: "https://pub.dev" + source: hosted + version: "0.0.1+7" dio: dependency: transitive description: @@ -159,6 +326,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" + dotted_border: + dependency: transitive + description: + name: dotted_border + sha256: "108837e11848ca776c53b30bc870086f84b62ed6e01c503ed976e8f8c7df9c04" + url: "https://pub.dev" + source: hosted + version: "2.1.0" drift: dependency: transitive description: @@ -199,6 +374,94 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.1" + file_picker: + dependency: transitive + description: + name: file_picker + sha256: d1d0ac3966b36dc3e66eeefb40280c17feb87fa2099c6e22e6a1fc959327bd03 + url: "https://pub.dev" + source: hosted + version: "8.0.0+1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + url: "https://pub.dev" + source: hosted + version: "0.9.2+1" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + url: "https://pub.dev" + source: hosted + version: "0.9.4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "2ad726953f6e8affbc4df8dc78b77c3b4a060967a291e528ef72ae846c60fb69" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + firebase_core: + dependency: transitive + description: + name: firebase_core + sha256: "53316975310c8af75a96e365f9fccb67d1c544ef0acdbf0d88bbe30eedd1c4f9" + url: "https://pub.dev" + source: hosted + version: "2.27.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf + url: "https://pub.dev" + source: hosted + version: "5.4.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: c8e1d59385eee98de63c92f961d2a7062c5d9a65e7f45bdc7f1b0b205aab2492 + url: "https://pub.dev" + source: hosted + version: "2.11.5" + firebase_crashlytics: + dependency: transitive + description: + name: firebase_crashlytics + sha256: c4f1b723d417bc9c4774810e774ff91df8fb0032d33fb2888b2c887e865581b8 + url: "https://pub.dev" + source: hosted + version: "3.4.18" + firebase_crashlytics_platform_interface: + dependency: transitive + description: + name: firebase_crashlytics_platform_interface + sha256: c5a11fca3df76a98e3fa68fde8b10a08aacb9a7639f619fbfd4dad6c67a08643 + url: "https://pub.dev" + source: hosted + version: "3.6.25" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -244,6 +507,78 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.6" + flutter_dropzone: + dependency: transitive + description: + name: flutter_dropzone + sha256: b399c60411f9bf9c4c2f97933c6a3a185859e75aade8897831e76cee4346c8e1 + url: "https://pub.dev" + source: hosted + version: "3.0.7" + flutter_dropzone_platform_interface: + dependency: transitive + description: + name: flutter_dropzone_platform_interface + sha256: "96d2c51c86063ba150551c3b40fd26c5a18785bee071c0c751502d28a545df3b" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter_dropzone_web: + dependency: transitive + description: + name: flutter_dropzone_web + sha256: c5a0fdb63b7216352a01761ec1b6eba1982e49541e60675735e2d3d95e207b19 + url: "https://pub.dev" + source: hosted + version: "3.0.13" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -252,16 +587,69 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" + url: "https://pub.dev" + source: hosted + version: "2.0.19" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: d2696eed13732831414595b98863260e33e8882fc069ee80ec35d4ac9ddb0472 + url: "https://pub.dev" + source: hosted + version: "5.2.1" + flutter_styled_toast: + dependency: transitive + description: + name: flutter_styled_toast + sha256: e667f13a665820eb0fa8506547e47eacbcddf1948d6d3036cfd3b089bd4b0516 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + url: "https://pub.dev" + source: hosted + version: "2.0.10+1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_typeahead: + dependency: transitive + description: + name: flutter_typeahead + sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 + url: "https://pub.dev" + source: hosted + version: "4.8.0" flutter_web_plugins: dependency: transitive description: flutter source: sdk version: "0.0.0" + fluttertoast: + dependency: transitive + description: + name: fluttertoast + sha256: "81b68579e23fcbcada2db3d50302813d2371664afe6165bc78148050ab94bf66" + url: "https://pub.dev" + source: hosted + version: "8.2.5" freezed_annotation: dependency: "direct main" description: @@ -270,6 +658,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + geolocator: + dependency: transitive + description: + name: geolocator + sha256: f4efb8d3c4cdcad2e226af9661eb1a0dd38c71a9494b22526f9da80ab79520e5 + url: "https://pub.dev" + source: hosted + version: "10.1.1" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807" + url: "https://pub.dev" + source: hosted + version: "2.3.8+1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" glob: dependency: transitive description: @@ -278,6 +722,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: "2776c66b3e97c6cdd58d1bd3281548b074b64f1fd5c8f82391f7456e38849567" + url: "https://pub.dev" + source: hosted + version: "4.0.5" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + horizontal_data_table: + dependency: transitive + description: + name: horizontal_data_table + sha256: c8ab5256bbced698a729f3e0ff2cb0e8e97416cdbb082860370eaf883badf722 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + html: + dependency: transitive + description: + name: html + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + url: "https://pub.dev" + source: hosted + version: "0.15.5" + http: + dependency: transitive + description: + name: http + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" + source: hosted + version: "1.2.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" http_parser: dependency: transitive description: @@ -286,6 +778,86 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image_picker: + dependency: transitive + description: + name: image_picker + sha256: "1f498d086203360cca099d20ffea2963f48c39ce91bdd8a3b6d4a045786b02c8" + url: "https://pub.dev" + source: hosted + version: "1.0.8" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "844c6da4e4f2829dffdab97816bca09d0e0977e8dcef7450864aba4e07967a58" + url: "https://pub.dev" + source: hosted + version: "0.8.9+6" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + url: "https://pub.dev" + source: hosted + version: "0.8.9+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + url: "https://pub.dev" + source: hosted + version: "2.9.3" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + intl: + dependency: transitive + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" isar: dependency: "direct main" description: @@ -358,6 +930,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: a93542cc2d60a7057255405f62252533f8e8956e7e06754955669fd32fb4b216 + url: "https://pub.dev" + source: hosted + version: "2.7.0" matcher: dependency: transitive description: @@ -382,6 +962,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + mime: + dependency: transitive + description: + name: mime + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + url: "https://pub.dev" + source: hosted + version: "1.0.6" mocktail: dependency: transitive description: @@ -398,6 +986,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + overlay_builder: + dependency: transitive + description: + name: overlay_builder + sha256: "58b97bc5f67a2e2bb7006dd88e697ac757dfffc9dbd1e7dfc1917fb510a4b5c8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" package_config: dependency: transitive description: @@ -414,6 +1010,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + url: "https://pub.dev" + source: hosted + version: "1.0.1" path_provider: dependency: "direct main" description: @@ -510,6 +1122,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" platform: dependency: transitive description: @@ -526,6 +1146,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" provider: dependency: transitive description: @@ -542,6 +1178,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + reactive_flutter_typeahead: + dependency: transitive + description: + name: reactive_flutter_typeahead + sha256: ef91627df8cef70e603e8a6458749d8a99a385b78854332602fd08ad905cdab8 + url: "https://pub.dev" + source: hosted + version: "0.8.1" + reactive_forms: + dependency: transitive + description: + name: reactive_forms + sha256: "5aa9c48a0626c20d00a005e597cb10efbdebbfeecb9c4227b03a5945fbb91ec4" + url: "https://pub.dev" + source: hosted + version: "14.3.0" recase: dependency: transitive description: @@ -550,6 +1210,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + shelf: + dependency: transitive + description: + name: shelf + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" + source: hosted + version: "1.4.1" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" + source: hosted + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -603,6 +1279,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" string_scanner: dependency: transitive description: @@ -627,6 +1311,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.1" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" type_plus: dependency: transitive description: @@ -643,6 +1335,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_html: + dependency: transitive + description: + name: universal_html + sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + url: "https://pub.dev" + source: hosted + version: "6.2.4" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" + source: hosted + version: "3.1.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + url: "https://pub.dev" + source: hosted + version: "2.2.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" + url: "https://pub.dev" + source: hosted + version: "3.1.2" uuid: dependency: transitive description: @@ -651,6 +1423,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.7" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + url: "https://pub.dev" + source: hosted + version: "1.1.11+1" vector_math: dependency: transitive description: @@ -659,6 +1455,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" watcher: dependency: transitive description: @@ -675,6 +1479,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" + source: hosted + version: "5.2.0" xdg_directories: dependency: transitive description: @@ -683,6 +1503,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" yaml: dependency: transitive description: @@ -692,5 +1520,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.2.0 <=3.9.0" flutter: ">=3.16.0" diff --git a/packages/forms_engine/pubspec.lock b/packages/forms_engine/pubspec.lock index 1fbd7a910f..02ab6b24de 100644 --- a/packages/forms_engine/pubspec.lock +++ b/packages/forms_engine/pubspec.lock @@ -228,11 +228,10 @@ packages: digit_components: dependency: "direct main" description: - name: digit_components - sha256: "8e5d120f2c16c0d8ffaf4d0de1218da5e492061d6bb9245214589fb1ea5ec09e" - url: "https://pub.dev" - source: hosted - version: "0.0.3+16" + path: "../digit_components" + relative: true + source: path + version: "1.0.2+1" easy_stepper: dependency: transitive description: @@ -1014,5 +1013,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <3.9.0" + dart: ">=3.2.0 <4.0.0" flutter: ">=3.16.0" diff --git a/packages/inventory_management/pubspec.lock b/packages/inventory_management/pubspec.lock index 1bb76bac87..f466306d20 100644 --- a/packages/inventory_management/pubspec.lock +++ b/packages/inventory_management/pubspec.lock @@ -413,10 +413,9 @@ packages: digit_scanner: dependency: "direct main" description: - name: digit_scanner - sha256: "9862c4885465bb1942e36dc9b42596c201648db9b0f5ffb8ad768e2409fc2742" - url: "https://pub.dev" - source: hosted + path: "../digit_scanner" + relative: true + source: path version: "1.0.3+1" dio: dependency: transitive diff --git a/packages/referral_reconciliation/pubspec.lock b/packages/referral_reconciliation/pubspec.lock index 61b85de941..880efe553b 100644 --- a/packages/referral_reconciliation/pubspec.lock +++ b/packages/referral_reconciliation/pubspec.lock @@ -421,10 +421,9 @@ packages: digit_scanner: dependency: "direct main" description: - name: digit_scanner - sha256: "9862c4885465bb1942e36dc9b42596c201648db9b0f5ffb8ad768e2409fc2742" - url: "https://pub.dev" - source: hosted + path: "../digit_scanner" + relative: true + source: path version: "1.0.3+1" digit_ui_components: dependency: "direct main" @@ -1462,10 +1461,9 @@ packages: survey_form: dependency: "direct main" description: - name: survey_form - sha256: "52532fb3fae06883828d22f870045587bf7122f67cb4de236c82ad4d6de1d7d7" - url: "https://pub.dev" - source: hosted + path: "../survey_form" + relative: true + source: path version: "0.0.1-dev.2" synchronized: dependency: transitive diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index ba3b22b759..32f3666c23 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -16,8 +16,8 @@ import 'package:digit_ui_components/widgets/molecules/digit_card.dart'; import 'package:digit_ui_components/widgets/molecules/show_pop_up.dart'; import 'package:digit_ui_components/widgets/scrollable_content.dart'; import 'package:flutter/material.dart'; -import 'package:survey_form/survey_form.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:survey_form/survey_form.dart'; import '../../blocs/beneficiary_registration/beneficiary_registration.dart'; import '../../blocs/delivery_intervention/deliver_intervention.dart'; @@ -554,12 +554,7 @@ class _HouseholdOverviewPageState ), Column( children: [ - RegistrationDeliverySingleton() - .searchHouseHoldFilter != - null && - RegistrationDeliverySingleton() - .searchHouseHoldFilter! - .isNotEmpty + getFilters() ? Align( alignment: Alignment.topLeft, @@ -1096,4 +1091,46 @@ class _HouseholdOverviewPageState callReloadEvent(offset: 0, limit: 10); } } + + String getStatus(String selectedFilter) { + final statusMap = { + Status.delivered.toValue(): Status.delivered, + Status.notAdministered.toValue(): Status.notAdministered, + Status.visited.toValue(): Status.visited, + Status.notVisited.toValue(): Status.notVisited, + Status.beneficiaryRefused.toValue(): Status.beneficiaryRefused, + Status.beneficiaryReferred.toValue(): Status.beneficiaryReferred, + Status.administeredSuccess.toValue(): Status.administeredSuccess, + Status.administeredFailed.toValue(): Status.administeredFailed, + Status.inComplete.toValue(): Status.inComplete, + Status.toAdminister.toValue(): Status.toAdminister, + Status.closeHousehold.toValue(): Status.closeHousehold, + Status.registered.toValue(): Status.registered, + Status.notRegistered.toValue(): Status.notRegistered, + }; + + var mappedStatus = statusMap.entries + .where((element) => element.value.name == selectedFilter) + .first + .key; + if (mappedStatus != null) { + return mappedStatus; + } else { + return selectedFilter; + } + } + + getFilters() { + bool hasFilters; + if (RegistrationDeliverySingleton().householdType == + HouseholdType.community) { + hasFilters = RegistrationDeliverySingleton().searchCLFFilters != null && + RegistrationDeliverySingleton().searchCLFFilters!.isNotEmpty; + } else { + hasFilters = + RegistrationDeliverySingleton().searchHouseHoldFilter != null && + RegistrationDeliverySingleton().searchHouseHoldFilter!.isNotEmpty; + } + return hasFilters; + } } diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index faff9eb457..07abc78d05 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -332,7 +332,7 @@ class RegistrationDeliverySingleton { List? _householdMemberDeletionReasonOptions; List? _deliveryCommentOptions; List? _symptomsTypes; - List? _searchHouseHoldFilter; + List? _searchHouseHoldFilter, _searchCLFFilters; List? _referralReasons; List? _houseStructureTypes; List? _refusalReasons; @@ -361,6 +361,7 @@ class RegistrationDeliverySingleton { required List? deliveryCommentOptions, required List? symptomsTypes, required List? searchHouseHoldFilter, + searchCLFFilters, required List? referralReasons, required List? houseStructureTypes, required List? refusalReasons, @@ -380,6 +381,7 @@ class RegistrationDeliverySingleton { _deliveryCommentOptions = deliveryCommentOptions; _symptomsTypes = symptomsTypes; _searchHouseHoldFilter = searchHouseHoldFilter; + _searchCLFFilters = searchCLFFilters; _referralReasons = referralReasons; _houseStructureTypes = houseStructureTypes; _refusalReasons = refusalReasons; @@ -395,28 +397,50 @@ class RegistrationDeliverySingleton { } String? get tenantId => _tenantId; + String? get loggedInUserUuid => _loggedInUserUuid; + double? get maxRadius => _maxRadius; + String? get projectId => _projectId; + BeneficiaryType? get beneficiaryType => _beneficiaryType; + ProjectTypeModel? get projectType => _projectType; + ProjectModel? get selectedProject => _selectedProject; + BoundaryModel? get boundary => _boundaryModel; + PersistenceConfiguration? get persistenceConfiguration => _persistenceConfiguration; + List? get genderOptions => _genderOptions; + List? get idTypeOptions => _idTypeOptions; + List? get householdDeletionReasonOptions => _householdDeletionReasonOptions; + List? get householdMemberDeletionReasonOptions => _householdMemberDeletionReasonOptions; + List? get deliveryCommentOptions => _deliveryCommentOptions; + List? get symptomsTypes => _symptomsTypes; + List? get searchHouseHoldFilter => _searchHouseHoldFilter; + + List? get searchCLFFilters => _searchCLFFilters; + List? get referralReasons => _referralReasons; + List? get houseStructureTypes => _houseStructureTypes; + List? get refusalReasons => _refusalReasons; + UserModel? get loggedInUser => _loggedInUser; + HouseholdType? get householdType => _householdType; } diff --git a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart index 79258c5ff9..0643f763f9 100644 --- a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart +++ b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart @@ -311,7 +311,9 @@ class ViewBeneficiaryCardState extends LocalizedState { ? '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}\n${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' : '${householdMember.members?.length ?? 1} ${householdMember.members?.length == 1 ? localizations.translate(i18.beneficiaryDetails.householdMemberSingular) : localizations.translate(i18.beneficiaryDetails.householdMemberPlural)}' : (widget.distance != null) - ? '${((widget.distance!) * 1000).round() > 999 ? '(${((widget.distance!).round())} km)' : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}'}' + ? ((widget.distance!) * 1000).round() > 999 + ? '(${((widget.distance!).round())} km)' + : '(${((widget.distance!) * 1000).round()} mts) ${localizations.translate(i18.beneficiaryDetails.fromCurrentLocation)}' : null, status: (RegistrationDeliverySingleton().householdType == HouseholdType.community) diff --git a/packages/registration_delivery/lib/widgets/status_filter/status_filter.dart b/packages/registration_delivery/lib/widgets/status_filter/status_filter.dart index 870639f6ec..a61fc17c51 100644 --- a/packages/registration_delivery/lib/widgets/status_filter/status_filter.dart +++ b/packages/registration_delivery/lib/widgets/status_filter/status_filter.dart @@ -1,9 +1,9 @@ +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_scanner/widgets/localized.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/widgets/atoms/selection_card.dart'; import 'package:flutter/material.dart'; import 'package:registration_delivery/registration_delivery.dart'; -import '../../utils/i18_key_constants.dart' as i18; import '../../models/entities/status.dart'; import '../../utils/i18_key_constants.dart' as i18; @@ -176,9 +176,10 @@ class StatusFilterState extends LocalizedState { getFilters() { var finalStatues = []; - finalStatues.addAll((RegistrationDeliverySingleton() - .searchHouseHoldFilter ?? - []) + finalStatues.addAll((RegistrationDeliverySingleton().householdType == + HouseholdType.community + ? RegistrationDeliverySingleton().searchCLFFilters ?? [] + : RegistrationDeliverySingleton().searchHouseHoldFilter ?? []) .map((e) => Status.values.where((element) => element.toValue() == e)) .expand((element) => element) .toList()); diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index 589a63578e..8d83531167 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -420,10 +420,9 @@ packages: digit_scanner: dependency: "direct main" description: - name: digit_scanner - sha256: "9862c4885465bb1942e36dc9b42596c201648db9b0f5ffb8ad768e2409fc2742" - url: "https://pub.dev" - source: hosted + path: "../digit_scanner" + relative: true + source: path version: "1.0.3+1" digit_showcase: dependency: "direct main" From 4ec0b1f1d356bbfebd960c1970693d0a5692dc7f Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 10:48:49 +0530 Subject: [PATCH 21/47] revert search based on household --- .../lib/pages/search_beneficiary.dart | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 30b3cfe99f..db0c950caf 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -512,33 +512,7 @@ class _SearchBeneficiaryPageState blocWrapper.clearEvent(); } - if (RegistrationDeliverySingleton().householdType == - HouseholdType.community) { - if (isProximityEnabled || - selectedFilters.isNotEmpty || - searchController.text.isNotEmpty) { - blocWrapper.houseHoldGlobalSearchBloc - .add(SearchHouseholdsEvent.houseHoldGlobalSearch( - globalSearchParams: GlobalSearchParameters( - isProximityEnabled: isProximityEnabled, - latitude: lat, - longitude: long, - projectId: RegistrationDeliverySingleton().projectId!, - maxRadius: RegistrationDeliverySingleton().maxRadius, - nameSearch: searchController.text.trim().length > 2 - ? searchController.text.trim() - : blocWrapper.searchHouseholdsBloc.state.searchQuery, - filter: selectedFilters, - offset: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.offset - : offset, - limit: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.limit - : limit, - householdType: RegistrationDeliverySingleton().householdType, - ))); - } - } else if (RegistrationDeliverySingleton().beneficiaryType == + if (RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.individual) { if (isProximityEnabled || selectedFilters.isNotEmpty || From 9ef6443d46d0e07a82a7374d0d2f2f28cd8a2f74 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 10:52:30 +0530 Subject: [PATCH 22/47] Revert "revert search based on household" This reverts commit 4ec0b1f1d356bbfebd960c1970693d0a5692dc7f. --- .../lib/pages/search_beneficiary.dart | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index db0c950caf..30b3cfe99f 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -512,7 +512,33 @@ class _SearchBeneficiaryPageState blocWrapper.clearEvent(); } - if (RegistrationDeliverySingleton().beneficiaryType == + if (RegistrationDeliverySingleton().householdType == + HouseholdType.community) { + if (isProximityEnabled || + selectedFilters.isNotEmpty || + searchController.text.isNotEmpty) { + blocWrapper.houseHoldGlobalSearchBloc + .add(SearchHouseholdsEvent.houseHoldGlobalSearch( + globalSearchParams: GlobalSearchParameters( + isProximityEnabled: isProximityEnabled, + latitude: lat, + longitude: long, + projectId: RegistrationDeliverySingleton().projectId!, + maxRadius: RegistrationDeliverySingleton().maxRadius, + nameSearch: searchController.text.trim().length > 2 + ? searchController.text.trim() + : blocWrapper.searchHouseholdsBloc.state.searchQuery, + filter: selectedFilters, + offset: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.offset + : offset, + limit: isPagination + ? blocWrapper.houseHoldGlobalSearchBloc.state.limit + : limit, + householdType: RegistrationDeliverySingleton().householdType, + ))); + } + } else if (RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.individual) { if (isProximityEnabled || selectedFilters.isNotEmpty || From ed4608a523d2c7f9a9b8dba96bfaab86952d230e Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 10:55:28 +0530 Subject: [PATCH 23/47] removed search based on household --- .../lib/pages/search_beneficiary.dart | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 30b3cfe99f..db0c950caf 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -512,33 +512,7 @@ class _SearchBeneficiaryPageState blocWrapper.clearEvent(); } - if (RegistrationDeliverySingleton().householdType == - HouseholdType.community) { - if (isProximityEnabled || - selectedFilters.isNotEmpty || - searchController.text.isNotEmpty) { - blocWrapper.houseHoldGlobalSearchBloc - .add(SearchHouseholdsEvent.houseHoldGlobalSearch( - globalSearchParams: GlobalSearchParameters( - isProximityEnabled: isProximityEnabled, - latitude: lat, - longitude: long, - projectId: RegistrationDeliverySingleton().projectId!, - maxRadius: RegistrationDeliverySingleton().maxRadius, - nameSearch: searchController.text.trim().length > 2 - ? searchController.text.trim() - : blocWrapper.searchHouseholdsBloc.state.searchQuery, - filter: selectedFilters, - offset: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.offset - : offset, - limit: isPagination - ? blocWrapper.houseHoldGlobalSearchBloc.state.limit - : limit, - householdType: RegistrationDeliverySingleton().householdType, - ))); - } - } else if (RegistrationDeliverySingleton().beneficiaryType == + if (RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.individual) { if (isProximityEnabled || selectedFilters.isNotEmpty || From f51cf7ec4186cec620103989578cad5d2b1b748d Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 14:32:04 +0530 Subject: [PATCH 24/47] added search clf in app configuration --- .../no_sql/schema/app_configuration.dart | 5 +- .../models/app_config/app_config_model.dart | 2 + .../app_config/app_config_model.freezed.dart | 85 +++++++++++---- .../models/app_config/app_config_model.g.dart | 4 + .../lib/models/downsync/downsync.mapper.dart | 7 ++ .../lib/pages/home.dart | 3 + .../data/local_store/sql_store/sql_store.dart | 100 ++++++++++++++---- 7 files changed, 162 insertions(+), 44 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart index ff59f20778..9309603a2c 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart @@ -1,6 +1,7 @@ import 'package:digit_dss/digit_dss.dart'; import 'package:isar/isar.dart'; +import '../../../../models/app_config/app_config_model.dart'; import '../../../../models/privacy_notice/privacy_notice_model.dart'; part 'app_configuration.g.dart'; @@ -78,6 +79,9 @@ class AppConfiguration { @Name('SEARCH_HOUSEHOLD_FILTERS') late List? searchHouseHoldFilters; + @Name('SEARCH_CLF_FILTERS') + late List? searchCLFFilters; + late List? referralReasons; late List? houseStructureTypes; late List? refusalReasons; @@ -257,4 +261,3 @@ class SubDescription { late bool? isBold; late bool? isSpaceRequired; } - diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart index 61275e5e68..b2580d3a84 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.dart @@ -90,6 +90,8 @@ class HCMWrapperModel with _$HCMWrapperModel { @JsonKey(name: 'SYMPTOM_TYPES') List? symptomsTypeList, @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') List? searchHouseHoldFilters, + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? searchCLFFilters, @JsonKey(name: 'REFERRAL_REASONS') List? referralReasonList, @JsonKey(name: 'HOUSE_STRUCTURE_TYPES') diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart index 8f636d2cfc..a94250be81 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.freezed.dart @@ -955,6 +955,9 @@ mixin _$HCMWrapperModel { @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') List? get searchHouseHoldFilters => throw _privateConstructorUsedError; + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? get searchCLFFilters => + throw _privateConstructorUsedError; @JsonKey(name: 'REFERRAL_REASONS') List? get referralReasonList => throw _privateConstructorUsedError; @@ -1004,6 +1007,8 @@ abstract class $HCMWrapperModelCopyWith<$Res> { @JsonKey(name: 'SYMPTOM_TYPES') List? symptomsTypeList, @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') List? searchHouseHoldFilters, + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? searchCLFFilters, @JsonKey(name: 'REFERRAL_REASONS') List? referralReasonList, @JsonKey(name: 'HOUSE_STRUCTURE_TYPES') @@ -1039,6 +1044,7 @@ class _$HCMWrapperModelCopyWithImpl<$Res, $Val extends HCMWrapperModel> Object? transportTypes = null, Object? symptomsTypeList = freezed, Object? searchHouseHoldFilters = freezed, + Object? searchCLFFilters = freezed, Object? referralReasonList = freezed, Object? houseStructureTypes = freezed, Object? refusalReasons = freezed, @@ -1102,6 +1108,10 @@ class _$HCMWrapperModelCopyWithImpl<$Res, $Val extends HCMWrapperModel> ? _value.searchHouseHoldFilters : searchHouseHoldFilters // ignore: cast_nullable_to_non_nullable as List?, + searchCLFFilters: freezed == searchCLFFilters + ? _value.searchCLFFilters + : searchCLFFilters // ignore: cast_nullable_to_non_nullable + as List?, referralReasonList: freezed == referralReasonList ? _value.referralReasonList : referralReasonList // ignore: cast_nullable_to_non_nullable @@ -1154,6 +1164,8 @@ abstract class _$$HCMWrapperModelImplCopyWith<$Res> @JsonKey(name: 'SYMPTOM_TYPES') List? symptomsTypeList, @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') List? searchHouseHoldFilters, + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? searchCLFFilters, @JsonKey(name: 'REFERRAL_REASONS') List? referralReasonList, @JsonKey(name: 'HOUSE_STRUCTURE_TYPES') @@ -1187,6 +1199,7 @@ class __$$HCMWrapperModelImplCopyWithImpl<$Res> Object? transportTypes = null, Object? symptomsTypeList = freezed, Object? searchHouseHoldFilters = freezed, + Object? searchCLFFilters = freezed, Object? referralReasonList = freezed, Object? houseStructureTypes = freezed, Object? refusalReasons = freezed, @@ -1250,6 +1263,10 @@ class __$$HCMWrapperModelImplCopyWithImpl<$Res> ? _value._searchHouseHoldFilters : searchHouseHoldFilters // ignore: cast_nullable_to_non_nullable as List?, + searchCLFFilters: freezed == searchCLFFilters + ? _value._searchCLFFilters + : searchCLFFilters // ignore: cast_nullable_to_non_nullable + as List?, referralReasonList: freezed == referralReasonList ? _value._referralReasonList : referralReasonList // ignore: cast_nullable_to_non_nullable @@ -1302,6 +1319,8 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { final List? symptomsTypeList, @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') final List? searchHouseHoldFilters, + @JsonKey(name: 'SEARCH_CLF_FILTERS') + final List? searchCLFFilters, @JsonKey(name: 'REFERRAL_REASONS') final List? referralReasonList, @JsonKey(name: 'HOUSE_STRUCTURE_TYPES') @@ -1325,6 +1344,7 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { _transportTypes = transportTypes, _symptomsTypeList = symptomsTypeList, _searchHouseHoldFilters = searchHouseHoldFilters, + _searchCLFFilters = searchCLFFilters, _referralReasonList = referralReasonList, _houseStructureTypes = houseStructureTypes, _refusalReasons = refusalReasons, @@ -1477,6 +1497,18 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { return EqualUnmodifiableListView(value); } + final List? _searchCLFFilters; + @override + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? get searchCLFFilters { + final value = _searchCLFFilters; + if (value == null) return null; + if (_searchCLFFilters is EqualUnmodifiableListView) + return _searchCLFFilters; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + final List? _referralReasonList; @override @JsonKey(name: 'REFERRAL_REASONS') @@ -1525,7 +1557,7 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { @override String toString() { - return 'HCMWrapperModel(appConfig: $appConfig, bandWidthBatchSize: $bandWidthBatchSize, downSyncBandWidthBatchSize: $downSyncBandWidthBatchSize, householdDeletionReasonOptions: $householdDeletionReasonOptions, householdMemberDeletionReasonOptions: $householdMemberDeletionReasonOptions, backgroundServiceConfig: $backgroundServiceConfig, checklistTypes: $checklistTypes, idTypeOptions: $idTypeOptions, deliveryCommentOptions: $deliveryCommentOptions, backendInterface: $backendInterface, callSupportOptions: $callSupportOptions, transportTypes: $transportTypes, symptomsTypeList: $symptomsTypeList, searchHouseHoldFilters: $searchHouseHoldFilters, referralReasonList: $referralReasonList, houseStructureTypes: $houseStructureTypes, refusalReasons: $refusalReasons, firebaseConfig: $firebaseConfig)'; + return 'HCMWrapperModel(appConfig: $appConfig, bandWidthBatchSize: $bandWidthBatchSize, downSyncBandWidthBatchSize: $downSyncBandWidthBatchSize, householdDeletionReasonOptions: $householdDeletionReasonOptions, householdMemberDeletionReasonOptions: $householdMemberDeletionReasonOptions, backgroundServiceConfig: $backgroundServiceConfig, checklistTypes: $checklistTypes, idTypeOptions: $idTypeOptions, deliveryCommentOptions: $deliveryCommentOptions, backendInterface: $backendInterface, callSupportOptions: $callSupportOptions, transportTypes: $transportTypes, symptomsTypeList: $symptomsTypeList, searchHouseHoldFilters: $searchHouseHoldFilters, searchCLFFilters: $searchCLFFilters, referralReasonList: $referralReasonList, houseStructureTypes: $houseStructureTypes, refusalReasons: $refusalReasons, firebaseConfig: $firebaseConfig)'; } @override @@ -1564,6 +1596,8 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { .equals(other._symptomsTypeList, _symptomsTypeList) && const DeepCollectionEquality().equals( other._searchHouseHoldFilters, _searchHouseHoldFilters) && + const DeepCollectionEquality() + .equals(other._searchCLFFilters, _searchCLFFilters) && const DeepCollectionEquality() .equals(other._referralReasonList, _referralReasonList) && const DeepCollectionEquality() @@ -1576,27 +1610,29 @@ class _$HCMWrapperModelImpl implements _HCMWrapperModel { @JsonKey(ignore: true) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_appConfig), - const DeepCollectionEquality().hash(_bandWidthBatchSize), - const DeepCollectionEquality().hash(_downSyncBandWidthBatchSize), - const DeepCollectionEquality().hash(_householdDeletionReasonOptions), - const DeepCollectionEquality() - .hash(_householdMemberDeletionReasonOptions), - const DeepCollectionEquality().hash(_backgroundServiceConfig), - const DeepCollectionEquality().hash(_checklistTypes), - const DeepCollectionEquality().hash(_idTypeOptions), - const DeepCollectionEquality().hash(_deliveryCommentOptions), - const DeepCollectionEquality().hash(_backendInterface), - const DeepCollectionEquality().hash(_callSupportOptions), - const DeepCollectionEquality().hash(_transportTypes), - const DeepCollectionEquality().hash(_symptomsTypeList), - const DeepCollectionEquality().hash(_searchHouseHoldFilters), - const DeepCollectionEquality().hash(_referralReasonList), - const DeepCollectionEquality().hash(_houseStructureTypes), - const DeepCollectionEquality().hash(_refusalReasons), - const DeepCollectionEquality().hash(_firebaseConfig)); + int get hashCode => Object.hashAll([ + runtimeType, + const DeepCollectionEquality().hash(_appConfig), + const DeepCollectionEquality().hash(_bandWidthBatchSize), + const DeepCollectionEquality().hash(_downSyncBandWidthBatchSize), + const DeepCollectionEquality().hash(_householdDeletionReasonOptions), + const DeepCollectionEquality() + .hash(_householdMemberDeletionReasonOptions), + const DeepCollectionEquality().hash(_backgroundServiceConfig), + const DeepCollectionEquality().hash(_checklistTypes), + const DeepCollectionEquality().hash(_idTypeOptions), + const DeepCollectionEquality().hash(_deliveryCommentOptions), + const DeepCollectionEquality().hash(_backendInterface), + const DeepCollectionEquality().hash(_callSupportOptions), + const DeepCollectionEquality().hash(_transportTypes), + const DeepCollectionEquality().hash(_symptomsTypeList), + const DeepCollectionEquality().hash(_searchHouseHoldFilters), + const DeepCollectionEquality().hash(_searchCLFFilters), + const DeepCollectionEquality().hash(_referralReasonList), + const DeepCollectionEquality().hash(_houseStructureTypes), + const DeepCollectionEquality().hash(_refusalReasons), + const DeepCollectionEquality().hash(_firebaseConfig) + ]); @JsonKey(ignore: true) @override @@ -1643,6 +1679,8 @@ abstract class _HCMWrapperModel implements HCMWrapperModel { final List? symptomsTypeList, @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') final List? searchHouseHoldFilters, + @JsonKey(name: 'SEARCH_CLF_FILTERS') + final List? searchCLFFilters, @JsonKey(name: 'REFERRAL_REASONS') final List? referralReasonList, @JsonKey(name: 'HOUSE_STRUCTURE_TYPES') @@ -1699,6 +1737,9 @@ abstract class _HCMWrapperModel implements HCMWrapperModel { @JsonKey(name: 'SEARCH_HOUSEHOLD_FILTERS') List? get searchHouseHoldFilters; @override + @JsonKey(name: 'SEARCH_CLF_FILTERS') + List? get searchCLFFilters; + @override @JsonKey(name: 'REFERRAL_REASONS') List? get referralReasonList; @override diff --git a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart index 3cd523aa9b..25bc7e6158 100644 --- a/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart +++ b/apps/health_campaign_field_worker_app/lib/models/app_config/app_config_model.g.dart @@ -141,6 +141,9 @@ _$HCMWrapperModelImpl _$$HCMWrapperModelImplFromJson( ?.map( (e) => SearchHouseHoldFilters.fromJson(e as Map)) .toList(), + searchCLFFilters: (json['SEARCH_CLF_FILTERS'] as List?) + ?.map((e) => SearchCLFFilters.fromJson(e as Map)) + .toList(), referralReasonList: (json['REFERRAL_REASONS'] as List?) ?.map((e) => ReferralReasonType.fromJson(e as Map)) .toList(), @@ -174,6 +177,7 @@ Map _$$HCMWrapperModelImplToJson( 'TRANSPORT_TYPES': instance.transportTypes, 'SYMPTOM_TYPES': instance.symptomsTypeList, 'SEARCH_HOUSEHOLD_FILTERS': instance.searchHouseHoldFilters, + 'SEARCH_CLF_FILTERS': instance.searchCLFFilters, 'REFERRAL_REASONS': instance.referralReasonList, 'HOUSE_STRUCTURE_TYPES': instance.houseStructureTypes, 'REFUSAL_REASONS': instance.refusalReasons, diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart index 41a7184bee..97408aac71 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart @@ -14,6 +14,7 @@ class DownsyncSearchModelMapper static DownsyncSearchModelMapper ensureInitialized() { if (_instance == null) { MapperContainer.globals.use(_instance = DownsyncSearchModelMapper._()); + EntitySearchModelMapper.ensureInitialized().addSubMapper(_instance!); } return _instance!; } @@ -221,6 +222,10 @@ class DownsyncModelMapper extends SubClassMapperBase { static DownsyncModelMapper ensureInitialized() { if (_instance == null) { MapperContainer.globals.use(_instance = DownsyncModelMapper._()); + EntityModelMapper.ensureInitialized().addSubMapper(_instance!); + DownsyncAdditionalFieldsMapper.ensureInitialized(); + AuditDetailsMapper.ensureInitialized(); + ClientAuditDetailsMapper.ensureInitialized(); } return _instance!; } @@ -489,6 +494,8 @@ class DownsyncAdditionalFieldsMapper if (_instance == null) { MapperContainer.globals .use(_instance = DownsyncAdditionalFieldsMapper._()); + AdditionalFieldsMapper.ensureInitialized().addSubMapper(_instance!); + AdditionalFieldMapper.ensureInitialized(); } return _instance!; } diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index cbc7d67ec5..82ccbc5abe 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -710,6 +710,9 @@ void setPackagesSingleton(BuildContext context) { .map((e) => e.code) .toList() : [], + searchCLFFilters: appConfiguration.searchCLFFilters != null + ? appConfiguration.searchCLFFilters!.map((e) => e.code).toList() + : [], referralReasons: appConfiguration.referralReasons?.map((e) => e.code).toList(), houseStructureTypes: diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart index ce33c8ef42..10fd81183a 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.dart @@ -110,7 +110,85 @@ class LocalSqlDataStore extends _$LocalSqlDataStore { /// The `schemaVersion` getter returns the schema version of the database. @override - int get schemaVersion => 6; + int get schemaVersion => 5; // Increment schema version + + @override + MigrationStrategy get migration => MigrationStrategy( + onUpgrade: (migrator, from, to) async { + if (from < 5) { + //Add column for projectType in Project Table + try { + await migrator.addColumn(project, project.projectType); + } catch (e) {} + } + if (from < 5) { + await customStatement(''' + CREATE TABLE attributes_temp ( + id TEXT, + dataType TEXT, + referenceId TEXT, + tenantId TEXT, + code TEXT, + values TEXT, + isActive BOOLEAN, + required BOOLEAN, + regex TEXT, + "order" INTEGER, + auditCreatedBy TEXT, + nonRecoverableError BOOLEAN DEFAULT 0, + auditCreatedTime INTEGER, + clientCreatedTime INTEGER, + clientModifiedBy TEXT, + clientCreatedBy TEXT, + clientModifiedTime INTEGER, + auditModifiedBy TEXT, + auditModifiedTime INTEGER, + isDeleted BOOLEAN DEFAULT 0, + rowVersion INTEGER, + additionalFields TEXT, + additionalDetails TEXT + ); + '''); + + // Step 2: Copy data from the old table to the new table + await customStatement(''' + INSERT INTO attributes_temp ( + id, dataType, referenceId, tenantId, code, values, isActive, required, regex, "order", + auditCreatedBy, nonRecoverableError, auditCreatedTime, clientCreatedTime, + clientModifiedBy, clientCreatedBy, clientModifiedTime, auditModifiedBy, + auditModifiedTime, isDeleted, rowVersion, additionalFields, additionalDetails + ) + SELECT + id, dataType, referenceId, tenantId, code, values, + CASE isActive WHEN 'true' THEN 1 WHEN 'false' THEN 0 ELSE NULL END, + required, regex, "order", + auditCreatedBy, nonRecoverableError, auditCreatedTime, clientCreatedTime, + clientModifiedBy, clientCreatedBy, clientModifiedTime, auditModifiedBy, + auditModifiedTime, isDeleted, rowVersion, additionalFields, additionalDetails + FROM attributes; + '''); + + // Step 3: Drop the old table + await migrator.deleteTable('attributes'); + + // Step 4: Rename the new table to the old table's name + await customStatement( + 'ALTER TABLE attributes_temp RENAME TO attributes;'); + } + + if (from < 6) { + try { + AppLogger.instance.info('Apply migration $from to $to'); + await migrator.addColumn(household, household.householdType); + } catch (e) { + AppLogger.instance.error( + title: 'migration', + message: e.toString(), + ); + } + } + }, + ); /// The `_openConnection` method opens a connection to the database. /// It returns a `LazyDatabase` that opens the database when it is first accessed. @@ -125,24 +203,4 @@ 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 < 6) { - 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(), - ); - } - } - }); - } } From 50e60ae05be990155fcd267e2fb215eb94edb0fa Mon Sep 17 00:00:00 2001 From: Naveen Renati <154230258+naveenr-egov@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:10:12 +0530 Subject: [PATCH 25/47] clf filters initialization fix --- .../no_sql/schema/app_configuration.dart | 11 +- .../no_sql/schema/app_configuration.g.dart | 605 ++++++++++++++++-- .../lib/data/repositories/remote/mdms.dart | 11 +- .../lib/utils/utils.dart | 2 +- 4 files changed, 584 insertions(+), 45 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart index 9309603a2c..1366f26bd8 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.dart @@ -1,9 +1,5 @@ -import 'package:digit_dss/digit_dss.dart'; import 'package:isar/isar.dart'; -import '../../../../models/app_config/app_config_model.dart'; -import '../../../../models/privacy_notice/privacy_notice_model.dart'; - part 'app_configuration.g.dart'; @Collection() @@ -183,6 +179,13 @@ class SearchHouseHoldFilters { late bool active; } +@embedded +class SearchCLFFilters { + late String name; + late String code; + late bool active; +} + @embedded class HouseholdMemberDeletionReasonOptions { late String name; diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart index d2e76c13c0..a2688a4dbc 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/no_sql/schema/app_configuration.g.dart @@ -116,59 +116,65 @@ const AppConfigurationSchema = CollectionSchema( name: r'PROXIMITY_SEARCH_RANGE', type: IsarType.double, ), - r'SEARCH_HOUSEHOLD_FILTERS': PropertySchema( + r'SEARCH_CLF_FILTERS': PropertySchema( id: 17, + name: r'SEARCH_CLF_FILTERS', + type: IsarType.objectList, + target: r'SearchCLFFilters', + ), + r'SEARCH_HOUSEHOLD_FILTERS': PropertySchema( + id: 18, name: r'SEARCH_HOUSEHOLD_FILTERS', type: IsarType.objectList, target: r'SearchHouseHoldFilters', ), r'SYNC_METHOD': PropertySchema( - id: 18, + id: 19, name: r'SYNC_METHOD', type: IsarType.string, ), r'SYNC_TRIGGER': PropertySchema( - id: 19, + id: 20, name: r'SYNC_TRIGGER', type: IsarType.string, ), r'TENANT_ID': PropertySchema( - id: 20, + id: 21, name: r'TENANT_ID', type: IsarType.string, ), r'TRANSPORT_TYPES': PropertySchema( - id: 21, + id: 22, name: r'TRANSPORT_TYPES', type: IsarType.objectList, target: r'TransportTypes', ), r'houseStructureTypes': PropertySchema( - id: 22, + id: 23, name: r'houseStructureTypes', type: IsarType.objectList, target: r'HouseStructureTypes', ), r'privacyPolicyConfig': PropertySchema( - id: 23, + id: 24, name: r'privacyPolicyConfig', type: IsarType.object, target: r'PrivacyPolicy', ), r'referralReasons': PropertySchema( - id: 24, + id: 25, name: r'referralReasons', type: IsarType.objectList, target: r'ReferralReasons', ), r'refusalReasons': PropertySchema( - id: 25, + id: 26, name: r'refusalReasons', type: IsarType.objectList, target: r'RefusalReasons', ), r'symptomsTypes': PropertySchema( - id: 26, + id: 27, name: r'symptomsTypes', type: IsarType.objectList, target: r'SymptomsTypes', @@ -201,6 +207,7 @@ const AppConfigurationSchema = CollectionSchema( r'FirebaseConfig': FirebaseConfigSchema, r'SymptomsTypes': SymptomsTypesSchema, r'SearchHouseHoldFilters': SearchHouseHoldFiltersSchema, + r'SearchCLFFilters': SearchCLFFiltersSchema, r'ReferralReasons': ReferralReasonsSchema, r'HouseStructureTypes': HouseStructureTypesSchema, r'RefusalReasons': RefusalReasonsSchema, @@ -411,6 +418,20 @@ int _appConfigurationEstimateSize( bytesCount += 3 + value.length * 3; } } + { + final list = object.searchCLFFilters; + if (list != null) { + bytesCount += 3 + list.length * 3; + { + final offsets = allOffsets[SearchCLFFilters]!; + for (var i = 0; i < list.length; i++) { + final value = list[i]; + bytesCount += + SearchCLFFiltersSchema.estimateSize(value, offsets, allOffsets); + } + } + } + } { final list = object.searchHouseHoldFilters; if (list != null) { @@ -617,47 +638,53 @@ void _appConfigurationSerialize( writer.writeString(offsets[14], object.networkDetection); writer.writeString(offsets[15], object.persistenceMode); writer.writeDouble(offsets[16], object.maxRadius); - writer.writeObjectList( + writer.writeObjectList( offsets[17], allOffsets, + SearchCLFFiltersSchema.serialize, + object.searchCLFFilters, + ); + writer.writeObjectList( + offsets[18], + allOffsets, SearchHouseHoldFiltersSchema.serialize, object.searchHouseHoldFilters, ); - writer.writeString(offsets[18], object.syncMethod); - writer.writeString(offsets[19], object.syncTrigger); - writer.writeString(offsets[20], object.tenantId); + writer.writeString(offsets[19], object.syncMethod); + writer.writeString(offsets[20], object.syncTrigger); + writer.writeString(offsets[21], object.tenantId); writer.writeObjectList( - offsets[21], + offsets[22], allOffsets, TransportTypesSchema.serialize, object.transportTypes, ); writer.writeObjectList( - offsets[22], + offsets[23], allOffsets, HouseStructureTypesSchema.serialize, object.houseStructureTypes, ); writer.writeObject( - offsets[23], + offsets[24], allOffsets, PrivacyPolicySchema.serialize, object.privacyPolicyConfig, ); writer.writeObjectList( - offsets[24], + offsets[25], allOffsets, ReferralReasonsSchema.serialize, object.referralReasons, ); writer.writeObjectList( - offsets[25], + offsets[26], allOffsets, RefusalReasonsSchema.serialize, object.refusalReasons, ); writer.writeObjectList( - offsets[26], + offsets[27], allOffsets, SymptomsTypesSchema.serialize, object.symptomsTypes, @@ -758,47 +785,53 @@ AppConfiguration _appConfigurationDeserialize( object.networkDetection = reader.readStringOrNull(offsets[14]); object.persistenceMode = reader.readStringOrNull(offsets[15]); object.maxRadius = reader.readDoubleOrNull(offsets[16]); - object.searchHouseHoldFilters = reader.readObjectList( + object.searchCLFFilters = reader.readObjectList( offsets[17], + SearchCLFFiltersSchema.deserialize, + allOffsets, + SearchCLFFilters(), + ); + object.searchHouseHoldFilters = reader.readObjectList( + offsets[18], SearchHouseHoldFiltersSchema.deserialize, allOffsets, SearchHouseHoldFilters(), ); - object.syncMethod = reader.readStringOrNull(offsets[18]); - object.syncTrigger = reader.readStringOrNull(offsets[19]); - object.tenantId = reader.readStringOrNull(offsets[20]); + object.syncMethod = reader.readStringOrNull(offsets[19]); + object.syncTrigger = reader.readStringOrNull(offsets[20]); + object.tenantId = reader.readStringOrNull(offsets[21]); object.transportTypes = reader.readObjectList( - offsets[21], + offsets[22], TransportTypesSchema.deserialize, allOffsets, TransportTypes(), ); object.houseStructureTypes = reader.readObjectList( - offsets[22], + offsets[23], HouseStructureTypesSchema.deserialize, allOffsets, HouseStructureTypes(), ); object.id = id; object.privacyPolicyConfig = reader.readObjectOrNull( - offsets[23], + offsets[24], PrivacyPolicySchema.deserialize, allOffsets, ); object.referralReasons = reader.readObjectList( - offsets[24], + offsets[25], ReferralReasonsSchema.deserialize, allOffsets, ReferralReasons(), ); object.refusalReasons = reader.readObjectList( - offsets[25], + offsets[26], RefusalReasonsSchema.deserialize, allOffsets, RefusalReasons(), ); object.symptomsTypes = reader.readObjectList( - offsets[26], + offsets[27], SymptomsTypesSchema.deserialize, allOffsets, SymptomsTypes(), @@ -915,53 +948,60 @@ P _appConfigurationDeserializeProp

( case 16: return (reader.readDoubleOrNull(offset)) as P; case 17: + return (reader.readObjectList( + offset, + SearchCLFFiltersSchema.deserialize, + allOffsets, + SearchCLFFilters(), + )) as P; + case 18: return (reader.readObjectList( offset, SearchHouseHoldFiltersSchema.deserialize, allOffsets, SearchHouseHoldFilters(), )) as P; - case 18: - return (reader.readStringOrNull(offset)) as P; case 19: return (reader.readStringOrNull(offset)) as P; case 20: return (reader.readStringOrNull(offset)) as P; case 21: + return (reader.readStringOrNull(offset)) as P; + case 22: return (reader.readObjectList( offset, TransportTypesSchema.deserialize, allOffsets, TransportTypes(), )) as P; - case 22: + case 23: return (reader.readObjectList( offset, HouseStructureTypesSchema.deserialize, allOffsets, HouseStructureTypes(), )) as P; - case 23: + case 24: return (reader.readObjectOrNull( offset, PrivacyPolicySchema.deserialize, allOffsets, )) as P; - case 24: + case 25: return (reader.readObjectList( offset, ReferralReasonsSchema.deserialize, allOffsets, ReferralReasons(), )) as P; - case 25: + case 26: return (reader.readObjectList( offset, RefusalReasonsSchema.deserialize, allOffsets, RefusalReasons(), )) as P; - case 26: + case 27: return (reader.readObjectList( offset, SymptomsTypesSchema.deserialize, @@ -2690,6 +2730,113 @@ extension AppConfigurationQueryFilter }); } + QueryBuilder + searchCLFFiltersIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'SEARCH_CLF_FILTERS', + )); + }); + } + + QueryBuilder + searchCLFFiltersIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'SEARCH_CLF_FILTERS', + )); + }); + } + + QueryBuilder + searchCLFFiltersLengthEqualTo(int length) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + length, + true, + length, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + true, + 0, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + false, + 999999, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthLessThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + 0, + true, + length, + include, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthGreaterThan( + int length, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + length, + include, + 999999, + true, + ); + }); + } + + QueryBuilder + searchCLFFiltersLengthBetween( + int lower, + int upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.listLength( + r'SEARCH_CLF_FILTERS', + lower, + includeLower, + upper, + includeUpper, + ); + }); + } + QueryBuilder searchHouseHoldFiltersIsNull() { return QueryBuilder.apply(this, (query) { @@ -3971,6 +4118,13 @@ extension AppConfigurationQueryObject }); } + QueryBuilder + searchCLFFiltersElement(FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'SEARCH_CLF_FILTERS'); + }); + } + QueryBuilder searchHouseHoldFiltersElement(FilterQuery q) { return QueryBuilder.apply(this, (query) { @@ -4385,6 +4539,13 @@ extension AppConfigurationQueryProperty }); } + QueryBuilder?, QQueryOperations> + searchCLFFiltersProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'SEARCH_CLF_FILTERS'); + }); + } + QueryBuilder?, QQueryOperations> searchHouseHoldFiltersProperty() { return QueryBuilder.apply(this, (query) { @@ -8904,6 +9065,376 @@ extension SearchHouseHoldFiltersQueryObject on QueryBuilder< // coverage:ignore-file // ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types +const SearchCLFFiltersSchema = Schema( + name: r'SearchCLFFilters', + id: 6742638452277890113, + properties: { + r'active': PropertySchema( + id: 0, + name: r'active', + type: IsarType.bool, + ), + r'code': PropertySchema( + id: 1, + name: r'code', + type: IsarType.string, + ), + r'name': PropertySchema( + id: 2, + name: r'name', + type: IsarType.string, + ) + }, + estimateSize: _searchCLFFiltersEstimateSize, + serialize: _searchCLFFiltersSerialize, + deserialize: _searchCLFFiltersDeserialize, + deserializeProp: _searchCLFFiltersDeserializeProp, +); + +int _searchCLFFiltersEstimateSize( + SearchCLFFilters object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + bytesCount += 3 + object.code.length * 3; + bytesCount += 3 + object.name.length * 3; + return bytesCount; +} + +void _searchCLFFiltersSerialize( + SearchCLFFilters object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeBool(offsets[0], object.active); + writer.writeString(offsets[1], object.code); + writer.writeString(offsets[2], object.name); +} + +SearchCLFFilters _searchCLFFiltersDeserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = SearchCLFFilters(); + object.active = reader.readBool(offsets[0]); + object.code = reader.readString(offsets[1]); + object.name = reader.readString(offsets[2]); + return object; +} + +P _searchCLFFiltersDeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readBool(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension SearchCLFFiltersQueryFilter + on QueryBuilder { + QueryBuilder + activeEqualTo(bool value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'active', + value: value, + )); + }); + } + + QueryBuilder + codeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'code', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'code', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'code', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + codeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'code', + value: '', + )); + }); + } + + QueryBuilder + codeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'code', + value: '', + )); + }); + } + + QueryBuilder + nameEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'name', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'name', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'name', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + nameIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'name', + value: '', + )); + }); + } + + QueryBuilder + nameIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'name', + value: '', + )); + }); + } +} + +extension SearchCLFFiltersQueryObject + on QueryBuilder {} + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters, always_specify_types + const HouseholdMemberDeletionReasonOptionsSchema = Schema( name: r'HouseholdMemberDeletionReasonOptions', id: 752674668946516871, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart index 35136b3426..d3df2bbee5 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/mdms.dart @@ -8,7 +8,6 @@ import 'package:isar/isar.dart'; import '../../../models/app_config/app_config_model.dart' as app_configuration; import '../../../models/mdms/service_registry/pgr_service_defenitions.dart'; import '../../../models/mdms/service_registry/service_registry_model.dart'; -import '../../../models/privacy_notice/privacy_notice_model.dart'; import '../../../models/role_actions/role_actions_model.dart'; import '../../local_store/no_sql/schema/app_configuration.dart'; import '../../local_store/no_sql/schema/row_versions.dart'; @@ -244,8 +243,6 @@ class MdmsRepository { return content; }).toList(); - - final List? idTypeOptions = element?.idTypeOptions.map((element) { final idOption = IdTypeOptions() @@ -329,6 +326,14 @@ class MdmsRepository { ..active = e.active; return searchFilters; }).toList(); + appConfiguration.searchCLFFilters = + result.hcmWrapperModel?.searchCLFFilters?.map((e) { + final searchFilters = SearchCLFFilters() + ..name = e.name + ..code = e.code + ..active = e.active; + return searchFilters; + }).toList(); appConfiguration.symptomsTypes = result.hcmWrapperModel?.symptomsTypeList?.map((e) { diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index 07abc78d05..981f410777 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -361,7 +361,7 @@ class RegistrationDeliverySingleton { required List? deliveryCommentOptions, required List? symptomsTypes, required List? searchHouseHoldFilter, - searchCLFFilters, + required List? searchCLFFilters, required List? referralReasons, required List? houseStructureTypes, required List? refusalReasons, From d477508bd8e987b9802076345310f91246980a7a Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 15:32:21 +0530 Subject: [PATCH 26/47] component issue fix --- .../pages/beneficiary/household_overview.dart | 1301 +++++++++-------- .../house_details.dart | 1 + .../individual_details.dart | 663 +++++---- .../lib/pages/search_beneficiary.dart | 35 +- .../lib/pages/summary_page.dart | 182 +-- 5 files changed, 1135 insertions(+), 1047 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 9fa5bab937..fc8745a101 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -104,7 +104,6 @@ class _HouseholdOverviewPageState enableFixedDigitButton: true, footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), children: [ DigitButton( mainAxisSize: MainAxisSize.max, @@ -259,693 +258,725 @@ class _HouseholdOverviewPageState ]), slivers: [ SliverToBoxAdapter( - child: DigitCard(children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + child: DigitCard( + margin: const EdgeInsets.all(spacer2), children: [ - if ((state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isNotEmpty) - Align( - alignment: Alignment.centerLeft, - child: DigitButton( - onPressed: () { - final projectId = - RegistrationDeliverySingleton() - .projectId!; + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + if ((state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isNotEmpty) + Align( + alignment: Alignment.centerLeft, + child: DigitButton( + onPressed: () { + final projectId = + RegistrationDeliverySingleton() + .projectId!; - final bloc = context - .read(); - bloc.add( - HouseholdOverviewReloadEvent( - projectId: projectId, - projectBeneficiaryType: - beneficiaryType, - ), - ); - showDialog( - context: context, - builder: (ctx) => DigitActionCard( - actions: [ - DigitButton( - capitalizeLetters: false, - prefixIcon: Icons.edit, - label: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? localizations.translate(i18 - .householdOverView - .clfOverViewEditLabel) - : localizations.translate( - i18.householdOverView - .householdOverViewEditLabel, - ), - type: DigitButtonType.secondary, - size: DigitButtonSize.large, - onPressed: () async { - Navigator.of( - context, - rootNavigator: true, - ).pop(); + final bloc = context + .read(); + bloc.add( + HouseholdOverviewReloadEvent( + projectId: projectId, + projectBeneficiaryType: + beneficiaryType, + ), + ); + showDialog( + context: context, + builder: (ctx) => DigitActionCard( + actions: [ + DigitButton( + capitalizeLetters: false, + prefixIcon: Icons.edit, + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType + .community) + ? localizations.translate(i18 + .householdOverView + .clfOverViewEditLabel) + : localizations + .translate( + i18.householdOverView + .householdOverViewEditLabel, + ), + type: DigitButtonType + .secondary, + size: DigitButtonSize.large, + onPressed: () async { + Navigator.of( + context, + rootNavigator: true, + ).pop(); - HouseholdMemberWrapper - wrapper = state - .householdMemberWrapper; + HouseholdMemberWrapper + wrapper = state + .householdMemberWrapper; - final timestamp = wrapper - .headOfHousehold - ?.clientAuditDetails - ?.createdTime; - final date = DateTime - .fromMillisecondsSinceEpoch( - timestamp ?? - DateTime.now() - .millisecondsSinceEpoch, - ); + final timestamp = wrapper + .headOfHousehold + ?.clientAuditDetails + ?.createdTime; + final date = DateTime + .fromMillisecondsSinceEpoch( + timestamp ?? + DateTime.now() + .millisecondsSinceEpoch, + ); - final address = wrapper - .household?.address; + final address = wrapper + .household?.address; - if (address == null) return; + if (address == null) + return; - final projectBeneficiary = - state + final projectBeneficiary = state .householdMemberWrapper .projectBeneficiaries ?.firstWhereOrNull( - (element) => - element - .beneficiaryClientReferenceId == - wrapper.household - ?.clientReferenceId, - ); + (element) => + element + .beneficiaryClientReferenceId == + wrapper.household + ?.clientReferenceId, + ); - await context.router.root - .push( - BeneficiaryRegistrationWrapperRoute( - initialState: - BeneficiaryRegistrationEditHouseholdState( - addressModel: address, - individualModel: state + await context.router.root + .push( + BeneficiaryRegistrationWrapperRoute( + initialState: + BeneficiaryRegistrationEditHouseholdState( + addressModel: + address, + individualModel: state + .householdMemberWrapper + .members ?? + [], + householdModel: state .householdMemberWrapper - .members ?? - [], - householdModel: state - .householdMemberWrapper - .household!, - registrationDate: date, - projectBeneficiaryModel: - projectBeneficiary, - ), - children: [ - HouseholdLocationRoute(), - ], - ), - ); - callReloadEvent( - offset: 0, limit: 10); - }, + .household!, + registrationDate: + date, + projectBeneficiaryModel: + projectBeneficiary, + ), + children: [ + HouseholdLocationRoute(), + ], + ), + ); + callReloadEvent( + offset: 0, limit: 10); + }, + ), + ], ), - ], - ), - ); - }, - label: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? localizations.translate(i18 - .householdOverView - .clfOverViewEditIconText) - : localizations.translate( - i18.householdOverView - .householdOverViewEditIconText, - ), - type: DigitButtonType.tertiary, - size: DigitButtonSize.medium, - prefixIcon: Icons.edit, - capitalizeLetters: false, - ), - ), - // BlocBuilder( - // builder: (ctx, deliverInterventionState) => - // Offstage( - // offstage: beneficiaryType == - // BeneficiaryType.individual, - // child: Align( - // alignment: Alignment.centerLeft, - // child: DigitIconButton( - // icon: getStatusAttributes(state, - // deliverInterventionState)['icon'], - // iconText: localizations.translate( - // getStatusAttributes(state, - // deliverInterventionState)[ - // 'textLabel'], - // ), // [TODO: map task status accordingly based on projectBeneficiaries and tasks] - // iconTextColor: getStatusAttributes(state, - // deliverInterventionState)['color'], - // iconColor: getStatusAttributes(state, - // deliverInterventionState)['color'], - // ), - // ), - // ), - // ), - Align( - alignment: Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(spacer2), - child: Text( - RegistrationDeliverySingleton() - .householdType != - null && - RegistrationDeliverySingleton() - .householdType == - HouseholdType.community - ? localizations.translate(i18 - .householdOverView - .clfOverviewLabel) - : localizations.translate(i18 - .householdOverView - .householdOverViewLabel), - style: textTheme.headingXl, + ); + }, + label: + (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .householdOverView + .clfOverViewEditIconText) + : localizations.translate( + i18.householdOverView + .householdOverViewEditIconText, + ), + type: DigitButtonType.tertiary, + size: DigitButtonSize.medium, + prefixIcon: Icons.edit, + capitalizeLetters: false, + ), + ), + // BlocBuilder( + // builder: (ctx, deliverInterventionState) => + // Offstage( + // offstage: beneficiaryType == + // BeneficiaryType.individual, + // child: Align( + // alignment: Alignment.centerLeft, + // child: DigitIconButton( + // icon: getStatusAttributes(state, + // deliverInterventionState)['icon'], + // iconText: localizations.translate( + // getStatusAttributes(state, + // deliverInterventionState)[ + // 'textLabel'], + // ), // [TODO: map task status accordingly based on projectBeneficiaries and tasks] + // iconTextColor: getStatusAttributes(state, + // deliverInterventionState)['color'], + // iconColor: getStatusAttributes(state, + // deliverInterventionState)['color'], + // ), + // ), + // ), + // ), + Align( + alignment: Alignment.centerLeft, + child: Padding( + padding: const EdgeInsets.all(spacer2), + child: Text( + RegistrationDeliverySingleton() + .householdType != + null && + RegistrationDeliverySingleton() + .householdType == + HouseholdType.community + ? localizations.translate(i18 + .householdOverView + .clfOverviewLabel) + : localizations.translate(i18 + .householdOverView + .householdOverViewLabel), + style: textTheme.headingXl, + ), + ), ), - ), - ), - Padding( - padding: const EdgeInsets.only( - left: spacer2, - right: spacer2, - ), - child: BlocBuilder( - builder: (ctx, deliverInterventionState) { - bool shouldShowStatus = beneficiaryType == - BeneficiaryType.household; + Padding( + padding: const EdgeInsets.only( + left: spacer2, + right: spacer2, + ), + child: BlocBuilder< + DeliverInterventionBloc, + DeliverInterventionState>( + builder: + (ctx, deliverInterventionState) { + bool shouldShowStatus = + beneficiaryType == + BeneficiaryType.household; - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { - return Column( - children: [ - DigitTableCard(element: { - localizations.translate(i18 - .householdOverView - .instituteNameLabel): state + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) { + return Column( + children: [ + DigitTableCard(element: { + localizations.translate(i18 + .householdOverView + .instituteNameLabel): state + .householdMemberWrapper + .household + ?.address + ?.buildingName ?? + localizations.translate(i18 + .common.coreCommonNA), + localizations.translate( + i18.deliverIntervention + .memberCountText, + ): state.householdMemberWrapper + .household?.memberCount, + localizations.translate( + i18.householdLocation + .administrationAreaFormLabel, + ): state .householdMemberWrapper - .household + .headOfHousehold ?.address - ?.buildingName ?? - localizations.translate( - i18.common.coreCommonNA), - localizations.translate( - i18.deliverIntervention - .memberCountText, - ): state.householdMemberWrapper - .household?.memberCount, - localizations.translate( - i18.householdLocation - .administrationAreaFormLabel, - ): state - .householdMemberWrapper - .headOfHousehold - ?.address - ?.first - .locality - ?.code, - }), - ], - ); - } + ?.first + .locality + ?.code, + }), + ], + ); + } - return Column( - children: [ - DigitTableCard( - element: { - localizations.translate(i18 + return Column( + children: [ + DigitTableCard( + element: { + localizations.translate(i18 .householdOverView - .householdOverViewHouseholdHeadNameLabel): - state + .householdOverViewHouseholdHeadNameLabel): state .householdMemberWrapper .headOfHousehold ?.name ?.givenName ?? localizations.translate(i18 .common.coreCommonNA), - localizations.translate( - i18.householdLocation - .administrationAreaFormLabel, - ): state - .householdMemberWrapper - .headOfHousehold - ?.address - ?.first - .locality - ?.code, - localizations.translate( - i18.deliverIntervention - .memberCountText, - ): state.householdMemberWrapper - .household?.memberCount, - if (shouldShowStatus) - localizations.translate(i18 - .beneficiaryDetails - .status): - localizations.translate( - getStatusAttributes(state, - deliverInterventionState)[ - 'textLabel'], - ) - }, - ), - ], - ); - }), - ), - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) ...[ - Padding( - padding: const EdgeInsets.only( - top: spacer2, bottom: spacer2), - child: Row( - children: [ - Expanded( - child: DigitSearchBar( - controller: searchController, - hintText: localizations.translate( - i18.common.searchByName, + localizations.translate( + i18.householdLocation + .administrationAreaFormLabel, + ): state + .householdMemberWrapper + .headOfHousehold + ?.address + ?.first + .locality + ?.code, + localizations.translate( + i18.deliverIntervention + .memberCountText, + ): state.householdMemberWrapper + .household?.memberCount, + if (shouldShowStatus) + localizations.translate(i18 + .beneficiaryDetails + .status): + localizations.translate( + getStatusAttributes(state, + deliverInterventionState)[ + 'textLabel'], + ) + }, ), - textCapitalization: - TextCapitalization.words, - onChanged: (value) { - if (value.length >= 3) { - callReloadEvent( - offset: 0, limit: 10); - } else if (searchController - .value.text.isEmpty) { - callReloadEvent( - offset: 0, limit: 10); - } - }, - ), - ), - Column( + ], + ); + }), + ), + if (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) ...[ + Padding( + padding: const EdgeInsets.only( + top: spacer2, bottom: spacer2), + child: Row( children: [ - getFilters() - ? Align( - alignment: - Alignment.topLeft, - child: Padding( + Expanded( + child: DigitSearchBar( + controller: searchController, + hintText: + localizations.translate( + i18.common.searchByName, + ), + textCapitalization: + TextCapitalization.words, + onChanged: (value) { + if (value.length >= 3) { + callReloadEvent( + offset: 0, limit: 10); + } else if (searchController + .value.text.isEmpty) { + callReloadEvent( + offset: 0, limit: 10); + } + }, + ), + ), + Column( + children: [ + getFilters() + ? Align( + alignment: + Alignment.topLeft, + child: Padding( + padding: + const EdgeInsets + .all(spacer2), + child: DigitButton( + label: + getFilterIconNLabel()[ + 'label'], + size: + DigitButtonSize + .medium, + type: + DigitButtonType + .tertiary, + suffixIcon: + getFilterIconNLabel()[ + 'icon'], + onPressed: () => + showFilterDialog(), + ), + ), + ) + : const Offstage(), + ], + ), + ], + ), + ), + ], + selectedFilters.isNotEmpty + ? Align( + alignment: Alignment.topLeft, + child: SizedBox( + height: MediaQuery.of(context) + .size + .height * + 0.06, + child: ListView.builder( + shrinkWrap: true, + scrollDirection: + Axis.horizontal, + itemCount: + selectedFilters.length, + itemBuilder: + (context, index) { + return Padding( padding: const EdgeInsets.all( - spacer2), - child: DigitButton( + spacer1), + child: DigitChip( label: - getFilterIconNLabel()[ - 'label'], - size: DigitButtonSize - .medium, - type: DigitButtonType - .tertiary, - suffixIcon: - getFilterIconNLabel()[ - 'icon'], - onPressed: () => - showFilterDialog(), + '${localizations.translate(getStatus(selectedFilters[index]))}' + ' (${state.householdMemberWrapper.members!.length})', + onItemDelete: () { + selectedFilters.remove( + selectedFilters[ + index]); + callReloadEvent( + offset: 0, + limit: 10); + }, ), - ), - ) - : const Offstage(), - ], - ), - ], - ), - ), - ], - selectedFilters.isNotEmpty - ? Align( - alignment: Alignment.topLeft, - child: SizedBox( - height: MediaQuery.of(context) - .size - .height * - 0.06, - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - itemCount: selectedFilters.length, - itemBuilder: (context, index) { - return Padding( - padding: const EdgeInsets.all( - spacer1), - child: DigitChip( - label: - '${localizations.translate(getStatus(selectedFilters[index]))}' - ' (${state.householdMemberWrapper.members!.length})', - onItemDelete: () { - selectedFilters.remove( - selectedFilters[ - index]); - callReloadEvent( - offset: 0, limit: 10); - }, - ), - ); - }), - ), - ) - : const Offstage(), - Column( - children: - (state.householdMemberWrapper.members ?? + ); + }), + ), + ) + : const Offstage(), + Column( + children: (state.householdMemberWrapper + .members ?? []) .map( - (e) { - final isHead = state + (e) { + final isHead = state + .householdMemberWrapper + .headOfHousehold + ?.clientReferenceId == + e.clientReferenceId; + final projectBeneficiaryId = state .householdMemberWrapper - .headOfHousehold - ?.clientReferenceId == - e.clientReferenceId; - final projectBeneficiaryId = state - .householdMemberWrapper - .projectBeneficiaries - ?.firstWhereOrNull((b) => - b.beneficiaryClientReferenceId == - e.clientReferenceId) - ?.clientReferenceId; + .projectBeneficiaries + ?.firstWhereOrNull((b) => + b.beneficiaryClientReferenceId == + e.clientReferenceId) + ?.clientReferenceId; - final projectBeneficiary = state - .householdMemberWrapper - .projectBeneficiaries - ?.where( - (element) => - element - .beneficiaryClientReferenceId == - (RegistrationDeliverySingleton() - .beneficiaryType == - BeneficiaryType - .individual - ? e.clientReferenceId - : state - .householdMemberWrapper - .household - ?.clientReferenceId), - ) - .toList(); - - final taskData = (projectBeneficiary ?? - []) - .isNotEmpty - ? state.householdMemberWrapper.tasks - ?.where((element) => - element - .projectBeneficiaryClientReferenceId == - projectBeneficiary - ?.first.clientReferenceId) - .toList() - : null; - final referralData = (projectBeneficiary ?? - []) - .isNotEmpty - ? state - .householdMemberWrapper.referrals - ?.where((element) => - element - .projectBeneficiaryClientReferenceId == - projectBeneficiary - ?.first.clientReferenceId) - .toList() - : null; - final sideEffectData = taskData != null && - taskData.isNotEmpty - ? state.householdMemberWrapper - .sideEffects - ?.where((element) => - element - .taskClientReferenceId == - taskData.lastOrNull - ?.clientReferenceId) - .toList() - : null; - final ageInYears = e.dateOfBirth != null - ? DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).years - : 0; - final ageInMonths = e.dateOfBirth != null - ? DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).months - : 0; - final currentCycle = - RegistrationDeliverySingleton() - .projectType - ?.cycles - ?.firstWhereOrNull( - (e) => - (e.startDate) < - DateTime.now() - .millisecondsSinceEpoch && - (e.endDate) > - DateTime.now() - .millisecondsSinceEpoch, - ); + final projectBeneficiary = state + .householdMemberWrapper + .projectBeneficiaries + ?.where( + (element) => + element + .beneficiaryClientReferenceId == + (RegistrationDeliverySingleton() + .beneficiaryType == + BeneficiaryType + .individual + ? e.clientReferenceId + : state + .householdMemberWrapper + .household + ?.clientReferenceId), + ) + .toList(); - final isBeneficiaryRefused = - checkIfBeneficiaryRefused( - taskData, - ); - final isBeneficiaryReferred = - checkIfBeneficiaryReferred( - referralData, - currentCycle, - ); + final taskData = (projectBeneficiary ?? + []) + .isNotEmpty + ? state + .householdMemberWrapper.tasks + ?.where((element) => + element + .projectBeneficiaryClientReferenceId == + projectBeneficiary?.first + .clientReferenceId) + .toList() + : null; + final referralData = + (projectBeneficiary ?? []) + .isNotEmpty + ? state.householdMemberWrapper + .referrals + ?.where((element) => + element + .projectBeneficiaryClientReferenceId == + projectBeneficiary + ?.first + .clientReferenceId) + .toList() + : null; + final sideEffectData = taskData != + null && + taskData.isNotEmpty + ? state.householdMemberWrapper + .sideEffects + ?.where((element) => + element + .taskClientReferenceId == + taskData.lastOrNull + ?.clientReferenceId) + .toList() + : null; + final ageInYears = + e.dateOfBirth != null + ? DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).years + : 0; + final ageInMonths = + e.dateOfBirth != null + ? DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).months + : 0; + final currentCycle = + RegistrationDeliverySingleton() + .projectType + ?.cycles + ?.firstWhereOrNull( + (e) => + (e.startDate) < + DateTime.now() + .millisecondsSinceEpoch && + (e.endDate) > + DateTime.now() + .millisecondsSinceEpoch, + ); - return MemberCard( - isHead: isHead, - individual: e, - projectBeneficiaries: - projectBeneficiary ?? [], - tasks: taskData, - sideEffects: sideEffectData, - editMemberAction: () async { - final bloc = - ctx.read(); + final isBeneficiaryRefused = + checkIfBeneficiaryRefused( + taskData, + ); + final isBeneficiaryReferred = + checkIfBeneficiaryReferred( + referralData, + currentCycle, + ); - Navigator.of( - context, - rootNavigator: true, - ).pop(); + return MemberCard( + isHead: isHead, + individual: e, + projectBeneficiaries: + projectBeneficiary ?? [], + tasks: taskData, + sideEffects: sideEffectData, + editMemberAction: () async { + final bloc = ctx.read< + HouseholdOverviewBloc>(); - final address = e.address; - if (address == null || - address.isEmpty) { - return; - } + Navigator.of( + context, + rootNavigator: true, + ).pop(); - final projectId = - RegistrationDeliverySingleton() - .projectId!; - bloc.add( - HouseholdOverviewReloadEvent( - projectId: projectId, - projectBeneficiaryType: - beneficiaryType, - ), - ); + final address = e.address; + if (address == null || + address.isEmpty) { + return; + } - await context.router.root.push( - BeneficiaryRegistrationWrapperRoute( - initialState: - BeneficiaryRegistrationEditIndividualState( - individualModel: e, - householdModel: state - .householdMemberWrapper - .household!, - addressModel: address.first, - projectBeneficiaryModel: state - .householdMemberWrapper - .projectBeneficiaries - ?.firstWhereOrNull( - (element) => - element - .beneficiaryClientReferenceId == - (RegistrationDeliverySingleton() - .beneficiaryType == - BeneficiaryType - .individual - ? e.clientReferenceId - : state - .householdMemberWrapper - .household - ?.clientReferenceId), - ), - ), - children: [ - IndividualDetailsRoute( - isHeadOfHousehold: isHead, - ), - ], - ), - ); - callReloadEvent(offset: 0, limit: 10); - }, - setAsHeadAction: () { - ctx.read().add( - HouseholdOverviewSetAsHeadEvent( - individualModel: e, - projectId: - RegistrationDeliverySingleton() - .projectId!, - householdModel: state - .householdMemberWrapper - .household!, + final projectId = + RegistrationDeliverySingleton() + .projectId!; + bloc.add( + HouseholdOverviewReloadEvent( + projectId: projectId, projectBeneficiaryType: beneficiaryType, ), ); - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - deleteMemberAction: () { - showCustomPopup( - context: context, - builder: (BuildContext) => Popup( - title: localizations.translate(i18 - .householdOverView - .householdOverViewActionCardTitle), - type: PopUpType.simple, - actions: [ - DigitButton( - label: localizations - .translate(i18 - .householdOverView - .householdOverViewPrimaryActionLabel), - onPressed: () { - Navigator.of( - context, - rootNavigator: true, - ) - ..pop() - ..pop(); - context - .read< - HouseholdOverviewBloc>() - .add( - HouseholdOverviewEvent - .selectedIndividual( - individualModel: - e, - ), - ); - context.router.push( - ReasonForDeletionRoute( - isHousholdDelete: - false, - ), - ); - }, - type: DigitButtonType - .primary, - size: DigitButtonSize - .large), - DigitButton( - label: localizations - .translate(i18 - .householdOverView - .householdOverViewSecondaryActionLabel), - onPressed: () { - Navigator.of( - context, - rootNavigator: true, - ).pop(); - }, - type: DigitButtonType - .tertiary, - size: - DigitButtonSize.large) - ]), - ); - }, - isNotEligible: - RegistrationDeliverySingleton() - .projectType - ?.cycles != - null - ? !checkEligibilityForAgeAndSideEffect( - DigitDOBAgeConvertor( - years: ageInYears, - months: ageInMonths, + await context.router.root.push( + BeneficiaryRegistrationWrapperRoute( + initialState: + BeneficiaryRegistrationEditIndividualState( + individualModel: e, + householdModel: state + .householdMemberWrapper + .household!, + addressModel: address.first, + projectBeneficiaryModel: state + .householdMemberWrapper + .projectBeneficiaries + ?.firstWhereOrNull( + (element) => + element + .beneficiaryClientReferenceId == + (RegistrationDeliverySingleton() + .beneficiaryType == + BeneficiaryType + .individual + ? e + .clientReferenceId + : state + .householdMemberWrapper + .household + ?.clientReferenceId), ), - RegistrationDeliverySingleton() - .projectType, - (taskData ?? []).isNotEmpty - ? taskData?.lastOrNull - : null, - sideEffectData, - ) - : false, - name: e.name?.givenName ?? ' - - ', - years: (e.dateOfBirth == null - ? null - : DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).years), - months: (e.dateOfBirth == null - ? null - : DigitDateUtils.calculateAge( - DigitDateUtils - .getFormattedDateToDateTime( - e.dateOfBirth!, - ) ?? - DateTime.now(), - ).months), - gender: e.gender?.name, - isBeneficiaryRefused: - isBeneficiaryRefused && - !checkStatus( - taskData, - currentCycle, + ), + children: [ + IndividualDetailsRoute( + isHeadOfHousehold: isHead, + ), + ], ), - isBeneficiaryReferred: - isBeneficiaryReferred, - isDelivered: taskData == null - ? false - : taskData.isNotEmpty && + ); + callReloadEvent( + offset: 0, limit: 10); + }, + setAsHeadAction: () { + ctx + .read() + .add( + HouseholdOverviewSetAsHeadEvent( + individualModel: e, + projectId: + RegistrationDeliverySingleton() + .projectId!, + householdModel: state + .householdMemberWrapper + .household!, + projectBeneficiaryType: + beneficiaryType, + ), + ); + + Navigator.of( + context, + rootNavigator: true, + ).pop(); + }, + deleteMemberAction: () { + showCustomPopup( + context: context, + builder: (BuildContext) => Popup( + title: localizations + .translate(i18 + .householdOverView + .householdOverViewActionCardTitle), + type: PopUpType.simple, + actions: [ + DigitButton( + label: localizations + .translate(i18 + .householdOverView + .householdOverViewPrimaryActionLabel), + onPressed: () { + Navigator.of( + context, + rootNavigator: + true, + ) + ..pop() + ..pop(); + context + .read< + HouseholdOverviewBloc>() + .add( + HouseholdOverviewEvent + .selectedIndividual( + individualModel: + e, + ), + ); + context.router.push( + ReasonForDeletionRoute( + isHousholdDelete: + false, + ), + ); + }, + type: DigitButtonType + .primary, + size: DigitButtonSize + .large), + DigitButton( + label: localizations + .translate(i18 + .householdOverView + .householdOverViewSecondaryActionLabel), + onPressed: () { + Navigator.of( + context, + rootNavigator: + true, + ).pop(); + }, + type: DigitButtonType + .tertiary, + size: DigitButtonSize + .large) + ]), + ); + }, + isNotEligible: + RegistrationDeliverySingleton() + .projectType + ?.cycles != + null + ? !checkEligibilityForAgeAndSideEffect( + DigitDOBAgeConvertor( + years: ageInYears, + months: ageInMonths, + ), + RegistrationDeliverySingleton() + .projectType, + (taskData ?? []) + .isNotEmpty + ? taskData + ?.lastOrNull + : null, + sideEffectData, + ) + : false, + name: e.name?.givenName ?? ' - - ', + years: (e.dateOfBirth == null + ? null + : DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).years), + months: (e.dateOfBirth == null + ? null + : DigitDateUtils.calculateAge( + DigitDateUtils + .getFormattedDateToDateTime( + e.dateOfBirth!, + ) ?? + DateTime.now(), + ).months), + gender: e.gender?.name, + isBeneficiaryRefused: + isBeneficiaryRefused && !checkStatus( taskData, currentCycle, - ) - ? true - : false, - localizations: localizations, - projectBeneficiaryClientReferenceId: - projectBeneficiaryId, - ); - }, - ).toList(), + ), + isBeneficiaryReferred: + isBeneficiaryReferred, + isDelivered: taskData == null + ? false + : taskData.isNotEmpty && + !checkStatus( + taskData, + currentCycle, + ) + ? true + : false, + localizations: localizations, + projectBeneficiaryClientReferenceId: + projectBeneficiaryId, + ); + }, + ).toList(), + ), + ], ), - ], - ), - ]), + ]), ), ], ), diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index babde12581..51613a9cd2 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -347,6 +347,7 @@ class HouseDetailsPageState extends LocalizedState { houseShowcaseData.typeOfStructure.buildWith( child: SelectionCard( isRequired: true, + showParentContainer: true, title: localizations.translate( i18.householdDetails.typeOfStructure), equalWidthOptions: true, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index f939098485..ee922312a2 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -107,7 +107,6 @@ class IndividualDetailsPageState extends LocalizedState { ]), footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), children: [ ValueListenableBuilder( valueListenable: clickedStatus, @@ -123,7 +122,11 @@ class IndividualDetailsPageState extends LocalizedState { size: DigitButtonSize.large, mainAxisSize: MainAxisSize.max, onPressed: () async { - if (form.control(_dobKey).value == null) { + final age = DigitDateUtils.calculateAge( + form.control(_dobKey).value as DateTime, + ); + if ((age.years == 0 && age.months == 0) || + age.years >= 150 && age.months > 0) { form.control(_dobKey).setErrors({'': true}); } if (form.control(_idTypeKey).value == null) { @@ -173,6 +176,9 @@ class IndividualDetailsPageState extends LocalizedState { ); final scannerBloc = context.read(); + scannerBloc.add( + const DigitScannerEvent.handleScanner(), + ); if (scannerBloc.state.duplicate) { Toast.showToast(context, @@ -185,6 +191,9 @@ class IndividualDetailsPageState extends LocalizedState { clickedStatus.value = true; final scannerBloc = context.read(); + scannerBloc.add( + const DigitScannerEvent.handleScanner(), + ); bloc.add( BeneficiaryRegistrationSummaryEvent( projectId: projectId!, @@ -207,6 +216,9 @@ class IndividualDetailsPageState extends LocalizedState { ) { final scannerBloc = context.read(); + scannerBloc.add( + const DigitScannerEvent.handleScanner(), + ); final individual = _getIndividualModel( context, form: form, @@ -273,7 +285,9 @@ class IndividualDetailsPageState extends LocalizedState { if (context.mounted) { final scannerBloc = context.read(); - + scannerBloc.add( + const DigitScannerEvent.handleScanner(), + ); if (scannerBloc.state.duplicate) { Toast.showToast( context, @@ -315,343 +329,364 @@ class IndividualDetailsPageState extends LocalizedState { ]), slivers: [ SliverToBoxAdapter( - child: DigitCard(children: [ - Padding( - padding: const EdgeInsets.only(bottom: spacer2), - child: Text( - localizations.translate( - i18.individualDetails.individualsDetailsLabelText, + child: DigitCard( + margin: const EdgeInsets.all(spacer2), + children: [ + Text( + localizations.translate( + i18.individualDetails.individualsDetailsLabelText, + ), + style: textTheme.headingXl, ), - style: textTheme.headingXl, - ), - ), - individualDetailsShowcaseData.nameOfIndividual.buildWith( - child: ReactiveWrapperField( - formControlName: _individualNameKey, - validationMessages: { - 'required': (object) => localizations.translate( - '${i18.individualDetails.nameLabelText}_IS_REQUIRED', + individualDetailsShowcaseData.nameOfIndividual + .buildWith( + child: ReactiveWrapperField( + formControlName: _individualNameKey, + validationMessages: { + 'required': (object) => localizations.translate( + '${i18.individualDetails.nameLabelText}_IS_REQUIRED', + ), + 'maxLength': (object) => localizations + .translate(i18.common.maxCharsRequired) + .replaceAll('{}', maxLength.toString()), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.nameLabelText, ), - 'maxLength': (object) => localizations - .translate(i18.common.maxCharsRequired) - .replaceAll('{}', maxLength.toString()), - }, - builder: (field) => LabeledField( - label: localizations.translate( - i18.individualDetails.nameLabelText, + isRequired: true, + child: DigitTextFormInput( + initialValue: + form.control(_individualNameKey).value, + onChange: (value) { + form.control(_individualNameKey).value = + value; + }, + errorMessage: field.errorText, + ), + ), ), - isRequired: true, - child: DigitTextFormInput( - initialValue: - form.control(_individualNameKey).value, - onChange: (value) { - form.control(_individualNameKey).value = value; - }, - errorMessage: field.errorText, + ), + Offstage( + offstage: !widget.isHeadOfHousehold, + child: DigitCheckbox( + capitalizeFirstLetter: false, + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate( + i18.individualDetails.clfCheckboxLabelText) + : localizations.translate( + i18.individualDetails.checkboxLabelText, + ), + value: widget.isHeadOfHousehold, + readOnly: widget.isHeadOfHousehold, + onChanged: (_) {}, ), ), - ), - ), - Offstage( - offstage: !widget.isHeadOfHousehold, - child: DigitCheckbox( - capitalizeFirstLetter: false, - label: (RegistrationDeliverySingleton().householdType == - HouseholdType.community) - ? localizations.translate( - i18.individualDetails.clfCheckboxLabelText) - : localizations.translate( - i18.individualDetails.checkboxLabelText, + ReactiveWrapperField( + formControlName: _idTypeKey, + validationMessages: { + 'required': (_) => localizations.translate( + i18.common.corecommonRequired, + ), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.idTypeLabelText, + ), + isRequired: true, + child: DigitDropdown( + selectedOption: + (form.control(_idTypeKey).value != null) + ? DropdownItem( + name: localizations.translate( + form.control(_idTypeKey).value), + code: form.control(_idTypeKey).value) + : const DropdownItem(name: '', code: ''), + items: RegistrationDeliverySingleton() + .idTypeOptions! + .map( + (e) => DropdownItem( + name: localizations.translate(e), + code: e), + ) + .toList(), + onSelect: (value) { + form.control(_idTypeKey).value = value.code; + setState(() { + if (value.code == 'DEFAULT') { + form.control(_idNumberKey).value = + IdGen.i.identifier.toString(); + } else { + form.control(_idNumberKey).value = null; + } + }); + }, + emptyItemText: localizations + .translate(i18.common.noMatchFound), + errorMessage: form.control(_idTypeKey).hasErrors + ? localizations.translate( + i18.common.corecommonRequired, + ) + : null, + ), + ), + ), + if (form.control(_idTypeKey).value != 'DEFAULT') + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ReactiveFormConsumer( + builder: (context, formGroup, child) { + return ReactiveWrapperField( + formControlName: _idNumberKey, + validationMessages: { + 'required': (object) => + localizations.translate( + '${i18.individualDetails.idNumberLabelText}_IS_REQUIRED', + ), + }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.idNumberLabelText, + ), + isRequired: form + .control(_idNumberKey) + .validators + .isNotEmpty, + child: DigitTextFormInput( + readOnly: + form.control(_idTypeKey).value == + 'DEFAULT', + initialValue: + form.control(_idNumberKey).value, + onChange: (value) { + form.control(_idNumberKey).value = + value; + }, + errorMessage: field.errorText, + ), + ), + ); + }, ), - value: widget.isHeadOfHousehold, - readOnly: widget.isHeadOfHousehold, - onChanged: (_) {}, - ), - ), - ReactiveWrapperField( - formControlName: _idTypeKey, - validationMessages: { - 'required': (_) => localizations.translate( - i18.common.corecommonRequired, + const SizedBox(height: 4), + ], + ), + if (form.control(_idTypeKey).value == 'DEFAULT') + const SizedBox( + height: spacer2, + ), + individualDetailsShowcaseData.dateOfBirth.buildWith( + child: DigitDobPicker( + datePickerFormControl: _dobKey, + datePickerLabel: localizations.translate( + i18.individualDetails.dobLabelText, ), - }, - builder: (field) => LabeledField( - label: localizations.translate( - i18.individualDetails.idTypeLabelText, + ageFieldLabel: localizations.translate( + i18.individualDetails.ageLabelText, + ), + yearsHintLabel: localizations.translate( + i18.individualDetails.yearsHintText, + ), + monthsHintLabel: localizations.translate( + i18.individualDetails.monthsHintText, + ), + separatorLabel: localizations.translate( + i18.individualDetails.separatorLabelText, + ), + yearsAndMonthsErrMsg: localizations.translate( + i18.individualDetails.yearsAndMonthsErrorText, + ), + errorMessage: form.control(_dobKey).hasErrors + ? localizations + .translate(i18.common.corecommonRequired) + : null, + initialDate: before150Years, + onChangeOfFormControl: (value) { + if (value == null) { + form.control(_dobKey).setErrors({'': true}); + } else { + DigitDOBAgeConvertor age = + DigitDateUtils.calculateAge(value); + if ((age.years == 0 && age.months == 0) || + age.months > 11 || + (age.years >= 150 && age.months >= 0)) { + form.control(_dobKey).setErrors({'': true}); + } else { + form.control(_dobKey).removeError(''); + } + } + // Handle changes to the control's value here + form.control(_dobKey).value = value; + }, + cancelText: localizations + .translate(i18.common.coreCommonCancel), + confirmText: localizations + .translate(i18.common.coreCommonOk), + ), ), - isRequired: true, - child: DigitDropdown( - selectedOption: - (form.control(_idTypeKey).value != null) - ? DropdownItem( - name: localizations.translate( - form.control(_idTypeKey).value), - code: form.control(_idTypeKey).value) - : const DropdownItem(name: '', code: ''), - items: RegistrationDeliverySingleton() - .idTypeOptions! + SelectionCard( + isRequired: true, + showParentContainer: true, + title: localizations.translate( + i18.individualDetails.genderLabelText, + ), + allowMultipleSelection: false, + width: 126, + initialSelection: + form.control(_genderKey).value != null + ? [form.control(_genderKey).value] + : [], + options: RegistrationDeliverySingleton() + .genderOptions! .map( - (e) => DropdownItem( - name: localizations.translate(e), code: e), + (e) => e, ) .toList(), - onSelect: (value) { - form.control(_idTypeKey).value = value.code; + onSelectionChanged: (value) { setState(() { - if (value.code == 'DEFAULT') { - form.control(_idNumberKey).value = - IdGen.i.identifier.toString(); + if (value.isNotEmpty) { + form.control(_genderKey).value = value.first; } else { - form.control(_idNumberKey).value = null; + form.control(_genderKey).value = null; + setState(() { + form + .control(_genderKey) + .setErrors({'': true}); + }); } }); }, - emptyItemText: - localizations.translate(i18.common.noMatchFound), - errorMessage: form.control(_idTypeKey).hasErrors - ? localizations.translate( - i18.common.corecommonRequired, - ) + valueMapper: (value) { + return localizations.translate(value); + }, + errorMessage: form.control(_genderKey).hasErrors + ? localizations + .translate(i18.common.corecommonRequired) : null, ), - ), - ), - if (form.control(_idTypeKey).value != 'DEFAULT') - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ReactiveFormConsumer( - builder: (context, formGroup, child) { - return ReactiveWrapperField( - formControlName: _idNumberKey, - validationMessages: { - 'required': (object) => - localizations.translate( - '${i18.individualDetails.idNumberLabelText}_IS_REQUIRED', - ), - }, - builder: (field) => LabeledField( - label: localizations.translate( - i18.individualDetails.idNumberLabelText, - ), - isRequired: form - .control(_idNumberKey) - .validators - .isNotEmpty, - child: DigitTextFormInput( - readOnly: form.control(_idTypeKey).value == - 'DEFAULT', - initialValue: - form.control(_idNumberKey).value, - onChange: (value) { - form.control(_idNumberKey).value = value; - }, - errorMessage: field.errorText, - ), - ), - ); + individualDetailsShowcaseData.mobile.buildWith( + child: ReactiveWrapperField( + formControlName: _mobileNumberKey, + validationMessages: { + 'maxLength': (object) => localizations.translate( + i18.individualDetails + .mobileNumberLengthValidationMessage), + 'minLength': (object) => localizations.translate( + i18.individualDetails + .mobileNumberLengthValidationMessage), }, + builder: (field) => LabeledField( + label: localizations.translate( + i18.individualDetails.mobileNumberLabelText, + ), + child: DigitTextFormInput( + keyboardType: TextInputType.number, + maxLength: 10, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly, + ], + initialValue: + form.control(_mobileNumberKey).value, + onChange: (value) { + form.control(_mobileNumberKey).value = value; + }, + ), + ), ), - const SizedBox(height: 4), - ], - ), - if (form.control(_idTypeKey).value == 'DEFAULT') - const SizedBox( - height: spacer2, - ), - individualDetailsShowcaseData.dateOfBirth.buildWith( - child: DigitDobPicker( - datePickerFormControl: _dobKey, - datePickerLabel: localizations.translate( - i18.individualDetails.dobLabelText, - ), - ageFieldLabel: localizations.translate( - i18.individualDetails.ageLabelText, - ), - yearsHintLabel: localizations.translate( - i18.individualDetails.yearsHintText, - ), - monthsHintLabel: localizations.translate( - i18.individualDetails.monthsHintText, ), - separatorLabel: localizations.translate( - i18.individualDetails.separatorLabelText, - ), - yearsAndMonthsErrMsg: localizations.translate( - i18.individualDetails.yearsAndMonthsErrorText, - ), - errorMessage: form.control(_dobKey).hasErrors - ? localizations - .translate(i18.common.corecommonRequired) - : null, - initialDate: before150Years, - onChangeOfFormControl: (value) { - if (value != null) { - setState(() { - form.control(_dobKey).setErrors({'': false}); - }); - } - // Handle changes to the control's value here - form.control(_dobKey).value = value; - }, - cancelText: localizations - .translate(i18.common.coreCommonCancel), - confirmText: - localizations.translate(i18.common.coreCommonOk), - ), - ), - SelectionCard( - isRequired: true, - title: localizations.translate( - i18.individualDetails.genderLabelText, - ), - allowMultipleSelection: false, - width: 126, - initialSelection: form.control(_genderKey).value != null - ? [form.control(_genderKey).value] - : [], - options: RegistrationDeliverySingleton() - .genderOptions! - .map( - (e) => e, - ) - .toList(), - onSelectionChanged: (value) { - setState(() { - if (value.isNotEmpty) { - form.control(_genderKey).value = value.first; - } else { - form.control(_genderKey).value = null; - setState(() { - form.control(_genderKey).setErrors({'': true}); - }); - } - }); - }, - valueMapper: (value) { - return localizations.translate(value); - }, - errorMessage: form.control(_genderKey).hasErrors - ? localizations - .translate(i18.common.corecommonRequired) - : null, - ), - individualDetailsShowcaseData.mobile.buildWith( - child: ReactiveWrapperField( - formControlName: _mobileNumberKey, - validationMessages: { - 'maxLength': (object) => localizations.translate(i18 - .individualDetails - .mobileNumberLengthValidationMessage), - 'minLength': (object) => localizations.translate(i18 - .individualDetails - .mobileNumberLengthValidationMessage), - }, - builder: (field) => LabeledField( - label: localizations.translate( - i18.individualDetails.mobileNumberLabelText, - ), - child: DigitTextFormInput( - keyboardType: TextInputType.number, - maxLength: 10, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly, - ], - initialValue: form.control(_mobileNumberKey).value, - onChange: (value) { - form.control(_mobileNumberKey).value = value; + const SizedBox(height: 16), + if ((RegistrationDeliverySingleton().beneficiaryType == + BeneficiaryType.household && + widget.isHeadOfHousehold) || + (RegistrationDeliverySingleton().beneficiaryType == + BeneficiaryType.individual)) + BlocBuilder( + buildWhen: (p, c) { + return true; }, - ), - ), - ), - ), - const SizedBox(height: 16), - if ((RegistrationDeliverySingleton().beneficiaryType == - BeneficiaryType.household && - widget.isHeadOfHousehold) || - (RegistrationDeliverySingleton().beneficiaryType == - BeneficiaryType.individual)) - BlocBuilder( - buildWhen: (p, c) { - return true; - }, - builder: (context, state) => state.qrCodes.isNotEmpty - ? Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - width: - MediaQuery.of(context).size.width / 3, - child: Text( - localizations.translate( - i18.deliverIntervention.voucherCode, + builder: (context, state) => state + .qrCodes.isNotEmpty + ? Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + SizedBox( + width: + MediaQuery.of(context).size.width / + 3, + child: Text( + localizations.translate( + i18.deliverIntervention.voucherCode, + ), + style: theme.textTheme.headlineSmall, + ), ), - style: theme.textTheme.headlineSmall, - ), - ), - Flexible( - child: Text( - overflow: TextOverflow.ellipsis, - localizations - .translate(state.qrCodes.last), - ), - ), - Padding( - padding: const EdgeInsets.only( - bottom: spacer2 * 2, - ), - child: IconButton( - color: theme.colorScheme.secondary, - icon: const Icon(Icons.edit), - onPressed: () { - Navigator.of(context).push( - //[TODO: Add the route to auto_route] - MaterialPageRoute( - builder: (context) => - const DigitScannerPage( - quantity: 1, - isGS1code: false, - singleValue: true, - isEditEnabled: true, - ), - settings: const RouteSettings( - name: '/qr-scanner'), + Flexible( + child: Text( + overflow: TextOverflow.ellipsis, + localizations + .translate(state.qrCodes.last), + ), + ), + Padding( + padding: const EdgeInsets.only( + bottom: spacer2 * 2, + ), + child: IconButton( + color: theme.colorScheme.secondary, + icon: const Icon(Icons.edit), + onPressed: () { + Navigator.of(context).push( + //[TODO: Add the route to auto_route] + MaterialPageRoute( + builder: (context) => + const DigitScannerPage( + quantity: 1, + isGS1code: false, + singleValue: true, + isEditEnabled: true, + ), + settings: const RouteSettings( + name: '/qr-scanner'), + ), + ); + }, + ), + ), + ], + + // ignore: no-empty-block + ) + : DigitButton( + type: DigitButtonType.secondary, + size: DigitButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + Navigator.of(context).push( + // [TODO: Add the route to auto_route] + MaterialPageRoute( + builder: (context) => + const DigitScannerPage( + quantity: 1, + isGS1code: false, + singleValue: true, ), - ); - }, + settings: const RouteSettings( + name: '/qr-scanner'), + ), + ); + }, + prefixIcon: Icons.qr_code, + label: localizations.translate( + i18.individualDetails + .linkVoucherToIndividual, ), ), - ], - - // ignore: no-empty-block - ) - : DigitButton( - type: DigitButtonType.secondary, - size: DigitButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - Navigator.of(context).push( - // [TODO: Add the route to auto_route] - MaterialPageRoute( - builder: (context) => - const DigitScannerPage( - quantity: 1, - isGS1code: false, - singleValue: true, - ), - settings: const RouteSettings( - name: '/qr-scanner'), - ), - ); - }, - prefixIcon: Icons.qr_code, - label: localizations.translate( - i18.individualDetails.linkVoucherToIndividual, - ), - ), - ), - ]), + ), + ]), ), ], ); diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 13bc78169a..129ee0f453 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -133,6 +133,8 @@ class _SearchBeneficiaryPageState BlocBuilder( builder: (context, locationState) { return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ locationState.latitude != null ? Padding( @@ -242,6 +244,7 @@ class _SearchBeneficiaryPageState label: '${localizations.translate(getStatus(selectedFilters[index]))}' ' (${searchHouseholdsState.totalResults})', + capitalizedFirstLetter: false, onItemDelete: () { setState(() { selectedFilters.remove( @@ -263,19 +266,23 @@ class _SearchBeneficiaryPageState ), if (searchHouseholdsState.resultsNotFound && !searchHouseholdsState.loading) - InfoCard( - type: InfoType.info, - description: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? localizations - .translate(i18.searchBeneficiary.clfInfoTitle) - : localizations.translate( - i18.searchBeneficiary - .beneficiaryInfoDescription, - ), - title: localizations.translate( - i18.searchBeneficiary.beneficiaryInfoTitle, + Padding( + padding: const EdgeInsets.only( + left: spacer2, top: spacer2, right: spacer2), + child: InfoCard( + type: InfoType.info, + description: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate( + i18.searchBeneficiary.clfInfoTitle) + : localizations.translate( + i18.searchBeneficiary + .beneficiaryInfoDescription, + ), + title: localizations.translate( + i18.searchBeneficiary.beneficiaryInfoTitle, + ), ), ), ], @@ -396,7 +403,7 @@ class _SearchBeneficiaryPageState searchHouseholdsState.householdMembers.isNotEmpty), child: DigitCard( margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), + padding: const EdgeInsets.all(spacer4), children: [ DigitButton( capitalizeLetters: false, diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index a2fa44e599..a48355478a 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -103,7 +103,6 @@ class SummaryPageState extends LocalizedState { ]), footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), children: [ ValueListenableBuilder( valueListenable: clickedStatus, @@ -213,21 +212,25 @@ class SummaryPageState extends LocalizedState { .householdLocationLabelText), items: [ LabelValueItem( - label: localizations.translate( - i18.householdLocation.villageLabel), - value: householdState.householdModel - ?.address?.locality?.code ?? - localizations.translate( - i18.common.coreCommonNA), - isInline: true), + label: localizations.translate( + i18.householdLocation.villageLabel), + value: householdState.householdModel + ?.address?.locality?.code ?? + localizations + .translate(i18.common.coreCommonNA), + isInline: true, + labelFlex: 5, + ), LabelValueItem( - label: localizations.translate(i18 - .householdLocation.landmarkFormLabel), - value: householdState.householdModel - ?.address?.landmark ?? - localizations.translate( - i18.common.coreCommonNA), - isInline: true), + label: localizations.translate(i18 + .householdLocation.landmarkFormLabel), + value: householdState.householdModel + ?.address?.landmark ?? + localizations + .translate(i18.common.coreCommonNA), + isInline: true, + labelFlex: 5, + ), ]), ]), if (RegistrationDeliverySingleton().householdType != @@ -241,45 +244,50 @@ class SummaryPageState extends LocalizedState { .householdDetails.householdDetailsLabel), items: [ LabelValueItem( - label: localizations.translate(i18 - .beneficiaryDetails.totalMembers), - value: householdState - .householdModel?.memberCount - .toString() ?? - '0', - isInline: true), + label: localizations.translate( + i18.beneficiaryDetails.totalMembers), + value: householdState + .householdModel?.memberCount + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfPregnantWomenCountLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .pregnantWomen - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), + label: localizations.translate(i18 + .householdDetails + .noOfPregnantWomenCountLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .pregnantWomen + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfChildrenBelow5YearsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .children - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), + label: localizations.translate(i18 + .householdDetails + .noOfChildrenBelow5YearsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.children + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), ]), ]), DigitCard( @@ -291,39 +299,43 @@ class SummaryPageState extends LocalizedState { i18.householdDetails.houseDetailsLabel), items: [ LabelValueItem( - label: localizations.translate( - i18.householdDetails.noOfRoomsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.noOfRooms - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true), + label: localizations.translate( + i18.householdDetails.noOfRoomsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.noOfRooms + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), LabelValueItem( - label: localizations.translate( - i18.householdDetails.typeOfStructure), - value: (householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .houseStructureTypes - .toValue()) - .firstOrNull - ?.value ?? - []) - .toString() - .split('|') - .map((item) => - getLocalizedMessage(item)) - .toList() - .join(', '), - isInline: true), + label: localizations.translate( + i18.householdDetails.typeOfStructure), + value: (householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .houseStructureTypes + .toValue()) + .firstOrNull + ?.value ?? + []) + .toString() + .split('|') + .map( + (item) => getLocalizedMessage(item)) + .toList() + .join(', '), + isInline: true, + labelFlex: 5, + ), ]), ]), DigitCard( @@ -383,6 +395,7 @@ class SummaryPageState extends LocalizedState { .toString() : localizations.translate( i18.common.coreCommonNA)), + labelFlex: 5, ), LabelValueItem( label: localizations.translate( @@ -408,6 +421,7 @@ class SummaryPageState extends LocalizedState { '') : localizations.translate( i18.common.coreCommonNA)), + labelFlex: 5, ), ]), ]), From 373b2a7ac4d64e9a38bcc56ccf3d41970345c21a Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 15:38:52 +0530 Subject: [PATCH 27/47] fix dob --- .../beneficiary_registration/individual_details.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index ee922312a2..b1b172102a 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -504,6 +504,7 @@ class IndividualDetailsPageState extends LocalizedState { .translate(i18.common.corecommonRequired) : null, initialDate: before150Years, + initialValue: getInitialDateValue(form), onChangeOfFormControl: (value) { if (value == null) { form.control(_dobKey).setErrors({'': true}); @@ -597,7 +598,7 @@ class IndividualDetailsPageState extends LocalizedState { ), ), ), - const SizedBox(height: 16), + // const SizedBox(height: spacer4), if ((RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.household && widget.isHeadOfHousehold) || @@ -621,7 +622,7 @@ class IndividualDetailsPageState extends LocalizedState { localizations.translate( i18.deliverIntervention.voucherCode, ), - style: theme.textTheme.headlineSmall, + style: textTheme.headingS, ), ), Flexible( @@ -636,7 +637,8 @@ class IndividualDetailsPageState extends LocalizedState { bottom: spacer2 * 2, ), child: IconButton( - color: theme.colorScheme.secondary, + color: + theme.colorTheme.primary.primary1, icon: const Icon(Icons.edit), onPressed: () { Navigator.of(context).push( From 68d971b2bbebfda73419717b14957dc29043863c Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 18:58:35 +0530 Subject: [PATCH 28/47] fix household type issues --- .../lib/data/repositories/local/household.dart | 1 + .../repositories/local/individual_global_search.dart | 4 ++-- .../lib/pages/search_beneficiary.dart | 10 ++++++++-- .../registration_delivery/lib/pages/summary_page.dart | 9 +++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/registration_delivery/lib/data/repositories/local/household.dart b/packages/registration_delivery/lib/data/repositories/local/household.dart index 8e19969878..1607f1d8ed 100644 --- a/packages/registration_delivery/lib/data/repositories/local/household.dart +++ b/packages/registration_delivery/lib/data/repositories/local/household.dart @@ -70,6 +70,7 @@ class HouseholdLocalRepository return HouseholdModel( id: household.id, + householdType: household.householdType, tenantId: household.tenantId, clientReferenceId: household.clientReferenceId, memberCount: household.memberCount, diff --git a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart index cdd3281e57..b0cd8045bb 100644 --- a/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart +++ b/packages/registration_delivery/lib/data/repositories/local/individual_global_search.dart @@ -183,7 +183,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { .equalsExp(sql.individual.clientReferenceId)) ]) ..where(buildAnd([ - if (params.householdType == HouseholdType.community) + if (params.householdType == HouseholdType.community && params.householdClientReferenceId==null) sql.householdMember.isHeadOfHousehold.equals(true), sql.address.relatedClientReferenceId.isNotNull(), sql.individual.clientReferenceId.isNotNull(), @@ -284,7 +284,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.projectBeneficiary.beneficiaryClientReferenceId .equalsExp(sql.household.clientReferenceId)) ]).where(buildAnd([ - if (params.householdType == HouseholdType.community) + if (params.householdType == HouseholdType.community && params.householdClientReferenceId==null) sql.householdMember.isHeadOfHousehold.equals(true), sql.household.householdType.equalsValue(params.householdType) ])); diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 129ee0f453..9222234361 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -362,8 +362,14 @@ class _SearchBeneficiaryPageState ? i.projectBeneficiaries ?.lastOrNull : null, - addressModel: i.headOfHousehold! - .address!.lastOrNull!, + addressModel: + (RegistrationDeliverySingleton() + .householdType == + HouseholdType + .community) + ? i.household!.address! + : i.headOfHousehold! + .address!.lastOrNull!, headOfHousehold: i.headOfHousehold), ), diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index a48355478a..c12bbfc67b 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -214,10 +214,10 @@ class SummaryPageState extends LocalizedState { LabelValueItem( label: localizations.translate( i18.householdLocation.villageLabel), - value: householdState.householdModel - ?.address?.locality?.code ?? - localizations - .translate(i18.common.coreCommonNA), + value: localizations.translate( + householdState.householdModel?.address + ?.locality?.code ?? + i18.common.coreCommonNA), isInline: true, labelFlex: 5, ), @@ -366,6 +366,7 @@ class SummaryPageState extends LocalizedState { individualModel?.name?.givenName ?? localizations.translate( i18.common.coreCommonNA)), + labelFlex: 5, ), LabelValueItem( label: localizations.translate( From a6e615e92d1f9f25eb8fa8e5906aaff92cbfa08f Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 23 Dec 2024 21:42:36 +0530 Subject: [PATCH 29/47] build fix --- packages/digit_data_model/pubspec.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/digit_data_model/pubspec.yaml b/packages/digit_data_model/pubspec.yaml index 5298d5f6ad..69f3b014d0 100644 --- a/packages/digit_data_model/pubspec.yaml +++ b/packages/digit_data_model/pubspec.yaml @@ -11,6 +11,7 @@ environment: dependencies: flutter: sdk: flutter + digit_ui_components: ^0.0.2-dev.4 flutter_bloc: ^8.1.5 freezed_annotation: ^2.4.1 dart_mappable: ^4.2.0 From d114234f8a3c0ddb8de2da378254dcd05e586498 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 26 Dec 2024 11:44:24 +0530 Subject: [PATCH 30/47] added household details screen for clf --- .../house_details.dart | 421 +++++++----------- .../lib/pages/summary_page.dart | 114 +++-- 2 files changed, 210 insertions(+), 325 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 51613a9cd2..274d6aa866 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -37,8 +37,6 @@ class HouseDetailsPageState extends LocalizedState { @override void initState() { - final registrationState = context.read().state; - super.initState(); } @@ -49,183 +47,91 @@ class HouseDetailsPageState extends LocalizedState { final router = context.router; final textTheme = theme.digitTextTheme(context); - return BlocConsumer( - listener: (context, state) { - if (state is BeneficiaryRegistrationPersistedState && state.isEdit) { - final overviewBloc = context.read(); - - overviewBloc.add( - HouseholdOverviewReloadEvent( - projectId: RegistrationDeliverySingleton().projectId.toString(), - projectBeneficiaryType: - RegistrationDeliverySingleton().beneficiaryType ?? - BeneficiaryType.household, - ), - ); - HouseholdMemberWrapper memberWrapper = - overviewBloc.state.householdMemberWrapper; - final route = router.parent() as StackRouter; - route.popUntilRouteWithName(SearchBeneficiaryRoute.name); - route.push(BeneficiaryWrapperRoute(wrapper: memberWrapper)); - } - }, - listenWhen: (previous, current) => - RegistrationDeliverySingleton().householdType == - HouseholdType.community, - builder: (context, registrationState) { - return Scaffold( - body: ReactiveFormBuilder( - form: () => buildForm(bloc.state), - builder: (_, form, __) => BlocBuilder( - builder: (context, registrationState) { - return ScrollableContent( - enableFixedDigitButton: true, - header: const Column( - children: [ - BackNavigationHelpHeaderWidget( - showcaseButton: ShowcaseButton(), - showHelp: false, - ), - ], + return Scaffold( + body: ReactiveFormBuilder( + form: () => buildForm(bloc.state), + builder: (_, form, __) => BlocBuilder( + builder: (context, registrationState) { + return ScrollableContent( + enableFixedDigitButton: true, + header: const Column( + children: [ + BackNavigationHelpHeaderWidget( + showcaseButton: ShowcaseButton(), + showHelp: false, ), - footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - padding: const EdgeInsets.all(spacer2), - children: [ - DigitButton( - onPressed: () { - form.markAllAsTouched(); - if (form - .control(_householdStructureKey) - .value == - null) { - setState(() { - form - .control(_householdStructureKey) - .setErrors({'': true}); - }); - } - - if (!form.valid) return; - selectedHouseStructureTypes = form + ], + ), + footer: DigitCard( + margin: const EdgeInsets.only(top: spacer2), + children: [ + DigitButton( + onPressed: () { + form.markAllAsTouched(); + if (form.control(_householdStructureKey).value == + null) { + setState(() { + form .control(_householdStructureKey) - .value; - - final noOfRooms = - form.control(_noOfRoomsKey).value as int; - registrationState.maybeWhen( - orElse: () { - return; - }, - create: ( - address, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - searchQuery, - loading, - isHeadOfHousehold, - ) { - var houseModel = HouseholdModel( - householdType: - RegistrationDeliverySingleton() - .householdType, - clientReferenceId: IdGen.i.identifier, - tenantId: - RegistrationDeliverySingleton() - .tenantId, - rowVersion: 1, - auditDetails: AuditDetails( - createdBy: - RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context - .millisecondsSinceEpoch(), - ), + .setErrors({'': true}); + }); + } - ///[TODO]: NEED TO FIX THIS - memberCount: - (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? 0 - : householdModel?.memberCount, - clientAuditDetails: - ClientAuditDetails( - createdBy: - RegistrationDeliverySingleton() - .loggedInUserUuid!, - createdTime: context - .millisecondsSinceEpoch(), - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: context - .millisecondsSinceEpoch(), - ), - additionalFields: - HouseholdAdditionalFields( - version: 1, - fields: [ - ...?householdModel - ?.additionalFields?.fields - .where((e) => - e.key != - AdditionalFieldsType - .houseStructureTypes - .toValue() && - e.key != - AdditionalFieldsType - .noOfRooms - .toValue()), - AdditionalField( - AdditionalFieldsType - .houseStructureTypes - .toValue(), - selectedHouseStructureTypes - ?.join("|") - .toString(), - ), - AdditionalField( - AdditionalFieldsType.noOfRooms - .toValue(), - noOfRooms, - ) - ])); + if (!form.valid) return; + selectedHouseStructureTypes = + form.control(_householdStructureKey).value; - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), - ); - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { - router.push(IndividualDetailsRoute( - isHeadOfHousehold: true)); - } else { - router.push(HouseHoldDetailsRoute()); - } - }, - editHousehold: ( - address, - householdModel, - individuals, - registrationDate, - projectBeneficiaryModel, - loading, - headOfHousehold, - ) { - var houseModel = householdModel.copyWith( - additionalFields: - HouseholdAdditionalFields( - version: 1, - fields: [ + final noOfRooms = + form.control(_noOfRoomsKey).value as int; + registrationState.maybeWhen( + orElse: () { + return; + }, + create: ( + address, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + searchQuery, + loading, + isHeadOfHousehold, + ) { + var houseModel = HouseholdModel( + clientReferenceId: IdGen.i.identifier, + householdType: + RegistrationDeliverySingleton() + .householdType, + tenantId: RegistrationDeliverySingleton() + .tenantId, + rowVersion: 1, + auditDetails: AuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + ), + memberCount: householdModel?.memberCount, + clientAuditDetails: ClientAuditDetails( + createdBy: + RegistrationDeliverySingleton() + .loggedInUserUuid!, + createdTime: + context.millisecondsSinceEpoch(), + lastModifiedBy: + RegistrationDeliverySingleton() + .loggedInUserUuid, + lastModifiedTime: + context.millisecondsSinceEpoch(), + ), + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ ...?householdModel - .additionalFields?.fields + ?.additionalFields?.fields .where((e) => e.key != AdditionalFieldsType @@ -249,94 +155,79 @@ class HouseDetailsPageState extends LocalizedState { noOfRooms, ) ])); - // TODO [Linking of Voucher for Household based project need to be handled] - if (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) { - bloc.add( - BeneficiaryRegistrationUpdateHouseholdDetailsEvent( - household: houseModel.copyWith( - clientAuditDetails: (address - .clientAuditDetails - ?.createdBy != - null && - address.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: address - .clientAuditDetails! - .createdBy, - createdTime: address - .clientAuditDetails! - .createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: context - .millisecondsSinceEpoch(), - ) - : null, - ), - addressModel: address.copyWith( - clientAuditDetails: (address - .clientAuditDetails - ?.createdBy != - null && - address.clientAuditDetails - ?.createdTime != - null) - ? ClientAuditDetails( - createdBy: address - .clientAuditDetails! - .createdBy, - createdTime: address - .clientAuditDetails! - .createdTime, - lastModifiedBy: - RegistrationDeliverySingleton() - .loggedInUserUuid, - lastModifiedTime: context - .millisecondsSinceEpoch(), - ) - : null, - ), - ), - ); - } else { - bloc.add( - BeneficiaryRegistrationSaveHouseDetailsEvent( - model: houseModel, - ), - ); - router.push(HouseHoldDetailsRoute()); - } - }, + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, + ), ); + router.push(HouseHoldDetailsRoute()); }, - type: DigitButtonType.primary, - size: DigitButtonSize.large, - mainAxisSize: MainAxisSize.max, - label: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? registrationState.mapOrNull( - editHousehold: (value) => - localizations.translate( - i18.common.coreCommonSave), - ) ?? - localizations.translate( - i18.householdDetails.actionLabel) - : localizations.translate( - i18.householdDetails.actionLabel), - ), - ]), - slivers: [ - SliverToBoxAdapter( - child: DigitCard(children: [ + editHousehold: ( + address, + householdModel, + individuals, + registrationDate, + projectBeneficiaryModel, + loading, + headOfHousehold, + ) { + var houseModel = householdModel.copyWith( + additionalFields: + HouseholdAdditionalFields( + version: 1, + fields: [ + ...?householdModel + .additionalFields?.fields + .where((e) => + e.key != + AdditionalFieldsType + .houseStructureTypes + .toValue() && + e.key != + AdditionalFieldsType + .noOfRooms + .toValue()), + AdditionalField( + AdditionalFieldsType + .houseStructureTypes + .toValue(), + selectedHouseStructureTypes + ?.join("|") + .toString(), + ), + AdditionalField( + AdditionalFieldsType.noOfRooms + .toValue(), + noOfRooms, + ) + ])); + // TODO [Linking of Voucher for Household based project need to be handled] + + bloc.add( + BeneficiaryRegistrationSaveHouseDetailsEvent( + model: houseModel, + ), + ); + router.push(HouseHoldDetailsRoute()); + }, + ); + }, + type: DigitButtonType.primary, + size: DigitButtonSize.large, + mainAxisSize: MainAxisSize.max, + label: localizations.translate( + i18.householdLocation.actionLabel, + ), + ), + ]), + slivers: [ + SliverToBoxAdapter( + child: DigitCard( + margin: const EdgeInsets.all(spacer2), + children: [ Padding( - padding: const EdgeInsets.all(spacer2), + padding: const EdgeInsets.all(0), child: Text( localizations.translate( i18.householdDetails.houseDetailsLabel, @@ -346,8 +237,8 @@ class HouseDetailsPageState extends LocalizedState { ), houseShowcaseData.typeOfStructure.buildWith( child: SelectionCard( - isRequired: true, showParentContainer: true, + isRequired: true, title: localizations.translate( i18.householdDetails.typeOfStructure), equalWidthOptions: true, @@ -426,13 +317,11 @@ class HouseDetailsPageState extends LocalizedState { ), ), ]), - ), - ], - ); - }, - )), - ); - }, + ), + ], + ); + }, + )), ); } diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index c12bbfc67b..454a00ddf7 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -1,5 +1,4 @@ import 'package:auto_route/auto_route.dart'; -import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/utils/date_utils.dart'; import 'package:digit_ui_components/widgets/atoms/label_value_list.dart'; @@ -8,7 +7,6 @@ import 'package:digit_ui_components/widgets/molecules/digit_card.dart'; import 'package:digit_ui_components/widgets/molecules/label_value_summary.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:recase/recase.dart'; import 'package:registration_delivery/models/entities/additional_fields_type.dart'; import 'package:registration_delivery/router/registration_delivery_router.gm.dart'; import 'package:registration_delivery/widgets/back_navigation_help_header.dart'; @@ -233,63 +231,61 @@ class SummaryPageState extends LocalizedState { ), ]), ]), - if (RegistrationDeliverySingleton().householdType != - HouseholdType.community) - DigitCard( - margin: const EdgeInsets.all(spacer2), - children: [ - LabelValueSummary( - padding: EdgeInsets.zero, - heading: localizations.translate(i18 - .householdDetails.householdDetailsLabel), - items: [ - LabelValueItem( - label: localizations.translate( - i18.beneficiaryDetails.totalMembers), - value: householdState - .householdModel?.memberCount - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - ), - LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfPregnantWomenCountLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .pregnantWomen - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - ), - LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfChildrenBelow5YearsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.children - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - ), - ]), - ]), + DigitCard( + margin: const EdgeInsets.all(spacer2), + children: [ + LabelValueSummary( + padding: EdgeInsets.zero, + heading: localizations.translate( + i18.householdDetails.householdDetailsLabel), + items: [ + LabelValueItem( + label: localizations.translate( + i18.beneficiaryDetails.totalMembers), + value: householdState + .householdModel?.memberCount + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), + LabelValueItem( + label: localizations.translate(i18 + .householdDetails + .noOfPregnantWomenCountLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .pregnantWomen + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), + LabelValueItem( + label: localizations.translate(i18 + .householdDetails + .noOfChildrenBelow5YearsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.children + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + ), + ]), + ]), DigitCard( margin: const EdgeInsets.all(spacer2), children: [ From 99f557060e7e8815ddb7060c8cf2173b3334bfb4 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Mon, 30 Dec 2024 15:52:57 +0530 Subject: [PATCH 31/47] build and review comment fix --- packages/digit_data_model/pubspec.lock | 667 +++++++++++++++++- .../pages/beneficiary/household_overview.dart | 2 +- 2 files changed, 667 insertions(+), 2 deletions(-) diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index 52da34c0e0..b373ccae8d 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + archive: + dependency: transitive + description: + name: archive + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d + url: "https://pub.dev" + source: hosted + version: "3.6.1" args: dependency: transitive description: @@ -137,6 +145,46 @@ packages: url: "https://pub.dev" source: hosted version: "8.9.2" + camera: + dependency: transitive + description: + name: camera + sha256: "26ff41045772153f222ffffecba711a206f670f5834d40ebf5eed3811692f167" + url: "https://pub.dev" + source: hosted + version: "0.11.0+2" + camera_android_camerax: + dependency: transitive + description: + name: camera_android_camerax + sha256: "011be2ab0e5b3e3aa8094413fa890f8c5c5afd7cfdaef353a992047d4dab5780" + url: "https://pub.dev" + source: hosted + version: "0.6.8+2" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + sha256: "2e4c568f70e406ccb87376bc06b53d2f5bebaab71e2fbcc1a950e31449381bcf" + url: "https://pub.dev" + source: hosted + version: "0.9.17+5" + camera_platform_interface: + dependency: transitive + description: + name: camera_platform_interface + sha256: b3ede1f171532e0d83111fe0980b46d17f1aa9788a07a2fbed07366bbdbb9061 + url: "https://pub.dev" + source: hosted + version: "2.8.0" + camera_web: + dependency: transitive + description: + name: camera_web + sha256: "595f28c89d1fb62d77c73c633193755b781c6d2e0ebcd8dc25b763b514e6ba8f" + url: "https://pub.dev" + source: hosted + version: "0.3.5" characters: dependency: transitive description: @@ -209,6 +257,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" crypto: dependency: transitive description: @@ -217,6 +273,22 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: transitive + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" dart_mappable: dependency: "direct main" description: @@ -258,6 +330,21 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" + digit_components: + dependency: "direct overridden" + description: + path: "../digit_components" + relative: true + source: path + version: "1.0.3" + digit_ui_components: + dependency: "direct main" + description: + name: digit_ui_components + sha256: "57c4da5237be6025783e7357a02b6b492f02e38f711d674bf46f5f8c8a93ad76" + url: "https://pub.dev" + source: hosted + version: "0.0.2-dev.4" dio: dependency: "direct main" description: @@ -266,6 +353,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.4.3+1" + dotted_border: + dependency: transitive + description: + name: dotted_border + sha256: "108837e11848ca776c53b30bc870086f84b62ed6e01c503ed976e8f8c7df9c04" + url: "https://pub.dev" + source: hosted + version: "2.1.0" drift: dependency: "direct main" description: @@ -282,6 +377,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.18.0" + easy_stepper: + dependency: transitive + description: + name: easy_stepper + sha256: "63f66314a509ec690c8152a41288961fd96ba9e92ef184299f068a5e78bd16ad" + url: "https://pub.dev" + source: hosted + version: "0.8.5+1" fake_async: dependency: transitive description: @@ -306,6 +409,46 @@ packages: url: "https://pub.dev" source: hosted version: "6.1.4" + file_picker: + dependency: transitive + description: + name: file_picker + sha256: "2ca051989f69d1b2ca012b2cf3ccf78c70d40144f0861ff2c063493f7c8c3d45" + url: "https://pub.dev" + source: hosted + version: "8.0.5" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "271ab9986df0c135d45c3cdb6bd0faa5db6f4976d3e4b437cf7d0f258d941bfc" + url: "https://pub.dev" + source: hosted + version: "0.9.4+2" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "8f5d2f6590d51ecd9179ba39c64f722edc15226cc93dcc8698466ad36a4a85a4" + url: "https://pub.dev" + source: hosted + version: "0.9.3+3" fixnum: dependency: transitive description: @@ -327,6 +470,86 @@ packages: url: "https://pub.dev" source: hosted version: "8.1.5" + flutter_dropzone: + dependency: transitive + description: + name: flutter_dropzone + sha256: b399c60411f9bf9c4c2f97933c6a3a185859e75aade8897831e76cee4346c8e1 + url: "https://pub.dev" + source: hosted + version: "3.0.7" + flutter_dropzone_platform_interface: + dependency: transitive + description: + name: flutter_dropzone_platform_interface + sha256: "96d2c51c86063ba150551c3b40fd26c5a18785bee071c0c751502d28a545df3b" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter_dropzone_web: + dependency: transitive + description: + name: flutter_dropzone_web + sha256: c5a0fdb63b7216352a01761ec1b6eba1982e49541e60675735e2d3d95e207b19 + url: "https://pub.dev" + source: hosted + version: "3.0.13" + flutter_focus_watcher: + dependency: transitive + description: + name: flutter_focus_watcher + sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility: + dependency: transitive + description: + name: flutter_keyboard_visibility + sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" + url: "https://pub.dev" + source: hosted + version: "5.4.1" + flutter_keyboard_visibility_linux: + dependency: transitive + description: + name: flutter_keyboard_visibility_linux + sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_macos: + dependency: transitive + description: + name: flutter_keyboard_visibility_macos + sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 + url: "https://pub.dev" + source: hosted + version: "1.0.0" + flutter_keyboard_visibility_platform_interface: + dependency: transitive + description: + name: flutter_keyboard_visibility_platform_interface + sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_web: + dependency: transitive + description: + name: flutter_keyboard_visibility_web + sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + flutter_keyboard_visibility_windows: + dependency: transitive + description: + name: flutter_keyboard_visibility_windows + sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -335,11 +558,69 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + flutter_localizations: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda" + url: "https://pub.dev" + source: hosted + version: "2.0.22" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: d2696eed13732831414595b98863260e33e8882fc069ee80ec35d4ac9ddb0472 + url: "https://pub.dev" + source: hosted + version: "5.2.1" + flutter_styled_toast: + dependency: transitive + description: + name: flutter_styled_toast + sha256: e667f13a665820eb0fa8506547e47eacbcddf1948d6d3036cfd3b089bd4b0516 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + flutter_svg: + dependency: transitive + description: + name: flutter_svg + sha256: "54900a1a1243f3c4a5506d853a2b5c2dbc38d5f27e52a52618a8054401431123" + url: "https://pub.dev" + source: hosted + version: "2.0.16" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_typeahead: + dependency: transitive + description: + name: flutter_typeahead + sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: transitive + description: + name: fluttertoast + sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc" + url: "https://pub.dev" + source: hosted + version: "8.2.8" freezed: dependency: "direct dev" description: @@ -364,6 +645,54 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + geolocator: + dependency: transitive + description: + name: geolocator + sha256: f4efb8d3c4cdcad2e226af9661eb1a0dd38c71a9494b22526f9da80ab79520e5 + url: "https://pub.dev" + source: hosted + version: "10.1.1" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" + url: "https://pub.dev" + source: hosted + version: "4.6.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: "6154ea2682563f69fc0125762ed7e91e7ed85d0b9776595653be33918e064807" + url: "https://pub.dev" + source: hosted + version: "2.3.8+1" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" + url: "https://pub.dev" + source: hosted + version: "0.2.3" glob: dependency: transitive description: @@ -372,6 +701,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_fonts: + dependency: transitive + description: + name: google_fonts + sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 + url: "https://pub.dev" + source: hosted + version: "6.2.1" graphs: dependency: transitive description: @@ -380,6 +717,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + horizontal_data_table: + dependency: transitive + description: + name: horizontal_data_table + sha256: c8ab5256bbced698a729f3e0ff2cb0e8e97416cdbb082860370eaf883badf722 + url: "https://pub.dev" + source: hosted + version: "4.3.1" + html: + dependency: transitive + description: + name: html + sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec" + url: "https://pub.dev" + source: hosted + version: "0.15.5" + http: + dependency: transitive + description: + name: http + sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + url: "https://pub.dev" + source: hosted + version: "1.2.2" http_multi_server: dependency: transitive description: @@ -396,6 +757,78 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + image_picker: + dependency: transitive + description: + name: image_picker + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56" + url: "https://pub.dev" + source: hosted + version: "0.8.12+12" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: "4f0568120c6fcc0aaa04511cb9f9f4d29fc3d0139884b1d06be88dcec7641d6b" + url: "https://pub.dev" + source: hosted + version: "0.8.12+1" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" + url: "https://pub.dev" + source: hosted + version: "2.10.0" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb" + url: "https://pub.dev" + source: hosted + version: "0.2.1+1" + intl: + dependency: transitive + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" io: dependency: transitive description: @@ -484,6 +917,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + location: + dependency: transitive + description: + name: location + sha256: "37ffdadcd4b1498b769824f45ebb4de8ed46663a4a67ac27b33a590ee486579f" + url: "https://pub.dev" + source: hosted + version: "6.0.2" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "2ecde6bb0f88032b0bbbde37e18975b4468711dd92619c2235cc0c0ee93b4b8e" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + location_web: + dependency: transitive + description: + name: location_web + sha256: "49dda13d415c4603c5775a33fb22f575e0aa3f0ec2916644ddcd722db31ee884" + url: "https://pub.dev" + source: hosted + version: "5.0.2" logging: dependency: transitive description: @@ -492,6 +949,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + lottie: + dependency: transitive + description: + name: lottie + sha256: "7afc60865a2429d994144f7d66ced2ae4305fe35d82890b8766e3359872d872c" + url: "https://pub.dev" + source: hosted + version: "3.1.3" matcher: dependency: transitive description: @@ -548,6 +1013,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" + overlay_builder: + dependency: transitive + description: + name: overlay_builder + sha256: "58b97bc5f67a2e2bb7006dd88e697ac757dfffc9dbd1e7dfc1917fb510a4b5c8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" package_config: dependency: transitive description: @@ -556,6 +1029,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 + url: "https://pub.dev" + source: hosted + version: "8.0.2" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b + url: "https://pub.dev" + source: hosted + version: "3.0.2" path: dependency: "direct main" description: @@ -564,6 +1053,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + path_drawing: + dependency: transitive + description: + name: path_drawing + sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977 + url: "https://pub.dev" + source: hosted + version: "1.0.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" path_provider: dependency: "direct main" description: @@ -612,6 +1117,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" platform: dependency: transitive description: @@ -628,6 +1141,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pointer_interceptor: + dependency: transitive + description: + name: pointer_interceptor + sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 + url: "https://pub.dev" + source: hosted + version: "0.9.3+7" pool: dependency: transitive description: @@ -660,6 +1181,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" + reactive_flutter_typeahead: + dependency: transitive + description: + name: reactive_flutter_typeahead + sha256: a5dbca4b537bd9dde245d4228e1a6ce937c05cd77c57ed45b9c05135540d5f1a + url: "https://pub.dev" + source: hosted + version: "2.1.1" + reactive_forms: + dependency: transitive + description: + name: reactive_forms + sha256: "9b1fb18e0aae9c50cfa0aaabaaa38bc4d78eefc9b7b95fa9c947b051f6524b8e" + url: "https://pub.dev" + source: hosted + version: "17.0.1" recase: dependency: "direct main" description: @@ -668,6 +1205,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" + remove_emoji_input_formatter: + dependency: transitive + description: + name: remove_emoji_input_formatter + sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" + url: "https://pub.dev" + source: hosted + version: "0.0.1+1" shelf: dependency: transitive description: @@ -873,6 +1418,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + universal_html: + dependency: transitive + description: + name: universal_html + sha256: "56536254004e24d9d8cfdb7dbbf09b74cf8df96729f38a2f5c238163e3d58971" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + url_launcher: + dependency: transitive + description: + name: url_launcher + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" + url: "https://pub.dev" + source: hosted + version: "6.3.1" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 + url: "https://pub.dev" + source: hosted + version: "6.3.9" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626" + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" + url: "https://pub.dev" + source: hosted + version: "3.2.2" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" + url: "https://pub.dev" + source: hosted + version: "3.1.3" uuid: dependency: "direct main" description: @@ -881,6 +1506,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.5.1" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "27d5fefe86fb9aace4a9f8375b56b3c292b64d8c04510df230f849850d912cb7" + url: "https://pub.dev" + source: hosted + version: "1.1.15" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "2430b973a4ca3c4dbc9999b62b8c719a160100dcbae5c819bae0cacce32c9cdb" + url: "https://pub.dev" + source: hosted + version: "1.1.12" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad" + url: "https://pub.dev" + source: hosted + version: "1.1.16" vector_math: dependency: transitive description: @@ -889,6 +1538,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" vm_service: dependency: transitive description: @@ -945,6 +1602,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" xxh3: dependency: transitive description: @@ -963,4 +1628,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.4.0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + flutter: ">=3.22.0" diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index fc8745a101..ba021fad0d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -189,7 +189,7 @@ class _HouseholdOverviewPageState : DigitButton( label: localizations.translate( i18.householdOverView - .householdOverViewActionText, + .householdOverViewEditLabel, ), type: DigitButtonType.primary, size: DigitButtonSize.large, From d95ddaa65c1c9ffadc0c8a36f673d7eb3138f079 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Wed, 8 Jan 2025 16:26:09 +0530 Subject: [PATCH 32/47] resolved review comments --- .../lib/models/downsync/downsync.mapper.dart | 7 - .../pubspec.lock | 27 ++-- .../pubspec.yaml | 6 +- packages/digit_data_model/pubspec.lock | 127 ------------------ .../household_overview.dart | 2 +- .../beneficiary/beneficiary_wrapper.dart | 3 - .../pages/beneficiary/household_overview.dart | 3 +- .../household_location.dart | 2 - packages/registration_delivery/pubspec.lock | 2 +- 9 files changed, 22 insertions(+), 157 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart index 97408aac71..41a7184bee 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart @@ -14,7 +14,6 @@ class DownsyncSearchModelMapper static DownsyncSearchModelMapper ensureInitialized() { if (_instance == null) { MapperContainer.globals.use(_instance = DownsyncSearchModelMapper._()); - EntitySearchModelMapper.ensureInitialized().addSubMapper(_instance!); } return _instance!; } @@ -222,10 +221,6 @@ class DownsyncModelMapper extends SubClassMapperBase { static DownsyncModelMapper ensureInitialized() { if (_instance == null) { MapperContainer.globals.use(_instance = DownsyncModelMapper._()); - EntityModelMapper.ensureInitialized().addSubMapper(_instance!); - DownsyncAdditionalFieldsMapper.ensureInitialized(); - AuditDetailsMapper.ensureInitialized(); - ClientAuditDetailsMapper.ensureInitialized(); } return _instance!; } @@ -494,8 +489,6 @@ class DownsyncAdditionalFieldsMapper if (_instance == null) { MapperContainer.globals .use(_instance = DownsyncAdditionalFieldsMapper._()); - AdditionalFieldsMapper.ensureInitialized().addSubMapper(_instance!); - AdditionalFieldMapper.ensureInitialized(); } return _instance!; } diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index dff3b37361..9a1c68655f 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -444,11 +444,12 @@ packages: dart_mappable_builder: dependency: "direct dev" description: - name: dart_mappable_builder - sha256: "04a6e7117382f8a8689b3e363bee6c3de8c9ea4332e664148fe01bd576eb1126" - url: "https://pub.dev" - source: hosted - version: "4.3.0" + path: "packages/dart_mappable_builder" + ref: master + resolved-ref: ab088b8fc21a07ed7a56bf81c935ee51481ad253 + url: "https://github.com/egovernments/health-campaign-field-worker-app/" + source: git + version: "4.2.3" dart_style: dependency: transitive description: @@ -516,11 +517,10 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: c3bc7299a7d927ebb83d8e91c1d7a8a51f6a1d1295dafeacb642012b72b99a2f - url: "https://pub.dev" - source: hosted - version: "1.0.5" + path: "../../packages/digit_data_model" + relative: true + source: path + version: "1.0.5+1" digit_dss: dependency: "direct main" description: @@ -1855,10 +1855,9 @@ packages: registration_delivery: dependency: "direct main" description: - name: registration_delivery - sha256: "4dd6e6781e367edf806d838e58771dff838eeff0d444534079a468789cadfbcb" - url: "https://pub.dev" - source: hosted + path: "../../packages/registration_delivery" + relative: true + source: path version: "1.0.5+2" remove_emoji_input_formatter: dependency: transitive diff --git a/apps/health_campaign_field_worker_app/pubspec.yaml b/apps/health_campaign_field_worker_app/pubspec.yaml index c85e790ba1..35e6eb2025 100644 --- a/apps/health_campaign_field_worker_app/pubspec.yaml +++ b/apps/health_campaign_field_worker_app/pubspec.yaml @@ -85,7 +85,11 @@ dev_dependencies: auto_route_generator: ^8.0.0 bloc_test: ^9.1.0 mocktail: ^1.0.2 - dart_mappable_builder: ^4.2.2 + dart_mappable_builder: + git: + url: https://github.com/egovernments/health-campaign-field-worker-app/ + ref: master + path: ./packages/dart_mappable_builder isar_generator: ^3.1.0+1 flutter_launcher_icons: ^0.13.1 hrk_flutter_test_batteries: ^0.8.0 diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index b373ccae8d..65e91fe916 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -281,14 +281,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" dart_mappable: dependency: "direct main" description: @@ -330,13 +322,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" - digit_components: - dependency: "direct overridden" - description: - path: "../digit_components" - relative: true - source: path - version: "1.0.3" digit_ui_components: dependency: "direct main" description: @@ -377,14 +362,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.18.0" - easy_stepper: - dependency: transitive - description: - name: easy_stepper - sha256: "63f66314a509ec690c8152a41288961fd96ba9e92ef184299f068a5e78bd16ad" - url: "https://pub.dev" - source: hosted - version: "0.8.5+1" fake_async: dependency: transitive description: @@ -494,62 +471,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.13" - flutter_focus_watcher: - dependency: transitive - description: - name: flutter_focus_watcher - sha256: a72ee539ae0237961308a25839887ca93a0b1cb6f87b0d492b139c8fccff8e79 - url: "https://pub.dev" - source: hosted - version: "2.0.0" - flutter_keyboard_visibility: - dependency: transitive - description: - name: flutter_keyboard_visibility - sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb" - url: "https://pub.dev" - source: hosted - version: "5.4.1" - flutter_keyboard_visibility_linux: - dependency: transitive - description: - name: flutter_keyboard_visibility_linux - sha256: "6fba7cd9bb033b6ddd8c2beb4c99ad02d728f1e6e6d9b9446667398b2ac39f08" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - flutter_keyboard_visibility_macos: - dependency: transitive - description: - name: flutter_keyboard_visibility_macos - sha256: c5c49b16fff453dfdafdc16f26bdd8fb8d55812a1d50b0ce25fc8d9f2e53d086 - url: "https://pub.dev" - source: hosted - version: "1.0.0" - flutter_keyboard_visibility_platform_interface: - dependency: transitive - description: - name: flutter_keyboard_visibility_platform_interface - sha256: e43a89845873f7be10cb3884345ceb9aebf00a659f479d1c8f4293fcb37022a4 - url: "https://pub.dev" - source: hosted - version: "2.0.0" - flutter_keyboard_visibility_web: - dependency: transitive - description: - name: flutter_keyboard_visibility_web - sha256: d3771a2e752880c79203f8d80658401d0c998e4183edca05a149f5098ce6e3d1 - url: "https://pub.dev" - source: hosted - version: "2.0.0" - flutter_keyboard_visibility_windows: - dependency: transitive - description: - name: flutter_keyboard_visibility_windows - sha256: fc4b0f0b6be9b93ae527f3d527fb56ee2d918cd88bbca438c478af7bcfd0ef73 - url: "https://pub.dev" - source: hosted - version: "1.0.0" flutter_lints: dependency: "direct dev" description: @@ -600,14 +521,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_typeahead: - dependency: transitive - description: - name: flutter_typeahead - sha256: b9942bd5b7611a6ec3f0730c477146cffa4cd4b051077983ba67ddfc9e7ee818 - url: "https://pub.dev" - source: hosted - version: "4.8.0" flutter_web_plugins: dependency: transitive description: flutter @@ -1029,22 +942,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" - package_info_plus: - dependency: transitive - description: - name: package_info_plus - sha256: a75164ade98cb7d24cfd0a13c6408927c6b217fa60dee5a7ff5c116a58f28918 - url: "https://pub.dev" - source: hosted - version: "8.0.2" - package_info_plus_platform_interface: - dependency: transitive - description: - name: package_info_plus_platform_interface - sha256: a5ef9986efc7bf772f2696183a3992615baa76c1ffb1189318dd8803778fb05b - url: "https://pub.dev" - source: hosted - version: "3.0.2" path: dependency: "direct main" description: @@ -1141,14 +1038,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" - pointer_interceptor: - dependency: transitive - description: - name: pointer_interceptor - sha256: adf7a637f97c077041d36801b43be08559fd4322d2127b3f20bb7be1b9eebc22 - url: "https://pub.dev" - source: hosted - version: "0.9.3+7" pool: dependency: transitive description: @@ -1181,14 +1070,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - reactive_flutter_typeahead: - dependency: transitive - description: - name: reactive_flutter_typeahead - sha256: a5dbca4b537bd9dde245d4228e1a6ce937c05cd77c57ed45b9c05135540d5f1a - url: "https://pub.dev" - source: hosted - version: "2.1.1" reactive_forms: dependency: transitive description: @@ -1205,14 +1086,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" - remove_emoji_input_formatter: - dependency: transitive - description: - name: remove_emoji_input_formatter - sha256: "82d195984f890de7a8fea936c698848e78c1a67ccefe18db3baf9f7a3bc0177f" - url: "https://pub.dev" - source: hosted - version: "0.0.1+1" shelf: dependency: transitive description: diff --git a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart index 35a3b2af71..705485a6ef 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -272,7 +272,7 @@ class HouseholdOverviewBloc offset: members.isNotEmpty ? (event.offset ?? 0) + (event.limit ?? 10) : null, - // limit: event.limit, + limit: event.limit, ), ); } else { diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart index 2fe8488730..538f250f0b 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_wrapper.dart @@ -58,9 +58,6 @@ class BeneficiaryWrapperPage extends StatelessWidget { final referral = context.repository(context); - final serviceDefinationRepo = context.repository(context); - final individualGlobalSearchRepository = context.read(); diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index ba021fad0d..ef223842e7 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -395,6 +395,8 @@ class _HouseholdOverviewPageState capitalizeLetters: false, ), ), + + ///Old UI Format // BlocBuilder( // builder: (ctx, deliverInterventionState) => @@ -440,7 +442,6 @@ class _HouseholdOverviewPageState ), ), ), - Padding( padding: const EdgeInsets.only( left: spacer2, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index fd670772cb..be7c2c750b 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -347,8 +347,6 @@ class HouseholdLocationPageState extends LocalizedState { ), ), ), - - ///[TODO]: NEED TO REMOVE THIS if (RegistrationDeliverySingleton().householdType == HouseholdType.community) householdLocationShowcaseData.buildingName.buildWith( diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index c9889bd74d..bb18f682ad 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -408,7 +408,7 @@ packages: path: "../digit_data_model" relative: true source: path - version: "1.0.5-dev.1" + version: "1.0.5+1" digit_scanner: dependency: "direct main" description: From 644540808b739a76c2f42613da8af4868440d52a Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 21 Jan 2025 10:42:21 +0530 Subject: [PATCH 33/47] integrate clf downysnc api --- .../project_beneficiaries_downsync.dart | 185 ++++- ...roject_beneficiaries_downsync.freezed.dart | 684 ++++++++++++++++++ .../data/repositories/remote/downsync.dart | 116 +++ .../lib/models/downsync/downsync.dart | 26 +- .../lib/models/downsync/downsync.mapper.dart | 18 + .../lib/models/entities/roles_type.dart | 26 +- .../models/entities/roles_type.mapper.dart | 4 + .../lib/pages/authenticated.dart | 6 +- .../lib/pages/boundary_selection.dart | 268 +++---- .../beneficiary/beneficaries_report.dart | 94 ++- .../lib/utils/utils.dart | 46 +- 11 files changed, 1263 insertions(+), 210 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index 61c278aeb2..7521fe790e 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -11,6 +11,7 @@ import 'package:sync_service/sync_service_lib.dart'; import '../../data/local_store/no_sql/schema/app_configuration.dart'; import '../../data/local_store/secure_store/secure_store.dart'; import '../../data/repositories/remote/bandwidth_check.dart'; +import '../../data/repositories/remote/downsync.dart'; import '../../models/downsync/downsync.dart'; import '../../utils/background_service.dart'; import '../../utils/environment_config.dart'; @@ -23,20 +24,19 @@ class BeneficiaryDownSyncBloc extends Bloc { final LocalRepository individualLocalRepository; - final RemoteRepository - downSyncRemoteRepository; + final DownsyncRemoteRepository downSyncRemoteRepository; final LocalRepository downSyncLocalRepository; final BandwidthCheckRepository bandwidthCheckRepository; final LocalRepository - householdLocalRepository; + householdLocalRepository; final LocalRepository - householdMemberLocalRepository; + householdMemberLocalRepository; final LocalRepository - projectBeneficiaryLocalRepository; + projectBeneficiaryLocalRepository; final LocalRepository taskLocalRepository; final LocalRepository - sideEffectLocalRepository; + sideEffectLocalRepository; final LocalRepository referralLocalRepository; BeneficiaryDownSyncBloc({ @@ -56,6 +56,8 @@ class BeneficiaryDownSyncBloc on(_handleDownSyncResetState); on(_handleDownSyncReport); on(_handleCheckBandWidth); + on(_handleClfTotalCount); + on(_handleDownSyncOfClf); } FutureOr _handleDownSyncResetState( @@ -267,6 +269,161 @@ class BeneficiaryDownSyncBloc final result = await downSyncLocalRepository.search(DownsyncSearchModel()); emit(BeneficiaryDownSyncState.report(result)); } + + FutureOr _handleDownSyncOfClf(DownSyncOfClfBeneficiaryEvent event, + BeneficiaryDownSyncEmitter emit) async { + emit(const BeneficiaryDownSyncState.loading(true)); + double? diskSpace = 0; + diskSpace = await DiskSpace + .getFreeDiskSpace; // Returns the device available space in MB + // diskSpace in MB * 1000 comparison with serverTotalCount * 150KB * Number of entities * 2 + if ((diskSpace ?? 0) * 1000 < (event.initialServerCount * 150 * 2)) { + emit(const BeneficiaryDownSyncState.insufficientStorage()); + } else { + try { + while (true) { + // Check each time, till the loop runs the offset, limit, totalCount, lastSyncTime from Local DB of DownSync Model + final existingDownSyncData = + await downSyncLocalRepository.search(DownsyncSearchModel( + locality: event.boundaryCode, + )); + + int offset = existingDownSyncData.isEmpty + ? 0 + : existingDownSyncData.first.offset ?? 0; + int totalCount = event.initialServerCount; + int? lastSyncedTime = existingDownSyncData.isEmpty + ? null + : existingDownSyncData.first.lastSyncedTime; + + if (existingDownSyncData.isEmpty) { + await downSyncLocalRepository.create(DownsyncModel( + offset: offset, + limit: event.batchSize, + lastSyncedTime: lastSyncedTime, + totalCount: totalCount, + locality: event.boundaryCode, + boundaryName: event.boundaryName, + )); + } + + if (offset < totalCount) { + emit(BeneficiaryDownSyncState.inProgress(offset, totalCount)); + + final downSyncResults = await downSyncRemoteRepository + .searchClfDownSync(DownsyncSearchModel( + locality: event.boundaryCode, + offset: offset, + limit: event.batchSize, + totalCount: totalCount, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + lastSyncedTime: lastSyncedTime, + isDeleted: true, + )); + + if (downSyncResults.isNotEmpty) { + final householdList = downSyncResults["Households"] as List; + + householdList.forEach((e) async { + int memberOffset = 0; + while (true) { + final memberData = await downSyncRemoteRepository + .getMemberData(DownsyncSearchModel( + locality: event.boundaryCode, + offset: memberOffset, + limit: event.batchSize, + totalCount: totalCount, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + lastSyncedTime: lastSyncedTime, + isDeleted: true, + householdId: (e as HouseholdModel).id, + )); + + if (memberData.isEmpty) break; + memberData["Households"].add([e]); + await SyncServiceSingleton() + .entityMapper + ?.writeToEntityDB(memberData, [ + individualLocalRepository, + householdLocalRepository, + householdMemberLocalRepository, + projectBeneficiaryLocalRepository, + taskLocalRepository, + sideEffectLocalRepository, + referralLocalRepository, + ]); + memberOffset += event.batchSize; + } + }); + } + + totalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; + + await downSyncLocalRepository.update(DownsyncModel( + offset: offset + event.batchSize, + limit: event.batchSize, + lastSyncedTime: lastSyncedTime, + totalCount: totalCount, + locality: event.boundaryCode, + boundaryName: event.boundaryName, + )); + } else { + emit(const BeneficiaryDownSyncState.failed()); + await LocalSecureStore.instance.setManualSyncTrigger(false); + break; + } + } + } catch (e) { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.failed()); + } + } + } + + FutureOr _handleClfTotalCount(DownSyncCheckTotalCountEvent event, + BeneficiaryDownSyncEmitter emit) async { + if (event.pendingSyncCount > 0) { + emit(const BeneficiaryDownSyncState.loading(true)); + emit(const BeneficiaryDownSyncState.pendingSync()); + } else { + emit(const BeneficiaryDownSyncState.loading(true)); + await LocalSecureStore.instance.setManualSyncTrigger(true); + final existingDownSyncData = + await downSyncLocalRepository.search(DownsyncSearchModel( + locality: event.boundaryCode, + )); + + int? lastSyncedTime = existingDownSyncData.isEmpty + ? null + : existingDownSyncData.first.lastSyncedTime; + + //To get the server totalCount + final initialResults = + await downSyncRemoteRepository.searchClfDownSync(DownsyncSearchModel( + locality: event.boundaryCode, + offset: existingDownSyncData.firstOrNull?.offset ?? 0, + limit: 1, + isDeleted: true, + lastSyncedTime: lastSyncedTime, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + )); + + if (initialResults.isNotEmpty) { + int serverTotalCount = + initialResults["Households"]["DownsyncCriteria"]["totalCount"]; + + emit(BeneficiaryDownSyncState.dataFound( + serverTotalCount, event.batchSize)); + } else { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.resetState()); + emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + } + } + } } @freezed @@ -279,6 +436,14 @@ class BeneficiaryDownSyncEvent with _$BeneficiaryDownSyncEvent { required String boundaryName, }) = DownSyncBeneficiaryEvent; + const factory BeneficiaryDownSyncEvent.downSyncCLF({ + required String projectId, + required String boundaryCode, + required int batchSize, + required int initialServerCount, + required String boundaryName, + }) = DownSyncOfClfBeneficiaryEvent; + const factory BeneficiaryDownSyncEvent.checkForData({ required String projectId, required String boundaryCode, @@ -287,6 +452,14 @@ class BeneficiaryDownSyncEvent with _$BeneficiaryDownSyncEvent { required String boundaryName, }) = DownSyncCheckTotalCountEvent; + const factory BeneficiaryDownSyncEvent.checkForClf({ + required String projectId, + required String boundaryCode, + required int pendingSyncCount, + required int batchSize, + required String boundaryName, + }) = DownSyncClfCheckTotalCountEvent; + const factory BeneficiaryDownSyncEvent.getBatchSize({ required List appConfiguration, required String projectId, diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart index 092150d1b5..63ee99fbd4 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart @@ -21,9 +21,15 @@ mixin _$BeneficiaryDownSyncEvent { required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -40,9 +46,15 @@ mixin _$BeneficiaryDownSyncEvent { TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -55,9 +67,15 @@ mixin _$BeneficiaryDownSyncEvent { TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -69,7 +87,10 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -78,7 +99,9 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -87,7 +110,9 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -234,9 +259,15 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -257,9 +288,15 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -276,9 +313,15 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -297,7 +340,10 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -309,7 +355,9 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -321,7 +369,9 @@ class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -352,6 +402,273 @@ abstract class DownSyncBeneficiaryEvent implements BeneficiaryDownSyncEvent { get copyWith => throw _privateConstructorUsedError; } +/// @nodoc +abstract class _$$DownSyncOfClfBeneficiaryEventImplCopyWith<$Res> { + factory _$$DownSyncOfClfBeneficiaryEventImplCopyWith( + _$DownSyncOfClfBeneficiaryEventImpl value, + $Res Function(_$DownSyncOfClfBeneficiaryEventImpl) then) = + __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl<$Res>; + @useResult + $Res call( + {String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + String boundaryName}); +} + +/// @nodoc +class __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl<$Res> + extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, + _$DownSyncOfClfBeneficiaryEventImpl> + implements _$$DownSyncOfClfBeneficiaryEventImplCopyWith<$Res> { + __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl( + _$DownSyncOfClfBeneficiaryEventImpl _value, + $Res Function(_$DownSyncOfClfBeneficiaryEventImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? projectId = null, + Object? boundaryCode = null, + Object? batchSize = null, + Object? initialServerCount = null, + Object? boundaryName = null, + }) { + return _then(_$DownSyncOfClfBeneficiaryEventImpl( + projectId: null == projectId + ? _value.projectId + : projectId // ignore: cast_nullable_to_non_nullable + as String, + boundaryCode: null == boundaryCode + ? _value.boundaryCode + : boundaryCode // ignore: cast_nullable_to_non_nullable + as String, + batchSize: null == batchSize + ? _value.batchSize + : batchSize // ignore: cast_nullable_to_non_nullable + as int, + initialServerCount: null == initialServerCount + ? _value.initialServerCount + : initialServerCount // ignore: cast_nullable_to_non_nullable + as int, + boundaryName: null == boundaryName + ? _value.boundaryName + : boundaryName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DownSyncOfClfBeneficiaryEventImpl + implements DownSyncOfClfBeneficiaryEvent { + const _$DownSyncOfClfBeneficiaryEventImpl( + {required this.projectId, + required this.boundaryCode, + required this.batchSize, + required this.initialServerCount, + required this.boundaryName}); + + @override + final String projectId; + @override + final String boundaryCode; + @override + final int batchSize; + @override + final int initialServerCount; + @override + final String boundaryName; + + @override + String toString() { + return 'BeneficiaryDownSyncEvent.downSyncCLF(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, boundaryName: $boundaryName)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DownSyncOfClfBeneficiaryEventImpl && + (identical(other.projectId, projectId) || + other.projectId == projectId) && + (identical(other.boundaryCode, boundaryCode) || + other.boundaryCode == boundaryCode) && + (identical(other.batchSize, batchSize) || + other.batchSize == batchSize) && + (identical(other.initialServerCount, initialServerCount) || + other.initialServerCount == initialServerCount) && + (identical(other.boundaryName, boundaryName) || + other.boundaryName == boundaryName)); + } + + @override + int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, + batchSize, initialServerCount, boundaryName); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DownSyncOfClfBeneficiaryEventImplCopyWith< + _$DownSyncOfClfBeneficiaryEventImpl> + get copyWith => __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl< + _$DownSyncOfClfBeneficiaryEventImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, + required TResult Function( + List appConfiguration, + String projectId, + String boundaryCode, + int pendingSyncCount, + String boundaryName) + getBatchSize, + required TResult Function() downSyncReport, + required TResult Function() resetState, + }) { + return downSyncCLF( + projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, + TResult? Function(List appConfiguration, String projectId, + String boundaryCode, int pendingSyncCount, String boundaryName)? + getBatchSize, + TResult? Function()? downSyncReport, + TResult? Function()? resetState, + }) { + return downSyncCLF?.call( + projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, + TResult Function(List appConfiguration, String projectId, + String boundaryCode, int pendingSyncCount, String boundaryName)? + getBatchSize, + TResult Function()? downSyncReport, + TResult Function()? resetState, + required TResult orElse(), + }) { + if (downSyncCLF != null) { + return downSyncCLF( + projectId, boundaryCode, batchSize, initialServerCount, boundaryName); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, + required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, + required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, + required TResult Function(DownSyncReportEvent value) downSyncReport, + required TResult Function(DownSyncResetStateEvent value) resetState, + }) { + return downSyncCLF(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, + TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, + TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, + TResult? Function(DownSyncReportEvent value)? downSyncReport, + TResult? Function(DownSyncResetStateEvent value)? resetState, + }) { + return downSyncCLF?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, + TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, + TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, + TResult Function(DownSyncReportEvent value)? downSyncReport, + TResult Function(DownSyncResetStateEvent value)? resetState, + required TResult orElse(), + }) { + if (downSyncCLF != null) { + return downSyncCLF(this); + } + return orElse(); + } +} + +abstract class DownSyncOfClfBeneficiaryEvent + implements BeneficiaryDownSyncEvent { + const factory DownSyncOfClfBeneficiaryEvent( + {required final String projectId, + required final String boundaryCode, + required final int batchSize, + required final int initialServerCount, + required final String boundaryName}) = + _$DownSyncOfClfBeneficiaryEventImpl; + + String get projectId; + String get boundaryCode; + int get batchSize; + int get initialServerCount; + String get boundaryName; + @JsonKey(ignore: true) + _$$DownSyncOfClfBeneficiaryEventImplCopyWith< + _$DownSyncOfClfBeneficiaryEventImpl> + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc abstract class _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { factory _$$DownSyncCheckTotalCountEventImplCopyWith( @@ -473,9 +790,15 @@ class _$DownSyncCheckTotalCountEventImpl required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -496,9 +819,15 @@ class _$DownSyncCheckTotalCountEventImpl TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -515,9 +844,15 @@ class _$DownSyncCheckTotalCountEventImpl TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -536,7 +871,10 @@ class _$DownSyncCheckTotalCountEventImpl @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -548,7 +886,9 @@ class _$DownSyncCheckTotalCountEventImpl @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -560,7 +900,9 @@ class _$DownSyncCheckTotalCountEventImpl @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -593,6 +935,273 @@ abstract class DownSyncCheckTotalCountEvent get copyWith => throw _privateConstructorUsedError; } +/// @nodoc +abstract class _$$DownSyncClfCheckTotalCountEventImplCopyWith<$Res> { + factory _$$DownSyncClfCheckTotalCountEventImplCopyWith( + _$DownSyncClfCheckTotalCountEventImpl value, + $Res Function(_$DownSyncClfCheckTotalCountEventImpl) then) = + __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res>; + @useResult + $Res call( + {String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName}); +} + +/// @nodoc +class __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res> + extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, + _$DownSyncClfCheckTotalCountEventImpl> + implements _$$DownSyncClfCheckTotalCountEventImplCopyWith<$Res> { + __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl( + _$DownSyncClfCheckTotalCountEventImpl _value, + $Res Function(_$DownSyncClfCheckTotalCountEventImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? projectId = null, + Object? boundaryCode = null, + Object? pendingSyncCount = null, + Object? batchSize = null, + Object? boundaryName = null, + }) { + return _then(_$DownSyncClfCheckTotalCountEventImpl( + projectId: null == projectId + ? _value.projectId + : projectId // ignore: cast_nullable_to_non_nullable + as String, + boundaryCode: null == boundaryCode + ? _value.boundaryCode + : boundaryCode // ignore: cast_nullable_to_non_nullable + as String, + pendingSyncCount: null == pendingSyncCount + ? _value.pendingSyncCount + : pendingSyncCount // ignore: cast_nullable_to_non_nullable + as int, + batchSize: null == batchSize + ? _value.batchSize + : batchSize // ignore: cast_nullable_to_non_nullable + as int, + boundaryName: null == boundaryName + ? _value.boundaryName + : boundaryName // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc + +class _$DownSyncClfCheckTotalCountEventImpl + implements DownSyncClfCheckTotalCountEvent { + const _$DownSyncClfCheckTotalCountEventImpl( + {required this.projectId, + required this.boundaryCode, + required this.pendingSyncCount, + required this.batchSize, + required this.boundaryName}); + + @override + final String projectId; + @override + final String boundaryCode; + @override + final int pendingSyncCount; + @override + final int batchSize; + @override + final String boundaryName; + + @override + String toString() { + return 'BeneficiaryDownSyncEvent.checkForClf(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DownSyncClfCheckTotalCountEventImpl && + (identical(other.projectId, projectId) || + other.projectId == projectId) && + (identical(other.boundaryCode, boundaryCode) || + other.boundaryCode == boundaryCode) && + (identical(other.pendingSyncCount, pendingSyncCount) || + other.pendingSyncCount == pendingSyncCount) && + (identical(other.batchSize, batchSize) || + other.batchSize == batchSize) && + (identical(other.boundaryName, boundaryName) || + other.boundaryName == boundaryName)); + } + + @override + int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, + pendingSyncCount, batchSize, boundaryName); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DownSyncClfCheckTotalCountEventImplCopyWith< + _$DownSyncClfCheckTotalCountEventImpl> + get copyWith => __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl< + _$DownSyncClfCheckTotalCountEventImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, + required TResult Function( + List appConfiguration, + String projectId, + String boundaryCode, + int pendingSyncCount, + String boundaryName) + getBatchSize, + required TResult Function() downSyncReport, + required TResult Function() resetState, + }) { + return checkForClf( + projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, + TResult? Function(List appConfiguration, String projectId, + String boundaryCode, int pendingSyncCount, String boundaryName)? + getBatchSize, + TResult? Function()? downSyncReport, + TResult? Function()? resetState, + }) { + return checkForClf?.call( + projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, + TResult Function(List appConfiguration, String projectId, + String boundaryCode, int pendingSyncCount, String boundaryName)? + getBatchSize, + TResult Function()? downSyncReport, + TResult Function()? resetState, + required TResult orElse(), + }) { + if (checkForClf != null) { + return checkForClf( + projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, + required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, + required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, + required TResult Function(DownSyncReportEvent value) downSyncReport, + required TResult Function(DownSyncResetStateEvent value) resetState, + }) { + return checkForClf(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, + TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, + TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, + TResult? Function(DownSyncReportEvent value)? downSyncReport, + TResult? Function(DownSyncResetStateEvent value)? resetState, + }) { + return checkForClf?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, + TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, + TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, + TResult Function(DownSyncReportEvent value)? downSyncReport, + TResult Function(DownSyncResetStateEvent value)? resetState, + required TResult orElse(), + }) { + if (checkForClf != null) { + return checkForClf(this); + } + return orElse(); + } +} + +abstract class DownSyncClfCheckTotalCountEvent + implements BeneficiaryDownSyncEvent { + const factory DownSyncClfCheckTotalCountEvent( + {required final String projectId, + required final String boundaryCode, + required final int pendingSyncCount, + required final int batchSize, + required final String boundaryName}) = + _$DownSyncClfCheckTotalCountEventImpl; + + String get projectId; + String get boundaryCode; + int get pendingSyncCount; + int get batchSize; + String get boundaryName; + @JsonKey(ignore: true) + _$$DownSyncClfCheckTotalCountEventImplCopyWith< + _$DownSyncClfCheckTotalCountEventImpl> + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc abstract class _$$DownSyncGetBatchSizeEventImplCopyWith<$Res> { factory _$$DownSyncGetBatchSizeEventImplCopyWith( @@ -725,9 +1334,15 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -748,9 +1363,15 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -767,9 +1388,15 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -788,7 +1415,10 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -800,7 +1430,9 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -812,7 +1444,9 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -886,9 +1520,15 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -908,9 +1548,15 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -926,9 +1572,15 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -946,7 +1598,10 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -958,7 +1613,9 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -970,7 +1627,9 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -1032,9 +1691,15 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { required TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName) downSync, + required TResult Function(String projectId, String boundaryCode, + int batchSize, int initialServerCount, String boundaryName) + downSyncCLF, required TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName) checkForData, + required TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName) + checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -1054,9 +1719,15 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { TResult? Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult? Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult? Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult? Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1072,9 +1743,15 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { TResult Function(String projectId, String boundaryCode, int batchSize, int initialServerCount, String boundaryName)? downSync, + TResult Function(String projectId, String boundaryCode, int batchSize, + int initialServerCount, String boundaryName)? + downSyncCLF, TResult Function(String projectId, String boundaryCode, int pendingSyncCount, int batchSize, String boundaryName)? checkForData, + TResult Function(String projectId, String boundaryCode, + int pendingSyncCount, int batchSize, String boundaryName)? + checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1092,7 +1769,10 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, + required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, + required TResult Function(DownSyncClfCheckTotalCountEvent value) + checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -1104,7 +1784,9 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, + TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -1116,7 +1798,9 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, + TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, + TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index d80ac81451..fae68e69fb 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -1,6 +1,8 @@ // Generated using mason. Do not modify by hand +import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:dio/dio.dart'; import '../../../models/downsync/downsync.dart'; class DownsyncRemoteRepository @@ -11,6 +13,120 @@ class DownsyncRemoteRepository super.entityName = 'Downsync', }); + @override + String get searchPath => actionMap[ApiOperation.search]?[0] ?? ''; + + String get searchClfPath => actionMap[ApiOperation.search]?[1] ?? ''; + + String get searchClfMemberData => actionMap[ApiOperation.search]?[2] ?? ''; + @override DataModelType get type => DataModelType.downsync; + + FutureOr> searchClfDownSync(DownsyncSearchModel query, + {int? offSet, int? limit}) async { + int defaultBatchSize = limit ?? 100; + int currentOffset = offSet ?? 0; + + Map finalResult = { + "Households": [], + "DownsyncCriteria": {} + }; + + Response response; + response = await executeFuture(future: () async { + return await dio.post( + searchClfPath, + queryParameters: { + 'offset': currentOffset, + 'limit': defaultBatchSize, + 'tenantId': DigitDataModelSingleton().tenantId, + if (query.isDeleted ?? false) 'includeDeleted': query.isDeleted + }, + data: { + isPlural ? entityNamePlural : 'DownsyncCriteria': + isPlural ? [query.toMap()] : query.toMap(), + }, + ); + }); + + //Execute the request + try {} catch (error) {} + + final responseMap = response.data; + + if (responseMap is! Map) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchClfPath, + response: responseMap, + ); + } + + //Check whether the response contains valid key + if (!responseMap.containsKey('Households')) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + final entityResponse = responseMap['Households']; + final DownsyncModel downSyncCriteria = entityResponse['DownsyncCriteria']; + + final household_map = entityResponse['HouseholdCountMap'] as List; + + try { + household_map + .forEach((e) => finalResult["Household"].add(e['household'])); + } catch (e) { + rethrow; + } + + finalResult["DownsyncCriteria"] = entityResponse['DownsyncCriteria']; + + return finalResult; + } + + FutureOr> getMemberData(DownsyncSearchModel query, + {int? offSet, int? limit}) async { + Response response; + + try { + response = await executeFuture( + future: () async { + return await dio.post( + searchClfMemberData, + queryParameters: { + 'offset': offSet ?? 0, + 'limit': limit ?? 100, + 'tenantId': DigitDataModelSingleton().tenantId, + if (query.isDeleted ?? false) 'includeDeleted': query.isDeleted, + }, + data: { + entityName == 'Downsync' ? 'DownsyncCriteria' : entityName: + query.toMap(), + }, + ); + }, + ); + } catch (error) { + return {}; + } + + final responseMap = response.data; + + if (!responseMap.containsKey( + entityName, + )) { + throw InvalidApiResponseException( + data: query.toMap(), + path: searchPath, + response: responseMap, + ); + } + + return responseMap[entityName]; + } } diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart index 7aa6ca5c2e..2210d842d1 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart @@ -7,7 +7,8 @@ import 'package:digit_data_model/data_model.dart'; part 'downsync.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMappable { +class DownsyncSearchModel extends EntitySearchModel + with DownsyncSearchModelMappable { final String? locality; final String? projectId; final int? offset; @@ -16,7 +17,8 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp final int? totalCount; final String? boundaryName; final String? tenantId; - + final String? householdId; + DownsyncSearchModel({ this.locality, this.projectId, @@ -26,9 +28,10 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp this.totalCount, this.boundaryName, this.tenantId, + this.householdId, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() DownsyncSearchModel.ignoreDeleted({ @@ -40,13 +43,13 @@ class DownsyncSearchModel extends EntitySearchModel with DownsyncSearchModelMapp this.totalCount, this.boundaryName, this.tenantId, + this.householdId, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class DownsyncModel extends EntityModel with DownsyncModelMappable { - static const schemaName = 'Downsync'; final String? locality; @@ -59,6 +62,7 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { final bool? nonRecoverableError; final String? tenantId; final int? rowVersion; + final String? householdId; final DownsyncAdditionalFields? additionalFields; DownsyncModel({ @@ -73,9 +77,11 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { this.nonRecoverableError = false, this.tenantId, this.rowVersion, - super.auditDetails,super.clientAuditDetails, + this.householdId, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); DownsyncCompanion get companion { return DownsyncCompanion( @@ -99,16 +105,16 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { nonRecoverableError: Value(nonRecoverableError), tenantId: Value(tenantId), rowVersion: Value(rowVersion), - ); + ); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class DownsyncAdditionalFields extends AdditionalFields with DownsyncAdditionalFieldsMappable { +class DownsyncAdditionalFields extends AdditionalFields + with DownsyncAdditionalFieldsMappable { DownsyncAdditionalFields({ super.schema = 'Downsync', required super.version, super.fields, }); } - diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart index 41a7184bee..2caf5147ef 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart @@ -45,6 +45,9 @@ class DownsyncSearchModelMapper static String? _$tenantId(DownsyncSearchModel v) => v.tenantId; static const Field _f$tenantId = Field('tenantId', _$tenantId, opt: true); + static String? _$householdId(DownsyncSearchModel v) => v.householdId; + static const Field _f$householdId = + Field('householdId', _$householdId, opt: true); static String? _$boundaryCode(DownsyncSearchModel v) => v.boundaryCode; static const Field _f$boundaryCode = Field('boundaryCode', _$boundaryCode, opt: true); @@ -67,6 +70,7 @@ class DownsyncSearchModelMapper #totalCount: _f$totalCount, #boundaryName: _f$boundaryName, #tenantId: _f$tenantId, + #householdId: _f$householdId, #boundaryCode: _f$boundaryCode, #auditDetails: _f$auditDetails, #additionalFields: _f$additionalFields, @@ -92,6 +96,7 @@ class DownsyncSearchModelMapper totalCount: data.dec(_f$totalCount), boundaryName: data.dec(_f$boundaryName), tenantId: data.dec(_f$tenantId), + householdId: data.dec(_f$householdId), boundaryCode: data.dec(_f$boundaryCode)); } @@ -160,6 +165,7 @@ abstract class DownsyncSearchModelCopyWith<$R, $In extends DownsyncSearchModel, int? totalCount, String? boundaryName, String? tenantId, + String? householdId, String? boundaryCode}); DownsyncSearchModelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( Then<$Out2, $R2> t); @@ -183,6 +189,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> Object? totalCount = $none, Object? boundaryName = $none, Object? tenantId = $none, + Object? householdId = $none, Object? boundaryCode = $none}) => $apply(FieldCopyWithData({ if (locality != $none) #locality: locality, @@ -193,6 +200,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> if (totalCount != $none) #totalCount: totalCount, if (boundaryName != $none) #boundaryName: boundaryName, if (tenantId != $none) #tenantId: tenantId, + if (householdId != $none) #householdId: householdId, if (boundaryCode != $none) #boundaryCode: boundaryCode })); @override @@ -206,6 +214,7 @@ class _DownsyncSearchModelCopyWithImpl<$R, $Out> totalCount: data.get(#totalCount, or: $value.totalCount), boundaryName: data.get(#boundaryName, or: $value.boundaryName), tenantId: data.get(#tenantId, or: $value.tenantId), + householdId: data.get(#householdId, or: $value.householdId), boundaryCode: data.get(#boundaryCode, or: $value.boundaryCode)); @override @@ -264,6 +273,9 @@ class DownsyncModelMapper extends SubClassMapperBase { static int? _$rowVersion(DownsyncModel v) => v.rowVersion; static const Field _f$rowVersion = Field('rowVersion', _$rowVersion, opt: true); + static String? _$householdId(DownsyncModel v) => v.householdId; + static const Field _f$householdId = + Field('householdId', _$householdId, opt: true); static AuditDetails? _$auditDetails(DownsyncModel v) => v.auditDetails; static const Field _f$auditDetails = Field('auditDetails', _$auditDetails, opt: true); @@ -288,6 +300,7 @@ class DownsyncModelMapper extends SubClassMapperBase { #nonRecoverableError: _f$nonRecoverableError, #tenantId: _f$tenantId, #rowVersion: _f$rowVersion, + #householdId: _f$householdId, #auditDetails: _f$auditDetails, #clientAuditDetails: _f$clientAuditDetails, #isDeleted: _f$isDeleted, @@ -316,6 +329,7 @@ class DownsyncModelMapper extends SubClassMapperBase { nonRecoverableError: data.dec(_f$nonRecoverableError), tenantId: data.dec(_f$tenantId), rowVersion: data.dec(_f$rowVersion), + householdId: data.dec(_f$householdId), auditDetails: data.dec(_f$auditDetails), clientAuditDetails: data.dec(_f$clientAuditDetails), isDeleted: data.dec(_f$isDeleted)); @@ -394,6 +408,7 @@ abstract class DownsyncModelCopyWith<$R, $In extends DownsyncModel, $Out> bool? nonRecoverableError, String? tenantId, int? rowVersion, + String? householdId, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); @@ -433,6 +448,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> Object? nonRecoverableError = $none, Object? tenantId = $none, Object? rowVersion = $none, + Object? householdId = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => @@ -449,6 +465,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> #nonRecoverableError: nonRecoverableError, if (tenantId != $none) #tenantId: tenantId, if (rowVersion != $none) #rowVersion: rowVersion, + if (householdId != $none) #householdId: householdId, if (auditDetails != $none) #auditDetails: auditDetails, if (clientAuditDetails != $none) #clientAuditDetails: clientAuditDetails, @@ -469,6 +486,7 @@ class _DownsyncModelCopyWithImpl<$R, $Out> data.get(#nonRecoverableError, or: $value.nonRecoverableError), tenantId: data.get(#tenantId, or: $value.tenantId), rowVersion: data.get(#rowVersion, or: $value.rowVersion), + householdId: data.get(#householdId, or: $value.householdId), auditDetails: data.get(#auditDetails, or: $value.auditDetails), clientAuditDetails: data.get(#clientAuditDetails, or: $value.clientAuditDetails), diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart index d1e7a4d7a1..c273a10ef8 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart @@ -2,14 +2,24 @@ import 'package:dart_mappable/dart_mappable.dart'; part 'roles_type.mapper.dart'; + @MappableEnum(caseStyle: CaseStyle.upperCase) enum RolesType { - @MappableValue("WAREHOUSE_MANAGER") warehouseManager, - @MappableValue("DISTRIBUTOR") distributor, - @MappableValue("HEALTH_FACILITY_WORKER") healthFacilityWorker, - @MappableValue("DISTRICT_SUPERVISOR") districtSupervisor, - @MappableValue("FIELD_SUPERVISOR") fieldSupervisor, - @MappableValue("SUPERUSER") superuser, - @MappableValue("REGISTRAR") registrar, + @MappableValue("WAREHOUSE_MANAGER") + warehouseManager, + @MappableValue("DISTRIBUTOR") + distributor, + @MappableValue("HEALTH_FACILITY_WORKER") + healthFacilityWorker, + @MappableValue("DISTRICT_SUPERVISOR") + districtSupervisor, + @MappableValue("FIELD_SUPERVISOR") + fieldSupervisor, + @MappableValue("SUPERUSER") + superuser, + @MappableValue("REGISTRAR") + registrar, + @MappableValue("COMMUNITY_CREATOR") + communityCreator, ; -} \ No newline at end of file +} diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart index 3ec8e82bdd..072c5d55e8 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.mapper.dart @@ -39,6 +39,8 @@ class RolesTypeMapper extends EnumMapper { return RolesType.superuser; case "REGISTRAR": return RolesType.registrar; + case "COMMUNITY_CREATOR": + return RolesType.communityCreator; default: throw MapperException.unknownEnumValue(value); } @@ -61,6 +63,8 @@ class RolesTypeMapper extends EnumMapper { return "SUPERUSER"; case RolesType.registrar: return "REGISTRAR"; + case RolesType.communityCreator: + return "COMMUNITY_CREATOR"; } } } diff --git a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart index c7f98a48fb..ed2967c48b 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/authenticated.dart @@ -16,6 +16,7 @@ import '../blocs/localization/app_localization.dart'; import '../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart'; import '../data/remote_client.dart'; import '../data/repositories/remote/bandwidth_check.dart'; +import '../data/repositories/remote/downsync.dart'; import '../models/downsync/downsync.dart'; import '../router/app_router.dart'; import '../router/authenticated_route_observer.dart'; @@ -183,9 +184,8 @@ class AuthenticatedPageWrapper extends StatelessWidget { individualLocalRepository: ctx.read< LocalRepository>(), - downSyncRemoteRepository: ctx.read< - RemoteRepository>(), + downSyncRemoteRepository: + ctx.read(), downSyncLocalRepository: ctx.read< LocalRepository>(), diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index 622a472085..b562e983a3 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -83,6 +83,12 @@ class _BoundarySelectionPageState ) .toList() .isNotEmpty; + bool isCommunityCreator = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.communityCreator.toValue(), + ) + .toList() + .isNotEmpty; return PopScope( canPop: shouldPop, @@ -129,12 +135,13 @@ class _BoundarySelectionPageState children: [ Expanded( child: ListView.builder( - itemCount: labelList.length+1, + itemCount: labelList.length + 1, itemBuilder: (context, labelIndex) { - if (labelIndex == labelList.length) { // Return a SizedBox for whitespace after the last item - return const SizedBox(height: kPadding*3); // Adjust height as needed + return const SizedBox( + height: kPadding * + 3); // Adjust height as needed } final label = labelList.elementAt(labelIndex); @@ -296,6 +303,8 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.pendingSync, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), dataFound: (initialServerCount, batchSize) { clickedStatus.value = false; @@ -344,6 +353,8 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.dataFound, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ); }, inProgress: (syncCount, totalCount) { @@ -379,6 +390,9 @@ class _BoundarySelectionPageState isPop: true, downloadProgressController: downloadProgress, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor, ); } }, @@ -466,66 +480,73 @@ class _BoundarySelectionPageState dialogType: DigitProgressDialogType.failed, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), totalCountCheckFailed: () => - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails - .unableToCheckDataInServer, - ), - appConfiguartion: appConfiguration, - projectId: context.projectId, - pendingSyncCount: pendingSyncCount, - boundary: selectedBoundary!.value!.code - .toString(), - primaryButtonLabel: - localizations.translate( - i18.syncDialog.retryButtonLabel, - ), - secondaryButtonLabel: - localizations.translate( - i18.beneficiaryDetails - .proceedWithoutDownloading, - ), - boundaryName: selectedBoundary - .value!.name - .toString(), - ), - dialogType: - DigitProgressDialogType.checkFailed, - isPop: true, - ), + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails + .unableToCheckDataInServer, + ), + appConfiguartion: + appConfiguration, + projectId: context.projectId, + pendingSyncCount: + pendingSyncCount, + boundary: selectedBoundary! + .value!.code + .toString(), + primaryButtonLabel: + localizations.translate( + i18.syncDialog.retryButtonLabel, + ), + secondaryButtonLabel: + localizations.translate( + i18.beneficiaryDetails + .proceedWithoutDownloading, + ), + boundaryName: selectedBoundary + .value!.name + .toString(), + ), + dialogType: DigitProgressDialogType + .checkFailed, + isPop: true, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor), insufficientStorage: () { clickedStatus.value = false; - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails - .insufficientStorage, - ), - content: localizations.translate(i18 - .beneficiaryDetails - .insufficientStorageContent), - projectId: context.projectId, - appConfiguartion: appConfiguration, - boundary: selectedBoundary! - .value!.code - .toString(), - primaryButtonLabel: - localizations.translate( - i18.common.coreCommonOk, + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails + .insufficientStorage, + ), + content: localizations.translate(i18 + .beneficiaryDetails + .insufficientStorageContent), + projectId: context.projectId, + appConfiguartion: appConfiguration, + boundary: selectedBoundary! + .value!.code + .toString(), + primaryButtonLabel: + localizations.translate( + i18.common.coreCommonOk, + ), + boundaryName: selectedBoundary + .value!.name + .toString(), ), - boundaryName: selectedBoundary - .value!.name - .toString(), - ), - dialogType: DigitProgressDialogType - .insufficientStorage, - isPop: true, - ); + dialogType: DigitProgressDialogType + .insufficientStorage, + isPop: true, + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor); }, ); }); @@ -562,77 +583,76 @@ class _BoundarySelectionPageState shouldPop = true; }); - context - .read() - .add( - const BoundarySubmitEvent(), - ); - bool isOnline = - await getIsConnected(); - - if (context.mounted) { - if (isOnline && - isDistributor) { - context - .read< - BeneficiaryDownSyncBloc>() - .add( - DownSyncGetBatchSizeEvent( - appConfiguration: [ - appConfiguration, - ], - projectId: context - .projectId, - boundaryCode: - selectedBoundary - .value! - .code - .toString(), - pendingSyncCount: - pendingSyncCount, - boundaryName: - selectedBoundary - .value! - .name - .toString(), - ), - ); - } else { - Future.delayed( - const Duration( - milliseconds: 100, - ), - () => context.router - .maybePop(), - ); - } - clickedStatus.value = - true; - LocalizationParams() - .setModule( - 'boundary', true); - context.read().add(LocalizationEvent.onUpdateLocalizationIndex( - index: appConfiguration - .languages! - .indexWhere((element) => - element - .value == - AppSharedPreferences() - .getSelectedLocale), - code: AppSharedPreferences() - .getSelectedLocale!)); + context + .read() + .add( + const BoundarySubmitEvent(), + ); + bool isOnline = + await getIsConnected(); + + if (context.mounted) { + if (isOnline && + (isDistributor || + isCommunityCreator)) { + context + .read< + BeneficiaryDownSyncBloc>() + .add( + DownSyncGetBatchSizeEvent( + appConfiguration: [ + appConfiguration, + ], + projectId: context + .projectId, + boundaryCode: + selectedBoundary + .value! + .code + .toString(), + pendingSyncCount: + pendingSyncCount, + boundaryName: + selectedBoundary + .value! + .name + .toString(), + ), + ); + } else { + Future.delayed( + const Duration( + milliseconds: 100, + ), + () => context.router + .maybePop(), + ); } + clickedStatus.value = true; + LocalizationParams() + .setModule( + 'boundary', true); + context.read().add(LocalizationEvent.onUpdateLocalizationIndex( + index: appConfiguration + .languages! + .indexWhere((element) => + element.value == + AppSharedPreferences() + .getSelectedLocale), + code: AppSharedPreferences() + .getSelectedLocale!)); } - }, - child: Text(localizations.translate( - i18.common.coreCommonSubmit, - )), - ); - }, - ), + } + }, + child: Text(localizations.translate( + i18.common.coreCommonSubmit, + )), + ); + }, ), ), ), + ), ], ), ), diff --git a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart index 02dd968be8..1f2447a557 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart @@ -11,6 +11,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../blocs/app_initialization/app_initialization.dart'; import '../../../blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart'; import '../../../models/downsync/downsync.dart'; +import '../../../models/entities/roles_type.dart'; import '../../../router/app_router.dart'; import '../../../utils/i18_key_constants.dart' as i18; import '../../../utils/utils.dart'; @@ -63,6 +64,18 @@ class BeneficiariesReportState extends LocalizedState { @override Widget build(BuildContext context) { final theme = Theme.of(context); + bool isDistributor = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.distributor.toValue(), + ) + .toList() + .isNotEmpty; + bool isCommunityCreator = context.loggedInUserRoles + .where( + (role) => role.code == RolesType.communityCreator.toValue(), + ) + .toList() + .isNotEmpty; return Scaffold( body: BlocBuilder( @@ -150,6 +163,8 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.pendingSync, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), dataFound: (initialServerCount, batchSize) => showDownloadDialog( @@ -185,6 +200,8 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.dataFound, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), inProgress: (syncCount, totalCount) { downloadProgress.add( @@ -194,25 +211,25 @@ class BeneficiariesReportState extends LocalizedState { ), ); if (syncCount < 1) { - showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails.dataDownloadInProgress, + showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails.dataDownloadInProgress, + ), + projectId: context.projectId, + boundary: selectedBoundary!.code.toString(), + appConfiguartion: appConfiguration, + syncCount: syncCount, + totalCount: totalCount, + prefixLabel: syncCount.toString(), + suffixLabel: totalCount.toString(), + boundaryName: selectedBoundary!.name.toString(), ), - projectId: context.projectId, - boundary: selectedBoundary!.code.toString(), - appConfiguartion: appConfiguration, - syncCount: syncCount, - totalCount: totalCount, - prefixLabel: syncCount.toString(), - suffixLabel: totalCount.toString(), - boundaryName: selectedBoundary!.name.toString(), - ), - dialogType: DigitProgressDialogType.inProgress, - isPop: true, - downloadProgressController: downloadProgress, - ); + dialogType: DigitProgressDialogType.inProgress, + isPop: true, + downloadProgressController: downloadProgress, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator); } }, success: (result) { @@ -281,6 +298,8 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.failed, isPop: true, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), totalCountCheckFailed: () => showDownloadDialog( context, @@ -302,26 +321,29 @@ class BeneficiariesReportState extends LocalizedState { ), dialogType: DigitProgressDialogType.checkFailed, isPop: true, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator, ), - insufficientStorage: () => showDownloadDialog( - context, - model: DownloadBeneficiary( - title: localizations.translate( - i18.beneficiaryDetails.insufficientStorage, - ), - content: localizations.translate(i18 - .beneficiaryDetails.insufficientStorageContent), - projectId: context.projectId, - appConfiguartion: appConfiguration, - boundary: selectedBoundary!.code.toString(), - primaryButtonLabel: localizations.translate( - i18.common.coreCommonOk, + insufficientStorage: () => showDownloadDialog(context, + model: DownloadBeneficiary( + title: localizations.translate( + i18.beneficiaryDetails.insufficientStorage, + ), + content: localizations.translate(i18 + .beneficiaryDetails.insufficientStorageContent), + projectId: context.projectId, + appConfiguartion: appConfiguration, + boundary: selectedBoundary!.code.toString(), + primaryButtonLabel: localizations.translate( + i18.common.coreCommonOk, + ), + boundaryName: selectedBoundary!.name.toString(), ), - boundaryName: selectedBoundary!.name.toString(), - ), - dialogType: DigitProgressDialogType.insufficientStorage, - isPop: true, - ), + dialogType: + DigitProgressDialogType.insufficientStorage, + isPop: true, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator), ); }, child: Column(children: [ diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index fe1c005f5f..c53a43e7e9 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -230,17 +230,16 @@ Future getIsConnected() async { } } -void showDownloadDialog( - BuildContext context, { - required DownloadBeneficiary model, - required DigitProgressDialogType dialogType, - bool isPop = true, - StreamController? downloadProgressController, -}) { +void showDownloadDialog(BuildContext context, + {required DownloadBeneficiary model, + required DigitProgressDialogType dialogType, + bool isPop = true, + StreamController? downloadProgressController, + required bool isCommunityCreator, + required bool isDistributor}) { if (isPop) { Navigator.of(context, rootNavigator: true).pop(); } - switch (dialogType) { case DigitProgressDialogType.failed: case DigitProgressDialogType.checkFailed: @@ -301,21 +300,22 @@ void showDownloadDialog( context.router.replaceAll([HomeRoute()]); } else { if ((model.totalCount ?? 0) > 0) { - context.read().add( - DownSyncBeneficiaryEvent( - projectId: context.projectId, - boundaryCode: model.boundary, - // Batch Size need to be defined based on Internet speed. - batchSize: model.batchSize ?? 1, - initialServerCount: model.totalCount ?? 0, - boundaryName: model.boundaryName, - ), - ); - } else { - Navigator.of(context, rootNavigator: true).pop(); - context.read().add( - const DownSyncResetStateEvent(), - ); + if (isCommunityCreator) { + context.read().add( + DownSyncOfClfBeneficiaryEvent( + projectId: context.projectId, + boundaryCode: model.boundary, + batchSize: model.batchSize ?? 1, + initialServerCount: model.totalCount ?? 0, + boundaryName: model.boundaryName), + ); + } + if (isDistributor) { + Navigator.of(context, rootNavigator: true).pop(); + context.read().add( + const DownSyncResetStateEvent(), + ); + } } } }, From db6939bb1abe6ab06816f09b307ec56a16711041 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 21 Jan 2025 14:25:22 +0530 Subject: [PATCH 34/47] added apiOperation for clf downsync --- .../lib/data/repositories/remote/downsync.dart | 8 +++----- .../local_store/sql_store/sql_store.g.dart | 18 ++++++++++++++++++ .../models/entities/household_type.mapper.dart | 2 +- .../lib/models/oplog/oplog_entry.dart | 4 +++- .../lib/models/oplog/oplog_entry.mapper.dart | 8 ++++++++ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index fae68e69fb..ecba456bad 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -13,12 +13,10 @@ class DownsyncRemoteRepository super.entityName = 'Downsync', }); - @override - String get searchPath => actionMap[ApiOperation.search]?[0] ?? ''; - - String get searchClfPath => actionMap[ApiOperation.search]?[1] ?? ''; + String get searchClfPath => actionMap[ApiOperation.clfSearch] ?? ''; - String get searchClfMemberData => actionMap[ApiOperation.search]?[2] ?? ''; + String get searchClfMemberData => + actionMap[ApiOperation.clfMemberSearch] ?? ''; @override DataModelType get type => DataModelType.downsync; diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart index 1ea1c7ce7d..fb417fc691 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart @@ -52633,6 +52633,7 @@ typedef $$HouseholdTableInsertCompanionBuilder = HouseholdCompanion Function({ Value tenantId, Value isDeleted, Value rowVersion, + Value householdType, Value additionalFields, Value rowid, }); @@ -52654,6 +52655,7 @@ typedef $$HouseholdTableUpdateCompanionBuilder = HouseholdCompanion Function({ Value tenantId, Value isDeleted, Value rowVersion, + Value householdType, Value additionalFields, Value rowid, }); @@ -52695,6 +52697,7 @@ class $$HouseholdTableTableManager extends RootTableManager< Value tenantId = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), + Value householdType = const Value.absent(), Value additionalFields = const Value.absent(), Value rowid = const Value.absent(), }) => @@ -52716,6 +52719,7 @@ class $$HouseholdTableTableManager extends RootTableManager< tenantId: tenantId, isDeleted: isDeleted, rowVersion: rowVersion, + householdType: householdType, additionalFields: additionalFields, rowid: rowid, ), @@ -52737,6 +52741,7 @@ class $$HouseholdTableTableManager extends RootTableManager< Value tenantId = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), + Value householdType = const Value.absent(), Value additionalFields = const Value.absent(), Value rowid = const Value.absent(), }) => @@ -52758,6 +52763,7 @@ class $$HouseholdTableTableManager extends RootTableManager< tenantId: tenantId, isDeleted: isDeleted, rowVersion: rowVersion, + householdType: householdType, additionalFields: additionalFields, rowid: rowid, ), @@ -52864,6 +52870,13 @@ class $$HouseholdTableFilterComposer builder: (column, joinBuilders) => ColumnFilters(column, joinBuilders: joinBuilders)); + ColumnWithTypeConverterFilters + get householdType => $state.composableBuilder( + column: $state.table.householdType, + builder: (column, joinBuilders) => ColumnWithTypeConverterFilters( + column, + joinBuilders: joinBuilders)); + ColumnFilters get additionalFields => $state.composableBuilder( column: $state.table.additionalFields, builder: (column, joinBuilders) => @@ -52958,6 +52971,11 @@ class $$HouseholdTableOrderingComposer builder: (column, joinBuilders) => ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get householdType => $state.composableBuilder( + column: $state.table.householdType, + builder: (column, joinBuilders) => + ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get additionalFields => $state.composableBuilder( column: $state.table.additionalFields, builder: (column, joinBuilders) => diff --git a/packages/digit_data_model/lib/models/entities/household_type.mapper.dart b/packages/digit_data_model/lib/models/entities/household_type.mapper.dart index 30ea5cb898..a98eeba17f 100644 --- a/packages/digit_data_model/lib/models/entities/household_type.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/household_type.mapper.dart @@ -1,7 +1,7 @@ // coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: type=lint -// ignore_for_file: unused_element, unnecessary_cast +// ignore_for_file: unused_element, unnecessary_cast, override_on_non_overriding_member // ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter part of 'household_type.dart'; diff --git a/packages/digit_data_model/lib/models/oplog/oplog_entry.dart b/packages/digit_data_model/lib/models/oplog/oplog_entry.dart index 26be51e96b..6f52df2f54 100644 --- a/packages/digit_data_model/lib/models/oplog/oplog_entry.dart +++ b/packages/digit_data_model/lib/models/oplog/oplog_entry.dart @@ -126,5 +126,7 @@ enum ApiOperation { bulkCreate, bulkUpdate, bulkDelete, - singleCreate + singleCreate, + clfSearch, + clfMemberSearch } diff --git a/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart b/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart index 79d1bb093c..a61eaf8d36 100644 --- a/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart +++ b/packages/digit_data_model/lib/models/oplog/oplog_entry.mapper.dart @@ -101,6 +101,10 @@ class ApiOperationMapper extends EnumMapper { return ApiOperation.bulkDelete; case 'single_create': return ApiOperation.singleCreate; + case 'clf_search': + return ApiOperation.clfSearch; + case 'clf_member_search': + return ApiOperation.clfMemberSearch; default: throw MapperException.unknownEnumValue(value); } @@ -127,6 +131,10 @@ class ApiOperationMapper extends EnumMapper { return 'bulk_delete'; case ApiOperation.singleCreate: return 'single_create'; + case ApiOperation.clfSearch: + return 'clf_search'; + case ApiOperation.clfMemberSearch: + return 'clf_member_search'; } } } From 4bf2fae9e3aa45519c730883a3b65a4d2ca5437f Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 21 Jan 2025 16:53:36 +0530 Subject: [PATCH 35/47] added downsyncReository provider --- .../project_beneficiaries_downsync.dart | 2 +- .../data/repositories/remote/downsync.dart | 1 - .../lib/pages/boundary_selection.dart | 25 +++++++++++++++++-- .../lib/utils/utils.dart | 1 + .../network_manager_provider_wrapper.dart | 3 +-- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index 7521fe790e..98d2868752 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -382,7 +382,7 @@ class BeneficiaryDownSyncBloc } } - FutureOr _handleClfTotalCount(DownSyncCheckTotalCountEvent event, + FutureOr _handleClfTotalCount(DownSyncClfCheckTotalCountEvent event, BeneficiaryDownSyncEmitter emit) async { if (event.pendingSyncCount > 0) { emit(const BeneficiaryDownSyncState.loading(true)); diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index ecba456bad..b6ef20eb7d 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -71,7 +71,6 @@ class DownsyncRemoteRepository } final entityResponse = responseMap['Households']; - final DownsyncModel downSyncCriteria = entityResponse['DownsyncCriteria']; final household_map = entityResponse['HouseholdCountMap'] as List; diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index b562e983a3..7da4985212 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -262,7 +262,26 @@ class _BoundarySelectionPageState boundaryCode, pendingSyncCount, boundaryName, - ) => + ) { + if (isCommunityCreator) { + context + .read() + .add( + DownSyncClfCheckTotalCountEvent( + projectId: context.projectId, + boundaryCode: selectedBoundary! + .value!.code + .toString(), + pendingSyncCount: + pendingSyncCount, + boundaryName: selectedBoundary + .value!.name + .toString(), + batchSize: batchSize, + ), + ); + } + if (isDistributor) { context .read() .add( @@ -278,7 +297,9 @@ class _BoundarySelectionPageState .toString(), batchSize: batchSize, ), - ), + ); + } + }, pendingSync: () => showDownloadDialog( context, model: DownloadBeneficiary( diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index c53a43e7e9..a50c1d1888 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -301,6 +301,7 @@ void showDownloadDialog(BuildContext context, } else { if ((model.totalCount ?? 0) > 0) { if (isCommunityCreator) { + Navigator.of(context, rootNavigator: true).pop(); context.read().add( DownSyncOfClfBeneficiaryEvent( projectId: context.projectId, diff --git a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart index 7b00ea5725..ffac651148 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/network_manager_provider_wrapper.dart @@ -408,8 +408,7 @@ class NetworkManagerProviderWrapper extends StatelessWidget { ), ), if (value == DataModelType.downsync) - RepositoryProvider< - RemoteRepository>( + RepositoryProvider( create: (_) => DownsyncRemoteRepository( dio, actionMap: actions, From f65bea6e200443c7f42a4e88b1b867098b9da4e8 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Wed, 22 Jan 2025 15:22:34 +0530 Subject: [PATCH 36/47] clf api changes added to project beneficiary bloc --- .../project_beneficiaries_downsync.dart | 287 ++- ...roject_beneficiaries_downsync.freezed.dart | 1680 +++++++---------- .../data/repositories/remote/downsync.dart | 13 +- .../lib/pages/boundary_selection.dart | 61 +- .../beneficiary/beneficaries_report.dart | 9 +- .../lib/utils/constants.dart | 2 + .../lib/utils/utils.dart | 39 +- 7 files changed, 912 insertions(+), 1179 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index 98d2868752..c9c5221958 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:disk_space_update/disk_space_update.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -56,8 +57,6 @@ class BeneficiaryDownSyncBloc on(_handleDownSyncResetState); on(_handleDownSyncReport); on(_handleCheckBandWidth); - on(_handleClfTotalCount); - on(_handleDownSyncOfClf); } FutureOr _handleDownSyncResetState( @@ -109,6 +108,8 @@ class BeneficiaryDownSyncBloc } else { emit(const BeneficiaryDownSyncState.loading(true)); await LocalSecureStore.instance.setManualSyncTrigger(true); + + int serverTotalCount = 0, clfServerCount = 0; final existingDownSyncData = await downSyncLocalRepository.search(DownsyncSearchModel( locality: event.boundaryCode, @@ -118,9 +119,34 @@ class BeneficiaryDownSyncBloc ? null : existingDownSyncData.first.lastSyncedTime; - //To get the server totalCount, - final initialResults = await downSyncRemoteRepository.downSync( - DownsyncSearchModel( + if (event.isDistributor) { + //To get the server totalCount, + final initialResults = await downSyncRemoteRepository.downSync( + DownsyncSearchModel( + locality: event.boundaryCode, + offset: existingDownSyncData.firstOrNull?.offset ?? 0, + limit: 1, + isDeleted: true, + lastSyncedTime: lastSyncedTime, + tenantId: envConfig.variables.tenantId, + projectId: event.projectId, + ), + ); + + if (initialResults.isEmpty) { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.resetState()); + emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + return; + } + + serverTotalCount = initialResults["DownsyncCriteria"]["totalCount"]; + } + + if (event.isCommunityCreator) { + //To get the CLF server totalCount + final initialResults = await downSyncRemoteRepository + .searchClfDownSync(DownsyncSearchModel( locality: event.boundaryCode, offset: existingDownSyncData.firstOrNull?.offset ?? 0, limit: 1, @@ -128,22 +154,23 @@ class BeneficiaryDownSyncBloc lastSyncedTime: lastSyncedTime, tenantId: envConfig.variables.tenantId, projectId: event.projectId, - ), - ); - if (initialResults.isNotEmpty) { - // Current response from server is String, Expecting it to be int - //[TODO: Need to move the dynamic keys to constants - int serverTotalCount = initialResults["DownsyncCriteria"]["totalCount"]; - - emit(BeneficiaryDownSyncState.dataFound( - serverTotalCount, - event.batchSize, )); - } else { - await LocalSecureStore.instance.setManualSyncTrigger(false); - emit(const BeneficiaryDownSyncState.resetState()); - emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + + if (initialResults.isEmpty) { + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(const BeneficiaryDownSyncState.resetState()); + emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); + return; + } + + clfServerCount = initialResults["DownsyncCriteria"]["totalCount"]; } + + emit(BeneficiaryDownSyncState.dataFound( + serverTotalCount, + clfServerCount, + event.batchSize, + )); } } @@ -171,10 +198,15 @@ class BeneficiaryDownSyncBloc int offset = existingDownSyncData.isEmpty ? 0 : existingDownSyncData.first.offset ?? 0; + int totalCount = event.initialServerCount; + + int clfTotalCount = event.clfServerCount; + int? lastSyncedTime = existingDownSyncData.isEmpty ? null : existingDownSyncData.first.lastSyncedTime; + if (existingDownSyncData.isEmpty) { await downSyncLocalRepository.create(DownsyncModel( offset: offset, @@ -186,8 +218,12 @@ class BeneficiaryDownSyncBloc )); } - if (offset < totalCount) { - emit(BeneficiaryDownSyncState.inProgress(offset, totalCount)); + bool flag = false; + emit(BeneficiaryDownSyncState.inProgress( + offset, totalCount, clfTotalCount)); + + if (event.isDistributor && offset < totalCount) { + flag = true; //Make the batch API call final downSyncResults = await downSyncRemoteRepository.downSync( DownsyncSearchModel( @@ -201,6 +237,7 @@ class BeneficiaryDownSyncBloc isDeleted: true, ), ); + // check if the API response is there or it failed if (downSyncResults.isNotEmpty) { await SyncServiceSingleton() @@ -216,15 +253,6 @@ class BeneficiaryDownSyncBloc ]); // Update the local downSync data for the boundary with the new values totalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; - - await downSyncLocalRepository.update(DownsyncModel( - offset: offset + event.batchSize, - limit: event.batchSize, - lastSyncedTime: lastSyncedTime, - totalCount: totalCount, - locality: event.boundaryCode, - boundaryName: event.boundaryName, - )); } // When API response failed else { @@ -232,90 +260,17 @@ class BeneficiaryDownSyncBloc await LocalSecureStore.instance.setManualSyncTrigger(false); break; } - } else { - await downSyncLocalRepository.update( - existingDownSyncData.first.copyWith( - offset: 0, - limit: 0, - totalCount: totalCount, - locality: event.boundaryCode, - boundaryName: event.boundaryName, - lastSyncedTime: DateTime.now().millisecondsSinceEpoch, - ), - ); - final result = DownsyncModel( - offset: totalCount, - lastSyncedTime: DateTime.now().millisecondsSinceEpoch, - totalCount: totalCount, - locality: event.boundaryCode, - boundaryName: event.boundaryName, - ); - await LocalSecureStore.instance.setManualSyncTrigger(false); - emit(BeneficiaryDownSyncState.success(result)); - break; // If offset is greater than or equal to totalCount, exit the loop - } - } - } catch (e) { - await LocalSecureStore.instance.setManualSyncTrigger(false); - emit(const BeneficiaryDownSyncState.failed()); - } - } - } - - FutureOr _handleDownSyncReport( - DownSyncReportEvent event, - BeneficiaryDownSyncEmitter emit, - ) async { - final result = await downSyncLocalRepository.search(DownsyncSearchModel()); - emit(BeneficiaryDownSyncState.report(result)); - } - - FutureOr _handleDownSyncOfClf(DownSyncOfClfBeneficiaryEvent event, - BeneficiaryDownSyncEmitter emit) async { - emit(const BeneficiaryDownSyncState.loading(true)); - double? diskSpace = 0; - diskSpace = await DiskSpace - .getFreeDiskSpace; // Returns the device available space in MB - // diskSpace in MB * 1000 comparison with serverTotalCount * 150KB * Number of entities * 2 - if ((diskSpace ?? 0) * 1000 < (event.initialServerCount * 150 * 2)) { - emit(const BeneficiaryDownSyncState.insufficientStorage()); - } else { - try { - while (true) { - // Check each time, till the loop runs the offset, limit, totalCount, lastSyncTime from Local DB of DownSync Model - final existingDownSyncData = - await downSyncLocalRepository.search(DownsyncSearchModel( - locality: event.boundaryCode, - )); - - int offset = existingDownSyncData.isEmpty - ? 0 - : existingDownSyncData.first.offset ?? 0; - int totalCount = event.initialServerCount; - int? lastSyncedTime = existingDownSyncData.isEmpty - ? null - : existingDownSyncData.first.lastSyncedTime; - - if (existingDownSyncData.isEmpty) { - await downSyncLocalRepository.create(DownsyncModel( - offset: offset, - limit: event.batchSize, - lastSyncedTime: lastSyncedTime, - totalCount: totalCount, - locality: event.boundaryCode, - boundaryName: event.boundaryName, - )); } - if (offset < totalCount) { - emit(BeneficiaryDownSyncState.inProgress(offset, totalCount)); + if (event.isCommunityCreator && offset < clfTotalCount) { + flag = true; final downSyncResults = await downSyncRemoteRepository .searchClfDownSync(DownsyncSearchModel( locality: event.boundaryCode, offset: offset, limit: event.batchSize, - totalCount: totalCount, + totalCount: clfTotalCount, tenantId: envConfig.variables.tenantId, projectId: event.projectId, lastSyncedTime: lastSyncedTime, @@ -324,10 +279,14 @@ class BeneficiaryDownSyncBloc if (downSyncResults.isNotEmpty) { final householdList = downSyncResults["Households"] as List; + final memberCountList = + downSyncResults["numberOfMembers"] as List; + int idx = 0; householdList.forEach((e) async { int memberOffset = 0; - while (true) { + int memberCount = memberCountList[idx++]; + while (memberCount > 0) { final memberData = await downSyncRemoteRepository .getMemberData(DownsyncSearchModel( locality: event.boundaryCode, @@ -338,11 +297,15 @@ class BeneficiaryDownSyncBloc projectId: event.projectId, lastSyncedTime: lastSyncedTime, isDeleted: true, - householdId: (e as HouseholdModel).id, + householdId: e["id"], )); if (memberData.isEmpty) break; - memberData["Households"].add([e]); + if (memberData["Households"] == null) { + memberData["Households"] = []; + memberData["Households"].add(e); + // e["householdType"] = HouseholdType.community; + } await SyncServiceSingleton() .entityMapper ?.writeToEntityDB(memberData, [ @@ -354,13 +317,41 @@ class BeneficiaryDownSyncBloc sideEffectLocalRepository, referralLocalRepository, ]); + memberCount -= event.batchSize; memberOffset += event.batchSize; } }); - } - totalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; + clfTotalCount = downSyncResults["DownsyncCriteria"]["totalCount"]; + } else { + emit(const BeneficiaryDownSyncState.failed()); + await LocalSecureStore.instance.setManualSyncTrigger(false); + break; + } + } + if (!flag) { + await downSyncLocalRepository.update( + existingDownSyncData.first.copyWith( + offset: 0, + limit: 0, + totalCount: clfTotalCount, + locality: event.boundaryCode, + boundaryName: event.boundaryName, + lastSyncedTime: DateTime.now().millisecondsSinceEpoch, + ), + ); + final result = DownsyncModel( + offset: clfTotalCount + totalCount, + lastSyncedTime: DateTime.now().millisecondsSinceEpoch, + totalCount: clfTotalCount, + locality: event.boundaryCode, + boundaryName: event.boundaryName, + ); + await LocalSecureStore.instance.setManualSyncTrigger(false); + emit(BeneficiaryDownSyncState.success(result)); + break; + } else { await downSyncLocalRepository.update(DownsyncModel( offset: offset + event.batchSize, limit: event.batchSize, @@ -369,10 +360,6 @@ class BeneficiaryDownSyncBloc locality: event.boundaryCode, boundaryName: event.boundaryName, )); - } else { - emit(const BeneficiaryDownSyncState.failed()); - await LocalSecureStore.instance.setManualSyncTrigger(false); - break; } } } catch (e) { @@ -382,47 +369,12 @@ class BeneficiaryDownSyncBloc } } - FutureOr _handleClfTotalCount(DownSyncClfCheckTotalCountEvent event, - BeneficiaryDownSyncEmitter emit) async { - if (event.pendingSyncCount > 0) { - emit(const BeneficiaryDownSyncState.loading(true)); - emit(const BeneficiaryDownSyncState.pendingSync()); - } else { - emit(const BeneficiaryDownSyncState.loading(true)); - await LocalSecureStore.instance.setManualSyncTrigger(true); - final existingDownSyncData = - await downSyncLocalRepository.search(DownsyncSearchModel( - locality: event.boundaryCode, - )); - - int? lastSyncedTime = existingDownSyncData.isEmpty - ? null - : existingDownSyncData.first.lastSyncedTime; - - //To get the server totalCount - final initialResults = - await downSyncRemoteRepository.searchClfDownSync(DownsyncSearchModel( - locality: event.boundaryCode, - offset: existingDownSyncData.firstOrNull?.offset ?? 0, - limit: 1, - isDeleted: true, - lastSyncedTime: lastSyncedTime, - tenantId: envConfig.variables.tenantId, - projectId: event.projectId, - )); - - if (initialResults.isNotEmpty) { - int serverTotalCount = - initialResults["Households"]["DownsyncCriteria"]["totalCount"]; - - emit(BeneficiaryDownSyncState.dataFound( - serverTotalCount, event.batchSize)); - } else { - await LocalSecureStore.instance.setManualSyncTrigger(false); - emit(const BeneficiaryDownSyncState.resetState()); - emit(const BeneficiaryDownSyncState.totalCountCheckFailed()); - } - } + FutureOr _handleDownSyncReport( + DownSyncReportEvent event, + BeneficiaryDownSyncEmitter emit, + ) async { + final result = await downSyncLocalRepository.search(DownsyncSearchModel()); + emit(BeneficiaryDownSyncState.report(result)); } } @@ -433,33 +385,22 @@ class BeneficiaryDownSyncEvent with _$BeneficiaryDownSyncEvent { required String boundaryCode, required int batchSize, required int initialServerCount, + required int clfServerCount, required String boundaryName, + required bool isCommunityCreator, + required bool isDistributor, }) = DownSyncBeneficiaryEvent; - const factory BeneficiaryDownSyncEvent.downSyncCLF({ - required String projectId, - required String boundaryCode, - required int batchSize, - required int initialServerCount, - required String boundaryName, - }) = DownSyncOfClfBeneficiaryEvent; - const factory BeneficiaryDownSyncEvent.checkForData({ required String projectId, required String boundaryCode, required int pendingSyncCount, required int batchSize, required String boundaryName, + required bool isCommunityCreator, + required bool isDistributor, }) = DownSyncCheckTotalCountEvent; - const factory BeneficiaryDownSyncEvent.checkForClf({ - required String projectId, - required String boundaryCode, - required int pendingSyncCount, - required int batchSize, - required String boundaryName, - }) = DownSyncClfCheckTotalCountEvent; - const factory BeneficiaryDownSyncEvent.getBatchSize({ required List appConfiguration, required String projectId, @@ -480,6 +421,7 @@ class BeneficiaryDownSyncState with _$BeneficiaryDownSyncState { const factory BeneficiaryDownSyncState.inProgress( int syncedCount, int totalCount, + int clfTotalCount, ) = _DownSyncInProgressState; const factory BeneficiaryDownSyncState.success( DownsyncModel downSyncResult, @@ -497,6 +439,7 @@ class BeneficiaryDownSyncState with _$BeneficiaryDownSyncState { _DownSyncInsufficientStorageState; const factory BeneficiaryDownSyncState.dataFound( int initialServerCount, + int initialClfServerCount, int batchSize, ) = _DownSyncDataFoundState; const factory BeneficiaryDownSyncState.resetState() = _DownSyncResetState; diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart index 63ee99fbd4..4501c5177b 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.freezed.dart @@ -18,18 +18,25 @@ final _privateConstructorUsedError = UnsupportedError( mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -43,18 +50,25 @@ mixin _$BeneficiaryDownSyncEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -64,18 +78,25 @@ mixin _$BeneficiaryDownSyncEvent { throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -87,10 +108,7 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -99,9 +117,7 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -110,9 +126,7 @@ mixin _$BeneficiaryDownSyncEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -135,563 +149,37 @@ class _$BeneficiaryDownSyncEventCopyWithImpl<$Res, _$BeneficiaryDownSyncEventCopyWithImpl(this._value, this._then); // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; -} - -/// @nodoc -abstract class _$$DownSyncBeneficiaryEventImplCopyWith<$Res> { - factory _$$DownSyncBeneficiaryEventImplCopyWith( - _$DownSyncBeneficiaryEventImpl value, - $Res Function(_$DownSyncBeneficiaryEventImpl) then) = - __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res>; - @useResult - $Res call( - {String projectId, - String boundaryCode, - int batchSize, - int initialServerCount, - String boundaryName}); -} - -/// @nodoc -class __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res> - extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, - _$DownSyncBeneficiaryEventImpl> - implements _$$DownSyncBeneficiaryEventImplCopyWith<$Res> { - __$$DownSyncBeneficiaryEventImplCopyWithImpl( - _$DownSyncBeneficiaryEventImpl _value, - $Res Function(_$DownSyncBeneficiaryEventImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? projectId = null, - Object? boundaryCode = null, - Object? batchSize = null, - Object? initialServerCount = null, - Object? boundaryName = null, - }) { - return _then(_$DownSyncBeneficiaryEventImpl( - projectId: null == projectId - ? _value.projectId - : projectId // ignore: cast_nullable_to_non_nullable - as String, - boundaryCode: null == boundaryCode - ? _value.boundaryCode - : boundaryCode // ignore: cast_nullable_to_non_nullable - as String, - batchSize: null == batchSize - ? _value.batchSize - : batchSize // ignore: cast_nullable_to_non_nullable - as int, - initialServerCount: null == initialServerCount - ? _value.initialServerCount - : initialServerCount // ignore: cast_nullable_to_non_nullable - as int, - boundaryName: null == boundaryName - ? _value.boundaryName - : boundaryName // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc - -class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { - const _$DownSyncBeneficiaryEventImpl( - {required this.projectId, - required this.boundaryCode, - required this.batchSize, - required this.initialServerCount, - required this.boundaryName}); - - @override - final String projectId; - @override - final String boundaryCode; - @override - final int batchSize; - @override - final int initialServerCount; - @override - final String boundaryName; - - @override - String toString() { - return 'BeneficiaryDownSyncEvent.downSync(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, boundaryName: $boundaryName)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DownSyncBeneficiaryEventImpl && - (identical(other.projectId, projectId) || - other.projectId == projectId) && - (identical(other.boundaryCode, boundaryCode) || - other.boundaryCode == boundaryCode) && - (identical(other.batchSize, batchSize) || - other.batchSize == batchSize) && - (identical(other.initialServerCount, initialServerCount) || - other.initialServerCount == initialServerCount) && - (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); - } - - @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - batchSize, initialServerCount, boundaryName); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$DownSyncBeneficiaryEventImplCopyWith<_$DownSyncBeneficiaryEventImpl> - get copyWith => __$$DownSyncBeneficiaryEventImplCopyWithImpl< - _$DownSyncBeneficiaryEventImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, - required TResult Function( - List appConfiguration, - String projectId, - String boundaryCode, - int pendingSyncCount, - String boundaryName) - getBatchSize, - required TResult Function() downSyncReport, - required TResult Function() resetState, - }) { - return downSync( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, - TResult? Function(List appConfiguration, String projectId, - String boundaryCode, int pendingSyncCount, String boundaryName)? - getBatchSize, - TResult? Function()? downSyncReport, - TResult? Function()? resetState, - }) { - return downSync?.call( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, - TResult Function(List appConfiguration, String projectId, - String boundaryCode, int pendingSyncCount, String boundaryName)? - getBatchSize, - TResult Function()? downSyncReport, - TResult Function()? resetState, - required TResult orElse(), - }) { - if (downSync != null) { - return downSync( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, - required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, - required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, - required TResult Function(DownSyncReportEvent value) downSyncReport, - required TResult Function(DownSyncResetStateEvent value) resetState, - }) { - return downSync(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, - TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, - TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, - TResult? Function(DownSyncReportEvent value)? downSyncReport, - TResult? Function(DownSyncResetStateEvent value)? resetState, - }) { - return downSync?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, - TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, - TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, - TResult Function(DownSyncReportEvent value)? downSyncReport, - TResult Function(DownSyncResetStateEvent value)? resetState, - required TResult orElse(), - }) { - if (downSync != null) { - return downSync(this); - } - return orElse(); - } -} - -abstract class DownSyncBeneficiaryEvent implements BeneficiaryDownSyncEvent { - const factory DownSyncBeneficiaryEvent( - {required final String projectId, - required final String boundaryCode, - required final int batchSize, - required final int initialServerCount, - required final String boundaryName}) = _$DownSyncBeneficiaryEventImpl; - - String get projectId; - String get boundaryCode; - int get batchSize; - int get initialServerCount; - String get boundaryName; - @JsonKey(ignore: true) - _$$DownSyncBeneficiaryEventImplCopyWith<_$DownSyncBeneficiaryEventImpl> - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class _$$DownSyncOfClfBeneficiaryEventImplCopyWith<$Res> { - factory _$$DownSyncOfClfBeneficiaryEventImplCopyWith( - _$DownSyncOfClfBeneficiaryEventImpl value, - $Res Function(_$DownSyncOfClfBeneficiaryEventImpl) then) = - __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl<$Res>; - @useResult - $Res call( - {String projectId, - String boundaryCode, - int batchSize, - int initialServerCount, - String boundaryName}); -} - -/// @nodoc -class __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl<$Res> - extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, - _$DownSyncOfClfBeneficiaryEventImpl> - implements _$$DownSyncOfClfBeneficiaryEventImplCopyWith<$Res> { - __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl( - _$DownSyncOfClfBeneficiaryEventImpl _value, - $Res Function(_$DownSyncOfClfBeneficiaryEventImpl) _then) - : super(_value, _then); - - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? projectId = null, - Object? boundaryCode = null, - Object? batchSize = null, - Object? initialServerCount = null, - Object? boundaryName = null, - }) { - return _then(_$DownSyncOfClfBeneficiaryEventImpl( - projectId: null == projectId - ? _value.projectId - : projectId // ignore: cast_nullable_to_non_nullable - as String, - boundaryCode: null == boundaryCode - ? _value.boundaryCode - : boundaryCode // ignore: cast_nullable_to_non_nullable - as String, - batchSize: null == batchSize - ? _value.batchSize - : batchSize // ignore: cast_nullable_to_non_nullable - as int, - initialServerCount: null == initialServerCount - ? _value.initialServerCount - : initialServerCount // ignore: cast_nullable_to_non_nullable - as int, - boundaryName: null == boundaryName - ? _value.boundaryName - : boundaryName // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc - -class _$DownSyncOfClfBeneficiaryEventImpl - implements DownSyncOfClfBeneficiaryEvent { - const _$DownSyncOfClfBeneficiaryEventImpl( - {required this.projectId, - required this.boundaryCode, - required this.batchSize, - required this.initialServerCount, - required this.boundaryName}); - - @override - final String projectId; - @override - final String boundaryCode; - @override - final int batchSize; - @override - final int initialServerCount; - @override - final String boundaryName; - - @override - String toString() { - return 'BeneficiaryDownSyncEvent.downSyncCLF(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, boundaryName: $boundaryName)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$DownSyncOfClfBeneficiaryEventImpl && - (identical(other.projectId, projectId) || - other.projectId == projectId) && - (identical(other.boundaryCode, boundaryCode) || - other.boundaryCode == boundaryCode) && - (identical(other.batchSize, batchSize) || - other.batchSize == batchSize) && - (identical(other.initialServerCount, initialServerCount) || - other.initialServerCount == initialServerCount) && - (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); - } - - @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - batchSize, initialServerCount, boundaryName); - - @JsonKey(ignore: true) - @override - @pragma('vm:prefer-inline') - _$$DownSyncOfClfBeneficiaryEventImplCopyWith< - _$DownSyncOfClfBeneficiaryEventImpl> - get copyWith => __$$DownSyncOfClfBeneficiaryEventImplCopyWithImpl< - _$DownSyncOfClfBeneficiaryEventImpl>(this, _$identity); - - @override - @optionalTypeArgs - TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, - required TResult Function( - List appConfiguration, - String projectId, - String boundaryCode, - int pendingSyncCount, - String boundaryName) - getBatchSize, - required TResult Function() downSyncReport, - required TResult Function() resetState, - }) { - return downSyncCLF( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - - @override - @optionalTypeArgs - TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, - TResult? Function(List appConfiguration, String projectId, - String boundaryCode, int pendingSyncCount, String boundaryName)? - getBatchSize, - TResult? Function()? downSyncReport, - TResult? Function()? resetState, - }) { - return downSyncCLF?.call( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - - @override - @optionalTypeArgs - TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, - TResult Function(List appConfiguration, String projectId, - String boundaryCode, int pendingSyncCount, String boundaryName)? - getBatchSize, - TResult Function()? downSyncReport, - TResult Function()? resetState, - required TResult orElse(), - }) { - if (downSyncCLF != null) { - return downSyncCLF( - projectId, boundaryCode, batchSize, initialServerCount, boundaryName); - } - return orElse(); - } - - @override - @optionalTypeArgs - TResult map({ - required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, - required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, - required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, - required TResult Function(DownSyncReportEvent value) downSyncReport, - required TResult Function(DownSyncResetStateEvent value) resetState, - }) { - return downSyncCLF(this); - } - - @override - @optionalTypeArgs - TResult? mapOrNull({ - TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, - TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, - TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, - TResult? Function(DownSyncReportEvent value)? downSyncReport, - TResult? Function(DownSyncResetStateEvent value)? resetState, - }) { - return downSyncCLF?.call(this); - } - - @override - @optionalTypeArgs - TResult maybeMap({ - TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, - TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, - TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, - TResult Function(DownSyncReportEvent value)? downSyncReport, - TResult Function(DownSyncResetStateEvent value)? resetState, - required TResult orElse(), - }) { - if (downSyncCLF != null) { - return downSyncCLF(this); - } - return orElse(); - } -} - -abstract class DownSyncOfClfBeneficiaryEvent - implements BeneficiaryDownSyncEvent { - const factory DownSyncOfClfBeneficiaryEvent( - {required final String projectId, - required final String boundaryCode, - required final int batchSize, - required final int initialServerCount, - required final String boundaryName}) = - _$DownSyncOfClfBeneficiaryEventImpl; - - String get projectId; - String get boundaryCode; - int get batchSize; - int get initialServerCount; - String get boundaryName; - @JsonKey(ignore: true) - _$$DownSyncOfClfBeneficiaryEventImplCopyWith< - _$DownSyncOfClfBeneficiaryEventImpl> - get copyWith => throw _privateConstructorUsedError; + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; } /// @nodoc -abstract class _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { - factory _$$DownSyncCheckTotalCountEventImplCopyWith( - _$DownSyncCheckTotalCountEventImpl value, - $Res Function(_$DownSyncCheckTotalCountEventImpl) then) = - __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res>; +abstract class _$$DownSyncBeneficiaryEventImplCopyWith<$Res> { + factory _$$DownSyncBeneficiaryEventImplCopyWith( + _$DownSyncBeneficiaryEventImpl value, + $Res Function(_$DownSyncBeneficiaryEventImpl) then) = + __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res>; @useResult $Res call( {String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, - String boundaryName}); + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor}); } /// @nodoc -class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> +class __$$DownSyncBeneficiaryEventImplCopyWithImpl<$Res> extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, - _$DownSyncCheckTotalCountEventImpl> - implements _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { - __$$DownSyncCheckTotalCountEventImplCopyWithImpl( - _$DownSyncCheckTotalCountEventImpl _value, - $Res Function(_$DownSyncCheckTotalCountEventImpl) _then) + _$DownSyncBeneficiaryEventImpl> + implements _$$DownSyncBeneficiaryEventImplCopyWith<$Res> { + __$$DownSyncBeneficiaryEventImplCopyWithImpl( + _$DownSyncBeneficiaryEventImpl _value, + $Res Function(_$DownSyncBeneficiaryEventImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -699,11 +187,14 @@ class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> $Res call({ Object? projectId = null, Object? boundaryCode = null, - Object? pendingSyncCount = null, Object? batchSize = null, + Object? initialServerCount = null, + Object? clfServerCount = null, Object? boundaryName = null, + Object? isCommunityCreator = null, + Object? isDistributor = null, }) { - return _then(_$DownSyncCheckTotalCountEventImpl( + return _then(_$DownSyncBeneficiaryEventImpl( projectId: null == projectId ? _value.projectId : projectId // ignore: cast_nullable_to_non_nullable @@ -712,93 +203,133 @@ class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> ? _value.boundaryCode : boundaryCode // ignore: cast_nullable_to_non_nullable as String, - pendingSyncCount: null == pendingSyncCount - ? _value.pendingSyncCount - : pendingSyncCount // ignore: cast_nullable_to_non_nullable - as int, batchSize: null == batchSize ? _value.batchSize : batchSize // ignore: cast_nullable_to_non_nullable as int, + initialServerCount: null == initialServerCount + ? _value.initialServerCount + : initialServerCount // ignore: cast_nullable_to_non_nullable + as int, + clfServerCount: null == clfServerCount + ? _value.clfServerCount + : clfServerCount // ignore: cast_nullable_to_non_nullable + as int, boundaryName: null == boundaryName ? _value.boundaryName : boundaryName // ignore: cast_nullable_to_non_nullable as String, + isCommunityCreator: null == isCommunityCreator + ? _value.isCommunityCreator + : isCommunityCreator // ignore: cast_nullable_to_non_nullable + as bool, + isDistributor: null == isDistributor + ? _value.isDistributor + : isDistributor // ignore: cast_nullable_to_non_nullable + as bool, )); } } /// @nodoc -class _$DownSyncCheckTotalCountEventImpl - implements DownSyncCheckTotalCountEvent { - const _$DownSyncCheckTotalCountEventImpl( +class _$DownSyncBeneficiaryEventImpl implements DownSyncBeneficiaryEvent { + const _$DownSyncBeneficiaryEventImpl( {required this.projectId, required this.boundaryCode, - required this.pendingSyncCount, required this.batchSize, - required this.boundaryName}); + required this.initialServerCount, + required this.clfServerCount, + required this.boundaryName, + required this.isCommunityCreator, + required this.isDistributor}); @override final String projectId; @override final String boundaryCode; @override - final int pendingSyncCount; - @override final int batchSize; @override + final int initialServerCount; + @override + final int clfServerCount; + @override final String boundaryName; + @override + final bool isCommunityCreator; + @override + final bool isDistributor; @override String toString() { - return 'BeneficiaryDownSyncEvent.checkForData(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName)'; + return 'BeneficiaryDownSyncEvent.downSync(projectId: $projectId, boundaryCode: $boundaryCode, batchSize: $batchSize, initialServerCount: $initialServerCount, clfServerCount: $clfServerCount, boundaryName: $boundaryName, isCommunityCreator: $isCommunityCreator, isDistributor: $isDistributor)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$DownSyncCheckTotalCountEventImpl && + other is _$DownSyncBeneficiaryEventImpl && (identical(other.projectId, projectId) || other.projectId == projectId) && (identical(other.boundaryCode, boundaryCode) || other.boundaryCode == boundaryCode) && - (identical(other.pendingSyncCount, pendingSyncCount) || - other.pendingSyncCount == pendingSyncCount) && (identical(other.batchSize, batchSize) || other.batchSize == batchSize) && + (identical(other.initialServerCount, initialServerCount) || + other.initialServerCount == initialServerCount) && + (identical(other.clfServerCount, clfServerCount) || + other.clfServerCount == clfServerCount) && (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); + other.boundaryName == boundaryName) && + (identical(other.isCommunityCreator, isCommunityCreator) || + other.isCommunityCreator == isCommunityCreator) && + (identical(other.isDistributor, isDistributor) || + other.isDistributor == isDistributor)); } @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - pendingSyncCount, batchSize, boundaryName); + int get hashCode => Object.hash( + runtimeType, + projectId, + boundaryCode, + batchSize, + initialServerCount, + clfServerCount, + boundaryName, + isCommunityCreator, + isDistributor); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DownSyncCheckTotalCountEventImplCopyWith< - _$DownSyncCheckTotalCountEventImpl> - get copyWith => __$$DownSyncCheckTotalCountEventImplCopyWithImpl< - _$DownSyncCheckTotalCountEventImpl>(this, _$identity); + _$$DownSyncBeneficiaryEventImplCopyWith<_$DownSyncBeneficiaryEventImpl> + get copyWith => __$$DownSyncBeneficiaryEventImplCopyWithImpl< + _$DownSyncBeneficiaryEventImpl>(this, _$identity); @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -809,50 +340,71 @@ class _$DownSyncCheckTotalCountEventImpl required TResult Function() downSyncReport, required TResult Function() resetState, }) { - return checkForData( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return downSync(projectId, boundaryCode, batchSize, initialServerCount, + clfServerCount, boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function()? downSyncReport, TResult? Function()? resetState, }) { - return checkForData?.call( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return downSync?.call( + projectId, + boundaryCode, + batchSize, + initialServerCount, + clfServerCount, + boundaryName, + isCommunityCreator, + isDistributor); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -860,9 +412,9 @@ class _$DownSyncCheckTotalCountEventImpl TResult Function()? resetState, required TResult orElse(), }) { - if (checkForData != null) { - return checkForData( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + if (downSync != null) { + return downSync(projectId, boundaryCode, batchSize, initialServerCount, + clfServerCount, boundaryName, isCommunityCreator, isDistributor); } return orElse(); } @@ -871,93 +423,92 @@ class _$DownSyncCheckTotalCountEventImpl @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, }) { - return checkForData(this); + return downSync(this); } @override @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, }) { - return checkForData?.call(this); + return downSync?.call(this); } @override @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, required TResult orElse(), }) { - if (checkForData != null) { - return checkForData(this); + if (downSync != null) { + return downSync(this); } return orElse(); } } -abstract class DownSyncCheckTotalCountEvent - implements BeneficiaryDownSyncEvent { - const factory DownSyncCheckTotalCountEvent( +abstract class DownSyncBeneficiaryEvent implements BeneficiaryDownSyncEvent { + const factory DownSyncBeneficiaryEvent( {required final String projectId, required final String boundaryCode, - required final int pendingSyncCount, required final int batchSize, - required final String boundaryName}) = _$DownSyncCheckTotalCountEventImpl; + required final int initialServerCount, + required final int clfServerCount, + required final String boundaryName, + required final bool isCommunityCreator, + required final bool isDistributor}) = _$DownSyncBeneficiaryEventImpl; String get projectId; String get boundaryCode; - int get pendingSyncCount; int get batchSize; + int get initialServerCount; + int get clfServerCount; String get boundaryName; + bool get isCommunityCreator; + bool get isDistributor; @JsonKey(ignore: true) - _$$DownSyncCheckTotalCountEventImplCopyWith< - _$DownSyncCheckTotalCountEventImpl> + _$$DownSyncBeneficiaryEventImplCopyWith<_$DownSyncBeneficiaryEventImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$DownSyncClfCheckTotalCountEventImplCopyWith<$Res> { - factory _$$DownSyncClfCheckTotalCountEventImplCopyWith( - _$DownSyncClfCheckTotalCountEventImpl value, - $Res Function(_$DownSyncClfCheckTotalCountEventImpl) then) = - __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res>; +abstract class _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { + factory _$$DownSyncCheckTotalCountEventImplCopyWith( + _$DownSyncCheckTotalCountEventImpl value, + $Res Function(_$DownSyncCheckTotalCountEventImpl) then) = + __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res>; @useResult $Res call( {String projectId, String boundaryCode, int pendingSyncCount, int batchSize, - String boundaryName}); + String boundaryName, + bool isCommunityCreator, + bool isDistributor}); } /// @nodoc -class __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res> +class __$$DownSyncCheckTotalCountEventImplCopyWithImpl<$Res> extends _$BeneficiaryDownSyncEventCopyWithImpl<$Res, - _$DownSyncClfCheckTotalCountEventImpl> - implements _$$DownSyncClfCheckTotalCountEventImplCopyWith<$Res> { - __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl( - _$DownSyncClfCheckTotalCountEventImpl _value, - $Res Function(_$DownSyncClfCheckTotalCountEventImpl) _then) + _$DownSyncCheckTotalCountEventImpl> + implements _$$DownSyncCheckTotalCountEventImplCopyWith<$Res> { + __$$DownSyncCheckTotalCountEventImplCopyWithImpl( + _$DownSyncCheckTotalCountEventImpl _value, + $Res Function(_$DownSyncCheckTotalCountEventImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -968,8 +519,10 @@ class __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res> Object? pendingSyncCount = null, Object? batchSize = null, Object? boundaryName = null, + Object? isCommunityCreator = null, + Object? isDistributor = null, }) { - return _then(_$DownSyncClfCheckTotalCountEventImpl( + return _then(_$DownSyncCheckTotalCountEventImpl( projectId: null == projectId ? _value.projectId : projectId // ignore: cast_nullable_to_non_nullable @@ -990,20 +543,30 @@ class __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl<$Res> ? _value.boundaryName : boundaryName // ignore: cast_nullable_to_non_nullable as String, + isCommunityCreator: null == isCommunityCreator + ? _value.isCommunityCreator + : isCommunityCreator // ignore: cast_nullable_to_non_nullable + as bool, + isDistributor: null == isDistributor + ? _value.isDistributor + : isDistributor // ignore: cast_nullable_to_non_nullable + as bool, )); } } /// @nodoc -class _$DownSyncClfCheckTotalCountEventImpl - implements DownSyncClfCheckTotalCountEvent { - const _$DownSyncClfCheckTotalCountEventImpl( +class _$DownSyncCheckTotalCountEventImpl + implements DownSyncCheckTotalCountEvent { + const _$DownSyncCheckTotalCountEventImpl( {required this.projectId, required this.boundaryCode, required this.pendingSyncCount, required this.batchSize, - required this.boundaryName}); + required this.boundaryName, + required this.isCommunityCreator, + required this.isDistributor}); @override final String projectId; @@ -1015,17 +578,21 @@ class _$DownSyncClfCheckTotalCountEventImpl final int batchSize; @override final String boundaryName; + @override + final bool isCommunityCreator; + @override + final bool isDistributor; @override String toString() { - return 'BeneficiaryDownSyncEvent.checkForClf(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName)'; + return 'BeneficiaryDownSyncEvent.checkForData(projectId: $projectId, boundaryCode: $boundaryCode, pendingSyncCount: $pendingSyncCount, batchSize: $batchSize, boundaryName: $boundaryName, isCommunityCreator: $isCommunityCreator, isDistributor: $isDistributor)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$DownSyncClfCheckTotalCountEventImpl && + other is _$DownSyncCheckTotalCountEventImpl && (identical(other.projectId, projectId) || other.projectId == projectId) && (identical(other.boundaryCode, boundaryCode) || @@ -1035,36 +602,54 @@ class _$DownSyncClfCheckTotalCountEventImpl (identical(other.batchSize, batchSize) || other.batchSize == batchSize) && (identical(other.boundaryName, boundaryName) || - other.boundaryName == boundaryName)); + other.boundaryName == boundaryName) && + (identical(other.isCommunityCreator, isCommunityCreator) || + other.isCommunityCreator == isCommunityCreator) && + (identical(other.isDistributor, isDistributor) || + other.isDistributor == isDistributor)); } @override - int get hashCode => Object.hash(runtimeType, projectId, boundaryCode, - pendingSyncCount, batchSize, boundaryName); + int get hashCode => Object.hash( + runtimeType, + projectId, + boundaryCode, + pendingSyncCount, + batchSize, + boundaryName, + isCommunityCreator, + isDistributor); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$DownSyncClfCheckTotalCountEventImplCopyWith< - _$DownSyncClfCheckTotalCountEventImpl> - get copyWith => __$$DownSyncClfCheckTotalCountEventImplCopyWithImpl< - _$DownSyncClfCheckTotalCountEventImpl>(this, _$identity); + _$$DownSyncCheckTotalCountEventImplCopyWith< + _$DownSyncCheckTotalCountEventImpl> + get copyWith => __$$DownSyncCheckTotalCountEventImplCopyWithImpl< + _$DownSyncCheckTotalCountEventImpl>(this, _$identity); @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -1075,50 +660,64 @@ class _$DownSyncClfCheckTotalCountEventImpl required TResult Function() downSyncReport, required TResult Function() resetState, }) { - return checkForClf( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return checkForData(projectId, boundaryCode, pendingSyncCount, batchSize, + boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function()? downSyncReport, TResult? Function()? resetState, }) { - return checkForClf?.call( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + return checkForData?.call(projectId, boundaryCode, pendingSyncCount, + batchSize, boundaryName, isCommunityCreator, isDistributor); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1126,9 +725,9 @@ class _$DownSyncClfCheckTotalCountEventImpl TResult Function()? resetState, required TResult orElse(), }) { - if (checkForClf != null) { - return checkForClf( - projectId, boundaryCode, pendingSyncCount, batchSize, boundaryName); + if (checkForData != null) { + return checkForData(projectId, boundaryCode, pendingSyncCount, batchSize, + boundaryName, isCommunityCreator, isDistributor); } return orElse(); } @@ -1137,68 +736,64 @@ class _$DownSyncClfCheckTotalCountEventImpl @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, }) { - return checkForClf(this); + return checkForData(this); } @override @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, }) { - return checkForClf?.call(this); + return checkForData?.call(this); } @override @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, required TResult orElse(), }) { - if (checkForClf != null) { - return checkForClf(this); + if (checkForData != null) { + return checkForData(this); } return orElse(); } } -abstract class DownSyncClfCheckTotalCountEvent +abstract class DownSyncCheckTotalCountEvent implements BeneficiaryDownSyncEvent { - const factory DownSyncClfCheckTotalCountEvent( - {required final String projectId, - required final String boundaryCode, - required final int pendingSyncCount, - required final int batchSize, - required final String boundaryName}) = - _$DownSyncClfCheckTotalCountEventImpl; + const factory DownSyncCheckTotalCountEvent( + {required final String projectId, + required final String boundaryCode, + required final int pendingSyncCount, + required final int batchSize, + required final String boundaryName, + required final bool isCommunityCreator, + required final bool isDistributor}) = _$DownSyncCheckTotalCountEventImpl; String get projectId; String get boundaryCode; int get pendingSyncCount; int get batchSize; String get boundaryName; + bool get isCommunityCreator; + bool get isDistributor; @JsonKey(ignore: true) - _$$DownSyncClfCheckTotalCountEventImplCopyWith< - _$DownSyncClfCheckTotalCountEventImpl> + _$$DownSyncCheckTotalCountEventImplCopyWith< + _$DownSyncCheckTotalCountEventImpl> get copyWith => throw _privateConstructorUsedError; } @@ -1331,18 +926,25 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -1360,18 +962,25 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1385,18 +994,25 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1415,10 +1031,7 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -1430,9 +1043,7 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -1444,9 +1055,7 @@ class _$DownSyncGetBatchSizeEventImpl implements DownSyncGetBatchSizeEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -1517,18 +1126,25 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -1545,18 +1161,25 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1569,18 +1192,25 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1598,10 +1228,7 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -1613,9 +1240,7 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -1627,9 +1252,7 @@ class _$DownSyncReportEventImpl implements DownSyncReportEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -1688,18 +1311,25 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult when({ - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) downSync, - required TResult Function(String projectId, String boundaryCode, - int batchSize, int initialServerCount, String boundaryName) - downSyncCLF, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) + required TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor) checkForData, - required TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName) - checkForClf, required TResult Function( List appConfiguration, String projectId, @@ -1716,18 +1346,25 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult? Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult? Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult? Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult? Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1740,18 +1377,25 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int batchSize, + int initialServerCount, + int clfServerCount, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? downSync, - TResult Function(String projectId, String boundaryCode, int batchSize, - int initialServerCount, String boundaryName)? - downSyncCLF, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? + TResult Function( + String projectId, + String boundaryCode, + int pendingSyncCount, + int batchSize, + String boundaryName, + bool isCommunityCreator, + bool isDistributor)? checkForData, - TResult Function(String projectId, String boundaryCode, - int pendingSyncCount, int batchSize, String boundaryName)? - checkForClf, TResult Function(List appConfiguration, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, @@ -1769,10 +1413,7 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult map({ required TResult Function(DownSyncBeneficiaryEvent value) downSync, - required TResult Function(DownSyncOfClfBeneficiaryEvent value) downSyncCLF, required TResult Function(DownSyncCheckTotalCountEvent value) checkForData, - required TResult Function(DownSyncClfCheckTotalCountEvent value) - checkForClf, required TResult Function(DownSyncGetBatchSizeEvent value) getBatchSize, required TResult Function(DownSyncReportEvent value) downSyncReport, required TResult Function(DownSyncResetStateEvent value) resetState, @@ -1784,9 +1425,7 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult? mapOrNull({ TResult? Function(DownSyncBeneficiaryEvent value)? downSync, - TResult? Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult? Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult? Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult? Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult? Function(DownSyncReportEvent value)? downSyncReport, TResult? Function(DownSyncResetStateEvent value)? resetState, @@ -1798,9 +1437,7 @@ class _$DownSyncResetStateEventImpl implements DownSyncResetStateEvent { @optionalTypeArgs TResult maybeMap({ TResult Function(DownSyncBeneficiaryEvent value)? downSync, - TResult Function(DownSyncOfClfBeneficiaryEvent value)? downSyncCLF, TResult Function(DownSyncCheckTotalCountEvent value)? checkForData, - TResult Function(DownSyncClfCheckTotalCountEvent value)? checkForClf, TResult Function(DownSyncGetBatchSizeEvent value)? getBatchSize, TResult Function(DownSyncReportEvent value)? downSyncReport, TResult Function(DownSyncResetStateEvent value)? resetState, @@ -1821,14 +1458,18 @@ abstract class DownSyncResetStateEvent implements BeneficiaryDownSyncEvent { mixin _$BeneficiaryDownSyncState { @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -1838,14 +1479,17 @@ mixin _$BeneficiaryDownSyncState { throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -1855,14 +1499,17 @@ mixin _$BeneficiaryDownSyncState { throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -1951,7 +1598,7 @@ abstract class _$$DownSyncInProgressStateImplCopyWith<$Res> { $Res Function(_$DownSyncInProgressStateImpl) then) = __$$DownSyncInProgressStateImplCopyWithImpl<$Res>; @useResult - $Res call({int syncedCount, int totalCount}); + $Res call({int syncedCount, int totalCount, int clfTotalCount}); } /// @nodoc @@ -1969,6 +1616,7 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> $Res call({ Object? syncedCount = null, Object? totalCount = null, + Object? clfTotalCount = null, }) { return _then(_$DownSyncInProgressStateImpl( null == syncedCount @@ -1979,6 +1627,10 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> ? _value.totalCount : totalCount // ignore: cast_nullable_to_non_nullable as int, + null == clfTotalCount + ? _value.clfTotalCount + : clfTotalCount // ignore: cast_nullable_to_non_nullable + as int, )); } } @@ -1986,17 +1638,20 @@ class __$$DownSyncInProgressStateImplCopyWithImpl<$Res> /// @nodoc class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { - const _$DownSyncInProgressStateImpl(this.syncedCount, this.totalCount) + const _$DownSyncInProgressStateImpl( + this.syncedCount, this.totalCount, this.clfTotalCount) : super._(); @override final int syncedCount; @override final int totalCount; + @override + final int clfTotalCount; @override String toString() { - return 'BeneficiaryDownSyncState.inProgress(syncedCount: $syncedCount, totalCount: $totalCount)'; + return 'BeneficiaryDownSyncState.inProgress(syncedCount: $syncedCount, totalCount: $totalCount, clfTotalCount: $clfTotalCount)'; } @override @@ -2007,11 +1662,14 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { (identical(other.syncedCount, syncedCount) || other.syncedCount == syncedCount) && (identical(other.totalCount, totalCount) || - other.totalCount == totalCount)); + other.totalCount == totalCount) && + (identical(other.clfTotalCount, clfTotalCount) || + other.clfTotalCount == clfTotalCount)); } @override - int get hashCode => Object.hash(runtimeType, syncedCount, totalCount); + int get hashCode => + Object.hash(runtimeType, syncedCount, totalCount, clfTotalCount); @JsonKey(ignore: true) @override @@ -2023,54 +1681,64 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, required TResult Function(List downsyncCriteriaList) report, required TResult Function() pendingSync, }) { - return inProgress(syncedCount, totalCount); + return inProgress(syncedCount, totalCount, clfTotalCount); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, TResult? Function(List downsyncCriteriaList)? report, TResult? Function()? pendingSync, }) { - return inProgress?.call(syncedCount, totalCount); + return inProgress?.call(syncedCount, totalCount, clfTotalCount); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2079,7 +1747,7 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { required TResult orElse(), }) { if (inProgress != null) { - return inProgress(syncedCount, totalCount); + return inProgress(syncedCount, totalCount, clfTotalCount); } return orElse(); } @@ -2151,12 +1819,14 @@ class _$DownSyncInProgressStateImpl extends _DownSyncInProgressState { abstract class _DownSyncInProgressState extends BeneficiaryDownSyncState { const factory _DownSyncInProgressState( - final int syncedCount, final int totalCount) = - _$DownSyncInProgressStateImpl; + final int syncedCount, + final int totalCount, + final int clfTotalCount) = _$DownSyncInProgressStateImpl; const _DownSyncInProgressState._() : super._(); int get syncedCount; int get totalCount; + int get clfTotalCount; @JsonKey(ignore: true) _$$DownSyncInProgressStateImplCopyWith<_$DownSyncInProgressStateImpl> get copyWith => throw _privateConstructorUsedError; @@ -2230,14 +1900,18 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2250,14 +1924,17 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2270,14 +1947,17 @@ class _$DownSyncSuccessStateImpl extends _DownSyncSuccessState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2480,14 +2160,18 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2501,14 +2185,17 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2522,14 +2209,17 @@ class _$DownSyncGetBatchSizeStateImpl extends _DownSyncGetBatchSizeState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2695,14 +2385,18 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2715,14 +2409,17 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2735,14 +2432,17 @@ class _$DownSyncLoadingStateImpl extends _DownSyncLoadingState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -2875,14 +2575,18 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -2895,14 +2599,17 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -2915,14 +2622,17 @@ class _$DownSyncInsufficientStorageStateImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3015,7 +2725,7 @@ abstract class _$$DownSyncDataFoundStateImplCopyWith<$Res> { $Res Function(_$DownSyncDataFoundStateImpl) then) = __$$DownSyncDataFoundStateImplCopyWithImpl<$Res>; @useResult - $Res call({int initialServerCount, int batchSize}); + $Res call({int initialServerCount, int initialClfServerCount, int batchSize}); } /// @nodoc @@ -3032,6 +2742,7 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> @override $Res call({ Object? initialServerCount = null, + Object? initialClfServerCount = null, Object? batchSize = null, }) { return _then(_$DownSyncDataFoundStateImpl( @@ -3039,6 +2750,10 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> ? _value.initialServerCount : initialServerCount // ignore: cast_nullable_to_non_nullable as int, + null == initialClfServerCount + ? _value.initialClfServerCount + : initialClfServerCount // ignore: cast_nullable_to_non_nullable + as int, null == batchSize ? _value.batchSize : batchSize // ignore: cast_nullable_to_non_nullable @@ -3050,17 +2765,20 @@ class __$$DownSyncDataFoundStateImplCopyWithImpl<$Res> /// @nodoc class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { - const _$DownSyncDataFoundStateImpl(this.initialServerCount, this.batchSize) + const _$DownSyncDataFoundStateImpl( + this.initialServerCount, this.initialClfServerCount, this.batchSize) : super._(); @override final int initialServerCount; @override + final int initialClfServerCount; + @override final int batchSize; @override String toString() { - return 'BeneficiaryDownSyncState.dataFound(initialServerCount: $initialServerCount, batchSize: $batchSize)'; + return 'BeneficiaryDownSyncState.dataFound(initialServerCount: $initialServerCount, initialClfServerCount: $initialClfServerCount, batchSize: $batchSize)'; } @override @@ -3070,12 +2788,15 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { other is _$DownSyncDataFoundStateImpl && (identical(other.initialServerCount, initialServerCount) || other.initialServerCount == initialServerCount) && + (identical(other.initialClfServerCount, initialClfServerCount) || + other.initialClfServerCount == initialClfServerCount) && (identical(other.batchSize, batchSize) || other.batchSize == batchSize)); } @override - int get hashCode => Object.hash(runtimeType, initialServerCount, batchSize); + int get hashCode => Object.hash( + runtimeType, initialServerCount, initialClfServerCount, batchSize); @JsonKey(ignore: true) @override @@ -3087,54 +2808,65 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, required TResult Function(List downsyncCriteriaList) report, required TResult Function() pendingSync, }) { - return dataFound(initialServerCount, batchSize); + return dataFound(initialServerCount, initialClfServerCount, batchSize); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, TResult? Function(List downsyncCriteriaList)? report, TResult? Function()? pendingSync, }) { - return dataFound?.call(initialServerCount, batchSize); + return dataFound?.call( + initialServerCount, initialClfServerCount, batchSize); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3143,7 +2875,7 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { required TResult orElse(), }) { if (dataFound != null) { - return dataFound(initialServerCount, batchSize); + return dataFound(initialServerCount, initialClfServerCount, batchSize); } return orElse(); } @@ -3215,11 +2947,13 @@ class _$DownSyncDataFoundStateImpl extends _DownSyncDataFoundState { abstract class _DownSyncDataFoundState extends BeneficiaryDownSyncState { const factory _DownSyncDataFoundState( - final int initialServerCount, final int batchSize) = - _$DownSyncDataFoundStateImpl; + final int initialServerCount, + final int initialClfServerCount, + final int batchSize) = _$DownSyncDataFoundStateImpl; const _DownSyncDataFoundState._() : super._(); int get initialServerCount; + int get initialClfServerCount; int get batchSize; @JsonKey(ignore: true) _$$DownSyncDataFoundStateImplCopyWith<_$DownSyncDataFoundStateImpl> @@ -3265,14 +2999,18 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3285,14 +3023,17 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3305,14 +3046,17 @@ class _$DownSyncResetStateImpl extends _DownSyncResetState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3439,14 +3183,18 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3459,14 +3207,17 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3479,14 +3230,17 @@ class _$DownSynnCountCheckFailedStateImpl @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3611,14 +3365,18 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3631,14 +3389,17 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3651,14 +3412,17 @@ class _$DownSyncFailureStateImpl extends _DownSyncFailureState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3819,14 +3583,18 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -3839,14 +3607,17 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -3859,14 +3630,17 @@ class _$DownSyncReportStateImpl extends _DownSyncReportState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, @@ -3999,14 +3773,18 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult when({ - required TResult Function(int syncedCount, int totalCount) inProgress, + required TResult Function( + int syncedCount, int totalCount, int clfTotalCount) + inProgress, required TResult Function(DownsyncModel downSyncResult) success, required TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName) getBatchSize, required TResult Function(bool isPop) loading, required TResult Function() insufficientStorage, - required TResult Function(int initialServerCount, int batchSize) dataFound, + required TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize) + dataFound, required TResult Function() resetState, required TResult Function() totalCountCheckFailed, required TResult Function() failed, @@ -4019,14 +3797,17 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(int syncedCount, int totalCount)? inProgress, + TResult? Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult? Function(DownsyncModel downSyncResult)? success, TResult? Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult? Function(bool isPop)? loading, TResult? Function()? insufficientStorage, - TResult? Function(int initialServerCount, int batchSize)? dataFound, + TResult? Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult? Function()? resetState, TResult? Function()? totalCountCheckFailed, TResult? Function()? failed, @@ -4039,14 +3820,17 @@ class _$DownSyncPendingSyncStateImpl extends _DownSyncPendingSyncState { @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(int syncedCount, int totalCount)? inProgress, + TResult Function(int syncedCount, int totalCount, int clfTotalCount)? + inProgress, TResult Function(DownsyncModel downSyncResult)? success, TResult Function(int batchSize, String projectId, String boundaryCode, int pendingSyncCount, String boundaryName)? getBatchSize, TResult Function(bool isPop)? loading, TResult Function()? insufficientStorage, - TResult Function(int initialServerCount, int batchSize)? dataFound, + TResult Function( + int initialServerCount, int initialClfServerCount, int batchSize)? + dataFound, TResult Function()? resetState, TResult Function()? totalCountCheckFailed, TResult Function()? failed, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index b6ef20eb7d..399e33a085 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -28,7 +28,8 @@ class DownsyncRemoteRepository Map finalResult = { "Households": [], - "DownsyncCriteria": {} + "DownsyncCriteria": {}, + "numberOfMembers": [] }; Response response; @@ -72,11 +73,15 @@ class DownsyncRemoteRepository final entityResponse = responseMap['Households']; - final household_map = entityResponse['HouseholdCountMap'] as List; + final householdMap = entityResponse['HouseholdCountMap'] as List; try { - household_map - .forEach((e) => finalResult["Household"].add(e['household'])); + for (var item in householdMap) { + if (item is Map && item.containsKey('household')) { + finalResult["Households"].add(item['household']); + finalResult["numberOfMembers"].add(item['numberOfMembers']); + } + } } catch (e) { rethrow; } diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index 7da4985212..5bc24a1dcc 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -263,11 +263,10 @@ class _BoundarySelectionPageState pendingSyncCount, boundaryName, ) { - if (isCommunityCreator) { - context - .read() - .add( - DownSyncClfCheckTotalCountEvent( + context + .read() + .add( + DownSyncCheckTotalCountEvent( projectId: context.projectId, boundaryCode: selectedBoundary! .value!.code @@ -278,27 +277,10 @@ class _BoundarySelectionPageState .value!.name .toString(), batchSize: batchSize, - ), - ); - } - if (isDistributor) { - context - .read() - .add( - DownSyncCheckTotalCountEvent( - projectId: context.projectId, - boundaryCode: selectedBoundary! - .value!.code - .toString(), - pendingSyncCount: - pendingSyncCount, - boundaryName: selectedBoundary - .value!.name - .toString(), - batchSize: batchSize, - ), - ); - } + isCommunityCreator: + isCommunityCreator, + isDistributor: isDistributor), + ); }, pendingSync: () => showDownloadDialog( context, @@ -327,13 +309,15 @@ class _BoundarySelectionPageState isCommunityCreator: isCommunityCreator, isDistributor: isDistributor, ), - dataFound: (initialServerCount, batchSize) { + dataFound: (initialServerCount, + initialClfServerCount, batchSize) { clickedStatus.value = false; showDownloadDialog( context, model: DownloadBeneficiary( title: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.beneficiaryDetails .dataFound : i18.beneficiaryDetails @@ -346,8 +330,10 @@ class _BoundarySelectionPageState .toString(), batchSize: batchSize, totalCount: initialServerCount, + clfTotalCount: initialClfServerCount, content: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.beneficiaryDetails .dataFoundContent : i18.beneficiaryDetails @@ -355,13 +341,15 @@ class _BoundarySelectionPageState ), primaryButtonLabel: localizations.translate( - initialServerCount > 0 + (initialServerCount > 0 || + initialClfServerCount > 0) ? i18.common.coreCommonDownload : i18.common.coreCommonGoback, ), secondaryButtonLabel: localizations.translate( - initialServerCount > 0 + initialServerCount > 0 || + initialClfServerCount > 0 ? i18.beneficiaryDetails .proceedWithoutDownloading : i18.acknowledgementSuccess @@ -378,10 +366,12 @@ class _BoundarySelectionPageState isDistributor: isDistributor, ); }, - inProgress: (syncCount, totalCount) { + inProgress: + (syncCount, totalCount, clfTotalCount) { downloadProgress.add( min( - (syncCount) / (totalCount), + (syncCount) / + (totalCount + clfTotalCount), 1, ), ); @@ -400,8 +390,11 @@ class _BoundarySelectionPageState appConfiguartion: appConfiguration, syncCount: syncCount, totalCount: totalCount, + clfTotalCount: clfTotalCount, prefixLabel: syncCount.toString(), - suffixLabel: totalCount.toString(), + suffixLabel: + (totalCount + clfTotalCount) + .toString(), boundaryName: selectedBoundary .value!.name .toString(), diff --git a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart index 1f2447a557..bc8188a82b 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/reports/beneficiary/beneficaries_report.dart @@ -135,6 +135,8 @@ class BeneficiariesReportState extends LocalizedState { pendingSyncCount: pendingSyncCount, boundaryName: boundaryName, batchSize: batchSize, + isDistributor: isDistributor, + isCommunityCreator: isCommunityCreator, ), ), report: (downSyncCriteriaList) { @@ -166,7 +168,8 @@ class BeneficiariesReportState extends LocalizedState { isCommunityCreator: isCommunityCreator, isDistributor: isDistributor, ), - dataFound: (initialServerCount, batchSize) => + dataFound: (initialServerCount, initialClfServerCount, + batchSize) => showDownloadDialog( context, model: DownloadBeneficiary( @@ -180,6 +183,7 @@ class BeneficiariesReportState extends LocalizedState { boundary: selectedBoundary!.code.toString(), batchSize: 5, totalCount: initialServerCount, + clfTotalCount: initialClfServerCount, content: localizations.translate( initialServerCount > 0 ? i18.beneficiaryDetails.dataFoundContent @@ -203,7 +207,7 @@ class BeneficiariesReportState extends LocalizedState { isCommunityCreator: isCommunityCreator, isDistributor: isDistributor, ), - inProgress: (syncCount, totalCount) { + inProgress: (syncCount, totalCount, clfCount) { downloadProgress.add( min( (syncCount) / (totalCount), @@ -221,6 +225,7 @@ class BeneficiariesReportState extends LocalizedState { appConfiguartion: appConfiguration, syncCount: syncCount, totalCount: totalCount, + clfTotalCount: clfCount, prefixLabel: syncCount.toString(), suffixLabel: totalCount.toString(), boundaryName: selectedBoundary!.name.toString(), diff --git a/apps/health_campaign_field_worker_app/lib/utils/constants.dart b/apps/health_campaign_field_worker_app/lib/utils/constants.dart index fe95a67674..06cb1da9d6 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/constants.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/constants.dart @@ -353,6 +353,7 @@ class DownloadBeneficiary { int? pendingSyncCount; int? syncCount; int? totalCount; + int? clfTotalCount; String? content; int? batchSize; String? primaryButtonLabel; @@ -371,6 +372,7 @@ class DownloadBeneficiary { this.batchSize, this.syncCount, this.totalCount, + this.clfTotalCount, this.content, this.primaryButtonLabel, this.secondaryButtonLabel, diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index a50c1d1888..bcf4f56ba9 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -299,24 +299,25 @@ void showDownloadDialog(BuildContext context, Navigator.of(context, rootNavigator: true).pop(); context.router.replaceAll([HomeRoute()]); } else { - if ((model.totalCount ?? 0) > 0) { - if (isCommunityCreator) { - Navigator.of(context, rootNavigator: true).pop(); - context.read().add( - DownSyncOfClfBeneficiaryEvent( - projectId: context.projectId, - boundaryCode: model.boundary, - batchSize: model.batchSize ?? 1, - initialServerCount: model.totalCount ?? 0, - boundaryName: model.boundaryName), - ); - } - if (isDistributor) { - Navigator.of(context, rootNavigator: true).pop(); - context.read().add( - const DownSyncResetStateEvent(), - ); - } + if ((model.totalCount ?? 0) > 0 || + (model.clfTotalCount ?? 0) > 0) { + context.read().add( + DownSyncBeneficiaryEvent( + projectId: context.projectId, + boundaryCode: model.boundary, + batchSize: model.batchSize ?? 1, + initialServerCount: model.totalCount ?? 0, + boundaryName: model.boundaryName, + clfServerCount: model.clfTotalCount ?? 0, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, + ), + ); + } else { + Navigator.of(context, rootNavigator: true).pop(); + context.read().add( + const DownSyncResetStateEvent(), + ); } } }, @@ -346,7 +347,7 @@ void showDownloadDialog(BuildContext context, label: '', prefixLabel: '', suffixLabel: - '${(snapshot.data == null ? 0 : snapshot.data! * model.totalCount!.toDouble()).toInt()}/${model.suffixLabel}', + '${(snapshot.data == null ? 0 : snapshot.data! * ((model.totalCount! + model.clfTotalCount!).toDouble().toInt()))}/${model.suffixLabel}', value: snapshot.data ?? 0, valueColor: AlwaysStoppedAnimation( DigitTheme.instance.colorScheme.secondary, From 5a98374f55bc6be2a19e1435edd07da6156c63f9 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Wed, 22 Jan 2025 16:51:04 +0530 Subject: [PATCH 37/47] added clf Offset and count tin table --- .../project_beneficiaries_downsync.dart | 26 ++- .../data/local_store/downsync/downsync.dart | 3 +- .../lib/models/downsync/downsync.dart | 6 + .../lib/models/downsync/downsync.mapper.dart | 18 ++ .../lib/pages/boundary_selection.dart | 2 +- .../local_store/sql_store/sql_store.g.dart | 156 +++++++++++++++--- .../sql_store/tables/downsync.dart | 18 +- 7 files changed, 192 insertions(+), 37 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index c9c5221958..3e8304711d 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -199,6 +199,10 @@ class BeneficiaryDownSyncBloc ? 0 : existingDownSyncData.first.offset ?? 0; + int clfOffset = existingDownSyncData.isEmpty + ? 0 + : existingDownSyncData.first.clfOffset ?? 0; + int totalCount = event.initialServerCount; int clfTotalCount = event.clfServerCount; @@ -210,9 +214,11 @@ class BeneficiaryDownSyncBloc if (existingDownSyncData.isEmpty) { await downSyncLocalRepository.create(DownsyncModel( offset: offset, + clfOffset: clfOffset, limit: event.batchSize, lastSyncedTime: lastSyncedTime, totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, )); @@ -262,13 +268,13 @@ class BeneficiaryDownSyncBloc } } - if (event.isCommunityCreator && offset < clfTotalCount) { + if (event.isCommunityCreator && clfOffset < clfTotalCount) { flag = true; final downSyncResults = await downSyncRemoteRepository .searchClfDownSync(DownsyncSearchModel( locality: event.boundaryCode, - offset: offset, + offset: clfOffset, limit: event.batchSize, totalCount: clfTotalCount, tenantId: envConfig.variables.tenantId, @@ -292,7 +298,7 @@ class BeneficiaryDownSyncBloc locality: event.boundaryCode, offset: memberOffset, limit: event.batchSize, - totalCount: totalCount, + totalCount: clfTotalCount, tenantId: envConfig.variables.tenantId, projectId: event.projectId, lastSyncedTime: lastSyncedTime, @@ -304,7 +310,6 @@ class BeneficiaryDownSyncBloc if (memberData["Households"] == null) { memberData["Households"] = []; memberData["Households"].add(e); - // e["householdType"] = HouseholdType.community; } await SyncServiceSingleton() .entityMapper @@ -335,16 +340,19 @@ class BeneficiaryDownSyncBloc existingDownSyncData.first.copyWith( offset: 0, limit: 0, - totalCount: clfTotalCount, + totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, lastSyncedTime: DateTime.now().millisecondsSinceEpoch, ), ); final result = DownsyncModel( - offset: clfTotalCount + totalCount, + offset: totalCount, + clfOffset: clfTotalCount, lastSyncedTime: DateTime.now().millisecondsSinceEpoch, - totalCount: clfTotalCount, + totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, ); @@ -353,10 +361,12 @@ class BeneficiaryDownSyncBloc break; } else { await downSyncLocalRepository.update(DownsyncModel( - offset: offset + event.batchSize, + offset: (totalCount != 0) ? offset + event.batchSize : 0, + clfOffset: (clfTotalCount != 0) ? clfOffset + event.batchSize : 0, limit: event.batchSize, lastSyncedTime: lastSyncedTime, totalCount: totalCount, + clfTotalCount: clfTotalCount, locality: event.boundaryCode, boundaryName: event.boundaryName, )); diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart index 9960641539..c0f7a95f1d 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/downsync/downsync.dart @@ -4,7 +4,6 @@ import 'package:digit_data_model/data_model.dart'; import 'package:drift/drift.dart'; import '../../../models/downsync/downsync.dart'; - class DownsyncLocalRepository extends LocalRepository { DownsyncLocalRepository(super.sql, super.opLogManager); @@ -69,6 +68,8 @@ class DownsyncLocalRepository return DownsyncModel( locality: data.locality, offset: data.offset, + clfOffset: data.clfOffset, + clfTotalCount: data.clfTotalCount, limit: data.offset, boundaryName: data.boundaryName, lastSyncedTime: data.lastSyncedTime, diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart index 2210d842d1..22ddf74129 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.dart @@ -55,9 +55,11 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { final String? locality; final String? projectId; final int? offset; + final int? clfOffset; final int? limit; final int? lastSyncedTime; final int? totalCount; + final int? clfTotalCount; final String? boundaryName; final bool? nonRecoverableError; final String? tenantId; @@ -70,6 +72,8 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { this.locality, this.projectId, this.offset, + this.clfOffset, + this.clfTotalCount, this.limit, this.lastSyncedTime, this.totalCount, @@ -98,6 +102,8 @@ class DownsyncModel extends EntityModel with DownsyncModelMappable { locality: Value(locality), projectId: Value(projectId), offset: Value(offset), + clfOffset: Value(clfOffset), + clfTotalCount: Value(clfTotalCount), limit: Value(limit), lastSyncedTime: Value(lastSyncedTime), totalCount: Value(totalCount), diff --git a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart index 2caf5147ef..81426fb457 100644 --- a/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart +++ b/apps/health_campaign_field_worker_app/lib/models/downsync/downsync.mapper.dart @@ -251,6 +251,12 @@ class DownsyncModelMapper extends SubClassMapperBase { static int? _$offset(DownsyncModel v) => v.offset; static const Field _f$offset = Field('offset', _$offset, opt: true); + static int? _$clfOffset(DownsyncModel v) => v.clfOffset; + static const Field _f$clfOffset = + Field('clfOffset', _$clfOffset, opt: true); + static int? _$clfTotalCount(DownsyncModel v) => v.clfTotalCount; + static const Field _f$clfTotalCount = + Field('clfTotalCount', _$clfTotalCount, opt: true); static int? _$limit(DownsyncModel v) => v.limit; static const Field _f$limit = Field('limit', _$limit, opt: true); @@ -293,6 +299,8 @@ class DownsyncModelMapper extends SubClassMapperBase { #locality: _f$locality, #projectId: _f$projectId, #offset: _f$offset, + #clfOffset: _f$clfOffset, + #clfTotalCount: _f$clfTotalCount, #limit: _f$limit, #lastSyncedTime: _f$lastSyncedTime, #totalCount: _f$totalCount, @@ -322,6 +330,8 @@ class DownsyncModelMapper extends SubClassMapperBase { locality: data.dec(_f$locality), projectId: data.dec(_f$projectId), offset: data.dec(_f$offset), + clfOffset: data.dec(_f$clfOffset), + clfTotalCount: data.dec(_f$clfTotalCount), limit: data.dec(_f$limit), lastSyncedTime: data.dec(_f$lastSyncedTime), totalCount: data.dec(_f$totalCount), @@ -401,6 +411,8 @@ abstract class DownsyncModelCopyWith<$R, $In extends DownsyncModel, $Out> String? locality, String? projectId, int? offset, + int? clfOffset, + int? clfTotalCount, int? limit, int? lastSyncedTime, int? totalCount, @@ -441,6 +453,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> Object? locality = $none, Object? projectId = $none, Object? offset = $none, + Object? clfOffset = $none, + Object? clfTotalCount = $none, Object? limit = $none, Object? lastSyncedTime = $none, Object? totalCount = $none, @@ -457,6 +471,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> if (locality != $none) #locality: locality, if (projectId != $none) #projectId: projectId, if (offset != $none) #offset: offset, + if (clfOffset != $none) #clfOffset: clfOffset, + if (clfTotalCount != $none) #clfTotalCount: clfTotalCount, if (limit != $none) #limit: limit, if (lastSyncedTime != $none) #lastSyncedTime: lastSyncedTime, if (totalCount != $none) #totalCount: totalCount, @@ -478,6 +494,8 @@ class _DownsyncModelCopyWithImpl<$R, $Out> locality: data.get(#locality, or: $value.locality), projectId: data.get(#projectId, or: $value.projectId), offset: data.get(#offset, or: $value.offset), + clfOffset: data.get(#clfOffset, or: $value.clfOffset), + clfTotalCount: data.get(#clfTotalCount, or: $value.clfTotalCount), limit: data.get(#limit, or: $value.limit), lastSyncedTime: data.get(#lastSyncedTime, or: $value.lastSyncedTime), totalCount: data.get(#totalCount, or: $value.totalCount), diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index 5bc24a1dcc..00bfd759b0 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -429,7 +429,7 @@ class _BoundarySelectionPageState i18.beneficiaryDetails.downloadedon, )} $date\n${localizations.translate( i18.beneficiaryDetails.recordsdownload, - )} ${result.totalCount}/${result.totalCount}"; + )} ${result.totalCount! + result.clfTotalCount!}/${result.totalCount! + result.clfTotalCount!}"; Navigator.of( context, rootNavigator: true, diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart index fb417fc691..9db0f5fdc3 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/sql_store.g.dart @@ -29895,6 +29895,18 @@ class $DownsyncTable extends Downsync late final GeneratedColumn limit = GeneratedColumn( 'limit', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _clfOffsetMeta = + const VerificationMeta('clfOffset'); + @override + late final GeneratedColumn clfOffset = GeneratedColumn( + 'clf_offset', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _clfTotalCountMeta = + const VerificationMeta('clfTotalCount'); + @override + late final GeneratedColumn clfTotalCount = GeneratedColumn( + 'clf_total_count', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); static const VerificationMeta _lastSyncedTimeMeta = const VerificationMeta('lastSyncedTime'); @override @@ -30005,6 +30017,8 @@ class $DownsyncTable extends Downsync projectId, offset, limit, + clfOffset, + clfTotalCount, lastSyncedTime, totalCount, boundaryName, @@ -30048,6 +30062,16 @@ class $DownsyncTable extends Downsync context.handle( _limitMeta, limit.isAcceptableOrUnknown(data['limit']!, _limitMeta)); } + if (data.containsKey('clf_offset')) { + context.handle(_clfOffsetMeta, + clfOffset.isAcceptableOrUnknown(data['clf_offset']!, _clfOffsetMeta)); + } + if (data.containsKey('clf_total_count')) { + context.handle( + _clfTotalCountMeta, + clfTotalCount.isAcceptableOrUnknown( + data['clf_total_count']!, _clfTotalCountMeta)); + } if (data.containsKey('last_synced_time')) { context.handle( _lastSyncedTimeMeta, @@ -30157,6 +30181,10 @@ class $DownsyncTable extends Downsync .read(DriftSqlType.int, data['${effectivePrefix}offset']), limit: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}limit']), + clfOffset: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}clf_offset']), + clfTotalCount: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}clf_total_count']), lastSyncedTime: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}last_synced_time']), totalCount: attachedDatabase.typeMapping @@ -30203,6 +30231,8 @@ class DownsyncData extends DataClass implements Insertable { final String? projectId; final int? offset; final int? limit; + final int? clfOffset; + final int? clfTotalCount; final int? lastSyncedTime; final int? totalCount; final String? boundaryName; @@ -30224,6 +30254,8 @@ class DownsyncData extends DataClass implements Insertable { this.projectId, this.offset, this.limit, + this.clfOffset, + this.clfTotalCount, this.lastSyncedTime, this.totalCount, this.boundaryName, @@ -30255,6 +30287,12 @@ class DownsyncData extends DataClass implements Insertable { if (!nullToAbsent || limit != null) { map['limit'] = Variable(limit); } + if (!nullToAbsent || clfOffset != null) { + map['clf_offset'] = Variable(clfOffset); + } + if (!nullToAbsent || clfTotalCount != null) { + map['clf_total_count'] = Variable(clfTotalCount); + } if (!nullToAbsent || lastSyncedTime != null) { map['last_synced_time'] = Variable(lastSyncedTime); } @@ -30318,6 +30356,12 @@ class DownsyncData extends DataClass implements Insertable { offset == null && nullToAbsent ? const Value.absent() : Value(offset), limit: limit == null && nullToAbsent ? const Value.absent() : Value(limit), + clfOffset: clfOffset == null && nullToAbsent + ? const Value.absent() + : Value(clfOffset), + clfTotalCount: clfTotalCount == null && nullToAbsent + ? const Value.absent() + : Value(clfTotalCount), lastSyncedTime: lastSyncedTime == null && nullToAbsent ? const Value.absent() : Value(lastSyncedTime), @@ -30377,6 +30421,8 @@ class DownsyncData extends DataClass implements Insertable { projectId: serializer.fromJson(json['projectId']), offset: serializer.fromJson(json['offset']), limit: serializer.fromJson(json['limit']), + clfOffset: serializer.fromJson(json['clfOffset']), + clfTotalCount: serializer.fromJson(json['clfTotalCount']), lastSyncedTime: serializer.fromJson(json['lastSyncedTime']), totalCount: serializer.fromJson(json['totalCount']), boundaryName: serializer.fromJson(json['boundaryName']), @@ -30404,6 +30450,8 @@ class DownsyncData extends DataClass implements Insertable { 'projectId': serializer.toJson(projectId), 'offset': serializer.toJson(offset), 'limit': serializer.toJson(limit), + 'clfOffset': serializer.toJson(clfOffset), + 'clfTotalCount': serializer.toJson(clfTotalCount), 'lastSyncedTime': serializer.toJson(lastSyncedTime), 'totalCount': serializer.toJson(totalCount), 'boundaryName': serializer.toJson(boundaryName), @@ -30428,6 +30476,8 @@ class DownsyncData extends DataClass implements Insertable { Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -30449,6 +30499,9 @@ class DownsyncData extends DataClass implements Insertable { projectId: projectId.present ? projectId.value : this.projectId, offset: offset.present ? offset.value : this.offset, limit: limit.present ? limit.value : this.limit, + clfOffset: clfOffset.present ? clfOffset.value : this.clfOffset, + clfTotalCount: + clfTotalCount.present ? clfTotalCount.value : this.clfTotalCount, lastSyncedTime: lastSyncedTime.present ? lastSyncedTime.value : this.lastSyncedTime, totalCount: totalCount.present ? totalCount.value : this.totalCount, @@ -30494,6 +30547,8 @@ class DownsyncData extends DataClass implements Insertable { ..write('projectId: $projectId, ') ..write('offset: $offset, ') ..write('limit: $limit, ') + ..write('clfOffset: $clfOffset, ') + ..write('clfTotalCount: $clfTotalCount, ') ..write('lastSyncedTime: $lastSyncedTime, ') ..write('totalCount: $totalCount, ') ..write('boundaryName: $boundaryName, ') @@ -30515,27 +30570,30 @@ class DownsyncData extends DataClass implements Insertable { } @override - int get hashCode => Object.hash( - locality, - projectId, - offset, - limit, - lastSyncedTime, - totalCount, - boundaryName, - auditCreatedBy, - nonRecoverableError, - auditCreatedTime, - clientCreatedTime, - clientModifiedBy, - clientCreatedBy, - clientModifiedTime, - auditModifiedBy, - auditModifiedTime, - tenantId, - isDeleted, - rowVersion, - additionalFields); + int get hashCode => Object.hashAll([ + locality, + projectId, + offset, + limit, + clfOffset, + clfTotalCount, + lastSyncedTime, + totalCount, + boundaryName, + auditCreatedBy, + nonRecoverableError, + auditCreatedTime, + clientCreatedTime, + clientModifiedBy, + clientCreatedBy, + clientModifiedTime, + auditModifiedBy, + auditModifiedTime, + tenantId, + isDeleted, + rowVersion, + additionalFields + ]); @override bool operator ==(Object other) => identical(this, other) || @@ -30544,6 +30602,8 @@ class DownsyncData extends DataClass implements Insertable { other.projectId == this.projectId && other.offset == this.offset && other.limit == this.limit && + other.clfOffset == this.clfOffset && + other.clfTotalCount == this.clfTotalCount && other.lastSyncedTime == this.lastSyncedTime && other.totalCount == this.totalCount && other.boundaryName == this.boundaryName && @@ -30567,6 +30627,8 @@ class DownsyncCompanion extends UpdateCompanion { final Value projectId; final Value offset; final Value limit; + final Value clfOffset; + final Value clfTotalCount; final Value lastSyncedTime; final Value totalCount; final Value boundaryName; @@ -30589,6 +30651,8 @@ class DownsyncCompanion extends UpdateCompanion { this.projectId = const Value.absent(), this.offset = const Value.absent(), this.limit = const Value.absent(), + this.clfOffset = const Value.absent(), + this.clfTotalCount = const Value.absent(), this.lastSyncedTime = const Value.absent(), this.totalCount = const Value.absent(), this.boundaryName = const Value.absent(), @@ -30612,6 +30676,8 @@ class DownsyncCompanion extends UpdateCompanion { this.projectId = const Value.absent(), this.offset = const Value.absent(), this.limit = const Value.absent(), + this.clfOffset = const Value.absent(), + this.clfTotalCount = const Value.absent(), this.lastSyncedTime = const Value.absent(), this.totalCount = const Value.absent(), this.boundaryName = const Value.absent(), @@ -30635,6 +30701,8 @@ class DownsyncCompanion extends UpdateCompanion { Expression? projectId, Expression? offset, Expression? limit, + Expression? clfOffset, + Expression? clfTotalCount, Expression? lastSyncedTime, Expression? totalCount, Expression? boundaryName, @@ -30658,6 +30726,8 @@ class DownsyncCompanion extends UpdateCompanion { if (projectId != null) 'project_id': projectId, if (offset != null) 'offset': offset, if (limit != null) 'limit': limit, + if (clfOffset != null) 'clf_offset': clfOffset, + if (clfTotalCount != null) 'clf_total_count': clfTotalCount, if (lastSyncedTime != null) 'last_synced_time': lastSyncedTime, if (totalCount != null) 'total_count': totalCount, if (boundaryName != null) 'boundary_name': boundaryName, @@ -30685,6 +30755,8 @@ class DownsyncCompanion extends UpdateCompanion { Value? projectId, Value? offset, Value? limit, + Value? clfOffset, + Value? clfTotalCount, Value? lastSyncedTime, Value? totalCount, Value? boundaryName, @@ -30707,6 +30779,8 @@ class DownsyncCompanion extends UpdateCompanion { projectId: projectId ?? this.projectId, offset: offset ?? this.offset, limit: limit ?? this.limit, + clfOffset: clfOffset ?? this.clfOffset, + clfTotalCount: clfTotalCount ?? this.clfTotalCount, lastSyncedTime: lastSyncedTime ?? this.lastSyncedTime, totalCount: totalCount ?? this.totalCount, boundaryName: boundaryName ?? this.boundaryName, @@ -30742,6 +30816,12 @@ class DownsyncCompanion extends UpdateCompanion { if (limit.present) { map['limit'] = Variable(limit.value); } + if (clfOffset.present) { + map['clf_offset'] = Variable(clfOffset.value); + } + if (clfTotalCount.present) { + map['clf_total_count'] = Variable(clfTotalCount.value); + } if (lastSyncedTime.present) { map['last_synced_time'] = Variable(lastSyncedTime.value); } @@ -30803,6 +30883,8 @@ class DownsyncCompanion extends UpdateCompanion { ..write('projectId: $projectId, ') ..write('offset: $offset, ') ..write('limit: $limit, ') + ..write('clfOffset: $clfOffset, ') + ..write('clfTotalCount: $clfTotalCount, ') ..write('lastSyncedTime: $lastSyncedTime, ') ..write('totalCount: $totalCount, ') ..write('boundaryName: $boundaryName, ') @@ -51425,6 +51507,8 @@ typedef $$DownsyncTableInsertCompanionBuilder = DownsyncCompanion Function({ Value projectId, Value offset, Value limit, + Value clfOffset, + Value clfTotalCount, Value lastSyncedTime, Value totalCount, Value boundaryName, @@ -51448,6 +51532,8 @@ typedef $$DownsyncTableUpdateCompanionBuilder = DownsyncCompanion Function({ Value projectId, Value offset, Value limit, + Value clfOffset, + Value clfTotalCount, Value lastSyncedTime, Value totalCount, Value boundaryName, @@ -51491,6 +51577,8 @@ class $$DownsyncTableTableManager extends RootTableManager< Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -51514,6 +51602,8 @@ class $$DownsyncTableTableManager extends RootTableManager< projectId: projectId, offset: offset, limit: limit, + clfOffset: clfOffset, + clfTotalCount: clfTotalCount, lastSyncedTime: lastSyncedTime, totalCount: totalCount, boundaryName: boundaryName, @@ -51537,6 +51627,8 @@ class $$DownsyncTableTableManager extends RootTableManager< Value projectId = const Value.absent(), Value offset = const Value.absent(), Value limit = const Value.absent(), + Value clfOffset = const Value.absent(), + Value clfTotalCount = const Value.absent(), Value lastSyncedTime = const Value.absent(), Value totalCount = const Value.absent(), Value boundaryName = const Value.absent(), @@ -51560,6 +51652,8 @@ class $$DownsyncTableTableManager extends RootTableManager< projectId: projectId, offset: offset, limit: limit, + clfOffset: clfOffset, + clfTotalCount: clfTotalCount, lastSyncedTime: lastSyncedTime, totalCount: totalCount, boundaryName: boundaryName, @@ -51616,6 +51710,16 @@ class $$DownsyncTableFilterComposer builder: (column, joinBuilders) => ColumnFilters(column, joinBuilders: joinBuilders)); + ColumnFilters get clfOffset => $state.composableBuilder( + column: $state.table.clfOffset, + builder: (column, joinBuilders) => + ColumnFilters(column, joinBuilders: joinBuilders)); + + ColumnFilters get clfTotalCount => $state.composableBuilder( + column: $state.table.clfTotalCount, + builder: (column, joinBuilders) => + ColumnFilters(column, joinBuilders: joinBuilders)); + ColumnFilters get lastSyncedTime => $state.composableBuilder( column: $state.table.lastSyncedTime, builder: (column, joinBuilders) => @@ -51720,6 +51824,16 @@ class $$DownsyncTableOrderingComposer builder: (column, joinBuilders) => ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get clfOffset => $state.composableBuilder( + column: $state.table.clfOffset, + builder: (column, joinBuilders) => + ColumnOrderings(column, joinBuilders: joinBuilders)); + + ColumnOrderings get clfTotalCount => $state.composableBuilder( + column: $state.table.clfTotalCount, + builder: (column, joinBuilders) => + ColumnOrderings(column, joinBuilders: joinBuilders)); + ColumnOrderings get lastSyncedTime => $state.composableBuilder( column: $state.table.lastSyncedTime, builder: (column, joinBuilders) => diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart index d3638698c4..b0a18f0728 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/downsync.dart @@ -2,17 +2,19 @@ import 'package:drift/drift.dart'; - class Downsync extends Table { TextColumn get locality => text().nullable()(); TextColumn get projectId => text().nullable()(); IntColumn get offset => integer().nullable()(); IntColumn get limit => integer().nullable()(); + IntColumn get clfOffset => integer().nullable()(); + IntColumn get clfTotalCount => integer().nullable()(); IntColumn get lastSyncedTime => integer().nullable()(); IntColumn get totalCount => integer().nullable()(); TextColumn get boundaryName => text().nullable()(); TextColumn get auditCreatedBy => text().nullable()(); - BoolColumn get nonRecoverableError => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get nonRecoverableError => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get auditCreatedTime => integer().nullable()(); IntColumn get clientCreatedTime => integer().nullable()(); TextColumn get clientModifiedBy => text().nullable()(); @@ -21,11 +23,15 @@ class Downsync extends Table { TextColumn get auditModifiedBy => text().nullable()(); IntColumn get auditModifiedTime => integer().nullable()(); TextColumn get tenantId => text().nullable()(); - BoolColumn get isDeleted => boolean().nullable().withDefault(const Constant(false))(); + BoolColumn get isDeleted => + boolean().nullable().withDefault(const Constant(false))(); IntColumn get rowVersion => integer().nullable()(); - + TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { locality, auditCreatedBy, }; -} \ No newline at end of file + Set get primaryKey => { + locality, + auditCreatedBy, + }; +} From 9caa9b54fa101dc42200eda040ef15b32a4d047c Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 23 Jan 2025 16:00:26 +0530 Subject: [PATCH 38/47] added code comment --- .../project_beneficiaries_downsync.dart | 16 ++++++++++++++++ .../lib/data/repositories/remote/downsync.dart | 2 ++ 2 files changed, 18 insertions(+) diff --git a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart index 3e8304711d..253e7da6f1 100644 --- a/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/blocs/projects_beneficiary_downsync/project_beneficiaries_downsync.dart @@ -119,6 +119,7 @@ class BeneficiaryDownSyncBloc ? null : existingDownSyncData.first.lastSyncedTime; + //Check if the event is for DISTRIBUTOR if (event.isDistributor) { //To get the server totalCount, final initialResults = await downSyncRemoteRepository.downSync( @@ -133,6 +134,7 @@ class BeneficiaryDownSyncBloc ), ); + //If API request failed, reset the State and emit a failure state if (initialResults.isEmpty) { await LocalSecureStore.instance.setManualSyncTrigger(false); emit(const BeneficiaryDownSyncState.resetState()); @@ -140,9 +142,11 @@ class BeneficiaryDownSyncBloc return; } + //Extract server total count serverTotalCount = initialResults["DownsyncCriteria"]["totalCount"]; } + //Check if the event is for COMMUNITY_CREATOR if (event.isCommunityCreator) { //To get the CLF server totalCount final initialResults = await downSyncRemoteRepository @@ -156,6 +160,7 @@ class BeneficiaryDownSyncBloc projectId: event.projectId, )); + //If API request failed, reset the State and emit a failure state if (initialResults.isEmpty) { await LocalSecureStore.instance.setManualSyncTrigger(false); emit(const BeneficiaryDownSyncState.resetState()); @@ -163,9 +168,11 @@ class BeneficiaryDownSyncBloc return; } + //Extract clf total count clfServerCount = initialResults["DownsyncCriteria"]["totalCount"]; } + // Emit a new state indicating that data has been found. Pass the server's total count, and clf total count emit(BeneficiaryDownSyncState.dataFound( serverTotalCount, clfServerCount, @@ -224,10 +231,14 @@ class BeneficiaryDownSyncBloc )); } + //Flag to check if any API calls are made, if not then break out of loop bool flag = false; + emit(BeneficiaryDownSyncState.inProgress( offset, totalCount, clfTotalCount)); + //Check if logged in user has role DISTRIBUTOR and offset value is less than totalcount + //then make API call if (event.isDistributor && offset < totalCount) { flag = true; //Make the batch API call @@ -268,9 +279,12 @@ class BeneficiaryDownSyncBloc } } + //Check if logged in user has role COMMUNITY_CREATOR and clfOffset value is less than clfTotalCount + //then make API call if (event.isCommunityCreator && clfOffset < clfTotalCount) { flag = true; + //Get households final downSyncResults = await downSyncRemoteRepository .searchClfDownSync(DownsyncSearchModel( locality: event.boundaryCode, @@ -289,6 +303,7 @@ class BeneficiaryDownSyncBloc downSyncResults["numberOfMembers"] as List; int idx = 0; + //Get memberData for each household householdList.forEach((e) async { int memberOffset = 0; int memberCount = memberCountList[idx++]; @@ -336,6 +351,7 @@ class BeneficiaryDownSyncBloc } if (!flag) { + //Update DownSync result await downSyncLocalRepository.update( existingDownSyncData.first.copyWith( offset: 0, diff --git a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart index 399e33a085..f791c87429 100644 --- a/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart +++ b/apps/health_campaign_field_worker_app/lib/data/repositories/remote/downsync.dart @@ -21,6 +21,7 @@ class DownsyncRemoteRepository @override DataModelType get type => DataModelType.downsync; + //DownSync CLF household FutureOr> searchClfDownSync(DownsyncSearchModel query, {int? offSet, int? limit}) async { int defaultBatchSize = limit ?? 100; @@ -91,6 +92,7 @@ class DownsyncRemoteRepository return finalResult; } + //DownSync MemberData for each household FutureOr> getMemberData(DownsyncSearchModel query, {int? offSet, int? limit}) async { Response response; From f62ffe359c445d65e0b7bd827457bb1efb8c57c7 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Tue, 28 Jan 2025 16:06:20 +0530 Subject: [PATCH 39/47] fix page issues --- .../pages/beneficiary/household_overview.dart | 335 +++++++++--------- 1 file changed, 173 insertions(+), 162 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 5949c0768a..228d96712f 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -103,180 +103,191 @@ class _HouseholdOverviewPageState ), enableFixedDigitButton: true, footer: DigitCard( - margin: const EdgeInsets.only(top: spacer2), - children: [ - DigitButton( - mainAxisSize: MainAxisSize.max, - onPressed: () => addIndividual( - context, - state.householdMemberWrapper.household!, - ), - label: localizations.translate( - i18.householdOverView - .householdOverViewAddActionText, - ), - prefixIcon: Icons.add_circle, - type: DigitButtonType.secondary, - size: DigitButtonSize.medium, + margin: const EdgeInsets.only(top: spacer2), + children: [ + DigitButton( + mainAxisSize: MainAxisSize.max, + onPressed: () => addIndividual( + context, + state.householdMemberWrapper.household!, ), - Offstage( - offstage: beneficiaryType == - BeneficiaryType.individual || - isOutsideProjectDateRange(), - child: BlocBuilder( - builder: (context, serviceDefinitionState) => - BlocBuilder( - builder: (ctx, deliverInterventionState) => - state.householdMemberWrapper.tasks - ?.lastOrNull?.status == - Status.administeredSuccess - .toValue() - ? Padding( - padding: - const EdgeInsets.symmetric( - vertical: spacer2), - child: DigitButton( - label: localizations.translate( - i18.memberCard - .deliverDetailsUpdateLabel, - ), - isDisabled: state - .householdMemberWrapper - .tasks - ?.lastOrNull - ?.status == - Status - .administeredSuccess - .toValue() - ? true - : false, - type: DigitButtonType.secondary, - size: DigitButtonSize.large, - mainAxisSize: MainAxisSize.max, - onPressed: () { - serviceDefinitionState.when( - empty: () {}, - isloading: () {}, - serviceDefinitionFetch: - (value, model) { - if (value - .where((element) => - element.code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}')) - .toList() - .isEmpty) { - context.router.push( - DeliverInterventionRoute(), - ); - } else { - navigateToChecklist( - ctx); - } - }); - callReloadEvent( - offset: state - .householdMemberWrapper - .members! - .length, - limit: limit); - }, - ), - ) - : DigitButton( + label: localizations.translate( + i18.householdOverView + .householdOverViewAddActionText, + ), + prefixIcon: Icons.add_circle, + type: DigitButtonType.secondary, + size: DigitButtonSize.medium, + ), + Offstage( + offstage: + beneficiaryType == BeneficiaryType.individual || + isOutsideProjectDateRange(), + child: BlocBuilder( + builder: (context, serviceDefinitionState) => + BlocBuilder( + builder: (ctx, deliverInterventionState) => + state.householdMemberWrapper.tasks + ?.lastOrNull?.status == + Status.administeredSuccess.toValue() + ? Padding( + padding: const EdgeInsets.symmetric( + vertical: spacer2), + child: DigitButton( label: localizations.translate( - i18.householdOverView - .householdOverViewEditLabel, + i18.memberCard + .deliverDetailsUpdateLabel, ), - type: DigitButtonType.primary, - size: DigitButtonSize.large, - mainAxisSize: MainAxisSize.max, - isDisabled: (state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isEmpty || - state - .householdMemberWrapper - .tasks - ?.lastOrNull - ?.status == - Status.closeHousehold - .toValue() + isDisabled: state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status.administeredSuccess + .toValue() ? true : false, - onPressed: () async { - final bloc = ctx.read< - HouseholdOverviewBloc>(); - - final projectId = - RegistrationDeliverySingleton() - .projectId!; - - bloc.add( - HouseholdOverviewReloadEvent( - projectId: projectId, - projectBeneficiaryType: - beneficiaryType, - ), - ); - - serviceDefinitionState.when( - empty: () {}, - isloading: () {}, - serviceDefinitionFetch: - (value, model) { - if (value - .where((element) => element - .code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || - element.code.toString().contains('${RegistrationDeliverySingleton().selectedProject!.name}.${RegistrationDeliveryEnums.eligibility.toValue()}')) - .toList() - .isEmpty) { - context.router.push( - DeliverInterventionRoute(), - ); - } else { - navigateToChecklist(ctx, - state.selectedIndividual!.clientReferenceId); - } - }); + type: DigitButtonType.secondary, + size: DigitButtonSize.large, + mainAxisSize: MainAxisSize.max, + onPressed: () { + serviceDefinitionState.when( + empty: () {}, + isloading: () {}, + serviceDefinitionFetch: + (value, model) { + if (value + .where((element) => + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject!.name}.${RegistrationDeliveryEnums.eligibility.toValue()}')) + .toList() + .isEmpty) { + context.router.push( + DeliverInterventionRoute(), + ); + } else { + navigateToChecklist( + ctx, + state + .selectedIndividual! + .clientReferenceId); + } + }); callReloadEvent( offset: state .householdMemberWrapper .members! .length, limit: limit); - }, - ), - ]), - ), + }, + ), + ) + : DigitButton( + label: localizations.translate( + i18.householdOverView + .householdOverViewEditLabel, + ), + type: DigitButtonType.primary, + size: DigitButtonSize.large, + mainAxisSize: MainAxisSize.max, + isDisabled: (state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isEmpty || + state + .householdMemberWrapper + .tasks + ?.lastOrNull + ?.status == + Status.closeHousehold + .toValue() + ? true + : false, + onPressed: () async { + final bloc = ctx.read< + HouseholdOverviewBloc>(); + + final projectId = + RegistrationDeliverySingleton() + .projectId!; + + bloc.add( + HouseholdOverviewReloadEvent( + projectId: projectId, + projectBeneficiaryType: + beneficiaryType, + ), + ); + + serviceDefinitionState.when( + empty: () {}, + isloading: () {}, + serviceDefinitionFetch: + (value, model) { + if (value + .where((element) => + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject!.name}.${RegistrationDeliveryEnums.eligibility.toValue()}')) + .toList() + .isEmpty) { + context.router.push( + DeliverInterventionRoute(), + ); + } else { + navigateToChecklist( + ctx, + state + .selectedIndividual! + .clientReferenceId); + } + }); + callReloadEvent( + offset: state + .householdMemberWrapper + .members! + .length, + limit: limit); + }, + ), + ), + ), + ), + ], ), - ), - slivers: [ - SliverToBoxAdapter( - child: DigitCard( - margin: const EdgeInsets.all(spacer2), - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - if ((state.householdMemberWrapper - .projectBeneficiaries ?? - []) - .isNotEmpty) - Align( - alignment: Alignment.centerLeft, - child: DigitButton( - onPressed: () { - final projectId = - RegistrationDeliverySingleton() - .projectId!; + slivers: [ + SliverToBoxAdapter( + child: DigitCard( + margin: const EdgeInsets.all(spacer2), + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + if ((state.householdMemberWrapper + .projectBeneficiaries ?? + []) + .isNotEmpty) + Align( + alignment: Alignment.centerLeft, + child: DigitButton( + onPressed: () { + final projectId = + RegistrationDeliverySingleton() + .projectId!; final bloc = context .read(); From b57ea86e16bd65dc3f3f4d60bc6f597c382948b3 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Wed, 29 Jan 2025 10:41:35 +0530 Subject: [PATCH 40/47] fix popUp context issue in beneficiary checklist --- .../lib/pages/beneficiary/beneficiary_checklist.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart index 9d6c18053e..1da603afb0 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart @@ -185,12 +185,14 @@ class _BeneficiaryChecklistPageState selectedServiceDefinition!); createSubmitRequest( decidedFlow: decidedFlow); - Navigator.of(context).pop(); + Navigator.of(popUpContext) + .pop(); navigateToDecidedFlow( context, decidedFlow); } else { createSubmitRequest(); - Navigator.of(context).pop(); + Navigator.of(popUpContext) + .pop(); context.router.push( DeliverInterventionRoute(), ); @@ -205,7 +207,8 @@ class _BeneficiaryChecklistPageState onPressed: () { createSubmitRequest(); - Navigator.of(context).pop(); + Navigator.of(popUpContext) + .pop(); context.router.push( RefusedDeliveryRoute(), ); From 7647cafc6069dfc2ae1b32e11fc6e1db8b9f3507 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Thu, 30 Jan 2025 16:06:07 +0530 Subject: [PATCH 41/47] added editable numeric field --- .../beneficiary_registration/household_details.dart | 10 ++++++++++ .../lib/pages/search_beneficiary.dart | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart index 81d9959184..23fafe10e4 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart @@ -1,5 +1,6 @@ import 'package:auto_route/auto_route.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/theme/digit_extended_theme.dart'; import 'package:digit_ui_components/widgets/atoms/text_block.dart'; @@ -415,6 +416,9 @@ class HouseHoldDetailsPageState extends LocalizedState { minValue: 0, maxValue: 10, step: 1, + editable: RegistrationDeliverySingleton() + .householdType == + HouseholdType.community, initialValue: form .control(_pregnantWomenCountKey) .value @@ -452,6 +456,9 @@ class HouseHoldDetailsPageState extends LocalizedState { minValue: 0, maxValue: 20, step: 1, + editable: RegistrationDeliverySingleton() + .householdType == + HouseholdType.community, initialValue: form .control(_childrenCountKey) .value @@ -491,6 +498,9 @@ class HouseHoldDetailsPageState extends LocalizedState { : 1, maxValue: 30, step: 1, + editable: RegistrationDeliverySingleton() + .householdType == + HouseholdType.community, initialValue: form .control(_memberCountKey) .value diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 9222234361..08c00d0a50 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -405,8 +405,7 @@ class _SearchBeneficiaryPageState offstage: RegistrationDeliverySingleton().householdType == HouseholdType.community && (searchHouseholdsState.searchQuery == null) || - (searchHouseholdsState.searchQuery != null && - searchHouseholdsState.householdMembers.isNotEmpty), + (searchHouseholdsState.searchQuery!.length < 3), child: DigitCard( margin: const EdgeInsets.only(top: spacer2), padding: const EdgeInsets.all(spacer4), From 797702574e7214ff0bb47906f098b573ce235c7a Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 31 Jan 2025 11:57:08 +0530 Subject: [PATCH 42/47] fix build issue --- tools/generate-apk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate-apk.sh b/tools/generate-apk.sh index 4d578fa4cd..4a4e3a0865 100755 --- a/tools/generate-apk.sh +++ b/tools/generate-apk.sh @@ -31,7 +31,7 @@ build_config="${build_config:-release}" # env_list=("$env") # fi -./tools/install_bricks.sh +#./tools/install_bricks.sh cd "$APP_DIR" || exit From c327131ff4515932a06c98018da7e8d50463b67c Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 31 Jan 2025 12:02:52 +0530 Subject: [PATCH 43/47] fix apk workflow --- .github/workflows/flutter-build-apk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter-build-apk.yml b/.github/workflows/flutter-build-apk.yml index 076e96a606..e6194a0915 100644 --- a/.github/workflows/flutter-build-apk.yml +++ b/.github/workflows/flutter-build-apk.yml @@ -84,7 +84,7 @@ jobs: path: apps/health_campaign_field_worker_app/build/app/outputs/apk/release/app-release.apk - name: Upload .env as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: env-file path: apps/health_campaign_field_worker_app/.env From dac274e3a544bbc527bbdde35f808746ed5e1895 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 31 Jan 2025 12:04:56 +0530 Subject: [PATCH 44/47] fix upload apk workflow --- .github/workflows/flutter-build-apk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flutter-build-apk.yml b/.github/workflows/flutter-build-apk.yml index e6194a0915..36aeb0df5a 100644 --- a/.github/workflows/flutter-build-apk.yml +++ b/.github/workflows/flutter-build-apk.yml @@ -78,7 +78,7 @@ jobs: # Archive the APK as a build artifact so it can be downloaded - name: Upload APKs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: app-release-apk path: apps/health_campaign_field_worker_app/build/app/outputs/apk/release/app-release.apk From 1024122b19ca53d9252b140f0a6af93e67c6fd44 Mon Sep 17 00:00:00 2001 From: yashita-egov Date: Fri, 31 Jan 2025 12:15:37 +0530 Subject: [PATCH 45/47] generate apk issue --- tools/generate-apk.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/generate-apk.sh b/tools/generate-apk.sh index 4a4e3a0865..4d578fa4cd 100755 --- a/tools/generate-apk.sh +++ b/tools/generate-apk.sh @@ -31,7 +31,7 @@ build_config="${build_config:-release}" # env_list=("$env") # fi -#./tools/install_bricks.sh +./tools/install_bricks.sh cd "$APP_DIR" || exit From b40b8f34a32cc7ce3ea910bdb7d638d96df2cc55 Mon Sep 17 00:00:00 2001 From: Naveen Renati <154230258+naveenr-egov@users.noreply.github.com> Date: Tue, 25 Mar 2025 16:53:35 +0530 Subject: [PATCH 46/47] merge conflicts with dev --- .../lib/models/entities/roles_type.dart | 30 +++++--- .../lib/pages/boundary_selection.dart | 26 +++---- .../lib/pages/home.dart | 9 +-- .../lib/utils/utils.dart | 69 ++++++++++--------- .../pages/beneficiary/household_overview.dart | 41 ++++++----- .../house_details.dart | 17 +++-- .../household_details.dart | 7 +- .../household_location.dart | 3 +- .../individual_details.dart | 52 +++++++------- packages/registration_delivery/pubspec.lock | 7 +- 10 files changed, 136 insertions(+), 125 deletions(-) diff --git a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart index 4c6937144c..337cec5be8 100644 --- a/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart +++ b/apps/health_campaign_field_worker_app/lib/models/entities/roles_type.dart @@ -2,16 +2,26 @@ import 'package:dart_mappable/dart_mappable.dart'; part 'roles_type.mapper.dart'; + @MappableEnum(caseStyle: CaseStyle.upperCase) enum RolesType { - @MappableValue("WAREHOUSE_MANAGER") warehouseManager, - @MappableValue("DISTRIBUTOR") distributor, - @MappableValue("HEALTH_FACILITY_WORKER") healthFacilityWorker, - @MappableValue("DISTRICT_SUPERVISOR") districtSupervisor, - @MappableValue("FIELD_SUPERVISOR") fieldSupervisor, - @MappableValue("SUPERUSER") superuser, - @MappableValue("REGISTRAR") registrar, - @MappableValue("COMMUNITY_CREATOR") communityCreator, - @MappableValue("TEAM_SUPERVISOR") teamSupervisor, + @MappableValue("WAREHOUSE_MANAGER") + warehouseManager, + @MappableValue("DISTRIBUTOR") + distributor, + @MappableValue("HEALTH_FACILITY_WORKER") + healthFacilityWorker, + @MappableValue("DISTRICT_SUPERVISOR") + districtSupervisor, + @MappableValue("FIELD_SUPERVISOR") + fieldSupervisor, + @MappableValue("SUPERUSER") + superuser, + @MappableValue("REGISTRAR") + registrar, + @MappableValue("COMMUNITY_CREATOR") + communityCreator, + @MappableValue("TEAM_SUPERVISOR") + teamSupervisor, ; -} \ No newline at end of file +} diff --git a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart index 3f49e673c9..f216008ddb 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/boundary_selection.dart @@ -526,19 +526,19 @@ class _BoundarySelectionPageState if (context.mounted) { if (isOnline && (isDistributor || - isCommunityCreator)) { - context - .read< - BeneficiaryDownSyncBloc>() - .add( - DownSyncGetBatchSizeEvent( - appConfiguration: [ - appConfiguration, - ], - projectId: context - .projectId, - boundaryCode: - selectedBoundary! + isCommunityCreator)) { + context + .read< + BeneficiaryDownSyncBloc>() + .add( + DownSyncGetBatchSizeEvent( + appConfiguration: [ + appConfiguration, + ], + projectId: context + .projectId, + boundaryCode: + selectedBoundary! .value!.code .toString(), pendingSyncCount: diff --git a/apps/health_campaign_field_worker_app/lib/pages/home.dart b/apps/health_campaign_field_worker_app/lib/pages/home.dart index 1ac63a4f99..3bbcf369d4 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -33,7 +33,6 @@ import 'package:registration_delivery/router/registration_delivery_router.gm.dar import 'package:survey_form/router/survey_form_router.gm.dart'; import 'package:survey_form/survey_form.dart'; import 'package:sync_service/blocs/sync/sync.dart'; -import 'package:digit_data_model/models/entities/household_type.dart'; import '../blocs/app_initialization/app_initialization.dart'; import '../blocs/auth/auth.dart'; @@ -606,11 +605,9 @@ class _HomePageState extends LocalizedState { .map((label) => homeItemsShowcaseMap[label]!) .toList(); - - if (envConfig.variables.envType == EnvType.demo && kReleaseMode) { - filteredLabels.remove(i18.home.db); - } - + if (envConfig.variables.envType == EnvType.demo && kReleaseMode) { + filteredLabels.remove(i18.home.db); + } final List widgetList = filteredLabels.map((label) => homeItemsMap[label]!).toList(); diff --git a/apps/health_campaign_field_worker_app/lib/utils/utils.dart b/apps/health_campaign_field_worker_app/lib/utils/utils.dart index 427e1753eb..0b370bf743 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/utils.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/utils.dart @@ -7,6 +7,7 @@ import 'package:attendance_management/attendance_management.dart' as attendance_mappers; import 'package:complaints/complaints.init.dart' as complaints_mappers; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:digit_data_model/data_model.dart' as data_model; import 'package:digit_data_model/data_model.init.dart' as data_model_mappers; import 'package:digit_dss/digit_dss.dart' as dss_mappers; import 'package:digit_ui_components/digit_components.dart'; @@ -21,7 +22,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:inventory_management/inventory_management.init.dart' as inventory_mappers; import 'package:isar/isar.dart'; -import 'package:digit_data_model/data_model.dart' as data_model; import 'package:reactive_forms/reactive_forms.dart'; import 'package:referral_reconciliation/referral_reconciliation.dart' as referral_reconciliation_mappers; @@ -35,9 +35,6 @@ import '../data/local_store/app_shared_preferences.dart'; import '../data/local_store/no_sql/schema/localization.dart'; import '../data/local_store/secure_store/secure_store.dart'; import '../models/app_config/app_config_model.dart'; -import '../models/data_model.init.dart'; -import '../models/tenant_boundary/tenant_boundary_model.dart'; - import '../router/app_router.dart'; import '../widgets/progress_indicator/progress_indicator.dart'; import 'constants.dart'; @@ -294,22 +291,22 @@ void showDownloadDialog(BuildContext context, DigitButton( label: model.primaryButtonLabel ?? '', onPressed: () { - if (dialogType == DigitProgressDialogType.pendingSync) { - Navigator.of(context, rootNavigator: true).pop(); - context.router.replaceAll([HomeRoute()]); - } else { - if ((model.totalCount ?? 0) > 0 || - (model.clfTotalCount ?? 0) > 0) { - context.read().add( - DownSyncBeneficiaryEvent( - projectId: context.projectId, - boundaryCode: model.boundary, - batchSize: model.batchSize ?? 1, - initialServerCount: model.totalCount ?? 0, - boundaryName: model.boundaryName, - clfServerCount: model.clfTotalCount ?? 0, - isCommunityCreator: isCommunityCreator, - isDistributor: isDistributor, + if (dialogType == DigitProgressDialogType.pendingSync) { + Navigator.of(context, rootNavigator: true).pop(); + context.router.replaceAll([HomeRoute()]); + } else { + if ((model.totalCount ?? 0) > 0 || + (model.clfTotalCount ?? 0) > 0) { + context.read().add( + DownSyncBeneficiaryEvent( + projectId: context.projectId, + boundaryCode: model.boundary, + batchSize: model.batchSize ?? 1, + initialServerCount: model.totalCount ?? 0, + boundaryName: model.boundaryName, + clfServerCount: model.clfTotalCount ?? 0, + isCommunityCreator: isCommunityCreator, + isDistributor: isDistributor, ), ); } else { @@ -364,14 +361,14 @@ void showDownloadDialog(BuildContext context, } } - // Existing _findLeastLevelBoundaryCode method remains unchanged String _findLeastLevelBoundaryCode(List boundaries) { data_model.BoundaryModel? highestBoundary; // Find the boundary with the highest boundaryNum for (var boundary in boundaries) { - if (highestBoundary == null || (boundary.boundaryNum ?? 0) > (highestBoundary.boundaryNum ?? 0)) { + if (highestBoundary == null || + (boundary.boundaryNum ?? 0) > (highestBoundary.boundaryNum ?? 0)) { highestBoundary = boundary; } } @@ -383,9 +380,10 @@ String _findLeastLevelBoundaryCode(List boundaries) { } // If the highest boundary has children, recursively search in them - if(highestBoundary?.children != null) { + if (highestBoundary?.children != null) { for (var child in highestBoundary!.children) { - String leastCode = _findLeastLevelBoundaryCode([child]); // Recursively find the least level + String leastCode = _findLeastLevelBoundaryCode( + [child]); // Recursively find the least level if (leastCode.isNotEmpty) { return leastCode; } @@ -397,7 +395,8 @@ String _findLeastLevelBoundaryCode(List boundaries) { } // Recursive function to find the least level boundary codes -List findLeastLevelBoundaries(List boundaries) { +List findLeastLevelBoundaries( + List boundaries) { // Find the least level boundary type String leastLevelType = _findLeastLevelBoundaryCode(boundaries); @@ -405,15 +404,18 @@ List findLeastLevelBoundaries(List boundaries) List leastLevelBoundaryCodes = []; // Iterate through the boundaries to find matching codes - if(leastLevelType.isNotEmpty) { + if (leastLevelType.isNotEmpty) { for (var boundary in boundaries) { // Check if the boundary matches the least-level type and has no children (leaf node) - if ((boundary.boundaryType == leastLevelType || boundary.label == leastLevelType) && boundary.children.isEmpty) { + if ((boundary.boundaryType == leastLevelType || + boundary.label == leastLevelType) && + boundary.children.isEmpty) { // Found a least level boundary with no children (leaf node), add its code leastLevelBoundaryCodes.add(boundary.code!); } else if (boundary.children.isNotEmpty) { // Recursively search in the children - List childVillageCodes = findLeastLevelBoundaries(boundary.children); + List childVillageCodes = + findLeastLevelBoundaries(boundary.children); leastLevelBoundaryCodes.addAll(childVillageCodes); } } @@ -442,10 +444,13 @@ getLocalizationString(Isar isar, String selectedLocale) async { } List filterDashboardConfig( - List? dashboardConfig, String projectTypeCode) { - return dashboardConfig?.where((element) => - element != null && element.projectTypeCode == projectTypeCode) - .toList() ?? []; + List? dashboardConfig, + String projectTypeCode) { + return dashboardConfig + ?.where((element) => + element != null && element.projectTypeCode == projectTypeCode) + .toList() ?? + []; } getSelectedLanguage(AppInitialized state, int index) { diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index 6f9ea0db1e..cf81959137 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -35,7 +35,6 @@ import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/member_card/member_card.dart'; import '../../widgets/table_card/table_card.dart'; -import '/widgets/status_filter/status_filter.dart'; @RoutePage() class HouseholdOverviewPage extends LocalizedStatefulWidget { @@ -109,20 +108,20 @@ class _HouseholdOverviewPageState footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), children: [ - DigitButton( - mainAxisSize: MainAxisSize.max, - onPressed: () => addIndividual( - context, - state.householdMemberWrapper.household!, - ), - label: localizations.translate( - i18.householdOverView - .householdOverViewAddActionText, - ), - prefixIcon: Icons.add_circle, - type: DigitButtonType.secondary, - size: DigitButtonSize.medium, - ), + DigitButton( + mainAxisSize: MainAxisSize.max, + onPressed: () => addIndividual( + context, + state.householdMemberWrapper.household!, + ), + label: localizations.translate( + i18.householdOverView + .householdOverViewAddActionText, + ), + prefixIcon: Icons.add_circle, + type: DigitButtonType.secondary, + size: DigitButtonSize.medium, + ), Offstage( offstage: beneficiaryType == BeneficiaryType.individual || @@ -164,10 +163,10 @@ class _HouseholdOverviewPageState (value, model) { if (value .where((element) => - element.code - .toString() - .contains( - '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || + element.code + .toString() + .contains( + '${RegistrationDeliverySingleton().selectedProject?.name}.${RegistrationDeliveryEnums.iec.toValue()}') || element.code .toString() .contains( @@ -464,8 +463,8 @@ class _HouseholdOverviewPageState .householdOverView .householdOverViewLabel), style: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme + .colorTheme.primary.primary2), ), ), ), diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart index 16236bc86e..a62e24c8ce 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/house_details.dart @@ -17,7 +17,6 @@ import '../../utils/i18_key_constants.dart' as i18; import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/showcase/config/showcase_constants.dart'; -import '../../widgets/showcase/showcase_button.dart'; @RoutePage() class HouseDetailsPage extends LocalizedStatefulWidget { @@ -238,12 +237,12 @@ class HouseDetailsPageState extends LocalizedState { i18.householdDetails .clfStructureDetailsLabel, ) - :localizations.translate( - i18.householdDetails.houseDetailsLabel, - ), + : localizations.translate( + i18.householdDetails + .houseDetailsLabel, + ), style: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme.colorTheme.primary.primary2), ), ), houseShowcaseData.typeOfStructure.buildWith( @@ -313,9 +312,9 @@ class HouseDetailsPageState extends LocalizedState { HouseholdType.community) ? localizations.translate(i18 .householdDetails.noOfRoomsCLFLabel) - :localizations.translate( - i18.householdDetails.noOfRoomsLabel, - ), + : localizations.translate( + i18.householdDetails.noOfRoomsLabel, + ), child: DigitNumericFormInput( minValue: 1, maxValue: 20, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart index a5cdc8b0db..37368c5f96 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_details.dart @@ -406,9 +406,10 @@ class HouseHoldDetailsPageState extends LocalizedState { ? localizations.translate( i18.householdDetails.clfDetailsLabel, ) - :localizations.translate( - i18.householdDetails.householdDetailsLabel, - ),headingStyle: textTheme.headingXl.copyWith( + : localizations.translate( + i18.householdDetails.householdDetailsLabel, + ), + headingStyle: textTheme.headingXl.copyWith( color: theme.colorTheme.primary.primary2), description: localizations.translate( i18.householdDetails.householdDetailsDescription, diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart index 63f33087f7..ee1b505803 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/household_location.dart @@ -299,8 +299,7 @@ class HouseholdLocationPageState extends LocalizedState { .householdLocationLabelText, ), headingStyle: textTheme.headingXl.copyWith( - color: theme.colorTheme.primary.primary2 - ), + color: theme.colorTheme.primary.primary2), description: (RegistrationDeliverySingleton() .householdType == HouseholdType.community) diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart index 9f83175a2e..4821131a15 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -27,7 +27,6 @@ import '../../utils/utils.dart'; import '../../widgets/back_navigation_help_header.dart'; import '../../widgets/localized.dart'; import '../../widgets/showcase/config/showcase_constants.dart'; -import '../../widgets/showcase/showcase_button.dart'; @RoutePage() class IndividualDetailsPage extends LocalizedStatefulWidget { @@ -336,7 +335,8 @@ class IndividualDetailsPageState extends LocalizedState { localizations.translate( i18.individualDetails.individualsDetailsLabelText, ), - style: textTheme.headingXl.copyWith(color: theme.colorTheme.primary.primary2), + style: textTheme.headingXl.copyWith( + color: theme.colorTheme.primary.primary2), ), Column( children: [ @@ -345,9 +345,10 @@ class IndividualDetailsPageState extends LocalizedState { child: ReactiveWrapperField( formControlName: _individualNameKey, validationMessages: { - 'required': (object) => localizations.translate( - '${i18.individualDetails.nameLabelText}_IS_REQUIRED', - ), + 'required': (object) => + localizations.translate( + '${i18.individualDetails.nameLabelText}_IS_REQUIRED', + ), 'maxLength': (object) => localizations .translate(i18.common.maxCharsRequired) .replaceAll('{}', maxLength.toString()), @@ -359,7 +360,7 @@ class IndividualDetailsPageState extends LocalizedState { isRequired: true, child: DigitTextFormInput( initialValue: - form.control(_individualNameKey).value, + form.control(_individualNameKey).value, onChange: (value) { form.control(_individualNameKey).value = value; @@ -369,25 +370,27 @@ class IndividualDetailsPageState extends LocalizedState { ), ), ), - if(widget.isHeadOfHousehold) - const SizedBox(height: spacer2,), + if (widget.isHeadOfHousehold) + const SizedBox( + height: spacer2, + ), Offstage( offstage: !widget.isHeadOfHousehold, child: DigitCheckbox( capitalizeFirstLetter: false, - capitalizeFirstLetter: false, - label: (RegistrationDeliverySingleton() - .householdType == - HouseholdType.community) - ? localizations.translate( - i18.individualDetails.clfCheckboxLabelText) - : localizations.translate( - i18.individualDetails.checkboxLabelText, - ), - value: widget.isHeadOfHousehold, - readOnly: widget.isHeadOfHousehold, - onChanged: (_) {}, - ),), + label: (RegistrationDeliverySingleton() + .householdType == + HouseholdType.community) + ? localizations.translate(i18 + .individualDetails.clfCheckboxLabelText) + : localizations.translate( + i18.individualDetails.checkboxLabelText, + ), + value: widget.isHeadOfHousehold, + readOnly: widget.isHeadOfHousehold, + onChanged: (_) {}, + ), + ), ], ), @@ -508,7 +511,8 @@ class IndividualDetailsPageState extends LocalizedState { yearsAndMonthsErrMsg: localizations.translate( i18.individualDetails.yearsAndMonthsErrorText, ), - errorMessage: _getDobErrorMessage(form.control(_dobKey)), + errorMessage: + _getDobErrorMessage(form.control(_dobKey)), initialDate: before150Years, initialValue: getInitialDateValue(form), onChangeOfFormControl: (value) { @@ -805,9 +809,7 @@ class IndividualDetailsPageState extends LocalizedState { if (!control.hasErrors) return null; final dobValue = control.value; - final age = dobValue != null - ? DigitDateUtils.calculateAge(dobValue) - : null; + final age = dobValue != null ? DigitDateUtils.calculateAge(dobValue) : null; if (dobValue == null) { return localizations.translate(i18.common.corecommonRequired); diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index ed4f1b0214..af76befd67 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -397,10 +397,9 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "4cdde28c79632a8aa4a8eb95c6567c96f0449b88e815c42896eeb1a41e0c2b00" - url: "https://pub.dev" - source: hosted + path: "../digit_data_model" + relative: true + source: path version: "1.0.6+1" digit_scanner: dependency: "direct main" From bc6b87d5cc2e403769af32a94e733c7e567836bc Mon Sep 17 00:00:00 2001 From: Naveen Renati <154230258+naveenr-egov@users.noreply.github.com> Date: Tue, 25 Mar 2025 17:09:27 +0530 Subject: [PATCH 47/47] merge conflicts with dev added new localization code --- .../pubspec.lock | 25 +- .../pages/beneficiary/household_overview.dart | 14 - .../beneficiary_acknowledgement.dart | 8 +- .../lib/pages/summary_page.dart | 252 +++++++++--------- .../lib/utils/i18_key_constants.dart | 3 + 5 files changed, 148 insertions(+), 154 deletions(-) diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index 98c60bd13f..7ebb98985d 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -509,11 +509,10 @@ packages: digit_data_model: dependency: "direct main" description: - name: digit_data_model - sha256: "8e67281c34e030b471a33d8889cb4e96d94d3d9fa6c6cf833e5d6d792ace1471" - url: "https://pub.dev" - source: hosted - version: "1.0.6+2" + path: "../../packages/digit_data_model" + relative: true + source: path + version: "1.0.6+1" digit_dss: dependency: "direct main" description: @@ -1328,10 +1327,9 @@ packages: inventory_management: dependency: "direct main" description: - name: inventory_management - sha256: "68271fd2f99fae4b3f826403b16b6b3568bb74ba96dc92c45c1eff457fdbcd49" - url: "https://pub.dev" - source: hosted + path: "../../packages/inventory_management" + relative: true + source: path version: "1.0.5+1" io: dependency: transitive @@ -1800,10 +1798,9 @@ packages: referral_reconciliation: dependency: "direct main" description: - name: referral_reconciliation - sha256: "5d3ea365246978776c0d247d9dbe35ebc04b7df1b85d7f38db20ec7e4021b977" - url: "https://pub.dev" - source: hosted + path: "../../packages/referral_reconciliation" + relative: true + source: path version: "1.0.4+2" registration_delivery: dependency: "direct main" @@ -1811,7 +1808,7 @@ packages: path: "../../packages/registration_delivery" relative: true source: path - version: "1.0.6+2" + version: "1.0.6+3" rxdart: dependency: transitive description: diff --git a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart index cf81959137..541f2fdc3d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/household_overview.dart @@ -108,20 +108,6 @@ class _HouseholdOverviewPageState footer: DigitCard( margin: const EdgeInsets.only(top: spacer2), children: [ - DigitButton( - mainAxisSize: MainAxisSize.max, - onPressed: () => addIndividual( - context, - state.householdMemberWrapper.household!, - ), - label: localizations.translate( - i18.householdOverView - .householdOverViewAddActionText, - ), - prefixIcon: Icons.add_circle, - type: DigitButtonType.secondary, - size: DigitButtonSize.medium, - ), Offstage( offstage: beneficiaryType == BeneficiaryType.individual || diff --git a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart index ec7b4c6317..2b80ac098f 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:digit_data_model/models/entities/household_type.dart'; import 'package:digit_ui_components/digit_components.dart'; import 'package:digit_ui_components/widgets/molecules/panel_cards.dart'; import 'package:flutter/material.dart'; @@ -8,6 +9,7 @@ import '../../../utils/i18_key_constants.dart' as i18; import '../../../widgets/localized.dart'; import '../../blocs/search_households/search_bloc_common_wrapper.dart'; import '../../router/registration_delivery_router.gm.dart'; +import '../../utils/utils.dart'; @RoutePage() class BeneficiaryAcknowledgementPage extends LocalizedStatefulWidget { @@ -37,8 +39,12 @@ class BeneficiaryAcknowledgementPageState .translate(i18.acknowledgementSuccess.acknowledgementLabelText), actions: [ DigitButton( + capitalizeLetters: false, label: localizations.translate( - i18.householdDetails.viewHouseHoldDetailsAction, + RegistrationDeliverySingleton().householdType == + HouseholdType.community + ? i18.householdDetails.viewInstitutionDetailsAction + : i18.householdDetails.viewHouseHoldDetailsAction, ), onPressed: () { final bloc = context.read(); diff --git a/packages/registration_delivery/lib/pages/summary_page.dart b/packages/registration_delivery/lib/pages/summary_page.dart index d1189e9bae..5054592604 100644 --- a/packages/registration_delivery/lib/pages/summary_page.dart +++ b/packages/registration_delivery/lib/pages/summary_page.dart @@ -11,7 +11,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:registration_delivery/models/entities/additional_fields_type.dart'; import 'package:registration_delivery/router/registration_delivery_router.gm.dart'; import 'package:registration_delivery/widgets/back_navigation_help_header.dart'; -import 'package:registration_delivery/widgets/showcase/showcase_button.dart'; import '../../../widgets/localized.dart'; import '../../utils/i18_key_constants.dart' as i18; @@ -99,7 +98,8 @@ class SummaryPageState extends LocalizedState { localizations.translate( i18.common.coreCommonSummaryDetails, ), - style: textTheme.headingXl.copyWith(color: theme.colorTheme.primary.primary2), + style: textTheme.headingXl + .copyWith(color: theme.colorTheme.primary.primary2), ), ), ), @@ -218,16 +218,16 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.householdLocation.villageLabel), - value: localizations.translate( - householdState.householdModel?.address - ?.locality?.code ?? - i18.common.coreCommonNA), - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.householdLocation.villageLabel), + value: localizations.translate( + householdState.householdModel?.address + ?.locality?.code ?? + i18.common.coreCommonNA), + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate(i18 .householdLocation.landmarkFormLabel), @@ -237,7 +237,8 @@ class SummaryPageState extends LocalizedState { .translate(i18.common.coreCommonNA), isInline: true, labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2), + padding: + const EdgeInsets.only(top: spacer2), ), ]), ]), @@ -253,16 +254,16 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.beneficiaryDetails.totalMembers), - value: householdState - .householdModel?.memberCount - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.beneficiaryDetails.totalMembers), + value: householdState + .householdModel?.memberCount + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate(i18 .householdDetails @@ -282,23 +283,23 @@ class SummaryPageState extends LocalizedState { labelFlex: 5, ), LabelValueItem( - label: localizations.translate(i18 - .householdDetails - .noOfChildrenBelow5YearsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.children - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate(i18 + .householdDetails + .noOfChildrenBelow5YearsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.children + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), DigitCard( @@ -313,45 +314,45 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.householdDetails.noOfRoomsLabel), - value: householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType.noOfRooms - .toValue()) - .firstOrNull - ?.value - .toString() ?? - '0', - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.householdDetails.noOfRoomsLabel), + value: householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType.noOfRooms + .toValue()) + .firstOrNull + ?.value + .toString() ?? + '0', + isInline: true, + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( - label: localizations.translate( - i18.householdDetails.typeOfStructure), - value: (householdState.householdModel - ?.additionalFields?.fields - .where((h) => - h.key == - AdditionalFieldsType - .houseStructureTypes - .toValue()) - .firstOrNull - ?.value ?? - []) - .toString() - .split('|') - .map( - (item) => getLocalizedMessage(item)) - .toList() - .join(', '), - isInline: true, - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate( + i18.householdDetails.typeOfStructure), + value: (householdState.householdModel + ?.additionalFields?.fields + .where((h) => + h.key == + AdditionalFieldsType + .houseStructureTypes + .toValue()) + .firstOrNull + ?.value ?? + []) + .toString() + .split('|') + .map((item) => + getLocalizedMessage(item)) + .toList() + .join(', '), + isInline: true, + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), DigitCard( @@ -367,27 +368,28 @@ class SummaryPageState extends LocalizedState { ), items: [ LabelValueItem( - label: localizations.translate( - i18.individualDetails.nameLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.name?.givenName ?? - localizations.translate( - i18.common.coreCommonNA)), - labelFlex: 5, - padding: const EdgeInsets.only(bottom: spacer2) - ), + label: localizations.translate( + i18.individualDetails.nameLabelText), + value: householdState.maybeWhen( + orElse: () => localizations.translate( + i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel + ?.name?.givenName ?? + localizations.translate( + i18.common.coreCommonNA)), + labelFlex: 5, + padding: const EdgeInsets.only( + bottom: spacer2)), LabelValueItem( label: localizations.translate( i18.individualDetails.dobLabelText), @@ -419,32 +421,32 @@ class SummaryPageState extends LocalizedState { labelFlex: 5, ), LabelValueItem( - label: localizations.translate( - i18.individualDetails.genderLabelText), - value: householdState.maybeWhen( - orElse: () => localizations - .translate(i18.common.coreCommonNA), - summary: ( - navigateToRoot, - householdModel, - individualModel, - projectBeneficiaryModel, - registrationDate, - addressModel, - loading, - isHeadOfHousehold, - ) => - individualModel?.gender != null - ? localizations.translate( - individualModel - ?.gender?.name - .toUpperCase() ?? - '') - : localizations.translate( - i18.common.coreCommonNA)), - labelFlex: 5, - padding: const EdgeInsets.only(top: spacer2) - ), + label: localizations.translate(i18 + .individualDetails.genderLabelText), + value: householdState.maybeWhen( + orElse: () => localizations.translate( + i18.common.coreCommonNA), + summary: ( + navigateToRoot, + householdModel, + individualModel, + projectBeneficiaryModel, + registrationDate, + addressModel, + loading, + isHeadOfHousehold, + ) => + individualModel?.gender != null + ? localizations.translate( + individualModel + ?.gender?.name + .toUpperCase() ?? + '') + : localizations.translate( + i18.common.coreCommonNA)), + labelFlex: 5, + padding: + const EdgeInsets.only(top: spacer2)), ]), ]), ], diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 167a3e306f..8c61829213 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -485,6 +485,9 @@ class HouseholdDetails { String get viewHouseHoldDetailsAction => 'VIEW_HOUSEHOLD_DETAILS_ACTION_LABEL'; + String get viewInstitutionDetailsAction => + 'VIEW_INSTITUTION_DETAILS_ACTION_LABEL'; + String get noOfRoomsLabel => 'NO_OF_ROOMS_LABEL'; String get noOfRoomsCLFLabel => 'NO_OF_ROOMS_CLF_LABEL';