Skip to content

Commit

Permalink
Hlm 2985 2d voucher (#291)
Browse files Browse the repository at this point in the history
* Project Type added to local storage

* added voucher scanner

* added text trim

* added tag

* bug fixes

* bug fixes

* added scanner fixes

* added button border

* fixed border issue

* position fixes

* fixed de-linking of QR code

---------

Co-authored-by: Ramkrishna-egov <[email protected]>
Co-authored-by: Ramkrishna-egov <[email protected]>
  • Loading branch information
3 people committed Nov 2, 2023
1 parent 912f222 commit f5fc6f5
Show file tree
Hide file tree
Showing 40 changed files with 3,341 additions and 887 deletions.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions apps/health_campaign_field_worker_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
PODS:
- audioplayers_darwin (0.0.1):
- Flutter
- battery_plus (1.0.0):
- Flutter
- connectivity_plus (0.0.1):
Expand Down Expand Up @@ -74,6 +76,7 @@ PODS:
- Flutter
- location (0.0.1):
- Flutter
- MTBBarcodeScanner (5.0.11)
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
Expand All @@ -87,6 +90,9 @@ PODS:
- PromisesObjC (2.2.0)
- PromisesSwift (2.2.0):
- PromisesObjC (= 2.2.0)
- qr_code_scanner (0.2.0):
- Flutter
- MTBBarcodeScanner
- ReachabilitySwift (5.0.0)
- shared_preferences_foundation (0.0.1):
- Flutter
Expand Down Expand Up @@ -117,6 +123,7 @@ PODS:
- Flutter

DEPENDENCIES:
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
- battery_plus (from `.symlinks/plugins/battery_plus/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
Expand All @@ -132,6 +139,7 @@ DEPENDENCIES:
- location (from `.symlinks/plugins/location/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
Expand All @@ -149,6 +157,7 @@ SPEC REPOS:
- FirebaseSessions
- GoogleDataTransport
- GoogleUtilities
- MTBBarcodeScanner
- nanopb
- PromisesObjC
- PromisesSwift
Expand All @@ -158,6 +167,8 @@ SPEC REPOS:
- Try

EXTERNAL SOURCES:
audioplayers_darwin:
:path: ".symlinks/plugins/audioplayers_darwin/ios"
battery_plus:
:path: ".symlinks/plugins/battery_plus/ios"
connectivity_plus:
Expand Down Expand Up @@ -188,6 +199,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
qr_code_scanner:
:path: ".symlinks/plugins/qr_code_scanner/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
speech_to_text:
Expand All @@ -200,6 +213,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/workmanager/ios"

SPEC CHECKSUMS:
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
battery_plus: 9bff772a7e5e4d5381ca3ca92a97373a3d8b2738
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
Expand All @@ -222,11 +236,13 @@ SPEC CHECKSUMS:
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
PromisesSwift: cf9eb58666a43bbe007302226e510b16c1e10959
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
Expand Down
4 changes: 4 additions & 0 deletions apps/health_campaign_field_worker_app/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand Down
10 changes: 10 additions & 0 deletions apps/health_campaign_field_worker_app/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'blocs/boundary/boundary.dart';
import 'blocs/localization/app_localization.dart';
import 'blocs/localization/localization.dart';
import 'blocs/project/project.dart';
import 'blocs/scanner/scanner.dart';
import 'blocs/user/user.dart';
import 'data/data_repository.dart';
import 'data/local_store/sql_store/sql_store.dart';
Expand Down Expand Up @@ -94,6 +95,15 @@ class MainApplicationState extends State<MainApplication>
),
),
),
BlocProvider(
create: (ctx) => ScannerBloc(
const ScannerState(),
projectBeneficiaryRepository: ctx
.read<NetworkManager>()
.repository<ProjectBeneficiaryModel,
ProjectBeneficiarySearchModel>(ctx),
),
),
BlocProvider(
create: (ctx) => BoundaryBloc(
const BoundaryState(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ class BeneficiaryRegistrationBloc

await projectBeneficiaryRepository.create(
ProjectBeneficiaryModel(
tag: event.tag,
rowVersion: 1,
tenantId: envConfig.variables.tenantId,
clientReferenceId: IdGen.i.identifier,
Expand Down Expand Up @@ -263,6 +264,19 @@ class BeneficiaryRegistrationBloc
),
),
);
final projectBeneficiary = await projectBeneficiaryRepository.search(
ProjectBeneficiarySearchModel(
beneficiaryClientReferenceId: [event.household.clientReferenceId],
),
);

if (projectBeneficiary.isNotEmpty) {
if (projectBeneficiary.first.tag != event.tag) {
await projectBeneficiaryRepository
.update(projectBeneficiary.first.copyWith(tag: event.tag));
}
}

for (var element in value.individualModel) {
await individualRepository.update(
element.copyWith(
Expand Down Expand Up @@ -310,7 +324,19 @@ class BeneficiaryRegistrationBloc
),
],
);

final projectBeneficiary = await projectBeneficiaryRepository.search(
ProjectBeneficiarySearchModel(
beneficiaryClientReferenceId: [event.model.clientReferenceId],
),
);
await individualRepository.update(individual);
if (projectBeneficiary.isNotEmpty) {
if (projectBeneficiary.first.tag != event.tag) {
await projectBeneficiaryRepository
.update(projectBeneficiary.first.copyWith(tag: event.tag));
}
}
} catch (error) {
rethrow;
} finally {
Expand Down Expand Up @@ -351,6 +377,7 @@ class BeneficiaryRegistrationBloc
if (event.beneficiaryType == BeneficiaryType.individual) {
await projectBeneficiaryRepository.create(
ProjectBeneficiaryModel(
tag: event.tag,
rowVersion: 1,
tenantId: envConfig.variables.tenantId,
clientReferenceId: IdGen.i.identifier,
Expand Down Expand Up @@ -429,24 +456,32 @@ class BeneficiaryRegistrationEvent with _$BeneficiaryRegistrationEvent {
required AddressModel addressModel,
required String userUuid,
required String projectId,
String? tag,
required BeneficiaryType beneficiaryType,
}) = BeneficiaryRegistrationAddMemberEvent;

const factory BeneficiaryRegistrationEvent.updateHouseholdDetails({
required HouseholdModel household,
AddressModel? addressModel,
String? tag,
}) = BeneficiaryRegistrationUpdateHouseholdDetailsEvent;

const factory BeneficiaryRegistrationEvent.updateIndividualDetails({
required IndividualModel model,
String? tag,
required AddressModel addressModel,
}) = BeneficiaryRegistrationUpdateIndividualDetailsEvent;

const factory BeneficiaryRegistrationEvent.create({
required String userUuid,
required String projectId,
required BoundaryModel boundary,
String? tag,
}) = BeneficiaryRegistrationCreateEvent;

const factory BeneficiaryRegistrationEvent.validate({
required String tag,
}) = BeneficiaryRegistrationTagEvent;
}

@freezed
Expand All @@ -466,13 +501,15 @@ class BeneficiaryRegistrationState with _$BeneficiaryRegistrationState {
required HouseholdModel householdModel,
required List<IndividualModel> individualModel,
required DateTime registrationDate,
ProjectBeneficiaryModel? projectBeneficiaryModel,
@Default(false) bool loading,
}) = BeneficiaryRegistrationEditHouseholdState;

const factory BeneficiaryRegistrationState.editIndividual({
required HouseholdModel householdModel,
required IndividualModel individualModel,
required AddressModel addressModel,
ProjectBeneficiaryModel? projectBeneficiaryModel,
@Default(false) bool loading,
}) = BeneficiaryRegistrationEditIndividualState;

Expand Down
Loading

0 comments on commit f5fc6f5

Please sign in to comment.