loan details user model, bug fixed.

main_production_ai_enhancement
Sikander Saleem 2 months ago
parent 3352c73e1d
commit 1d8ef3676b

@ -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 'package:test_sa/models/lookup.dart';
import 'assigned_fe_user_model.dart';
import 'loan_attachment_model.dart'; import 'loan_attachment_model.dart';
class LoanRequestModel { class LoanRequestModel {
@ -43,13 +41,13 @@ class LoanRequestModel {
String? installationEDD; String? installationEDD;
String? pulloutEDD; String? pulloutEDD;
String? mdUserID; String? mdUserID;
MdUser? mdUser; User? mdUser;
String? mesUserID; String? mesUserID;
String? mesUser; User? mesUser;
String? assignedFEForInstallationUserID; String? assignedFEForInstallationUserID;
AssignedFEUser? assignedFEForInstallationUser; User? assignedFEForInstallationUser;
String? assignedFEForPulloutUserID; String? assignedFEForPulloutUserID;
AssignedFEUser? assignedFEForPulloutUser; User? assignedFEForPulloutUser;
int? cmwoItemId; int? cmwoItemId;
int? installationWOItemId; int? installationWOItemId;
int? pulloutWOItemId; int? pulloutWOItemId;
@ -169,13 +167,13 @@ class LoanRequestModel {
installationEDD = json['installationEDD']; installationEDD = json['installationEDD'];
pulloutEDD = json['pulloutEDD']; pulloutEDD = json['pulloutEDD'];
mdUserID = json['mdUserID']; mdUserID = json['mdUserID'];
mdUser = json['mdUser'] == null ? null : MdUser.fromJson(json['mdUser']); mdUser = json['mdUser'] == null ? null : User.fromJson(json['mdUser']);
mesUserID = json['mesUserID']; mesUserID = json['mesUserID'];
mesUser = json['mesUser']; mesUser = json['mesUser'] == null ? null : User.fromJson(json['mesUser']);
assignedFEForInstallationUserID = json['assignedFEForInstallationUserID']; assignedFEForInstallationUserID = json['assignedFEForInstallationUserID'];
assignedFEForInstallationUser = json['assignedFEForInstallationUser'] == null ? null : AssignedFEUser.fromJson(json['assignedFEForInstallationUser']); assignedFEForInstallationUser = json['assignedFEForInstallationUser'] == null ? null : User.fromJson(json['assignedFEForInstallationUser']);
assignedFEForPulloutUserID = json['assignedFEForPulloutUserID']; assignedFEForPulloutUserID = json['assignedFEForPulloutUserID'];
assignedFEForPulloutUser = json['assignedFEForPulloutUser'] == null ? null : AssignedFEUser.fromJson(json['assignedFEForPulloutUser']); assignedFEForPulloutUser = json['assignedFEForPulloutUser'] == null ? null : User.fromJson(json['assignedFEForPulloutUser']);
cmwoItemId = json['cmwoItemId']; cmwoItemId = json['cmwoItemId'];
installationWOItemId = json['installationWOItemId']; installationWOItemId = json['installationWOItemId'];
pulloutWOItemId = json['pulloutWOItemId']; pulloutWOItemId = json['pulloutWOItemId'];
@ -255,22 +253,65 @@ class LoanRequestModel {
return data; 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? id;
String? name; 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) { User.fromJson(Map<String, dynamic> json) {
id = json['id'] ?? ''; id = json['id'];
name = json['name'] ?? ''; 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() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final Map<String, dynamic> data = new Map<String, dynamic>();
map['id'] = id; data['id'] = this.id;
map['name'] = name; data['name'] = this.name;
return map; 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;
} }
} }

@ -50,7 +50,8 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const DefaultAppBar(title: "Request Details"), appBar: const DefaultAppBar(title: "Request Details"),
body: FutureBuilder<LoanRequestModel?>( body: SafeArea(
child: FutureBuilder<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(widget.loanId), future: Provider.of<LoanProvider>(context, listen: false).getLoanById(widget.loanId),
builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> snapshot) { builder: (BuildContext context, AsyncSnapshot<LoanRequestModel?> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center; if (snapshot.connectionState == ConnectionState.waiting) return const CircularProgressIndicator(color: AppColor.primary10).center;
@ -58,8 +59,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
List<LoanAttachmentModel> allAttachments = snapshot.data!.loanAttachments!; List<LoanAttachmentModel> allAttachments = snapshot.data!.loanAttachments!;
return Column( return Column(children: [
children: [
ListView( ListView(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
children: [ children: [
@ -103,7 +103,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []), FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
], ],
], ],
).toShadowContainer(context, padding: 12), ).toShadowContainer(context, padding: 12)
], ],
).expanded, ).expanded,
// @todo ask backend to add loanTypeValue, so we can show or hide the buttons // @todo ask backend to add loanTypeValue, so we can show or hide the buttons
@ -181,7 +181,8 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
) )
]); ]);
// }), // }),
})); }),
));
} }
List<Widget> requestDetails(BuildContext context, LoanRequestModel loanData) { List<Widget> requestDetails(BuildContext context, LoanRequestModel loanData) {

@ -66,7 +66,8 @@ class _RequestsListPageState extends State<RequestsListPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: DefaultAppBar(title: "${widget.title} ${context.translation.requests}"), appBar: DefaultAppBar(title: "${widget.title} ${context.translation.requests}"),
body: Consumer<DashBoardProvider>(builder: (context, snapshot, _) { body: SafeArea(
child: Consumer<DashBoardProvider>(builder: (context, snapshot, _) {
if (snapshot.isDetailLoading || snapshot.requestDetailList == null) { if (snapshot.isDetailLoading || snapshot.requestDetailList == null) {
return ListView.builder( return ListView.builder(
itemCount: 6, itemCount: 6,
@ -102,7 +103,8 @@ class _RequestsListPageState extends State<RequestsListPage> {
// : widget.index == 3 // : widget.index == 3
// ? snapshot.completedRequests?.requestsDetails ?? [] // ? snapshot.completedRequests?.requestsDetails ?? []
// : []; // : [];
})); }),
));
} }
Future<void> callRequestApis({bool showLoader = true, int pageNo = 1, int pageSize = 10}) async { 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:test_sa/extensions/context_extension.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 { class AAlertDialog extends StatelessWidget {
final String? title; final String? title;
@ -10,8 +14,8 @@ class AAlertDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return Platform.isIOS
return CupertinoAlertDialog( ? CupertinoAlertDialog(
title: title != null ? Text(title!) : null, title: title != null ? Text(title!) : null,
content: content != null ? Text(content!) : null, content: content != null ? Text(content!) : null,
actions: <Widget>[ actions: <Widget>[
@ -30,6 +34,28 @@ class AAlertDialog extends StatelessWidget {
}, },
), ),
], ],
)
: 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);
},
),
],
); );
} }
} }

Loading…
Cancel
Save