Add (mr number) field to the WO details bottom sheet

main_design2.0
zaid_daoud 2 years ago
parent 2d0c72b138
commit 630a4e1b9d

@ -39,6 +39,7 @@ class SearchWorkOrder {
this.nurseSignature, this.nurseSignature,
this.woParentDto, this.woParentDto,
this.timer, this.timer,
this.mrNumber,
}); });
SearchWorkOrder.fromJson(dynamic json) { SearchWorkOrder.fromJson(dynamic json) {
@ -51,6 +52,7 @@ class SearchWorkOrder {
assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null; assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
visitDate = json['visitDate']; visitDate = json['visitDate'];
mrNumber = json['mrNumber'];
if (json['assistantEmployees'] != null) { if (json['assistantEmployees'] != null) {
assistantEmployees = []; assistantEmployees = [];
json['assistantEmployees'].forEach((v) { json['assistantEmployees'].forEach((v) {
@ -145,6 +147,7 @@ class SearchWorkOrder {
engSignature = wo.engSignature ?? engSignature; engSignature = wo.engSignature ?? engSignature;
nurseSignature = wo.nurseSignature ?? nurseSignature; nurseSignature = wo.nurseSignature ?? nurseSignature;
woParentDto = wo.woParentDto ?? woParentDto; woParentDto = wo.woParentDto ?? woParentDto;
mrNumber = wo.mrNumber ?? mrNumber;
} }
num id; num id;
@ -180,6 +183,7 @@ class SearchWorkOrder {
String nurseSignature; String nurseSignature;
WoParentDto woParentDto; WoParentDto woParentDto;
TimerModel timer; TimerModel timer;
String mrNumber;
SearchWorkOrder copyWith({ SearchWorkOrder copyWith({
num id, num id,
@ -215,6 +219,7 @@ class SearchWorkOrder {
String nurseSignature, String nurseSignature,
WoParentDto woParentDto, WoParentDto woParentDto,
TimerModel timer, TimerModel timer,
String mrNumber,
}) => }) =>
SearchWorkOrder( SearchWorkOrder(
id: id ?? this.id, id: id ?? this.id,
@ -250,6 +255,7 @@ class SearchWorkOrder {
nurseSignature: nurseSignature ?? this.nurseSignature, nurseSignature: nurseSignature ?? this.nurseSignature,
woParentDto: woParentDto ?? this.woParentDto, woParentDto: woParentDto ?? this.woParentDto,
timer: timer ?? this.timer, timer: timer ?? this.timer,
mrNumber: mrNumber ?? this.mrNumber,
); );
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -319,6 +325,9 @@ class SearchWorkOrder {
if (woParentDto != null) { if (woParentDto != null) {
map['woParentDto'] = woParentDto.toJson(); map['woParentDto'] = woParentDto.toJson();
} }
if (mrNumber != null) {
map['mrNumber'] = mrNumber;
}
return map; return map;
} }

@ -13,7 +13,6 @@ import 'package:test_sa/views/widgets/status/service_request/supplier_engineers_
import '../../../controllers/localization/localization.dart'; import '../../../controllers/localization/localization.dart';
import '../../../controllers/providers/api/status_drop_down/report/service_report_maintenance_situation_provider.dart'; import '../../../controllers/providers/api/status_drop_down/report/service_report_maintenance_situation_provider.dart';
import '../../app_style/colors.dart';
import '../../widgets/timer/app_timer.dart'; import '../../widgets/timer/app_timer.dart';
import '../../widgets/titles/app_sub_title.dart'; import '../../widgets/titles/app_sub_title.dart';
import 'auto_generated_vendor_name.dart'; import 'auto_generated_vendor_name.dart';
@ -144,6 +143,7 @@ class _WorkOrderDetailsBottomSheetState extends State<WorkOrderDetailsBottomShee
} }
if (status?.value == 12 || _workOrder.calllastSituation?.value == 12) { if (status?.value == 12 || _workOrder.calllastSituation?.value == 12) {
_workOrder.calllastSituation = status; _workOrder.calllastSituation = status;
_workOrder.mrNumber = null;
setState(() {}); setState(() {});
} else { } else {
_workOrder.calllastSituation = status; _workOrder.calllastSituation = status;
@ -152,8 +152,16 @@ class _WorkOrderDetailsBottomSheetState extends State<WorkOrderDetailsBottomShee
}, },
woId: widget.subWorkOrder?.parentWOId?.toString(), woId: widget.subWorkOrder?.parentWOId?.toString(),
), ),
if(_workOrder.calllastSituation.value ==12) if (_workOrder.calllastSituation.value == 12) const ASubTitle(" You have to add parts", color: Colors.amber, padding: EdgeInsets.all(2), font: 11),
ASubTitle(" You have to add parts", color: AColors.primaryColor, padding: EdgeInsets.all(2), font: 12,), if (_workOrder.calllastSituation.value == 12) const SizedBox(height: 8),
if (_workOrder.calllastSituation.value == 12)
ATextFormField(
labelText: "MR number",
initialValue: _workOrder.mrNumber,
onSaved: (value) {
_workOrder.mrNumber = value;
},
),
if (_showVendorFields) const SizedBox(height: 8), if (_showVendorFields) const SizedBox(height: 8),
if (_showVendorFields) if (_showVendorFields)
AutoGeneratedVendorName( AutoGeneratedVendorName(

Loading…
Cancel
Save