Merge branch 'refs/heads/design_3.0_traf_module' into design_3.0_internal_audit_module

design_3.0_cx_module
Sikander Saleem 2 weeks ago
commit 60125bb6d9

@ -0,0 +1,3 @@
<svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M1.35372 0.305286C1.4756 0.46666 1.83951 0.948403 2.05624 1.22611C2.49031 1.78233 3.08342 2.52142 3.72323 3.25831C4.36627 3.99893 5.04178 4.72022 5.64189 5.25046C5.94281 5.51634 6.20714 5.71838 6.42527 5.84987C6.63042 5.97355 6.75161 5.99927 6.75161 5.99927C6.75161 5.99927 6.86923 5.97355 7.07437 5.84988C7.2925 5.71838 7.55684 5.51635 7.85775 5.25047C8.45786 4.72022 9.13337 3.99892 9.77642 3.2583C10.4162 2.5214 11.0093 1.7823 11.4434 1.22608C11.6601 0.948368 12.0235 0.467305 12.1454 0.305929C12.3911 -0.0275935 12.8611 -0.0995297 13.1946 0.146103C13.5281 0.391736 13.5994 0.861234 13.3537 1.19476L13.3518 1.1973C13.224 1.36655 12.8471 1.86557 12.6259 2.14892C12.1821 2.7177 11.5716 3.47861 10.9091 4.24171C10.2497 5.00109 9.52408 5.77979 8.85096 6.37454C8.51526 6.67116 8.17497 6.93788 7.8488 7.1345C7.54322 7.31872 7.15633 7.5 6.74982 7.5C6.34331 7.5 5.95642 7.31871 5.65084 7.1345C5.32468 6.93787 4.98439 6.67116 4.64869 6.37454C3.97557 5.77979 3.2499 5.0011 2.59058 4.24173C1.92803 3.47863 1.3176 2.71774 0.873719 2.14896C0.652433 1.86541 0.275507 1.36637 0.14793 1.19747L0.14628 1.19528C-0.0993546 0.861762 -0.0284591 0.391787 0.305062 0.146153C0.638573 -0.0994739 1.10808 -0.0282082 1.35372 0.305286Z" fill="#3B3D4A"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,3 @@
<svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.305286 12.1462C0.46666 12.0243 0.948403 11.6604 1.22611 11.4436C1.78233 11.0096 2.52142 10.4165 3.25831 9.77665C3.99893 9.13361 4.72022 8.4581 5.25046 7.85799C5.51634 7.55707 5.71838 7.29274 5.84987 7.07461C5.97355 6.86945 5.99927 6.74827 5.99927 6.74827C5.99927 6.74827 5.97355 6.63064 5.84988 6.4255C5.71838 6.20738 5.51635 5.94304 5.25047 5.64213C4.72022 5.04201 3.99892 4.3665 3.2583 3.72346C2.5214 3.08366 1.7823 2.49055 1.22608 2.05647C0.948368 1.83975 0.467305 1.47634 0.305929 1.35446C-0.0275935 1.10883 -0.0995297 0.63882 0.146103 0.305298C0.391736 -0.0282253 0.861234 -0.0994742 1.19476 0.146159L1.1973 0.148077C1.36655 0.275917 1.86557 0.652817 2.14892 0.873949C2.7177 1.31783 3.47861 1.92826 4.24171 2.59081C5.00109 3.25013 5.77979 3.9758 6.37454 4.64892C6.67116 4.98462 6.93788 5.32491 7.1345 5.65108C7.31872 5.95665 7.5 6.34355 7.5 6.75006C7.5 7.15657 7.31871 7.54346 7.1345 7.84904C6.93787 8.1752 6.67116 8.51549 6.37454 8.85119C5.77979 9.52431 5.0011 10.25 4.24173 10.9093C3.47863 11.5719 2.71774 12.1823 2.14896 12.6262C1.86541 12.8474 1.36637 13.2244 1.19747 13.3519L1.19528 13.3536C0.861762 13.5992 0.391787 13.5283 0.146153 13.1948C-0.0994739 12.8613 -0.0282082 12.3918 0.305286 12.1462Z" fill="#3B3D4A"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -100,13 +100,13 @@ class AssetInventoryModel {
String? photo;
String? photoOriginName;
String? remarks;
Site? site;
Building? building;
Floor? floor;
Department? department;
Rooms? room;
SupplierDetails? supplier;
List<AssetInventoryDetailAssetAttachments> assetInventoryDetailAssetAttachments = [];
AssetInventoryModel({
this.id,
@ -160,6 +160,7 @@ class AssetInventoryModel {
this.floor,
this.room,
this.supplier,
this.assetInventoryDetailAssetAttachments = const [],
});
AssetInventoryModel.fromJson(Map<String, dynamic> json) {
@ -194,6 +195,13 @@ class AssetInventoryModel {
photo = json['photo'];
photoOriginName = json['photoOriginName'];
remarks = json['remarks'];
if (json['assetTransferAttachments'] != null) {
assetInventoryDetailAssetAttachments = [];
json['assetInventoryDetailAssetAttachments'].forEach((v) {
assetInventoryDetailAssetAttachments.add(AssetInventoryDetailAssetAttachments.fromJson(v));
});
}
//new data..
// newAssetNumber = json['newAssetNumber'] ?? json['assetNumber'];
// manufacturerId = json['manufacturerId'] ?? json['manufacturerId'];
@ -232,6 +240,9 @@ class AssetInventoryModel {
'newSupplierName': newSupplierName,
'photo': photo,
'remarks': remarks,
'assetInventoryDetailAssetAttachments': assetInventoryDetailAssetAttachments != null
? assetInventoryDetailAssetAttachments!.map((v) => v.toJson()).toList()
: [],
};
}
@ -290,8 +301,45 @@ class AssetInventoryModel {
department: department ?? other.department,
room: room ?? other.room,
supplier: supplier ?? other.supplier,
assetInventoryDetailAssetAttachments: assetInventoryDetailAssetAttachments??other.assetInventoryDetailAssetAttachments,
);
}
}
class AssetInventoryDetailAssetAttachments {
AssetInventoryDetailAssetAttachments({
this.id,
this.name,
this.originalName,
});
AssetInventoryDetailAssetAttachments.fromJson(dynamic json) {
id = json['id'];
name = json['name'];
originalName = json['originalName'];
}
num? id;
String? name;
String? originalName;
AssetInventoryDetailAssetAttachments copyWith({
num? id, // Parameter is now nullable
String? name, // Parameter is now nullable
String? originalName, // Parameter is now nullable
}) =>
AssetInventoryDetailAssetAttachments(
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;
return map;
}
}

