From c8862bbb633d7d5f9efc1863246cf898dbb8d04d Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 3 Feb 2025 10:33:32 +0300 Subject: [PATCH] device transfer and Gas refill new data added --- lib/l10n/app_ar.arb | 5 +- lib/l10n/app_en.arb | 5 +- lib/models/device/asset_transfer.dart | 158 ++++++++++-------- lib/models/new_models/gas_refill_model.dart | 30 ++++ .../device_transfer_details.dart | 12 ++ .../user/gas_refill/gas_refill_details.dart | 13 ++ 6 files changed, 155 insertions(+), 68 deletions(-) diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb index 724c316d..3d5cfafd 100644 --- a/lib/l10n/app_ar.arb +++ b/lib/l10n/app_ar.arb @@ -404,5 +404,8 @@ "lastPmDate" : "موعد الزيارة الوقائية الأخيرة", "assetScan" : "مسح الجهاز", "pickManually" : "اختر يدويا", - "searchAsset" : "ابحث عن جهاز" + "searchAsset" : "ابحث عن جهاز", + "createdDate": "تاريخ الإنشاء", + "employeeId": "رقم الموظف", + "extensionNo": "رقم التمديد" } \ No newline at end of file diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 3cb1625d..b19606f9 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -406,5 +406,8 @@ "lastPmDate" : "Last PM Date", "assetScan" : "Asset Scan", "pickManually" : "Pick Manually", - "searchAsset" : "Search Asset" + "searchAsset" : "Search Asset", + "createdDate": "Created Date", + "employeeId": "Employee ID", + "extensionNo": "Extension No" } \ No newline at end of file diff --git a/lib/models/device/asset_transfer.dart b/lib/models/device/asset_transfer.dart index 7030c7f1..db113be3 100644 --- a/lib/models/device/asset_transfer.dart +++ b/lib/models/device/asset_transfer.dart @@ -8,71 +8,76 @@ import 'package:test_sa/models/timer_model.dart'; import 'asset_transfer_attachment.dart'; class AssetTransfer { - AssetTransfer( - {this.id, - this.transferNo, - this.transferCode, - this.assetId, - this.destSiteId, - this.destBuildingId, - this.destFloorId, - this.destDepartmentId, - this.destRoomId, - this.senderSiteId, - this.senderBuildingId, - this.senderFloorId, - this.senderDepartmentId, - this.senderRoom, - this.senderAssignedEmployeeId, - this.senderMachineStatusId, - this.senderComment, - this.comment, - this.receiverEndUserId, - this.receiverEndUserName, - this.senderStartDate, - this.senderEndDate, - this.senderWorkingHours, - this.senderTravelingHours, - this.senderEngSignature, - this.senderAttachments, - this.receiverAssignedEmployeeId, - this.receiverMachineStatusId, - this.receiverComment, - this.receiverStartDate, - this.receiverEndDate, - this.receiverWorkingHours, - this.receiverTravelingHours, - this.receiverEngSignature, - this.receiverAttachments, - this.assetNumber, - this.assetName, - this.manufacturerName, - this.modelName, - this.assetSerialNo, - this.destDepartmentName, - this.destBuildingName, - this.applied, - this.createdOn, - this.destFloorName, - this.destSiteName, - this.manufacturerId, - this.modelId, - this.modifiedOn, - this.receiverAssignedEmployeeName, - this.receiverEngSignatureUrl, - this.receiverMachineStatusName, - this.senderAssignedEmployeeName, - this.senderBuildingName, - this.senderDepartmentName, - this.senderEngSignatureUrl, - this.senderFloorName, - this.senderMachineStatusName, - this.senderSiteName, - this.supplierId, - this.supplierName, - this.senderVisitTimers, - this.receiverVisitTimers, - this.tbsTimer}); + AssetTransfer({ + this.id, + this.transferNo, + this.transferCode, + this.assetId, + this.destSiteId, + this.destBuildingId, + this.destFloorId, + this.destDepartmentId, + this.destRoomId, + this.senderSiteId, + this.senderBuildingId, + this.senderFloorId, + this.senderDepartmentId, + this.senderRoom, + this.senderAssignedEmployeeId, + this.senderMachineStatusId, + this.senderComment, + this.comment, + this.receiverEndUserId, + this.receiverEndUserName, + this.senderStartDate, + this.senderEndDate, + this.senderWorkingHours, + this.senderTravelingHours, + this.senderEngSignature, + this.senderAttachments, + this.receiverAssignedEmployeeId, + this.receiverMachineStatusId, + this.receiverComment, + this.receiverStartDate, + this.receiverEndDate, + this.receiverWorkingHours, + this.receiverTravelingHours, + this.receiverEngSignature, + this.receiverAttachments, + this.assetNumber, + this.assetName, + this.manufacturerName, + this.modelName, + this.assetSerialNo, + this.destDepartmentName, + this.destBuildingName, + this.applied, + this.createdOn, + this.destFloorName, + this.destSiteName, + this.manufacturerId, + this.modelId, + this.modifiedOn, + this.receiverAssignedEmployeeName, + this.receiverEngSignatureUrl, + this.receiverMachineStatusName, + this.senderAssignedEmployeeName, + this.senderBuildingName, + this.senderDepartmentName, + this.senderEngSignatureUrl, + this.senderFloorName, + this.senderMachineStatusName, + this.senderSiteName, + this.supplierId, + this.supplierName, + this.senderVisitTimers, + this.receiverVisitTimers, + this.tbsTimer, + this.extensionNo, + this.employeeId, + this.name, + this.createdDate, + }); AssetTransfer.fromJson(dynamic json) { id = json['id']; @@ -100,6 +105,10 @@ class AssetTransfer { senderWorkingHours = json['senderWorkingHours']; senderTravelingHours = json['senderTravelingHours']; senderEngSignature = json['senderEngSignature']; + extensionNo = json['extensionNo']; + employeeId = json['employeeId']; + name = json['name']; + createdDate = json['createdDate']; if (json['senderAttachments'] != null) { senderAttachments = []; json['senderAttachments'].forEach((v) { @@ -239,6 +248,10 @@ class AssetTransfer { List senderVisitTimers; List receiverVisitTimers; TimerModel tbsTimer = TimerModel(); + String extensionNo; + String employeeId; + String name; + String createdDate; AssetTransfer copyWith( {num id, @@ -305,6 +318,10 @@ class AssetTransfer { String destDepartmentName, List senderVisitTimers, List receiverVisitTimers, + String extensionNo, + String employeeId, + String name, + String createdDate, TimerModel tbsTimer}) => AssetTransfer( id: id ?? this.id, @@ -370,7 +387,12 @@ class AssetTransfer { senderVisitTimers: senderVisitTimers ?? this.senderVisitTimers, receiverVisitTimers: receiverVisitTimers ?? this.receiverVisitTimers, tbsTimer: tbsTimer ?? this.tbsTimer, - manufacturerName: manufacturerName ?? this.manufacturerName); + manufacturerName: manufacturerName ?? this.manufacturerName, + extensionNo: extensionNo ?? this.extensionNo, + employeeId: employeeId ?? this.employeeId, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, + ); Map toJson() { final map = {}; @@ -399,6 +421,10 @@ class AssetTransfer { map['senderWorkingHours'] = senderWorkingHours; map['senderTravelingHours'] = senderTravelingHours; map['senderEngSignature'] = senderEngSignature; + map['extensionNo'] = extensionNo; + map['employeeId'] = employeeId; + map['name'] = name; + map['createdDate'] = createdDate; if (this.senderVisitTimers != null) { map['assetTransferSenderTimers'] = this.senderVisitTimers.map((v) => v.toJson()).toList(); } diff --git a/lib/models/new_models/gas_refill_model.dart b/lib/models/new_models/gas_refill_model.dart index 4b0d9b89..4c71a3b7 100644 --- a/lib/models/new_models/gas_refill_model.dart +++ b/lib/models/new_models/gas_refill_model.dart @@ -35,6 +35,10 @@ class GasRefillModel { this.localEngineerSignature, this.localNurseSignature, this.timer, + this.extensionNo, + this.employeeId, + this.name, + this.createdDate, }); GasRefillModel.fromJson(dynamic json) { @@ -48,6 +52,11 @@ 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 sd = DateTime.tryParse(startDate ?? ""); final st = DateTime.tryParse(startTime ?? ""); @@ -102,6 +111,11 @@ class GasRefillModel { Uint8List localNurseSignature; Uint8List localEngineerSignature; TimerModel timer = TimerModel(); + String extensionNo; + String employeeId; + String name; + String createdDate; + GasRefillModel copyWith({ num id, @@ -124,6 +138,10 @@ class GasRefillModel { String comment, List gazRefillDetails, TimerModel timer, + String extensionNo, + String employeeId, + String name, + String createdDate, }) => GasRefillModel( id: id ?? this.id, @@ -146,6 +164,10 @@ class GasRefillModel { comment: comment ?? this.comment, gazRefillDetails: gazRefillDetails ?? this.gazRefillDetails, timer: timer ?? this.timer, + extensionNo: extensionNo ?? this.extensionNo, + employeeId: employeeId ?? this.employeeId, + name: name ?? this.name, + createdDate: createdDate ?? this.createdDate, ); Map toJson() { @@ -162,6 +184,10 @@ class GasRefillModel { map['nurseSignature'] = nurseSignature; map['workingHours'] = workingHours; map['comment'] = comment; + map['extensionNo'] = extensionNo; + map['employeeId'] = employeeId; + map['name'] = name; + map['createdDate'] = createdDate; if (site != null) { map['site'] = site.toJson(addBuildings: false); } @@ -223,6 +249,10 @@ class GasRefillModel { engSignature = model.engSignature; nurseSignature = model.nurseSignature; workingHours = model.workingHours; + extensionNo= model.extensionNo; + employeeId=model.employeeId; + name=model.name; + createdDate=model.createdDate; } } diff --git a/lib/views/pages/device_transfer/device_transfer_details.dart b/lib/views/pages/device_transfer/device_transfer_details.dart index 9b26a152..a5618c48 100644 --- a/lib/views/pages/device_transfer/device_transfer_details.dart +++ b/lib/views/pages/device_transfer/device_transfer_details.dart @@ -79,6 +79,10 @@ class _DeviceTransferDetailsState extends State { _buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'), if (_model?.receiverEndUserName != null) _buildTextWidget('${context.translation.receiverName} : ${_model?.receiverEndUserName ?? ""}'), _buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'), + infoText(label:context.translation.extensionNo ,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.toFirstActionFormat), if ((_model?.comment ?? "").isNotEmpty) ...[ 8.height, const Divider().defaultStyle(context), @@ -225,4 +229,12 @@ class _DeviceTransferDetailsState extends State { ], ).toShadowContainer(context); } + Widget infoText({String label,String value,}){ + if(value==null||value.isEmpty){ + return const SizedBox(); + } + else { + return '$label: $value'.bodyText(context); + } +} } diff --git a/lib/views/pages/user/gas_refill/gas_refill_details.dart b/lib/views/pages/user/gas_refill/gas_refill_details.dart index c7dc13a0..7b391df4 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_details.dart +++ b/lib/views/pages/user/gas_refill/gas_refill_details.dart @@ -113,6 +113,10 @@ class _GasRefillDetailsPageState extends State { '${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), + infoText(label:context.translation.extensionNo ,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.toFirstActionFormat), const Divider().defaultStyle(context), '${context.translation.requestedQuantity}: ${gasRefillModel.gazRefillDetails[0]?.requestedQty ?? 0}'.bodyText(context), '${context.translation.deliveredQuantity}: ${gasRefillModel.gazRefillDetails[0]?.deliverdQty ?? 0}'.bodyText(context), @@ -220,4 +224,13 @@ class _GasRefillDetailsPageState extends State { ], ).toShadowContainer(context, padding: 0); } + Widget infoText({String label,String value,}){ + if(value==null||value.isEmpty){ + return const SizedBox(); + } + else { + return '$label: $value'.bodyText(context); + } + + } }