From 5c8e1d576341c08a31df3238e689c62aecc0eb08 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 11 Nov 2025 08:50:35 +0300 Subject: [PATCH] bug fixes. --- .../traf_module/create_traf_request_page.dart | 20 +++++++++++-- .../traf_module/traf_request_detail_page.dart | 30 +++++++++++++------ .../traf_module/traf_request_model.dart | 8 +++++ 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/lib/modules/traf_module/create_traf_request_page.dart b/lib/modules/traf_module/create_traf_request_page.dart index 05670e01..fd895ee1 100644 --- a/lib/modules/traf_module/create_traf_request_page.dart +++ b/lib/modules/traf_module/create_traf_request_page.dart @@ -310,7 +310,7 @@ class _CreateTRAFRequestPageState extends State { initialValue: isUsedSolelyOrShared, onSelect: (value) { isUsedSolelyOrShared = value; - trafRequest?.usingSolelyOrSharedId = value?.value; + trafRequest?.usingSolelyOrSharedId = value?.id; if (isUsedSolelyOrShared?.value != 1) { departments = []; trafRequest?.trafDepartments = []; @@ -353,7 +353,7 @@ class _CreateTRAFRequestPageState extends State { initialValue: otherServicesEffects, onSelect: (value) { otherServicesEffects = value; - trafRequest?.isEffectedId = value?.value; + trafRequest?.isEffectedId = value?.id; if (otherServicesEffects?.value != 1) { trafRequest?.effectedServices = null; FocusScope.of(context).unfocus(); @@ -395,7 +395,7 @@ class _CreateTRAFRequestPageState extends State { initialValue: useInCombination, onSelect: (value) { useInCombination = value; - trafRequest?.isCombinationId = value?.value; + trafRequest?.isCombinationId = value?.id; if (useInCombination?.value != 1) { trafRequest?.usedWithCombination = null; FocusScope.of(context).unfocus(); @@ -483,11 +483,25 @@ class _CreateTRAFRequestPageState extends State { "Please specify users going to use technology".showToast; return; } + if (isUsedSolelyOrShared == null) { + "Please specify technology solely or shared".showToast; + return; + } if (isUsedSolelyOrShared?.value == 1 && (trafRequest?.trafDepartments ?? []).isEmpty) { "Please specify departments and relations".showToast; return; } + if (otherServicesEffects == null) { + "Please specify other services will be effected or not".showToast; + return; + } + + if (useInCombination == null) { + "Please specify equipment used in combination or not".showToast; + return; + } + Utils.showLoading(context); bool isSuccess = await Provider.of(context, listen: false).addTraf(trafRequest!.toJson()); Utils.hideLoading(context); diff --git a/lib/modules/traf_module/traf_request_detail_page.dart b/lib/modules/traf_module/traf_request_detail_page.dart index c69073c7..3eac9725 100644 --- a/lib/modules/traf_module/traf_request_detail_page.dart +++ b/lib/modules/traf_module/traf_request_detail_page.dart @@ -93,14 +93,14 @@ class _TrafRequestDetailPageState extends State { ), 8.height, '${context.translation.employeeId}: ${data.employeeIdForDisplay ?? '-'}'.bodyText(context), - '${context.translation.name}: ${data.employeeName ?? '-'}'.bodyText(context), // todo ask shaheer - '${context.translation.email}: ${data.employeeEmail ?? '-'}'.bodyText(context), // todo ask shaheer - 'Position: ${data.positionName ?? '-'}'.bodyText(context), // todo ask shaheer + '${context.translation.name}: ${data.employeeName ?? '-'}'.bodyText(context), + '${context.translation.email}: ${data.employeeEmail ?? '-'}'.bodyText(context), + 'Position: ${data.positionName ?? '-'}'.bodyText(context), '${context.translation.site}: ${data.siteName ?? '-'}'.bodyText(context), - '${context.translation.department}: ${data.departments?.map((item) => item.departmentName).toList() ?? '-'}'.bodyText(context), - 'Requester Extension: ${data.requesterExtensionName ?? '-'}'.bodyText(context), - '${context.translation.extensionNo}: ${data.requesterExtensionNumber ?? '-'}'.bodyText(context), - '${context.translation.phoneNumber}: ${data.requesterContactNumber ?? '-'}'.bodyText(context), + '${context.translation.department}: ${data.departmentName}'.bodyText(context), + // 'Requester Extension: ${data.requesterExtensionName ?? '-'}'.bodyText(context), + 'Number/Contact Information: ${data.requesterContactNumber ?? '-'}'.bodyText(context), + 'Extension: ${data.requesterExtensionNumber ?? '-'}'.bodyText(context), ], ).toShadowContainer(context, borderRadius: 20, padding: 12); } @@ -131,10 +131,22 @@ class _TrafRequestDetailPageState extends State { .bodyText(context), 4.height, 'Is the requesting department going to use the technology solely or shared with other departments?:\n${data.usingSolelyOrSharedName ?? '-'}'.bodyText(context), + if ((data.departments ?? []).isNotEmpty) ...[ + 4.height, + 'Technology used with other departments:\n${data.departments?.map((item) => item.departmentName).toList() ?? '-'}'.bodyText(context), + ], 4.height, - 'Would other services be effected by acquiring the new equipment?:\n${data.effectedServices ?? '-'}'.bodyText(context), + 'Would other services be effected by acquiring the new equipment?:\n${data.isEffectedName ?? '-'}'.bodyText(context), + if ((data.effectedServices ?? "").isNotEmpty) ...[ + 4.height, + 'List of services would it be effected:\n${data.effectedServices ?? '-'}'.bodyText(context), + ], 4.height, - 'Is the equipment going to be used with combination of other equipment to accomplish a specific procedure?:\n${data.usedWithCombination ?? '-'}'.bodyText(context), + 'Is the equipment going to be used with combination of other equipment to accomplish a specific procedure?:\n${data.isCombinationName ?? '-'}'.bodyText(context), + if ((data.usedWithCombination ?? "").isNotEmpty) ...[ + 4.height, + 'Equipment going to be used with combination of other equipments:\n${data.usedWithCombination ?? '-'}'.bodyText(context), + ], ], ).toShadowContainer(context, borderRadius: 20, padding: 12); } diff --git a/lib/modules/traf_module/traf_request_model.dart b/lib/modules/traf_module/traf_request_model.dart index 9234ba60..af3977be 100644 --- a/lib/modules/traf_module/traf_request_model.dart +++ b/lib/modules/traf_module/traf_request_model.dart @@ -51,6 +51,8 @@ class TrafRequestDataModel { String? employeeEmail; int? positionId; String? positionName; + String? departmentId; + String? departmentName; List? departments; List? trafDepartments; int? siteId; @@ -147,6 +149,8 @@ class TrafRequestDataModel { this.employeeEmail, this.positionId, this.positionName, + this.departmentId, + this.departmentName, this.departments, this.trafDepartments, this.siteId, @@ -243,6 +247,8 @@ class TrafRequestDataModel { employeeEmail = json['employeeEmail']; positionId = json['positionId']; positionName = json['positionName']; + departmentId = json['departmentId']; + departmentName = json['departmentName']; if (json['departments'] != null) { departments = []; json['departments'].forEach((v) { @@ -366,6 +372,8 @@ class TrafRequestDataModel { data['employeeEmail'] = this.employeeEmail; data['positionId'] = this.positionId; data['positionName'] = this.positionName; + data['departmentId'] = this.departmentId; + data['departmentName'] = this.departmentName; if (this.departments != null) { data['departments'] = this.departments!.map((v) => v.toJson()).toList(); }