device transfer

main_design2.0
nextwo 2 years ago
parent 402f7513bd
commit 62f6f135bb

@ -271,6 +271,13 @@
"requestedThrough" : "الطلب عبر",
"typeOfRequest" : "نوع الطلب",
"assetDetails" : "تفاصيل الجهاز",
"deviceTransfer" : "نقل جهاز ",
"deviceTransferRequest" : "طلب نقل جهاز ",
"deviceTransferDetails" : "تفاصيل نقل جهاز ",
"transferDetails" : "تفاصيل النقل" ,
"senderDetails" : "تفاصيل المرسل",
"receiverDetails" : "تفاصيل المستقبل",
"assetDetails" : "تفاصيل الجهاز",
"searchBy" : "إبحث بـ",
"searchByDesc" : "إبحث بأي من المعايير التالية",
"location" : "الموقع",

@ -276,6 +276,13 @@
"receiverDetails" : "Receiver Details",
"requestedThrough" : "Requested Through",
"typeOfRequest" : "Type of Request",
"deviceTransfer" : "Device Transfer",
"deviceTransferRequest" : "Device Transfer Request",
"deviceTransferDetails" : "Device Transfer Details",
"transferDetails" : "Transfer Details" ,
"senderDetails" :"Sender Details",
"receiverDetails" :"Receiver Details",
"typeOfRequest" : "Type of Request",
"searchBy" : "Search by",
"searchByDesc" : "Search by any of the following criteria",
"location" : "Location",

