From 1d8ef3676bcc5d9cfec2b7180bdfa4c0d714d5c9 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 21 Apr 2026 15:16:35 +0300 Subject: [PATCH 1/2] loan details user model, bug fixed. --- .../models/assigned_fe_user_model.dart | 52 ------------ .../models/loan_request_model.dart | 79 ++++++++++++++----- .../pages/loan_equipment_detail_page.dart | 29 +++---- .../pages/land_page/requests_list_page.dart | 76 +++++++++--------- lib/views/widgets/dialogs/dialog.dart | 68 +++++++++++----- 5 files changed, 161 insertions(+), 143 deletions(-) delete mode 100644 lib/modules/loan_module/models/assigned_fe_user_model.dart diff --git a/lib/modules/loan_module/models/assigned_fe_user_model.dart b/lib/modules/loan_module/models/assigned_fe_user_model.dart deleted file mode 100644 index db778092..00000000 --- a/lib/modules/loan_module/models/assigned_fe_user_model.dart +++ /dev/null @@ -1,52 +0,0 @@ -class AssignedFEUser { - String? id; - String? name; - String? email; - String? employeeId; - int? languageId; - String? extensionNo; - String? phoneNumber; - String? positionName; - String? position; - bool? isActive; - - AssignedFEUser( - {this.id, - this.name, - this.email, - this.employeeId, - this.languageId, - this.extensionNo, - this.phoneNumber, - this.positionName, - this.position, - this.isActive}); - - AssignedFEUser.fromJson(Map json) { - id = json['id']; - name = json['name']; - email = json['email']; - employeeId = json['employeeId']; - languageId = json['languageId']; - extensionNo = json['extensionNo']; - phoneNumber = json['phoneNumber']; - positionName = json['positionName']; - position = json['position']; - isActive = json['isActive']; - } - - Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['email'] = this.email; - data['employeeId'] = this.employeeId; - data['languageId'] = this.languageId; - data['extensionNo'] = this.extensionNo; - data['phoneNumber'] = this.phoneNumber; - data['positionName'] = this.positionName; - data['position'] = this.position; - data['isActive'] = this.isActive; - return data; - } -} \ No newline at end of file diff --git a/lib/modules/loan_module/models/loan_request_model.dart b/lib/modules/loan_module/models/loan_request_model.dart index 5757299f..1f76cda8 100644 --- a/lib/modules/loan_module/models/loan_request_model.dart +++ b/lib/modules/loan_module/models/loan_request_model.dart @@ -1,6 +1,4 @@ import 'package:test_sa/models/lookup.dart'; - -import 'assigned_fe_user_model.dart'; import 'loan_attachment_model.dart'; class LoanRequestModel { @@ -43,13 +41,13 @@ class LoanRequestModel { String? installationEDD; String? pulloutEDD; String? mdUserID; - MdUser? mdUser; + User? mdUser; String? mesUserID; - String? mesUser; + User? mesUser; String? assignedFEForInstallationUserID; - AssignedFEUser? assignedFEForInstallationUser; + User? assignedFEForInstallationUser; String? assignedFEForPulloutUserID; - AssignedFEUser? assignedFEForPulloutUser; + User? assignedFEForPulloutUser; int? cmwoItemId; int? installationWOItemId; int? pulloutWOItemId; @@ -169,13 +167,13 @@ class LoanRequestModel { installationEDD = json['installationEDD']; pulloutEDD = json['pulloutEDD']; mdUserID = json['mdUserID']; - mdUser = json['mdUser'] == null ? null : MdUser.fromJson(json['mdUser']); + mdUser = json['mdUser'] == null ? null : User.fromJson(json['mdUser']); mesUserID = json['mesUserID']; - mesUser = json['mesUser']; + mesUser = json['mesUser'] == null ? null : User.fromJson(json['mesUser']); assignedFEForInstallationUserID = json['assignedFEForInstallationUserID']; - assignedFEForInstallationUser = json['assignedFEForInstallationUser'] == null ? null : AssignedFEUser.fromJson(json['assignedFEForInstallationUser']); + assignedFEForInstallationUser = json['assignedFEForInstallationUser'] == null ? null : User.fromJson(json['assignedFEForInstallationUser']); assignedFEForPulloutUserID = json['assignedFEForPulloutUserID']; - assignedFEForPulloutUser = json['assignedFEForPulloutUser'] == null ? null : AssignedFEUser.fromJson(json['assignedFEForPulloutUser']); + assignedFEForPulloutUser = json['assignedFEForPulloutUser'] == null ? null : User.fromJson(json['assignedFEForPulloutUser']); cmwoItemId = json['cmwoItemId']; installationWOItemId = json['installationWOItemId']; pulloutWOItemId = json['pulloutWOItemId']; @@ -255,22 +253,65 @@ class LoanRequestModel { return data; } } +// +// class MdUser { +// String? id; +// String? name; +// +// MdUser({this.id, this.name}); +// +// MdUser.fromJson(dynamic json) { +// id = json['id'] ?? ''; +// name = json['name'] ?? ''; +// } +// +// Map toJson() { +// final map = {}; +// map['id'] = id; +// map['name'] = name; +// return map; +// } +// } -class MdUser { +class User { String? id; String? name; + String? email; + String? employeeId; + int? languageId; + String? extensionNo; + String? phoneNumber; + String? positionName; + String? position; + bool? isActive; - MdUser({this.id, this.name}); + User({this.id, this.name, this.email, this.employeeId, this.languageId, this.extensionNo, this.phoneNumber, this.positionName, this.position, this.isActive}); - MdUser.fromJson(dynamic json) { - id = json['id'] ?? ''; - name = json['name'] ?? ''; + User.fromJson(Map json) { + id = json['id']; + name = json['name']; + email = json['email']; + employeeId = json['employeeId']; + languageId = json['languageId']; + extensionNo = json['extensionNo']; + phoneNumber = json['phoneNumber']; + positionName = json['positionName']; + position = json['position']; + isActive = json['isActive']; } Map toJson() { - final map = {}; - map['id'] = id; - map['name'] = name; - return map; + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['email'] = this.email; + data['employeeId'] = this.employeeId; + data['languageId'] = this.languageId; + data['extensionNo'] = this.extensionNo; + data['phoneNumber'] = this.phoneNumber; + data['positionName'] = this.positionName; + data['position'] = this.position; + data['isActive'] = this.isActive; + return data; } } diff --git a/lib/modules/loan_module/pages/loan_equipment_detail_page.dart b/lib/modules/loan_module/pages/loan_equipment_detail_page.dart index 5abb9118..caacf28c 100644 --- a/lib/modules/loan_module/pages/loan_equipment_detail_page.dart +++ b/lib/modules/loan_module/pages/loan_equipment_detail_page.dart @@ -49,17 +49,17 @@ class _LoanEquipmentDetailPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const DefaultAppBar(title: "Request Details"), - body: FutureBuilder( - future: Provider.of(context, listen: false).getLoanById(widget.loanId), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center; - if (snapshot.data == null) return const NoDataFound().center; + appBar: const DefaultAppBar(title: "Request Details"), + body: SafeArea( + child: FutureBuilder( + future: Provider.of(context, listen: false).getLoanById(widget.loanId), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center; + if (snapshot.data == null) return const NoDataFound().center; - List allAttachments = snapshot.data!.loanAttachments!; + List allAttachments = snapshot.data!.loanAttachments!; - return Column( - children: [ + return Column(children: [ ListView( padding: const EdgeInsets.all(16), children: [ @@ -103,7 +103,7 @@ class _LoanEquipmentDetailPageState extends State { FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), ], ], - ).toShadowContainer(context, padding: 12), + ).toShadowContainer(context, padding: 12) ], ).expanded, // @todo ask backend to add loanTypeValue, so we can show or hide the buttons @@ -175,13 +175,14 @@ class _LoanEquipmentDetailPageState extends State { label: snapshot.data?.loanStatusValue == 4 ? "Delivered" : snapshot.data?.loanStatusValue == 5 - ? 'Installation Report' - : 'PullOut Report', + ? 'Installation Report' + : 'PullOut Report', ), ) ]); - // }), - })); + // }), + }), + )); } List requestDetails(BuildContext context, LoanRequestModel loanData) { diff --git a/lib/new_views/pages/land_page/requests_list_page.dart b/lib/new_views/pages/land_page/requests_list_page.dart index 3568505d..540f1d79 100644 --- a/lib/new_views/pages/land_page/requests_list_page.dart +++ b/lib/new_views/pages/land_page/requests_list_page.dart @@ -66,43 +66,45 @@ class _RequestsListPageState extends State { Widget build(BuildContext context) { return Scaffold( appBar: DefaultAppBar(title: "${widget.title} ${context.translation.requests}"), - body: Consumer(builder: (context, snapshot, _) { - if (snapshot.isDetailLoading || snapshot.requestDetailList == null) { - return ListView.builder( - itemCount: 6, - padding: const EdgeInsets.all(16), - itemBuilder: (context, index) { - return Padding( - padding: EdgeInsets.symmetric(vertical: 10.toScreenHeight, horizontal: 0), - child: const SizedBox().toRequestShimmer(context, snapshot.isDetailLoading), - ); - }, - ); - } else if (snapshot.requestDetailList?.data?.isEmpty ?? true) { - return const NoDataFound().center; - } else { - return RequestPaginatedListview(snapshot.requestDetailList?.data ?? [], snapshot.isDetailLoading, snapshot.requestDetailList?.totalRows ?? 0, _scrollController); - } - // bool isLoading = widget.index == 0 - // ? snapshot.isHighPriorityLoading - // : widget.index == 1 - // ? snapshot.isOverdueLoading - // : widget.index == 2 - // ? snapshot.isOpenLoading - // : widget.index == 3 - // ? snapshot.isCompleteLoading - // : false; - // - // List list = widget.index == 0 - // ? snapshot.highPriorityRequests?.requestsDetails ?? [] - // : widget.index == 1 - // ? snapshot.overdueRequests?.requestsDetails ?? [] - // : widget.index == 2 - // ? snapshot.openRequests?.requestsDetails ?? [] - // : widget.index == 3 - // ? snapshot.completedRequests?.requestsDetails ?? [] - // : []; - })); + body: SafeArea( + child: Consumer(builder: (context, snapshot, _) { + if (snapshot.isDetailLoading || snapshot.requestDetailList == null) { + return ListView.builder( + itemCount: 6, + padding: const EdgeInsets.all(16), + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.symmetric(vertical: 10.toScreenHeight, horizontal: 0), + child: const SizedBox().toRequestShimmer(context, snapshot.isDetailLoading), + ); + }, + ); + } else if (snapshot.requestDetailList?.data?.isEmpty ?? true) { + return const NoDataFound().center; + } else { + return RequestPaginatedListview(snapshot.requestDetailList?.data ?? [], snapshot.isDetailLoading, snapshot.requestDetailList?.totalRows ?? 0, _scrollController); + } + // bool isLoading = widget.index == 0 + // ? snapshot.isHighPriorityLoading + // : widget.index == 1 + // ? snapshot.isOverdueLoading + // : widget.index == 2 + // ? snapshot.isOpenLoading + // : widget.index == 3 + // ? snapshot.isCompleteLoading + // : false; + // + // List list = widget.index == 0 + // ? snapshot.highPriorityRequests?.requestsDetails ?? [] + // : widget.index == 1 + // ? snapshot.overdueRequests?.requestsDetails ?? [] + // : widget.index == 2 + // ? snapshot.openRequests?.requestsDetails ?? [] + // : widget.index == 3 + // ? snapshot.completedRequests?.requestsDetails ?? [] + // : []; + }), + )); } Future callRequestApis({bool showLoader = true, int pageNo = 1, int pageSize = 10}) async { diff --git a/lib/views/widgets/dialogs/dialog.dart b/lib/views/widgets/dialogs/dialog.dart index 56788636..7d981fd9 100644 --- a/lib/views/widgets/dialogs/dialog.dart +++ b/lib/views/widgets/dialogs/dialog.dart @@ -1,6 +1,10 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:test_sa/extensions/context_extension.dart'; +import 'package:test_sa/extensions/text_extensions.dart'; +import 'package:test_sa/new_views/app_style/app_color.dart'; class AAlertDialog extends StatelessWidget { final String? title; @@ -10,26 +14,48 @@ class AAlertDialog extends StatelessWidget { @override Widget build(BuildContext context) { - // - return CupertinoAlertDialog( - title: title != null ? Text(title!) : null, - content: content != null ? Text(content!) : null, - actions: [ - TextButton( - // child: Text(_subtitle.confirm), - child: Text(context.translation.confirm), - onPressed: () { - Navigator.of(context).pop(true); - }, - ), - TextButton( - // child: Text(_subtitle.cancel), - child: Text(context.translation.cancel), - onPressed: () { - Navigator.of(context).pop(false); - }, - ), - ], - ); + return Platform.isIOS + ? CupertinoAlertDialog( + title: title != null ? Text(title!) : null, + content: content != null ? Text(content!) : null, + actions: [ + TextButton( + // child: Text(_subtitle.confirm), + child: Text(context.translation.confirm), + onPressed: () { + Navigator.of(context).pop(true); + }, + ), + TextButton( + // child: Text(_subtitle.cancel), + child: Text(context.translation.cancel), + onPressed: () { + Navigator.of(context).pop(false); + }, + ), + ], + ) + : AlertDialog( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + title: title != null ? Text(title!) : null, + content: content != null ? Text(content!) : null, + // contentTextStyle: AppTextStyles.bodyText.copyWith(color: (context.isDark ? AppColor.neutral30 : AppColor.neutral50)), + actions: [ + TextButton( + // child: Text(_subtitle.confirm), + child: Text(context.translation.confirm, style: AppTextStyles.bodyText), + onPressed: () { + Navigator.of(context).pop(true); + }, + ), + TextButton( + // child: Text(_subtitle.cancel), + child: Text(context.translation.cancel, style: AppTextStyles.bodyText), + onPressed: () { + Navigator.of(context).pop(false); + }, + ), + ], + ); } } From eea2f6b4e95d7830e38b624dd6936f350a4e3556 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 21 Apr 2026 16:47:17 +0300 Subject: [PATCH 2/2] 1.7.5+40 uploaded. --- lib/controllers/api_routes/urls.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index 8437ecf5..d274eebf 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -1,7 +1,7 @@ class URLs { URLs._(); - static const String appReleaseBuildNumber = "39"; + static const String appReleaseBuildNumber = "40"; static const host1 = "https://atomsm.hmg.com"; // production url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url diff --git a/pubspec.yaml b/pubspec.yaml index 38ad5def..bf8e3371 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.7.4+39 +version: 1.7.5+40 environment: sdk: ">=3.5.0 <4.0.0"