diff --git a/apps/health_campaign_field_worker_app/android/app/src/main/AndroidManifest.xml b/apps/health_campaign_field_worker_app/android/app/src/main/AndroidManifest.xml index 6bdfc6e86..549ee11ab 100644 --- a/apps/health_campaign_field_worker_app/android/app/src/main/AndroidManifest.xml +++ b/apps/health_campaign_field_worker_app/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ + diff --git a/apps/health_campaign_field_worker_app/lib/app.dart b/apps/health_campaign_field_worker_app/lib/app.dart index 7d90ae5da..7472335aa 100644 --- a/apps/health_campaign_field_worker_app/lib/app.dart +++ b/apps/health_campaign_field_worker_app/lib/app.dart @@ -316,6 +316,8 @@ class MainApplicationState extends State projectFacilityDataRepository: context.repository< ProjectFacilityModel, ProjectFacilitySearchModel>(), + facilityDataRepository: context.repository< + FacilityModel, FacilitySearchModel>(), ), ), BlocProvider( diff --git a/apps/health_campaign_field_worker_app/lib/data/local_store/app_shared_preferences.dart b/apps/health_campaign_field_worker_app/lib/data/local_store/app_shared_preferences.dart index 45b30f76e..aa2e0972e 100644 --- a/apps/health_campaign_field_worker_app/lib/data/local_store/app_shared_preferences.dart +++ b/apps/health_campaign_field_worker_app/lib/data/local_store/app_shared_preferences.dart @@ -29,7 +29,8 @@ class AppSharedPreferences { bool get isFirstLaunch => sharedPreferences.getBool(isFirstLaunchKey) ?? true; - String? get getSelectedLocale => sharedPreferences.getString(userSelectedLocale); + String? get getSelectedLocale => + sharedPreferences.getString(userSelectedLocale); Future appLaunchedFirstTime() async { await sharedPreferences.setBool( @@ -44,5 +45,4 @@ class AppSharedPreferences { localeString, ); } - } diff --git a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart b/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart index 8556c1163..21a3a507e 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/checklist/checklist_view.dart @@ -138,7 +138,9 @@ class _ChecklistViewPageState extends LocalizedState { } // Request location from LocationBloc - context.read().add(const LocationEvent.load()); + context + .read() + .add(const LocationEvent.load()); // Wait for the location to be obtained final locationState = @@ -146,7 +148,6 @@ class _ChecklistViewPageState extends LocalizedState { double? latitude = locationState.latitude; double? longitude = locationState.longitude; - final shouldSubmit = await DigitDialog.show( context, options: DigitDialogOptions( @@ -213,64 +214,68 @@ class _ChecklistViewPageState extends LocalizedState { .text .toString() : null, - additionalFields: ServiceAttributesAdditionalFields( + additionalFields: + ServiceAttributesAdditionalFields( version: 1, fields: [ AdditionalField( - 'latitude', latitude, + 'latitude', + latitude, ), AdditionalField( - 'longitude', longitude, + 'longitude', + longitude, ), ], ), - ) - ); + )); } context.read().add( ServiceCreateEvent( serviceModel: ServiceModel( - createdAt: DigitDateUtils - .getDateFromTimestamp( - DateTime.now() - .toLocal() - .millisecondsSinceEpoch, - dateFormat: Constants - .checklistViewDateFormat, - ), - tenantId: value - .selectedServiceDefinition! - .tenantId, - clientId: isHealthFacilityWorker && - widget.referralClientRefId != - null - ? widget.referralClientRefId - .toString() - : referenceId, - serviceDefId: value - .selectedServiceDefinition?.id, - attributes: attributes, - rowVersion: 1, - accountId: context.projectId, - auditDetails: AuditDetails( - createdBy: context.loggedInUserUuid, - createdTime: DateTime.now() - .millisecondsSinceEpoch, - ), - clientAuditDetails: - ClientAuditDetails( - createdBy: context.loggedInUserUuid, - createdTime: context - .millisecondsSinceEpoch(), - lastModifiedBy: - context.loggedInUserUuid, - lastModifiedTime: context - .millisecondsSinceEpoch(), - ), - additionalDetails: - context.boundary.code, - ), + createdAt: DigitDateUtils + .getDateFromTimestamp( + DateTime.now() + .toLocal() + .millisecondsSinceEpoch, + dateFormat: Constants + .checklistViewDateFormat, + ), + tenantId: value + .selectedServiceDefinition! + .tenantId, + clientId: isHealthFacilityWorker && + widget.referralClientRefId != + null + ? widget.referralClientRefId.toString() + : referenceId, + serviceDefId: value.selectedServiceDefinition?.id, + attributes: attributes, + rowVersion: 1, + accountId: context.projectId, + auditDetails: AuditDetails( + createdBy: + context.loggedInUserUuid, + createdTime: DateTime.now() + .millisecondsSinceEpoch, + ), + clientAuditDetails: ClientAuditDetails( + createdBy: + context.loggedInUserUuid, + createdTime: context + .millisecondsSinceEpoch(), + lastModifiedBy: + context.loggedInUserUuid, + lastModifiedTime: context + .millisecondsSinceEpoch(), + ), + additionalDetails: { + "boundaryCode": + context.boundary.code, + "lat": latitude, + "lng": longitude + }), ), ); @@ -397,7 +402,7 @@ class _ChecklistViewPageState extends LocalizedState { Align( alignment: Alignment.topLeft, child: Padding( - padding: const EdgeInsets.all(8), + padding: const EdgeInsets.all(kPadding * 2), child: Column( children: [ Text( @@ -412,45 +417,89 @@ class _ChecklistViewPageState extends LocalizedState { ), BlocBuilder( builder: (context, state) { + // Validation logic to check if required field is empty + final hasError = (e.required == true && + controller[index].text.isEmpty && + submitTriggered); + return Column( - children: e.values! - .map((e) => DigitCheckboxTile( - label: e, - value: controller[index] - .text - .split('.') - .contains(e), - onChanged: (value) { - context - .read() - .add( - ServiceChecklistEvent( - value: e.toString(), - submitTriggered: - submitTriggered, - ), - ); - final String ele; - var val = controller[index] - .text - .split('.'); - if (val.contains(e)) { - val.remove(e); - ele = val.join("."); - } else { - ele = - "${controller[index].text}.$e"; - } - controller[index].value = - TextEditingController - .fromValue( - TextEditingValue( - text: ele, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // Checkbox options + Column( + children: e.values! + .map((item) => Padding( + padding: + const EdgeInsets.only( + left: kPadding * 2), + child: DigitCheckboxTile( + label: item, + value: controller[index] + .text + .split('.') + .contains(item), + onChanged: (value) { + context + .read() + .add( + ServiceChecklistEvent( + value: item + .toString(), + submitTriggered: + submitTriggered, + ), + ); + + var val = + controller[index] + .text + .split('.'); + if (val + .contains(item)) { + val.remove(item); + } else { + val.add(item); + } + + // Update the controller with the selected values + controller[index] + .value = + TextEditingController + .fromValue( + TextEditingValue( + text: val.join('.'), + ), + ).value; + + // If the field is required and no option is selected, trigger validation + if (e.required == + true && + val.isEmpty) { + submitTriggered = + true; + } + }, ), - ).value; - }, - )) - .toList(), + )) + .toList(), + ), + // Error message display if validation fails + Offstage( + offstage: !hasError, + child: Align( + alignment: Alignment.centerLeft, + child: Text( + localizations.translate( + i18.common.corecommonRequired, + ), + style: TextStyle( + color: theme.colorScheme.error, + ), + ), + ), + ), + ], ); }, ), @@ -464,7 +513,7 @@ class _ChecklistViewPageState extends LocalizedState { context, ), ), - ]else if (e.dataType == 'Boolean') ...[ + ] else if (e.dataType == 'Boolean') ...[ if (!(e.code ?? '').contains('.')) DigitCard( child: Column( @@ -479,7 +528,8 @@ class _ChecklistViewPageState extends LocalizedState { '${localizations.translate( '${selectedServiceDefinition?.code}.${e.code}', )} ${e.required == true ? '*' : ''}', - style: theme.textTheme.headlineSmall, + style: theme + .textTheme.headlineSmall, ), ], ), @@ -492,30 +542,46 @@ class _ChecklistViewPageState extends LocalizedState { allowMultipleSelection: false, width: 110, valueMapper: (value) { - return value ? localizations.translate( - i18.common.coreCommonYes, - ) : localizations.translate( - i18.common.coreCommonNo, - ); + return value + ? localizations.translate( + i18.common + .coreCommonYes, + ) + : localizations.translate( + i18.common.coreCommonNo, + ); }, - initialSelection: controller[index].text=='true' ? [true] : controller[index].text=='false' ?[false] : [], - options: const [true, false], // TODO: need to update + initialSelection: + controller[index].text == + 'true' + ? [true] + : controller[index] + .text == + 'false' + ? [false] + : [], + options: const [ + true, + false + ], // TODO: need to update onSelectionChanged: (curValue) { - if(curValue.isNotEmpty){ + if (curValue.isNotEmpty) { context .read() .add( - ServiceChecklistEvent( - value: curValue.toString(), - submitTriggered: - submitTriggered, - ), - ); - controller[index].value = TextEditingValue( - text: curValue.first.toString(), + ServiceChecklistEvent( + value: curValue + .toString(), + submitTriggered: + submitTriggered, + ), + ); + controller[index].value = + TextEditingValue( + text: curValue.first + .toString(), ); } - }, ); }, 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 2e6ff96b8..5ad59140d 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/home.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/home.dart @@ -18,7 +18,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:health_campaign_field_worker_app/data/local_store/no_sql/schema/service_registry.dart'; import 'package:inventory_management/inventory_management.dart'; import 'package:inventory_management/router/inventory_router.gm.dart'; import 'package:referral_reconciliation/referral_reconciliation.dart'; @@ -32,6 +31,7 @@ import '../blocs/localization/localization.dart'; import '../blocs/sync/sync.dart'; import '../data/local_store/app_shared_preferences.dart'; import '../data/local_store/no_sql/schema/app_configuration.dart'; +import '../data/local_store/no_sql/schema/service_registry.dart'; import '../data/local_store/secure_store/secure_store.dart'; import '../models/entities/roles_type.dart'; import '../router/app_router.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/pages/login.dart b/apps/health_campaign_field_worker_app/lib/pages/login.dart index f0912efb5..cb1277d20 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/login.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/login.dart @@ -1,5 +1,7 @@ import 'package:digit_components/digit_components.dart'; +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; +import 'package:digit_components/widgets/privacy_notice/privacy_component.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -11,7 +13,6 @@ import '../router/app_router.dart'; import '../utils/environment_config.dart'; import '../utils/i18_key_constants.dart' as i18; import '../widgets/localized.dart'; -import '../widgets/privacy_notice/privacy_component.dart'; @RoutePage() class LoginPage extends LocalizedStatefulWidget { @@ -126,30 +127,33 @@ class _LoginPageState extends LocalizedState { suffix: buildPasswordVisibility(), ), BlocBuilder( + AppInitializationState>( builder: (context, initState) { - final privacyPolicyJson = initState.maybeWhen( - initialized: - (AppConfiguration appConfiguration, _, __) => - appConfiguration.privacyPolicyConfig, - orElse: () => null); - if (privacyPolicyJson?.active == false) { - return const SizedBox.shrink(); - } + final privacyPolicyJson = initState.maybeWhen( + initialized: + (AppConfiguration appConfiguration, _, __) => + appConfiguration.privacyPolicyConfig, + orElse: () => null); + if (privacyPolicyJson?.active == false) { + return const SizedBox.shrink(); + } - form.control(_privacyCheck).setValidators([Validators.requiredTrue]); - form.control(_privacyCheck).updateValueAndValidity(); - return PrivacyComponent( - privacyPolicy: privacyPolicyJson, - formControlName: _privacyCheck, - text: localizations - .translate(i18.privacyPolicy.privacyNoticeText), - linkText: localizations.translate( - i18.privacyPolicy.privacyPolicyLinkText), - validationMessage: localizations.translate( - i18.privacyPolicy.privacyPolicyValidationText), - ); - }), + form + .control(_privacyCheck) + .setValidators([Validators.requiredTrue]); + form.control(_privacyCheck).updateValueAndValidity(); + return PrivacyComponent( + privacyPolicy: + convertToPrivacyPolicyModel(privacyPolicyJson), + formControlName: _privacyCheck, + text: localizations + .translate(i18.privacyPolicy.privacyNoticeText), + linkText: localizations.translate( + i18.privacyPolicy.privacyPolicyLinkText), + validationMessage: localizations.translate( + i18.privacyPolicy.privacyPolicyValidationText), + ); + }), const SizedBox(height: 16), DigitElevatedButton( onPressed: () { @@ -159,16 +163,16 @@ class _LoginPageState extends LocalizedState { FocusManager.instance.primaryFocus?.unfocus(); context.read().add( - AuthLoginEvent( - userId: - (form.control(_userId).value as String) - .trim(), - password: - (form.control(_password).value as String) - .trim(), - tenantId: envConfig.variables.tenantId, - ), - ); + AuthLoginEvent( + userId: + (form.control(_userId).value as String) + .trim(), + password: + (form.control(_password).value as String) + .trim(), + tenantId: envConfig.variables.tenantId, + ), + ); }, child: Center( child: Text( @@ -224,16 +228,46 @@ class _LoginPageState extends LocalizedState { } FormGroup buildForm() => fb.group({ - _userId: FormControl( - value: '', - validators: [Validators.required], - ), - _password: FormControl( - validators: [Validators.required], - value: '', - ), - _privacyCheck: FormControl( - value: false, - ) - }); + _userId: FormControl( + value: '', + validators: [Validators.required], + ), + _password: FormControl( + validators: [Validators.required], + value: '', + ), + _privacyCheck: FormControl( + value: false, + ) + }); +} + +// convert to privacy notice model +PrivacyNoticeModel? convertToPrivacyPolicyModel(PrivacyPolicy? privacyPolicy) { + return PrivacyNoticeModel( + header: privacyPolicy?.header ?? '', + module: privacyPolicy?.module ?? '', + active: privacyPolicy?.active, + contents: privacyPolicy?.contents + ?.map((content) => ContentNoticeModel( + header: content.header, + descriptions: content.descriptions + ?.map((description) => DescriptionNoticeModel( + text: description.text, + type: description.type, + isBold: description.isBold, + subDescriptions: description.subDescriptions + ?.map((subDescription) => SubDescriptionNoticeModel( + text: subDescription.text, + type: subDescription.type, + isBold: subDescription.isBold, + isSpaceRequired: + subDescription.isSpaceRequired, + )) + .toList(), + )) + .toList(), + )) + .toList(), + ); } diff --git a/apps/health_campaign_field_worker_app/lib/pages/profile.dart b/apps/health_campaign_field_worker_app/lib/pages/profile.dart index b42a78708..216b38bb7 100644 --- a/apps/health_campaign_field_worker_app/lib/pages/profile.dart +++ b/apps/health_campaign_field_worker_app/lib/pages/profile.dart @@ -2,6 +2,7 @@ import 'package:collection/collection.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/widgets/atoms/digit_toaster.dart'; +import 'package:digit_data_model/blocs/user/user.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; diff --git a/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart b/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart index 74935a44d..76112cf6d 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/extensions/context_utility.dart @@ -77,8 +77,8 @@ extension ContextUtilityExtensions on BuildContext { final projectState = projectBloc.state; - final BeneficiaryType? selectedBeneficiary = - projectState.selectedProject?.targets?.firstOrNull?.beneficiaryType; + final BeneficiaryType? selectedBeneficiary = projectState + .selectedProject?.additionalDetails?.projectType?.beneficiaryType; if (selectedBeneficiary == null) { throw AppException('No beneficiary type is selected'); diff --git a/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart b/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart index 6e62855fe..700760a8e 100644 --- a/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart +++ b/apps/health_campaign_field_worker_app/lib/utils/localization_delegates.dart @@ -16,6 +16,7 @@ import 'package:referral_reconciliation/blocs/app_localization.dart' as referral_reconciliation_localization; import 'package:registration_delivery/blocs/app_localization.dart' as registration_delivery_localization; +import 'package:digit_components/blocs/localization.dart' as component_localization; import '../blocs/localization/app_localization.dart'; import '../data/local_store/no_sql/schema/app_configuration.dart'; @@ -59,6 +60,10 @@ getAppLocalizationDelegates({ digit_dss_localization.DashboardLocalization.getDelegate( LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, appConfig.languages!, - ) + ), + component_localization.ComponentLocalization.getDelegate( + LocalizationLocalRepository().returnLocalizationFromSQL(sql) as Future, + appConfig.languages!, + ), ]; } diff --git a/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart b/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart index 07530a05d..f46bc1084 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart +++ b/apps/health_campaign_field_worker_app/lib/widgets/sidebar/side_bar.dart @@ -1,6 +1,7 @@ import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/models/digit_row_card/digit_row_card_model.dart'; +import 'package:digit_data_model/blocs/user/user.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -110,9 +111,7 @@ class SideBar extends StatelessWidget { i18.common.coreCommonlanguage, ), icon: Icons.language, - onPressed: () { - - }, + onPressed: () {}, content: Offstage( offstage: languages == null, child: BlocBuilder( diff --git a/apps/health_campaign_field_worker_app/pubspec.lock b/apps/health_campaign_field_worker_app/pubspec.lock index c96f0b5fd..50dd5f8fc 100644 --- a/apps/health_campaign_field_worker_app/pubspec.lock +++ b/apps/health_campaign_field_worker_app/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: "direct main" description: name: attendance_management - sha256: f1b4373e8d0d9f8227ede0d25d4141f0d16d18ac2525c0347b844098cdab080f + sha256: "8a09814ca11cca736d771be70fb6174303ea0cb3525aa72e7239cbc14b915303" url: "https://pub.dev" source: hosted - version: "1.0.2+1" + version: "1.0.2+4" audioplayers: dependency: "direct main" description: @@ -430,7 +430,7 @@ packages: description: path: "packages/dart_mappable_builder" ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" + resolved-ref: "5595f37310a63a92b2c1c7e386c74fe39df5555d" url: "https://github.com/egovernments/health-campaign-field-worker-app/" source: git version: "4.2.0" @@ -494,32 +494,33 @@ 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: name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" + sha256: "139d193f202db85e685a9da6e33fe9ea17b7856cc5415413830bff8dfd67d33e" url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.9-uniqueId" digit_dss: dependency: "direct main" description: name: digit_dss - sha256: "32e2173ae52e7fd9fb53fa435fb21466248029366584f44a0c0f2c6836267a98" + sha256: "0498e3e910883a0132050a1acdd7b3a094b935240111bac24683515c9d0dcf3b" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" 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_scanner: dependency: "direct main" @@ -690,34 +691,34 @@ packages: dependency: "direct main" description: name: flutter_background_service - sha256: "94d9a143852729140e17254a53769383b03738cd92b6e588a8762003e6cd9dd9" + sha256: d32f078ec57647c9cfd6e1a8da9297f7d8f021d4dcc204a35aaad2cdbfe255f0 url: "https://pub.dev" source: hosted - version: "5.0.5" + version: "5.0.10" flutter_background_service_android: dependency: transitive description: name: flutter_background_service_android - sha256: "30863ebafd8214b8e76d5e5c9f27887dc5cc303fcf3e89f71534f621fc486782" + sha256: "39da42dddf877beeef82bc2583130d8bedb4d0765e99ca9e7b4a32e8c6abd239" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.2.7" flutter_background_service_ios: dependency: transitive description: name: flutter_background_service_ios - sha256: ab73657535876e16abc89e40f924df3e92ad3dee83f64d187081417e824709ed + sha256: "6037ffd45c4d019dab0975c7feb1d31012dd697e25edc05505a4a9b0c7dc9fba" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.0.3" flutter_background_service_platform_interface: dependency: transitive description: name: flutter_background_service_platform_interface - sha256: cd5720ff5b051d551a4734fae16683aace779bd0425e8d3f15d84a0cdcc2d8d9 + sha256: ca74aa95789a8304f4d3f57f07ba404faa86bed6e415f83e8edea6ad8b904a41 url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.2" flutter_bloc: dependency: "direct main" description: @@ -1120,10 +1121,10 @@ packages: dependency: "direct main" description: name: inventory_management - sha256: "1a5976ab807666629704f559730d5418e1c723fed898df2cc6e7d9807f813b6f" + sha256: "5866b781b960d38c4973a87ba664afda31502769fbbe684ec83b5ce697aea3e5" url: "https://pub.dev" source: hosted - version: "1.0.3+2" + version: "1.0.3-dev.3" io: dependency: transitive description: @@ -1536,18 +1537,18 @@ packages: dependency: "direct main" description: name: referral_reconciliation - sha256: "80d5b93164e4f8337fa757fcb75a1e85b88ffbb760e731ca24496a0cae2aef38" + sha256: "522b27524f971d62aa3aa40a659cc688cc3593054f3042e44db4c47287e38b91" url: "https://pub.dev" source: hosted - version: "1.0.2+1" + version: "1.0.2-dev.1" registration_delivery: dependency: "direct main" description: name: registration_delivery - sha256: a6a88665bbf1fa5dce5b864d66992ff9c885b2a3cd898d37f349f1be03cf4086 + sha256: b1db0f358f76249526975ff90fd97ce33f2a77286653acafb8bfb004086f849c url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.5-search-fix" remove_emoji_input_formatter: dependency: transitive description: diff --git a/apps/health_campaign_field_worker_app/pubspec.yaml b/apps/health_campaign_field_worker_app/pubspec.yaml index c2d6d352d..8474d7ad6 100644 --- a/apps/health_campaign_field_worker_app/pubspec.yaml +++ b/apps/health_campaign_field_worker_app/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sqlite3_flutter_libs: ^0.5.10 path_provider: ^2.0.11 path: ^1.8.2 - digit_components: ^1.0.1+1 + digit_components: ^1.0.2 auto_route: ^7.8.4 flutter_bloc: ^8.1.1 collection: ^1.16.0 @@ -65,12 +65,12 @@ dependencies: disk_space: ^0.2.1 google_mlkit_barcode_scanning: ^0.10.0 camera: ^0.10.5+7 - attendance_management: ^1.0.2+1 + attendance_management: ^1.0.2+4 digit_scanner: ^1.0.3+1 - inventory_management: ^1.0.3+2 - referral_reconciliation: ^1.0.2+1 - digit_data_model: ^1.0.3+1 - registration_delivery: ^1.0.3+1 + inventory_management: 1.0.3-dev.3 + referral_reconciliation: 1.0.2-dev.1 + digit_data_model: 1.0.4-dev.9-uniqueId + registration_delivery: ^1.0.4-dev.4-search-fix disable_battery_optimization: ^1.1.1 digit_dss: ^1.0.1 closed_household: ^1.0.1+1 diff --git a/packages/closed_household/pubspec.yaml b/packages/closed_household/pubspec.yaml index 6dccba824..201e98c8c 100644 --- a/packages/closed_household/pubspec.yaml +++ b/packages/closed_household/pubspec.yaml @@ -40,7 +40,11 @@ dependencies: stream_transform: ^2.1.0 async: ^2.11.0 formula_parser: ^2.0.1 - registration_delivery: ^1.0.3+1 + registration_delivery: + git: + url: https://github.com/egovernments/health-campaign-field-worker-app/ + ref: HCMPRE-638 + path: ./packages/registration_delivery dev_dependencies: diff --git a/packages/digit_components/CHANGELOG.md b/packages/digit_components/CHANGELOG.md index 7270235e4..a62b6ecf2 100644 --- a/packages/digit_components/CHANGELOG.md +++ b/packages/digit_components/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.0.2 +* Added privacy notice component + ## 1.0.1+1 * Changed similar dialogs to a common hideDialog diff --git a/packages/digit_components/example/pubspec.lock b/packages/digit_components/example/pubspec.lock index 5f036b9d0..87767b83c 100644 --- a/packages/digit_components/example/pubspec.lock +++ b/packages/digit_components/example/pubspec.lock @@ -231,7 +231,7 @@ packages: path: ".." relative: true source: path - version: "1.0.1+1" + version: "1.0.2" easy_stepper: dependency: transitive description: diff --git a/packages/digit_components/lib/blocs/localization.dart b/packages/digit_components/lib/blocs/localization.dart new file mode 100644 index 000000000..d393cfefa --- /dev/null +++ b/packages/digit_components/lib/blocs/localization.dart @@ -0,0 +1,52 @@ +import 'package:flutter/material.dart'; + +import 'localization_delegates.dart'; + + +// Class responsible for handling component localization +class ComponentLocalization { + final Locale locale; + final Future localizedStrings; + final List languages; + + ComponentLocalization(this.locale, this.localizedStrings, this.languages); + + // Method to get the current localization instance from context + static ComponentLocalization of(BuildContext context) { + return Localizations.of(context, ComponentLocalization)!; + } + + static final List _localizedStrings = []; + + // Method to get the delegate for localization + static LocalizationsDelegate getDelegate( + Future localizedStrings, List languages) => + ComponentLocalizationDelegate(localizedStrings, languages); + + // Method to load localized strings + Future load() async { + _localizedStrings.clear(); + // Iterate over localized strings and filter based on locale + for (var element in await localizedStrings) { + if (element.locale == '${locale.languageCode}_${locale.countryCode}') { + _localizedStrings.add(element); + } + } + + return true; + } + + // Method to translate a given localized value + String translate(String localizedValues) { + + if (_localizedStrings.isEmpty) { + return localizedValues; + } else { + final index = _localizedStrings.indexWhere( + (medium) => medium.code == localizedValues, + ); + + return index != -1 ? _localizedStrings[index].message : localizedValues; + } + } +} \ No newline at end of file diff --git a/packages/digit_components/lib/blocs/localization_delegates.dart b/packages/digit_components/lib/blocs/localization_delegates.dart new file mode 100644 index 000000000..3d2e2dd16 --- /dev/null +++ b/packages/digit_components/lib/blocs/localization_delegates.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +import 'localization.dart'; + + +class ComponentLocalizationDelegate + extends LocalizationsDelegate { + final Future localizedStrings; + final List languages; + + const ComponentLocalizationDelegate(this.localizedStrings, this.languages); + + @override + bool isSupported(Locale locale) { + return languages.map((e) { + final results = e.value.split('_'); + if (results.isNotEmpty) return results.first; + }).contains(locale.languageCode); + } + + @override + Future load(Locale locale) async { + ComponentLocalization localization = + ComponentLocalization(locale, localizedStrings, languages); + await localization.load(); + return localization; + } + + @override + bool shouldReload(covariant LocalizationsDelegate old) { + return true; + } +} \ No newline at end of file diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart new file mode 100644 index 000000000..f2d1f896c --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.dart @@ -0,0 +1,50 @@ +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'privacy_notice_model.freezed.dart'; +part 'privacy_notice_model.g.dart'; + +@freezed +class PrivacyNoticeModel with _$PrivacyNoticeModel { + const factory PrivacyNoticeModel({ + required String header, + required String module, + bool? active, + List? contents, + }) = _PrivacyNoticeModel; + + factory PrivacyNoticeModel.fromJson(Map json) => _$PrivacyNoticeModelFromJson(json); +} + +@freezed +class ContentNoticeModel with _$ContentNoticeModel { + const factory ContentNoticeModel({ + String? header, + List? descriptions, + }) = _ContentNoticeModel; + + factory ContentNoticeModel.fromJson(Map json) => _$ContentNoticeModelFromJson(json); +} + +@freezed +class DescriptionNoticeModel with _$DescriptionNoticeModel { + const factory DescriptionNoticeModel({ + String? text, + String? type, + bool? isBold, + List? subDescriptions, + }) = _DescriptionNoticeModel; + + factory DescriptionNoticeModel.fromJson(Map json) => _$DescriptionNoticeModelFromJson(json); +} + +@freezed +class SubDescriptionNoticeModel with _$SubDescriptionNoticeModel { + const factory SubDescriptionNoticeModel({ + String? text, + String? type, + bool? isBold, + bool? isSpaceRequired, + }) = _SubDescriptionNoticeModel; + + factory SubDescriptionNoticeModel.fromJson(Map json) => _$SubDescriptionNoticeModelFromJson(json); +} diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart new file mode 100644 index 000000000..2090ee866 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.freezed.dart @@ -0,0 +1,808 @@ +// coverage:ignore-file +// GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'privacy_notice_model.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +T _$identity(T value) => value; + +final _privateConstructorUsedError = UnsupportedError( + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); + +PrivacyNoticeModel _$PrivacyNoticeModelFromJson(Map json) { + return _PrivacyNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$PrivacyNoticeModel { + String get header => throw _privateConstructorUsedError; + String get module => throw _privateConstructorUsedError; + bool? get active => throw _privateConstructorUsedError; + List? get contents => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $PrivacyNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $PrivacyNoticeModelCopyWith<$Res> { + factory $PrivacyNoticeModelCopyWith( + PrivacyNoticeModel value, $Res Function(PrivacyNoticeModel) then) = + _$PrivacyNoticeModelCopyWithImpl<$Res, PrivacyNoticeModel>; + @useResult + $Res call( + {String header, + String module, + bool? active, + List? contents}); +} + +/// @nodoc +class _$PrivacyNoticeModelCopyWithImpl<$Res, $Val extends PrivacyNoticeModel> + implements $PrivacyNoticeModelCopyWith<$Res> { + _$PrivacyNoticeModelCopyWithImpl(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? header = null, + Object? module = null, + Object? active = freezed, + Object? contents = freezed, + }) { + return _then(_value.copyWith( + header: null == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String, + module: null == module + ? _value.module + : module // ignore: cast_nullable_to_non_nullable + as String, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + contents: freezed == contents + ? _value.contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$PrivacyNoticeModelImplCopyWith<$Res> + implements $PrivacyNoticeModelCopyWith<$Res> { + factory _$$PrivacyNoticeModelImplCopyWith(_$PrivacyNoticeModelImpl value, + $Res Function(_$PrivacyNoticeModelImpl) then) = + __$$PrivacyNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String header, + String module, + bool? active, + List? contents}); +} + +/// @nodoc +class __$$PrivacyNoticeModelImplCopyWithImpl<$Res> + extends _$PrivacyNoticeModelCopyWithImpl<$Res, _$PrivacyNoticeModelImpl> + implements _$$PrivacyNoticeModelImplCopyWith<$Res> { + __$$PrivacyNoticeModelImplCopyWithImpl(_$PrivacyNoticeModelImpl _value, + $Res Function(_$PrivacyNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = null, + Object? module = null, + Object? active = freezed, + Object? contents = freezed, + }) { + return _then(_$PrivacyNoticeModelImpl( + header: null == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String, + module: null == module + ? _value.module + : module // ignore: cast_nullable_to_non_nullable + as String, + active: freezed == active + ? _value.active + : active // ignore: cast_nullable_to_non_nullable + as bool?, + contents: freezed == contents + ? _value._contents + : contents // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$PrivacyNoticeModelImpl implements _PrivacyNoticeModel { + const _$PrivacyNoticeModelImpl( + {required this.header, + required this.module, + this.active, + final List? contents}) + : _contents = contents; + + factory _$PrivacyNoticeModelImpl.fromJson(Map json) => + _$$PrivacyNoticeModelImplFromJson(json); + + @override + final String header; + @override + final String module; + @override + final bool? active; + final List? _contents; + @override + List? get contents { + final value = _contents; + if (value == null) return null; + if (_contents is EqualUnmodifiableListView) return _contents; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'PrivacyNoticeModel(header: $header, module: $module, active: $active, contents: $contents)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$PrivacyNoticeModelImpl && + (identical(other.header, header) || other.header == header) && + (identical(other.module, module) || other.module == module) && + (identical(other.active, active) || other.active == active) && + const DeepCollectionEquality().equals(other._contents, _contents)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, header, module, active, + const DeepCollectionEquality().hash(_contents)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$PrivacyNoticeModelImplCopyWith<_$PrivacyNoticeModelImpl> get copyWith => + __$$PrivacyNoticeModelImplCopyWithImpl<_$PrivacyNoticeModelImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$PrivacyNoticeModelImplToJson( + this, + ); + } +} + +abstract class _PrivacyNoticeModel implements PrivacyNoticeModel { + const factory _PrivacyNoticeModel( + {required final String header, + required final String module, + final bool? active, + final List? contents}) = _$PrivacyNoticeModelImpl; + + factory _PrivacyNoticeModel.fromJson(Map json) = + _$PrivacyNoticeModelImpl.fromJson; + + @override + String get header; + @override + String get module; + @override + bool? get active; + @override + List? get contents; + @override + @JsonKey(ignore: true) + _$$PrivacyNoticeModelImplCopyWith<_$PrivacyNoticeModelImpl> get copyWith => + throw _privateConstructorUsedError; +} + +ContentNoticeModel _$ContentNoticeModelFromJson(Map json) { + return _ContentNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$ContentNoticeModel { + String? get header => throw _privateConstructorUsedError; + List? get descriptions => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $ContentNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ContentNoticeModelCopyWith<$Res> { + factory $ContentNoticeModelCopyWith( + ContentNoticeModel value, $Res Function(ContentNoticeModel) then) = + _$ContentNoticeModelCopyWithImpl<$Res, ContentNoticeModel>; + @useResult + $Res call({String? header, List? descriptions}); +} + +/// @nodoc +class _$ContentNoticeModelCopyWithImpl<$Res, $Val extends ContentNoticeModel> + implements $ContentNoticeModelCopyWith<$Res> { + _$ContentNoticeModelCopyWithImpl(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? header = freezed, + Object? descriptions = freezed, + }) { + return _then(_value.copyWith( + header: freezed == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String?, + descriptions: freezed == descriptions + ? _value.descriptions + : descriptions // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ContentNoticeModelImplCopyWith<$Res> + implements $ContentNoticeModelCopyWith<$Res> { + factory _$$ContentNoticeModelImplCopyWith(_$ContentNoticeModelImpl value, + $Res Function(_$ContentNoticeModelImpl) then) = + __$$ContentNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? header, List? descriptions}); +} + +/// @nodoc +class __$$ContentNoticeModelImplCopyWithImpl<$Res> + extends _$ContentNoticeModelCopyWithImpl<$Res, _$ContentNoticeModelImpl> + implements _$$ContentNoticeModelImplCopyWith<$Res> { + __$$ContentNoticeModelImplCopyWithImpl(_$ContentNoticeModelImpl _value, + $Res Function(_$ContentNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? header = freezed, + Object? descriptions = freezed, + }) { + return _then(_$ContentNoticeModelImpl( + header: freezed == header + ? _value.header + : header // ignore: cast_nullable_to_non_nullable + as String?, + descriptions: freezed == descriptions + ? _value._descriptions + : descriptions // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$ContentNoticeModelImpl implements _ContentNoticeModel { + const _$ContentNoticeModelImpl( + {this.header, final List? descriptions}) + : _descriptions = descriptions; + + factory _$ContentNoticeModelImpl.fromJson(Map json) => + _$$ContentNoticeModelImplFromJson(json); + + @override + final String? header; + final List? _descriptions; + @override + List? get descriptions { + final value = _descriptions; + if (value == null) return null; + if (_descriptions is EqualUnmodifiableListView) return _descriptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'ContentNoticeModel(header: $header, descriptions: $descriptions)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ContentNoticeModelImpl && + (identical(other.header, header) || other.header == header) && + const DeepCollectionEquality() + .equals(other._descriptions, _descriptions)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash( + runtimeType, header, const DeepCollectionEquality().hash(_descriptions)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$ContentNoticeModelImplCopyWith<_$ContentNoticeModelImpl> get copyWith => + __$$ContentNoticeModelImplCopyWithImpl<_$ContentNoticeModelImpl>( + this, _$identity); + + @override + Map toJson() { + return _$$ContentNoticeModelImplToJson( + this, + ); + } +} + +abstract class _ContentNoticeModel implements ContentNoticeModel { + const factory _ContentNoticeModel( + {final String? header, + final List? descriptions}) = + _$ContentNoticeModelImpl; + + factory _ContentNoticeModel.fromJson(Map json) = + _$ContentNoticeModelImpl.fromJson; + + @override + String? get header; + @override + List? get descriptions; + @override + @JsonKey(ignore: true) + _$$ContentNoticeModelImplCopyWith<_$ContentNoticeModelImpl> get copyWith => + throw _privateConstructorUsedError; +} + +DescriptionNoticeModel _$DescriptionNoticeModelFromJson( + Map json) { + return _DescriptionNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$DescriptionNoticeModel { + String? get text => throw _privateConstructorUsedError; + String? get type => throw _privateConstructorUsedError; + bool? get isBold => throw _privateConstructorUsedError; + List? get subDescriptions => + throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $DescriptionNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $DescriptionNoticeModelCopyWith<$Res> { + factory $DescriptionNoticeModelCopyWith(DescriptionNoticeModel value, + $Res Function(DescriptionNoticeModel) then) = + _$DescriptionNoticeModelCopyWithImpl<$Res, DescriptionNoticeModel>; + @useResult + $Res call( + {String? text, + String? type, + bool? isBold, + List? subDescriptions}); +} + +/// @nodoc +class _$DescriptionNoticeModelCopyWithImpl<$Res, + $Val extends DescriptionNoticeModel> + implements $DescriptionNoticeModelCopyWith<$Res> { + _$DescriptionNoticeModelCopyWithImpl(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? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? subDescriptions = freezed, + }) { + return _then(_value.copyWith( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + subDescriptions: freezed == subDescriptions + ? _value.subDescriptions + : subDescriptions // ignore: cast_nullable_to_non_nullable + as List?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$DescriptionNoticeModelImplCopyWith<$Res> + implements $DescriptionNoticeModelCopyWith<$Res> { + factory _$$DescriptionNoticeModelImplCopyWith( + _$DescriptionNoticeModelImpl value, + $Res Function(_$DescriptionNoticeModelImpl) then) = + __$$DescriptionNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {String? text, + String? type, + bool? isBold, + List? subDescriptions}); +} + +/// @nodoc +class __$$DescriptionNoticeModelImplCopyWithImpl<$Res> + extends _$DescriptionNoticeModelCopyWithImpl<$Res, + _$DescriptionNoticeModelImpl> + implements _$$DescriptionNoticeModelImplCopyWith<$Res> { + __$$DescriptionNoticeModelImplCopyWithImpl( + _$DescriptionNoticeModelImpl _value, + $Res Function(_$DescriptionNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? subDescriptions = freezed, + }) { + return _then(_$DescriptionNoticeModelImpl( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + subDescriptions: freezed == subDescriptions + ? _value._subDescriptions + : subDescriptions // ignore: cast_nullable_to_non_nullable + as List?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$DescriptionNoticeModelImpl implements _DescriptionNoticeModel { + const _$DescriptionNoticeModelImpl( + {this.text, + this.type, + this.isBold, + final List? subDescriptions}) + : _subDescriptions = subDescriptions; + + factory _$DescriptionNoticeModelImpl.fromJson(Map json) => + _$$DescriptionNoticeModelImplFromJson(json); + + @override + final String? text; + @override + final String? type; + @override + final bool? isBold; + final List? _subDescriptions; + @override + List? get subDescriptions { + final value = _subDescriptions; + if (value == null) return null; + if (_subDescriptions is EqualUnmodifiableListView) return _subDescriptions; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(value); + } + + @override + String toString() { + return 'DescriptionNoticeModel(text: $text, type: $type, isBold: $isBold, subDescriptions: $subDescriptions)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$DescriptionNoticeModelImpl && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.isBold, isBold) || other.isBold == isBold) && + const DeepCollectionEquality() + .equals(other._subDescriptions, _subDescriptions)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, text, type, isBold, + const DeepCollectionEquality().hash(_subDescriptions)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$DescriptionNoticeModelImplCopyWith<_$DescriptionNoticeModelImpl> + get copyWith => __$$DescriptionNoticeModelImplCopyWithImpl< + _$DescriptionNoticeModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$DescriptionNoticeModelImplToJson( + this, + ); + } +} + +abstract class _DescriptionNoticeModel implements DescriptionNoticeModel { + const factory _DescriptionNoticeModel( + {final String? text, + final String? type, + final bool? isBold, + final List? subDescriptions}) = + _$DescriptionNoticeModelImpl; + + factory _DescriptionNoticeModel.fromJson(Map json) = + _$DescriptionNoticeModelImpl.fromJson; + + @override + String? get text; + @override + String? get type; + @override + bool? get isBold; + @override + List? get subDescriptions; + @override + @JsonKey(ignore: true) + _$$DescriptionNoticeModelImplCopyWith<_$DescriptionNoticeModelImpl> + get copyWith => throw _privateConstructorUsedError; +} + +SubDescriptionNoticeModel _$SubDescriptionNoticeModelFromJson( + Map json) { + return _SubDescriptionNoticeModel.fromJson(json); +} + +/// @nodoc +mixin _$SubDescriptionNoticeModel { + String? get text => throw _privateConstructorUsedError; + String? get type => throw _privateConstructorUsedError; + bool? get isBold => throw _privateConstructorUsedError; + bool? get isSpaceRequired => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $SubDescriptionNoticeModelCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $SubDescriptionNoticeModelCopyWith<$Res> { + factory $SubDescriptionNoticeModelCopyWith(SubDescriptionNoticeModel value, + $Res Function(SubDescriptionNoticeModel) then) = + _$SubDescriptionNoticeModelCopyWithImpl<$Res, SubDescriptionNoticeModel>; + @useResult + $Res call({String? text, String? type, bool? isBold, bool? isSpaceRequired}); +} + +/// @nodoc +class _$SubDescriptionNoticeModelCopyWithImpl<$Res, + $Val extends SubDescriptionNoticeModel> + implements $SubDescriptionNoticeModelCopyWith<$Res> { + _$SubDescriptionNoticeModelCopyWithImpl(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? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? isSpaceRequired = freezed, + }) { + return _then(_value.copyWith( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + isSpaceRequired: freezed == isSpaceRequired + ? _value.isSpaceRequired + : isSpaceRequired // ignore: cast_nullable_to_non_nullable + as bool?, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$SubDescriptionNoticeModelImplCopyWith<$Res> + implements $SubDescriptionNoticeModelCopyWith<$Res> { + factory _$$SubDescriptionNoticeModelImplCopyWith( + _$SubDescriptionNoticeModelImpl value, + $Res Function(_$SubDescriptionNoticeModelImpl) then) = + __$$SubDescriptionNoticeModelImplCopyWithImpl<$Res>; + @override + @useResult + $Res call({String? text, String? type, bool? isBold, bool? isSpaceRequired}); +} + +/// @nodoc +class __$$SubDescriptionNoticeModelImplCopyWithImpl<$Res> + extends _$SubDescriptionNoticeModelCopyWithImpl<$Res, + _$SubDescriptionNoticeModelImpl> + implements _$$SubDescriptionNoticeModelImplCopyWith<$Res> { + __$$SubDescriptionNoticeModelImplCopyWithImpl( + _$SubDescriptionNoticeModelImpl _value, + $Res Function(_$SubDescriptionNoticeModelImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? text = freezed, + Object? type = freezed, + Object? isBold = freezed, + Object? isSpaceRequired = freezed, + }) { + return _then(_$SubDescriptionNoticeModelImpl( + text: freezed == text + ? _value.text + : text // ignore: cast_nullable_to_non_nullable + as String?, + type: freezed == type + ? _value.type + : type // ignore: cast_nullable_to_non_nullable + as String?, + isBold: freezed == isBold + ? _value.isBold + : isBold // ignore: cast_nullable_to_non_nullable + as bool?, + isSpaceRequired: freezed == isSpaceRequired + ? _value.isSpaceRequired + : isSpaceRequired // ignore: cast_nullable_to_non_nullable + as bool?, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$SubDescriptionNoticeModelImpl implements _SubDescriptionNoticeModel { + const _$SubDescriptionNoticeModelImpl( + {this.text, this.type, this.isBold, this.isSpaceRequired}); + + factory _$SubDescriptionNoticeModelImpl.fromJson(Map json) => + _$$SubDescriptionNoticeModelImplFromJson(json); + + @override + final String? text; + @override + final String? type; + @override + final bool? isBold; + @override + final bool? isSpaceRequired; + + @override + String toString() { + return 'SubDescriptionNoticeModel(text: $text, type: $type, isBold: $isBold, isSpaceRequired: $isSpaceRequired)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SubDescriptionNoticeModelImpl && + (identical(other.text, text) || other.text == text) && + (identical(other.type, type) || other.type == type) && + (identical(other.isBold, isBold) || other.isBold == isBold) && + (identical(other.isSpaceRequired, isSpaceRequired) || + other.isSpaceRequired == isSpaceRequired)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => + Object.hash(runtimeType, text, type, isBold, isSpaceRequired); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SubDescriptionNoticeModelImplCopyWith<_$SubDescriptionNoticeModelImpl> + get copyWith => __$$SubDescriptionNoticeModelImplCopyWithImpl< + _$SubDescriptionNoticeModelImpl>(this, _$identity); + + @override + Map toJson() { + return _$$SubDescriptionNoticeModelImplToJson( + this, + ); + } +} + +abstract class _SubDescriptionNoticeModel implements SubDescriptionNoticeModel { + const factory _SubDescriptionNoticeModel( + {final String? text, + final String? type, + final bool? isBold, + final bool? isSpaceRequired}) = _$SubDescriptionNoticeModelImpl; + + factory _SubDescriptionNoticeModel.fromJson(Map json) = + _$SubDescriptionNoticeModelImpl.fromJson; + + @override + String? get text; + @override + String? get type; + @override + bool? get isBold; + @override + bool? get isSpaceRequired; + @override + @JsonKey(ignore: true) + _$$SubDescriptionNoticeModelImplCopyWith<_$SubDescriptionNoticeModelImpl> + get copyWith => throw _privateConstructorUsedError; +} diff --git a/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart new file mode 100644 index 000000000..2e10758a5 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_notice/privacy_notice_model.g.dart @@ -0,0 +1,83 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'privacy_notice_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +_$PrivacyNoticeModelImpl _$$PrivacyNoticeModelImplFromJson( + Map json) => + _$PrivacyNoticeModelImpl( + header: json['header'] as String, + module: json['module'] as String, + active: json['active'] as bool?, + contents: (json['contents'] as List?) + ?.map((e) => ContentNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$PrivacyNoticeModelImplToJson( + _$PrivacyNoticeModelImpl instance) => + { + 'header': instance.header, + 'module': instance.module, + 'active': instance.active, + 'contents': instance.contents, + }; + +_$ContentNoticeModelImpl _$$ContentNoticeModelImplFromJson( + Map json) => + _$ContentNoticeModelImpl( + header: json['header'] as String?, + descriptions: (json['descriptions'] as List?) + ?.map( + (e) => DescriptionNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$ContentNoticeModelImplToJson( + _$ContentNoticeModelImpl instance) => + { + 'header': instance.header, + 'descriptions': instance.descriptions, + }; + +_$DescriptionNoticeModelImpl _$$DescriptionNoticeModelImplFromJson( + Map json) => + _$DescriptionNoticeModelImpl( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + subDescriptions: (json['subDescriptions'] as List?) + ?.map((e) => + SubDescriptionNoticeModel.fromJson(e as Map)) + .toList(), + ); + +Map _$$DescriptionNoticeModelImplToJson( + _$DescriptionNoticeModelImpl instance) => + { + 'text': instance.text, + 'type': instance.type, + 'isBold': instance.isBold, + 'subDescriptions': instance.subDescriptions, + }; + +_$SubDescriptionNoticeModelImpl _$$SubDescriptionNoticeModelImplFromJson( + Map json) => + _$SubDescriptionNoticeModelImpl( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + isSpaceRequired: json['isSpaceRequired'] as bool?, + ); + +Map _$$SubDescriptionNoticeModelImplToJson( + _$SubDescriptionNoticeModelImpl instance) => + { + 'text': instance.text, + 'type': instance.type, + 'isBold': instance.isBold, + 'isSpaceRequired': instance.isSpaceRequired, + }; diff --git a/packages/digit_components/lib/models/privacy_policy_model.dart b/packages/digit_components/lib/models/privacy_policy_model.dart new file mode 100644 index 000000000..834e44c60 --- /dev/null +++ b/packages/digit_components/lib/models/privacy_policy_model.dart @@ -0,0 +1,95 @@ +class PrivacyPolicy { + final String? header; // Changed to nullable + final String? module; // Changed to nullable + final bool? active; + final List? contents; + + PrivacyPolicy({ + this.header, + this.module, + this.active, + this.contents, + }); + + // Factory constructor to create PrivacyPolicy from JSON + factory PrivacyPolicy.fromJson(Map json) { + return PrivacyPolicy( + header: json['header'] as String?, + module: json['module'] as String?, + active: json['active'] as bool?, + contents: (json['contents'] as List?) + ?.map((item) => Content.fromJson(item as Map)) + .toList(), + ); + } +} + +class Content { + final String? header; // Changed to nullable + final List? descriptions; + + Content({ + this.header, + this.descriptions, + }); + + // Factory constructor to create Content from JSON + factory Content.fromJson(Map json) { + return Content( + header: json['header'] as String?, + descriptions: (json['descriptions'] as List?) + ?.map((item) => Description.fromJson(item as Map)) + .toList(), + ); + } +} + +class Description { + final String? text; // Changed to nullable + final String? type; // Changed to nullable + final bool? isBold; + final List? subDescriptions; + + Description({ + this.text, + this.type, + this.isBold, + this.subDescriptions, + }); + + // Factory constructor to create Description from JSON + factory Description.fromJson(Map json) { + return Description( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + subDescriptions: (json['subDescriptions'] as List?) + ?.map((item) => SubDescription.fromJson(item as Map)) + .toList(), + ); + } +} + +class SubDescription { + final String? text; // Changed to nullable + final String? type; // Changed to nullable + final bool? isBold; + final bool? isSpaceRequired; + + SubDescription({ + this.text, + this.type, + this.isBold, + this.isSpaceRequired, + }); + + // Factory constructor to create SubDescription from JSON + factory SubDescription.fromJson(Map json) { + return SubDescription( + text: json['text'] as String?, + type: json['type'] as String?, + isBold: json['isBold'] as bool?, + isSpaceRequired: json['isSpaceRequired'] as bool?, + ); + } +} diff --git a/packages/digit_components/lib/utils/i18_key_constants.dart b/packages/digit_components/lib/utils/i18_key_constants.dart new file mode 100644 index 000000000..1d7e1fcca --- /dev/null +++ b/packages/digit_components/lib/utils/i18_key_constants.dart @@ -0,0 +1,20 @@ +library i18; + +const privacyPolicy = PrivacyPolicy(); + +class PrivacyPolicy { + const PrivacyPolicy(); + + String get acceptText { + return 'PRIVACY_POLICY_ACCEPT_TEXT'; + } + + String get declineText { + return 'PRIVACY_POLICY_DECLINE_TEXT'; + } + + String get privacyNoticeText => 'PRIVACY_POLICY_TEXT'; + String get privacyPolicyLinkText => 'PRIVACY_POLICY_LINK_TEXT'; + String get privacyPolicyValidationText => 'PRIVACY_POLICY_VALIDATION_TEXT'; + +} \ No newline at end of file diff --git a/packages/digit_components/lib/widgets/localized.dart b/packages/digit_components/lib/widgets/localized.dart new file mode 100644 index 000000000..2d3d6a479 --- /dev/null +++ b/packages/digit_components/lib/widgets/localized.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import '../blocs/localization.dart'; + +abstract class LocalizedStatefulWidget extends StatefulWidget { + final ComponentLocalization? appLocalizations; + + const LocalizedStatefulWidget({ + super.key, + this.appLocalizations, + }); +} + +abstract class LocalizedState + extends State { + late ComponentLocalization _localizations; + + ComponentLocalization get localizations => _localizations; + + set localizations(ComponentLocalization localizations) { + if (mounted) { + setState(() { + _localizations = localizations; + }); + } + } + + @override + @mustCallSuper + void didChangeDependencies() { + _localizations = widget.appLocalizations ?? ComponentLocalization.of(context); + super.didChangeDependencies(); + } +} \ No newline at end of file diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart similarity index 96% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart index e246dc30a..f2d9aa0f0 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_component.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_component.dart @@ -1,7 +1,7 @@ import 'package:digit_components/digit_components.dart'; +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; import '../localized.dart'; import 'privacy_notice_dialog.dart'; import 'package:reactive_forms/reactive_forms.dart'; @@ -10,7 +10,7 @@ class PrivacyComponent extends LocalizedStatefulWidget { final String formControlName; final String text; final String linkText; - final PrivacyPolicy? privacyPolicy; + final PrivacyNoticeModel? privacyPolicy; final String? trailingText; final String validationMessage; @@ -21,7 +21,7 @@ class PrivacyComponent extends LocalizedStatefulWidget { required this.text, required this.linkText, this.trailingText, - this.privacyPolicy, + this.privacyPolicy, required this.validationMessage, }); @@ -54,6 +54,7 @@ class _PrivacyComponentState extends LocalizedState { return ValueListenableBuilder( valueListenable: checkboxStateNotifier, builder: (context, value, child) { + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -120,7 +121,7 @@ class _PrivacyComponentState extends LocalizedState { builder: (context) { return FullPageDialog( - privacyPolicy: widget.privacyPolicy ?? PrivacyPolicy(), + privacyPolicy: widget.privacyPolicy ?? const PrivacyNoticeModel(header: '', module: ''), onAccept: () { checkboxStateNotifier.value = true; field.didChange(true); diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart similarity index 93% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart index 55421cfc2..696b2c681 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_dialog.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_dialog.dart @@ -1,17 +1,17 @@ +import 'package:digit_components/models/privacy_notice/privacy_notice_model.dart'; import 'package:digit_components/theme/colors.dart'; import 'package:digit_components/widgets/digit_card.dart'; import 'package:digit_components/widgets/digit_elevated_button.dart'; import 'package:digit_components/widgets/digit_outline_button.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; +import '../../theme/digit_theme.dart'; import '../localized.dart'; import 'privacy_notice_expand_component.dart'; import '../../utils/i18_key_constants.dart' as i18; -import '../../models/privacy_notice/privacy_notice_model.dart'; -import '../showcase/showcase_wrappers.dart'; + class FullPageDialog extends LocalizedStatefulWidget { - final PrivacyPolicy privacyPolicy; + final PrivacyNoticeModel privacyPolicy; final VoidCallback onAccept; final VoidCallback onDecline; @@ -24,10 +24,10 @@ class FullPageDialog extends LocalizedStatefulWidget { }); @override - _FullPageDialogState createState() => _FullPageDialogState(); + FullPageDialogState createState() => FullPageDialogState(); } -class _FullPageDialogState extends LocalizedState { +class FullPageDialogState extends LocalizedState { @override Widget build(BuildContext context) { return Dialog.fullscreen( @@ -49,7 +49,7 @@ class _FullPageDialogState extends LocalizedState { Padding( padding: const EdgeInsets.only(top: kPadding*3, left: 0), child: Text( - localizations.translate(widget.privacyPolicy.header), + localizations.translate(widget.privacyPolicy.header ?? ''), maxLines: 3, style: Theme.of(context).textTheme.displayMedium?.copyWith( color: const DigitColors().woodsmokeBlack, diff --git a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart similarity index 91% rename from apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart rename to packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart index 6f3f6006a..50bf2eb05 100644 --- a/apps/health_campaign_field_worker_app/lib/widgets/privacy_notice/privacy_notice_expand_component.dart +++ b/packages/digit_components/lib/widgets/privacy_notice/privacy_notice_expand_component.dart @@ -1,11 +1,11 @@ -import 'package:closed_household/widgets/showcase/showcase_wrappers.dart'; import 'package:digit_components/theme/colors.dart'; import 'package:flutter/material.dart'; -import '../../data/local_store/no_sql/schema/app_configuration.dart'; +import '../../models/privacy_notice/privacy_notice_model.dart'; +import '../../theme/digit_theme.dart'; import '../localized.dart'; class ExpandableSection extends LocalizedStatefulWidget { - final Content content; + final ContentNoticeModel content; const ExpandableSection({ super.key, @@ -14,10 +14,10 @@ class ExpandableSection extends LocalizedStatefulWidget { }); @override - _ExpandableSectionState createState() => _ExpandableSectionState(); + ExpandableSectionState createState() => ExpandableSectionState(); } -class _ExpandableSectionState extends LocalizedState { +class ExpandableSectionState extends LocalizedState { bool _isExpanded = false; @override @@ -75,7 +75,7 @@ class _ExpandableSectionState extends LocalizedState { children: widget.content.descriptions!.asMap().entries.map((entry) { int index = entry.key; - Description desc = entry.value; + DescriptionNoticeModel desc = entry.value; int? stepNumber = desc.type == 'step' ? index + 1 : null; return DescriptionWidget( description: desc, @@ -91,7 +91,7 @@ class _ExpandableSectionState extends LocalizedState { } class DescriptionWidget extends LocalizedStatefulWidget { - final Description description; + final DescriptionNoticeModel description; final int? stepNumber; const DescriptionWidget({ @@ -102,10 +102,10 @@ class DescriptionWidget extends LocalizedStatefulWidget { }); @override - _DescriptionWidgetState createState() => _DescriptionWidgetState(); + DescriptionWidgetState createState() => DescriptionWidgetState(); } -class _DescriptionWidgetState extends LocalizedState { +class DescriptionWidgetState extends LocalizedState { @override Widget build(BuildContext context) { final descriptionText = widget.description.text ?? ''; @@ -201,7 +201,7 @@ class _DescriptionWidgetState extends LocalizedState { } class SubDescriptionWidget extends LocalizedStatefulWidget { - final SubDescription subDescription; + final SubDescriptionNoticeModel subDescription; final int? stepNumber; const SubDescriptionWidget({ @@ -212,10 +212,10 @@ class SubDescriptionWidget extends LocalizedStatefulWidget { }); @override - _SubDescriptionWidgetState createState() => _SubDescriptionWidgetState(); + SubDescriptionWidgetState createState() => SubDescriptionWidgetState(); } -class _SubDescriptionWidgetState extends LocalizedState { +class SubDescriptionWidgetState extends LocalizedState { @override Widget build(BuildContext context) { final subDescriptionText = widget.subDescription.text ?? ''; diff --git a/packages/digit_components/pubspec.yaml b/packages/digit_components/pubspec.yaml index 901f6c61c..f693b4a82 100644 --- a/packages/digit_components/pubspec.yaml +++ b/packages/digit_components/pubspec.yaml @@ -1,6 +1,6 @@ name: digit_components description: Digit UI Design specification Flutter widgets. Import this package by adding digit_components in respective pubspec.yaml dependencies. -version: 1.0.1+1 +version: 1.0.2 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/digit_components repository: https://github.com/egovernments/health-campaign-field-worker-app diff --git a/packages/digit_data_model/CHANGELOG.md b/packages/digit_data_model/CHANGELOG.md index 49f954173..bfd232b83 100644 --- a/packages/digit_data_model/CHANGELOG.md +++ b/packages/digit_data_model/CHANGELOG.md @@ -1,3 +1,39 @@ +## 1.0.4-dev.10-uniqueId + +* Bug Fix: + * Updated syncRetryCount,syncRetryInterval and errorPath to dynamic + +## 1.0.4-dev.9-uniqueId + +* Stock and facility related changes + * Added dateOfEntry in stock model + * Added name in facility model + +## 1.0.4-dev.8-uniqueId + +* Changed additionalDetails of ServiceModel to Map + +## 1.0.4-dev.7-uniqueId + +* Modified identifierType of unique beneficiary id + +## 1.0.4-dev.6-uniqueId + +* Added additionalDetails field to service definition attributes model + +## 1.0.4-dev.5-uniqueId + +* Added identifierType enum entity +* Added identifierType and id as primary key to identifier table + +* Updated oplog transactions to synchronous - fix for write transaction lock +* Same change in 1.0.3-hotfix, 1.0.4-dev.3 + +## 1.0.3+2 + +* Updated beneficiary type target model and table to string +* Updated project type beneficiary type model and table to BeneficiaryType enum + ## 1.0.3+1 * Updated oplog transactions to synchronous - fix for write transaction lock @@ -15,11 +51,11 @@ ## 1.0.3-dev.4 * Updated individual local search results with user uuid mapping - + ## 1.0.3-dev.3 -* Created localization table - - Creation of the localization table. +* Created localization table + - Creation of the localization table. ## 1.0.3-dev.2 @@ -53,7 +89,7 @@ ## 0.0.0-dev.2 -* Boundary v2 Integrated, to use Boundary v1 0.0.0-dev.1 version can be used +* Boundary v2 Integrated, to use Boundary v1 0.0.0-dev.1 version can be used - Integration of Boundary v2 with the option to use Boundary v1 version 0.0.0-dev.1. ## 0.0.0-dev.1 diff --git a/packages/digit_data_model/lib/blocs/project_facility/project_facility.dart b/packages/digit_data_model/lib/blocs/project_facility/project_facility.dart index ded76c2f0..8e44708f7 100644 --- a/packages/digit_data_model/lib/blocs/project_facility/project_facility.dart +++ b/packages/digit_data_model/lib/blocs/project_facility/project_facility.dart @@ -4,6 +4,7 @@ import 'dart:async'; import 'package:digit_data_model/models/entities/project_facility.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import '../../models/entities/facility.dart'; import '../../utils/typedefs.dart'; @@ -19,12 +20,14 @@ class ProjectFacilityBloc extends Bloc { // The data repository used by this bloc. final ProjectFacilityDataRepository projectFacilityDataRepository; + final FacilityDataRepository facilityDataRepository; /// The constructor for `ProjectFacilityBloc`. /// It initializes the bloc with an empty state and sets up the event handler for loading project facilities. ProjectFacilityBloc( super.initialState, { required this.projectFacilityDataRepository, + required this.facilityDataRepository, }) { on(_handleLoad); } @@ -40,10 +43,21 @@ class ProjectFacilityBloc event.query, ); + final facilities = await facilityDataRepository.search(FacilitySearchModel( + id: results.map((e) => e.facilityId).toList(), + )); + Map facilityMap = {}; + for (var element in facilities) { + facilityMap[element.id] = element.name ?? element.id; + } + if (results.isEmpty) { emit(const ProjectFacilityEmptyState()); } else { - emit(ProjectFacilityFetchedState(projectFacilities: results)); + emit(ProjectFacilityFetchedState( + projectFacilities: results, + facilityMap: facilityMap, + )); } } } @@ -69,5 +83,6 @@ class ProjectFacilityState with _$ProjectFacilityState { /// The `ProjectFacilityFetchedState` state represents the state where project facilities have been loaded. const factory ProjectFacilityState.fetched({ required List projectFacilities, + required Map facilityMap, }) = ProjectFacilityFetchedState; } diff --git a/packages/digit_data_model/lib/blocs/project_facility/project_facility.freezed.dart b/packages/digit_data_model/lib/blocs/project_facility/project_facility.freezed.dart index fc9a97289..9251295c8 100644 --- a/packages/digit_data_model/lib/blocs/project_facility/project_facility.freezed.dart +++ b/packages/digit_data_model/lib/blocs/project_facility/project_facility.freezed.dart @@ -232,7 +232,8 @@ mixin _$ProjectFacilityState { TResult when({ required TResult Function() empty, required TResult Function() loading, - required TResult Function(List projectFacilities) + required TResult Function(List projectFacilities, + Map facilityMap) fetched, }) => throw _privateConstructorUsedError; @@ -240,14 +241,18 @@ mixin _$ProjectFacilityState { TResult? whenOrNull({ TResult? Function()? empty, TResult? Function()? loading, - TResult? Function(List projectFacilities)? fetched, + TResult? Function(List projectFacilities, + Map facilityMap)? + fetched, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ TResult Function()? empty, TResult Function()? loading, - TResult Function(List projectFacilities)? fetched, + TResult Function(List projectFacilities, + Map facilityMap)? + fetched, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -338,7 +343,8 @@ class _$ProjectFacilityEmptyStateImpl implements ProjectFacilityEmptyState { TResult when({ required TResult Function() empty, required TResult Function() loading, - required TResult Function(List projectFacilities) + required TResult Function(List projectFacilities, + Map facilityMap) fetched, }) { return empty(); @@ -349,7 +355,9 @@ class _$ProjectFacilityEmptyStateImpl implements ProjectFacilityEmptyState { TResult? whenOrNull({ TResult? Function()? empty, TResult? Function()? loading, - TResult? Function(List projectFacilities)? fetched, + TResult? Function(List projectFacilities, + Map facilityMap)? + fetched, }) { return empty?.call(); } @@ -359,7 +367,9 @@ class _$ProjectFacilityEmptyStateImpl implements ProjectFacilityEmptyState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? loading, - TResult Function(List projectFacilities)? fetched, + TResult Function(List projectFacilities, + Map facilityMap)? + fetched, required TResult orElse(), }) { if (empty != null) { @@ -451,7 +461,8 @@ class _$ProjectFacilityLoadingStateImpl implements ProjectFacilityLoadingState { TResult when({ required TResult Function() empty, required TResult Function() loading, - required TResult Function(List projectFacilities) + required TResult Function(List projectFacilities, + Map facilityMap) fetched, }) { return loading(); @@ -462,7 +473,9 @@ class _$ProjectFacilityLoadingStateImpl implements ProjectFacilityLoadingState { TResult? whenOrNull({ TResult? Function()? empty, TResult? Function()? loading, - TResult? Function(List projectFacilities)? fetched, + TResult? Function(List projectFacilities, + Map facilityMap)? + fetched, }) { return loading?.call(); } @@ -472,7 +485,9 @@ class _$ProjectFacilityLoadingStateImpl implements ProjectFacilityLoadingState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? loading, - TResult Function(List projectFacilities)? fetched, + TResult Function(List projectFacilities, + Map facilityMap)? + fetched, required TResult orElse(), }) { if (loading != null) { @@ -528,7 +543,9 @@ abstract class _$$ProjectFacilityFetchedStateImplCopyWith<$Res> { $Res Function(_$ProjectFacilityFetchedStateImpl) then) = __$$ProjectFacilityFetchedStateImplCopyWithImpl<$Res>; @useResult - $Res call({List projectFacilities}); + $Res call( + {List projectFacilities, + Map facilityMap}); } /// @nodoc @@ -545,12 +562,17 @@ class __$$ProjectFacilityFetchedStateImplCopyWithImpl<$Res> @override $Res call({ Object? projectFacilities = null, + Object? facilityMap = null, }) { return _then(_$ProjectFacilityFetchedStateImpl( projectFacilities: null == projectFacilities ? _value._projectFacilities : projectFacilities // ignore: cast_nullable_to_non_nullable as List, + facilityMap: null == facilityMap + ? _value._facilityMap + : facilityMap // ignore: cast_nullable_to_non_nullable + as Map, )); } } @@ -559,8 +581,10 @@ class __$$ProjectFacilityFetchedStateImplCopyWithImpl<$Res> class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { const _$ProjectFacilityFetchedStateImpl( - {required final List projectFacilities}) - : _projectFacilities = projectFacilities; + {required final List projectFacilities, + required final Map facilityMap}) + : _projectFacilities = projectFacilities, + _facilityMap = facilityMap; final List _projectFacilities; @override @@ -571,9 +595,17 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { return EqualUnmodifiableListView(_projectFacilities); } + final Map _facilityMap; + @override + Map get facilityMap { + if (_facilityMap is EqualUnmodifiableMapView) return _facilityMap; + // ignore: implicit_dynamic_type + return EqualUnmodifiableMapView(_facilityMap); + } + @override String toString() { - return 'ProjectFacilityState.fetched(projectFacilities: $projectFacilities)'; + return 'ProjectFacilityState.fetched(projectFacilities: $projectFacilities, facilityMap: $facilityMap)'; } @override @@ -582,12 +614,16 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { (other.runtimeType == runtimeType && other is _$ProjectFacilityFetchedStateImpl && const DeepCollectionEquality() - .equals(other._projectFacilities, _projectFacilities)); + .equals(other._projectFacilities, _projectFacilities) && + const DeepCollectionEquality() + .equals(other._facilityMap, _facilityMap)); } @override int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_projectFacilities)); + runtimeType, + const DeepCollectionEquality().hash(_projectFacilities), + const DeepCollectionEquality().hash(_facilityMap)); @JsonKey(ignore: true) @override @@ -601,10 +637,11 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { TResult when({ required TResult Function() empty, required TResult Function() loading, - required TResult Function(List projectFacilities) + required TResult Function(List projectFacilities, + Map facilityMap) fetched, }) { - return fetched(projectFacilities); + return fetched(projectFacilities, facilityMap); } @override @@ -612,9 +649,11 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { TResult? whenOrNull({ TResult? Function()? empty, TResult? Function()? loading, - TResult? Function(List projectFacilities)? fetched, + TResult? Function(List projectFacilities, + Map facilityMap)? + fetched, }) { - return fetched?.call(projectFacilities); + return fetched?.call(projectFacilities, facilityMap); } @override @@ -622,11 +661,13 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { TResult maybeWhen({ TResult Function()? empty, TResult Function()? loading, - TResult Function(List projectFacilities)? fetched, + TResult Function(List projectFacilities, + Map facilityMap)? + fetched, required TResult orElse(), }) { if (fetched != null) { - return fetched(projectFacilities); + return fetched(projectFacilities, facilityMap); } return orElse(); } @@ -668,10 +709,12 @@ class _$ProjectFacilityFetchedStateImpl implements ProjectFacilityFetchedState { abstract class ProjectFacilityFetchedState implements ProjectFacilityState { const factory ProjectFacilityFetchedState( - {required final List projectFacilities}) = + {required final List projectFacilities, + required final Map facilityMap}) = _$ProjectFacilityFetchedStateImpl; List get projectFacilities; + Map get facilityMap; @JsonKey(ignore: true) _$$ProjectFacilityFetchedStateImplCopyWith<_$ProjectFacilityFetchedStateImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/packages/digit_data_model/lib/data/data_repository.dart b/packages/digit_data_model/lib/data/data_repository.dart index 17b98e2dc..89914d162 100644 --- a/packages/digit_data_model/lib/data/data_repository.dart +++ b/packages/digit_data_model/lib/data/data_repository.dart @@ -291,7 +291,7 @@ R extends EntitySearchModel> extends DataRepository { } return await dio.post( - 'error-handler/handle-error', // [TODO: Update this URL] + DigitDataModelSingleton().errorDumpApiPath, options: Options(headers: { "content-type": 'application/json', }), 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 3c37e452b..f8d5dfca9 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 @@ -6875,6 +6875,11 @@ class $FacilityTable extends Facility late final GeneratedColumn tenantId = GeneratedColumn( 'tenant_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _nameMeta = const VerificationMeta('name'); + @override + late final GeneratedColumn name = GeneratedColumn( + 'name', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override @@ -6913,6 +6918,7 @@ class $FacilityTable extends Facility auditModifiedBy, auditModifiedTime, tenantId, + name, isDeleted, rowVersion, additionalFields @@ -7006,6 +7012,10 @@ class $FacilityTable extends Facility context.handle(_tenantIdMeta, tenantId.isAcceptableOrUnknown(data['tenant_id']!, _tenantIdMeta)); } + if (data.containsKey('name')) { + context.handle( + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); + } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); @@ -7059,6 +7069,8 @@ class $FacilityTable extends Facility DriftSqlType.int, data['${effectivePrefix}audit_modified_time']), tenantId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tenant_id']), + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name']), isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted']), rowVersion: attachedDatabase.typeMapping @@ -7089,6 +7101,7 @@ class FacilityData extends DataClass implements Insertable { final String? auditModifiedBy; final int? auditModifiedTime; final String? tenantId; + final String? name; final bool? isDeleted; final int? rowVersion; final String? additionalFields; @@ -7107,6 +7120,7 @@ class FacilityData extends DataClass implements Insertable { this.auditModifiedBy, this.auditModifiedTime, this.tenantId, + this.name, this.isDeleted, this.rowVersion, this.additionalFields}); @@ -7153,6 +7167,9 @@ class FacilityData extends DataClass implements Insertable { if (!nullToAbsent || tenantId != null) { map['tenant_id'] = Variable(tenantId); } + if (!nullToAbsent || name != null) { + map['name'] = Variable(name); + } if (!nullToAbsent || isDeleted != null) { map['is_deleted'] = Variable(isDeleted); } @@ -7206,6 +7223,7 @@ class FacilityData extends DataClass implements Insertable { tenantId: tenantId == null && nullToAbsent ? const Value.absent() : Value(tenantId), + name: name == null && nullToAbsent ? const Value.absent() : Value(name), isDeleted: isDeleted == null && nullToAbsent ? const Value.absent() : Value(isDeleted), @@ -7237,6 +7255,7 @@ class FacilityData extends DataClass implements Insertable { auditModifiedBy: serializer.fromJson(json['auditModifiedBy']), auditModifiedTime: serializer.fromJson(json['auditModifiedTime']), tenantId: serializer.fromJson(json['tenantId']), + name: serializer.fromJson(json['name']), isDeleted: serializer.fromJson(json['isDeleted']), rowVersion: serializer.fromJson(json['rowVersion']), additionalFields: serializer.fromJson(json['additionalFields']), @@ -7260,6 +7279,7 @@ class FacilityData extends DataClass implements Insertable { 'auditModifiedBy': serializer.toJson(auditModifiedBy), 'auditModifiedTime': serializer.toJson(auditModifiedTime), 'tenantId': serializer.toJson(tenantId), + 'name': serializer.toJson(name), 'isDeleted': serializer.toJson(isDeleted), 'rowVersion': serializer.toJson(rowVersion), 'additionalFields': serializer.toJson(additionalFields), @@ -7281,6 +7301,7 @@ class FacilityData extends DataClass implements Insertable { Value auditModifiedBy = const Value.absent(), Value auditModifiedTime = const Value.absent(), Value tenantId = const Value.absent(), + Value name = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), Value additionalFields = const Value.absent()}) => @@ -7318,6 +7339,7 @@ class FacilityData extends DataClass implements Insertable { ? auditModifiedTime.value : this.auditModifiedTime, tenantId: tenantId.present ? tenantId.value : this.tenantId, + name: name.present ? name.value : this.name, isDeleted: isDeleted.present ? isDeleted.value : this.isDeleted, rowVersion: rowVersion.present ? rowVersion.value : this.rowVersion, additionalFields: additionalFields.present @@ -7341,6 +7363,7 @@ class FacilityData extends DataClass implements Insertable { ..write('auditModifiedBy: $auditModifiedBy, ') ..write('auditModifiedTime: $auditModifiedTime, ') ..write('tenantId: $tenantId, ') + ..write('name: $name, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') ..write('additionalFields: $additionalFields') @@ -7364,6 +7387,7 @@ class FacilityData extends DataClass implements Insertable { auditModifiedBy, auditModifiedTime, tenantId, + name, isDeleted, rowVersion, additionalFields); @@ -7385,6 +7409,7 @@ class FacilityData extends DataClass implements Insertable { other.auditModifiedBy == this.auditModifiedBy && other.auditModifiedTime == this.auditModifiedTime && other.tenantId == this.tenantId && + other.name == this.name && other.isDeleted == this.isDeleted && other.rowVersion == this.rowVersion && other.additionalFields == this.additionalFields); @@ -7405,6 +7430,7 @@ class FacilityCompanion extends UpdateCompanion { final Value auditModifiedBy; final Value auditModifiedTime; final Value tenantId; + final Value name; final Value isDeleted; final Value rowVersion; final Value additionalFields; @@ -7424,6 +7450,7 @@ class FacilityCompanion extends UpdateCompanion { this.auditModifiedBy = const Value.absent(), this.auditModifiedTime = const Value.absent(), this.tenantId = const Value.absent(), + this.name = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), this.additionalFields = const Value.absent(), @@ -7444,6 +7471,7 @@ class FacilityCompanion extends UpdateCompanion { this.auditModifiedBy = const Value.absent(), this.auditModifiedTime = const Value.absent(), this.tenantId = const Value.absent(), + this.name = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), this.additionalFields = const Value.absent(), @@ -7464,6 +7492,7 @@ class FacilityCompanion extends UpdateCompanion { Expression? auditModifiedBy, Expression? auditModifiedTime, Expression? tenantId, + Expression? name, Expression? isDeleted, Expression? rowVersion, Expression? additionalFields, @@ -7486,6 +7515,7 @@ class FacilityCompanion extends UpdateCompanion { if (auditModifiedBy != null) 'audit_modified_by': auditModifiedBy, if (auditModifiedTime != null) 'audit_modified_time': auditModifiedTime, if (tenantId != null) 'tenant_id': tenantId, + if (name != null) 'name': name, if (isDeleted != null) 'is_deleted': isDeleted, if (rowVersion != null) 'row_version': rowVersion, if (additionalFields != null) 'additional_fields': additionalFields, @@ -7508,6 +7538,7 @@ class FacilityCompanion extends UpdateCompanion { Value? auditModifiedBy, Value? auditModifiedTime, Value? tenantId, + Value? name, Value? isDeleted, Value? rowVersion, Value? additionalFields, @@ -7527,6 +7558,7 @@ class FacilityCompanion extends UpdateCompanion { auditModifiedBy: auditModifiedBy ?? this.auditModifiedBy, auditModifiedTime: auditModifiedTime ?? this.auditModifiedTime, tenantId: tenantId ?? this.tenantId, + name: name ?? this.name, isDeleted: isDeleted ?? this.isDeleted, rowVersion: rowVersion ?? this.rowVersion, additionalFields: additionalFields ?? this.additionalFields, @@ -7579,6 +7611,9 @@ class FacilityCompanion extends UpdateCompanion { if (tenantId.present) { map['tenant_id'] = Variable(tenantId.value); } + if (name.present) { + map['name'] = Variable(name.value); + } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } @@ -7611,6 +7646,7 @@ class FacilityCompanion extends UpdateCompanion { ..write('auditModifiedBy: $auditModifiedBy, ') ..write('auditModifiedTime: $auditModifiedTime, ') ..write('tenantId: $tenantId, ') + ..write('name: $name, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') ..write('additionalFields: $additionalFields, ') @@ -14874,9 +14910,12 @@ class $ProjectTypeTable extends ProjectType static const VerificationMeta _beneficiaryTypeMeta = const VerificationMeta('beneficiaryType'); @override - late final GeneratedColumn beneficiaryType = GeneratedColumn( - 'beneficiary_type', aliasedName, true, - type: DriftSqlType.string, requiredDuringInsert: false); + late final GeneratedColumnWithTypeConverter + beneficiaryType = GeneratedColumn( + 'beneficiary_type', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false) + .withConverter( + $ProjectTypeTable.$converterbeneficiaryTypen); static const VerificationMeta _eligibilityCriteriaMeta = const VerificationMeta('eligibilityCriteria'); @override @@ -15030,12 +15069,7 @@ class $ProjectTypeTable extends ProjectType context.handle( _groupMeta, group.isAcceptableOrUnknown(data['group']!, _groupMeta)); } - if (data.containsKey('beneficiary_type')) { - context.handle( - _beneficiaryTypeMeta, - beneficiaryType.isAcceptableOrUnknown( - data['beneficiary_type']!, _beneficiaryTypeMeta)); - } + context.handle(_beneficiaryTypeMeta, const VerificationResult.success()); if (data.containsKey('eligibility_criteria')) { context.handle( _eligibilityCriteriaMeta, @@ -15147,8 +15181,9 @@ class $ProjectTypeTable extends ProjectType .read(DriftSqlType.string, data['${effectivePrefix}code']), group: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}group']), - beneficiaryType: attachedDatabase.typeMapping.read( - DriftSqlType.string, data['${effectivePrefix}beneficiary_type']), + beneficiaryType: $ProjectTypeTable.$converterbeneficiaryTypen.fromSql( + attachedDatabase.typeMapping.read( + DriftSqlType.int, data['${effectivePrefix}beneficiary_type'])), eligibilityCriteria: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}eligibility_criteria']), taskProcedure: attachedDatabase.typeMapping @@ -15188,6 +15223,13 @@ class $ProjectTypeTable extends ProjectType $ProjectTypeTable createAlias(String alias) { return $ProjectTypeTable(attachedDatabase, alias); } + + static JsonTypeConverter2 + $converterbeneficiaryType = + const EnumIndexConverter(BeneficiaryType.values); + static JsonTypeConverter2 + $converterbeneficiaryTypen = + JsonTypeConverter2.asNullable($converterbeneficiaryType); } class ProjectTypeData extends DataClass implements Insertable { @@ -15195,7 +15237,7 @@ class ProjectTypeData extends DataClass implements Insertable { final String? name; final String? code; final String? group; - final String? beneficiaryType; + final BeneficiaryType? beneficiaryType; final String? eligibilityCriteria; final String? taskProcedure; final String? auditCreatedBy; @@ -15250,7 +15292,8 @@ class ProjectTypeData extends DataClass implements Insertable { map['group'] = Variable(group); } if (!nullToAbsent || beneficiaryType != null) { - map['beneficiary_type'] = Variable(beneficiaryType); + map['beneficiary_type'] = Variable( + $ProjectTypeTable.$converterbeneficiaryTypen.toSql(beneficiaryType)); } if (!nullToAbsent || eligibilityCriteria != null) { map['eligibility_criteria'] = Variable(eligibilityCriteria); @@ -15368,7 +15411,8 @@ class ProjectTypeData extends DataClass implements Insertable { name: serializer.fromJson(json['name']), code: serializer.fromJson(json['code']), group: serializer.fromJson(json['group']), - beneficiaryType: serializer.fromJson(json['beneficiaryType']), + beneficiaryType: $ProjectTypeTable.$converterbeneficiaryTypen + .fromJson(serializer.fromJson(json['beneficiaryType'])), eligibilityCriteria: serializer.fromJson(json['eligibilityCriteria']), taskProcedure: serializer.fromJson(json['taskProcedure']), @@ -15397,7 +15441,8 @@ class ProjectTypeData extends DataClass implements Insertable { 'name': serializer.toJson(name), 'code': serializer.toJson(code), 'group': serializer.toJson(group), - 'beneficiaryType': serializer.toJson(beneficiaryType), + 'beneficiaryType': serializer.toJson( + $ProjectTypeTable.$converterbeneficiaryTypen.toJson(beneficiaryType)), 'eligibilityCriteria': serializer.toJson(eligibilityCriteria), 'taskProcedure': serializer.toJson(taskProcedure), 'auditCreatedBy': serializer.toJson(auditCreatedBy), @@ -15422,7 +15467,7 @@ class ProjectTypeData extends DataClass implements Insertable { Value name = const Value.absent(), Value code = const Value.absent(), Value group = const Value.absent(), - Value beneficiaryType = const Value.absent(), + Value beneficiaryType = const Value.absent(), Value eligibilityCriteria = const Value.absent(), Value taskProcedure = const Value.absent(), Value auditCreatedBy = const Value.absent(), @@ -15570,7 +15615,7 @@ class ProjectTypeCompanion extends UpdateCompanion { final Value name; final Value code; final Value group; - final Value beneficiaryType; + final Value beneficiaryType; final Value eligibilityCriteria; final Value taskProcedure; final Value auditCreatedBy; @@ -15641,7 +15686,7 @@ class ProjectTypeCompanion extends UpdateCompanion { Expression? name, Expression? code, Expression? group, - Expression? beneficiaryType, + Expression? beneficiaryType, Expression? eligibilityCriteria, Expression? taskProcedure, Expression? auditCreatedBy, @@ -15694,7 +15739,7 @@ class ProjectTypeCompanion extends UpdateCompanion { Value? name, Value? code, Value? group, - Value? beneficiaryType, + Value? beneficiaryType, Value? eligibilityCriteria, Value? taskProcedure, Value? auditCreatedBy, @@ -15754,7 +15799,9 @@ class ProjectTypeCompanion extends UpdateCompanion { map['group'] = Variable(group.value); } if (beneficiaryType.present) { - map['beneficiary_type'] = Variable(beneficiaryType.value); + map['beneficiary_type'] = Variable($ProjectTypeTable + .$converterbeneficiaryTypen + .toSql(beneficiaryType.value)); } if (eligibilityCriteria.present) { map['eligibility_criteria'] = Variable(eligibilityCriteria.value); @@ -17333,7 +17380,8 @@ class $IdentifierTable extends Identifier } @override - Set get $primaryKey => {auditCreatedBy, clientReferenceId}; + Set get $primaryKey => + {auditCreatedBy, clientReferenceId, identifierType, identifierId}; @override IdentifierData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; @@ -18014,6 +18062,12 @@ class $StockTable extends Stock with TableInfo<$StockTable, StockData> { late final GeneratedColumn senderType = GeneratedColumn( 'sender_type', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); + static const VerificationMeta _dateOfEntryMeta = + const VerificationMeta('dateOfEntry'); + @override + late final GeneratedColumn dateOfEntry = GeneratedColumn( + 'date_of_entry', aliasedName, true, + type: DriftSqlType.int, requiredDuringInsert: false); static const VerificationMeta _auditCreatedByMeta = const VerificationMeta('auditCreatedBy'); @override @@ -18128,6 +18182,7 @@ class $StockTable extends Stock with TableInfo<$StockTable, StockData> { receiverType, senderId, senderType, + dateOfEntry, auditCreatedBy, nonRecoverableError, auditCreatedTime, @@ -18229,6 +18284,12 @@ class $StockTable extends Stock with TableInfo<$StockTable, StockData> { senderType.isAcceptableOrUnknown( data['sender_type']!, _senderTypeMeta)); } + if (data.containsKey('date_of_entry')) { + context.handle( + _dateOfEntryMeta, + dateOfEntry.isAcceptableOrUnknown( + data['date_of_entry']!, _dateOfEntryMeta)); + } if (data.containsKey('audit_created_by')) { context.handle( _auditCreatedByMeta, @@ -18357,6 +18418,8 @@ class $StockTable extends Stock with TableInfo<$StockTable, StockData> { .read(DriftSqlType.string, data['${effectivePrefix}sender_id']), senderType: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}sender_type']), + dateOfEntry: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}date_of_entry']), auditCreatedBy: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}audit_created_by']), nonRecoverableError: attachedDatabase.typeMapping.read( @@ -18411,6 +18474,7 @@ class StockData extends DataClass implements Insertable { final String? receiverType; final String? senderId; final String? senderType; + final int? dateOfEntry; final String? auditCreatedBy; final bool? nonRecoverableError; final int? auditCreatedTime; @@ -18441,6 +18505,7 @@ class StockData extends DataClass implements Insertable { this.receiverType, this.senderId, this.senderType, + this.dateOfEntry, this.auditCreatedBy, this.nonRecoverableError, this.auditCreatedTime, @@ -18501,6 +18566,9 @@ class StockData extends DataClass implements Insertable { if (!nullToAbsent || senderType != null) { map['sender_type'] = Variable(senderType); } + if (!nullToAbsent || dateOfEntry != null) { + map['date_of_entry'] = Variable(dateOfEntry); + } if (!nullToAbsent || auditCreatedBy != null) { map['audit_created_by'] = Variable(auditCreatedBy); } @@ -18589,6 +18657,9 @@ class StockData extends DataClass implements Insertable { senderType: senderType == null && nullToAbsent ? const Value.absent() : Value(senderType), + dateOfEntry: dateOfEntry == null && nullToAbsent + ? const Value.absent() + : Value(dateOfEntry), auditCreatedBy: auditCreatedBy == null && nullToAbsent ? const Value.absent() : Value(auditCreatedBy), @@ -18655,6 +18726,7 @@ class StockData extends DataClass implements Insertable { receiverType: serializer.fromJson(json['receiverType']), senderId: serializer.fromJson(json['senderId']), senderType: serializer.fromJson(json['senderType']), + dateOfEntry: serializer.fromJson(json['dateOfEntry']), auditCreatedBy: serializer.fromJson(json['auditCreatedBy']), nonRecoverableError: serializer.fromJson(json['nonRecoverableError']), @@ -18692,6 +18764,7 @@ class StockData extends DataClass implements Insertable { 'receiverType': serializer.toJson(receiverType), 'senderId': serializer.toJson(senderId), 'senderType': serializer.toJson(senderType), + 'dateOfEntry': serializer.toJson(dateOfEntry), 'auditCreatedBy': serializer.toJson(auditCreatedBy), 'nonRecoverableError': serializer.toJson(nonRecoverableError), 'auditCreatedTime': serializer.toJson(auditCreatedTime), @@ -18725,6 +18798,7 @@ class StockData extends DataClass implements Insertable { Value receiverType = const Value.absent(), Value senderId = const Value.absent(), Value senderType = const Value.absent(), + Value dateOfEntry = const Value.absent(), Value auditCreatedBy = const Value.absent(), Value nonRecoverableError = const Value.absent(), Value auditCreatedTime = const Value.absent(), @@ -18765,6 +18839,7 @@ class StockData extends DataClass implements Insertable { receiverType.present ? receiverType.value : this.receiverType, senderId: senderId.present ? senderId.value : this.senderId, senderType: senderType.present ? senderType.value : this.senderType, + dateOfEntry: dateOfEntry.present ? dateOfEntry.value : this.dateOfEntry, auditCreatedBy: auditCreatedBy.present ? auditCreatedBy.value : this.auditCreatedBy, nonRecoverableError: nonRecoverableError.present @@ -18821,6 +18896,7 @@ class StockData extends DataClass implements Insertable { ..write('receiverType: $receiverType, ') ..write('senderId: $senderId, ') ..write('senderType: $senderType, ') + ..write('dateOfEntry: $dateOfEntry, ') ..write('auditCreatedBy: $auditCreatedBy, ') ..write('nonRecoverableError: $nonRecoverableError, ') ..write('auditCreatedTime: $auditCreatedTime, ') @@ -18856,6 +18932,7 @@ class StockData extends DataClass implements Insertable { receiverType, senderId, senderType, + dateOfEntry, auditCreatedBy, nonRecoverableError, auditCreatedTime, @@ -18890,6 +18967,7 @@ class StockData extends DataClass implements Insertable { other.receiverType == this.receiverType && other.senderId == this.senderId && other.senderType == this.senderType && + other.dateOfEntry == this.dateOfEntry && other.auditCreatedBy == this.auditCreatedBy && other.nonRecoverableError == this.nonRecoverableError && other.auditCreatedTime == this.auditCreatedTime && @@ -18922,6 +19000,7 @@ class StockCompanion extends UpdateCompanion { final Value receiverType; final Value senderId; final Value senderType; + final Value dateOfEntry; final Value auditCreatedBy; final Value nonRecoverableError; final Value auditCreatedTime; @@ -18953,6 +19032,7 @@ class StockCompanion extends UpdateCompanion { this.receiverType = const Value.absent(), this.senderId = const Value.absent(), this.senderType = const Value.absent(), + this.dateOfEntry = const Value.absent(), this.auditCreatedBy = const Value.absent(), this.nonRecoverableError = const Value.absent(), this.auditCreatedTime = const Value.absent(), @@ -18985,6 +19065,7 @@ class StockCompanion extends UpdateCompanion { this.receiverType = const Value.absent(), this.senderId = const Value.absent(), this.senderType = const Value.absent(), + this.dateOfEntry = const Value.absent(), this.auditCreatedBy = const Value.absent(), this.nonRecoverableError = const Value.absent(), this.auditCreatedTime = const Value.absent(), @@ -19017,6 +19098,7 @@ class StockCompanion extends UpdateCompanion { Expression? receiverType, Expression? senderId, Expression? senderType, + Expression? dateOfEntry, Expression? auditCreatedBy, Expression? nonRecoverableError, Expression? auditCreatedTime, @@ -19051,6 +19133,7 @@ class StockCompanion extends UpdateCompanion { if (receiverType != null) 'receiver_type': receiverType, if (senderId != null) 'sender_id': senderId, if (senderType != null) 'sender_type': senderType, + if (dateOfEntry != null) 'date_of_entry': dateOfEntry, if (auditCreatedBy != null) 'audit_created_by': auditCreatedBy, if (nonRecoverableError != null) 'non_recoverable_error': nonRecoverableError, @@ -19087,6 +19170,7 @@ class StockCompanion extends UpdateCompanion { Value? receiverType, Value? senderId, Value? senderType, + Value? dateOfEntry, Value? auditCreatedBy, Value? nonRecoverableError, Value? auditCreatedTime, @@ -19118,6 +19202,7 @@ class StockCompanion extends UpdateCompanion { receiverType: receiverType ?? this.receiverType, senderId: senderId ?? this.senderId, senderType: senderType ?? this.senderType, + dateOfEntry: dateOfEntry ?? this.dateOfEntry, auditCreatedBy: auditCreatedBy ?? this.auditCreatedBy, nonRecoverableError: nonRecoverableError ?? this.nonRecoverableError, auditCreatedTime: auditCreatedTime ?? this.auditCreatedTime, @@ -19183,6 +19268,9 @@ class StockCompanion extends UpdateCompanion { if (senderType.present) { map['sender_type'] = Variable(senderType.value); } + if (dateOfEntry.present) { + map['date_of_entry'] = Variable(dateOfEntry.value); + } if (auditCreatedBy.present) { map['audit_created_by'] = Variable(auditCreatedBy.value); } @@ -19251,6 +19339,7 @@ class StockCompanion extends UpdateCompanion { ..write('receiverType: $receiverType, ') ..write('senderId: $senderId, ') ..write('senderType: $senderType, ') + ..write('dateOfEntry: $dateOfEntry, ') ..write('auditCreatedBy: $auditCreatedBy, ') ..write('nonRecoverableError: $nonRecoverableError, ') ..write('auditCreatedTime: $auditCreatedTime, ') @@ -20489,12 +20578,9 @@ class $TargetTable extends Target with TableInfo<$TargetTable, TargetData> { static const VerificationMeta _beneficiaryTypeMeta = const VerificationMeta('beneficiaryType'); @override - late final GeneratedColumnWithTypeConverter - beneficiaryType = GeneratedColumn( - 'beneficiary_type', aliasedName, true, - type: DriftSqlType.int, requiredDuringInsert: false) - .withConverter( - $TargetTable.$converterbeneficiaryTypen); + late final GeneratedColumn beneficiaryType = GeneratedColumn( + 'beneficiary_type', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _additionalFieldsMeta = const VerificationMeta('additionalFields'); @override @@ -20619,7 +20705,12 @@ class $TargetTable extends Target with TableInfo<$TargetTable, TargetData> { rowVersion.isAcceptableOrUnknown( data['row_version']!, _rowVersionMeta)); } - context.handle(_beneficiaryTypeMeta, const VerificationResult.success()); + if (data.containsKey('beneficiary_type')) { + context.handle( + _beneficiaryTypeMeta, + beneficiaryType.isAcceptableOrUnknown( + data['beneficiary_type']!, _beneficiaryTypeMeta)); + } if (data.containsKey('additional_fields')) { context.handle( _additionalFieldsMeta, @@ -20667,9 +20758,8 @@ class $TargetTable extends Target with TableInfo<$TargetTable, TargetData> { .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted']), rowVersion: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}row_version']), - beneficiaryType: $TargetTable.$converterbeneficiaryTypen.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.int, data['${effectivePrefix}beneficiary_type'])), + beneficiaryType: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}beneficiary_type']), additionalFields: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}additional_fields']), ); @@ -20679,13 +20769,6 @@ class $TargetTable extends Target with TableInfo<$TargetTable, TargetData> { $TargetTable createAlias(String alias) { return $TargetTable(attachedDatabase, alias); } - - static JsonTypeConverter2 - $converterbeneficiaryType = - const EnumIndexConverter(BeneficiaryType.values); - static JsonTypeConverter2 - $converterbeneficiaryTypen = - JsonTypeConverter2.asNullable($converterbeneficiaryType); } class TargetData extends DataClass implements Insertable { @@ -20705,7 +20788,7 @@ class TargetData extends DataClass implements Insertable { final String? tenantId; final bool? isDeleted; final int? rowVersion; - final BeneficiaryType? beneficiaryType; + final String? beneficiaryType; final String? additionalFields; const TargetData( {required this.id, @@ -20776,8 +20859,7 @@ class TargetData extends DataClass implements Insertable { map['row_version'] = Variable(rowVersion); } if (!nullToAbsent || beneficiaryType != null) { - map['beneficiary_type'] = Variable( - $TargetTable.$converterbeneficiaryTypen.toSql(beneficiaryType)); + map['beneficiary_type'] = Variable(beneficiaryType); } if (!nullToAbsent || additionalFields != null) { map['additional_fields'] = Variable(additionalFields); @@ -20864,8 +20946,7 @@ class TargetData extends DataClass implements Insertable { tenantId: serializer.fromJson(json['tenantId']), isDeleted: serializer.fromJson(json['isDeleted']), rowVersion: serializer.fromJson(json['rowVersion']), - beneficiaryType: $TargetTable.$converterbeneficiaryTypen - .fromJson(serializer.fromJson(json['beneficiaryType'])), + beneficiaryType: serializer.fromJson(json['beneficiaryType']), additionalFields: serializer.fromJson(json['additionalFields']), ); } @@ -20889,8 +20970,7 @@ class TargetData extends DataClass implements Insertable { 'tenantId': serializer.toJson(tenantId), 'isDeleted': serializer.toJson(isDeleted), 'rowVersion': serializer.toJson(rowVersion), - 'beneficiaryType': serializer.toJson( - $TargetTable.$converterbeneficiaryTypen.toJson(beneficiaryType)), + 'beneficiaryType': serializer.toJson(beneficiaryType), 'additionalFields': serializer.toJson(additionalFields), }; } @@ -20912,7 +20992,7 @@ class TargetData extends DataClass implements Insertable { Value tenantId = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), - Value beneficiaryType = const Value.absent(), + Value beneficiaryType = const Value.absent(), Value additionalFields = const Value.absent()}) => TargetData( id: id ?? this.id, @@ -21043,7 +21123,7 @@ class TargetCompanion extends UpdateCompanion { final Value tenantId; final Value isDeleted; final Value rowVersion; - final Value beneficiaryType; + final Value beneficiaryType; final Value additionalFields; final Value rowid; const TargetCompanion({ @@ -21105,7 +21185,7 @@ class TargetCompanion extends UpdateCompanion { Expression? tenantId, Expression? isDeleted, Expression? rowVersion, - Expression? beneficiaryType, + Expression? beneficiaryType, Expression? additionalFields, Expression? rowid, }) { @@ -21151,7 +21231,7 @@ class TargetCompanion extends UpdateCompanion { Value? tenantId, Value? isDeleted, Value? rowVersion, - Value? beneficiaryType, + Value? beneficiaryType, Value? additionalFields, Value? rowid}) { return TargetCompanion( @@ -21229,8 +21309,7 @@ class TargetCompanion extends UpdateCompanion { map['row_version'] = Variable(rowVersion.value); } if (beneficiaryType.present) { - map['beneficiary_type'] = Variable( - $TargetTable.$converterbeneficiaryTypen.toSql(beneficiaryType.value)); + map['beneficiary_type'] = Variable(beneficiaryType.value); } if (additionalFields.present) { map['additional_fields'] = Variable(additionalFields.value); @@ -25182,6 +25261,12 @@ class $AttributesTable extends Attributes late final GeneratedColumn rowVersion = GeneratedColumn( 'row_version', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); + static const VerificationMeta _additionalDetailsMeta = + const VerificationMeta('additionalDetails'); + @override + late final GeneratedColumn additionalDetails = + GeneratedColumn('additional_details', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _additionalFieldsMeta = const VerificationMeta('additionalFields'); @override @@ -25211,6 +25296,7 @@ class $AttributesTable extends Attributes auditModifiedTime, isDeleted, rowVersion, + additionalDetails, additionalFields ]; @override @@ -25328,6 +25414,12 @@ class $AttributesTable extends Attributes rowVersion.isAcceptableOrUnknown( data['row_version']!, _rowVersionMeta)); } + if (data.containsKey('additional_details')) { + context.handle( + _additionalDetailsMeta, + additionalDetails.isAcceptableOrUnknown( + data['additional_details']!, _additionalDetailsMeta)); + } if (data.containsKey('additional_fields')) { context.handle( _additionalFieldsMeta, @@ -25385,6 +25477,8 @@ class $AttributesTable extends Attributes .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted']), rowVersion: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}row_version']), + additionalDetails: attachedDatabase.typeMapping.read( + DriftSqlType.string, data['${effectivePrefix}additional_details']), additionalFields: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}additional_fields']), ); @@ -25418,6 +25512,7 @@ class Attribute extends DataClass implements Insertable { final int? auditModifiedTime; final bool? isDeleted; final int? rowVersion; + final String? additionalDetails; final String? additionalFields; const Attribute( {this.id, @@ -25441,6 +25536,7 @@ class Attribute extends DataClass implements Insertable { this.auditModifiedTime, this.isDeleted, this.rowVersion, + this.additionalDetails, this.additionalFields}); @override Map toColumns(bool nullToAbsent) { @@ -25508,6 +25604,9 @@ class Attribute extends DataClass implements Insertable { if (!nullToAbsent || rowVersion != null) { map['row_version'] = Variable(rowVersion); } + if (!nullToAbsent || additionalDetails != null) { + map['additional_details'] = Variable(additionalDetails); + } if (!nullToAbsent || additionalFields != null) { map['additional_fields'] = Variable(additionalFields); } @@ -25572,6 +25671,9 @@ class Attribute extends DataClass implements Insertable { rowVersion: rowVersion == null && nullToAbsent ? const Value.absent() : Value(rowVersion), + additionalDetails: additionalDetails == null && nullToAbsent + ? const Value.absent() + : Value(additionalDetails), additionalFields: additionalFields == null && nullToAbsent ? const Value.absent() : Value(additionalFields), @@ -25604,6 +25706,8 @@ class Attribute extends DataClass implements Insertable { auditModifiedTime: serializer.fromJson(json['auditModifiedTime']), isDeleted: serializer.fromJson(json['isDeleted']), rowVersion: serializer.fromJson(json['rowVersion']), + additionalDetails: + serializer.fromJson(json['additionalDetails']), additionalFields: serializer.fromJson(json['additionalFields']), ); } @@ -25632,6 +25736,7 @@ class Attribute extends DataClass implements Insertable { 'auditModifiedTime': serializer.toJson(auditModifiedTime), 'isDeleted': serializer.toJson(isDeleted), 'rowVersion': serializer.toJson(rowVersion), + 'additionalDetails': serializer.toJson(additionalDetails), 'additionalFields': serializer.toJson(additionalFields), }; } @@ -25658,6 +25763,7 @@ class Attribute extends DataClass implements Insertable { Value auditModifiedTime = const Value.absent(), Value isDeleted = const Value.absent(), Value rowVersion = const Value.absent(), + Value additionalDetails = const Value.absent(), Value additionalFields = const Value.absent()}) => Attribute( id: id.present ? id.value : this.id, @@ -25698,6 +25804,9 @@ class Attribute extends DataClass implements Insertable { : this.auditModifiedTime, isDeleted: isDeleted.present ? isDeleted.value : this.isDeleted, rowVersion: rowVersion.present ? rowVersion.value : this.rowVersion, + additionalDetails: additionalDetails.present + ? additionalDetails.value + : this.additionalDetails, additionalFields: additionalFields.present ? additionalFields.value : this.additionalFields, @@ -25726,6 +25835,7 @@ class Attribute extends DataClass implements Insertable { ..write('auditModifiedTime: $auditModifiedTime, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') + ..write('additionalDetails: $additionalDetails, ') ..write('additionalFields: $additionalFields') ..write(')')) .toString(); @@ -25754,6 +25864,7 @@ class Attribute extends DataClass implements Insertable { auditModifiedTime, isDeleted, rowVersion, + additionalDetails, additionalFields ]); @override @@ -25781,6 +25892,7 @@ class Attribute extends DataClass implements Insertable { other.auditModifiedTime == this.auditModifiedTime && other.isDeleted == this.isDeleted && other.rowVersion == this.rowVersion && + other.additionalDetails == this.additionalDetails && other.additionalFields == this.additionalFields); } @@ -25806,6 +25918,7 @@ class AttributesCompanion extends UpdateCompanion { final Value auditModifiedTime; final Value isDeleted; final Value rowVersion; + final Value additionalDetails; final Value additionalFields; final Value rowid; const AttributesCompanion({ @@ -25830,6 +25943,7 @@ class AttributesCompanion extends UpdateCompanion { this.auditModifiedTime = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), + this.additionalDetails = const Value.absent(), this.additionalFields = const Value.absent(), this.rowid = const Value.absent(), }); @@ -25855,6 +25969,7 @@ class AttributesCompanion extends UpdateCompanion { this.auditModifiedTime = const Value.absent(), this.isDeleted = const Value.absent(), this.rowVersion = const Value.absent(), + this.additionalDetails = const Value.absent(), this.additionalFields = const Value.absent(), this.rowid = const Value.absent(), }); @@ -25880,6 +25995,7 @@ class AttributesCompanion extends UpdateCompanion { Expression? auditModifiedTime, Expression? isDeleted, Expression? rowVersion, + Expression? additionalDetails, Expression? additionalFields, Expression? rowid, }) { @@ -25907,6 +26023,7 @@ class AttributesCompanion extends UpdateCompanion { if (auditModifiedTime != null) 'audit_modified_time': auditModifiedTime, if (isDeleted != null) 'is_deleted': isDeleted, if (rowVersion != null) 'row_version': rowVersion, + if (additionalDetails != null) 'additional_details': additionalDetails, if (additionalFields != null) 'additional_fields': additionalFields, if (rowid != null) 'rowid': rowid, }); @@ -25934,6 +26051,7 @@ class AttributesCompanion extends UpdateCompanion { Value? auditModifiedTime, Value? isDeleted, Value? rowVersion, + Value? additionalDetails, Value? additionalFields, Value? rowid}) { return AttributesCompanion( @@ -25958,6 +26076,7 @@ class AttributesCompanion extends UpdateCompanion { auditModifiedTime: auditModifiedTime ?? this.auditModifiedTime, isDeleted: isDeleted ?? this.isDeleted, rowVersion: rowVersion ?? this.rowVersion, + additionalDetails: additionalDetails ?? this.additionalDetails, additionalFields: additionalFields ?? this.additionalFields, rowid: rowid ?? this.rowid, ); @@ -26029,6 +26148,9 @@ class AttributesCompanion extends UpdateCompanion { if (rowVersion.present) { map['row_version'] = Variable(rowVersion.value); } + if (additionalDetails.present) { + map['additional_details'] = Variable(additionalDetails.value); + } if (additionalFields.present) { map['additional_fields'] = Variable(additionalFields.value); } @@ -26062,6 +26184,7 @@ class AttributesCompanion extends UpdateCompanion { ..write('auditModifiedTime: $auditModifiedTime, ') ..write('isDeleted: $isDeleted, ') ..write('rowVersion: $rowVersion, ') + ..write('additionalDetails: $additionalDetails, ') ..write('additionalFields: $additionalFields, ') ..write('rowid: $rowid') ..write(')')) diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/attributes.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/attributes.dart index 1958e5014..c28a212ee 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/attributes.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/attributes.dart @@ -2,7 +2,6 @@ import 'package:drift/drift.dart'; - class Attributes extends Table { TextColumn get id => text().nullable()(); TextColumn get dataType => text().nullable()(); @@ -15,7 +14,8 @@ class Attributes extends Table { TextColumn get regex => text().nullable()(); IntColumn get order => integer().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()(); @@ -23,11 +23,15 @@ class Attributes extends Table { IntColumn get clientModifiedTime => integer().nullable()(); TextColumn get auditModifiedBy => text().nullable()(); IntColumn get auditModifiedTime => integer().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 additionalDetails => text().nullable()(); TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { id, auditCreatedBy, }; -} \ No newline at end of file + Set get primaryKey => { + id, + auditCreatedBy, + }; +} diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/facility.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/facility.dart index f01360c6b..855e862d7 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/facility.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/facility.dart @@ -16,6 +16,7 @@ class Facility extends Table { TextColumn get auditModifiedBy => text().nullable()(); IntColumn get auditModifiedTime => integer().nullable()(); TextColumn get tenantId => text().nullable()(); + TextColumn get name => text().nullable()(); BoolColumn get isDeleted => boolean().nullable().withDefault(const Constant(false))(); IntColumn get rowVersion => integer().nullable()(); diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/identifier.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/identifier.dart index 9ac344fbc..ab4dead10 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/identifier.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/identifier.dart @@ -2,13 +2,13 @@ import 'package:drift/drift.dart'; - class Identifier extends Table { TextColumn get id => text().nullable()(); TextColumn get identifierType => text().nullable()(); TextColumn get identifierId => 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()(); @@ -18,11 +18,13 @@ class Identifier 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()(); - + TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { auditCreatedBy, clientReferenceId, }; -} \ No newline at end of file + Set get primaryKey => + {auditCreatedBy, clientReferenceId, identifierType, identifierId}; +} diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/stock.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/stock.dart index f40613c14..9630d57a0 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/stock.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/package_tables/stock.dart @@ -20,6 +20,7 @@ class Stock extends Table { TextColumn get receiverType => text().nullable()(); TextColumn get senderId => text().nullable()(); TextColumn get senderType => text().nullable()(); + IntColumn get dateOfEntry => integer().nullable()(); TextColumn get auditCreatedBy => text().nullable()(); BoolColumn get nonRecoverableError => boolean().nullable().withDefault(const Constant(false))(); diff --git a/packages/digit_data_model/lib/data/local_store/sql_store/tables/project_type.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/project_type.dart index a882e39f6..de3cb2bdd 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/project_type.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/project_type.dart @@ -2,17 +2,19 @@ import 'package:drift/drift.dart'; +import '../../../../models/entities/beneficiary_type.dart'; class ProjectType extends Table { TextColumn get id => text().nullable()(); TextColumn get name => text().nullable()(); TextColumn get code => text().nullable()(); TextColumn get group => text().nullable()(); - TextColumn get beneficiaryType => text().nullable()(); + IntColumn get beneficiaryType => intEnum().nullable()(); TextColumn get eligibilityCriteria => text().nullable()(); TextColumn get taskProcedure => 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()(); @@ -22,11 +24,15 @@ class ProjectType 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()(); - + 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/local_store/sql_store/tables/target.dart b/packages/digit_data_model/lib/data/local_store/sql_store/tables/target.dart index 14e093862..09140859b 100644 --- a/packages/digit_data_model/lib/data/local_store/sql_store/tables/target.dart +++ b/packages/digit_data_model/lib/data/local_store/sql_store/tables/target.dart @@ -2,15 +2,14 @@ import 'package:drift/drift.dart'; -import '../../../../models/entities/beneficiary_type.dart'; - class Target extends Table { TextColumn get id => text()(); TextColumn get clientReferenceId => text().nullable()(); RealColumn get totalNo => real().nullable()(); RealColumn get targetNo => 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,12 +18,16 @@ class Target 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()(); - IntColumn get beneficiaryType => intEnum().nullable()(); - + TextColumn get beneficiaryType => text().nullable()(); + TextColumn get additionalFields => text().nullable()(); @override - Set get primaryKey => { id, auditCreatedBy, }; -} \ No newline at end of file + Set get primaryKey => { + id, + auditCreatedBy, + }; +} diff --git a/packages/digit_data_model/lib/data/repositories/local/facility.dart b/packages/digit_data_model/lib/data/repositories/local/facility.dart index faf3a42f3..b7874e161 100644 --- a/packages/digit_data_model/lib/data/repositories/local/facility.dart +++ b/packages/digit_data_model/lib/data/repositories/local/facility.dart @@ -54,6 +54,7 @@ class FacilityLocalRepository isPermanent: facility.isPermanent, storageCapacity: facility.storageCapacity, usage: facility.usage, + name: facility.name, address: address == null ? null : AddressModel( diff --git a/packages/digit_data_model/lib/data/repositories/oplog/oplog.dart b/packages/digit_data_model/lib/data/repositories/oplog/oplog.dart index 3d4349c8e..ac76272c5 100644 --- a/packages/digit_data_model/lib/data/repositories/oplog/oplog.dart +++ b/packages/digit_data_model/lib/data/repositories/oplog/oplog.dart @@ -72,7 +72,7 @@ abstract class OpLogManager { .syncedDownEqualTo(false) .nonRecoverableErrorEqualTo(false) .syncDownRetryCountGreaterThan( - 5 - 1, + DigitDataModelSingleton().syncDownRetryCount - 1, ) .createdByEqualTo(createdBy) .findAllSync(); @@ -112,7 +112,8 @@ abstract class OpLogManager { var oplogs = isar.opLogs .filter() .syncedUpEqualTo(true) - .syncDownRetryCountLessThan(5) + .syncDownRetryCountLessThan( + DigitDataModelSingleton().syncDownRetryCount) .syncedDownEqualTo(false) .entityTypeEqualTo(type) .findAllSync(); @@ -298,7 +299,8 @@ abstract class OpLogManager { OpLogEntry updatedEntry = entry.copyWith( syncDownRetryCount: syncDownRetryCount + 1, ); - if (updatedEntry.syncDownRetryCount >= 5) { + if (updatedEntry.syncDownRetryCount >= + DigitDataModelSingleton().syncDownRetryCount) { markAsNonRecoverable = true; updatedEntry = updatedEntry.copyWith(nonRecoverableError: true); } @@ -314,7 +316,8 @@ abstract class OpLogManager { await Future.delayed(const Duration(seconds: 1)); } else { await Future.delayed(Duration( - seconds: 5 * oplogs.first.syncDownRetryCount, + seconds: DigitDataModelSingleton().retryTimeInterval * + oplogs.first.syncDownRetryCount, )); } diff --git a/packages/digit_data_model/lib/data_model.dart b/packages/digit_data_model/lib/data_model.dart index 15e7ae7be..939c796aa 100644 --- a/packages/digit_data_model/lib/data_model.dart +++ b/packages/digit_data_model/lib/data_model.dart @@ -9,17 +9,18 @@ library data_model; // Import statements for various packages and files used in this file. import 'package:dart_mappable/dart_mappable.dart'; + import 'data_model.dart'; +export 'blocs/boundary/boundary.dart'; // Export statements for various files that are part of the data model. export 'blocs/facility/facility.dart'; export 'blocs/product_variant/product_variant.dart'; export 'blocs/project_facility/project_facility.dart'; -export 'blocs/user/user.dart'; -export 'blocs/boundary/boundary.dart'; export 'blocs/service/service.dart'; export 'blocs/service_definition/service_definition.dart'; +export 'blocs/user/user.dart'; export 'data/data_repository.dart'; export 'data/local_store/no_sql/schema/oplog.dart' hide AdditionalId; export 'data/local_store/sql_store/sql_store.dart'; @@ -75,6 +76,7 @@ export 'models/entities/document.dart'; export 'models/entities/facility.dart'; export 'models/entities/gender.dart'; export 'models/entities/identifier.dart'; +export 'models/entities/identifier_types.dart'; export 'models/entities/individual.dart'; export 'models/entities/locality.dart'; export 'models/entities/name.dart'; diff --git a/packages/digit_data_model/lib/data_model.init.dart b/packages/digit_data_model/lib/data_model.init.dart index 3abdaf1ed..6f8cd5ed5 100644 --- a/packages/digit_data_model/lib/data_model.init.dart +++ b/packages/digit_data_model/lib/data_model.init.dart @@ -14,26 +14,27 @@ 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/product.dart' as p14; -import 'models/entities/product_variant.dart' as p15; -import 'models/entities/project.dart' as p16; -import 'models/entities/project_facility.dart' as p17; -import 'models/entities/project_product_variant.dart' as p18; -import 'models/entities/project_resource.dart' as p19; -import 'models/entities/project_staff.dart' as p20; -import 'models/entities/project_type.dart' as p21; -import 'models/entities/service.dart' as p22; -import 'models/entities/service_attributes.dart' as p23; -import 'models/entities/service_definition.dart' as p24; -import 'models/entities/target.dart' as p25; -import 'models/entities/user.dart' as p26; -import 'models/oplog/oplog_entry.dart' as p27; -import 'models/pgr_complaints/pgr_address.dart' as p28; -import 'models/pgr_complaints/pgr_complaints.dart' as p29; -import 'models/pgr_complaints/pgr_complaints_response.dart' as p30; +import 'models/entities/identifier_types.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/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/service.dart' as p23; +import 'models/entities/service_attributes.dart' as p24; +import 'models/entities/service_definition.dart' as p25; +import 'models/entities/target.dart' as p26; +import 'models/entities/user.dart' as p27; +import 'models/oplog/oplog_entry.dart' as p28; +import 'models/pgr_complaints/pgr_address.dart' as p29; +import 'models/pgr_complaints/pgr_complaints.dart' as p30; +import 'models/pgr_complaints/pgr_complaints_response.dart' as p31; void initializeMappers() { p0.EntityModelMapper.ensureInitialized(); @@ -63,76 +64,77 @@ void initializeMappers() { 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.ProductSearchModelMapper.ensureInitialized(); - p14.ProductModelMapper.ensureInitialized(); - p14.ProductAdditionalFieldsMapper.ensureInitialized(); - p15.ProductVariantSearchModelMapper.ensureInitialized(); - p15.ProductVariantModelMapper.ensureInitialized(); - p15.ProductVariantAdditionalFieldsMapper.ensureInitialized(); - p16.ProjectSearchModelMapper.ensureInitialized(); - p16.ProjectModelMapper.ensureInitialized(); - p16.ProjectAdditionalFieldsMapper.ensureInitialized(); - p16.ProjectAdditionalDetailsMapper.ensureInitialized(); - p17.ProjectFacilitySearchModelMapper.ensureInitialized(); - p17.ProjectFacilityModelMapper.ensureInitialized(); - p17.ProjectFacilityAdditionalFieldsMapper.ensureInitialized(); - p18.ProjectProductVariantSearchModelMapper.ensureInitialized(); - p18.ProjectProductVariantModelMapper.ensureInitialized(); - p18.ProjectProductVariantAdditionalFieldsMapper.ensureInitialized(); - p19.ProjectResourceSearchModelMapper.ensureInitialized(); - p19.ProjectResourceModelMapper.ensureInitialized(); - p19.ProjectResourceAdditionalFieldsMapper.ensureInitialized(); - p20.ProjectStaffSearchModelMapper.ensureInitialized(); - p20.ProjectStaffModelMapper.ensureInitialized(); - p20.ProjectStaffAdditionalFieldsMapper.ensureInitialized(); - p21.ProjectTypeModelMapper.ensureInitialized(); - p21.ProjectTypeAdditionalFieldsMapper.ensureInitialized(); - p21.ProjectCycleMapper.ensureInitialized(); - p21.ProjectCycleDeliveryMapper.ensureInitialized(); - p21.DeliveryDoseCriteriaMapper.ensureInitialized(); - p21.DeliveryProductVariantMapper.ensureInitialized(); - p22.ServiceSearchModelMapper.ensureInitialized(); - p22.ServiceModelMapper.ensureInitialized(); - p22.ServiceAdditionalFieldsMapper.ensureInitialized(); - p23.ServiceAttributesSearchModelMapper.ensureInitialized(); - p23.ServiceAttributesModelMapper.ensureInitialized(); - p23.ServiceAttributesAdditionalFieldsMapper.ensureInitialized(); - p24.ServiceDefinitionSearchModelMapper.ensureInitialized(); - p24.ServiceDefinitionModelMapper.ensureInitialized(); - p24.ServiceDefinitionAdditionalFieldsMapper.ensureInitialized(); - p25.TargetSearchModelMapper.ensureInitialized(); - p25.TargetModelMapper.ensureInitialized(); - p25.TargetAdditionalFieldsMapper.ensureInitialized(); - p26.UserSearchModelMapper.ensureInitialized(); - p26.UserModelMapper.ensureInitialized(); - p26.UserAdditionalFieldsMapper.ensureInitialized(); - p27.OpLogEntryMapper.ensureInitialized(); - p27.AdditionalIdMapper.ensureInitialized(); - p27.DataOperationMapper.ensureInitialized(); - p27.ApiOperationMapper.ensureInitialized(); - p28.PgrAddressModelMapper.ensureInitialized(); - p28.GeoLocationMapper.ensureInitialized(); - p29.PgrComplaintModelMapper.ensureInitialized(); - p29.PgrComplainantModelMapper.ensureInitialized(); - p29.PgrRolesModelMapper.ensureInitialized(); - p29.PgrServiceSearchModelMapper.ensureInitialized(); - p29.PgrServiceModelMapper.ensureInitialized(); - p29.PgrWorkflowModelMapper.ensureInitialized(); - p29.PgrFiltersMapper.ensureInitialized(); - p29.PgrSearchKeysMapper.ensureInitialized(); - p29.PgrAdditionalDetailsMapper.ensureInitialized(); - p29.PgrServiceApplicationStatusMapper.ensureInitialized(); - p30.PgrServiceCreateResponseModelMapper.ensureInitialized(); - p30.PgrComplaintResponseModelMapper.ensureInitialized(); - p30.PgrComplainantResponseModelMapper.ensureInitialized(); - p30.PgrServiceResponseModelMapper.ensureInitialized(); + p11.IdentifierTypesMapper.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.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.ServiceSearchModelMapper.ensureInitialized(); + p23.ServiceModelMapper.ensureInitialized(); + p23.ServiceAdditionalFieldsMapper.ensureInitialized(); + p24.ServiceAttributesSearchModelMapper.ensureInitialized(); + p24.ServiceAttributesModelMapper.ensureInitialized(); + p24.ServiceAttributesAdditionalFieldsMapper.ensureInitialized(); + p25.ServiceDefinitionSearchModelMapper.ensureInitialized(); + p25.ServiceDefinitionModelMapper.ensureInitialized(); + p25.ServiceDefinitionAdditionalFieldsMapper.ensureInitialized(); + p26.TargetSearchModelMapper.ensureInitialized(); + p26.TargetModelMapper.ensureInitialized(); + p26.TargetAdditionalFieldsMapper.ensureInitialized(); + p27.UserSearchModelMapper.ensureInitialized(); + p27.UserModelMapper.ensureInitialized(); + p27.UserAdditionalFieldsMapper.ensureInitialized(); + p28.OpLogEntryMapper.ensureInitialized(); + p28.AdditionalIdMapper.ensureInitialized(); + p28.DataOperationMapper.ensureInitialized(); + p28.ApiOperationMapper.ensureInitialized(); + p29.PgrAddressModelMapper.ensureInitialized(); + p29.GeoLocationMapper.ensureInitialized(); + p30.PgrComplaintModelMapper.ensureInitialized(); + p30.PgrComplainantModelMapper.ensureInitialized(); + p30.PgrRolesModelMapper.ensureInitialized(); + p30.PgrServiceSearchModelMapper.ensureInitialized(); + p30.PgrServiceModelMapper.ensureInitialized(); + p30.PgrWorkflowModelMapper.ensureInitialized(); + p30.PgrFiltersMapper.ensureInitialized(); + p30.PgrSearchKeysMapper.ensureInitialized(); + p30.PgrAdditionalDetailsMapper.ensureInitialized(); + p30.PgrServiceApplicationStatusMapper.ensureInitialized(); + p31.PgrServiceCreateResponseModelMapper.ensureInitialized(); + p31.PgrComplaintResponseModelMapper.ensureInitialized(); + p31.PgrComplainantResponseModelMapper.ensureInitialized(); + p31.PgrServiceResponseModelMapper.ensureInitialized(); } diff --git a/packages/digit_data_model/lib/models/entities/attributes.dart b/packages/digit_data_model/lib/models/entities/attributes.dart index 9bbf3b6d4..a96c55150 100644 --- a/packages/digit_data_model/lib/models/entities/attributes.dart +++ b/packages/digit_data_model/lib/models/entities/attributes.dart @@ -1,15 +1,15 @@ // Generated using mason. Do not modify by hand -import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; +import 'dart:convert'; +import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; - -import '../../data/local_store/sql_store/sql_store.dart'; +import 'package:drift/drift.dart'; part 'attributes.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class AttributesSearchModel extends EntitySearchModel with AttributesSearchModelMappable { +class AttributesSearchModel extends EntitySearchModel + with AttributesSearchModelMappable { final String? id; final String? dataType; final String? referenceId; @@ -19,7 +19,7 @@ class AttributesSearchModel extends EntitySearchModel with AttributesSearchModel final bool? required; final String? regex; final int? order; - + AttributesSearchModel({ this.id, this.dataType, @@ -32,7 +32,7 @@ class AttributesSearchModel extends EntitySearchModel with AttributesSearchModel this.order, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() AttributesSearchModel.ignoreDeleted({ @@ -46,12 +46,11 @@ class AttributesSearchModel extends EntitySearchModel with AttributesSearchModel this.regex, this.order, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class AttributesModel extends EntityModel with AttributesModelMappable { - static const schemaName = 'Attributes'; final String? id; @@ -67,8 +66,10 @@ class AttributesModel extends EntityModel with AttributesModelMappable { final bool? nonRecoverableError; final int? rowVersion; final AttributesAdditionalFields? additionalFields; + final Map? additionalDetails; AttributesModel({ + this.additionalDetails, this.additionalFields, this.id, this.dataType, @@ -82,9 +83,10 @@ class AttributesModel extends EntityModel with AttributesModelMappable { this.order, this.nonRecoverableError = false, this.rowVersion, - super.auditDetails,super.clientAuditDetails, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); AttributesCompanion get companion { return AttributesCompanion( @@ -109,17 +111,18 @@ class AttributesModel extends EntityModel with AttributesModelMappable { regex: Value(regex), order: Value(order), nonRecoverableError: Value(nonRecoverableError), + additionalDetails: Value(jsonEncode(additionalDetails)), rowVersion: Value(rowVersion), - ); + ); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class AttributesAdditionalFields extends AdditionalFields with AttributesAdditionalFieldsMappable { +class AttributesAdditionalFields extends AdditionalFields + with AttributesAdditionalFieldsMappable { AttributesAdditionalFields({ super.schema = 'Attributes', required super.version, super.fields, }); } - diff --git a/packages/digit_data_model/lib/models/entities/attributes.mapper.dart b/packages/digit_data_model/lib/models/entities/attributes.mapper.dart index 48d5f0b92..2b9f5e138 100644 --- a/packages/digit_data_model/lib/models/entities/attributes.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/attributes.mapper.dart @@ -242,6 +242,11 @@ class AttributesModelMapper extends SubClassMapperBase { @override final String id = 'AttributesModel'; + static Map? _$additionalDetails(AttributesModel v) => + v.additionalDetails; + static const Field> + _f$additionalDetails = + Field('additionalDetails', _$additionalDetails, opt: true); static AttributesAdditionalFields? _$additionalFields(AttributesModel v) => v.additionalFields; static const Field @@ -299,6 +304,7 @@ class AttributesModelMapper extends SubClassMapperBase { @override final MappableFields fields = const { + #additionalDetails: _f$additionalDetails, #additionalFields: _f$additionalFields, #id: _f$id, #dataType: _f$dataType, @@ -329,6 +335,7 @@ class AttributesModelMapper extends SubClassMapperBase { static AttributesModel _instantiate(DecodingData data) { return AttributesModel( + additionalDetails: data.dec(_f$additionalDetails), additionalFields: data.dec(_f$additionalFields), id: data.dec(_f$id), dataType: data.dec(_f$dataType), @@ -402,6 +409,8 @@ extension AttributesModelValueCopy<$R, $Out> abstract class AttributesModelCopyWith<$R, $In extends AttributesModel, $Out> implements EntityModelCopyWith<$R, $In, $Out> { + MapCopyWith<$R, String, dynamic, ObjectCopyWith<$R, dynamic, dynamic>>? + get additionalDetails; AttributesAdditionalFieldsCopyWith<$R, AttributesAdditionalFields, AttributesAdditionalFields>? get additionalFields; ListCopyWith<$R, String, ObjectCopyWith<$R, String, String>>? get values; @@ -412,7 +421,8 @@ abstract class AttributesModelCopyWith<$R, $In extends AttributesModel, $Out> get clientAuditDetails; @override $R call( - {AttributesAdditionalFields? additionalFields, + {Map? additionalDetails, + AttributesAdditionalFields? additionalFields, String? id, String? dataType, String? referenceId, @@ -441,6 +451,14 @@ class _AttributesModelCopyWithImpl<$R, $Out> late final ClassMapperBase $mapper = AttributesModelMapper.ensureInitialized(); @override + MapCopyWith<$R, String, dynamic, ObjectCopyWith<$R, dynamic, dynamic>>? + get additionalDetails => $value.additionalDetails != null + ? MapCopyWith( + $value.additionalDetails!, + (v, t) => ObjectCopyWith(v, $identity, t), + (v) => call(additionalDetails: v)) + : null; + @override AttributesAdditionalFieldsCopyWith<$R, AttributesAdditionalFields, AttributesAdditionalFields>? get additionalFields => $value.additionalFields?.copyWith @@ -460,7 +478,8 @@ class _AttributesModelCopyWithImpl<$R, $Out> .$chain((v) => call(clientAuditDetails: v)); @override $R call( - {Object? additionalFields = $none, + {Object? additionalDetails = $none, + Object? additionalFields = $none, Object? id = $none, Object? dataType = $none, Object? referenceId = $none, @@ -477,6 +496,7 @@ class _AttributesModelCopyWithImpl<$R, $Out> Object? clientAuditDetails = $none, Object? isDeleted = $none}) => $apply(FieldCopyWithData({ + if (additionalDetails != $none) #additionalDetails: additionalDetails, if (additionalFields != $none) #additionalFields: additionalFields, if (id != $none) #id: id, if (dataType != $none) #dataType: dataType, @@ -498,6 +518,8 @@ class _AttributesModelCopyWithImpl<$R, $Out> })); @override AttributesModel $make(CopyWithData data) => AttributesModel( + additionalDetails: + data.get(#additionalDetails, or: $value.additionalDetails), additionalFields: data.get(#additionalFields, or: $value.additionalFields), id: data.get(#id, or: $value.id), diff --git a/packages/digit_data_model/lib/models/entities/facility.dart b/packages/digit_data_model/lib/models/entities/facility.dart index cc2347c48..c080247bc 100644 --- a/packages/digit_data_model/lib/models/entities/facility.dart +++ b/packages/digit_data_model/lib/models/entities/facility.dart @@ -9,14 +9,16 @@ import '../../data/local_store/sql_store/sql_store.dart'; part 'facility.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class FacilitySearchModel extends EntitySearchModel with FacilitySearchModelMappable { +class FacilitySearchModel extends EntitySearchModel + with FacilitySearchModelMappable { final List? id; final bool? isPermanent; final String? usage; final int? storageCapacity; final String? tenantId; - + final String? name; FacilitySearchModel({ + this.name, this.id, this.isPermanent, this.usage, @@ -24,22 +26,22 @@ class FacilitySearchModel extends EntitySearchModel with FacilitySearchModelMapp this.tenantId, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() FacilitySearchModel.ignoreDeleted({ + this.name, this.id, this.isPermanent, this.usage, this.storageCapacity, this.tenantId, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class FacilityModel extends EntityModel with FacilityModelMappable { - static const schemaName = 'Facility'; final String id; @@ -51,6 +53,7 @@ class FacilityModel extends EntityModel with FacilityModelMappable { final int? rowVersion; final AddressModel? address; final FacilityAdditionalFields? additionalFields; + final String? name; FacilityModel({ this.additionalFields, @@ -62,39 +65,41 @@ class FacilityModel extends EntityModel with FacilityModelMappable { this.tenantId, this.rowVersion, this.address, - super.auditDetails,super.clientAuditDetails, + this.name, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); FacilityCompanion get companion { return FacilityCompanion( - auditCreatedBy: Value(auditDetails?.createdBy), - auditCreatedTime: Value(auditDetails?.createdTime), - auditModifiedBy: Value(auditDetails?.lastModifiedBy), - clientCreatedTime: Value(clientAuditDetails?.createdTime), - clientModifiedTime: Value(clientAuditDetails?.lastModifiedTime), - clientCreatedBy: Value(clientAuditDetails?.createdBy), - clientModifiedBy: Value(clientAuditDetails?.lastModifiedBy), - auditModifiedTime: Value(auditDetails?.lastModifiedTime), - additionalFields: Value(additionalFields?.toJson()), - isDeleted: Value(isDeleted), - id: Value(id), - isPermanent: Value(isPermanent), - usage: Value(usage), - storageCapacity: Value(storageCapacity), - nonRecoverableError: Value(nonRecoverableError), - tenantId: Value(tenantId), - rowVersion: Value(rowVersion), - ); + auditCreatedBy: Value(auditDetails?.createdBy), + auditCreatedTime: Value(auditDetails?.createdTime), + auditModifiedBy: Value(auditDetails?.lastModifiedBy), + clientCreatedTime: Value(clientAuditDetails?.createdTime), + clientModifiedTime: Value(clientAuditDetails?.lastModifiedTime), + clientCreatedBy: Value(clientAuditDetails?.createdBy), + clientModifiedBy: Value(clientAuditDetails?.lastModifiedBy), + auditModifiedTime: Value(auditDetails?.lastModifiedTime), + additionalFields: Value(additionalFields?.toJson()), + isDeleted: Value(isDeleted), + id: Value(id), + isPermanent: Value(isPermanent), + usage: Value(usage), + storageCapacity: Value(storageCapacity), + nonRecoverableError: Value(nonRecoverableError), + tenantId: Value(tenantId), + rowVersion: Value(rowVersion), + name: Value(name)); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class FacilityAdditionalFields extends AdditionalFields with FacilityAdditionalFieldsMappable { +class FacilityAdditionalFields extends AdditionalFields + with FacilityAdditionalFieldsMappable { FacilityAdditionalFields({ super.schema = 'Facility', required super.version, super.fields, }); } - diff --git a/packages/digit_data_model/lib/models/entities/facility.mapper.dart b/packages/digit_data_model/lib/models/entities/facility.mapper.dart index 1ef9e0118..2808cd68d 100644 --- a/packages/digit_data_model/lib/models/entities/facility.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/facility.mapper.dart @@ -21,6 +21,9 @@ class FacilitySearchModelMapper @override final String id = 'FacilitySearchModel'; + static String? _$name(FacilitySearchModel v) => v.name; + static const Field _f$name = + Field('name', _$name, opt: true); static List? _$id(FacilitySearchModel v) => v.id; static const Field> _f$id = Field('id', _$id, opt: true); @@ -50,6 +53,7 @@ class FacilitySearchModelMapper @override final MappableFields fields = const { + #name: _f$name, #id: _f$id, #isPermanent: _f$isPermanent, #usage: _f$usage, @@ -72,6 +76,7 @@ class FacilitySearchModelMapper static FacilitySearchModel _instantiate(DecodingData data) { return FacilitySearchModel.ignoreDeleted( + name: data.dec(_f$name), id: data.dec(_f$id), isPermanent: data.dec(_f$isPermanent), usage: data.dec(_f$usage), @@ -140,7 +145,8 @@ abstract class FacilitySearchModelCopyWith<$R, $In extends FacilitySearchModel, ListCopyWith<$R, String, ObjectCopyWith<$R, String, String>>? get id; @override $R call( - {List? id, + {String? name, + List? id, bool? isPermanent, String? usage, int? storageCapacity, @@ -166,13 +172,15 @@ class _FacilitySearchModelCopyWithImpl<$R, $Out> : null; @override $R call( - {Object? id = $none, + {Object? name = $none, + Object? id = $none, Object? isPermanent = $none, Object? usage = $none, Object? storageCapacity = $none, Object? tenantId = $none, Object? boundaryCode = $none}) => $apply(FieldCopyWithData({ + if (name != $none) #name: name, if (id != $none) #id: id, if (isPermanent != $none) #isPermanent: isPermanent, if (usage != $none) #usage: usage, @@ -183,6 +191,7 @@ class _FacilitySearchModelCopyWithImpl<$R, $Out> @override FacilitySearchModel $make(CopyWithData data) => FacilitySearchModel.ignoreDeleted( + name: data.get(#name, or: $value.name), id: data.get(#id, or: $value.id), isPermanent: data.get(#isPermanent, or: $value.isPermanent), usage: data.get(#usage, or: $value.usage), @@ -240,6 +249,9 @@ class FacilityModelMapper extends SubClassMapperBase { static AddressModel? _$address(FacilityModel v) => v.address; static const Field _f$address = Field('address', _$address, opt: true); + static String? _$name(FacilityModel v) => v.name; + static const Field _f$name = + Field('name', _$name, opt: true); static AuditDetails? _$auditDetails(FacilityModel v) => v.auditDetails; static const Field _f$auditDetails = Field('auditDetails', _$auditDetails, opt: true); @@ -262,6 +274,7 @@ class FacilityModelMapper extends SubClassMapperBase { #tenantId: _f$tenantId, #rowVersion: _f$rowVersion, #address: _f$address, + #name: _f$name, #auditDetails: _f$auditDetails, #clientAuditDetails: _f$clientAuditDetails, #isDeleted: _f$isDeleted, @@ -288,6 +301,7 @@ class FacilityModelMapper extends SubClassMapperBase { tenantId: data.dec(_f$tenantId), rowVersion: data.dec(_f$rowVersion), address: data.dec(_f$address), + name: data.dec(_f$name), auditDetails: data.dec(_f$auditDetails), clientAuditDetails: data.dec(_f$clientAuditDetails), isDeleted: data.dec(_f$isDeleted)); @@ -367,6 +381,7 @@ abstract class FacilityModelCopyWith<$R, $In extends FacilityModel, $Out> String? tenantId, int? rowVersion, AddressModel? address, + String? name, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); @@ -407,6 +422,7 @@ class _FacilityModelCopyWithImpl<$R, $Out> Object? tenantId = $none, Object? rowVersion = $none, Object? address = $none, + Object? name = $none, Object? auditDetails = $none, Object? clientAuditDetails = $none, Object? isDeleted = $none}) => @@ -421,6 +437,7 @@ class _FacilityModelCopyWithImpl<$R, $Out> if (tenantId != $none) #tenantId: tenantId, if (rowVersion != $none) #rowVersion: rowVersion, if (address != $none) #address: address, + if (name != $none) #name: name, if (auditDetails != $none) #auditDetails: auditDetails, if (clientAuditDetails != $none) #clientAuditDetails: clientAuditDetails, @@ -439,6 +456,7 @@ class _FacilityModelCopyWithImpl<$R, $Out> tenantId: data.get(#tenantId, or: $value.tenantId), rowVersion: data.get(#rowVersion, or: $value.rowVersion), address: data.get(#address, or: $value.address), + name: data.get(#name, or: $value.name), auditDetails: data.get(#auditDetails, or: $value.auditDetails), clientAuditDetails: data.get(#clientAuditDetails, or: $value.clientAuditDetails), diff --git a/packages/digit_data_model/lib/models/entities/identifier_types.dart b/packages/digit_data_model/lib/models/entities/identifier_types.dart new file mode 100644 index 000000000..b63723201 --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/identifier_types.dart @@ -0,0 +1,12 @@ +// Generated using mason. Do not modify by hand +import 'package:dart_mappable/dart_mappable.dart'; + +part 'identifier_types.mapper.dart'; + +@MappableEnum(caseStyle: CaseStyle.upperCase) +enum IdentifierTypes { + @MappableValue("UNIQUE_BENEFICIARY_ID") + uniqueBeneficiaryID, + @MappableValue("DEFAULT") + defaultID, +} diff --git a/packages/digit_data_model/lib/models/entities/identifier_types.mapper.dart b/packages/digit_data_model/lib/models/entities/identifier_types.mapper.dart new file mode 100644 index 000000000..e81a8d7a2 --- /dev/null +++ b/packages/digit_data_model/lib/models/entities/identifier_types.mapper.dart @@ -0,0 +1,53 @@ +// 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 'identifier_types.dart'; + +class IdentifierTypesMapper extends EnumMapper { + IdentifierTypesMapper._(); + + static IdentifierTypesMapper? _instance; + static IdentifierTypesMapper ensureInitialized() { + if (_instance == null) { + MapperContainer.globals.use(_instance = IdentifierTypesMapper._()); + } + return _instance!; + } + + static IdentifierTypes fromValue(dynamic value) { + ensureInitialized(); + return MapperContainer.globals.fromValue(value); + } + + @override + IdentifierTypes decode(dynamic value) { + switch (value) { + case "UNIQUE_BENEFICIARY_ID": + return IdentifierTypes.uniqueBeneficiaryID; + case "DEFAULT": + return IdentifierTypes.defaultID; + default: + throw MapperException.unknownEnumValue(value); + } + } + + @override + dynamic encode(IdentifierTypes self) { + switch (self) { + case IdentifierTypes.uniqueBeneficiaryID: + return "UNIQUE_BENEFICIARY_ID"; + case IdentifierTypes.defaultID: + return "DEFAULT"; + } + } +} + +extension IdentifierTypesMapperExtension on IdentifierTypes { + dynamic toValue() { + IdentifierTypesMapper.ensureInitialized(); + return MapperContainer.globals.toValue(this); + } +} diff --git a/packages/digit_data_model/lib/models/entities/project_type.dart b/packages/digit_data_model/lib/models/entities/project_type.dart index 820b48925..0d2f80389 100644 --- a/packages/digit_data_model/lib/models/entities/project_type.dart +++ b/packages/digit_data_model/lib/models/entities/project_type.dart @@ -14,7 +14,7 @@ class ProjectTypeModel extends EntityModel with ProjectTypeModelMappable { final String? name; final String? code; final String? group; - final String? beneficiaryType; + final BeneficiaryType? beneficiaryType; final List? eligibilityCriteria; final List? taskProcedure; final List? cycles; diff --git a/packages/digit_data_model/lib/models/entities/project_type.mapper.dart b/packages/digit_data_model/lib/models/entities/project_type.mapper.dart index 01597308f..d011cde6a 100644 --- a/packages/digit_data_model/lib/models/entities/project_type.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/project_type.mapper.dart @@ -43,8 +43,9 @@ class ProjectTypeModelMapper extends SubClassMapperBase { static int? _$validMaxAge(ProjectTypeModel v) => v.validMaxAge; static const Field _f$validMaxAge = Field('validMaxAge', _$validMaxAge, opt: true); - static String? _$beneficiaryType(ProjectTypeModel v) => v.beneficiaryType; - static const Field _f$beneficiaryType = + static BeneficiaryType? _$beneficiaryType(ProjectTypeModel v) => + v.beneficiaryType; + static const Field _f$beneficiaryType = Field('beneficiaryType', _$beneficiaryType, opt: true); static List? _$eligibilityCriteria(ProjectTypeModel v) => v.eligibilityCriteria; @@ -220,7 +221,7 @@ abstract class ProjectTypeModelCopyWith<$R, $In extends ProjectTypeModel, $Out> String? group, int? validMinAge, int? validMaxAge, - String? beneficiaryType, + BeneficiaryType? beneficiaryType, List? eligibilityCriteria, List? cycles, List? taskProcedure, diff --git a/packages/digit_data_model/lib/models/entities/service.dart b/packages/digit_data_model/lib/models/entities/service.dart index 87eccc440..c8e4c20a1 100644 --- a/packages/digit_data_model/lib/models/entities/service.dart +++ b/packages/digit_data_model/lib/models/entities/service.dart @@ -1,22 +1,22 @@ // Generated using mason. Do not modify by hand -import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; +import 'dart:convert'; +import 'package:dart_mappable/dart_mappable.dart'; import 'package:digit_data_model/data_model.dart'; - -import '../../data/local_store/sql_store/sql_store.dart'; +import 'package:drift/drift.dart'; part 'service.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class ServiceSearchModel extends EntitySearchModel with ServiceSearchModelMappable { +class ServiceSearchModel extends EntitySearchModel + with ServiceSearchModelMappable { final String? id; final String? clientId; final String? serviceDefId; final String? accountId; final String? createdAt; final String? tenantId; - + ServiceSearchModel({ this.id, this.clientId, @@ -26,7 +26,7 @@ class ServiceSearchModel extends EntitySearchModel with ServiceSearchModelMappab this.tenantId, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() ServiceSearchModel.ignoreDeleted({ @@ -37,12 +37,11 @@ class ServiceSearchModel extends EntitySearchModel with ServiceSearchModelMappab this.createdAt, this.tenantId, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class ServiceModel extends EntityModel with ServiceModelMappable { - static const schemaName = 'Service'; final String? id; @@ -50,7 +49,7 @@ class ServiceModel extends EntityModel with ServiceModelMappable { final String? serviceDefId; final bool? isActive; final String? accountId; - final String? additionalDetails; + final Map? additionalDetails; final String? createdAt; final bool? nonRecoverableError; final String? tenantId; @@ -71,9 +70,10 @@ class ServiceModel extends EntityModel with ServiceModelMappable { this.tenantId, this.rowVersion, this.attributes, - super.auditDetails,super.clientAuditDetails, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); ServiceCompanion get companion { return ServiceCompanion( @@ -92,21 +92,21 @@ class ServiceModel extends EntityModel with ServiceModelMappable { serviceDefId: Value(serviceDefId), isActive: Value(isActive), accountId: Value(accountId), - additionalDetails: Value(additionalDetails), + additionalDetails: Value(jsonEncode(additionalDetails)), createdAt: Value(createdAt), nonRecoverableError: Value(nonRecoverableError), tenantId: Value(tenantId), rowVersion: Value(rowVersion), - ); + ); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class ServiceAdditionalFields extends AdditionalFields with ServiceAdditionalFieldsMappable { +class ServiceAdditionalFields extends AdditionalFields + with ServiceAdditionalFieldsMappable { ServiceAdditionalFields({ super.schema = 'Service', required super.version, super.fields, }); } - diff --git a/packages/digit_data_model/lib/models/entities/service.mapper.dart b/packages/digit_data_model/lib/models/entities/service.mapper.dart index 57c1b57b3..2f6f47d4c 100644 --- a/packages/digit_data_model/lib/models/entities/service.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/service.mapper.dart @@ -229,8 +229,9 @@ class ServiceModelMapper extends SubClassMapperBase { static String? _$accountId(ServiceModel v) => v.accountId; static const Field _f$accountId = Field('accountId', _$accountId, opt: true); - static String? _$additionalDetails(ServiceModel v) => v.additionalDetails; - static const Field _f$additionalDetails = + static Map? _$additionalDetails(ServiceModel v) => + v.additionalDetails; + static const Field> _f$additionalDetails = Field('additionalDetails', _$additionalDetails, opt: true); static String? _$createdAt(ServiceModel v) => v.createdAt; static const Field _f$createdAt = @@ -364,6 +365,8 @@ abstract class ServiceModelCopyWith<$R, $In extends ServiceModel, $Out> implements EntityModelCopyWith<$R, $In, $Out> { ServiceAdditionalFieldsCopyWith<$R, ServiceAdditionalFields, ServiceAdditionalFields>? get additionalFields; + MapCopyWith<$R, String, dynamic, ObjectCopyWith<$R, dynamic, dynamic>>? + get additionalDetails; ListCopyWith< $R, ServiceAttributesModel, @@ -382,7 +385,7 @@ abstract class ServiceModelCopyWith<$R, $In extends ServiceModel, $Out> String? serviceDefId, bool? isActive, String? accountId, - String? additionalDetails, + Map? additionalDetails, String? createdAt, bool? nonRecoverableError, String? tenantId, @@ -408,6 +411,14 @@ class _ServiceModelCopyWithImpl<$R, $Out> get additionalFields => $value.additionalFields?.copyWith .$chain((v) => call(additionalFields: v)); @override + MapCopyWith<$R, String, dynamic, ObjectCopyWith<$R, dynamic, dynamic>>? + get additionalDetails => $value.additionalDetails != null + ? MapCopyWith( + $value.additionalDetails!, + (v, t) => ObjectCopyWith(v, $identity, t), + (v) => call(additionalDetails: v)) + : null; + @override ListCopyWith< $R, ServiceAttributesModel, diff --git a/packages/digit_data_model/lib/models/entities/target.dart b/packages/digit_data_model/lib/models/entities/target.dart index ace5f79d0..d96f3c08c 100644 --- a/packages/digit_data_model/lib/models/entities/target.dart +++ b/packages/digit_data_model/lib/models/entities/target.dart @@ -1,31 +1,30 @@ // Generated using mason. Do not modify by hand import 'package:dart_mappable/dart_mappable.dart'; -import 'package:drift/drift.dart'; import 'package:digit_data_model/data_model.dart'; -import 'beneficiary_type.dart'; +import 'package:drift/drift.dart'; part 'target.mapper.dart'; @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class TargetSearchModel extends EntitySearchModel with TargetSearchModelMappable { +class TargetSearchModel extends EntitySearchModel + with TargetSearchModelMappable { final String? tenantId; - + TargetSearchModel({ this.tenantId, super.boundaryCode, super.isDeleted, - }): super(); + }) : super(); @MappableConstructor() TargetSearchModel.ignoreDeleted({ this.tenantId, super.boundaryCode, - }): super(isDeleted: false); + }) : super(isDeleted: false); } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) class TargetModel extends EntityModel with TargetModelMappable { - static const schemaName = 'Target'; final String id; @@ -35,7 +34,7 @@ class TargetModel extends EntityModel with TargetModelMappable { final bool? nonRecoverableError; final String? tenantId; final int? rowVersion; - final BeneficiaryType? beneficiaryType; + final String? beneficiaryType; final TargetAdditionalFields? additionalFields; TargetModel({ @@ -48,9 +47,10 @@ class TargetModel extends EntityModel with TargetModelMappable { this.tenantId, this.rowVersion, this.beneficiaryType, - super.auditDetails,super.clientAuditDetails, + super.auditDetails, + super.clientAuditDetails, super.isDeleted = false, - }): super(); + }) : super(); TargetCompanion get companion { return TargetCompanion( @@ -72,16 +72,16 @@ class TargetModel extends EntityModel with TargetModelMappable { tenantId: Value(tenantId), rowVersion: Value(rowVersion), beneficiaryType: Value(beneficiaryType), - ); + ); } } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) -class TargetAdditionalFields extends AdditionalFields with TargetAdditionalFieldsMappable { +class TargetAdditionalFields extends AdditionalFields + with TargetAdditionalFieldsMappable { TargetAdditionalFields({ super.schema = 'Target', required super.version, super.fields, }); } - diff --git a/packages/digit_data_model/lib/models/entities/target.mapper.dart b/packages/digit_data_model/lib/models/entities/target.mapper.dart index 1502ade6d..7cb86ee06 100644 --- a/packages/digit_data_model/lib/models/entities/target.mapper.dart +++ b/packages/digit_data_model/lib/models/entities/target.mapper.dart @@ -185,8 +185,8 @@ class TargetModelMapper extends SubClassMapperBase { static int? _$rowVersion(TargetModel v) => v.rowVersion; static const Field _f$rowVersion = Field('rowVersion', _$rowVersion, opt: true); - static BeneficiaryType? _$beneficiaryType(TargetModel v) => v.beneficiaryType; - static const Field _f$beneficiaryType = + static String? _$beneficiaryType(TargetModel v) => v.beneficiaryType; + static const Field _f$beneficiaryType = Field('beneficiaryType', _$beneficiaryType, opt: true); static AuditDetails? _$auditDetails(TargetModel v) => v.auditDetails; static const Field _f$auditDetails = @@ -311,7 +311,7 @@ abstract class TargetModelCopyWith<$R, $In extends TargetModel, $Out> bool? nonRecoverableError, String? tenantId, int? rowVersion, - BeneficiaryType? beneficiaryType, + String? beneficiaryType, AuditDetails? auditDetails, ClientAuditDetails? clientAuditDetails, bool? isDeleted}); diff --git a/packages/digit_data_model/pubspec.lock b/packages/digit_data_model/pubspec.lock index a2f7c5b49..a51054106 100644 --- a/packages/digit_data_model/pubspec.lock +++ b/packages/digit_data_model/pubspec.lock @@ -254,7 +254,7 @@ packages: description: path: "packages/dart_mappable_builder" ref: master - resolved-ref: "145091c3b5f05ccea22ec7520f5b9f4e50ff6106" + resolved-ref: e3d8ac43f70568b4a17c200cae5cde285050ef23 url: "https://github.com/egovernments/health-campaign-field-worker-app/" source: git version: "4.2.0" diff --git a/packages/digit_data_model/pubspec.yaml b/packages/digit_data_model/pubspec.yaml index 96cf93b28..390bacb60 100644 --- a/packages/digit_data_model/pubspec.yaml +++ b/packages/digit_data_model/pubspec.yaml @@ -1,6 +1,6 @@ name: digit_data_model description: The digit_data_model package is a data modeling library. It defines various classes, enums, and functions. -version: 1.0.3+1 +version: 1.0.4-dev.10-uniqueId homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/digit_data_model repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -50,33 +50,33 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware +# To add assets to your package, add an assets section, like this: +# assets: +# - images/a_dot_burr.jpeg +# - images/a_dot_ham.jpeg +# +# For details regarding assets in packages, see +# https://flutter.dev/assets-and-images/#from-packages +# +# An image asset can refer to one or more resolution-specific "variants", see +# https://flutter.dev/assets-and-images/#resolution-aware - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages +# To add custom fonts to your package, add a fonts section here, +# in this "flutter" section. Each entry in this list should have a +# "family" key with the font family name, and a "fonts" key with a +# list giving the asset and other descriptors for the font. For +# example: +# fonts: +# - family: Schyler +# fonts: +# - asset: fonts/Schyler-Regular.ttf +# - asset: fonts/Schyler-Italic.ttf +# style: italic +# - family: Trajan Pro +# fonts: +# - asset: fonts/TrajanPro.ttf +# - asset: fonts/TrajanPro_Bold.ttf +# weight: 700 +# +# For details regarding fonts in packages, see +# https://flutter.dev/custom-fonts/#from-packages diff --git a/packages/digit_data_model/test/project_facility_bloc_test.dart b/packages/digit_data_model/test/project_facility_bloc_test.dart index 9f4ec9a1b..16798f079 100644 --- a/packages/digit_data_model/test/project_facility_bloc_test.dart +++ b/packages/digit_data_model/test/project_facility_bloc_test.dart @@ -8,6 +8,9 @@ import 'package:mocktail/mocktail.dart'; class MockProjectFacilityDataRepository extends Mock implements ProjectFacilityDataRepository {} +class MockFacilityDataRepository extends Mock + implements FacilityDataRepository {} + class FakeProjectFacilitySearchModel extends Fake implements ProjectFacilitySearchModel {} @@ -18,14 +21,17 @@ void main() { }); late MockProjectFacilityDataRepository mockProjectFacilityDataRepository; + late MockFacilityDataRepository mockFacilityDataRepository; late ProjectFacilityBloc projectFacilityBloc; // Initializing mock objects before each test. setUp(() { mockProjectFacilityDataRepository = MockProjectFacilityDataRepository(); + mockFacilityDataRepository = MockFacilityDataRepository(); projectFacilityBloc = ProjectFacilityBloc( const ProjectFacilityEmptyState(), projectFacilityDataRepository: mockProjectFacilityDataRepository, + facilityDataRepository: mockFacilityDataRepository, ); }); @@ -64,7 +70,10 @@ void main() { query: ProjectFacilitySearchModel(projectId: testProjectId))), expect: () => [ const ProjectFacilityLoadingState(), - ProjectFacilityFetchedState(projectFacilities: testProjectFacilities), + ProjectFacilityFetchedState( + projectFacilities: testProjectFacilities, + facilityMap: {}, + ), ], verify: (_) { verify(() => mockProjectFacilityDataRepository.search(any())).called(1); diff --git a/packages/digit_dss/CHANGELOG.md b/packages/digit_dss/CHANGELOG.md index 968f59396..a2b442da6 100644 --- a/packages/digit_dss/CHANGELOG.md +++ b/packages/digit_dss/CHANGELOG.md @@ -1,21 +1,31 @@ +## 1.0.2-dev.1 + +* Added projectTypeCode in Dashboard schema + ## 1.0.1 + * Bug fixes * Added enums for dss charts * Fixed chart delete issue * Updated digit_scanner package, digit_components, digit_data_model, attendance_management ## 1.0.0 + * Initial DSS Dashboard Release supporting metric and table charts ## 0.0.1-dev.4 -* Added error toast for network failure + +* Added error toast for network failure * No result card added if no charts available ## 0.0.1-dev.3 + * Fixed user uuid search for dss charts ## 0.0.1-dev.2 + * Added userIds and project Id filters for all dss charts ## 0.0.1-dev.1 + * Initial DSS Dashboard Release diff --git a/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.dart b/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.dart index 854e32156..fea761c39 100644 --- a/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.dart +++ b/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.dart @@ -11,6 +11,9 @@ class DashboardConfigSchema { @Name("charts") late List? charts; + + @Name("projectTypeCode") + late String? projectTypeCode; } @embedded diff --git a/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.g.dart b/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.g.dart index 723c4c6b0..b66d36b49 100644 --- a/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.g.dart +++ b/packages/digit_dss/lib/data/local_store/no_sql/schema/dashboard_config_schema.g.dart @@ -28,6 +28,11 @@ const DashboardConfigSchemaSchema = CollectionSchema( id: 1, name: r'enableDashboard', type: IsarType.bool, + ), + r'projectTypeCode': PropertySchema( + id: 2, + name: r'projectTypeCode', + type: IsarType.string, ) }, estimateSize: _dashboardConfigSchemaEstimateSize, @@ -66,6 +71,12 @@ int _dashboardConfigSchemaEstimateSize( } } } + { + final value = object.projectTypeCode; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } return bytesCount; } @@ -82,6 +93,7 @@ void _dashboardConfigSchemaSerialize( object.charts, ); writer.writeBool(offsets[1], object.enableDashboard); + writer.writeString(offsets[2], object.projectTypeCode); } DashboardConfigSchema _dashboardConfigSchemaDeserialize( @@ -99,6 +111,7 @@ DashboardConfigSchema _dashboardConfigSchemaDeserialize( ); object.enableDashboard = reader.readBoolOrNull(offsets[1]); object.id = id; + object.projectTypeCode = reader.readStringOrNull(offsets[2]); return object; } @@ -118,6 +131,8 @@ P _dashboardConfigSchemaDeserializeProp

( )) as P; case 1: return (reader.readBoolOrNull(offset)) as P; + case 2: + return (reader.readStringOrNull(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -410,6 +425,162 @@ extension DashboardConfigSchemaQueryFilter on QueryBuilder< )); }); } + + QueryBuilder projectTypeCodeIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'projectTypeCode', + )); + }); + } + + QueryBuilder projectTypeCodeIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'projectTypeCode', + )); + }); + } + + QueryBuilder projectTypeCodeEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeBetween( + 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'projectTypeCode', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + projectTypeCodeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'projectTypeCode', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + projectTypeCodeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'projectTypeCode', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder projectTypeCodeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'projectTypeCode', + value: '', + )); + }); + } + + QueryBuilder projectTypeCodeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'projectTypeCode', + value: '', + )); + }); + } } extension DashboardConfigSchemaQueryObject on QueryBuilder< @@ -441,6 +612,20 @@ extension DashboardConfigSchemaQuerySortBy return query.addSortBy(r'enableDashboard', Sort.desc); }); } + + QueryBuilder + sortByProjectTypeCode() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'projectTypeCode', Sort.asc); + }); + } + + QueryBuilder + sortByProjectTypeCodeDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'projectTypeCode', Sort.desc); + }); + } } extension DashboardConfigSchemaQuerySortThenBy @@ -472,6 +657,20 @@ extension DashboardConfigSchemaQuerySortThenBy return query.addSortBy(r'id', Sort.desc); }); } + + QueryBuilder + thenByProjectTypeCode() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'projectTypeCode', Sort.asc); + }); + } + + QueryBuilder + thenByProjectTypeCodeDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'projectTypeCode', Sort.desc); + }); + } } extension DashboardConfigSchemaQueryWhereDistinct @@ -482,6 +681,14 @@ extension DashboardConfigSchemaQueryWhereDistinct return query.addDistinctBy(r'enableDashboard'); }); } + + QueryBuilder + distinctByProjectTypeCode({bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'projectTypeCode', + caseSensitive: caseSensitive); + }); + } } extension DashboardConfigSchemaQueryProperty on QueryBuilder< @@ -505,6 +712,13 @@ extension DashboardConfigSchemaQueryProperty on QueryBuilder< return query.addPropertyName(r'enableDashboard'); }); } + + QueryBuilder + projectTypeCodeProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'projectTypeCode'); + }); + } } // ************************************************************************** diff --git a/packages/digit_dss/lib/data/remote/dashboard.dart b/packages/digit_dss/lib/data/remote/dashboard.dart index 8f6a2a321..9a0c2e1b2 100644 --- a/packages/digit_dss/lib/data/remote/dashboard.dart +++ b/packages/digit_dss/lib/data/remote/dashboard.dart @@ -136,6 +136,7 @@ class DashboardRemoteRepository { ) async { final dashboardConfig = DashboardConfigSchema() ..enableDashboard = dashboardConfigWrapper.enableDashboard + ..projectTypeCode = dashboardConfigWrapper.projectTypeCode ..charts = dashboardConfigWrapper.charts?.map((chart) { final dssChart = DashboardChartConfigSchema() ..name = chart.name diff --git a/packages/digit_dss/lib/models/entities/dashboard_config.dart b/packages/digit_dss/lib/models/entities/dashboard_config.dart index e510ad5aa..2ac1ecbd5 100644 --- a/packages/digit_dss/lib/models/entities/dashboard_config.dart +++ b/packages/digit_dss/lib/models/entities/dashboard_config.dart @@ -22,6 +22,7 @@ class DashboardConfigWrapper with _$DashboardConfigWrapper { const factory DashboardConfigWrapper({ @JsonKey(name: 'enableDashboard') required bool enableDashboard, @JsonKey(name: 'charts') List? charts, + @JsonKey(name: 'projectTypeCode') required String projectTypeCode, }) = _DashboardConfigWrapper; factory DashboardConfigWrapper.fromJson( diff --git a/packages/digit_dss/lib/models/entities/dashboard_config.freezed.dart b/packages/digit_dss/lib/models/entities/dashboard_config.freezed.dart index ff8cb1285..2953af88d 100644 --- a/packages/digit_dss/lib/models/entities/dashboard_config.freezed.dart +++ b/packages/digit_dss/lib/models/entities/dashboard_config.freezed.dart @@ -196,6 +196,8 @@ mixin _$DashboardConfigWrapper { bool get enableDashboard => throw _privateConstructorUsedError; @JsonKey(name: 'charts') List? get charts => throw _privateConstructorUsedError; + @JsonKey(name: 'projectTypeCode') + String get projectTypeCode => throw _privateConstructorUsedError; Map toJson() => throw _privateConstructorUsedError; @JsonKey(ignore: true) @@ -211,7 +213,8 @@ abstract class $DashboardConfigWrapperCopyWith<$Res> { @useResult $Res call( {@JsonKey(name: 'enableDashboard') bool enableDashboard, - @JsonKey(name: 'charts') List? charts}); + @JsonKey(name: 'charts') List? charts, + @JsonKey(name: 'projectTypeCode') String projectTypeCode}); } /// @nodoc @@ -230,6 +233,7 @@ class _$DashboardConfigWrapperCopyWithImpl<$Res, $Res call({ Object? enableDashboard = null, Object? charts = freezed, + Object? projectTypeCode = null, }) { return _then(_value.copyWith( enableDashboard: null == enableDashboard @@ -240,6 +244,10 @@ class _$DashboardConfigWrapperCopyWithImpl<$Res, ? _value.charts : charts // ignore: cast_nullable_to_non_nullable as List?, + projectTypeCode: null == projectTypeCode + ? _value.projectTypeCode + : projectTypeCode // ignore: cast_nullable_to_non_nullable + as String, ) as $Val); } } @@ -255,7 +263,8 @@ abstract class _$$DashboardConfigWrapperImplCopyWith<$Res> @useResult $Res call( {@JsonKey(name: 'enableDashboard') bool enableDashboard, - @JsonKey(name: 'charts') List? charts}); + @JsonKey(name: 'charts') List? charts, + @JsonKey(name: 'projectTypeCode') String projectTypeCode}); } /// @nodoc @@ -273,6 +282,7 @@ class __$$DashboardConfigWrapperImplCopyWithImpl<$Res> $Res call({ Object? enableDashboard = null, Object? charts = freezed, + Object? projectTypeCode = null, }) { return _then(_$DashboardConfigWrapperImpl( enableDashboard: null == enableDashboard @@ -283,6 +293,10 @@ class __$$DashboardConfigWrapperImplCopyWithImpl<$Res> ? _value._charts : charts // ignore: cast_nullable_to_non_nullable as List?, + projectTypeCode: null == projectTypeCode + ? _value.projectTypeCode + : projectTypeCode // ignore: cast_nullable_to_non_nullable + as String, )); } } @@ -292,7 +306,8 @@ class __$$DashboardConfigWrapperImplCopyWithImpl<$Res> class _$DashboardConfigWrapperImpl implements _DashboardConfigWrapper { const _$DashboardConfigWrapperImpl( {@JsonKey(name: 'enableDashboard') required this.enableDashboard, - @JsonKey(name: 'charts') final List? charts}) + @JsonKey(name: 'charts') final List? charts, + @JsonKey(name: 'projectTypeCode') required this.projectTypeCode}) : _charts = charts; factory _$DashboardConfigWrapperImpl.fromJson(Map json) => @@ -312,9 +327,13 @@ class _$DashboardConfigWrapperImpl implements _DashboardConfigWrapper { return EqualUnmodifiableListView(value); } + @override + @JsonKey(name: 'projectTypeCode') + final String projectTypeCode; + @override String toString() { - return 'DashboardConfigWrapper(enableDashboard: $enableDashboard, charts: $charts)'; + return 'DashboardConfigWrapper(enableDashboard: $enableDashboard, charts: $charts, projectTypeCode: $projectTypeCode)'; } @override @@ -324,13 +343,15 @@ class _$DashboardConfigWrapperImpl implements _DashboardConfigWrapper { other is _$DashboardConfigWrapperImpl && (identical(other.enableDashboard, enableDashboard) || other.enableDashboard == enableDashboard) && - const DeepCollectionEquality().equals(other._charts, _charts)); + const DeepCollectionEquality().equals(other._charts, _charts) && + (identical(other.projectTypeCode, projectTypeCode) || + other.projectTypeCode == projectTypeCode)); } @JsonKey(ignore: true) @override int get hashCode => Object.hash(runtimeType, enableDashboard, - const DeepCollectionEquality().hash(_charts)); + const DeepCollectionEquality().hash(_charts), projectTypeCode); @JsonKey(ignore: true) @override @@ -350,8 +371,9 @@ class _$DashboardConfigWrapperImpl implements _DashboardConfigWrapper { abstract class _DashboardConfigWrapper implements DashboardConfigWrapper { const factory _DashboardConfigWrapper( {@JsonKey(name: 'enableDashboard') required final bool enableDashboard, - @JsonKey(name: 'charts') - final List? charts}) = _$DashboardConfigWrapperImpl; + @JsonKey(name: 'charts') final List? charts, + @JsonKey(name: 'projectTypeCode') + required final String projectTypeCode}) = _$DashboardConfigWrapperImpl; factory _DashboardConfigWrapper.fromJson(Map json) = _$DashboardConfigWrapperImpl.fromJson; @@ -363,6 +385,9 @@ abstract class _DashboardConfigWrapper implements DashboardConfigWrapper { @JsonKey(name: 'charts') List? get charts; @override + @JsonKey(name: 'projectTypeCode') + String get projectTypeCode; + @override @JsonKey(ignore: true) _$$DashboardConfigWrapperImplCopyWith<_$DashboardConfigWrapperImpl> get copyWith => throw _privateConstructorUsedError; diff --git a/packages/digit_dss/lib/models/entities/dashboard_config.g.dart b/packages/digit_dss/lib/models/entities/dashboard_config.g.dart index 6996d05b5..703dcc4f3 100644 --- a/packages/digit_dss/lib/models/entities/dashboard_config.g.dart +++ b/packages/digit_dss/lib/models/entities/dashboard_config.g.dart @@ -29,6 +29,7 @@ _$DashboardConfigWrapperImpl _$$DashboardConfigWrapperImplFromJson( charts: (json['charts'] as List?) ?.map((e) => ChartConfigModel.fromJson(e as Map)) .toList(), + projectTypeCode: json['projectTypeCode'] as String, ); Map _$$DashboardConfigWrapperImplToJson( @@ -36,6 +37,7 @@ Map _$$DashboardConfigWrapperImplToJson( { 'enableDashboard': instance.enableDashboard, 'charts': instance.charts, + 'projectTypeCode': instance.projectTypeCode, }; _$ChartConfigModelImpl _$$ChartConfigModelImplFromJson( diff --git a/packages/digit_dss/pubspec.yaml b/packages/digit_dss/pubspec.yaml index a5496ae33..2e56c5769 100644 --- a/packages/digit_dss/pubspec.yaml +++ b/packages/digit_dss/pubspec.yaml @@ -1,6 +1,6 @@ name: digit_dss description: "DSS Dashboard for campaign management" -version: 1.0.1 +version: 1.0.2-dev.1 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/develop/packages/digit_dss repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -19,7 +19,7 @@ dependencies: flutter_svg: ^2.0.8 dart_mappable: ^4.2.0 auto_route: ^7.8.4 - digit_data_model: ^1.0.3+1 + digit_data_model: ^1.0.4-dev.9-uniqueId package_info_plus: ^5.0.1 collection: ^1.16.0 async: ^2.11.0 diff --git a/packages/digit_scanner/pubspec.lock b/packages/digit_scanner/pubspec.lock index 465d76a5f..db34b99ff 100644 --- a/packages/digit_scanner/pubspec.lock +++ b/packages/digit_scanner/pubspec.lock @@ -321,14 +321,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_style: dependency: transitive description: @@ -337,14 +329,6 @@ packages: 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" diff_match_patch: dependency: transitive description: @@ -356,49 +340,11 @@ packages: digit_components: dependency: "direct main" description: - path: "../digit_components" - relative: true - source: path - version: "1.0.1+1" - digit_data_model: - dependency: "direct overridden" - description: - path: "../digit_data_model" - relative: true - source: path - version: "1.0.3+1" - dio: - dependency: transitive - description: - name: dio - sha256: "0dfb6b6a1979dac1c1245e17cef824d7b452ea29bd33d3467269f9bef3715fb0" - url: "https://pub.dev" - source: hosted - version: "5.6.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 + name: digit_components + sha256: "07b585e5d8010639366da72a4a8b215ce9b8790c75b2162b66af3cea57ca35d9" 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" + version: "1.0.2+1" easy_stepper: dependency: transitive description: @@ -686,22 +632,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - 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: @@ -1006,14 +936,6 @@ packages: url: "https://pub.dev" source: hosted version: "14.3.0" - recase: - dependency: transitive - description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 - url: "https://pub.dev" - source: hosted - version: "4.1.0" remove_emoji_input_formatter: dependency: transitive description: @@ -1099,22 +1021,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: "62bbb4073edbcdf53f40c80775f33eea01d301b7b81417e5b3fb7395416258c1" - url: "https://pub.dev" - source: hosted - version: "0.5.24" stack_trace: dependency: transitive description: @@ -1195,14 +1101,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/inventory_management/CHANGELOG.md b/packages/inventory_management/CHANGELOG.md index 930c5526b..2c7163dc4 100644 --- a/packages/inventory_management/CHANGELOG.md +++ b/packages/inventory_management/CHANGELOG.md @@ -1,4 +1,27 @@ -## 1.0.3+1 +## 1.0.3-dev.5 + +* Updated digit_data_model dev version + +## 1.0.3-dev.4 + +* Added additional fields in stock search response + +## 1.0.3-dev.3 + +* Added _handleSetDateOfReconciliation event in stock_reconciliation_bloc +* Added dateOfEntry in stock model +* Updated digit_data_model dev version with the latest changes + +## 1.0.3+4 + +* Updated wayBillNumber validation + +## 1.0.3+3 + +* Updated key name of waybillNumber to wayBillNumber +* Return transaction type logic change in stock_details and report_details bloc + +## 1.0.3+2 * Updated digit_scanner package, digit_components, digit_data_model diff --git a/packages/inventory_management/lib/blocs/inventory_report.dart b/packages/inventory_management/lib/blocs/inventory_report.dart index 29c2bdf7f..9221d2c02 100644 --- a/packages/inventory_management/lib/blocs/inventory_report.dart +++ b/packages/inventory_management/lib/blocs/inventory_report.dart @@ -67,8 +67,8 @@ class InventoryReportBloc } else if (reportType == InventoryReportType.returned) { transactionType = [TransactionType.received.toValue()]; transactionReason = [TransactionReason.returned.toValue()]; - receiverId = null; - senderId = facilityId; + receiverId = facilityId; + senderId = null; } else if (reportType == InventoryReportType.damage) { transactionType = [TransactionType.dispatched.toValue()]; transactionReason = [ diff --git a/packages/inventory_management/lib/blocs/record_stock.dart b/packages/inventory_management/lib/blocs/record_stock.dart index 82ac8efbe..fa73f8c73 100644 --- a/packages/inventory_management/lib/blocs/record_stock.dart +++ b/packages/inventory_management/lib/blocs/record_stock.dart @@ -115,6 +115,7 @@ class RecordStockBloc extends Bloc { facilityId: facilityModel.id, rowVersion: 1, tenantId: InventorySingleton().tenantId, + dateOfEntry: dateOfRecord.millisecondsSinceEpoch, ), ); @@ -180,7 +181,7 @@ class RecordStockState with _$RecordStockState { String? primaryId, StockModel? stockModel, }) = RecordStockPersistedState; - } +} class InvalidRecordStockStateException implements Exception { final String? message; diff --git a/packages/inventory_management/lib/blocs/stock_reconciliation.dart b/packages/inventory_management/lib/blocs/stock_reconciliation.dart index 0d18c99e3..fb54385bc 100644 --- a/packages/inventory_management/lib/blocs/stock_reconciliation.dart +++ b/packages/inventory_management/lib/blocs/stock_reconciliation.dart @@ -31,6 +31,17 @@ class StockReconciliationBloc on(_handleSelectProduct); on(_handleCalculate); on(_handleCreate); + on(_handleSetDateOfReconciliation); + } + + // Event handler for selecting dateOfReconciliation + FutureOr _handleSetDateOfReconciliation( + StockReconciliationSetDateOfReconciliationEvent event, + StockReconciliationEmitter emit, + ) async { + // Emitting the state with the selected dateOfReconciliation + emit(state.copyWith(dateOfReconciliation: event.dateOfReconciliation)); + add(const StockReconciliationCalculateEvent()); } // Event handler for selecting a facility @@ -65,6 +76,7 @@ class StockReconciliationBloc final productVariantId = state.productVariantId; final facilityId = state.facilityModel?.id; + final dateOfReconciliation = state.dateOfReconciliation; if ((productVariantId == null) || (!event.isDistributor && facilityId == null)) return; @@ -93,10 +105,24 @@ class StockReconciliationBloc InventorySingleton().loggedInUserUuid) .toList(); + final stocks = [...receivedStocks, ...sentStocks]; + final dateFilteredStocks = stocks + .where( + (e) => + e.dateOfEntryTime == null || + (e.dateOfEntryTime!.year < dateOfReconciliation.year || + e.dateOfEntryTime!.year == dateOfReconciliation.year && + e.dateOfEntryTime!.month < dateOfReconciliation.month || + e.dateOfEntryTime!.year == dateOfReconciliation.year && + e.dateOfEntryTime!.month == dateOfReconciliation.month && + e.dateOfEntryTime!.day <= dateOfReconciliation.day), + ) + .toList(); + // Emitting the state with the fetched stock reconciliation details emit(state.copyWith( loading: false, - stockModels: [...receivedStocks, ...sentStocks], + stockModels: dateFilteredStocks, )); } @@ -161,6 +187,12 @@ class StockReconciliationEvent with _$StockReconciliationEvent { const factory StockReconciliationEvent.create( StockReconciliationModel stockReconciliationModel, ) = StockReconciliationCreateEvent; + + //Event For setting dateOfReconciliation + const factory StockReconciliationEvent.setDateOfReconciliation( + DateTime dateOfReconciliation, { + @Default(false) bool isDistributor, + }) = StockReconciliationSetDateOfReconciliationEvent; } // Freezed union class for stock reconciliation states diff --git a/packages/inventory_management/lib/blocs/stock_reconciliation.freezed.dart b/packages/inventory_management/lib/blocs/stock_reconciliation.freezed.dart index c102a0c1a..094766e2b 100644 --- a/packages/inventory_management/lib/blocs/stock_reconciliation.freezed.dart +++ b/packages/inventory_management/lib/blocs/stock_reconciliation.freezed.dart @@ -25,6 +25,8 @@ mixin _$StockReconciliationEvent { required TResult Function(bool isDistributor) calculate, required TResult Function(StockReconciliationModel stockReconciliationModel) create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -36,6 +38,8 @@ mixin _$StockReconciliationEvent { TResult? Function(bool isDistributor)? calculate, TResult? Function(StockReconciliationModel stockReconciliationModel)? create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -46,6 +50,8 @@ mixin _$StockReconciliationEvent { selectProduct, TResult Function(bool isDistributor)? calculate, TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -58,6 +64,9 @@ mixin _$StockReconciliationEvent { required TResult Function(StockReconciliationCalculateEvent value) calculate, required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -68,6 +77,8 @@ mixin _$StockReconciliationEvent { selectProduct, TResult? Function(StockReconciliationCalculateEvent value)? calculate, TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, }) => throw _privateConstructorUsedError; @optionalTypeArgs @@ -78,6 +89,8 @@ mixin _$StockReconciliationEvent { selectProduct, TResult Function(StockReconciliationCalculateEvent value)? calculate, TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, required TResult orElse(), }) => throw _privateConstructorUsedError; @@ -192,6 +205,8 @@ class _$StockReconciliationSelectFacilityEventImpl required TResult Function(bool isDistributor) calculate, required TResult Function(StockReconciliationModel stockReconciliationModel) create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, }) { return selectFacility(facilityModel, isDistributor); } @@ -206,6 +221,8 @@ class _$StockReconciliationSelectFacilityEventImpl TResult? Function(bool isDistributor)? calculate, TResult? Function(StockReconciliationModel stockReconciliationModel)? create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, }) { return selectFacility?.call(facilityModel, isDistributor); } @@ -219,6 +236,8 @@ class _$StockReconciliationSelectFacilityEventImpl selectProduct, TResult Function(bool isDistributor)? calculate, TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, required TResult orElse(), }) { if (selectFacility != null) { @@ -237,6 +256,9 @@ class _$StockReconciliationSelectFacilityEventImpl required TResult Function(StockReconciliationCalculateEvent value) calculate, required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, }) { return selectFacility(this); } @@ -250,6 +272,8 @@ class _$StockReconciliationSelectFacilityEventImpl selectProduct, TResult? Function(StockReconciliationCalculateEvent value)? calculate, TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, }) { return selectFacility?.call(this); } @@ -263,6 +287,8 @@ class _$StockReconciliationSelectFacilityEventImpl selectProduct, TResult Function(StockReconciliationCalculateEvent value)? calculate, TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, required TResult orElse(), }) { if (selectFacility != null) { @@ -376,6 +402,8 @@ class _$StockReconciliationSelectProductEventImpl required TResult Function(bool isDistributor) calculate, required TResult Function(StockReconciliationModel stockReconciliationModel) create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, }) { return selectProduct(productVariantId, isDistributor); } @@ -390,6 +418,8 @@ class _$StockReconciliationSelectProductEventImpl TResult? Function(bool isDistributor)? calculate, TResult? Function(StockReconciliationModel stockReconciliationModel)? create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, }) { return selectProduct?.call(productVariantId, isDistributor); } @@ -403,6 +433,8 @@ class _$StockReconciliationSelectProductEventImpl selectProduct, TResult Function(bool isDistributor)? calculate, TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, required TResult orElse(), }) { if (selectProduct != null) { @@ -421,6 +453,9 @@ class _$StockReconciliationSelectProductEventImpl required TResult Function(StockReconciliationCalculateEvent value) calculate, required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, }) { return selectProduct(this); } @@ -434,6 +469,8 @@ class _$StockReconciliationSelectProductEventImpl selectProduct, TResult? Function(StockReconciliationCalculateEvent value)? calculate, TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, }) { return selectProduct?.call(this); } @@ -447,6 +484,8 @@ class _$StockReconciliationSelectProductEventImpl selectProduct, TResult Function(StockReconciliationCalculateEvent value)? calculate, TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, required TResult orElse(), }) { if (selectProduct != null) { @@ -549,6 +588,8 @@ class _$StockReconciliationCalculateEventImpl required TResult Function(bool isDistributor) calculate, required TResult Function(StockReconciliationModel stockReconciliationModel) create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, }) { return calculate(isDistributor); } @@ -563,6 +604,8 @@ class _$StockReconciliationCalculateEventImpl TResult? Function(bool isDistributor)? calculate, TResult? Function(StockReconciliationModel stockReconciliationModel)? create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, }) { return calculate?.call(isDistributor); } @@ -576,6 +619,8 @@ class _$StockReconciliationCalculateEventImpl selectProduct, TResult Function(bool isDistributor)? calculate, TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, required TResult orElse(), }) { if (calculate != null) { @@ -594,6 +639,9 @@ class _$StockReconciliationCalculateEventImpl required TResult Function(StockReconciliationCalculateEvent value) calculate, required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, }) { return calculate(this); } @@ -607,6 +655,8 @@ class _$StockReconciliationCalculateEventImpl selectProduct, TResult? Function(StockReconciliationCalculateEvent value)? calculate, TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, }) { return calculate?.call(this); } @@ -620,6 +670,8 @@ class _$StockReconciliationCalculateEventImpl selectProduct, TResult Function(StockReconciliationCalculateEvent value)? calculate, TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, required TResult orElse(), }) { if (calculate != null) { @@ -720,6 +772,8 @@ class _$StockReconciliationCreateEventImpl required TResult Function(bool isDistributor) calculate, required TResult Function(StockReconciliationModel stockReconciliationModel) create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, }) { return create(stockReconciliationModel); } @@ -734,6 +788,8 @@ class _$StockReconciliationCreateEventImpl TResult? Function(bool isDistributor)? calculate, TResult? Function(StockReconciliationModel stockReconciliationModel)? create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, }) { return create?.call(stockReconciliationModel); } @@ -747,6 +803,8 @@ class _$StockReconciliationCreateEventImpl selectProduct, TResult Function(bool isDistributor)? calculate, TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, required TResult orElse(), }) { if (create != null) { @@ -765,6 +823,9 @@ class _$StockReconciliationCreateEventImpl required TResult Function(StockReconciliationCalculateEvent value) calculate, required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, }) { return create(this); } @@ -778,6 +839,8 @@ class _$StockReconciliationCreateEventImpl selectProduct, TResult? Function(StockReconciliationCalculateEvent value)? calculate, TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, }) { return create?.call(this); } @@ -791,6 +854,8 @@ class _$StockReconciliationCreateEventImpl selectProduct, TResult Function(StockReconciliationCalculateEvent value)? calculate, TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, required TResult orElse(), }) { if (create != null) { @@ -813,6 +878,211 @@ abstract class StockReconciliationCreateEvent get copyWith => throw _privateConstructorUsedError; } +/// @nodoc +abstract class _$$StockReconciliationSetDateOfReconciliationEventImplCopyWith< + $Res> { + factory _$$StockReconciliationSetDateOfReconciliationEventImplCopyWith( + _$StockReconciliationSetDateOfReconciliationEventImpl value, + $Res Function(_$StockReconciliationSetDateOfReconciliationEventImpl) + then) = + __$$StockReconciliationSetDateOfReconciliationEventImplCopyWithImpl<$Res>; + @useResult + $Res call({DateTime dateOfReconciliation, bool isDistributor}); +} + +/// @nodoc +class __$$StockReconciliationSetDateOfReconciliationEventImplCopyWithImpl<$Res> + extends _$StockReconciliationEventCopyWithImpl<$Res, + _$StockReconciliationSetDateOfReconciliationEventImpl> + implements + _$$StockReconciliationSetDateOfReconciliationEventImplCopyWith<$Res> { + __$$StockReconciliationSetDateOfReconciliationEventImplCopyWithImpl( + _$StockReconciliationSetDateOfReconciliationEventImpl _value, + $Res Function(_$StockReconciliationSetDateOfReconciliationEventImpl) + _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? dateOfReconciliation = null, + Object? isDistributor = null, + }) { + return _then(_$StockReconciliationSetDateOfReconciliationEventImpl( + null == dateOfReconciliation + ? _value.dateOfReconciliation + : dateOfReconciliation // ignore: cast_nullable_to_non_nullable + as DateTime, + isDistributor: null == isDistributor + ? _value.isDistributor + : isDistributor // ignore: cast_nullable_to_non_nullable + as bool, + )); + } +} + +/// @nodoc + +class _$StockReconciliationSetDateOfReconciliationEventImpl + implements StockReconciliationSetDateOfReconciliationEvent { + const _$StockReconciliationSetDateOfReconciliationEventImpl( + this.dateOfReconciliation, + {this.isDistributor = false}); + + @override + final DateTime dateOfReconciliation; + @override + @JsonKey() + final bool isDistributor; + + @override + String toString() { + return 'StockReconciliationEvent.setDateOfReconciliation(dateOfReconciliation: $dateOfReconciliation, isDistributor: $isDistributor)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$StockReconciliationSetDateOfReconciliationEventImpl && + (identical(other.dateOfReconciliation, dateOfReconciliation) || + other.dateOfReconciliation == dateOfReconciliation) && + (identical(other.isDistributor, isDistributor) || + other.isDistributor == isDistributor)); + } + + @override + int get hashCode => + Object.hash(runtimeType, dateOfReconciliation, isDistributor); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$StockReconciliationSetDateOfReconciliationEventImplCopyWith< + _$StockReconciliationSetDateOfReconciliationEventImpl> + get copyWith => + __$$StockReconciliationSetDateOfReconciliationEventImplCopyWithImpl< + _$StockReconciliationSetDateOfReconciliationEventImpl>( + this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(FacilityModel facilityModel, bool isDistributor) + selectFacility, + required TResult Function(String? productVariantId, bool isDistributor) + selectProduct, + required TResult Function(bool isDistributor) calculate, + required TResult Function(StockReconciliationModel stockReconciliationModel) + create, + required TResult Function(DateTime dateOfReconciliation, bool isDistributor) + setDateOfReconciliation, + }) { + return setDateOfReconciliation(dateOfReconciliation, isDistributor); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(FacilityModel facilityModel, bool isDistributor)? + selectFacility, + TResult? Function(String? productVariantId, bool isDistributor)? + selectProduct, + TResult? Function(bool isDistributor)? calculate, + TResult? Function(StockReconciliationModel stockReconciliationModel)? + create, + TResult? Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, + }) { + return setDateOfReconciliation?.call(dateOfReconciliation, isDistributor); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(FacilityModel facilityModel, bool isDistributor)? + selectFacility, + TResult Function(String? productVariantId, bool isDistributor)? + selectProduct, + TResult Function(bool isDistributor)? calculate, + TResult Function(StockReconciliationModel stockReconciliationModel)? create, + TResult Function(DateTime dateOfReconciliation, bool isDistributor)? + setDateOfReconciliation, + required TResult orElse(), + }) { + if (setDateOfReconciliation != null) { + return setDateOfReconciliation(dateOfReconciliation, isDistributor); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(StockReconciliationSelectFacilityEvent value) + selectFacility, + required TResult Function(StockReconciliationSelectProductEvent value) + selectProduct, + required TResult Function(StockReconciliationCalculateEvent value) + calculate, + required TResult Function(StockReconciliationCreateEvent value) create, + required TResult Function( + StockReconciliationSetDateOfReconciliationEvent value) + setDateOfReconciliation, + }) { + return setDateOfReconciliation(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(StockReconciliationSelectFacilityEvent value)? + selectFacility, + TResult? Function(StockReconciliationSelectProductEvent value)? + selectProduct, + TResult? Function(StockReconciliationCalculateEvent value)? calculate, + TResult? Function(StockReconciliationCreateEvent value)? create, + TResult? Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, + }) { + return setDateOfReconciliation?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(StockReconciliationSelectFacilityEvent value)? + selectFacility, + TResult Function(StockReconciliationSelectProductEvent value)? + selectProduct, + TResult Function(StockReconciliationCalculateEvent value)? calculate, + TResult Function(StockReconciliationCreateEvent value)? create, + TResult Function(StockReconciliationSetDateOfReconciliationEvent value)? + setDateOfReconciliation, + required TResult orElse(), + }) { + if (setDateOfReconciliation != null) { + return setDateOfReconciliation(this); + } + return orElse(); + } +} + +abstract class StockReconciliationSetDateOfReconciliationEvent + implements StockReconciliationEvent { + const factory StockReconciliationSetDateOfReconciliationEvent( + final DateTime dateOfReconciliation, + {final bool isDistributor}) = + _$StockReconciliationSetDateOfReconciliationEventImpl; + + DateTime get dateOfReconciliation; + bool get isDistributor; + @JsonKey(ignore: true) + _$$StockReconciliationSetDateOfReconciliationEventImplCopyWith< + _$StockReconciliationSetDateOfReconciliationEventImpl> + get copyWith => throw _privateConstructorUsedError; +} + /// @nodoc mixin _$StockReconciliationState { bool get loading => throw _privateConstructorUsedError; diff --git a/packages/inventory_management/lib/data/repositories/local/stock.dart b/packages/inventory_management/lib/data/repositories/local/stock.dart index b50043d79..e9b2e67ab 100644 --- a/packages/inventory_management/lib/data/repositories/local/stock.dart +++ b/packages/inventory_management/lib/data/repositories/local/stock.dart @@ -89,10 +89,14 @@ class StockLocalRepository transactingPartyId: data.transactingPartyId, transactingPartyType: data.transactingPartyType, quantity: data.quantity, - waybillNumber: data.waybillNumber, + wayBillNumber: data.waybillNumber, clientReferenceId: data.clientReferenceId, isDeleted: data.isDeleted, rowVersion: data.rowVersion, + dateOfEntry: data.dateOfEntry, + additionalFields: data.additionalFields == null + ? null + : StockAdditionalFieldsMapper.fromJson(data.additionalFields), auditDetails: createdTime == null || createdBy == null ? null : AuditDetails(createdTime: createdTime, createdBy: createdBy), diff --git a/packages/inventory_management/lib/models/entities/stock.dart b/packages/inventory_management/lib/models/entities/stock.dart index ea66c3e19..79e8f797c 100644 --- a/packages/inventory_management/lib/models/entities/stock.dart +++ b/packages/inventory_management/lib/models/entities/stock.dart @@ -22,6 +22,7 @@ class StockSearchModel extends EntitySearchModel with StockSearchModelMappable { final List? clientReferenceId; final List? transactionType; final List? transactionReason; + final DateTime? dateOfEntryTime; StockSearchModel({ this.id, @@ -39,9 +40,13 @@ class StockSearchModel extends EntitySearchModel with StockSearchModelMappable { this.clientReferenceId, this.transactionType, this.transactionReason, + int? dateOfEntry, super.boundaryCode, super.isDeleted, - }) : super(); + }) : dateOfEntryTime = dateOfEntry == null + ? null + : DateTime.fromMillisecondsSinceEpoch(dateOfEntry), + super(); @MappableConstructor() StockSearchModel.ignoreDeleted({ @@ -60,8 +65,14 @@ class StockSearchModel extends EntitySearchModel with StockSearchModelMappable { this.clientReferenceId, this.transactionType, this.transactionReason, + int? dateOfEntry, super.boundaryCode, - }) : super(isDeleted: false); + }) : dateOfEntryTime = dateOfEntry == null + ? null + : DateTime.fromMillisecondsSinceEpoch(dateOfEntry), + super(isDeleted: false); + + int? get dateOfEntry => dateOfEntryTime?.millisecondsSinceEpoch; } @MappableClass(ignoreNull: true, discriminatorValue: MappableClass.useAsDefault) @@ -77,7 +88,7 @@ class StockModel extends EntityModel with StockModelMappable { final String? transactingPartyId; final String? transactingPartyType; final String? quantity; - final String? waybillNumber; + final String? wayBillNumber; final String? receiverId; final String? receiverType; final String? senderId; @@ -88,8 +99,10 @@ class StockModel extends EntityModel with StockModelMappable { final String? transactionType; final String? transactionReason; final StockAdditionalFields? additionalFields; + final DateTime? dateOfEntryTime; StockModel({ + int? dateOfEntry, this.additionalFields, this.id, this.tenantId, @@ -100,7 +113,7 @@ class StockModel extends EntityModel with StockModelMappable { this.transactingPartyId, this.transactingPartyType, this.quantity, - this.waybillNumber, + this.wayBillNumber, this.receiverId, this.receiverType, this.senderId, @@ -113,7 +126,12 @@ class StockModel extends EntityModel with StockModelMappable { super.auditDetails, super.clientAuditDetails, super.isDeleted = false, - }) : super(); + }) : dateOfEntryTime = dateOfEntry == null + ? null + : DateTime.fromMillisecondsSinceEpoch(dateOfEntry), + super(); + + int? get dateOfEntry => dateOfEntryTime?.millisecondsSinceEpoch; StockCompanion get companion { return StockCompanion( @@ -136,7 +154,7 @@ class StockModel extends EntityModel with StockModelMappable { transactingPartyId: Value(transactingPartyId), transactingPartyType: Value(transactingPartyType), quantity: Value(quantity), - waybillNumber: Value(waybillNumber), + waybillNumber: Value(wayBillNumber), receiverId: Value(receiverId), receiverType: Value(receiverType), senderId: Value(senderId), @@ -146,6 +164,7 @@ class StockModel extends EntityModel with StockModelMappable { rowVersion: Value(rowVersion), transactionType: Value(transactionType), transactionReason: Value(transactionReason), + dateOfEntry: Value(dateOfEntry), ); } } diff --git a/packages/inventory_management/lib/models/entities/stock.mapper.dart b/packages/inventory_management/lib/models/entities/stock.mapper.dart index c34205004..7780aa6e6 100644 --- a/packages/inventory_management/lib/models/entities/stock.mapper.dart +++ b/packages/inventory_management/lib/models/entities/stock.mapper.dart @@ -70,6 +70,9 @@ class StockSearchModelMapper extends SubClassMapperBase { v.transactionReason; static const Field> _f$transactionReason = Field('transactionReason', _$transactionReason, opt: true); + static int? _$dateOfEntry(StockSearchModel v) => v.dateOfEntry; + static const Field _f$dateOfEntry = + Field('dateOfEntry', _$dateOfEntry, opt: true); static String? _$boundaryCode(StockSearchModel v) => v.boundaryCode; static const Field _f$boundaryCode = Field('boundaryCode', _$boundaryCode, opt: true); @@ -80,6 +83,9 @@ class StockSearchModelMapper extends SubClassMapperBase { v.additionalFields; static const Field _f$additionalFields = Field('additionalFields', _$additionalFields, mode: FieldMode.member); + static DateTime? _$dateOfEntryTime(StockSearchModel v) => v.dateOfEntryTime; + static const Field _f$dateOfEntryTime = + Field('dateOfEntryTime', _$dateOfEntryTime, mode: FieldMode.member); @override final MappableFields fields = const { @@ -98,9 +104,11 @@ class StockSearchModelMapper extends SubClassMapperBase { #clientReferenceId: _f$clientReferenceId, #transactionType: _f$transactionType, #transactionReason: _f$transactionReason, + #dateOfEntry: _f$dateOfEntry, #boundaryCode: _f$boundaryCode, #auditDetails: _f$auditDetails, #additionalFields: _f$additionalFields, + #dateOfEntryTime: _f$dateOfEntryTime, }; @override final bool ignoreNull = true; @@ -130,6 +138,7 @@ class StockSearchModelMapper extends SubClassMapperBase { clientReferenceId: data.dec(_f$clientReferenceId), transactionType: data.dec(_f$transactionType), transactionReason: data.dec(_f$transactionReason), + dateOfEntry: data.dec(_f$dateOfEntry), boundaryCode: data.dec(_f$boundaryCode)); } @@ -212,6 +221,7 @@ abstract class StockSearchModelCopyWith<$R, $In extends StockSearchModel, $Out> List? clientReferenceId, List? transactionType, List? transactionReason, + int? dateOfEntry, String? boundaryCode}); StockSearchModelCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( Then<$Out2, $R2> t); @@ -266,6 +276,7 @@ class _StockSearchModelCopyWithImpl<$R, $Out> Object? clientReferenceId = $none, Object? transactionType = $none, Object? transactionReason = $none, + Object? dateOfEntry = $none, Object? boundaryCode = $none}) => $apply(FieldCopyWithData({ if (id != $none) #id: id, @@ -285,6 +296,7 @@ class _StockSearchModelCopyWithImpl<$R, $Out> if (clientReferenceId != $none) #clientReferenceId: clientReferenceId, if (transactionType != $none) #transactionType: transactionType, if (transactionReason != $none) #transactionReason: transactionReason, + if (dateOfEntry != $none) #dateOfEntry: dateOfEntry, if (boundaryCode != $none) #boundaryCode: boundaryCode })); @override @@ -309,6 +321,7 @@ class _StockSearchModelCopyWithImpl<$R, $Out> transactionType: data.get(#transactionType, or: $value.transactionType), transactionReason: data.get(#transactionReason, or: $value.transactionReason), + dateOfEntry: data.get(#dateOfEntry, or: $value.dateOfEntry), boundaryCode: data.get(#boundaryCode, or: $value.boundaryCode)); @override @@ -331,6 +344,9 @@ class StockModelMapper extends SubClassMapperBase { @override final String id = 'StockModel'; + static int? _$dateOfEntry(StockModel v) => v.dateOfEntry; + static const Field _f$dateOfEntry = + Field('dateOfEntry', _$dateOfEntry, opt: true); static StockAdditionalFields? _$additionalFields(StockModel v) => v.additionalFields; static const Field _f$additionalFields = @@ -361,9 +377,9 @@ class StockModelMapper extends SubClassMapperBase { static String? _$quantity(StockModel v) => v.quantity; static const Field _f$quantity = Field('quantity', _$quantity, opt: true); - static String? _$waybillNumber(StockModel v) => v.waybillNumber; - static const Field _f$waybillNumber = - Field('waybillNumber', _$waybillNumber, opt: true); + static String? _$wayBillNumber(StockModel v) => v.wayBillNumber; + static const Field _f$wayBillNumber = + Field('wayBillNumber', _$wayBillNumber, opt: true); static String? _$receiverId(StockModel v) => v.receiverId; static const Field _f$receiverId = Field('receiverId', _$receiverId, opt: true); @@ -402,9 +418,13 @@ class StockModelMapper extends SubClassMapperBase { static bool? _$isDeleted(StockModel v) => v.isDeleted; static const Field _f$isDeleted = Field('isDeleted', _$isDeleted, opt: true, def: false); + static DateTime? _$dateOfEntryTime(StockModel v) => v.dateOfEntryTime; + static const Field _f$dateOfEntryTime = + Field('dateOfEntryTime', _$dateOfEntryTime, mode: FieldMode.member); @override final MappableFields fields = const { + #dateOfEntry: _f$dateOfEntry, #additionalFields: _f$additionalFields, #id: _f$id, #tenantId: _f$tenantId, @@ -415,7 +435,7 @@ class StockModelMapper extends SubClassMapperBase { #transactingPartyId: _f$transactingPartyId, #transactingPartyType: _f$transactingPartyType, #quantity: _f$quantity, - #waybillNumber: _f$waybillNumber, + #wayBillNumber: _f$wayBillNumber, #receiverId: _f$receiverId, #receiverType: _f$receiverType, #senderId: _f$senderId, @@ -428,6 +448,7 @@ class StockModelMapper extends SubClassMapperBase { #auditDetails: _f$auditDetails, #clientAuditDetails: _f$clientAuditDetails, #isDeleted: _f$isDeleted, + #dateOfEntryTime: _f$dateOfEntryTime, }; @override final bool ignoreNull = true; @@ -442,6 +463,7 @@ class StockModelMapper extends SubClassMapperBase { static StockModel _instantiate(DecodingData data) { return StockModel( + dateOfEntry: data.dec(_f$dateOfEntry), additionalFields: data.dec(_f$additionalFields), id: data.dec(_f$id), tenantId: data.dec(_f$tenantId), @@ -452,7 +474,7 @@ class StockModelMapper extends SubClassMapperBase { transactingPartyId: data.dec(_f$transactingPartyId), transactingPartyType: data.dec(_f$transactingPartyType), quantity: data.dec(_f$quantity), - waybillNumber: data.dec(_f$waybillNumber), + wayBillNumber: data.dec(_f$wayBillNumber), receiverId: data.dec(_f$receiverId), receiverType: data.dec(_f$receiverType), senderId: data.dec(_f$senderId), @@ -529,7 +551,8 @@ abstract class StockModelCopyWith<$R, $In extends StockModel, $Out> get clientAuditDetails; @override $R call( - {StockAdditionalFields? additionalFields, + {int? dateOfEntry, + StockAdditionalFields? additionalFields, String? id, String? tenantId, String? facilityId, @@ -539,7 +562,7 @@ abstract class StockModelCopyWith<$R, $In extends StockModel, $Out> String? transactingPartyId, String? transactingPartyType, String? quantity, - String? waybillNumber, + String? wayBillNumber, String? receiverId, String? receiverType, String? senderId, @@ -577,7 +600,8 @@ class _StockModelCopyWithImpl<$R, $Out> .$chain((v) => call(clientAuditDetails: v)); @override $R call( - {Object? additionalFields = $none, + {Object? dateOfEntry = $none, + Object? additionalFields = $none, Object? id = $none, Object? tenantId = $none, Object? facilityId = $none, @@ -587,7 +611,7 @@ class _StockModelCopyWithImpl<$R, $Out> Object? transactingPartyId = $none, Object? transactingPartyType = $none, Object? quantity = $none, - Object? waybillNumber = $none, + Object? wayBillNumber = $none, Object? receiverId = $none, Object? receiverType = $none, Object? senderId = $none, @@ -601,6 +625,7 @@ class _StockModelCopyWithImpl<$R, $Out> Object? clientAuditDetails = $none, Object? isDeleted = $none}) => $apply(FieldCopyWithData({ + if (dateOfEntry != $none) #dateOfEntry: dateOfEntry, if (additionalFields != $none) #additionalFields: additionalFields, if (id != $none) #id: id, if (tenantId != $none) #tenantId: tenantId, @@ -613,7 +638,7 @@ class _StockModelCopyWithImpl<$R, $Out> if (transactingPartyType != $none) #transactingPartyType: transactingPartyType, if (quantity != $none) #quantity: quantity, - if (waybillNumber != $none) #waybillNumber: waybillNumber, + if (wayBillNumber != $none) #wayBillNumber: wayBillNumber, if (receiverId != $none) #receiverId: receiverId, if (receiverType != $none) #receiverType: receiverType, if (senderId != $none) #senderId: senderId, @@ -631,6 +656,7 @@ class _StockModelCopyWithImpl<$R, $Out> })); @override StockModel $make(CopyWithData data) => StockModel( + dateOfEntry: data.get(#dateOfEntry, or: $value.dateOfEntry), additionalFields: data.get(#additionalFields, or: $value.additionalFields), id: data.get(#id, or: $value.id), @@ -645,7 +671,7 @@ class _StockModelCopyWithImpl<$R, $Out> transactingPartyType: data.get(#transactingPartyType, or: $value.transactingPartyType), quantity: data.get(#quantity, or: $value.quantity), - waybillNumber: data.get(#waybillNumber, or: $value.waybillNumber), + wayBillNumber: data.get(#wayBillNumber, or: $value.wayBillNumber), receiverId: data.get(#receiverId, or: $value.receiverId), receiverType: data.get(#receiverType, or: $value.receiverType), senderId: data.get(#senderId, or: $value.senderId), diff --git a/packages/inventory_management/lib/pages/record_stock/stock_details.dart b/packages/inventory_management/lib/pages/record_stock/stock_details.dart index ac1373925..be040e8e4 100644 --- a/packages/inventory_management/lib/pages/record_stock/stock_details.dart +++ b/packages/inventory_management/lib/pages/record_stock/stock_details.dart @@ -60,7 +60,9 @@ class StockDetailsPageState extends LocalizedState { Validators.max(10000), ]), _transactionReasonKey: FormControl(), - _waybillNumberKey: FormControl(), + _waybillNumberKey: FormControl( + validators: [Validators.minLength(2), Validators.maxLength(200)], + ), _waybillQuantityKey: FormControl(), _vehicleNumberKey: FormControl(), _typeOfTransportKey: FormControl(), @@ -385,6 +387,7 @@ class StockDetailsPageState extends LocalizedState { case StockRecordEntryType.receipt: case StockRecordEntryType.loss: case StockRecordEntryType.damaged: + case StockRecordEntryType.returned: if (deliveryTeamSelected) { senderId = deliveryTeamName; senderType = "STAFF"; @@ -397,7 +400,6 @@ class StockDetailsPageState extends LocalizedState { break; case StockRecordEntryType.dispatch: - case StockRecordEntryType.returned: if (deliveryTeamSelected) { receiverId = deliveryTeamName; receiverType = "STAFF"; @@ -420,7 +422,7 @@ class StockDetailsPageState extends LocalizedState { referenceId: stockState.projectId, referenceIdType: 'PROJECT', quantity: quantity.toString(), - waybillNumber: waybillNumber, + wayBillNumber: waybillNumber, receiverId: receiverId, receiverType: receiverType, senderId: senderId, @@ -834,16 +836,25 @@ class StockDetailsPageState extends LocalizedState { ), if (isWareHouseMgr) DigitTextFormField( - key: const Key(_waybillNumberKey), - label: localizations.translate( - i18.stockDetails.waybillNumberLabel, - ), - formControlName: _waybillNumberKey, - keyboardType: - const TextInputType.numberWithOptions( - decimal: true, - ), - ), + key: const Key(_waybillNumberKey), + label: localizations.translate( + i18.stockDetails.waybillNumberLabel, + ), + formControlName: _waybillNumberKey, + keyboardType: + const TextInputType.numberWithOptions( + decimal: true, + ), + validationMessages: { + 'maxLength': (object) => localizations + .translate( + i18.common.maxCharsRequired) + .replaceAll('{}', '200'), + 'minLength': (object) => localizations + .translate( + i18.common.min2CharsRequired) + .replaceAll('{}', ''), + }), if (isWareHouseMgr) DigitTextFormField( label: localizations.translate( diff --git a/packages/inventory_management/lib/pages/reports/report_details.dart b/packages/inventory_management/lib/pages/reports/report_details.dart index 19b1aef9d..1cefbb72c 100644 --- a/packages/inventory_management/lib/pages/reports/report_details.dart +++ b/packages/inventory_management/lib/pages/reports/report_details.dart @@ -458,9 +458,9 @@ class InventoryReportDetailsPageState DigitGridCell( key: waybillKey, value: model - .waybillNumber ?? + .wayBillNumber ?? model - .waybillNumber ?? + .wayBillNumber ?? '', ), DigitGridCell( diff --git a/packages/inventory_management/pubspec.lock b/packages/inventory_management/pubspec.lock index 8135fff11..20b6fea71 100644 --- a/packages/inventory_management/pubspec.lock +++ b/packages/inventory_management/pubspec.lock @@ -422,18 +422,18 @@ 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: name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" + sha256: df389a1972ddc9d59b2f7e1375a04bab88700ae4cc876e5cb83e8fbfe55cfa62 url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.10-uniqueId" digit_scanner: dependency: "direct main" description: diff --git a/packages/inventory_management/pubspec.yaml b/packages/inventory_management/pubspec.yaml index 29c0c7f95..fd0ff13a9 100644 --- a/packages/inventory_management/pubspec.yaml +++ b/packages/inventory_management/pubspec.yaml @@ -1,6 +1,6 @@ name: inventory_management description: This package offers inventory management features, allowing users to view stock reports and perform inventory resource reconciliation. -version: 1.0.3+2 +version: 1.0.3-dev.5 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/inventory_management repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -32,7 +32,7 @@ dependencies: digit_scanner: ^1.0.3+1 gs1_barcode_parser: ^1.0.5 auto_route: ^7.8.4 - digit_data_model: ^1.0.3+1 + digit_data_model: ^1.0.4-dev.10-uniqueId collection: ^1.16.0 dev_dependencies: diff --git a/packages/referral_reconciliation/CHANGELOG.md b/packages/referral_reconciliation/CHANGELOG.md index 00372f19e..9e9878980 100644 --- a/packages/referral_reconciliation/CHANGELOG.md +++ b/packages/referral_reconciliation/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.2-dev.1 +* Incorporated ProjectFacilityBloc changes +* Updated digit_data_model dev version with the latest changes + ## 1.0.2+1 * Updated digit_scanner package, digit_components, digit_data_model diff --git a/packages/referral_reconciliation/lib/pages/create_referral/record_facility_details.dart b/packages/referral_reconciliation/lib/pages/create_referral/record_facility_details.dart index 0f2bb4a98..dd07f4727 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/record_facility_details.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/record_facility_details.dart @@ -72,7 +72,7 @@ class _ReferralFacilityPageState extends LocalizedState { builder: (ctx, facilityState) { return facilityState.maybeWhen( orElse: () => const SizedBox.shrink(), - fetched: (facilities) { + fetched: (facilities, facilityMap) { final projectFacilities = facilities .where((e) => e.id != 'N/A' && e.id != 'Delivery Team') .toList(); @@ -306,8 +306,9 @@ class _ReferralFacilityPageState extends LocalizedState { ), ); - if (facility == null) + if (facility == null) { return; + } form .control( _evaluationFacilityKey, diff --git a/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart b/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart index 5a5303e09..5a9796e75 100644 --- a/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart +++ b/packages/referral_reconciliation/lib/pages/create_referral/record_reason_checklist.dart @@ -163,29 +163,30 @@ class _ReferralReasonChecklistPageState context.read().add( ServiceCreateEvent( serviceModel: ServiceModel( - createdAt: DigitDateUtils - .getDateFromTimestamp( - DateTime.now() - .toLocal() - .millisecondsSinceEpoch, - dateFormat: defaultDateTimeFormat, - ), - tenantId: value - .selectedServiceDefinition! - .tenantId, - clientId: widget.referralClientRefId - .toString(), - serviceDefId: value - .selectedServiceDefinition?.id, - attributes: attributes, - rowVersion: 1, - accountId: ReferralReconSingleton() - .projectId, - additionalDetails: - ReferralReconSingleton() - .boundary - ?.code, - ), + createdAt: DigitDateUtils + .getDateFromTimestamp( + DateTime.now() + .toLocal() + .millisecondsSinceEpoch, + dateFormat: defaultDateTimeFormat, + ), + tenantId: value + .selectedServiceDefinition! + .tenantId, + clientId: widget.referralClientRefId + .toString(), + serviceDefId: value + .selectedServiceDefinition?.id, + attributes: attributes, + rowVersion: 1, + accountId: ReferralReconSingleton() + .projectId, + additionalDetails: { + "boundaryCode": + ReferralReconSingleton() + .boundary! + .code, + }), ), ); diff --git a/packages/referral_reconciliation/lib/widgets/project_facility_bloc_wrapper.dart b/packages/referral_reconciliation/lib/widgets/project_facility_bloc_wrapper.dart index e49e0272e..def597a88 100644 --- a/packages/referral_reconciliation/lib/widgets/project_facility_bloc_wrapper.dart +++ b/packages/referral_reconciliation/lib/widgets/project_facility_bloc_wrapper.dart @@ -16,11 +16,14 @@ class ProjectFacilityBlocWrapper extends StatelessWidget { @override Widget build(BuildContext context) { + final facilityRepository = + context.read>(); return BlocProvider( create: (_) => ProjectFacilityBloc( const ProjectFacilityEmptyState(), projectFacilityDataRepository: context.repository(context), + facilityDataRepository: facilityRepository, )..add(ProjectFacilityLoadEvent( query: ProjectFacilitySearchModel( projectId: [ReferralReconSingleton().projectId]))), diff --git a/packages/referral_reconciliation/pubspec.lock b/packages/referral_reconciliation/pubspec.lock index 60830a342..30bde96b2 100644 --- a/packages/referral_reconciliation/pubspec.lock +++ b/packages/referral_reconciliation/pubspec.lock @@ -422,18 +422,18 @@ 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: name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" + sha256: "139d193f202db85e685a9da6e33fe9ea17b7856cc5415413830bff8dfd67d33e" url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.9-uniqueId" digit_scanner: dependency: "direct main" description: diff --git a/packages/referral_reconciliation/pubspec.yaml b/packages/referral_reconciliation/pubspec.yaml index 4813ae9df..6054bf73e 100644 --- a/packages/referral_reconciliation/pubspec.yaml +++ b/packages/referral_reconciliation/pubspec.yaml @@ -1,6 +1,6 @@ name: referral_reconciliation description: "This module will enable the health facility supervisors to track referrals made by on-field health workers to different health facilities digitally via the Digit HCM app" -version: 1.0.2+1 +version: 1.0.2-dev.1 homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/referral_reconciliation repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -11,7 +11,7 @@ environment: dependencies: flutter: sdk: flutter - digit_components: ^1.0.1+1 + digit_components: ^1.0.2+1 flutter_bloc: ^8.1.1 freezed_annotation: ^2.1.0 reactive_forms: ^14.1.0 @@ -33,7 +33,7 @@ dependencies: flutter_keyboard_visibility: ^5.4.0 auto_route: ^7.8.4 collection: ^1.16.0 - digit_data_model: ^1.0.3+1 + digit_data_model: ^1.0.4-dev.9-uniqueId stream_transform: ^2.1.0 dev_dependencies: diff --git a/packages/registration_delivery/CHANGELOG.md b/packages/registration_delivery/CHANGELOG.md index 10e985d7e..a0a5fed06 100644 --- a/packages/registration_delivery/CHANGELOG.md +++ b/packages/registration_delivery/CHANGELOG.md @@ -1,8 +1,58 @@ +## 1.0.4-dev.8-search-fix + +* BeneficiaryReferred search query fix +* Check to avoid duplicate entry in containers +* Fetching all individuals from members after query search + +## 1.0.4-dev.7-search-fix + +* Added facility repo reference to ProjectFacilityBloc + +## 1.0.4-dev.6-search-fix + +* Update of existing record fix before update for task, individual and household +* Updated data_model to latest dev version with unique beneficiary id changes + +## 1.0.4-dev.5-search-fix + +* Added facility name in facility local repo +* Updated type check in progress for beneficiary type + +## 1.0.4-dev.4-search-fix + +* Changed additionalDetails of ServiceModel to Map + +## 1.0.4 + +* Bug Fix - + * Updated query search for beneficiary referred status + +## 1.0.4-dev.3-search-fix + +* Bug Fix - + * Individual, Household search for child query fix + +## 1.0.4-dev.2-uniqueId + +* Unique Beneficiary Id link to identifier +* Updated digit_data_model package + +## 1.0.4-dev.1-uniqueId + +* Added BeneficiaryInEligible status +* Added utils function to get unique beneficiary id + +## 1.0.3+2 + +* Bug Fix - + * fixed wrong status map of beneficiaryRefused in utils +* Sorting tasks based on createTime + ## 1.0.3+1 * Bug Fixes - - * Reload fix after edit - * Project Beneficiary create for all members if not registered for campaign + * Reload fix after edit + * Project Beneficiary create for all members if not registered for campaign * Updated digit_scanner package, digit_components, digit_data_model ## 1.0.3 @@ -21,11 +71,11 @@ ## 1.0.3-dev.10 -* Removed stepper if number of deliveries is greater than 1 +* Removed stepper if number of deliveries is greater than 1 ## 1.0.3-dev.9 -* Updated localization key +* Updated localization key * Resolved taskStatus key from task table entity ## 1.0.3-dev.8 @@ -42,7 +92,7 @@ ## 1.0.3-dev.5 -* Added count for filter search +* Added count for filter search * Bug fixes ## 1.0.3-dev.4 @@ -53,7 +103,6 @@ * Closed household flow change - ## 1.0.3-dev.2 * Closed household search fixes @@ -129,7 +178,7 @@ ## 0.0.0-dev.2 -* Boundary v2 Integrated, to use Boundary v1 0.0.0-dev.1 version can be used +* Boundary v2 Integrated, to use Boundary v1 0.0.0-dev.1 version can be used ## 0.0.0-dev.1 diff --git a/packages/registration_delivery/lib/blocs/beneficiary_registration/beneficiary_registration.dart b/packages/registration_delivery/lib/blocs/beneficiary_registration/beneficiary_registration.dart index ba5a9736b..e24e94826 100644 --- a/packages/registration_delivery/lib/blocs/beneficiary_registration/beneficiary_registration.dart +++ b/packages/registration_delivery/lib/blocs/beneficiary_registration/beneficiary_registration.dart @@ -409,6 +409,11 @@ class BeneficiaryRegistrationBloc editHousehold: (value) async { emit(value.copyWith(loading: true)); try { + final HouseholdModel? existingHousehold = + (await householdRepository.search(HouseholdSearchModel( + clientReferenceId: [value.householdModel.clientReferenceId], + ))) + .firstOrNull; await householdRepository.update( event.household.copyWith( clientAuditDetails: ClientAuditDetails( @@ -426,6 +431,10 @@ class BeneficiaryRegistrationBloc relatedClientReferenceId: value.householdModel.clientReferenceId, ), + id: existingHousehold?.id, + rowVersion: existingHousehold?.rowVersion ?? 1, + nonRecoverableError: + existingHousehold?.nonRecoverableError ?? false, ), ); final projectBeneficiary = await projectBeneficiaryRepository.search( @@ -492,6 +501,11 @@ class BeneficiaryRegistrationBloc } for (var element in value.individualModel) { + final IndividualModel? existingIndividual = + (await individualRepository.search(IndividualSearchModel( + clientReferenceId: [element.clientReferenceId], + ))) + .firstOrNull; await individualRepository.update( element.copyWith( address: [ @@ -503,6 +517,10 @@ class BeneficiaryRegistrationBloc ); }), ], + id: existingIndividual?.id, + rowVersion: existingIndividual?.rowVersion ?? 1, + nonRecoverableError: + existingIndividual?.nonRecoverableError ?? false, ), ); } @@ -548,7 +566,17 @@ class BeneficiaryRegistrationBloc ], ), ); - await individualRepository.update(individual); + final IndividualModel? existingIndividual = + (await individualRepository.search(IndividualSearchModel( + clientReferenceId: [individual.clientReferenceId], + ))) + .firstOrNull; + await individualRepository.update(individual.copyWith( + id: existingIndividual?.id, + rowVersion: existingIndividual?.rowVersion ?? 1, + nonRecoverableError: + existingIndividual?.nonRecoverableError ?? false, + )); if (projectBeneficiary.isNotEmpty) { if (projectBeneficiary.first.tag != event.tag) { await projectBeneficiaryRepository diff --git a/packages/registration_delivery/lib/blocs/delivery_intervention/deliver_intervention.dart b/packages/registration_delivery/lib/blocs/delivery_intervention/deliver_intervention.dart index 8ccbd43a2..f1a09f106 100644 --- a/packages/registration_delivery/lib/blocs/delivery_intervention/deliver_intervention.dart +++ b/packages/registration_delivery/lib/blocs/delivery_intervention/deliver_intervention.dart @@ -39,7 +39,15 @@ class DeliverInterventionBloc try { if (event.isEditing) { if (!event.navigateToSummary) { + final TaskModel? existingTask = + (await taskRepository.search(TaskSearchModel( + clientReferenceId: [event.task.clientReferenceId], + ))) + .firstOrNull; await taskRepository.update(event.task.copyWith( + id: existingTask?.id, + rowVersion: existingTask?.rowVersion ?? 1, + nonRecoverableError: existingTask?.nonRecoverableError ?? false, clientAuditDetails: (event.task.clientAuditDetails?.createdBy != null && event.task.clientAuditDetails?.createdTime != null) 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 4a6c6354f..9f9e5f765 100644 --- a/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart +++ b/packages/registration_delivery/lib/blocs/household_overview/household_overview.dart @@ -173,10 +173,9 @@ class HouseholdOverviewBloc } // Search for tasks associated with project beneficiaries. - final tasks = await taskDataRepository.search(TaskSearchModel( - projectBeneficiaryClientReferenceId: - projectBeneficiaries.map((e) => e.clientReferenceId).toList(), - )); + var tasks = await taskDataRepository.search(TaskSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiaries.map((e) => e.clientReferenceId).toList())); // Search for adverse events associated with tasks. final sideEffects = @@ -223,16 +222,65 @@ class HouseholdOverviewBloc HouseholdOverviewEmitter emit, ) async { // Delete the household from the repository. + final HouseholdModel? existingHousehold = + (await householdRepository.search(HouseholdSearchModel( + clientReferenceId: [event.householdModel.clientReferenceId], + ))) + .firstOrNull; await householdRepository.delete( event.householdModel.copyWith( - rowVersion: event.householdModel.rowVersion, + id: existingHousehold?.id, + rowVersion: existingHousehold?.rowVersion ?? 1, + nonRecoverableError: existingHousehold?.nonRecoverableError ?? false, ), ); // Iterate through individual members of the household. for (final i in event.members) { // Delete the individual from the repository. - await individualRepository.delete(i); + final IndividualModel? existingIndividual = + (await individualRepository.search(IndividualSearchModel( + clientReferenceId: [i.clientReferenceId], + ))) + .firstOrNull; + await individualRepository.delete(i.copyWith( + id: existingIndividual?.id, + rowVersion: existingIndividual?.rowVersion ?? 1, + nonRecoverableError: existingIndividual?.nonRecoverableError ?? false, + )); + if (event.projectBeneficiaryType == BeneficiaryType.individual) { + // Search for project beneficiary associated with the deleted individual. + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: [ + i.clientReferenceId, + ], + ), + ); + // Delete the associated project beneficiaries. + for (final projectBeneficiary in projectBeneficiaries) { + await projectBeneficiaryRepository.delete( + projectBeneficiary.copyWith( + rowVersion: projectBeneficiary.rowVersion, + clientAuditDetails: (projectBeneficiary + .clientAuditDetails?.createdBy != + null && + projectBeneficiary.clientAuditDetails?.createdTime != + null) + ? ClientAuditDetails( + createdBy: + projectBeneficiary.clientAuditDetails!.createdBy, + createdTime: + projectBeneficiary.clientAuditDetails!.createdTime, + lastModifiedBy: + projectBeneficiary.clientAuditDetails!.lastModifiedBy, + lastModifiedTime: DateTime.now().millisecondsSinceEpoch, + ) + : null, + ), + ); + } + } // Search for household members associated with the deleted individual. final householdMember = @@ -251,12 +299,23 @@ class HouseholdOverviewBloc } } - // Delete the project beneficiary associated with the household. - await projectBeneficiaryRepository.delete( - event.projectBeneficiaryModel.copyWith( - rowVersion: event.projectBeneficiaryModel.rowVersion, - ), - ); + if (BeneficiaryType.household == event.projectBeneficiaryType) { + // Delete the project beneficiary associated with the household. + final ProjectBeneficiaryModel? existingProjectBeneficiary = + (await projectBeneficiaryRepository + .search(ProjectBeneficiarySearchModel( + clientReferenceId: [event.projectBeneficiaryModel.clientReferenceId], + ))) + .firstOrNull; + await projectBeneficiaryRepository.delete( + event.projectBeneficiaryModel.copyWith( + id: existingProjectBeneficiary?.id, + rowVersion: existingProjectBeneficiary?.rowVersion ?? 1, + nonRecoverableError: + existingProjectBeneficiary?.nonRecoverableError ?? false, + ), + ); + } } // This function handles the deletion of an individual from a household. @@ -265,7 +324,47 @@ class HouseholdOverviewBloc HouseholdOverviewEmitter emit, ) async { // Delete the individual from the repository. - await individualRepository.delete(event.individualModel); + final IndividualModel? existingIndividual = + (await individualRepository.search(IndividualSearchModel( + clientReferenceId: [event.individualModel.clientReferenceId], + ))) + .firstOrNull; + await individualRepository.delete(event.individualModel.copyWith( + id: existingIndividual?.id, + rowVersion: existingIndividual?.rowVersion ?? 1, + nonRecoverableError: existingIndividual?.nonRecoverableError ?? false, + )); + if (event.projectBeneficiaryType == BeneficiaryType.individual) { + // Search for project beneficiary associated with the deleted individual. + final projectBeneficiaries = await projectBeneficiaryRepository.search( + ProjectBeneficiarySearchModel( + beneficiaryClientReferenceId: [ + event.individualModel.clientReferenceId, + ], + ), + ); + // Delete the associated project beneficiaries. + for (final projectBeneficiary in projectBeneficiaries) { + await projectBeneficiaryRepository.delete( + projectBeneficiary.copyWith( + rowVersion: projectBeneficiary.rowVersion, + clientAuditDetails: (projectBeneficiary + .clientAuditDetails?.createdBy != + null && + projectBeneficiary.clientAuditDetails?.createdTime != null) + ? ClientAuditDetails( + createdBy: projectBeneficiary.clientAuditDetails!.createdBy, + createdTime: + projectBeneficiary.clientAuditDetails!.createdTime, + lastModifiedBy: + projectBeneficiary.clientAuditDetails!.lastModifiedBy, + lastModifiedTime: DateTime.now().millisecondsSinceEpoch, + ) + : null, + ), + ); + } + } // Search for household members associated with the deleted individual. final householdMembers = await householdMemberRepository.search( 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 332d43054..d6de8956a 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 @@ -1,4 +1,5 @@ import 'dart:async'; + import 'package:collection/collection.dart'; import 'package:digit_data_model/models/entities/individual.dart'; import 'package:registration_delivery/blocs/search_households/search_households.dart'; @@ -215,6 +216,7 @@ class HouseHoldGlobalSearchBloc extends SearchHouseholdsBloc { projectBeneficiariesList, taskList, sideEffectsList, referralsList); taskList = tasksRelated[0]; + sideEffectsList = tasksRelated[1]; referralsList = tasksRelated[2]; @@ -260,6 +262,10 @@ class HouseHoldGlobalSearchBloc extends SearchHouseholdsBloc { List filteredTasks = []; List filteredBeneficiaries = []; final householdId = entry.key; + + final existingHousehold = state.householdMembers.firstWhereOrNull( + (element) => element.household?.clientReferenceId == householdId); + if (existingHousehold != null) continue; if (householdId == null) continue; // Filter household based on household ID 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 696df872e..c63cec3ea 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 @@ -94,6 +94,19 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { ), ); + householdMembersList = await fetchHouseholdMembersBulk( + null, + householdList.map((e) => e.clientReferenceId).toList(), + ); + + individualClientReferenceIds = householdMembersList + .map((e) => e.individualClientReferenceId.toString()) + .toList(); + + individualsList = await individual.search( + IndividualSearchModel(clientReferenceId: individualClientReferenceIds), + ); + projectBeneficiariesList = await projectBeneficiary.search( ProjectBeneficiarySearchModel( projectId: [RegistrationDeliverySingleton().projectId.toString()], @@ -141,14 +154,6 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { null, ); - final List individualClientReferenceIds = householdMembersList - .map((e) => e.individualClientReferenceId.toString()) - .toList(); - - individualsList = await individual.search( - IndividualSearchModel(clientReferenceId: individualClientReferenceIds), - ); - late List houseHoldClientReferenceIds = []; houseHoldClientReferenceIds = householdMembersList @@ -159,9 +164,43 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { clientReferenceId: houseHoldClientReferenceIds, )); - finalResults.forEach((element) { - taskList.add(element); - }); + householdMembersList = await fetchHouseholdMembersBulk( + null, + houseHoldClientReferenceIds, + ); + + individualsList = await individual.search( + IndividualSearchModel( + clientReferenceId: householdMembersList + .map((e) => e.individualClientReferenceId.toString()) + .toList(), + ), + ); + + final List individualClientReferenceIds = householdMembersList + .map((e) => e.individualClientReferenceId.toString()) + .toList(); + + individualsList = await individual.search( + IndividualSearchModel(clientReferenceId: individualClientReferenceIds), + ); + + projectBeneficiariesList = await projectBeneficiary.search( + ProjectBeneficiarySearchModel( + projectId: [RegistrationDeliverySingleton().projectId.toString()], + beneficiaryClientReferenceId: + individualClientReferenceIds.map((e) => e).toList())); + + if (!event.globalSearchParams.filter! + .contains(Status.beneficiaryReferred.name)) { + finalResults.forEach((element) { + taskList.add(element); + }); + } else { + finalResults.forEach((element) { + referralsList.add(element); + }); + } List tasksRelated = await _processTasksAndRelatedData( projectBeneficiariesList, taskList, sideEffectsList, referralsList); @@ -193,7 +232,7 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { individualClientReferenceIds.map((e) => e.toString()).toList())); // Search for individual results using the extracted IDs and search text. - final List householdMembers = + List householdMembers = await fetchHouseholdMembersBulk( individualClientReferenceIds, null, @@ -205,6 +244,32 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { .toList(), )); + householdMembers = await fetchHouseholdMembersBulk( + null, + householdList.map((e) => e.clientReferenceId).toList(), + ); + + individualsList = await individual.search( + IndividualSearchModel( + clientReferenceId: householdMembers + .map((e) => e.individualClientReferenceId.toString()) + .toList(), + ), + ); + + householdMembersList = await fetchHouseholdMembersBulk( + null, + householdList.map((e) => e.clientReferenceId).toList(), + ); + + individualClientReferenceIds = householdMembersList + .map((e) => e.individualClientReferenceId.toString()) + .toList(); + + individualsList = await individual.search( + IndividualSearchModel(clientReferenceId: individualClientReferenceIds), + ); + projectBeneficiariesList = await projectBeneficiary.search( ProjectBeneficiarySearchModel( projectId: [RegistrationDeliverySingleton().projectId.toString()], @@ -259,6 +324,10 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { List filteredTasks = []; List filteredBeneficiaries = []; final householdId = entry.key; + + final existingHousehold = state.householdMembers.firstWhereOrNull( + (element) => element.household?.clientReferenceId == householdId); + if (existingHousehold != null) continue; if (householdId == null) continue; // Filter household based on household ID @@ -333,10 +402,12 @@ class IndividualGlobalSearchBloc extends SearchHouseholdsBloc { taskClientReferenceId: taskList.map((e) => e.clientReferenceId).toList(), )); - referralsList = await referralDataRepository.search(ReferralSearchModel( - projectBeneficiaryClientReferenceId: - projectBeneficiariesList.map((e) => e.clientReferenceId).toList(), - )); + if (referralsList.isEmpty) { + referralsList = await referralDataRepository.search(ReferralSearchModel( + projectBeneficiaryClientReferenceId: + projectBeneficiariesList.map((e) => e.clientReferenceId).toList(), + )); + } } return [taskList, sideEffectsList, referralsList]; 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 26ffbd225..3b083b7be 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 @@ -234,8 +234,7 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { sql.householdMember, sql.householdMember.individualClientReferenceId .equalsExp(sql.individual.clientReferenceId)) - ]) - ..where(sql.householdMember.isHeadOfHousehold.equals(true)); + ]); selectQuery.join([ leftOuterJoin( sql.household, @@ -266,6 +265,20 @@ class HouseHoldGlobalSearchRepository extends LocalRepository { sql.name.givenName.contains( params.nameSearch!, ), + sql.name.familyName.contains( + params.nameSearch!, + ), + buildOr([ + sql.name.givenName.contains( + params.nameSearch!, + ), + sql.name.familyName.contains( + params.nameSearch!, + ), + sql.name.otherNames.equals( + params.nameSearch!, + ), + ]), ]), ])); } 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 abd395fef..907fd8b71 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 @@ -1,10 +1,12 @@ import 'dart:async'; import 'dart:math' as math; +import 'package:collection/collection.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:drift/drift.dart'; import 'package:flutter/material.dart'; +import '../../../models/entities/referral.dart'; import '../../../models/entities/status.dart'; import '../../../models/entities/task.dart'; import '../../../models/entities/task_resource.dart'; @@ -93,45 +95,80 @@ class IndividualGlobalSearchRepository extends LocalRepository { } await filterSelectQuery.limit(params.limit ?? 50, offset: params.offset ?? 0); - + var data; final results = await filterSelectQuery.get(); - var data = results - .map((e) { - final task = e.readTableOrNull(sql.task); - final resources = e.readTableOrNull(sql.taskResource); - - return TaskModel( - id: task.id, - createdBy: task.createdBy, - clientReferenceId: task.clientReferenceId, - rowVersion: task.rowVersion, - tenantId: task.tenantId, - isDeleted: task.isDeleted, - projectId: task.projectId, - projectBeneficiaryId: task.projectBeneficiaryId, - projectBeneficiaryClientReferenceId: - task.projectBeneficiaryClientReferenceId, - createdDate: task.createdDate, - status: task.status, - resources: resources == null - ? null - : [ - TaskResourceModel( - taskclientReferenceId: - resources.taskclientReferenceId, - clientReferenceId: resources.clientReferenceId, - id: resources.id, - productVariantId: resources.productVariantId, - taskId: resources.taskId, - deliveryComment: resources.deliveryComment, - quantity: resources.quantity, - rowVersion: resources.rowVersion, + if (params.filter!.contains(Status.beneficiaryReferred.name)) { + data = results + .map((e) { + final referral = e.readTableOrNull(sql.referral); + if (referral == null) return null; + + return ReferralModel( + id: referral.id, + clientReferenceId: referral.clientReferenceId, + rowVersion: referral.rowVersion, + tenantId: referral.tenantId, + isDeleted: referral.isDeleted, + projectBeneficiaryClientReferenceId: + referral.projectBeneficiaryClientReferenceId, + auditDetails: AuditDetails( + createdBy: referral.auditCreatedBy!, + createdTime: referral.auditCreatedTime!, + lastModifiedBy: referral.auditModifiedBy, + lastModifiedTime: referral.auditModifiedTime, + ), + clientAuditDetails: referral.clientCreatedTime == null || + referral.clientCreatedBy == null + ? null + : ClientAuditDetails( + createdTime: referral.clientCreatedTime!, + createdBy: referral.clientCreatedBy!, + lastModifiedBy: referral.clientModifiedBy, + lastModifiedTime: referral.clientModifiedTime, ), - ], - ); - }) - .where((element) => element.isDeleted != true) - .toList(); + ); + }) + .where((element) => element.isDeleted != true) + .toList(); + } else { + data = results + .map((e) { + final task = e.readTableOrNull(sql.task); + final resources = e.readTableOrNull(sql.taskResource); + + return TaskModel( + id: task.id, + createdBy: task.createdBy, + clientReferenceId: task.clientReferenceId, + rowVersion: task.rowVersion, + tenantId: task.tenantId, + isDeleted: task.isDeleted, + projectId: task.projectId, + projectBeneficiaryId: task.projectBeneficiaryId, + projectBeneficiaryClientReferenceId: + task.projectBeneficiaryClientReferenceId, + createdDate: task.createdDate, + status: task.status, + resources: resources == null + ? null + : [ + TaskResourceModel( + taskclientReferenceId: + resources.taskclientReferenceId, + clientReferenceId: resources.clientReferenceId, + id: resources.id, + productVariantId: resources.productVariantId, + taskId: resources.taskId, + deliveryComment: resources.deliveryComment, + quantity: resources.quantity, + rowVersion: resources.rowVersion, + ), + ], + ); + }) + .where((element) => element.isDeleted != true) + .toList(); + } return {"data": data, "total_count": count}; } @@ -219,19 +256,15 @@ class IndividualGlobalSearchRepository extends LocalRepository { return selectQuery; } else if (params.nameSearch != null || params.nameSearch!.isNotEmpty && selectQuery == null) { - selectQuery = super - .sql - .individual - .select() - .join([joinName(sql), joinIndividualAddress(sql)]); + selectQuery = super.sql.individual.select().join( + [joinName(sql), joinIdentifier(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, @@ -240,14 +273,12 @@ class IndividualGlobalSearchRepository extends LocalRepository { leftOuterJoin( sql.projectBeneficiary, sql.projectBeneficiary.beneficiaryClientReferenceId - .equalsExp(sql.household.clientReferenceId)) + .equalsExp(sql.individual.clientReferenceId)) ]); } else if (params.nameSearch != null && params.nameSearch!.isNotEmpty && selectQuery != null) { - selectQuery = selectQuery.join([ - joinName(sql), - ]); + selectQuery = selectQuery.join([joinName(sql), joinIdentifier(sql)]); selectQuery = searchByName(selectQuery, params, sql); } return selectQuery; @@ -261,6 +292,20 @@ class IndividualGlobalSearchRepository extends LocalRepository { sql.name.givenName.contains( params.nameSearch!, ), + sql.name.familyName.contains( + params.nameSearch!, + ), + buildOr([ + sql.name.givenName.contains( + params.nameSearch!, + ), + sql.name.familyName.contains( + params.nameSearch!, + ), + sql.name.otherNames.equals( + params.nameSearch!, + ), + ]), ]), ])); } @@ -281,6 +326,18 @@ class IndividualGlobalSearchRepository extends LocalRepository { ..where(filter == Status.registered.name ? sql.projectBeneficiary.beneficiaryClientReferenceId.isNotNull() : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull()); + } else if (filter == Status.beneficiaryReferred.name) { + selectQuery = sql.referral.select().join([ + if (params.nameSearch == null || !params.isProximityEnabled) + leftOuterJoin( + sql.projectBeneficiary, + sql.projectBeneficiary.clientReferenceId.equalsExp( + sql.referral.projectBeneficiaryClientReferenceId)) + ]); + if (!(params.filter!.contains(Status.notRegistered.name))) { + selectQuery.where( + sql.projectBeneficiary.projectId.equals(params.projectId!)); + } } else { var filterSearchQuery = await filterTasks(selectQuery, filter, sql, params); @@ -300,6 +357,19 @@ class IndividualGlobalSearchRepository extends LocalRepository { ..where(filter == Status.registered.name ? sql.projectBeneficiary.beneficiaryClientReferenceId.isNotNull() : sql.projectBeneficiary.beneficiaryClientReferenceId.isNull()); + } else if (filter == Status.beneficiaryReferred.name) { + selectQuery = selectQuery.join([ + leftOuterJoin( + sql.referral, + sql.referral.projectBeneficiaryClientReferenceId + .equalsExp(sql.projectBeneficiary.clientReferenceId)) + ]); + if (!(params.filter!.contains(Status.notRegistered.name))) { + selectQuery.where( + sql.projectBeneficiary.projectId.equals(params.projectId!)); + selectQuery.where(sql.projectBeneficiary.clientReferenceId + .equalsExp(sql.referral.projectBeneficiaryClientReferenceId)); + } } else { var filterSearchQuery = await filterTasks(selectQuery, filter, sql, params); @@ -324,7 +394,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { Status.toAdminister.name: Status.toAdminister, Status.closeHousehold.name: Status.closeHousehold, }; - var applyFilter = filter; + var appliedFilter = statusMap[filter]!.toValue(); if (selectQuery == null) { selectQuery = sql.select(sql.task).join([ leftOuterJoin( @@ -333,11 +403,11 @@ 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(), + appliedFilter, )); if (!(params.filter!.contains(Status.notRegistered.name))) { selectQuery @@ -370,6 +440,15 @@ class IndividualGlobalSearchRepository extends LocalRepository { ); } + joinIdentifier(LocalSqlDataStore sql) { + return leftOuterJoin( + sql.identifier, + sql.identifier.clientReferenceId.equalsExp( + sql.individual.clientReferenceId, + ), + ); + } + joinIndividualAddress(LocalSqlDataStore sql) { return leftOuterJoin( sql.address, @@ -379,11 +458,6 @@ class IndividualGlobalSearchRepository extends LocalRepository { ); } - joinProjectBeneficiary(LocalSqlDataStore sql) { - return leftOuterJoin(sql.projectBeneficiary, - sql.projectBeneficiary.clientReferenceId.isNotNull()); - } - // Executing custom select query on top of filterSelectQuery to get count _getTotalCount(filterSelectQuery, GlobalSearchParameters params, LocalSqlDataStore sql) async { @@ -403,7 +477,7 @@ class IndividualGlobalSearchRepository extends LocalRepository { : []) .get(); } catch (e) { - debugPrint('error in total $e'); + debugPrint('Error in total $e'); } return totalCount == null ? 0 : totalCount.first.data['total_count']; } @@ -414,38 +488,71 @@ class IndividualGlobalSearchRepository extends LocalRepository { final individual = e.readTableOrNull(sql.individual); final address = e.readTableOrNull(sql.address); final name = e.readTableOrNull(sql.name); + final identifier = e.readTableOrNull(sql.identifier); return IndividualModel( - id: individual?.id, - tenantId: individual?.tenantId, - clientReferenceId: individual!.clientReferenceId, + id: individual.id, + tenantId: individual.tenantId, + individualId: individual.individualId, + clientReferenceId: individual.clientReferenceId, dateOfBirth: individual.dateOfBirth, - name: NameModel( - givenName: name?.givenName, - individualClientReferenceId: individual.clientReferenceId, - tenantId: individual.tenantId, - auditDetails: AuditDetails( - createdBy: individual.auditCreatedBy!, - createdTime: individual.auditCreatedTime!, - lastModifiedBy: individual.auditModifiedBy, - lastModifiedTime: individual.auditModifiedTime, - ), - ), - rowVersion: individual.rowVersion, + mobileNumber: individual.mobileNumber, isDeleted: individual.isDeleted, - auditDetails: AuditDetails( - createdBy: individual.auditCreatedBy!, - createdTime: individual.auditCreatedTime!, - lastModifiedBy: individual.auditModifiedBy, - lastModifiedTime: individual.auditModifiedTime, - ), - address: address == null + rowVersion: individual.rowVersion, + clientAuditDetails: (individual.clientCreatedBy != null && + individual.clientCreatedTime != null) + ? ClientAuditDetails( + createdBy: individual.clientCreatedBy!, + createdTime: individual.clientCreatedTime!, + lastModifiedBy: individual.clientModifiedBy, + lastModifiedTime: individual.clientModifiedTime, + ) + : null, + auditDetails: (individual.auditCreatedBy != null && + individual.auditCreatedTime != null) + ? AuditDetails( + createdBy: individual.auditCreatedBy!, + createdTime: individual.auditCreatedTime!, + lastModifiedBy: individual.auditModifiedBy, + lastModifiedTime: individual.auditModifiedTime, + ) + : null, + name: name == null ? null - : [ - AddressModel( + : NameModel( + id: name.id, + individualClientReferenceId: individual.clientReferenceId, + familyName: name.familyName, + givenName: name.givenName, + otherNames: name.otherNames, + rowVersion: name.rowVersion, + tenantId: name.tenantId, + auditDetails: (name.auditCreatedBy != null && + name.auditCreatedTime != null) + ? AuditDetails( + createdBy: name.auditCreatedBy!, + createdTime: name.auditCreatedTime!, + lastModifiedBy: name.auditModifiedBy, + lastModifiedTime: name.auditModifiedTime, + ) + : null, + clientAuditDetails: (name.clientCreatedBy != null && + name.clientCreatedTime != null) + ? ClientAuditDetails( + createdBy: name.clientCreatedBy!, + createdTime: name.clientCreatedTime!, + lastModifiedBy: name.clientModifiedBy, + lastModifiedTime: name.clientModifiedTime, + ) + : null, + ), + bloodGroup: individual.bloodGroup, + address: [ + address == null + ? null + : AddressModel( id: address.id, - relatedClientReferenceId: - address.relatedClientReferenceId, + relatedClientReferenceId: individual.clientReferenceId, tenantId: address.tenantId, doorNo: address.doorNo, latitude: address.latitude, @@ -456,22 +563,57 @@ class IndividualGlobalSearchRepository extends LocalRepository { addressLine2: address.addressLine2, city: address.city, pincode: address.pincode, + type: address.type, locality: address.localityBoundaryCode != null ? LocalityModel( code: address.localityBoundaryCode!, name: address.localityBoundaryName, ) : null, - type: address.type, rowVersion: address.rowVersion, - auditDetails: AuditDetails( - createdBy: individual.auditCreatedBy!, - createdTime: individual.auditCreatedTime!, - lastModifiedBy: individual.auditModifiedBy, - lastModifiedTime: individual.auditModifiedTime, - ), + auditDetails: (address.auditCreatedBy != null && + address.auditCreatedTime != null) + ? AuditDetails( + createdBy: address.auditCreatedBy!, + createdTime: address.auditCreatedTime!, + lastModifiedBy: address.auditModifiedBy, + lastModifiedTime: address.auditModifiedTime, + ) + : null, + clientAuditDetails: (address.clientCreatedBy != null && + address.clientCreatedTime != null) + ? ClientAuditDetails( + createdBy: address.clientCreatedBy!, + createdTime: address.clientCreatedTime!, + lastModifiedBy: address.clientModifiedBy, + lastModifiedTime: address.clientModifiedTime, + ) + : null, ), - ], + ].whereNotNull().toList(), + gender: individual.gender, + identifiers: [ + if (identifier != null) + IdentifierModel( + id: identifier.id, + clientReferenceId: individual.clientReferenceId, + identifierType: identifier.identifierType, + identifierId: identifier.identifierId, + rowVersion: identifier.rowVersion, + tenantId: identifier.tenantId, + auditDetails: AuditDetails( + createdBy: identifier.auditCreatedBy!, + createdTime: identifier.auditCreatedTime!, + lastModifiedBy: identifier.auditModifiedBy, + lastModifiedTime: identifier.auditModifiedTime, + ), + ), + ], + additionalFields: individual.additionalFields == null + ? null + : IndividualAdditionalFieldsMapper.fromJson( + individual.additionalFields!, + ), ); }) .where((element) => element.isDeleted != true) diff --git a/packages/registration_delivery/lib/data/repositories/local/task.dart b/packages/registration_delivery/lib/data/repositories/local/task.dart index dbddb9607..6d350830d 100644 --- a/packages/registration_delivery/lib/data/repositories/local/task.dart +++ b/packages/registration_delivery/lib/data/repositories/local/task.dart @@ -114,7 +114,13 @@ class TaskLocalRepository extends LocalRepository { sql.task.auditCreatedBy.equals( userId, ), - ]))) + ])) + ..orderBy([ + OrderingTerm( + expression: sql.task.clientModifiedTime, + mode: OrderingMode.asc, + ), + ])) .get(); final tasksMap = {}; diff --git a/packages/registration_delivery/lib/models/entities/status.dart b/packages/registration_delivery/lib/models/entities/status.dart index c3cb7c79f..79aaae949 100644 --- a/packages/registration_delivery/lib/models/entities/status.dart +++ b/packages/registration_delivery/lib/models/entities/status.dart @@ -15,6 +15,8 @@ enum Status { notVisited, @MappableValue("BENEFICIARY_REFUSED") beneficiaryRefused, + @MappableValue("BENEFICIARY_INELIGIBLE") + beneficiaryInEligible, @MappableValue("BENEFICIARY_REFERRED") beneficiaryReferred, @MappableValue("ADMINISTRATION_SUCCESS") diff --git a/packages/registration_delivery/lib/models/entities/status.mapper.dart b/packages/registration_delivery/lib/models/entities/status.mapper.dart index 3f1896d6e..4be40840e 100644 --- a/packages/registration_delivery/lib/models/entities/status.mapper.dart +++ b/packages/registration_delivery/lib/models/entities/status.mapper.dart @@ -35,6 +35,8 @@ class StatusMapper extends EnumMapper { return Status.notVisited; case "BENEFICIARY_REFUSED": return Status.beneficiaryRefused; + case "BENEFICIARY_INELIGIBLE": + return Status.beneficiaryInEligible; case "BENEFICIARY_REFERRED": return Status.beneficiaryReferred; case "ADMINISTRATION_SUCCESS": @@ -69,6 +71,8 @@ class StatusMapper extends EnumMapper { return "NOT_VISITED"; case Status.beneficiaryRefused: return "BENEFICIARY_REFUSED"; + case Status.beneficiaryInEligible: + return "BENEFICIARY_INELIGIBLE"; case Status.beneficiaryReferred: return "BENEFICIARY_REFERRED"; case Status.administeredSuccess: diff --git a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart index 8a1980d7a..73fdb618d 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/beneficiary_checklist.dart @@ -3,7 +3,6 @@ import 'dart:math'; import 'package:auto_route/auto_route.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_components/utils/date_utils.dart'; -import 'package:digit_components/widgets/atoms/digit_toaster.dart'; import 'package:digit_components/widgets/atoms/selection_card.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; @@ -183,10 +182,12 @@ class _BeneficiaryChecklistPageState rowVersion: 1, accountId: RegistrationDeliverySingleton().projectId, - additionalDetails: - RegistrationDeliverySingleton() - .boundary - ?.code, + additionalDetails: { + "boundaryCode": + RegistrationDeliverySingleton() + .boundary + ?.code, + }, auditDetails: AuditDetails( createdBy: RegistrationDeliverySingleton() .loggedInUserUuid!, diff --git a/packages/registration_delivery/lib/pages/beneficiary/deliver_intervention.dart b/packages/registration_delivery/lib/pages/beneficiary/deliver_intervention.dart index a8f8f6bd6..29e580d8a 100644 --- a/packages/registration_delivery/lib/pages/beneficiary/deliver_intervention.dart +++ b/packages/registration_delivery/lib/pages/beneficiary/deliver_intervention.dart @@ -80,7 +80,7 @@ class DeliverInterventionPageState form: form, oldTask: RegistrationDeliverySingleton().beneficiaryType == BeneficiaryType.household - ? deliverInterventionState.tasks?.last + ? deliverInterventionState.tasks?.lastOrNull : null, projectBeneficiaryClientReferenceId: projectBeneficiary.clientReferenceId, @@ -624,7 +624,7 @@ class DeliverInterventionPageState } } bool hasDuplicateProductIdOrNoProductId = - deliveredProducts.any((ele) => ele?.productId == null); + deliveredProducts.any((ele) => ele?.productId == null); return hasDuplicateProductIdOrNoProductId; } @@ -824,14 +824,14 @@ class DeliverInterventionPageState _deliveryCommentKey: FormControl( value: RegistrationDeliverySingleton().beneficiaryType != BeneficiaryType.individual - ? (bloc.tasks?.last.additionalFields?.fields + ? (bloc.tasks?.lastOrNull?.additionalFields?.fields .where((a) => a.key == AdditionalFieldsType.deliveryComment.toValue()) .toList() ?? []) .isNotEmpty - ? bloc.tasks?.last.additionalFields?.fields + ? bloc.tasks?.lastOrNull?.additionalFields?.fields .where((a) => a.key == AdditionalFieldsType.deliveryComment.toValue()) .first @@ -866,7 +866,8 @@ class DeliverInterventionPageState value: RegistrationDeliverySingleton().beneficiaryType != BeneficiaryType.individual ? int.tryParse( - bloc.tasks?.last.resources?.elementAt(i).quantity ?? '0', + bloc.tasks?.lastOrNull?.resources?.elementAt(i).quantity ?? + '0', ) : 0, validators: [Validators.min(1)], 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 10b7e82b8..d931acb5e 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/beneficiary_acknowledgement.dart @@ -1,11 +1,14 @@ import 'package:auto_route/auto_route.dart'; +import 'package:collection/collection.dart'; import 'package:digit_components/digit_components.dart'; +import 'package:digit_data_model/models/entities/identifier_types.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import '../../../utils/i18_key_constants.dart' as i18; import '../../../widgets/localized.dart'; import '../../blocs/search_households/search_bloc_common_wrapper.dart'; +import '../../blocs/search_households/search_households.dart'; import '../../router/registration_delivery_router.gm.dart'; @RoutePage() @@ -25,6 +28,15 @@ class BeneficiaryAcknowledgementPage extends LocalizedStatefulWidget { class BeneficiaryAcknowledgementPageState extends LocalizedState { + late final HouseholdMemberWrapper? wrapper; + + @override + void initState() { + super.initState(); + final bloc = context.read(); + wrapper = bloc.state.householdMembers.lastOrNull; + } + @override Widget build(BuildContext context) { return Scaffold( @@ -50,9 +62,22 @@ class BeneficiaryAcknowledgementPageState description: localizations.translate( i18.acknowledgementSuccess.acknowledgementDescriptionText, ), + subLabel: getSubText(wrapper), label: localizations .translate(i18.acknowledgementSuccess.acknowledgementLabelText), ), ); } + + getSubText(HouseholdMemberWrapper? wrapper) { + return wrapper != null + ? '${localizations.translate(i18.beneficiaryDetails.beneficiaryId)}\n' + '${wrapper.members?.lastOrNull!.name!.givenName} - ' + '${wrapper.members?.lastOrNull!.identifiers!.lastWhereOrNull( + (e) => + e.identifierType == + IdentifierTypes.uniqueBeneficiaryID.toValue(), + )?.identifierId ?? localizations.translate(i18.common.noResultsFound)}' + : ''; + } } 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 34ea6c862..b5c7eefa0 100644 --- a/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart +++ b/packages/registration_delivery/lib/pages/beneficiary_registration/individual_details.dart @@ -387,9 +387,14 @@ class IndividualDetailsPageState extends LocalizedState { }, onSelected: (value) { setState(() { - if (value == 'DEFAULT') { + if (value == + IdentifierTypes.defaultID.toValue()) { form.control(_idNumberKey).value = IdGen.i.identifier.toString(); + } else if (value == + IdentifierTypes.uniqueBeneficiaryID + .toValue()) { + setUniqueBeneficiaryId(form); } else { form.control(_idNumberKey).value = null; } @@ -402,7 +407,10 @@ class IndividualDetailsPageState extends LocalizedState { emptyText: localizations .translate(i18.common.noMatchFound), ), - if (form.control(_idTypeKey).value != 'DEFAULT') + if (form.control(_idTypeKey).value != + IdentifierTypes.defaultID.toValue() && + form.control(_idTypeKey).value != + IdentifierTypes.uniqueBeneficiaryID.toValue()) Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -411,7 +419,12 @@ class IndividualDetailsPageState extends LocalizedState { return DigitTextFormField( readOnly: form.control(_idTypeKey).value == - 'DEFAULT', + IdentifierTypes.defaultID + .toValue() || + form.control(_idTypeKey).value == + IdentifierTypes + .uniqueBeneficiaryID + .toValue(), isRequired: form .control(_idNumberKey) .validators @@ -437,7 +450,10 @@ class IndividualDetailsPageState extends LocalizedState { const SizedBox(height: 4), ], ), - if (form.control(_idTypeKey).value == 'DEFAULT') + if (form.control(_idTypeKey).value == + IdentifierTypes.defaultID.toValue() || + form.control(_idTypeKey).value == + IdentifierTypes.uniqueBeneficiaryID.toValue()) const SizedBox( height: kPadding, ), @@ -807,4 +823,13 @@ class IndividualDetailsPageState extends LocalizedState { (element) => element.toLowerCase() == individual?.gender?.name, ); } + + void setUniqueBeneficiaryId(FormGroup form) async { + var beneficiaryId = await UniqueIdGeneration().generateUniqueId( + localityCode: RegistrationDeliverySingleton().boundary!.code!, + loggedInUserId: RegistrationDeliverySingleton().loggedInUserUuid!, + returnCombinedIds: false); + + form.control(_idNumberKey).value = beneficiaryId.first.toString(); + } } diff --git a/packages/registration_delivery/lib/pages/search_beneficiary.dart b/packages/registration_delivery/lib/pages/search_beneficiary.dart index 0cf5c4650..cae2556a2 100644 --- a/packages/registration_delivery/lib/pages/search_beneficiary.dart +++ b/packages/registration_delivery/lib/pages/search_beneficiary.dart @@ -344,7 +344,7 @@ class _SearchBeneficiaryPageState ); if ((i.tasks != null && - i.tasks?.last.status == + i.tasks?.lastOrNull!.status == Status.closeHousehold.toValue() && (i.tasks ?? []).isNotEmpty) || (i.projectBeneficiaries ?? []).isEmpty) { @@ -363,10 +363,10 @@ class _SearchBeneficiaryPageState (i.projectBeneficiaries ?? []) .isNotEmpty ? i.projectBeneficiaries - ?.last + ?.lastOrNull : null, addressModel: i.headOfHousehold! - .address!.last, + .address!.lastOrNull!, headOfHousehold: i.headOfHousehold), ), diff --git a/packages/registration_delivery/lib/utils/i18_key_constants.dart b/packages/registration_delivery/lib/utils/i18_key_constants.dart index 6dbb112c2..c27370d99 100644 --- a/packages/registration_delivery/lib/utils/i18_key_constants.dart +++ b/packages/registration_delivery/lib/utils/i18_key_constants.dart @@ -174,6 +174,7 @@ class BeneficiaryDetails { String get resourcesTobeProvided => 'RESOURCES_TO_BE_PROVIDED'; String get beneficiaryAge => 'BENEFICIARY_AGE'; + String get beneficiaryId => 'BENEFICIARY_ID'; String get ctaProceed => 'PROCEED'; String get beneficiaryDoseNo => 'BENEFICIARY_DETAILS_DOSE_NO'; String get beneficiaryDose => 'BENEFICIARY_DETAILS_DOSE'; diff --git a/packages/registration_delivery/lib/utils/utils.dart b/packages/registration_delivery/lib/utils/utils.dart index 1b40a62af..39b0347f8 100644 --- a/packages/registration_delivery/lib/utils/utils.dart +++ b/packages/registration_delivery/lib/utils/utils.dart @@ -1,9 +1,13 @@ // Importing necessary packages and modules +import 'dart:convert'; import 'dart:math'; import 'package:collection/collection.dart'; +import 'package:crypto/crypto.dart'; +import 'package:device_info_plus/device_info_plus.dart'; import 'package:digit_components/utils/date_utils.dart'; import 'package:digit_data_model/data_model.dart'; +import 'package:flutter/foundation.dart'; import 'package:formula_parser/formula_parser.dart'; import 'package:reactive_forms/reactive_forms.dart'; import 'package:registration_delivery/models/entities/household.dart'; @@ -90,7 +94,7 @@ bool checkIfBeneficiaryRefused( ) { final isBeneficiaryRefused = (tasks != null && (tasks ?? []).isNotEmpty && - tasks.last.status == Status.administeredFailed.toValue()); + tasks.last.status == Status.beneficiaryRefused.toValue()); return isBeneficiaryRefused; } @@ -132,9 +136,12 @@ bool checkEligibilityForAgeAndSideEffect( : false : false; } else { - return totalAgeMonths >= projectType!.validMinAge! && - totalAgeMonths <= projectType.validMaxAge! - ? true + return (projectType?.validMinAge != null && + projectType?.validMaxAge != null) + ? totalAgeMonths >= projectType!.validMinAge! && + totalAgeMonths <= projectType.validMaxAge! + ? true + : false : false; } } @@ -467,7 +474,8 @@ Status getTaskStatus(Iterable tasks) { if (tasks.isEmpty) { return Status.registered.toValue(); } else { - final mappedStatus = statusMap[tasks.last.status ?? Status.registered]; + final mappedStatus = + statusMap[tasks.lastOrNull!.status ?? Status.registered]; if (mappedStatus != null) { return mappedStatus; } @@ -475,3 +483,51 @@ Status getTaskStatus(Iterable tasks) { return Status.registered.toValue(); } + +class UniqueIdGeneration { + Future> generateUniqueId({ + required String localityCode, + required String loggedInUserId, + required bool returnCombinedIds, + }) async { + DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); + AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; + + // Get the Android ID + String androidId = androidInfo.serialNumber == 'unknown' + ? androidInfo.id.replaceAll('.', '') + : androidInfo.serialNumber; + + // Get current timestamp + int timestamp = DateTime.now().millisecondsSinceEpoch; + + // Combine the Android ID with the timestamp + String combinedId = '$loggedInUserId$androidId$localityCode$timestamp'; + + // Generate SHA-256 hash + List bytes = utf8.encode(combinedId); + Digest sha256Hash = sha256.convert(bytes); + + // Convert the hash to a 12-character string and make it uppercase + String hashString = sha256Hash.toString(); + String uniqueId = hashString.substring(0, 12).toUpperCase(); + + // Add a hyphen every 4 characters, except the last + String formattedUniqueId = uniqueId.replaceAllMapped( + RegExp(r'.{1,4}'), + (match) => '${match.group(0)}-', + ); + + // Remove the last hyphen + formattedUniqueId = + formattedUniqueId.substring(0, formattedUniqueId.length - 1); + + if (kDebugMode) { + print('uniqueId : $formattedUniqueId'); + } + + return returnCombinedIds + ? {formattedUniqueId, combinedId} + : {formattedUniqueId}; + } +} diff --git a/packages/registration_delivery/lib/widgets/beneficiary/beneficiary_card.dart b/packages/registration_delivery/lib/widgets/beneficiary/beneficiary_card.dart index 753cf2918..32bb08bed 100644 --- a/packages/registration_delivery/lib/widgets/beneficiary/beneficiary_card.dart +++ b/packages/registration_delivery/lib/widgets/beneficiary/beneficiary_card.dart @@ -39,7 +39,8 @@ class BeneficiaryCard extends StatelessWidget { offstage: status == null, child: status == Status.visited.toValue() || status == Status.registered.toValue() || - status == Status.administeredSuccess.toValue() + status == Status.administeredSuccess.toValue() || + status == Status.delivered.toValue() ? DigitIconButton( icon: Icons.check_circle, iconText: RegistrationDeliveryLocalization.of(context) 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 9f49dbbc4..92e9b0454 100644 --- a/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart +++ b/packages/registration_delivery/lib/widgets/beneficiary/view_beneficiary_card.dart @@ -167,7 +167,9 @@ class ViewBeneficiaryCardState extends LocalizedState { TableData( [ e.name?.givenName ?? '--', - (e.name?.familyName?.trim().isNotEmpty ?? false) ? e.name?.familyName : null, + (e.name?.familyName?.trim().isNotEmpty ?? false) + ? e.name?.familyName + : null, ].whereNotNull().join(' '), cellKey: 'beneficiary', ), @@ -210,7 +212,10 @@ class ViewBeneficiaryCardState extends LocalizedState { cellKey: 'age', ), TableData( - e.gender?.name == null ? '--' : localizations.translate('CORE_COMMON_${ e.gender?.name.toUpperCase()}'), + e.gender?.name == null + ? '--' + : localizations + .translate('CORE_COMMON_${e.gender?.name.toUpperCase()}'), cellKey: 'gender', ), ]; @@ -411,7 +416,7 @@ class ViewBeneficiaryCardState extends LocalizedState { if (tasks.isEmpty) { return Status.registered.toValue(); } else { - return getTaskStatus(tasks).toValue(); + return getTaskStatus(tasks.toList()).toValue(); } } else { return Status.notRegistered.toValue(); diff --git a/packages/registration_delivery/lib/widgets/component_wrapper/facility_bloc_wrapper.dart b/packages/registration_delivery/lib/widgets/component_wrapper/facility_bloc_wrapper.dart index 74948d44c..d7f298060 100644 --- a/packages/registration_delivery/lib/widgets/component_wrapper/facility_bloc_wrapper.dart +++ b/packages/registration_delivery/lib/widgets/component_wrapper/facility_bloc_wrapper.dart @@ -42,6 +42,7 @@ class FacilityBlocWrapper extends StatelessWidget { const ProjectFacilityState.loading(), projectFacilityDataRepository: context.read(), + facilityDataRepository: context.read(), )..add( ProjectFacilityLoadEvent( query: ProjectFacilitySearchModel( 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 014dab8dc..626a3083f 100644 --- a/packages/registration_delivery/lib/widgets/member_card/member_card.dart +++ b/packages/registration_delivery/lib/widgets/member_card/member_card.dart @@ -1,4 +1,5 @@ import 'package:auto_route/auto_route.dart'; +import 'package:collection/collection.dart'; import 'package:digit_components/digit_components.dart'; import 'package:digit_data_model/data_model.dart'; import 'package:flutter/material.dart'; @@ -84,20 +85,60 @@ class MemberCard extends StatelessWidget { children: [ Stack( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, + Column( children: [ - SizedBox( - width: MediaQuery.of(context).size.width / 1.8, - child: Padding( - padding: - const EdgeInsets.only(left: kPadding, top: kPadding), - child: Text( - name, - style: theme.textTheme.headlineMedium, + if (individual.identifiers != null) + Align( + alignment: Alignment.topLeft, + child: Padding( + padding: const EdgeInsets.all(kPadding), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: DigitTheme.instance.colorScheme.primary, + ), + borderRadius: const BorderRadius.all( + Radius.circular(kPadding), + ), + ), + child: Padding( + padding: const EdgeInsets.all( + kPadding, + ), + child: Text( + individual.identifiers + ?.lastWhereOrNull( + (e) => + e.identifierType == + IdentifierTypes.uniqueBeneficiaryID + .toValue(), + ) + ?.identifierId ?? + localizations + .translate(i18.common.noResultsFound), + ), + ), + ), ), - ), + ) + else + const Offstage(), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: MediaQuery.of(context).size.width / 1.8, + child: Padding( + padding: const EdgeInsets.only( + left: kPadding, top: kPadding), + child: Text( + name, + style: theme.textTheme.headlineMedium, + ), + ), + ), + ], ), ], ), diff --git a/packages/registration_delivery/lib/widgets/progress_bar/beneficiary_progress.dart b/packages/registration_delivery/lib/widgets/progress_bar/beneficiary_progress.dart index 5ae9047bd..4aab785fc 100644 --- a/packages/registration_delivery/lib/widgets/progress_bar/beneficiary_progress.dart +++ b/packages/registration_delivery/lib/widgets/progress_bar/beneficiary_progress.dart @@ -75,7 +75,8 @@ class BeneficiaryProgressBarState extends State { @override Widget build(BuildContext context) { final selectedProject = RegistrationDeliverySingleton().selectedProject!; - final beneficiaryType = RegistrationDeliverySingleton().beneficiaryType; + final beneficiaryType = + RegistrationDeliverySingleton().beneficiaryType.toString(); final targetModel = selectedProject.targets?.firstWhereOrNull( (element) => element.beneficiaryType == beneficiaryType, diff --git a/packages/registration_delivery/pubspec.lock b/packages/registration_delivery/pubspec.lock index 95488a9b0..e67565028 100644 --- a/packages/registration_delivery/pubspec.lock +++ b/packages/registration_delivery/pubspec.lock @@ -338,7 +338,7 @@ packages: source: hosted version: "0.3.3+8" crypto: - dependency: transitive + dependency: "direct main" description: name: crypto sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab @@ -390,7 +390,7 @@ packages: description: path: "packages/dart_mappable_builder" ref: master - resolved-ref: "9b887d24c05459c027a92391869d4c10b440e00f" + resolved-ref: "8011a4c367094dfb018fce701d700a582ba862bb" url: "https://github.com/egovernments/health-campaign-field-worker-app/" source: git version: "4.2.0" @@ -410,6 +410,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110" + url: "https://pub.dev" + source: hosted + version: "9.1.2" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: "282d3cf731045a2feb66abfe61bbc40870ae50a3ed10a4d3d217556c35c8c2ba" + url: "https://pub.dev" + source: hosted + version: "7.0.1" diff_match_patch: dependency: transitive description: @@ -422,18 +438,18 @@ 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: name: digit_data_model - sha256: "0b81e96636496b56b4f9c5d918690a17d8985d6b131e0ab54968eb5471ee4f54" + sha256: df389a1972ddc9d59b2f7e1375a04bab88700ae4cc876e5cb83e8fbfe55cfa62 url: "https://pub.dev" source: hosted - version: "1.0.3+1" + version: "1.0.4-dev.10-uniqueId" digit_scanner: dependency: "direct main" description: @@ -1446,6 +1462,14 @@ packages: url: "https://pub.dev" source: hosted version: "5.2.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" + url: "https://pub.dev" + source: hosted + version: "1.1.2" xdg_directories: dependency: transitive description: diff --git a/packages/registration_delivery/pubspec.yaml b/packages/registration_delivery/pubspec.yaml index b88722f63..3a4a3ef5a 100644 --- a/packages/registration_delivery/pubspec.yaml +++ b/packages/registration_delivery/pubspec.yaml @@ -1,6 +1,6 @@ name: registration_delivery description: This package enables health facility workers to register a household and individual members and deliver the resources. -version: 1.0.3+1 +version: 1.0.4-dev.8-search-fix homepage: https://github.com/egovernments/health-campaign-field-worker-app/tree/master/packages/registration_delivery repository: https://github.com/egovernments/health-campaign-field-worker-app @@ -32,7 +32,7 @@ dependencies: digit_scanner: ^1.0.3+1 gs1_barcode_parser: ^1.0.5 auto_route: ^7.8.4 - digit_data_model: ^1.0.3+1 + digit_data_model: ^1.0.4-dev.10-uniqueId package_info_plus: ^5.0.1 digit_showcase: ^1.0.0 collection: ^1.16.0 @@ -40,6 +40,8 @@ dependencies: stream_transform: ^2.1.0 async: ^2.11.0 formula_parser: ^2.0.1 + device_info_plus: ^9.0.1 + crypto: ^3.0.3 dev_dependencies: flutter_test: