Merge branch 'refs/heads/main_production_ai_enhancement' into cleaner_module

export_module
Sikander Saleem 2 months ago
commit 68fcc444d9

@ -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

@ -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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -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<String, dynamic> toJson() {
// final map = <String, dynamic>{};
// 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<String, dynamic> 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<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
return map;
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -49,17 +49,17 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "Request Details"),
body: FutureBuilder<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(widget.loanId),
builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> 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<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(widget.loanId),
builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
if (snapshot.data == null) return const NoDataFound().center;
List<LoanAttachmentModel> allAttachments = snapshot.data!.loanAttachments!;
List<LoanAttachmentModel> 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<LoanEquipmentDetailPage> {
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<LoanEquipmentDetailPage> {
label: snapshot.data?.loanStatusValue == 4
? "Delivered"
: snapshot.data?.loanStatusValue == 5
? 'Installation Report'
: 'PullOut Report',
? 'Installation Report'
: 'PullOut Report',
),
)
]);
// }),
}));
// }),
}),
));
}
List<Widget> requestDetails(BuildContext context, LoanRequestModel loanData) {

@ -66,43 +66,45 @@ class _RequestsListPageState extends State<RequestsListPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: DefaultAppBar(title: "${widget.title} ${context.translation.requests}"),
body: Consumer<DashBoardProvider>(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 ?? <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<RequestsDetails> 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<DashBoardProvider>(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 ?? <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<RequestsDetails> 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<void> callRequestApis({bool showLoader = true, int pageNo = 1, int pageSize = 10}) async {

@ -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: <Widget>[
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: <Widget>[
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: <Widget>[
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);
},
),
],
);
}
}

@ -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"

Loading…
Cancel
Save