@ -39,6 +39,32 @@ class AssetTransfer {
this.receiverTravelingHours,
this.receiverEngSignature,
this.receiverAttachments,
this.assetNumber,
this.assetName,
this.manufacturerName,
this.modelName,
this.assetSerialNo,
this.destDepartmentName,
this.destBuildingName,
this.applied,
this.createdOn,
this.destFloorName,
this.destSiteName,
this.manufacturerId,
this.modelId,
this.modifiedOn,
this.receiverAssignedEmployeeName,
this.receiverEngSignatureUrl,
this.receiverMachineStatusName,
this.senderAssignedEmployeeName,
this.senderBuildingName,
this.senderDepartmentName,
this.senderEngSignatureUrl,
this.senderFloorName,
this.senderMachineStatusName,
this.senderSiteName,
this.supplierId,
this.supplierName
});
AssetTransfer.fromJson(dynamic json) {
@ -84,11 +110,44 @@ class AssetTransfer {
receiverAttachments.add(AssetTransferAttachment.fromJson(v));
});
}
assetNumber= json['assetNumber'];
assetName= json['assetName'];
manufacturerName= json['manufacturerName'];
modelName= json['modelName'];
assetSerialNo= json['assetSerialNo'];
destDepartmentName= json['destDepartmentName'];
destBuildingName= json['destBuildingName'];
applied= json['applied'];
createdOn= json['createdOn'];
destFloorName= json['destFloorName'];
destSiteName= json['destSiteName'];
manufacturerId= json['manufacturerId'];
modelId= json['modelId'];
modifiedOn= json['modifiedOn'];
receiverAssignedEmployeeName= json['receiverAssignedEmployeeName'];
receiverEngSignatureUrl= json['receiverEngSignatureUrl'];
receiverMachineStatusName= json['receiverMachineStatusName'];
senderAssignedEmployeeName= json['senderAssignedEmployeeName'];
senderBuildingName= json['senderBuildingName'];
senderDepartmentName= json['senderDepartmentName'];
senderEngSignatureUrl= json['senderEngSignatureUrl'];
senderFloorName= json['senderFloorName'];
senderMachineStatusName= json['senderMachineStatusName'];
senderSiteName= json['senderSiteName'];
supplierId= json['supplierId'];
supplierName= json['supplierName'];
}
num id;
num transferNo;
String transferCode;
String assetSerialNo;
num assetId;
String assetNumber;
String assetName;
int modelId;
String modelName;
int manufacturerId;
String manufacturerName;
num destSiteId;
num destBuildingId;
num destFloorId;
@ -117,6 +176,26 @@ class AssetTransfer {
String receiverTravelingHours;
String receiverEngSignature;
List<AssetTransferAttachment> receiverAttachments;
num supplierId;
String supplierName;
String destSiteName;
String destBuildingName;
String destFloorName;
String destDepartmentName;
String senderSiteName;
String senderBuildingName;
String senderFloorName;
String senderDepartmentName;
String senderAssignedEmployeeName;
String senderMachineStatusName;
String senderEngSignatureUrl;
String receiverAssignedEmployeeName;
String receiverMachineStatusName;
String receiverEngSignatureUrl;
bool applied;
String createdOn;
String modifiedOn;
AssetTransfer copyWith({
num id,
num transferNo,
@ -150,6 +229,33 @@ class AssetTransfer {
String receiverTravelingHours,
String receiverEngSignature,
List<AssetTransferAttachment> receiverAttachments,
num supplierId,
String supplierName,
String destSiteName,
String destBuildingName,
String destFloorName,
String destDepartmentNam,
String senderSiteName,
String senderBuildingName,
String senderFloorName,
String senderDepartmentName,
String senderAssignedEmployeeName,
String senderMachineStatusName,
String senderEngSignatureUrl,
String receiverAssignedEmployeeName,
String receiverMachineStatusName,
String receiverEngSignatureUrl,
bool applied,
String createdOn,
String modifiedOn,
String assetSerialNo,
String assetNumber,
String assetName,
int modelId,
String modelName,
int manufacturerId,
String manufacturerName,
String destDepartmentName
}) =>
AssetTransfer(
id: id ?? this.id,
@ -184,6 +290,32 @@ class AssetTransfer {
receiverTravelingHours: receiverTravelingHours ?? this.receiverTravelingHours,
receiverEngSignature: receiverEngSignature ?? this.receiverEngSignature,
receiverAttachments: receiverAttachments ?? this.receiverAttachments,
supplierId : supplierId?? this.supplierId,
supplierName: supplierName??this.supplierName,
destSiteName: destSiteName??this.destSiteName,
destBuildingName: destBuildingName?? this.destBuildingName,
destFloorName: destFloorName??this.destFloorName,
destDepartmentName: destDepartmentName?? this.destDepartmentName,
senderSiteName: senderSiteName??this.senderSiteName,
senderBuildingName: senderBuildingName??this.senderBuildingName,
senderFloorName: senderFloorName??this.senderFloorName,
senderDepartmentName: senderDepartmentName??this.senderDepartmentName,
senderAssignedEmployeeName: senderAssignedEmployeeName??this.senderAssignedEmployeeName,
senderMachineStatusName: senderMachineStatusName??this.senderMachineStatusName,
senderEngSignatureUrl: senderEngSignatureUrl??this.senderEngSignatureUrl,
receiverAssignedEmployeeName: receiverAssignedEmployeeName?? this.receiverAssignedEmployeeName,
receiverMachineStatusName: receiverMachineStatusName??this.receiverMachineStatusName,
receiverEngSignatureUrl: receiverEngSignatureUrl??this.receiverEngSignatureUrl,
applied: applied??this.applied,
createdOn: createdOn?? this.createdOn,
modifiedOn: modifiedOn??this.modifiedOn,
assetSerialNo:assetSerialNo??this.assetSerialNo,
assetNumber:assetNumber??this.assetNumber,
assetName:assetName??this.assetName,
modelId:modelId??this.modelId,
modelName:modelName??this.modelName,
manufacturerId:manufacturerId??this.manufacturerId,
manufacturerName:manufacturerName??this.manufacturerName
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
@ -223,6 +355,32 @@ class AssetTransfer {
if (receiverAttachments != null) {
map['receiverAttachments'] = receiverAttachments.map((v) => v.toJson()).toList();
}
map["supplierId"] = supplierId;
map["supplierName"] =supplierName;
map["destSiteName"] =destSiteName;
map["destBuildingName"] =destBuildingName;
map["destFloorName"] =destFloorName;
map["destDepartmentName"] =destDepartmentName;
map["senderSiteName"] =senderSiteName;
map["senderBuildingName"] = senderBuildingName;
map["senderFloorName"] = senderFloorName;
map["senderDepartmentName"] = senderDepartmentName;
map["senderAssignedEmployeeName"] = senderAssignedEmployeeName;
map["senderMachineStatusName"] = senderMachineStatusName;
map["senderEngSignatureUrl"] = senderEngSignatureUrl;
map["receiverAssignedEmployeeName"] = receiverAssignedEmployeeName;
map["receiverMachineStatusName"] = receiverMachineStatusName;
map["receiverEngSignatureUrl"] = receiverEngSignatureUrl;
map["applied"] = applied;
map["createdOn"] = createdOn;
map["modifiedOn"] = modifiedOn;
map["assetSerialNo"] =assetSerialNo;
map["assetNumber"] =assetNumber;
map["assetName"] =assetName;
map["modelId"] =modelId;
map["modelName"] =modelName;
map["manufacturerId"] =manufacturerId;
map["manufacturerName"] =manufacturerName;
return map;
}

@ -1,19 +1,28 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
import 'package:test_sa/controllers/providers/api/user_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/widget_extensions.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart';
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
import 'package:test_sa/views/widgets/buttons/app_small_button.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/requests/info_row.dart';
import '../../../extensions/text_extensions.dart';
import '../../../models/enums/user_types.dart';
import '../../../new_views/app_style/app_color.dart';
import '../../../new_views/common_widgets/default_app_bar.dart';
import '../../widgets/requests/request_status.dart';
class DeviceTransferDetails extends StatefulWidget {
final AssetTransfer model;
@ -26,8 +35,6 @@ class DeviceTransferDetails extends StatefulWidget {
class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
AssetTransfer _model;
bool _isSender = false;
bool _isReceiver = false;
UserProvider _userProvider;
bool _isLoading = false;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -46,6 +53,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: DefaultAppBar(title: context.translation.deviceTransferDetails),
key: _scaffoldKey,
body: SafeArea(
child: FutureBuilder(
@ -55,8 +63,6 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
return const ALoading();
} else {
_userProvider = Provider.of<UserProvider>(context);
// _isSender = _userProvider.user.userID == _model.sender?.userId;
// _isReceiver = _userProvider.user.userID == _model.receiver?.userId;
return Form(
key: _formKey,
child: LoadingManager(
@ -66,129 +72,74 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
onRefresh: () async {},
child: Column(
children: [
Container(
color: Theme.of(context).colorScheme.primary,
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
const ABackButton(),
Expanded(
child: Center(
child: Text(
context.translation.details,
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
),
),
),
const SizedBox(width: 58),
],
),
),
Expanded(
child: SingleChildScrollView(
padding: EdgeInsets.all(16 * AppStyle.getScaleFactor(context)),
child: Column(
_buildDetailsCard(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RequestInfoRow(
title: "Transfer Id",
info: "_model.title?.toString()",
),
RequestInfoRow(
title: context.translation.assetName,
info: "_model.device.assetName",
),
RequestInfoRow(
title: context.translation.assetSN,
info: "_model.device.serialNumber",
),
RequestInfoRow(
title: context.translation.assetNumber,
info: "_model.device.number",
),
RequestInfoRow(
title: context.translation.destinationSite,
info: "_model.device.destSiteName",
),
RequestInfoRow(
title: context.translation.building,
info: " _model.device.destBuildingName",
),
RequestInfoRow(
title: context.translation.floor,
info: "_model.device.destFloor",
),
RequestInfoRow(
title: context.translation.department,
info: "_model.device.destDepartmentName",
),
RequestInfoRow(
title: context.translation.room,
info: "_model.device.destRoom",
),
RequestInfoRow(
title: context.translation.actions,
info: "",
),
const SizedBox(height: 8),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text("Sender", style: Theme.of(context).textTheme.headline6),
Row(
children: [
/// TBD
StatusLabel(
label: "",
id: 0,
textColor: AColors.getPriorityStatusTextColor(0),
backgroundColor: AColors.getPriorityStatusColor(0)),
8.width,
/// TBD
StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
],
),
if (_userProvider.user?.type == UsersTypes.engineer)
ASmallButton(
text: context.translation.edit,
// onPressed: (_isSender)
// ? (_model.sender.status?.name == "Closed"
// ? null
// : () {
// Navigator.of(context).push(MaterialPageRoute(
// builder: (_) => UpdateDeviceTransfer(
// model: _model,
// isSender: true,
// )));
// })
// : null,
),
1.width.expanded,
Text(widget.model.createdOn != null ?widget.model.createdOn.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
const SizedBox(height: 12),
// DeviceTransferInfoSection(
// info: _model.sender,
// isSender: true,
// ),
const SizedBox(height: 8),
Row(
8.height,
Text(context.translation.transferDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text("Receiver", style: Theme.of(context).textTheme.headline6),
),
if (_userProvider.user?.type == UsersTypes.engineer)
ASmallButton(
text: context.translation.edit,
// onPressed: (_isReceiver)
// ? (_model.receiver.status?.name == "Closed"
// ? null
// : () {
// Navigator.of(context).push(MaterialPageRoute(
// builder: (_) => UpdateDeviceTransfer(
// model: _model,
// isSender: false,
// )));
// })
// : null,
),
_buildTextWidget('${context.translation.assetName} : ${_model.assetName}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model.assetNumber}'),
_buildTextWidget('${context.translation.model} : ${_model.modelName}'),
_buildTextWidget('${context.translation.sn} : ${_model.assetSerialNo}'),
],
),
const SizedBox(height: 12),
// DeviceTransferInfoSection(
// info: _model.receiver,
// isSender: false,
// ),
8.height,
],
),
),
).paddingAll(14)
),
// sender card
_buildCard(
isSender: true,
site: _model.senderSiteName??"",
/// TBD
unit: _model.senderDepartmentName??"",
comment: _model.senderComment??"",
/// TBD
statusLabel: StatusLabel(
label: _model.senderMachineStatusName??"",
id: _model.senderMachineStatusId,
textColor: AColors.getRequestStatusTextColor(_model.senderMachineStatusId),
backgroundColor: AColors.getRequestStatusColor(_model.senderMachineStatusId)),
),
// receiver card
_buildCard(
isSender: false,
site: _model.destSiteName??"",
/// TBD
unit: _model.destDepartmentName??"",
comment: _model.receiverComment??"",
/// TBD
statusLabel: StatusLabel(
label: _model.receiverMachineStatusName??"",
id: _model.receiverMachineStatusId,
textColor: AColors.getRequestStatusTextColor(_model.receiverMachineStatusId),
backgroundColor: AColors.getRequestStatusColor(_model.receiverMachineStatusId)),
),
],
),
@ -200,4 +151,93 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
),
);
}
_buildDetailsCard(Widget widget){
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
child: widget,
).paddingOnly(top: 14, start: 14, end: 14);
}
_buildTextWidget(String text){
return Text(
text, style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
);
}
_buildCard({@required String site, @required String unit, @required String comment, @required bool isSender, StatusLabel statusLabel}){
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
statusLabel??Container(),
8.height,
Text(isSender?context.translation.senderDetails:context.translation.receiverDetails,
style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
],
),
if (_userProvider.user?.type == UsersTypes.engineer)
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.only(left: 3.0),
child: SvgPicture.asset('assets/images/update.svg'),
),
),
).onPress(
isSender ? _model.senderMachineStatusName == "Closed"
? null
: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => UpdateDeviceTransfer(
model: _model,
isSender: isSender,
)));
}
: _model.receiverMachineStatusName == "Closed"
? null
: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => UpdateDeviceTransfer(
model: _model,
isSender: isSender,
)));
}),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.site} : $site'),
_buildTextWidget('${context.translation.unite} : $unit'),
8.height,
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
8.height,
_buildTextWidget(comment),
],
),
8.height,
],
).paddingAll(14),
).paddingOnly(top: 14, start: 14, end: 14);
}
}