@ -24,6 +24,7 @@ class AssetDetailCardView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
@ -37,81 +38,75 @@ class AssetDetailCardView extends StatelessWidget {
],
),
8.height,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'transaction Date: ${assetInventoryModel.transactionDate?.toServiceRequestDetailsFormat ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.assetNumber}: ${assetInventoryModel.assetNumber ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.serialNo}: ${assetInventoryModel.serialNo ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.manufacture}: ${assetInventoryModel.manufacturer ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.model}: ${assetInventoryModel.model ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.site}: ${assetInventoryModel.siteName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.building}: ${assetInventoryModel.buildingName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.floor}: ${assetInventoryModel.floorName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.department}: ${assetInventoryModel.departmentName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.supplier}: ${assetInventoryModel.supplierName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Classifications'.addTranslation}: ${assetInventoryModel.status ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Remarks'.addTranslation}: ${assetInventoryModel.remarks ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
],
).expanded,
Container(
decoration: BoxDecoration(color: AppColor.neutral100, borderRadius: BorderRadius.circular(15)),
height: 115.toScreenHeight,
width: 115.toScreenWidth,
margin: const EdgeInsets.only(top: 8),
child: assetInventoryModel.photo != null && assetInventoryModel.photo!.isNotEmpty
? ClipRRect(
borderRadius: BorderRadius.circular(8),
child: ImageLoader(
url: URLs.getFileUrl(assetInventoryModel.photo),
boxFit: BoxFit.cover,
height: 48,
width: 48,
))
: 'image_placeholder'.toSvgAsset().center,
)
],
Text(
'Inventory Date: ${assetInventoryModel.transactionDate?.toServiceRequestDetailsFormat ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.assetNumber}: ${assetInventoryModel.assetNumber ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
), Text(
'${context.translation.assetName}: ${assetInventoryModel.assetName ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.serialNo}: ${assetInventoryModel.serialNo ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.manufacture}: ${assetInventoryModel.manufacturer ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.model}: ${assetInventoryModel.model ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.site}: ${assetInventoryModel.siteName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.building}: ${assetInventoryModel.buildingName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.floor}: ${assetInventoryModel.floorName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.department}: ${assetInventoryModel.departmentName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${context.translation.supplier}: ${assetInventoryModel.supplierName ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Classifications'.addTranslation}: ${assetInventoryModel.status ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'${'Remarks'.addTranslation}: ${assetInventoryModel.remarks ?? ''}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
],
).toShadowContainer(context, borderRadius: 20, padding: 12);
}
}
//TODO old code.
// Container(
// decoration: BoxDecoration(color: AppColor.neutral100, borderRadius: BorderRadius.circular(15)),
// height: 115.toScreenHeight,
// width: 115.toScreenWidth,
// margin: const EdgeInsets.only(top: 8),
// child: assetInventoryModel.photo != null && assetInventoryModel.photo!.isNotEmpty
// ? ClipRRect(
// borderRadius: BorderRadius.circular(8),
// child: ImageLoader(
// url: URLs.getFileUrl(assetInventoryModel.photo),
// boxFit: BoxFit.cover,
// height: 48,
// width: 48,
// ))
// : 'image_placeholder'.toSvgAsset().center,
// )

