Gas refill and Asset Transfer attributes addition done

design_3.0_internal_audit_module
WaseemAbbasi22 1 year ago
parent 27097956cb
commit c15cec364d

@ -47,6 +47,7 @@ class GasRefillProvider extends ChangeNotifier {
Future<GasRefillModel?> getGasRefillObjectById(num id) async { Future<GasRefillModel?> getGasRefillObjectById(num id) async {
try { try {
Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gazRefillId=$id"); Response response = await ApiManager.instance.get(URLs.getGasRefillById + "?gazRefillId=$id");
if (response.statusCode >= 200 && response.statusCode < 300) { if (response.statusCode >= 200 && response.statusCode < 300) {
return GasRefillModel.fromJson(json.decode(response.body)["data"]); return GasRefillModel.fromJson(json.decode(response.body)["data"]);
} else { } else {

@ -526,5 +526,9 @@
"userName": "اسم المستخدم", "userName": "اسم المستخدم",
"siteName": "اسم الموقع", "siteName": "اسم الموقع",
"pointName": "اسم النقطة", "pointName": "اسم النقطة",
"checkIn": "تسجيل الدخول" "checkIn": "تسجيل الدخول",
"createdDate": "تاريخ الإنشاء",
"employeeId": "رقم الموظف",
"extensionNo": "رقم التمديد",
"recurrentWo": "أمر العمل المتكرر"
} }

@ -530,5 +530,9 @@
"userName": "User Name", "userName": "User Name",
"siteName": "Site Name", "siteName": "Site Name",
"pointName": "Point Name", "pointName": "Point Name",
"checkIn": "Check in" "checkIn": "Check in",
"createdDate": "Created Date",
"employeeId": "Employee ID",
"extensionNo": "Extension No",
"recurrentWo": "Recurrent WO"
} }

@ -52,6 +52,10 @@ class AssetTransfer {
this.destDepartmentName, this.destDepartmentName,
this.destBuildingName, this.destBuildingName,
this.applied, this.applied,
this.extensionNo,
this.name,
this.employeeId,
this.createdDate,
this.createdOn, this.createdOn,
this.destFloorName, this.destFloorName,
this.destSiteName, this.destSiteName,
@ -155,6 +159,10 @@ class AssetTransfer {
destDepartmentName = json['destDepartmentName']; destDepartmentName = json['destDepartmentName'];
destBuildingName = json['destBuildingName']; destBuildingName = json['destBuildingName'];
applied = json['applied']; applied = json['applied'];
extensionNo = json['extensionNo'];
employeeId = json['employeeId'];
name = json['name'];
createdDate = json['createdDate'];
createdOn = json['createdOn']; createdOn = json['createdOn'];
destFloorName = json['destFloorName']; destFloorName = json['destFloorName'];
destSiteName = json['destSiteName']; destSiteName = json['destSiteName'];
@ -234,6 +242,10 @@ class AssetTransfer {
String? receiverMachineStatusName; String? receiverMachineStatusName;
String? receiverEngSignatureUrl; String? receiverEngSignatureUrl;
bool? applied; bool? applied;
dynamic extensionNo;
String? employeeId;
String? name;
String? createdDate;
String? createdOn; String? createdOn;
String? modifiedOn; String? modifiedOn;
List<VisitTimers>? senderVisitTimers; List<VisitTimers>? senderVisitTimers;
@ -293,6 +305,10 @@ class AssetTransfer {
String? receiverMachineStatusName, String? receiverMachineStatusName,
String? receiverEngSignatureUrl, String? receiverEngSignatureUrl,
bool? applied, bool? applied,
dynamic extensionNo,
String? employeeId,
String? name,
String? createdDate,
String? createdOn, String? createdOn,
String? modifiedOn, String? modifiedOn,
String? assetSerialNo, String? assetSerialNo,
@ -359,6 +375,10 @@ class AssetTransfer {
receiverMachineStatusName: receiverMachineStatusName ?? this.receiverMachineStatusName, receiverMachineStatusName: receiverMachineStatusName ?? this.receiverMachineStatusName,
receiverEngSignatureUrl: receiverEngSignatureUrl ?? this.receiverEngSignatureUrl, receiverEngSignatureUrl: receiverEngSignatureUrl ?? this.receiverEngSignatureUrl,
applied: applied ?? this.applied, applied: applied ?? this.applied,
extensionNo: extensionNo??this.extensionNo,
employeeId: employeeId??this.employeeId,
name: name??this.name,
createdDate: createdDate??this.createdDate,
createdOn: createdOn ?? this.createdOn, createdOn: createdOn ?? this.createdOn,
modifiedOn: modifiedOn ?? this.modifiedOn, modifiedOn: modifiedOn ?? this.modifiedOn,
assetSerialNo: assetSerialNo ?? this.assetSerialNo, assetSerialNo: assetSerialNo ?? this.assetSerialNo,
@ -436,6 +456,10 @@ class AssetTransfer {
map["receiverMachineStatusName"] = receiverMachineStatusName; map["receiverMachineStatusName"] = receiverMachineStatusName;
map["receiverEngSignatureUrl"] = receiverEngSignatureUrl; map["receiverEngSignatureUrl"] = receiverEngSignatureUrl;
map["applied"] = applied; map["applied"] = applied;
map["extensionNo"] = extensionNo;
map["employeeId"] = employeeId;
map["name"] = name;
map["createdDate"] = createdDate;
map["createdOn"] = createdOn; map["createdOn"] = createdOn;
map["modifiedOn"] = modifiedOn; map["modifiedOn"] = modifiedOn;
map["assetSerialNo"] = assetSerialNo; map["assetSerialNo"] = assetSerialNo;
@ -552,6 +576,10 @@ class AssetTransfer {
receiverMachineStatusName = assetTransfer.receiverMachineStatusName; receiverMachineStatusName = assetTransfer.receiverMachineStatusName;
receiverEngSignatureUrl = assetTransfer.receiverEngSignatureUrl; receiverEngSignatureUrl = assetTransfer.receiverEngSignatureUrl;
applied = assetTransfer.applied; applied = assetTransfer.applied;
extensionNo = assetTransfer.extensionNo;
employeeId = assetTransfer.employeeId;
name = assetTransfer.name;
createdDate = assetTransfer.createdDate;
createdOn = assetTransfer.createdOn; createdOn = assetTransfer.createdOn;
modifiedOn = assetTransfer.modifiedOn; modifiedOn = assetTransfer.modifiedOn;
assetSerialNo = assetTransfer.assetSerialNo; assetSerialNo = assetTransfer.assetSerialNo;

@ -24,6 +24,10 @@ class GasRefillModel {
this.engSignature, this.engSignature,
this.nurseSignature, this.nurseSignature,
this.workingHours, this.workingHours,
this.extensionNo,
this.employeeId,
this.name,
this.createdDate,
this.site, this.site,
this.building, this.building,
this.floor, this.floor,
@ -47,6 +51,10 @@ class GasRefillModel {
endTime = json['endTime']; endTime = json['endTime'];
comment = json['comment']; comment = json['comment'];
workingHours = json['workingHours']; workingHours = json['workingHours'];
extensionNo = json['extensionNo'];
employeeId = json['employeeId'];
name = json['name'];
createdDate = json['createdDate'];
try { try {
final DateTime? sd = DateTime.tryParse(startDate ?? ""); final DateTime? sd = DateTime.tryParse(startDate ?? "");
final DateTime? st = DateTime.tryParse(startTime ?? ""); final DateTime? st = DateTime.tryParse(startTime ?? "");
@ -90,7 +98,11 @@ class GasRefillModel {
String? endTime; // Now nullable String? endTime; // Now nullable
String? engSignature; // Now nullable String? engSignature; // Now nullable
String? nurseSignature; // Now nullable String? nurseSignature; // Now nullable
num? workingHours; // Now nullable num? workingHours;
dynamic extensionNo;
String? employeeId;
String? name;
String? createdDate;
Site? site; // Now nullable Site? site; // Now nullable
Building? building; // Now nullable Building? building; // Now nullable
Floor? floor; // Now nullable Floor? floor; // Now nullable
@ -115,6 +127,10 @@ class GasRefillModel {
String? engSignature, String? engSignature,
String? nurseSignature, String? nurseSignature,
num? workingHours, num? workingHours,
num? extensionNo,
num? employeeId,
String? name,
String? createdDate,
Site? site, Site? site,
Building? building, Building? building,
Floor? floor, Floor? floor,
@ -161,6 +177,10 @@ class GasRefillModel {
map['engSignature'] = engSignature; map['engSignature'] = engSignature;
map['nurseSignature'] = nurseSignature; map['nurseSignature'] = nurseSignature;
map['workingHours'] = workingHours; map['workingHours'] = workingHours;
map['extensionNo'] = extensionNo;
map['employeeId'] = employeeId;
map['name'] = name;
map['createdDate'] = createdDate;
map['comment'] = comment; map['comment'] = comment;
if (site != null) { if (site != null) {
map['site'] = site?.toJson(addBuildings: false); // Use '?.' for null safety map['site'] = site?.toJson(addBuildings: false); // Use '?.' for null safety
@ -223,6 +243,10 @@ class GasRefillModel {
engSignature = model.engSignature; engSignature = model.engSignature;
nurseSignature = model.nurseSignature; nurseSignature = model.nurseSignature;
workingHours = model.workingHours; workingHours = model.workingHours;
extensionNo = model.extensionNo;
employeeId = model.employeeId;
name = model.name;
createdDate = model.createdDate;
} }
} }

@ -25,6 +25,7 @@ class RequestItemViewList extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (cxt, index) { itemBuilder: (cxt, index) {
if (isLoading) return const SizedBox().toRequestShimmer(cxt, isLoading); if (isLoading) return const SizedBox().toRequestShimmer(cxt, isLoading);
bool isServiceRequest = list[index].transactionType == 1; bool isServiceRequest = list[index].transactionType == 1;
bool isGasRefill = list[index].transactionType == 2; bool isGasRefill = list[index].transactionType == 2;
bool isAssetTransfer = list[index].transactionType == 3; bool isAssetTransfer = list[index].transactionType == 3;

@ -79,6 +79,11 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'), _buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'), if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'),
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'), _buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
//TODO need to confirm where to display this new data...
infoText(label:context.translation.gasRequest ,value:_model?.extensionNo ),
infoText(label:context.translation.employeeId ,value:_model?.employeeId ),
infoText(label:context.translation.name ,value:_model?.name ),
infoText(label:context.translation.createdDate ,value:_model?.createdDate?.toInitialVisitCardFormat),
if ((_model?.comment ?? "").isNotEmpty) ...[ if ((_model?.comment ?? "").isNotEmpty) ...[
8.height, 8.height,
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
@ -223,4 +228,13 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
], ],
).toShadowContainer(context); ).toShadowContainer(context);
} }
Widget infoText({String ?label,String ?value,}){
if(value==null||value.isEmpty){
return const SizedBox();
}
else {
return '$label: $value'.bodyText(context);
}
}
} }

@ -108,12 +108,19 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
8.height, 8.height,
context.translation.gasRefillRequest.heading5(context), context.translation.gasRefillRequest.heading5(context),
8.height, 8.height,
'${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails![0].gasType?.name}'.bodyText(context), '${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails![0].gasType?.name}'.bodyText(context),
'${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails![0].cylinderType?.name}'.bodyText(context), '${context.translation.cylinderType}: ${gasRefillModel.gazRefillDetails![0].cylinderType?.name}'.bodyText(context),
'${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails![0].cylinderSize?.name}'.bodyText(context), '${context.translation.cylinderSize}: ${gasRefillModel.gazRefillDetails![0].cylinderSize?.name}'.bodyText(context),
'${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), '${context.translation.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context), '${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.requestNo}: ${gasRefillModel.gazRefillNo}'.bodyText(context), '${context.translation.requestNo}: ${gasRefillModel.gazRefillNo}'.bodyText(context),
//TODO need to confirm where to display this new data...
infoText(label:context.translation.gasRequest ,value:gasRefillModel.extensionNo ),
infoText(label:context.translation.employeeId ,value:gasRefillModel.employeeId ),
infoText(label:context.translation.name ,value:gasRefillModel.name ),
infoText(label:context.translation.createdDate ,value:gasRefillModel.createdDate?.toInitialVisitCardFormat),
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
'${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails![0].requestedQty ?? 0}'.bodyText(context), '${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails![0].requestedQty ?? 0}'.bodyText(context),
'${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails![0].deliverdQty ?? 0}'.bodyText(context), '${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails![0].deliverdQty ?? 0}'.bodyText(context),
@ -221,4 +228,14 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
], ],
).toShadowContainer(context, padding: 0); ).toShadowContainer(context, padding: 0);
} }
Widget infoText({String ?label,String ?value,}){
if(value==null||value.isEmpty){
return const SizedBox();
}
else {
return '$label: $value'.bodyText(context);
}
}
} }

@ -176,6 +176,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context); _userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context); _settingProvider = Provider.of<SettingProvider>(context);
_gasRefillProvider ??= Provider.of<GasRefillProvider>(context, listen: false); _gasRefillProvider ??= Provider.of<GasRefillProvider>(context, listen: false);

Loading…
Cancel
Save