Skip to content

TICKET::HCMPRE-2565 #694

New issue

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

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

Already on GitHub? Sign in to your account

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ class AuthRepository {
"authorization": "Basic ZWdvdi11c2VyLWNsaWVudDo=",
};

final formData = FormData.fromMap(loginModel.toJson());
//final formData = FormData.fromMap(loginModel.toJson());
final encodedFormData = loginModel
.toJson()
.entries
.map((e) =>
'${Uri.encodeQueryComponent(e.key)}=${Uri.encodeQueryComponent(e.value.toString())}')
.join('&');
final response = await _client.post(
loginPath,
data: formData,
data: encodedFormData,
options: Options(headers: headers),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ class IndividualLocalRepository
),
),
],
additionalFields: individual.additionalFields == null
? null
: IndividualAdditionalFieldsMapper.fromJson(
individual.additionalFields!,
),

);
})
.where((element) => element.isDeleted != true)
Expand Down
2 changes: 2 additions & 0 deletions packages/digit_scanner/lib/utils/i18_key_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class AcknowledgementSuccess {
class Scanner {
const Scanner();

String get scannedQtyExceed => 'SCANNED_QTY_EXCEED_THAN_REQUIRED';

String get changingCameraLens => 'CHANGING_CAMERA_LENS';

String get flashOn => 'FLASH_ON';
Expand Down
7 changes: 6 additions & 1 deletion packages/digit_scanner/lib/utils/scanner_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,13 @@ class DigitScannerUtils {
} else if (quantity > result.length) {
// Store the parsed result if the quantity is greater than result length
await storeValue(parsedResult);
} else {
} else if(quantity <= result.length) {
// Handle error if there is a mismatch in the scanned resource count
await handleError(
localizations.translate(i18.scanner.scannedQtyExceed));
}
else{
// Handle error if there is a mismatch in the scanned resource
await handleError(
localizations.translate(i18.scanner.invalidBarcode));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,12 @@ class StockDetailsPageState extends LocalizedState<StockDetailsPage> {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
const DigitScannerPage(
quantity: 5,
DigitScannerPage(
quantity: int.parse((form
.control(
_transactionQuantityKey)
.value)
.toString()),
isGS1code: true,
singleValue: false,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ enum AdditionalFieldsType {
houseStructureTypes,
@MappableValue("reasonOfRefusal")
reasonOfRefusal,
@MappableValue("height")
height,
@MappableValue("weight")
weight,
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class AdditionalFieldsTypeMapper extends EnumMapper<AdditionalFieldsType> {
return AdditionalFieldsType.houseStructureTypes;
case "reasonOfRefusal":
return AdditionalFieldsType.reasonOfRefusal;
case "height":
return AdditionalFieldsType.height;
case "weight":
return AdditionalFieldsType.weight;
default:
throw MapperException.unknownEnumValue(value);
}
Expand Down Expand Up @@ -121,6 +125,10 @@ class AdditionalFieldsTypeMapper extends EnumMapper<AdditionalFieldsType> {
return "houseStructureTypes";
case AdditionalFieldsType.reasonOfRefusal:
return "reasonOfRefusal";
case AdditionalFieldsType.height:
return "height";
case AdditionalFieldsType.weight:
return "weight";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,67 +164,109 @@ class BeneficiaryDetailsPageState
c.id ==
deliverState.cycle);
if (selectedCycle != null) {
bloc.add(
DeliverInterventionEvent
.selectFutureCycleDose(
dose: deliverState.dose,
cycle:
RegistrationDeliverySingleton()
final currentCycle =
deliverState.cycle >= 0
? deliverState.cycle
: 0;

// Calculate the current dose. If deliverInterventionState.dose is negative, set it to 0.
final currentDose =
deliverState.dose >= 0
? deliverState.dose
: 0;

final items =
RegistrationDeliverySingleton()
.projectType!
.cycles!
.firstWhere((c) =>
c.id ==
deliverState
.cycle),
individualModel: state
.selectedIndividual,
),
);
showCustomPopup(
context: context,
builder: (popUpContext) => Popup(
title: localizations
.translate(i18
.beneficiaryDetails
.resourcesTobeDelivered),
type: PopUpType.simple,
contentPadding:
EdgeInsets.zero,
additionalWidgets: [
buildTableContent(
deliverState,
context,
variant,
.cycles?[
currentCycle - 1]
.deliveries?[
currentDose - 1];
final matchedDoses =
fetchProductVariant(
items,
state
.selectedIndividual,
state
.householdMemberWrapper
.household),
],
actions: [
DigitButton(
label: localizations
.translate(i18
.beneficiaryDetails
.ctaProceed),
onPressed: () {
Navigator.of(
context,
rootNavigator:
true,
).pop();
router.push(
DeliverInterventionRoute(),
);
},
type:
DigitButtonType
.primary,
size:
DigitButtonSize
.large),
]),
);
.household) ??
[];

if ((matchedDoses != null &&
matchedDoses
.isNotEmpty)) {
bloc.add(
DeliverInterventionEvent
.selectFutureCycleDose(
dose: deliverState.dose,
cycle:
RegistrationDeliverySingleton()
.projectType!
.cycles!
.firstWhere((c) =>
c.id ==
deliverState
.cycle),
individualModel: state
.selectedIndividual,
),
);
showCustomPopup(
context: context,
builder: (popUpContext) => Popup(
title: localizations
.translate(i18
.beneficiaryDetails
.resourcesTobeDelivered),
type:
PopUpType.simple,
contentPadding:
EdgeInsets.zero,
additionalWidgets: [
buildTableContent(
deliverState,
context,
variant,
state
.selectedIndividual,
state
.householdMemberWrapper
.household),
],
actions: [
DigitButton(
label: localizations
.translate(i18
.beneficiaryDetails
.ctaProceed),
onPressed: () {
Navigator.of(
context,
rootNavigator:
true,
).pop();
router.push(
DeliverInterventionRoute(),
);
},
type:
DigitButtonType
.primary,
size:
DigitButtonSize
.large),
]),
);
} else {
Toast.showToast(
context,
type: ToastType.error,
message: localizations
.translate(i18
.beneficiaryDetails
.notMeetDeliveryRulesCriteria),
);
}
}
},
),
Expand Down
Loading
Loading