Gas refill and Asset Transfer attributes addition done

design_3.0_latest
WaseemAbbasi22 9 months ago
parent 27097956cb
commit c15cec364d

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

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

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

@ -24,6 +24,10 @@ class GasRefillModel {
this.engSignature,
this.nurseSignature,
this.workingHours,
this.extensionNo,
this.employeeId,
this.name,
this.createdDate,
this.site,
this.building,
this.floor,
@ -47,6 +51,10 @@ class GasRefillModel {
endTime = json['endTime'];
comment = json['comment'];
workingHours = json['workingHours'];
extensionNo = json['extensionNo'];
employeeId = json['employeeId'];
name = json['name'];
createdDate = json['createdDate'];
try {
final DateTime? sd = DateTime.tryParse(startDate ?? "");
final DateTime? st = DateTime.tryParse(startTime ?? "");
@ -90,7 +98,11 @@ class GasRefillModel {
String? endTime; // Now nullable
String? engSignature; // Now nullable
String? nurseSignature; // Now nullable
num? workingHours; // Now nullable
num? workingHours;
dynamic extensionNo;
String? employeeId;
String? name;
String? createdDate;
Site? site; // Now nullable
Building? building; // Now nullable
Floor? floor; // Now nullable
@ -115,6 +127,10 @@ class GasRefillModel {
String? engSignature,
String? nurseSignature,
num? workingHours,
num? extensionNo,
num? employeeId,
String? name,
String? createdDate,
Site? site,
Building? building,
Floor? floor,
@ -161,6 +177,10 @@ class GasRefillModel {
map['engSignature'] = engSignature;
map['nurseSignature'] = nurseSignature;
map['workingHours'] = workingHours;
map['extensionNo'] = extensionNo;
map['employeeId'] = employeeId;
map['name'] = name;
map['createdDate'] = createdDate;
map['comment'] = comment;
if (site != null) {
map['site'] = site?.toJson(addBuildings: false); // Use '?.' for null safety
@ -223,6 +243,10 @@ class GasRefillModel {
engSignature = model.engSignature;
nurseSignature = model.nurseSignature;
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,
itemBuilder: (cxt, index) {
if (isLoading) return const SizedBox().toRequestShimmer(cxt, isLoading);
bool isServiceRequest = list[index].transactionType == 1;
bool isGasRefill = list[index].transactionType == 2;
bool isAssetTransfer = list[index].transactionType == 3;

@ -79,6 +79,11 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'),
_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) ...[
8.height,
const Divider().defaultStyle(context),
@ -223,4 +228,13 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
],
).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,
context.translation.gasRefillRequest.heading5(context),
8.height,
'${context.translation.gasRequest}: ${gasRefillModel.gazRefillDetails![0].gasType?.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.site}: ${gasRefillModel.site?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.department}: ${gasRefillModel.department?.name?.cleanupWhitespace.capitalizeFirstOfEach}'.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),
'${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails![0].requestedQty ?? 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);
}
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
Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context);
_gasRefillProvider ??= Provider.of<GasRefillProvider>(context, listen: false);

Loading…
Cancel
Save