Skip to content

Commit

Permalink
Merge pull request #570 from odisha-muktasoft/mb-uat-merge
Browse files Browse the repository at this point in the history
Mb uat merge
  • Loading branch information
Tulika-eGov authored Jul 25, 2024
2 parents 3b1bbf0 + ec3eea1 commit 37c0842
Show file tree
Hide file tree
Showing 12 changed files with 560 additions and 193 deletions.
17 changes: 15 additions & 2 deletions frontend/works_shg_app/lib/blocs/employee/mb/mb_crud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,24 @@ class MeasurementCrudBloc
Client client = Client();

try {

bool createCheck=false;
state.maybeMap(orElse:()=>{},
loaded: (value) {
if ((event.type== MBScreen.create && value.measurement!.wfStatus == "SUBMITTED")||(event.type== MBScreen.create && value.measurement!.wfStatus == "DRAFTED")) {

createCheck=true;

}
},
);
// createCheck=true;
emit(const MeasurementCrudState.loading());

final Measurement res = await MBRepository(client.init()).updateMeasurement(
url: event.type== MBScreen.update? Urls.measurementService.updateMeasurement:Urls.measurementService.createMeasurement,
url:
createCheck?Urls.measurementService.updateMeasurement
:
event.type== MBScreen.update? Urls.measurementService.updateMeasurement:Urls.measurementService.createMeasurement,
body: {
"measurements": [MBLogic.measurementToMap(event.measurement)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class MeasurementInboxBloc
};
final MBInboxResponse res =
await MBRepository(client.init()).fetchMbInbox(
url: Urls.measurementService.measurementInbox, body: s,

url: Urls.measurementService.measurementInbox,
body: s,
);
if (event.offset == 0) {
emit(MeasurementInboxState.loaded(
Expand Down Expand Up @@ -92,6 +92,8 @@ class MeasurementInboxBloc
}
} on DioError catch (e) {
emit(MeasurementInboxState.error(e.response?.data['Errors'][0]['code']));
} catch (e) {
emit(const MeasurementInboxState.error("CORE_SOMETHING_WENT_WRONG"));
}
}
//search
Expand All @@ -106,7 +108,6 @@ class MeasurementInboxBloc
emit(const MeasurementInboxState.loading());
}


final MBInboxResponse res =
await MBRepository(client.init()).fetchMbInbox(
url: Urls.measurementService.measurementInbox,
Expand Down Expand Up @@ -172,7 +173,6 @@ class MeasurementInboxBloc
return null;
},
loaded: (value) async {

value.data['inbox']!['offset'] = event.offset;
final MBInboxResponse res = await MBRepository(client.init())
.fetchMbInbox(
Expand Down
515 changes: 394 additions & 121 deletions frontend/works_shg_app/lib/pages/employee/mb_detail_page.dart

Large diffs are not rendered by default.

124 changes: 99 additions & 25 deletions frontend/works_shg_app/lib/pages/employee/mb_history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,51 @@ class _MBHistoryBookPageState extends State<MBHistoryBookPage> {
loaded: (mbWorkFlow) {
final g = mbWorkFlow
.musterWorkFlowModel?.processInstances;
return FloatActionCard(
actions: () {
DigitActionDialog.show(
context,
widget: CommonButtonCard(
g: g,
contractNumber: widget.contractNumber,
mbNumber: widget.mbNumber,
type: widget.type,
),
);
},
amount: value.data.first.totalAmount != null
? value.data.first.totalAmount!.roundToDouble()
.toStringAsFixed(2)
: "0.00",
openButtonSheet: () {
return Draggable(
childWhenDragging:FloatActionCard(
actions: () {
DigitActionDialog.show(
context,
widget: CommonButtonCard(
g: g,
contractNumber: widget.contractNumber,
mbNumber: widget.mbNumber,
type: widget.type,
),
);
},
amount: value.data.first.totalAmount != null
? value.data.first.totalAmount!
.roundToDouble()
.toStringAsFixed(2)
: "0.00",
openButtonSheet: () {
_openBottomSheet(
t,
context,
value.data.first.totalSorAmount!,
value.data.first.totalNorSorAmount!,
value.data.first.totalAmount!,
g,
widget.contractNumber,
widget.mbNumber,
(g != null &&
(g.first.nextActions !=
null &&
g.first.nextActions!
.isEmpty))
? false
: true);
},
totalAmountText: t.translate(
i18.measurementBook.totalMbAmount),
showAction: (g != null &&
(g.first.nextActions != null &&
g.first.nextActions!.isEmpty))
? false
: true,
) ,
onDragEnd: (details) {
_openBottomSheet(
t,
context,
Expand All @@ -109,13 +137,50 @@ class _MBHistoryBookPageState extends State<MBHistoryBookPage> {
? false
: true);
},
totalAmountText: t.translate(
i18.measurementBook.totalMbAmount),
showAction: (g != null &&
(g.first.nextActions != null &&
g.first.nextActions!.isEmpty))
? false
: true,
feedback: const SizedBox.shrink(),
child: FloatActionCard(
actions: () {
DigitActionDialog.show(
context,
widget: CommonButtonCard(
g: g,
contractNumber: widget.contractNumber,
mbNumber: widget.mbNumber,
type: widget.type,
),
);
},
amount: value.data.first.totalAmount != null
? value.data.first.totalAmount!
.roundToDouble()
.toStringAsFixed(2)
: "0.00",
openButtonSheet: () {
_openBottomSheet(
t,
context,
value.data.first.totalSorAmount!,
value.data.first.totalNorSorAmount!,
value.data.first.totalAmount!,
g,
widget.contractNumber,
widget.mbNumber,
(g != null &&
(g.first.nextActions !=
null &&
g.first.nextActions!
.isEmpty))
? false
: true);
},
totalAmountText: t.translate(
i18.measurementBook.totalMbAmount),
showAction: (g != null &&
(g.first.nextActions != null &&
g.first.nextActions!.isEmpty))
? false
: true,
),
);
},
);
Expand Down Expand Up @@ -174,7 +239,8 @@ class _MBHistoryBookPageState extends State<MBHistoryBookPage> {
widget.type == MBScreen.update ? index : index;
if (adjustedIndex <= k.length) {
return CommonMBCard(
padding: const EdgeInsets.only(left:8.0,top: 8.0,right: 8.0,bottom: 0),
padding: const EdgeInsets.only(
left: 8.0, top: 8.0, right: 8.0, bottom: 0),
headLabel:
"${DateFormat('dd/MM/yyyy').format(DateTime.fromMillisecondsSinceEpoch(k[adjustedIndex].startDate!))} - ${DateFormat('dd/MM/yyyy').format(DateTime.fromMillisecondsSinceEpoch(k[adjustedIndex].endDate!))}",
items: {
Expand Down Expand Up @@ -257,6 +323,14 @@ class _MBHistoryBookPageState extends State<MBHistoryBookPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
const Center(
child: SizedBox(
width: 100,
child: Divider(
thickness: 5,
),
),
),
Container(
decoration: const BoxDecoration(
border: Border(
Expand Down
29 changes: 15 additions & 14 deletions frontend/works_shg_app/lib/pages/employee/mb_inbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {

@override
void initState() {
context
context
.read<ProjectTypeBloc>()
.add(ProjectTypeEvent(tenantId: GlobalVariables.tenantId!));

context.read<MeasurementInboxBloc>().add(
MeasurementBookInboxBlocEvent(
businessService: "MB",
Expand All @@ -53,8 +53,6 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
),
);



context.read<WageSeekerLocationBloc>().add(
LocationEventWageSeeker(tenantId: GlobalVariables.tenantId!),
);
Expand Down Expand Up @@ -83,13 +81,13 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
state.maybeMap(
orElse: () => {},
loaded: (value) {
if (value.search && value.data.length==1) {
if (value.search && value.data.length == 1) {
context.read<MeasurementInboxBloc>().add(
MeasurementBookInboxSearchRepeatBlocEvent(
businessService: "MB",
limit: 10,
moduleName: 'measurement-module',
offset: value.data['inbox']!['offset']+10,
offset: value.data['inbox']!['offset'] + 10,
tenantId: GlobalVariables.tenantId!,
),
);
Expand Down Expand Up @@ -188,10 +186,8 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Back(

callback: () {
context.router.pop();

},
),
Padding(
Expand Down Expand Up @@ -303,8 +299,6 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
},
icon:
SvgPicture.asset(Constants.sort)),


],
),
),
Expand All @@ -320,10 +314,11 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
(BuildContext context, int index) {
// Display items

return Center(
return Center(
child: EmptyImage(
align: Alignment.center,
label: t.translate(i18.measurementBook.mbNotFound),
label: t.translate(
i18.measurementBook.mbNotFound),
),
);
},
Expand Down Expand Up @@ -463,15 +458,21 @@ class _MeasurementBookInboxPageState extends State<MeasurementBookInboxPage> {
child: CircularProgressIndicator.adaptive(),
);
},
error: (value) {
return Center(
child: EmptyImage(
align: Alignment.center,
label: t.translate(i18.common.wentWrong),
),
);
},
);
},
),
);
},
);
}


}

class MyHeaderDelegate extends SliverPersistentHeaderDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ class _CreateTimeExtensionRequestPage
i18.workOrder
.extensionReqInDaysMinVal,
),
'max':(_)=>t.translate(
i18.workOrder
.extensionReqInDaysMaxVal,
),
// 'max':(_)=>t.translate(
// i18.workOrder
// .extensionReqInDaysMaxVal,
// ),
},
),
DigitTextFormField(
Expand Down Expand Up @@ -445,7 +445,7 @@ class _CreateTimeExtensionRequestPage
extensionDaysKey: FormControl<String>(value: extensionDays ?? '', validators: [
Validators.required,
Validators.min('1'),
Validators.max('365')

]),
reasonForExtensionKey: FormControl<String>(value: extensionReason ?? '', validators: [
Validators.required,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ class IndividualDetailsPageState extends State<IndividualDetailsPage> {
'required': (_) => t.translate(
i18.wageSeeker.aadhaarRequired,
),
'minLength': (_) => t.translate(
i18.wageSeeker.minAadhaarCharacters,
),
'maxLength': (_) => t.translate(
i18.wageSeeker.maxAadhaarCharacters,
),
},
),
DigitTextFormField(
Expand Down Expand Up @@ -576,6 +582,8 @@ class IndividualDetailsPageState extends State<IndividualDetailsPage> {
]
: [
Validators.required,
Validators.minLength(12),
Validators.maxLength(12)
]),
nameKey: FormControl<String>(
value: individualDetails.name ?? '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Login {

class Common {
const Common();
String get wentWrong=>"CORE_SOMETHING_WENT_WRONG";
String get statementnotfound=>"WORK_ORDER_STATEMENT_NOT_FOUND";
String get noFileSelected=>"WORKS_NO_FILE_SELECTED";
String get comments=>"WF_COMMON_COMMENTS";
Expand Down
2 changes: 1 addition & 1 deletion frontend/works_shg_app/lib/widgets/mb/mb_detail_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CommonMBCard extends StatelessWidget {
width: MediaQuery.of(context).size.width / 2,
child: Text(
t.translate(i18.measurementBook.mbSlaDaysRemaining),
style: theme.textTheme.headline5,
style: theme.textTheme.headlineSmall,
textAlign: TextAlign.start,
),
),
Expand Down
6 changes: 3 additions & 3 deletions frontend/works_shg_app/lib/widgets/mb/multi_line_items.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ class _MultiLineItemsState extends State<MultiLineItems> {
),
),
Padding(
padding: const EdgeInsets.only(left: 4.0),
padding: const EdgeInsets.only(left: 3.0),
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.8 / 3,
child: DigitTextField(
inputFormatter: [
FilteringTextInputFormatter.allow(
RegExp(r'^\d*\.?\d{0,4}')),
RegExp(r'^\d*\.?\d{0,4}'),),
],
label: t.translate(i18.measurementBook.widthLabel),
isDisabled: widget.viewMode,
Expand All @@ -263,7 +263,7 @@ class _MultiLineItemsState extends State<MultiLineItems> {
),
),
Padding(
padding: const EdgeInsets.only(left: 4.0, right: 2.0),
padding: const EdgeInsets.only(left: 3, right: 0),
child: SizedBox(
width: MediaQuery.of(context).size.width * 0.8 / 3,
child: DigitTextField(
Expand Down
Loading

0 comments on commit 37c0842

Please sign in to comment.