loan equipment item view added;
parent
e76067bdac
commit
22fd3c8cc9
@ -0,0 +1,235 @@
|
||||
class LoanRequestModel {
|
||||
String? requestorUserID;
|
||||
int? reqNo;
|
||||
String? reqCode;
|
||||
String? requestorUserName;
|
||||
String? requestorUserEmail;
|
||||
String? requestorUserIdForDisplay;
|
||||
int? requesterUserPositionId;
|
||||
String? requesterExtensionNo;
|
||||
String? requestorUserMobileNumber;
|
||||
int? loanTypeId;
|
||||
String? loanTypeName;
|
||||
int? siteId;
|
||||
String? siteName;
|
||||
int? departmentId;
|
||||
String? departmentName;
|
||||
String? doctorName;
|
||||
String? doctorContact;
|
||||
String? doctorEmail;
|
||||
String? itemDescription;
|
||||
String? requestDescription;
|
||||
int? assetId;
|
||||
String? assetNumber;
|
||||
String? assetName;
|
||||
String? assetSerialNumber;
|
||||
String? model;
|
||||
String? manufacturer;
|
||||
int? loanPeriodId;
|
||||
String? loanPeriodName;
|
||||
String? vendorName;
|
||||
String? vendorRepName;
|
||||
String? vendorContact;
|
||||
String? vendorEmail;
|
||||
List<Null>? loanAttachments;
|
||||
int? loanStatusId;
|
||||
String? loanStatusName;
|
||||
int? loanStatusValue;
|
||||
String? installationEDD;
|
||||
String? pulloutEDD;
|
||||
String? mdUserID;
|
||||
String? mdUser;
|
||||
String? mesUserID;
|
||||
String? mesUser;
|
||||
String? assignedFEForInstallationUserID;
|
||||
String? assignedFEForInstallationUser;
|
||||
String? assignedFEForPulloutUserID;
|
||||
String? assignedFEForPulloutUser;
|
||||
int? cmwoItemId;
|
||||
int? installationWOItemId;
|
||||
int? pulloutWOItemId;
|
||||
int? id;
|
||||
String? createdBy;
|
||||
String? createdDate;
|
||||
String? modifiedBy;
|
||||
String? modifiedDate;
|
||||
|
||||
LoanRequestModel(
|
||||
{this.requestorUserID,
|
||||
this.reqNo,
|
||||
this.reqCode,
|
||||
this.requestorUserName,
|
||||
this.requestorUserEmail,
|
||||
this.requestorUserIdForDisplay,
|
||||
this.requesterUserPositionId,
|
||||
this.requesterExtensionNo,
|
||||
this.requestorUserMobileNumber,
|
||||
this.loanTypeId,
|
||||
this.loanTypeName,
|
||||
this.siteId,
|
||||
this.siteName,
|
||||
this.departmentId,
|
||||
this.departmentName,
|
||||
this.doctorName,
|
||||
this.doctorContact,
|
||||
this.doctorEmail,
|
||||
this.itemDescription,
|
||||
this.requestDescription,
|
||||
this.assetId,
|
||||
this.assetNumber,
|
||||
this.assetName,
|
||||
this.assetSerialNumber,
|
||||
this.model,
|
||||
this.manufacturer,
|
||||
this.loanPeriodId,
|
||||
this.loanPeriodName,
|
||||
this.vendorName,
|
||||
this.vendorRepName,
|
||||
this.vendorContact,
|
||||
this.vendorEmail,
|
||||
this.loanAttachments,
|
||||
this.loanStatusId,
|
||||
this.loanStatusName,
|
||||
this.loanStatusValue,
|
||||
this.installationEDD,
|
||||
this.pulloutEDD,
|
||||
this.mdUserID,
|
||||
this.mdUser,
|
||||
this.mesUserID,
|
||||
this.mesUser,
|
||||
this.assignedFEForInstallationUserID,
|
||||
this.assignedFEForInstallationUser,
|
||||
this.assignedFEForPulloutUserID,
|
||||
this.assignedFEForPulloutUser,
|
||||
this.cmwoItemId,
|
||||
this.installationWOItemId,
|
||||
this.pulloutWOItemId,
|
||||
this.id,
|
||||
this.createdBy,
|
||||
this.createdDate,
|
||||
this.modifiedBy,
|
||||
this.modifiedDate});
|
||||
|
||||
LoanRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
requestorUserID = json['requestorUserID'];
|
||||
reqNo = json['reqNo'];
|
||||
reqCode = json['reqCode'];
|
||||
requestorUserName = json['requestorUserName'];
|
||||
requestorUserEmail = json['requestorUserEmail'];
|
||||
requestorUserIdForDisplay = json['requestorUserIdForDisplay'];
|
||||
requesterUserPositionId = json['requesterUserPositionId'];
|
||||
requesterExtensionNo = json['requesterExtensionNo'];
|
||||
requestorUserMobileNumber = json['requestorUserMobileNumber'];
|
||||
loanTypeId = json['loanTypeId'];
|
||||
loanTypeName = json['loanTypeName'];
|
||||
siteId = json['siteId'];
|
||||
siteName = json['siteName'];
|
||||
departmentId = json['departmentId'];
|
||||
departmentName = json['departmentName'];
|
||||
doctorName = json['doctorName'];
|
||||
doctorContact = json['doctorContact'];
|
||||
doctorEmail = json['doctorEmail'];
|
||||
itemDescription = json['itemDescription'];
|
||||
requestDescription = json['requestDescription'];
|
||||
assetId = json['assetId'];
|
||||
assetNumber = json['assetNumber'];
|
||||
assetName = json['assetName'];
|
||||
assetSerialNumber = json['assetSerialNumber'];
|
||||
model = json['model'];
|
||||
manufacturer = json['manufacturer'];
|
||||
loanPeriodId = json['loanPeriodId'];
|
||||
loanPeriodName = json['loanPeriodName'];
|
||||
vendorName = json['vendorName'];
|
||||
vendorRepName = json['vendorRepName'];
|
||||
vendorContact = json['vendorContact'];
|
||||
vendorEmail = json['vendorEmail'];
|
||||
if (json['loanAttachments'] != null) {
|
||||
loanAttachments = <Null>[];
|
||||
json['loanAttachments'].forEach((v) {
|
||||
// loanAttachments!.add(new Null.fromJson(v));
|
||||
});
|
||||
}
|
||||
loanStatusId = json['loanStatusId'];
|
||||
loanStatusName = json['loanStatusName'];
|
||||
loanStatusValue = json['loanStatusValue'];
|
||||
installationEDD = json['installationEDD'];
|
||||
pulloutEDD = json['pulloutEDD'];
|
||||
mdUserID = json['mdUserID'];
|
||||
mdUser = json['mdUser'];
|
||||
mesUserID = json['mesUserID'];
|
||||
mesUser = json['mesUser'];
|
||||
assignedFEForInstallationUserID = json['assignedFEForInstallationUserID'];
|
||||
assignedFEForInstallationUser = json['assignedFEForInstallationUser'];
|
||||
assignedFEForPulloutUserID = json['assignedFEForPulloutUserID'];
|
||||
assignedFEForPulloutUser = json['assignedFEForPulloutUser'];
|
||||
cmwoItemId = json['cmwoItemId'];
|
||||
installationWOItemId = json['installationWOItemId'];
|
||||
pulloutWOItemId = json['pulloutWOItemId'];
|
||||
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['requestorUserID'] = this.requestorUserID;
|
||||
data['reqNo'] = this.reqNo;
|
||||
data['reqCode'] = this.reqCode;
|
||||
data['requestorUserName'] = this.requestorUserName;
|
||||
data['requestorUserEmail'] = this.requestorUserEmail;
|
||||
data['requestorUserIdForDisplay'] = this.requestorUserIdForDisplay;
|
||||
data['requesterUserPositionId'] = this.requesterUserPositionId;
|
||||
data['requesterExtensionNo'] = this.requesterExtensionNo;
|
||||
data['requestorUserMobileNumber'] = this.requestorUserMobileNumber;
|
||||
data['loanTypeId'] = this.loanTypeId;
|
||||
data['loanTypeName'] = this.loanTypeName;
|
||||
data['siteId'] = this.siteId;
|
||||
data['siteName'] = this.siteName;
|
||||
data['departmentId'] = this.departmentId;
|
||||
data['departmentName'] = this.departmentName;
|
||||
data['doctorName'] = this.doctorName;
|
||||
data['doctorContact'] = this.doctorContact;
|
||||
data['doctorEmail'] = this.doctorEmail;
|
||||
data['itemDescription'] = this.itemDescription;
|
||||
data['requestDescription'] = this.requestDescription;
|
||||
data['assetId'] = this.assetId;
|
||||
data['assetNumber'] = this.assetNumber;
|
||||
data['assetName'] = this.assetName;
|
||||
data['assetSerialNumber'] = this.assetSerialNumber;
|
||||
data['model'] = this.model;
|
||||
data['manufacturer'] = this.manufacturer;
|
||||
data['loanPeriodId'] = this.loanPeriodId;
|
||||
data['loanPeriodName'] = this.loanPeriodName;
|
||||
data['vendorName'] = this.vendorName;
|
||||
data['vendorRepName'] = this.vendorRepName;
|
||||
data['vendorContact'] = this.vendorContact;
|
||||
data['vendorEmail'] = this.vendorEmail;
|
||||
if (this.loanAttachments != null) {
|
||||
// data['loanAttachments'] = this.loanAttachments!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['loanStatusId'] = this.loanStatusId;
|
||||
data['loanStatusName'] = this.loanStatusName;
|
||||
data['loanStatusValue'] = this.loanStatusValue;
|
||||
data['installationEDD'] = this.installationEDD;
|
||||
data['pulloutEDD'] = this.pulloutEDD;
|
||||
data['mdUserID'] = this.mdUserID;
|
||||
data['mdUser'] = this.mdUser;
|
||||
data['mesUserID'] = this.mesUserID;
|
||||
data['mesUser'] = this.mesUser;
|
||||
data['assignedFEForInstallationUserID'] = this.assignedFEForInstallationUserID;
|
||||
data['assignedFEForInstallationUser'] = this.assignedFEForInstallationUser;
|
||||
data['assignedFEForPulloutUserID'] = this.assignedFEForPulloutUserID;
|
||||
data['assignedFEForPulloutUser'] = this.assignedFEForPulloutUser;
|
||||
data['cmwoItemId'] = this.cmwoItemId;
|
||||
data['installationWOItemId'] = this.installationWOItemId;
|
||||
data['pulloutWOItemId'] = this.pulloutWOItemId;
|
||||
data['id'] = this.id;
|
||||
data['createdBy'] = this.createdBy;
|
||||
data['createdDate'] = this.createdDate;
|
||||
data['modifiedBy'] = this.modifiedBy;
|
||||
data['modifiedDate'] = this.modifiedDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,295 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/extensions/context_extension.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';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/models/internal_audit_attachment_model.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/models/system_internal_audit_data_model.dart';
|
||||
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/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';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/widgets/images/files_list.dart';
|
||||
|
||||
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
|
||||
import '../models/loan_request_model.dart';
|
||||
|
||||
class LoanEquipmentDetailPage extends StatefulWidget {
|
||||
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;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
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,
|
||||
Text(
|
||||
model?.createdDate?.toServiceRequestCardFormat ?? "-",
|
||||
textAlign: TextAlign.end,
|
||||
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
],
|
||||
),
|
||||
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
|
||||
// }
|
||||
// }),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> vendorDetails(LoanRequestModel loanData) {
|
||||
return [
|
||||
Text("Vendor Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'Name: ${loanData.vendorName ?? "-"}'.bodyText(context),
|
||||
'Representative Name: ${loanData.vendorRepName ?? "-"}'.bodyText(context),
|
||||
'Contact: ${loanData.vendorContact ?? "-"}'.bodyText(context),
|
||||
'Email: ${loanData.vendorEmail ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> assetDetails(LoanRequestModel loanData) {
|
||||
return [
|
||||
Text("Asset Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'${context.translation.assetName}: ${loanData.assetName ?? "-"}'.bodyText(context),
|
||||
'${context.translation.assetNo}: ${loanData.assetNumber ?? "-"}'.bodyText(context),
|
||||
'${context.translation.serialNumber}: ${loanData.assetSerialNumber ?? "-"}'.bodyText(context),
|
||||
'${context.translation.manufacture}: ${loanData.manufacturer ?? "-"}'.bodyText(context),
|
||||
'${context.translation.model}: ${loanData.model ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> doctorDetails(LoanRequestModel loanData) {
|
||||
return [
|
||||
Text("Doctor Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'Name: ${loanData.doctorName ?? "-"}'.bodyText(context),
|
||||
'Contact: ${loanData.doctorContact ?? "-"}'.bodyText(context),
|
||||
'Email: ${loanData.doctorEmail ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> requesterDetails(LoanRequestModel loanData) {
|
||||
return [
|
||||
Text("Requester Information", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
||||
'Name: ${loanData.requestorUserIdForDisplay ?? "-"}'.bodyText(context),
|
||||
'Email: ${loanData.requestorUserEmail ?? "-"}'.bodyText(context),
|
||||
'Contact: ${loanData.requestorUserMobileNumber ?? "-"}'.bodyText(context),
|
||||
'Extension: ${loanData.requesterExtensionNo ?? "-"}'.bodyText(context),
|
||||
];
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Text(
|
||||
'$label: $value',
|
||||
style: AppTextStyles.bodyText.copyWith(
|
||||
color: context.isDark ? AppColor.neutral30 : AppColor.neutral120,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget checklistWidget({required String value}) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Checkbox(
|
||||
value: true,
|
||||
activeColor: AppColor.neutral120,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
visualDensity: const VisualDensity(horizontal: -4, vertical: -3),
|
||||
onChanged: (value) {},
|
||||
),
|
||||
value.bodyText(context),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.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';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/all_requests_and_count_model.dart';
|
||||
import 'package:test_sa/models/new_models/dashboard_detail.dart';
|
||||
import 'package:test_sa/modules/internal_audit_module/pages/equipment_internal_audit/equipment_internal_audit_detail_page.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
|
||||
import 'loan_equipment_detail_page.dart';
|
||||
|
||||
class LoanEquipmentItemView extends StatelessWidget {
|
||||
final Data? requestData;
|
||||
final RequestsDetails? requestDetails;
|
||||
final bool showShadow;
|
||||
|
||||
const LoanEquipmentItemView({Key? key, this.requestData, this.requestDetails, this.showShadow = true}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (requestData != null) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: requestData!.statusName!,
|
||||
textColor: AppColor.getRequestStatusTextColorByName(context, requestData!.statusName!),
|
||||
backgroundColor: AppColor.getRequestStatusColorByName(context, requestData!.statusName!),
|
||||
),
|
||||
1.width.expanded,
|
||||
Text(
|
||||
requestData!.transactionDate?.toServiceRequestCardFormat ?? "",
|
||||
textAlign: TextAlign.end,
|
||||
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
(requestData?.typeTransaction ?? "Loan Request").heading5(context),
|
||||
infoWidget(label: context.translation.requestType, value: requestData?.requestTypeName, context: context),
|
||||
infoWidget(label: context.translation.requestNo, value: requestData?.requestNo, context: context),
|
||||
// infoWidget(label: context.translation.site, value: requestData?., context: context),
|
||||
8.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
context.translation.viewDetails,
|
||||
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
||||
),
|
||||
4.width,
|
||||
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
||||
],
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => LoanEquipmentDetailPage(loanId: requestDetails!.id!)));
|
||||
});
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: requestDetails!.status!,
|
||||
textColor: AppColor.getRequestStatusTextColorByName(context, requestDetails?.status!),
|
||||
backgroundColor: AppColor.getRequestStatusColorByName(context, requestDetails?.status!),
|
||||
),
|
||||
1.width.expanded,
|
||||
Text(
|
||||
requestDetails!.date?.toServiceRequestCardFormat ?? "",
|
||||
textAlign: TextAlign.end,
|
||||
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
||||
),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
(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.site, value: requestDetails!.site, context: context),
|
||||
8.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
context.translation.viewDetails,
|
||||
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
||||
),
|
||||
4.width,
|
||||
Icon(Icons.arrow_forward, color: AppColor.blueStatus(context), size: 14)
|
||||
],
|
||||
),
|
||||
],
|
||||
).toShadowContainer(context, withShadow: showShadow).onPress(() async {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => LoanEquipmentDetailPage(loanId: requestDetails!.id!)));
|
||||
});
|
||||
}
|
||||
|
||||
Widget infoWidget({required String label, String? value, required BuildContext context}) {
|
||||
if (value != null && value.isNotEmpty) {
|
||||
return '$label: $value'.bodyText(context);
|
||||
}
|
||||
return const SizedBox();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue