loan attachment added & improvements.

design_3.0_asset_delivery_module
Sikander Saleem 3 months ago
parent 22fd3c8cc9
commit 07ec866315

@ -353,26 +353,41 @@ class URLs {
//internal Audit
static get getInternalAuditEquipmentById => "$_baseUrl/InternalAuditEquipments/GetInternalAuditEquipmentById";
static get getInternalAuditSystemById => "$_baseUrl/InternalAuditSystems/GetInternalAuditSystemByIdV2";
static get getInternalAuditChecklist => "$_baseUrl/Lookups/GetLookup?lookupEnum=43";
static get getInternalAuditWoType => "$_baseUrl/Lookups/GetLookup?lookupEnum=2500";
static get getInternalAuditFindingType => "$_baseUrl/Lookups/GetLookup?lookupEnum=2502";
static get addOrUpdateEquipmentInternalAudit => "$_baseUrl/InternalAuditEquipments/AddOrUpdateAuditEquipment";
static get addOrUpdateInternalAuditSystem => "$_baseUrl/InternalAuditSystems/AddOrUpdateInternalAuditSystem";
static get getWoAutoComplete => "$_baseUrl/InternalAuditSystems/AutoCompleteAllWorkOrder";
static get updateAuditEquipmentsEngineer => "$_baseUrl/InternalAuditEquipments/UpdateAuditEquipmentsEngineer";
static get updateAuditSystemEngineer => "$_baseUrl/InternalAuditSystems/UpdateAuditSystemEngineer";
static get loadAllWorkOrderDetailsByID => "$_baseUrl/InternalAuditSystems/LoadAllWorkOrderDetailsByID";
//chat
static get chatSdkToken => '$chatHubUrlApi/auth/sdk-token';
//survey
static get getQuestionnaire => '$_baseUrl/SurveyQuestionnaire/GetQuestionnaire';
static get submitSurvey => '$_baseUrl/SurveyQuestionnaire/SubmitSurvey';
// load module
static get getLoanPeriod => "$_baseUrl/Lookups/GetLookup?lookupEnum=3051";
static get getMedDepartmentBasedOnSite => "$_baseUrl/TRAFDataSource/GetDepartmentBasedOnSite";
static get getLoanById => '$_baseUrl/Loan/GetLoanById';
static get addLoan => '$_baseUrl/Loan/AddLoan';
}