@ -4,6 +4,7 @@ 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/new_models/site.dart';
import 'package:test_sa/modules/asset_inventory_module/models/session_model.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
@ -48,12 +49,15 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
StatusLabel(
label: sessionModel.statusName,
id: sessionModel.statusId,
radius: 4,
textColor: AppColor.green15,
backgroundColor: AppColor.greenStatus(context),
textColor: AppColor.getRequestStatusTextColorByName(context, sessionModel.statusName),
backgroundColor: AppColor.getRequestStatusColorByName(context, sessionModel.statusName),
// textColor: AppColor.green15,
// backgroundColor: AppColor.greenStatus(context),
),
Text(
sessionModel.createdDate!.toString().toServiceRequestCardFormat,
@ -64,7 +68,7 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
),
8.height,
Text(
context.translation.requestDetails,
'Session Details'.addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
@ -100,64 +104,139 @@ class _AssetInventoryDetailViewState extends State<AssetInventoryDetailView> {
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
ListView.separated(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemCount: sites.length,
itemBuilder: (cxt, siteIndex) {
final site = sites[siteIndex];
final buildingNames = (site.buildings ?? []).map((b) => b.name).where((name) => name != null && name!.trim().isNotEmpty).join(', ');
final floorNames = (site.buildings ?? []).expand((b) => b.floors ?? []).map((f) => f.name).where((name) => name != null && name!.trim().isNotEmpty).join(', ');
final departmentNames =
(site.buildings ?? []).expand((b) => b.floors ?? []).expand((f) => f.departments ?? []).map((d) => d.name).where((name) => name != null && name!.trim().isNotEmpty).join(', ');
final roomNames = (site.buildings ?? [])
.expand((b) => b.floors ?? [])
.expand((f) => f.departments ?? [])
.expand((d) => d.rooms ?? [])
.map((r) => r.name)
.where((name) => name != null && name!.trim().isNotEmpty)
.join(', ');
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
SiteHierarchyView(
sites: sites,
),
],
).toShadowContainer(context, padding: 12, borderRadius: 20);
}
}
class SiteHierarchyView extends StatelessWidget {
final List<Site> sites;
const SiteHierarchyView({super.key, required this.sites});
@override
Widget build(BuildContext context) {
return ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: sites.length,
itemBuilder: (context, index) {
final site = sites[index];
return HierarchyTile(
title: site.name ?? '-',
children: (site.buildings ?? [])
.map((b) => HierarchyTile(
title: b.name ?? '-',
children: (b.floors ?? [])
.map((f) => HierarchyTile(
title: f.name ?? '-',
children: (f.departments ?? [])
.map((d) => HierarchyTile(
title: d.name ?? '-',
children: (d.rooms ?? [])
.map((r) => LeafTile(title: r.name ?? '-'))
.toList(),
))
.toList(),
))
.toList(),
))
.toList(),
);
},
);
}
}
class HierarchyTile extends StatefulWidget {
final String title;
final List<Widget> children;
final double indent;
const HierarchyTile({
super.key,
required this.title,
this.children = const [],
this.indent = 0,
});
@override
State<HierarchyTile> createState() => _HierarchyTileState();
}
class _HierarchyTileState extends State<HierarchyTile> {
bool expanded = false;
@override
Widget build(BuildContext context) {
final hasChildren = widget.children.isNotEmpty;
return Padding(
padding: EdgeInsets.only(left: widget.indent,top: 10.toScreenHeight),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: hasChildren ? () => setState(() => expanded = !expanded) : null,
child: Row(
children: [
if (hasChildren)
// expanded? 'expended_arrow_icon'.toSvgAsset(color: AppColor.neutral50,width: 8,height:13): 'collesped_arrow_icon'.toSvgAsset(color: AppColor.neutral50,width: 8,height:13)
Icon(
expanded ? Icons.expand_more : Icons.chevron_right,
size: 25.toScreenHeight,
color: AppColor.neutral50,
)
else
SizedBox(width: 18.toScreenWidth),
SizedBox(width: 15.toScreenWidth),
Text(
site.name ?? '-',
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
),
),
Text(
'${context.translation.building}: ${buildingNames.isNotEmpty ? buildingNames : '-'}',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
),
),
Text(
'${context.translation.floor}: ${floorNames.isNotEmpty ? floorNames : '-'}',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
),
),
Text(
'${context.translation.department}: ${departmentNames.isNotEmpty ? departmentNames : '-'}',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
),
),
Text(
'${context.translation.room}: ${roomNames.isNotEmpty ? roomNames : '-'}',
style: AppTextStyles.bodyText.copyWith(
color: context.isDark ? AppColor.neutral10 : AppColor.neutral120,
),
widget.title,
style:AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
),
],
);
},
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
),
],
).toShadowContainer(context, padding: 12, borderRadius: 20);
),
),
if (expanded)
Padding(
padding: const EdgeInsets.only(left: 20, top: 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: widget.children
.map((child) => child is HierarchyTile
? HierarchyTile(
title: (child).title,
indent: 0,
children: (child).children,
)
: child)
.toList(),
),
),
],
),
);
}
}
class LeafTile extends StatelessWidget {
final String title;
const LeafTile({super.key, required this.title});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 22, top: 4, bottom: 4),
child: Text(
title,
style: const TextStyle(fontSize: 13, color: Colors.black87),
),
);
}
}

