Skip to content

Commit

Permalink
Merge pull request #624 from egovernments/inventory_management
Browse files Browse the repository at this point in the history
updated inventory package with new components
  • Loading branch information
naveenr-egov authored Dec 11, 2024
2 parents a7a1eb6 + 0caab37 commit d104997
Show file tree
Hide file tree
Showing 13 changed files with 1,440 additions and 1,578 deletions.
91 changes: 51 additions & 40 deletions packages/inventory_management/lib/pages/acknowledgement.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'package:digit_components/digit_components.dart';
import 'package:digit_ui_components/digit_components.dart';
import 'package:digit_ui_components/widgets/molecules/digit_card.dart';
import 'package:digit_ui_components/widgets/molecules/panel_cards.dart';
import 'package:flutter/material.dart';
import '../utils/i18_key_constants.dart' as i18;
import '../widgets/localized.dart';
Expand Down Expand Up @@ -31,73 +33,82 @@ class AcknowledgementPageState
final theme = Theme.of(context);

return Scaffold(
body: DigitAcknowledgement.success(
description: widget.description ??
body: PanelCard(
title: widget.label ??
localizations.translate(
i18.acknowledgementSuccess.acknowledgementDescriptionText,
i18.acknowledgementSuccess.acknowledgementLabelText,
),
descriptionWidget: widget.isDataRecordSuccess
? DigitTableCard(
element: widget.descriptionTableData ?? {},
)
: null,
label: widget.label ??
type: PanelType.success,
description: widget.description ??
localizations.translate(
i18.acknowledgementSuccess.acknowledgementLabelText,
i18.acknowledgementSuccess.acknowledgementDescriptionText,
),
action: () {
context.router.maybePop();
},
enableBackToSearch: widget.isDataRecordSuccess ? false : true,
actionLabel:
localizations.translate(i18.acknowledgementSuccess.actionLabelText),
/// TODO: need to update this as listview card
// additionWidgets: widget.isDataRecordSuccess
// ? DigitTableCard(
// element: widget.descriptionTableData ?? {},
// )
// : null,
actions: [
DigitButton(
label: localizations.translate(i18.acknowledgementSuccess.actionLabelText),
onPressed: () {
context.router.maybePop();
},
type: DigitButtonType.primary,
size: DigitButtonSize.large),
if(!widget.isDataRecordSuccess)
DigitButton(
label: localizations
.translate(i18.acknowledgementSuccess.actionLabelText),
onPressed: () {
final parent = context.router.parent() as StackRouter;
// Pop twice to navigate back to the previous screen
parent.popUntilRoot();
},
type: DigitButtonType.secondary,
size: DigitButtonSize.large),
],
// action: () {
// context.router.maybePop();
// },
// enableBackToSearch: widget.isDataRecordSuccess ? false : true,
// actionLabel:
// localizations.translate(i18.acknowledgementSuccess.actionLabelText),
),
bottomNavigationBar: Offstage(
offstage: !widget.isDataRecordSuccess,
// Show the bottom navigation bar if `isDataRecordSuccess` is true
child: SizedBox(
height: 150,
child: DigitCard(
margin: const EdgeInsets.fromLTRB(0, kPadding, 0, 0),
padding: const EdgeInsets.fromLTRB(kPadding, 0, kPadding, 0),
child: Column(
children: [
DigitElevatedButton(
child: Text(localizations
.translate(i18.acknowledgementSuccess.goToHome)),
margin: const EdgeInsets.fromLTRB(0, spacer2, 0, 0),
children: [
DigitButton(
size: DigitButtonSize.large,
type: DigitButtonType.secondary,
label: localizations
.translate(i18.acknowledgementSuccess.goToHome),
onPressed: () {
context.router.popUntilRoot();
},
),
const SizedBox(
height: 12,
),
DigitOutLineButton(
DigitButton(
size: DigitButtonSize.large,
type: DigitButtonType.primary,
onPressed: () {
context.router.popUntilRoot();
},
label: localizations
.translate(i18.acknowledgementSuccess.downloadmoredata),
buttonStyle: OutlinedButton.styleFrom(
backgroundColor: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero,
),
side: BorderSide(
width: 1.0,
color: theme.colorScheme.secondary,
),
minimumSize: Size(
MediaQuery.of(context).size.width,
50,
),
),
),
],
),
),
),
),
);
}
}
38 changes: 20 additions & 18 deletions packages/inventory_management/lib/pages/facility_selection.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
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:digit_ui_components/digit_components.dart';
import 'package:digit_ui_components/theme/digit_extended_theme.dart';
import 'package:digit_ui_components/widgets/scrollable_content.dart';
import 'package:flutter/material.dart';
import 'package:inventory_management/utils/constants.dart';
import 'package:inventory_management/widgets/localized.dart';
Expand Down Expand Up @@ -67,11 +69,11 @@ class InventoryFacilitySelectionPageState
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: kPadding * 2),
horizontal: spacer4),
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(kPadding),
padding: const EdgeInsets.all(spacer2),
child: Align(
alignment: Alignment.topLeft,
child: Text(
Expand All @@ -83,13 +85,15 @@ class InventoryFacilitySelectionPageState
),
),
),
const DigitTextFormField(
suffix: Padding(
padding: EdgeInsets.all(kPadding),
child: Icon(Icons.search),
),
label: '',
formControlName: _facilityName,
ReactiveWrapperField(
formControlName: _facilityName,
builder: (field) {
return DigitSearchFormInput(
onChange: (value){
field.control.value = value;
},
);
}
),
],
),
Expand All @@ -104,13 +108,12 @@ class InventoryFacilitySelectionPageState
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: kPadding),
horizontal: spacer2),
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: kPadding),
horizontal: spacer2),
decoration: BoxDecoration(
color:
DigitTheme.instance.colors.alabasterWhite,
color:Theme.of(context).colorTheme.paper.secondary,
border: Border(
top:
index == 0 ? borderSide : BorderSide.none,
Expand All @@ -126,10 +129,9 @@ class InventoryFacilitySelectionPageState
Navigator.of(context).pop(facility);
},
child: Container(
margin: const EdgeInsets.all(kPadding),
margin: const EdgeInsets.all(spacer2),
decoration: BoxDecoration(
color: DigitTheme
.instance.colors.alabasterWhite,
color: Theme.of(context).colorTheme.paper.secondary,
border: Border(
bottom: BorderSide(
color: theme.colorScheme.outline,
Expand All @@ -138,7 +140,7 @@ class InventoryFacilitySelectionPageState
),
),
child: Padding(
padding: const EdgeInsets.all(kPadding * 2),
padding: const EdgeInsets.all(spacer4),
child: Text(
localizations.translate(
'$facilityPrefix${facility.id}'),
Expand Down
51 changes: 24 additions & 27 deletions packages/inventory_management/lib/pages/manage_stocks.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'package:digit_components/digit_components.dart';
import 'package:digit_ui_components/digit_components.dart';
import 'package:digit_ui_components/widgets/atoms/menu_card.dart';
import 'package:digit_ui_components/widgets/scrollable_content.dart';
import 'package:flutter/material.dart';
import 'package:inventory_management/router/inventory_router.gm.dart';

Expand Down Expand Up @@ -39,7 +41,7 @@ class ManageStocksPageState extends LocalizedState<ManageStocksPage> {
children: [
Padding(
padding: const EdgeInsets.fromLTRB(
kPadding * 2, kPadding, kPadding * 2, kPadding),
spacer4, spacer2, spacer4, spacer2),
child: Align(
alignment: Alignment.topLeft,
child: Text(
Expand All @@ -50,68 +52,63 @@ class ManageStocksPageState extends LocalizedState<ManageStocksPage> {
),
),
Column(children: [
DigitListView(
title: localizations
MenuCard(
heading: localizations
.translate(i18.manageStock.recordStockReceiptLabel),
description: localizations
.translate(i18.manageStock.recordStockReceiptDescription),
prefixIcon: Icons.file_download_outlined,
sufixIcon: Icons.arrow_circle_right,
onPressed: () {
icon: Icons.file_download_outlined,
onTap: () {
context.router.push(
RecordStockWrapperRoute(
type: StockRecordEntryType.receipt,
),
);
},
),
DigitListView(
title: localizations
MenuCard(
heading: localizations
.translate(i18.manageStock.recordStockIssuedLabel),
description: localizations.translate(
i18.manageStock.recordStockIssuedDescription),
prefixIcon: Icons.file_upload_outlined,
sufixIcon: Icons.arrow_circle_right,
onPressed: () => context.router.push(
icon: Icons.file_upload_outlined,
onTap: () => context.router.push(
RecordStockWrapperRoute(
type: StockRecordEntryType.dispatch,
),
)),
DigitListView(
title: localizations
MenuCard(
heading: localizations
.translate(i18.manageStock.recordStockReturnedLabel),
description: localizations.translate(
i18.manageStock.recordStockReturnedDescription,
),
prefixIcon: Icons.settings_backup_restore,
sufixIcon: Icons.arrow_circle_right,
onPressed: () => context.router.push(
icon: Icons.settings_backup_restore,
onTap: () => context.router.push(
RecordStockWrapperRoute(
type: StockRecordEntryType.returned,
),
)),
DigitListView(
title: localizations
MenuCard(
heading: localizations
.translate(i18.manageStock.recordStockDamagedLabel),
description: localizations.translate(
i18.manageStock.recordStockDamagedDescription,
),
prefixIcon: Icons.store,
sufixIcon: Icons.arrow_circle_right,
onPressed: () => context.router.push(
icon: Icons.store,
onTap: () => context.router.push(
RecordStockWrapperRoute(
type: StockRecordEntryType.damaged,
),
)),
DigitListView(
title: localizations
MenuCard(
heading: localizations
.translate(i18.manageStock.recordStockLossLabel),
description: localizations.translate(
i18.manageStock.recordStockDamagedDescription,
),
prefixIcon: Icons.store,
sufixIcon: Icons.arrow_circle_right,
onPressed: () => context.router.push(
icon: Icons.store,
onTap: () => context.router.push(
RecordStockWrapperRoute(
type: StockRecordEntryType.loss,
),
Expand Down
Loading

0 comments on commit d104997

Please sign in to comment.