@ -3,11 +3,13 @@ import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
import 'package:test_sa/views/widgets/device_trancfer/device_transfer_list.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import '../../../new_views/common_widgets/default_app_bar.dart';
import '../../widgets/buttons/app_icon_button.dart';
class TrackDeviceTransferPage extends StatefulWidget {
@ -31,6 +33,7 @@ class _TrackDeviceTransferPageState extends State<TrackDeviceTransferPage> with
_settingProvider = Provider.of<SettingProvider>(context);
return Scaffold(
appBar: DefaultAppBar(title: context.translation.deviceTransfer),
body: SafeArea(
child: LoadingManager(
isLoading: _deviceTransferProvider.isLoading,
@ -47,52 +50,6 @@ class _TrackDeviceTransferPageState extends State<TrackDeviceTransferPage> with
children: [
Column(
children: [
Container(
color: AColors.primaryColor,
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Column(
children: [
Row(
children: [
const ABackButton(),
Expanded(
child: Center(
child: Text(
"Asset Transfer",
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
),
),
),
AIconButton(
iconData: Icons.search,
color: AColors.secondaryColor,
buttonSize: 42,
backgroundColor: AColors.white,
onPressed: () async {
// DeviceTransferSearch temp = await showModalBottomSheet(
// context: context,
// isScrollControlled: true,
// builder: (context) {
// return AssetTransferSearchDialog(initialSearchValue: _deviceTransferProvider.deviceTransferSearch);
// },
// );
// if (temp != null) {
// _deviceTransferProvider.deviceTransferSearch = temp;
// _deviceTransferProvider.reset();
// setState(() {});
// await _deviceTransferProvider.getRequests(
// user: _userProvider.user,
// host: _settingProvider.host,
// );
// }
},
),
const SizedBox(width: 16),
],
),
],
),
),
Expanded(
child: DeviceTransferList(
nextPage: _deviceTransferProvider.nextPage,

@ -7,12 +7,14 @@ import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/subtitle.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/buttons/app_button.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
import '../../../../controllers/localization/localization.dart';
import '../../../new_views/common_widgets/default_app_bar.dart';
class UpdateDeviceTransfer extends StatefulWidget {
final AssetTransfer model;
@ -90,133 +92,120 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
_settingProvider = Provider.of<SettingProvider>(context);
_deviceTransferProvider = Provider.of<AssetTransferProvider>(context, listen: false);
return Scaffold(
appBar: DefaultAppBar(title: context.translation.updateRequest),
key: _scaffoldKey,
body: Form(
key: _formKey,
child: SafeArea(
child: LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: SingleChildScrollView(
padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Edit Transfer Asset",
style: Theme.of(context).textTheme.headline5.copyWith(color: Theme.of(context).primaryColor, fontSize: 28, fontWeight: FontWeight.bold),
),
body: SafeArea(
child: LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SingleChildScrollView(
padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle("Comment"),
const SizedBox(
height: 4,
),
),
const SizedBox(
height: 8,
),
ASubTitle("Comment"),
const SizedBox(
height: 4,
),
// ATextFormField(
// initialValue: _formModel?.comment,
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.subtitle1,
// textInputType: TextInputType.text,
// onSaved: (value) {
// _formModel.comment = value;
// },
// ),
const SizedBox(
height: 8,
),
ASubTitle(context.translation.travelingHours),
const SizedBox(
height: 4,
),
// ATextFormField(
// initialValue: _formModel?.travelingHours,
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.subtitle1,
// textInputType: TextInputType.number,
// onSaved: (value) {
// _formModel.travelingHours = value;
// },
// ),
const SizedBox(
height: 16,
),
ASubTitle(context.translation.workingHours),
const SizedBox(height: 8),
Row(
children: [
// Expanded(
// child: AppTimer(
// timer: _formModel.timer,
// onChange: (timer) async {
// _formModel.timer = timer;
// _formModel.workingHours = (((timer?.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2) ?? "0";
// return true;
// },
// ),
// ),
],
),
const SizedBox(height: 16),
ASubTitle(context.translation.status),
const SizedBox(
height: 4,
),
// AssetStatusMenu(
// initialValue: _formModel.status,
// onSelect: (status) {
// if (status == null) return;
// _formModel.status = status;
// setState(() {});
// },
// ),
const SizedBox(
height: 16,
),
// MultiFilesPicker(
// label: "Attachments",
// files: _formModel.attachments,
// ),
const SizedBox(
height: 16,
),
const ASubTitle("Signature"),
// if(_validate && _formModel.signature == null)
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
const SizedBox(
height: 4,
),
// ESignature(
// oldSignature: widget.isSender ? widget.model.sender.engSignature : widget.model.receiver.engSignature,
// newSignature: _signature,
// onSaved: (signature) {
// _signature = signature;
// if (signature == null || signature.isEmpty) return;
// _formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
// // base64Encode(signature);
// },
// ),
Padding(
padding: const EdgeInsets.all(16.0),
child: AButton(
text: context.translation.update,
onPressed: _update,
// ATextFormField(
// initialValue: _formModel?.comment,
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.subtitle1,
// textInputType: TextInputType.text,
// onSaved: (value) {
// _formModel.comment = value;
// },
// ),
const SizedBox(
height: 8,
),
ASubTitle(context.translation.travelingHours),
const SizedBox(
height: 4,
),
// ATextFormField(
// initialValue: _formModel?.travelingHours,
// textAlign: TextAlign.center,
// style: Theme.of(context).textTheme.subtitle1,
// textInputType: TextInputType.number,
// onSaved: (value) {
// _formModel.travelingHours = value;
// },
// ),
const SizedBox(
height: 16,
),
ASubTitle(context.translation.workingHours),
const SizedBox(height: 8),
Row(
children: [
// Expanded(
// child: AppTimer(
// timer: _formModel.timer,
// onChange: (timer) async {
// _formModel.timer = timer;
// _formModel.workingHours = (((timer?.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2) ?? "0";
// return true;
// },
// ),
// ),
],
),
const SizedBox(height: 16),
ASubTitle(context.translation.status),
const SizedBox(
height: 4,
),
),
const SizedBox(
height: 100,
)
],
// AssetStatusMenu(
// initialValue: _formModel.status,
// onSelect: (status) {
// if (status == null) return;
// _formModel.status = status;
// setState(() {});
// },
// ),
const SizedBox(
height: 16,
),
// MultiFilesPicker(
// label: "Attachments",
// files: _formModel.attachments,
// ),
const SizedBox(
height: 16,
),
const ASubTitle("Signature"),
// if(_validate && _formModel.signature == null)
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
const SizedBox(
height: 4,
),
// ESignature(
// oldSignature: widget.isSender ? widget.model.sender.engSignature : widget.model.receiver.engSignature,
// newSignature: _signature,
// onSaved: (signature) {
// _signature = signature;
// if (signature == null || signature.isEmpty) return;
// _formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
// // base64Encode(signature);
// },
// ),
],
),
),
Padding(
padding: const EdgeInsets.all(16.0),
child: AppFilledButton(
label: context.translation.update,
onPressed: _update,
),
),
),
],
),
),
),

@ -13,6 +13,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/timer_model.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/app_text_form_field.dart';
import 'package:test_sa/views/widgets/buttons/app_button.dart';
@ -199,11 +200,11 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
child: Column(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SingleChildScrollView(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
@ -278,13 +279,13 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
},
),
],
).paddingAll(16),
AButton(
text: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
onPressed:()async{_onSubmit.call(context);},
).paddingAll(16),
],
),
).paddingAll(16)
).expanded,
AppFilledButton(
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
onPressed:()async{_onSubmit.call(context);},
).paddingAll(16),
],
)
),
),