@ -294,30 +294,17 @@ class _AssetInventoryFormViewState extends State<AssetInventoryFormView> {
],
12.height,
Text(
'Asset Photo'.addTranslation,
'Attachments'.addTranslation,
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.white936),
),
12.height,
attachments.isEmpty
? AttachmentPicker(
label: context.translation.attachImage,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: true,
onChange: (value) {
setState(() {});
},
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
)
: MultiFilesPickerItem(
file: File(attachments.first.name ?? ''),
enabled: true,
onRemoveTap: (file) {
setState(() {
attachments.clear();
});
},
),
AttachmentPicker(
label: context.translation.attachFiles,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
),
12.height,
AppTextFormField(
backgroundColor: AppColor.fieldBgColor(context),
@ -338,7 +325,7 @@ class _AssetInventoryFormViewState extends State<AssetInventoryFormView> {
.expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: context.translation.submitRequest, maxWidth: true, onPressed: _onSubmit),
child: AppFilledButton(buttonColor: AppColor.primary10, label: 'Submit'.addTranslation, maxWidth: true, onPressed: _onSubmit),
),
],
),
@ -348,7 +335,6 @@ class _AssetInventoryFormViewState extends State<AssetInventoryFormView> {
Future<void> searchAsset({required String assetNo}) async {
AssetInventoryProvider provider = Provider.of<AssetInventoryProvider>(context, listen: false);
Map<String, dynamic> payload = {
"assetNumber": assetNo,
"sessionId": widget.assetInventoryModel?.sessionId,
@ -415,11 +401,20 @@ class _AssetInventoryFormViewState extends State<AssetInventoryFormView> {
_scannedAssetModel?.departmentId = widget.assetInventoryModel?.department?.id;
_scannedAssetModel?.roomId = widget.assetInventoryModel?.room?.id;
_scannedAssetModel?.isNotRegistered = isRegistered;
if (attachments.isNotEmpty) {
String? photoName = attachments.first.name;
String fileName = ServiceRequestUtils.isLocalUrl(photoName ?? '') ? ("${photoName ?? ''.split("/").last}|${base64Encode(File(photoName ?? '').readAsBytesSync())}") : photoName ?? '';
_scannedAssetModel?.photo = fileName;
_scannedAssetModel?.assetInventoryDetailAssetAttachments = [];
// try {
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
_scannedAssetModel?.assetInventoryDetailAssetAttachments.add(AssetInventoryDetailAssetAttachments(id: item.id, name: fileName));
}
// // } catch (error) {
// // print(error);
// // }
// if (attachments.isNotEmpty) {
// String? photoName = attachments.first.name;
// String fileName = ServiceRequestUtils.isLocalUrl(photoName ?? '') ? ("${photoName ?? ''.split("/").last}|${base64Encode(File(photoName ?? '').readAsBytesSync())}") : photoName ?? '';
// _scannedAssetModel?.photo = fileName;
// }
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
assetInventoryProvider.saveAssetInSession(model: _scannedAssetModel).then((success) async {
///Need to use push and remove until...

@ -58,7 +58,7 @@ class _AssetInventoryPageState extends State<AssetInventoryPage> {
return Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: DefaultAppBar(
title: 'Inventory Session Request'.addTranslation,
title: 'Asset Inventory Session'.addTranslation,
onBackPress: () {
Navigator.pop(context);
},
@ -86,7 +86,7 @@ class _AssetInventoryPageState extends State<AssetInventoryPage> {
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral60 : AppColor.neutral110, borderRadius: BorderRadius.circular(7)),
onTap: (index) {},
tabs: [
Tab(text: 'Request Details'.addTranslation, height: 57.toScreenHeight),
Tab(text: 'Session Details'.addTranslation, height: 57.toScreenHeight),
Tab(
text:
'${'Scan Assets'.addTranslation} ${provider.assetInventoryResponse?.totalRows != null && provider.assetInventoryResponse!.totalRows! > 0 ? '(${provider.assetInventoryResponse?.totalRows})' : ''}',

@ -26,12 +26,6 @@ class InventorySessionItemView extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StatusLabel(
label: requestData!.priorityName!,
textColor: AppColor.getRequestStatusTextColorByName(context, requestData!.priorityName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, requestData!.priorityName!),
),
8.width,
StatusLabel(
label: requestData!.statusName!,
textColor: AppColor.getRequestStatusTextColorByName(context, requestData!.statusName!),
@ -47,7 +41,7 @@ class InventorySessionItemView extends StatelessWidget {
),
8.height,
(requestData?.typeTransaction ?? context.translation.taskRequest).heading5(context),
infoWidget(label: context.translation.requestType, value: requestData?.sessionType, context: context),
infoWidget(label: 'Session Type'.addTranslation, value: requestData?.sessionType, context: context),
infoWidget(label: 'No of Assets'.addTranslation, value: requestData?.numberOfAssets != null ? requestData?.numberOfAssets.toString() : '-', context: context),
infoWidget(label: 'No of Sites'.addTranslation, value: requestData?.numberOfSites != null ? requestData?.numberOfSites.toString() : '-', context: context),
8.height,
@ -73,12 +67,6 @@ class InventorySessionItemView extends StatelessWidget {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StatusLabel(
label: requestDetails!.priority!,
textColor: AppColor.getRequestStatusTextColorByName(context, requestDetails?.priority!),
backgroundColor: AppColor.getRequestStatusColorByName(context, requestDetails?.priority!),
),
8.width,
StatusLabel(
label: requestDetails!.status!,
textColor: AppColor.getRequestStatusTextColorByName(context, requestDetails?.status!),
@ -94,7 +82,7 @@ class InventorySessionItemView extends StatelessWidget {
),
8.height,
(requestDetails?.nameOfType ?? context.translation.taskRequest).heading5(context),
infoWidget(label: context.translation.requestType, value: requestDetails?.sessionType, context: context),
infoWidget(label: 'Session Type'.addTranslation, value: requestDetails?.sessionType, context: context),
infoWidget(label: 'No of Assets'.addTranslation, value: requestDetails?.numberOfAssets != null ? requestDetails?.numberOfAssets.toString() : '-', context: context),
infoWidget(label: 'No of Sites'.addTranslation, value: requestDetails?.numberOfSites != null ? requestDetails?.numberOfSites.toString() : '-', context: context),
8.height,

@ -1570,6 +1570,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
tree_view_flutter:
dependency: "direct main"
description:
name: tree_view_flutter
sha256: "3365e29b7d1b1e6c5098a2a0e77a208a12a9345dfa73865cb4c87657cf387801"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
typed_data:
dependency: transitive
description:

@ -95,6 +95,7 @@ dependencies:
safe_device: ^1.2.1
toggle_switch: ^2.3.0
clipboard: ^2.0.2
tree_view_flutter: ^1.0.2
local_auth_darwin: any
dev_dependencies:

Loading…
Cancel
Save