diff --git a/lib/models/new_models/traf_department.dart b/lib/models/new_models/traf_department.dart index 5a2e256d..232470a4 100644 --- a/lib/models/new_models/traf_department.dart +++ b/lib/models/new_models/traf_department.dart @@ -3,9 +3,9 @@ import 'package:test_sa/models/new_models/room_model.dart'; import '../base.dart'; class TrafDepartment extends Base { - TrafDepartment({ - this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate - }) : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id + TrafDepartment( + {this.departmentName, this.departmentCode, this.ntCode, this.costCenterNumber, this.costCenterName, this.name, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate}) + : super(identifier: id?.toString() ?? '', name: departmentName); // Handle potential null id TrafDepartment.fromJson(Map json) { departmentName = json['departmentName'] ?? json['name']; @@ -15,6 +15,7 @@ class TrafDepartment extends Base { costCenterName = json['costCenterName']; name = json['name']; id = json['id']; + identifier = id?.toString() ?? ''; createdBy = json['createdBy']; createdDate = json['createdDate']; modifiedBy = json['modifiedBy']; @@ -33,24 +34,22 @@ class TrafDepartment extends Base { String? modifiedBy; String? modifiedDate; - // TrafDepartment copyWith({ - // num? id, // Parameters are now nullable - // String? departmentName, - // String? departmentCode, - // String? departmentId, - // String? ntCode, - // List? rooms, - // }) => - // TrafDepartment( - // id: id ?? this.id, - // departmentName: departmentName ?? this.departmentName, - // departmentCode: departmentCode ?? this.departmentCode, - // departmentId: departmentId ?? this.departmentId, - // ntCode: ntCode ?? this.ntCode, - // rooms: rooms ?? this.rooms, - // ); - - +// TrafDepartment copyWith({ +// num? id, // Parameters are now nullable +// String? departmentName, +// String? departmentCode, +// String? departmentId, +// String? ntCode, +// List? rooms, +// }) => +// TrafDepartment( +// id: id ?? this.id, +// departmentName: departmentName ?? this.departmentName, +// departmentCode: departmentCode ?? this.departmentCode, +// departmentId: departmentId ?? this.departmentId, +// ntCode: ntCode ?? this.ntCode, +// rooms: rooms ?? this.rooms, +// ); } // class TrafDepartment extends Base { diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 1310fb79..a6d4d880 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -135,10 +135,10 @@ class _ServiceRequestDetailViewState extends State { // spacing: 8, runSpacing: 8, children: [ - if (Provider.of(context, listen: false).showPriority) ...[ + if (Provider.of(context, listen: false).showPriority&&workOrder.priority!=null) ...[ StatusLabel( label: workOrder.priority?.name, - id: workOrder.priority!.value!, + id: workOrder.priority?.value, radius: 4, textColor: AppColor.getPriorityStatusTextColor(context, workOrder.priority!.value!), backgroundColor: AppColor.getPriorityStatusColor(context, workOrder.priority!.value!), diff --git a/lib/modules/loan_module/pages/create_loan_request_page.dart b/lib/modules/loan_module/pages/create_loan_request_page.dart index 0b2dc53e..450ea806 100644 --- a/lib/modules/loan_module/pages/create_loan_request_page.dart +++ b/lib/modules/loan_module/pages/create_loan_request_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:test_sa/controllers/validator/validator.dart'; import 'package:test_sa/extensions/context_extension.dart'; +import 'package:test_sa/extensions/enum_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/string_extensions.dart'; import 'package:test_sa/extensions/text_extensions.dart'; @@ -315,6 +316,7 @@ class _CreateLoanRequestPageState extends State with Tick SingleItemDropDownMenu( context: context, title: context.translation.department, + matchBy: DropDownMatchType.identifier, showShadow: false, enabled: !isBackUpRequest, validator: (value) { diff --git a/lib/new_views/pages/land_page/requests/service_request_item_view.dart b/lib/new_views/pages/land_page/requests/service_request_item_view.dart index b24a01cc..f7128ad6 100644 --- a/lib/new_views/pages/land_page/requests/service_request_item_view.dart +++ b/lib/new_views/pages/land_page/requests/service_request_item_view.dart @@ -32,7 +32,7 @@ class ServiceRequestItemView extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (Provider.of(context, listen: false).showPriority) ...[ + if (Provider.of(context, listen: false).showPriority && requestData?.priorityName != null && requestData!.priorityName!.isNotEmpty) ...[ StatusLabel( label: requestData!.priorityName!, textColor: AppColor.getRequestStatusTextColorByName(context, requestData!.priorityName!), @@ -95,7 +95,7 @@ class ServiceRequestItemView extends StatelessWidget { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (Provider.of(context, listen: false).showPriority) ...[ + if (Provider.of(context, listen: false).showPriority && requestDetails!.priority != null && requestDetails!.priority!.isNotEmpty) ...[ StatusLabel( label: requestDetails!.priority, textColor: AppColor.getRequestStatusTextColorByName(context, requestDetails!.priority),