@ -1,13 +1,15 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/controllers/providers/api/user_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/widget_extensions.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/models/subtitle.dart';
import 'package:test_sa/models/user.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import '../../../extensions/text_extensions.dart';
import '../../app_style/colors.dart';
import '../requests/request_status.dart';
class DeviceTransferItem extends StatelessWidget {
final int index;
final AssetTransfer item;
@ -17,21 +19,18 @@ class DeviceTransferItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
User _user = Provider.of<UserProvider>(context, listen: false).user;
Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
backgroundColor: itemColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
style: ElevatedButton.styleFrom(
elevation: 0,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
),
),
//padding: EdgeInsets.symmetric(vertical: 8,horizontal: 8),
onPressed: () {
onPressed(item);
},
@ -39,115 +38,49 @@ class DeviceTransferItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// TBD
StatusLabel(
label: '',
id: 0,
textColor: AColors.getPriorityStatusTextColor(0),
backgroundColor: AColors.getPriorityStatusColor(0)),
8.width,
/// TBD
StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
1.width.expanded,
Text(item.createdOn != null ?item.createdOn.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
8.height,
Text(context.translation.deviceTransferRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
Text(
'${context.translation.from} : ${item.senderAssignedEmployeeName}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'${context.translation.to} : ${item.receiverAssignedEmployeeName}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
8.height,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
/*item.title ??*/ "-----",
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
),
Divider(
color: onItemColor,
),
Text(
/*item.asset?.number ??*/ "-----",
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
),
Divider(
color: onItemColor,
),
Text(
/*item.asset.assetName ??*/ "",
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
),
Divider(
color: onItemColor,
),
Row(
children: [
Expanded(
child: Text(
context.translation.from,
style: Theme.of(context).textTheme.subtitle2.copyWith(
color: onItemColor,
),
),
),
// StatusLabel(
// backgroundColor: AColors.getRequestStatusColor(item.sender.status?.id),
// label: item.sender.status?.name,
// )
],
),
//const SizedBox(height: 8,),
// Row(
// children: [
// Expanded(
// child: Text(
// item.sender.client.name,
// style: Theme.of(context).textTheme.subtitle2.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// ],
// ),
// if (item.sender.department.id != null)
// Text(
// item.sender.department.name,
// style: Theme.of(context).textTheme.bodySmall.copyWith(
// color: onItemColor,
// ),
// ),
Divider(
color: onItemColor,
),
// Row(
// children: [
// Expanded(
// child: Text(
// context.translation.to,
// style: Theme.of(context).textTheme.subtitle2.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// StatusLabel(
// backgroundColor: AColors.getRequestStatusColor(item.receiver.status?.id),
// label: item.receiver.status?.name,
// )
// ],
// ),
// //const SizedBox(height: 8,),
// Row(
// children: [
// Expanded(
// child: Text(
// item.receiver.client.name,
// style: Theme.of(context).textTheme.subtitle2.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// ],
// ),
// if (item.receiver.department.id != null)
// Text(
// item.receiver.department.name,
// style: Theme.of(context).textTheme.bodySmall.copyWith(
// color: onItemColor,
// ),
// ),
//Divider(color: onItemColor,),
],
),
Text(
'View Details',
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
),
],
),
)
),
);
}

Loading…
Cancel
Save