@ -14,6 +14,7 @@ import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service
import 'package:test_sa/modules/cx_module/chat/chat_page.dart';
import 'package:test_sa/modules/cx_module/chat/chat_provider.dart';
import 'package:test_sa/modules/cx_module/survey/survey_page.dart';
import 'package:test_sa/modules/loan_module/pages/create_loan_request_page.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
@ -119,23 +120,39 @@ class _CMDetailPageState extends State<CMDetailPage> {
return const SizedBox();
}
}),
isNurse
? IconButton(
icon: 'qr'.toSvgAsset(
height: 24,
width: 24,
if (isNurse)
IconButton(
icon: 'qr'.toSvgAsset(height: 24, width: 24),
onPressed: () {
ServiceRequestBottomSheet.getQRCodeBottomSheet(context: context);
},
)
else ...[
Container(
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 6),
decoration: BoxDecoration(color: context.isDark ? AppColor.neutral50 : AppColor.neutral30, borderRadius: BorderRadius.circular(16)),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.add, size: 20, color: AppColor.black1E),
Text(
"Loan",
style: AppTextStyles.bodyText2.copyWith(color: AppColor.black1E),
),
onPressed: () {
ServiceRequestBottomSheet.getQRCodeBottomSheet(context: context);
},
)
: IconButton(
icon: const Icon(Icons.home),
onPressed: () {
// stopTimer();
Navigator.pop(context);
},
),
4.width,
],
),
).onPress(() {
Navigator.push(context, MaterialPageRoute(builder: (context) => CreateLoanRequestPage(workOrderId: widget.requestId)));
}),
IconButton(
icon: const Icon(Icons.home),
onPressed: () {
// stopTimer();
Navigator.pop(context);
},
)
],
],
),
body: DefaultTabController(

@ -286,8 +286,6 @@ class ChatApiClient {
// This is the most important part: prevent automatic redirection.
request.followRedirects = false;
print("Making initial request to: $url");
final streamedResponse = await client.send(request);
// --- Step 2: Check the response and handle the redirect ---

@ -0,0 +1,39 @@
class LoanAttachmentModel {
int? loanId;
String? attachmentName;
int? loanAttachmentTypeId;
String? attachmentDescription;
int? id;
String? createdBy;
String? createdDate;
String? modifiedBy;
String? modifiedDate;
LoanAttachmentModel({this.loanId, this.attachmentName, this.loanAttachmentTypeId, this.attachmentDescription, this.id, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate});
LoanAttachmentModel.fromJson(Map<String, dynamic> json) {
loanId = json['loanId'];
attachmentName = json['attachmentName'];
loanAttachmentTypeId = json['loanAttachmentTypeId'];
attachmentDescription = json['attachmentDescription'];
id = json['id'];
createdBy = json['createdBy'];
createdDate = json['createdDate'];
modifiedBy = json['modifiedBy'];
modifiedDate = json['modifiedDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['loanId'] = this.loanId;
data['attachmentName'] = this.attachmentName;
data['loanAttachmentTypeId'] = this.loanAttachmentTypeId;
data['attachmentDescription'] = this.attachmentDescription;
data['id'] = this.id;
data['createdBy'] = this.createdBy;
data['createdDate'] = this.createdDate;
data['modifiedBy'] = this.modifiedBy;
data['modifiedDate'] = this.modifiedDate;
return data;
}
}

@ -87,7 +87,9 @@ class LoanFormModel {
"loanPeriodId": loanProvided?.id,
"vendorName": vendorName,
"vendorRepresentativeName": vendorRepresentativeName,
"vendorRepName": vendorRepresentativeName,
"vendorNumber": vendorNumber,
"vendorContact": vendorNumber,
"vendorEmail": vendorEmail,
'siteId': site?.id,
'departmentId': department?.id,
@ -97,38 +99,40 @@ class LoanFormModel {
}
class LoanAttachments {
LoanAttachments({
this.id,
this.name,
this.originalName,
});
num? id;
num? loanAttachmentTypeId;
num? loanId;
String? attachmentName;
String? attachmentDescription;
LoanAttachments({this.id, this.loanAttachmentTypeId, this.attachmentName, this.loanId, this.attachmentDescription});
LoanAttachments.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
originalName = json['originalName'];
loanAttachmentTypeId = json['loanAttachmentTypeId'];
loanId = json['loanId'];
attachmentName = json['attachmentName'];
attachmentDescription = json['attachmentDescription'];
}
num? id;
String? name;
String? originalName;
LoanAttachments copyWith({
num? id, // Parameter is now nullable
String? name, // Parameter is now nullable
String? originalName, // Parameter is now nullable
}) =>
LoanAttachments(
id: id ?? this.id,
name: name ?? this.name,
originalName: originalName ?? this.originalName,
);
// LoanAttachments copyWith({
// num? id, // Parameter is now nullable
// String? name, // Parameter is now nullable
// String? originalName, // Parameter is now nullable
// }) =>
// LoanAttachments(
// id: id ?? this.id,
// name: name ?? this.name,
// originalName: originalName ?? this.originalName,
// );
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['name'] = name;
map['originalName'] = originalName;
map['loanAttachmentTypeId'] = loanAttachmentTypeId;
map['attachmentName'] = attachmentName;
map['loanId'] = loanId;
map['attachmentDescription'] = attachmentDescription;
return map;
}
}

@ -1,3 +1,7 @@
import 'package:test_sa/models/lookup.dart';
import 'loan_attachment_model.dart';
class LoanRequestModel {
String? requestorUserID;
int? reqNo;
@ -31,14 +35,14 @@ class LoanRequestModel {
String? vendorRepName;
String? vendorContact;
String? vendorEmail;
List<Null>? loanAttachments;
List<LoanAttachmentModel>? loanAttachments;
int? loanStatusId;
String? loanStatusName;
int? loanStatusValue;
String? installationEDD;
String? pulloutEDD;
String? mdUserID;
String? mdUser;
MdUser? mdUser;
String? mesUserID;
String? mesUser;
String? assignedFEForInstallationUserID;
@ -49,6 +53,8 @@ class LoanRequestModel {
int? installationWOItemId;
int? pulloutWOItemId;
int? id;
String? installationDate;
String? pulloutDate;
String? createdBy;
String? createdDate;
String? modifiedBy;
@ -106,6 +112,8 @@ class LoanRequestModel {
this.pulloutWOItemId,
this.id,
this.createdBy,
this.installationDate,
this.pulloutDate,
this.createdDate,
this.modifiedBy,
this.modifiedDate});
@ -143,10 +151,11 @@ class LoanRequestModel {
vendorRepName = json['vendorRepName'];
vendorContact = json['vendorContact'];
vendorEmail = json['vendorEmail'];
loanAttachments = <LoanAttachmentModel>[];
if (json['loanAttachments'] != null) {
loanAttachments = <Null>[];
loanAttachments = <LoanAttachmentModel>[];
json['loanAttachments'].forEach((v) {
// loanAttachments!.add(new Null.fromJson(v));
loanAttachments!.add(new LoanAttachmentModel.fromJson(v));
});
}
loanStatusId = json['loanStatusId'];
@ -155,7 +164,7 @@ class LoanRequestModel {
installationEDD = json['installationEDD'];
pulloutEDD = json['pulloutEDD'];
mdUserID = json['mdUserID'];
mdUser = json['mdUser'];
mdUser = json['mdUser'] == null ? null : MdUser.fromJson(json['mdUser']);
mesUserID = json['mesUserID'];
mesUser = json['mesUser'];
assignedFEForInstallationUserID = json['assignedFEForInstallationUserID'];
@ -166,6 +175,8 @@ class LoanRequestModel {
installationWOItemId = json['installationWOItemId'];
pulloutWOItemId = json['pulloutWOItemId'];
id = json['id'];
installationDate = json['installationDate'];
pulloutDate = json['pulloutDate'];
createdBy = json['createdBy'];
createdDate = json['createdDate'];
modifiedBy = json['modifiedBy'];
@ -207,7 +218,7 @@ class LoanRequestModel {
data['vendorContact'] = this.vendorContact;
data['vendorEmail'] = this.vendorEmail;
if (this.loanAttachments != null) {
// data['loanAttachments'] = this.loanAttachments!.map((v) => v.toJson()).toList();
data['loanAttachments'] = this.loanAttachments!.map((v) => v.toJson()).toList();
}
data['loanStatusId'] = this.loanStatusId;
data['loanStatusName'] = this.loanStatusName;
@ -215,7 +226,7 @@ class LoanRequestModel {
data['installationEDD'] = this.installationEDD;
data['pulloutEDD'] = this.pulloutEDD;
data['mdUserID'] = this.mdUserID;
data['mdUser'] = this.mdUser;
data['mdUser'] = this.mdUser?.toJson();
data['mesUserID'] = this.mesUserID;
data['mesUser'] = this.mesUser;
data['assignedFEForInstallationUserID'] = this.assignedFEForInstallationUserID;
@ -226,6 +237,8 @@ class LoanRequestModel {
data['installationWOItemId'] = this.installationWOItemId;
data['pulloutWOItemId'] = this.pulloutWOItemId;
data['id'] = this.id;
data['installationDate'] = this.installationDate;
data['pulloutDate'] = this.pulloutDate;
data['createdBy'] = this.createdBy;
data['createdDate'] = this.createdDate;
data['modifiedBy'] = this.modifiedBy;
@ -233,3 +246,22 @@ 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;
}
}

@ -486,7 +486,7 @@ class _CreateLoanRequestPageState extends State<CreateLoanRequestPage> with Tick
_loanFormModel.loanAttachment = [];
for (var item in attachments) {
String fileName = CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
_loanFormModel.loanAttachment?.add(LoanAttachments(id: item.id, name: fileName));
_loanFormModel.loanAttachment?.add(LoanAttachments(id: 0, attachmentName: fileName, loanId: 0));
}
Utils.showLoading(context);
LoanProvider loanProvider = Provider.of<LoanProvider>(context, listen: false);

@ -14,6 +14,7 @@ import 'package:test_sa/modules/internal_audit_module/models/system_internal_aud
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/update_equipment_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/pages/system_internal_audit/update_system_internal_audit_page.dart';
import 'package:test_sa/modules/internal_audit_module/provider/internal_audit_provider.dart';
import 'package:test_sa/modules/loan_module/models/loan_attachment_model.dart';
import 'package:test_sa/modules/loan_module/provider/loan_provider.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
@ -26,185 +27,91 @@ import 'package:test_sa/views/widgets/requests/request_status.dart';
import '../models/loan_request_model.dart';
class LoanEquipmentDetailPage extends StatefulWidget {
class LoanEquipmentDetailPage extends StatelessWidget {
static const String id = "/loan-equipment-detail-page";
final int loanId;
LoanEquipmentDetailPage({Key? key, required this.loanId}) : super(key: key);
@override
_LoanEquipmentDetailPageState createState() {
return _LoanEquipmentDetailPageState();
}
}
class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
bool isWoType = true;
late LoanProvider _loanProvider;
List<InternalAuditAttachments> allAttachments = [];
@override
void initState() {
super.initState();
_loanProvider = Provider.of<LoanProvider>(context, listen: false);
WidgetsBinding.instance.addPostFrameCallback((_) {
_loanProvider.getLoanById(widget.loanId);
});
}
// Future<void> getLoanData() async {
// model = await _loanProvider.getLoanById(widget.loanId);
// allAttachments.clear();
// allAttachments = [
// // ...(model?.attachments ?? []),
// // ...(model?.engineerData?.attachments ?? []),
// ];
// }
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "Request Details"),
body: Selector<LoanProvider, bool>(
selector: (_, provider) => provider.isLoading,
builder: (_, isLoading, __) {
if (isLoading) return const CircularProgressIndicator(color: AppColor.primary10).center;
LoanRequestModel? model = Provider.of<LoanProvider>(context, listen: false).loanData;
if (model == null) const NoDataFound().center;
body: SafeArea(
child: FutureBuilder<LoanRequestModel?>(
future: Provider.of<LoanProvider>(context, listen: false).getLoanById(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!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleChildScrollView(
return ListView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// StatusLabel(
// label: model.priority!,
// textColor: AppColor.getRequestStatusTextColorByName(context, widget.requestDetails?.priority!),
// backgroundColor: AppColor.getRequestStatusColorByName(context, widget.requestDetails?.priority!),
// ),
// 8.width,
StatusLabel(
label: model?.loanStatusName!,
textColor: AppColor.getRequestStatusTextColorByName(context, model?.loanStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, model?.loanStatusName!),
),
1.width.expanded,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StatusLabel(
label: snapshot.data!.loanStatusName!,
textColor: AppColor.getRequestStatusTextColorByName(context, snapshot.data!.loanStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, snapshot.data!.loanStatusName!),
),
1.width.expanded,
Text(
snapshot.data!.createdDate?.toServiceRequestCardFormat ?? "-",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
),
],
),
12.height,
...requesterDetails(context, snapshot.data!),
12.height,
...requestDetails(context, snapshot.data!),
12.height,
...assetDetails(context, snapshot.data!),
12.height,
...installationDetails(context, snapshot.data!),
12.height,
...doctorDetails(context, snapshot.data!),
12.height,
...vendorDetails(context, snapshot.data!),
if (allAttachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
model?.createdDate?.toServiceRequestCardFormat ?? "-",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
],
),
12.height,
...requestDetails(model!),
12.height,
...assetDetails(model),
12.height,
...requesterDetails(model),
12.height,
...doctorDetails(model),
12.height,
...vendorDetails(model),
// assetInformation(),
// 8.height,
// workOrderInformation(),
// 8.height,
// //TODO need to check for comments
// if (model?.findingDescription?.isNotEmpty ?? false) ...[
// const Divider().defaultStyle(context),
// // Text(
// // "Comments".addTranslation,
// // style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
// // ),
// model!.findingDescription!.bodyText(context),
// ],
//TODO need to check for attachments
if (allAttachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
FilesList(images: allAttachments.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []),
],
],
).paddingAll(0).toShadowContainer(context),
).expanded,
// if (context.userProvider.isEngineer)
// FooterActionButton.footerContainer(
// context: context,
// child: AppFilledButton(
// buttonColor: AppColor.primary10,
// label: "Update",
// onPressed: () async {
// final result = await Navigator.of(context).push(
// MaterialPageRoute(
// builder: (_) => UpdateSystemInternalAuditPage(model: model),
// ),
// );
// if (result == true) {
// // await getAuditData();
// // setState(() {}); // refresh UI with new model
// }
// }),
// ),
],
);
},
).toShadowContainer(context),
],
);
}),
));
}
// Widget workOrderInformation() {
// final details = model?.workOrderDetails;
// return Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// const Divider().defaultStyle(context),
// Text(
// "WO Info",
// style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
// ),
// 6.height,
// labelValueText(context, context.translation.woNumber, details?.workOrderNo),
// labelValueText(context, 'WO Type'.addTranslation, model?.workOrderType?.name),
// labelValueText(context, context.translation.site, details?.woSite),
// labelValueText(context, context.translation.assetName, details?.woAssetName),
// labelValueText(context, context.translation.manufacture, details?.woManufacturer),
// labelValueText(context, context.translation.model, details?.woModel),
// ],
// );
// }
List<Widget> requestDetails(LoanRequestModel loanData) {
List<Widget> requestDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
6.height,
'Loan Type: ${loanData.loanTypeName ?? "-"}'.bodyText(context),
'Loan No: ${loanData.reqCode ?? "-"}'.bodyText(context),
'Loan Period: ${loanData.loanPeriodName ?? "-"}'.bodyText(context),
'Item Description: ${loanData.itemDescription ?? "-"}'.bodyText(context),
'Request Description: ${loanData.requestDescription ?? "-"}'.bodyText(context),
'${context.translation.site}: ${loanData.siteName ?? "-"}'.bodyText(context),
'${context.translation.department}: ${loanData.departmentName ?? "-"}'.bodyText(context),
'Item Description: ${loanData.itemDescription ?? "-"}'.bodyText(context),
'Request Description: ${loanData.requestDescription ?? "-"}'.bodyText(context),
];
}
List<Widget> vendorDetails(LoanRequestModel loanData) {
List<Widget> vendorDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Vendor Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.vendorName ?? "-"}'.bodyText(context),
@ -214,7 +121,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
];
}
List<Widget> assetDetails(LoanRequestModel loanData) {
List<Widget> assetDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Asset Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.assetName}: ${loanData.assetName ?? "-"}'.bodyText(context),
@ -225,7 +132,17 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
];
}
List<Widget> doctorDetails(LoanRequestModel loanData) {
List<Widget> installationDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Installation & Pullout Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Installation EDD: ${loanData.installationEDD?.toServiceRequestDetailsFormat ?? "-"}'.bodyText(context),
'Installation Date: ${loanData.installationEDD?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
'Pullout EDD: ${loanData.pulloutEDD?.toServiceRequestDetailsFormat ?? "-"}'.bodyText(context),
'Pullout Date: ${loanData.pulloutDate?.toAssetDetailsFormat ?? "-"}'.bodyText(context),
];
}
List<Widget> doctorDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Doctor Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.doctorName ?? "-"}'.bodyText(context),
@ -234,7 +151,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
];
}
List<Widget> requesterDetails(LoanRequestModel loanData) {
List<Widget> requesterDetails(BuildContext context, LoanRequestModel loanData) {
return [
Text("Requester Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'Name: ${loanData.requestorUserIdForDisplay ?? "-"}'.bodyText(context),
@ -244,25 +161,6 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
];
}
// Widget assetInformation() {
// final details = model?.workOrderDetails;
// return Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// "Asset Details",
// style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
// ),
// 6.height,
// labelValueText(context, context.translation.assetName, details?.woAssetName),
// labelValueText(context, context.translation.assetNo, details?.woAssetNo),
// labelValueText(context, context.translation.manufacture, details?.woManufacturer),
// labelValueText(context, context.translation.model, details?.woModel),
// ],
// );
// }
Widget labelValueText(BuildContext context, String label, String? value) {
if (value == null || value.isEmpty) return const SizedBox.shrink();
@ -277,7 +175,7 @@ class _LoanEquipmentDetailPageState extends State<LoanEquipmentDetailPage> {
);
}
Widget checklistWidget({required String value}) {
Widget checklistWidget(BuildContext context, {required String value}) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [

@ -88,7 +88,7 @@ class LoanEquipmentItemView extends StatelessWidget {
(requestDetails?.nameOfType ?? "Loan Request").heading5(context),
8.height,
infoWidget(label: context.translation.requestType, value: requestDetails!.requestType, context: context),
infoWidget(label: context.translation.requestNo, value: requestDetails!.requestType, context: context),
infoWidget(label: context.translation.requestNo, value: requestDetails!.requestNo, context: context),
infoWidget(label: context.translation.site, value: requestDetails!.site, context: context),
8.height,
Row(

@ -21,23 +21,16 @@ class LoanProvider extends ChangeNotifier {
bool isLoading = false;
LoanRequestModel? loanData;
Future<void> getLoanById(int id) async {
loanData = null;
isLoading = true;
notifyListeners();
Future<LoanRequestModel?> getLoanById(int id) async {
LoanRequestModel? loanData;
try {
Response response = await ApiManager.instance.get(URLs.getLoanById + "?loanId=$id");
if (response.statusCode >= 200 && response.statusCode < 300) {
loanData = LoanRequestModel.fromJson(json.decode(response.body)["data"]);
}
// return data;
} catch (error) {
// return data;
print(error);
}
isLoading = false;
notifyListeners();
return loanData;
}
}

@ -267,7 +267,7 @@ class AppColor {
case 0:
return green15;
case 1:
//high priority
//high priority
return white10;
case 82:
//high priority

Loading…
Cancel
Save