|
|
|
|
@ -4,6 +4,7 @@ import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/devices_provider.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/device/asset_by_id_model.dart';
|
|
|
|
|
@ -12,6 +13,7 @@ import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/failed_loading.dart';
|
|
|
|
|
|
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
|
import '../requests/request_status.dart';
|
|
|
|
|
|
|
|
|
|
class AssetDetailPage extends StatefulWidget {
|
|
|
|
|
static const String id = "/asset-details";
|
|
|
|
|
@ -71,7 +73,7 @@ class _AssetDetailPageState extends State<AssetDetailPage> {
|
|
|
|
|
width: 95,
|
|
|
|
|
height: 95,
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: const Color(0xFFEAF1F4),
|
|
|
|
|
color: AppColor.neutral30,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
@ -87,64 +89,52 @@ class _AssetDetailPageState extends State<AssetDetailPage> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
_assetProvider.assetById?.modelDefinition?.assetName ?? "-".heading5(context),
|
|
|
|
|
),
|
|
|
|
|
if (_assetProvider.assetById.commissioningStatus != null)
|
|
|
|
|
StatusLabel(
|
|
|
|
|
label: _assetProvider.assetById.commissioningStatus.name,
|
|
|
|
|
textColor: AppColor.getRequestStatusTextColorByName(context, _assetProvider.assetById.commissioningStatus.name),
|
|
|
|
|
backgroundColor: AppColor.getRequestStatusColorByName(context, _assetProvider.assetById.commissioningStatus.name),
|
|
|
|
|
),
|
|
|
|
|
if (_assetProvider.assetById.commissioningStatus != null) 8.height,
|
|
|
|
|
(_assetProvider.assetById?.modelDefinition?.assetName ?? "-").heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
"${context.translation.assetNumber}: ${_assetProvider.assetById.multiAssets.first.assetNumber}".bodyText(context),
|
|
|
|
|
"${context.translation.model}: ${_assetProvider.assetById.modelDefinition.modelDefCode}".bodyText(context),
|
|
|
|
|
Text(
|
|
|
|
|
"${context.translation.serialNo}: ${_assetProvider.assetById.multiAssets.first.assetSerialNo}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"MD: ${_assetProvider.assetById.department.departmentName ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Supplier: ${_assetProvider.assetById.supplier?.suppliername ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Manufacturer: ${_assetProvider.assetById.modelDefinition.manufacturerName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Location: ${_assetProvider.assetById.site.custName}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"${context.translation.assetNo}: ${_assetProvider.assetById.multiAssets.first.assetNumber}".bodyText(context),
|
|
|
|
|
"${context.translation.modelNo}: ${_assetProvider.assetById.modelDefinition.modelDefCode}".bodyText(context),
|
|
|
|
|
"${context.translation.supplier}: ${_assetProvider.assetById.supplier?.suppliername ?? "-"}".bodyText(context),
|
|
|
|
|
"${context.translation.manufacture}: ${_assetProvider.assetById.modelDefinition.manufacturerName}".bodyText(context),
|
|
|
|
|
"${context.translation.location}: ${_assetProvider.assetById.site.custName}".bodyText(context),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
8.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
/// TODO: theres no [ORACLE CODE] available to preview
|
|
|
|
|
// "${context.translation.oracleCode}: ${"-"}".bodyText(context),
|
|
|
|
|
"${context.translation.snNo}: ${_assetProvider.assetById.multiAssets.first.assetSerialNo}".bodyText(context),
|
|
|
|
|
"${context.translation.site}: ${_assetProvider.assetById?.site?.custName ?? "-"}".bodyText(context),
|
|
|
|
|
"${context.translation.md}: ${_assetProvider.assetById?.modelDefinition?.modelName ?? "-"}".bodyText(context),
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
const Divider(color: AppColor.neutral30, height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Installation Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Next PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
"Last PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
"${context.translation.installationDate}: ${_assetProvider.assetById.installationDate.toAssetDetailsFormat ?? "-"}".bodyText(context),
|
|
|
|
|
"${context.translation.nextPmDate}: ${_assetProvider.assetById.installationDate.toAssetDetailsFormat}".bodyText(context),
|
|
|
|
|
"${context.translation.lastPmDate}: ${_assetProvider.assetById.installationDate.toAssetDetailsFormat}".bodyText(context),
|
|
|
|
|
if ((_assetProvider.assetById.modelDefinition.assetDescription ?? "").isNotEmpty) ...[
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
|
|
|
|
const Divider(color: AppColor.neutral30, height: 1, thickness: 1),
|
|
|
|
|
8.height,
|
|
|
|
|
Text(
|
|
|
|
|
_assetProvider.assetById.modelDefinition.assetDescription ?? "-",
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : Color(0xFF757575)),
|
|
|
|
|
),
|
|
|
|
|
_assetProvider.assetById.modelDefinition.assetDescription.bodyText(context),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
@ -152,7 +142,7 @@ class _AssetDetailPageState extends State<AssetDetailPage> {
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return Center(child: ALoading());
|
|
|
|
|
return const Center(child: ALoading());
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|