diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb index 16ca034c..6179ac8f 100644 --- a/lib/l10n/app_ar.arb +++ b/lib/l10n/app_ar.arb @@ -547,5 +547,6 @@ "since": "منذ", "rejectionDetails": "تفاصيل الرفض", "part": "جزء", - "creationDate": "تاريخ الإنشاء" + "creationDate": "تاريخ الإنشاء", + "transferType": "نوع النقل" } \ No newline at end of file diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f2f7bfd7..70c91225 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -544,6 +544,7 @@ "createAssetTransferRequest": "Create Asset Transfer Request", "arrivedDate": "Arrived Date", "closedDate": "Closed Date", + "transferType": "Transfer Type", "since": "Since", "rejectionDetails": "Rejection Details", "part": "Part", diff --git a/lib/models/device/asset_transfer.dart b/lib/models/device/asset_transfer.dart index db4c9900..56918b2a 100644 --- a/lib/models/device/asset_transfer.dart +++ b/lib/models/device/asset_transfer.dart @@ -47,6 +47,7 @@ class AssetTransfer { this.receiverTravelingHours, this.receiverEngSignature, this.receiverAttachments, + this.assetTransferAttachments, this.attachments, this.assetNumber, this.assetName, @@ -124,6 +125,12 @@ class AssetTransfer { senderAttachments!.add(AssetTransferAttachment.fromJson(v)); }); } + if (json['assetTransferAttachments'] != null) { + assetTransferAttachments = []; + json['assetTransferAttachments'].forEach((v) { + assetTransferAttachments?.add(AssetTransferAttachment.fromJson(v)); + }); + } receiverAssignedEmployeeId = json['receiverAssignedEmployeeId']; receiverMachineStatusId = json['receiverMachineStatusId']; receiverComment = json['receiverComment']; @@ -178,13 +185,6 @@ class AssetTransfer { receiverAttachments!.add(AssetTransferAttachment.fromJson(v)); }); } - if (senderAttachments != null) { - attachments = senderAttachments; - } else if (receiverAttachments != null) { - attachments = receiverAttachments; - } - print('sender attachment i got is ${senderAttachments?.length}'); - assetNumber = json['assetNumber']; assetName = json['assetName']; manufacturerName = json['manufacturerName']; @@ -253,6 +253,7 @@ class AssetTransfer { String? senderEngSignature; List? senderAttachments; List? attachments; + List? assetTransferAttachments; String? receiverAssignedEmployeeId; num? receiverMachineStatusId; String? receiverComment; diff --git a/lib/new_views/pages/land_page/requests/asset_item_view.dart b/lib/new_views/pages/land_page/requests/asset_item_view.dart index fc420a03..d78238f6 100644 --- a/lib/new_views/pages/land_page/requests/asset_item_view.dart +++ b/lib/new_views/pages/land_page/requests/asset_item_view.dart @@ -112,8 +112,8 @@ class AssetItemView extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ (requestDetails?.nameOfType ?? context.translation.deviceTransferRequest).heading5(context), - "${context.translation.from} : ${requestDetails!.siteTransferFrom?.cleanupWhitespace?.capitalizeFirstOfEach}".bodyText(context), - "${context.translation.to} : ${requestDetails!.siteTransferTo?.cleanupWhitespace?.capitalizeFirstOfEach}".bodyText(context), + "${context.translation.from} : ${requestDetails!.siteTransferFrom?.cleanupWhitespace.capitalizeFirstOfEach}".bodyText(context), + "${context.translation.to} : ${requestDetails!.siteTransferTo?.cleanupWhitespace.capitalizeFirstOfEach}".bodyText(context), requestDetails!.status!.replaceAll("=", ":").bodyText(context), '${context.translation.requestNo}: ${requestDetails!.requestNo}'.bodyText(context), ], diff --git a/lib/views/pages/device_transfer/device_transfer_details.dart b/lib/views/pages/device_transfer/device_transfer_details.dart index 68b5056a..4e72a38f 100644 --- a/lib/views/pages/device_transfer/device_transfer_details.dart +++ b/lib/views/pages/device_transfer/device_transfer_details.dart @@ -57,8 +57,7 @@ class _DeviceTransferDetailsState extends State { return const ALoading(); } else { _model = snapshot.data as AssetTransfer?; - _attachments = _model?.attachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? []; - + _attachments = _model?.assetTransferAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? []; return Form( key: _formKey, child: LoadingManager( @@ -79,24 +78,24 @@ class _DeviceTransferDetailsState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + _buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'), _buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'), _buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'), _buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'), _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), + 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), 8.height, _buildTextWidget(_model!.comment!), - - + ], + if (_attachments.isNotEmpty) ...[ + attachmentWidget(), ] ], ), @@ -106,21 +105,6 @@ class _DeviceTransferDetailsState extends State { Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - /// TBD - // Row( - // children: [ - // /// TBD - // // StatusLabel( - // // label: "", - // // id: 0, - // // textColor: AColors.getPriorityStatusTextColor(0), - // // backgroundColor: AColors.getPriorityStatusColor(0)), - // 8.width, - // - // /// TBD - // //StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)), - // ], - // ), 1.width, Text( _model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "", @@ -136,12 +120,8 @@ class _DeviceTransferDetailsState extends State { _buildCard( isSender: true, site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "", - - /// TBD unit: _model?.senderDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "", comment: _model?.senderComment ?? "", - - /// TBD statusLabel: _model?.senderMachineStatusName != null ? StatusLabel( label: _model!.senderMachineStatusName!, @@ -156,12 +136,8 @@ class _DeviceTransferDetailsState extends State { _buildCard( isSender: false, site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "", - - /// TBD unit: _model?.destDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "", comment: _model?.receiverComment ?? "", - - /// TBD statusLabel: _model?.receiverMachineStatusName != null ? StatusLabel( label: _model!.receiverMachineStatusName ?? "", @@ -181,11 +157,7 @@ class _DeviceTransferDetailsState extends State { ); } - _buildDetailsCard(Widget widget) { - return widget.toShadowContainer(context).paddingOnly(top: 14, start: 14, end: 14); - } - - Widget attachmentWidget(){ + Widget attachmentWidget() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -200,7 +172,6 @@ class _DeviceTransferDetailsState extends State { enabled: false, onlyImages: false, ), - 12.height, ], ], ); @@ -253,21 +224,19 @@ class _DeviceTransferDetailsState extends State { const Divider().defaultStyle(context), 8.height, _buildTextWidget(comment), - attachmentWidget(), - ] ], ).toShadowContainer(context); } - Widget infoText({String ?label,String ?value,}){ - if(value==null||value.isEmpty){ - return const SizedBox(); - } - else { + + 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 908e4da5..fd4b49c2 100644 --- a/lib/views/pages/user/gas_refill/gas_refill_details.dart +++ b/lib/views/pages/user/gas_refill/gas_refill_details.dart @@ -76,7 +76,7 @@ class _GasRefillDetailsPageState extends State { padding: const EdgeInsets.all(16), child: informationCard(_model), ).expanded, - if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.id! != 5833))//TODO need to check this value for complete status. + if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2))//TODO need to ask backend for status of complete and cancelled request. AppFilledButton( onPressed: () async { await Navigator.of(context).push(MaterialPageRoute(builder: (_) => GasRefillForm(gasRefillModel: _model))); @@ -125,14 +125,12 @@ class _GasRefillDetailsPageState extends State { context.translation.gasRefillRequest.heading5(context), 8.height, - '${context.translation.gasRequest}: ${gasRefillModel.gasRefillDetails![0].gasType?.name}'.bodyText(context), + '${context.translation.gasType}: ${gasRefillModel.gasRefillDetails![0].gasType?.name}'.bodyText(context), '${context.translation.cylinderType}: ${gasRefillModel.gasRefillDetails![0].cylinderType?.name}'.bodyText(context), '${context.translation.cylinderSize}: ${gasRefillModel.gasRefillDetails![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.gasRefillNo}'.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),