Merge remote-tracking branch 'origin/majd_development_new' into zaid_development_new

# Conflicts:
#	lib/models/visits/visits_search.dart
#	lib/views/pages/device_transfer/device_transfer_details.dart
#	lib/views/pages/user/visits/visit_details.dart
#	lib/views/widgets/search/service_request_search_bar.dart
#	lib/views/widgets/search/visits_search_bar.dart
main_design2.0
zaid_daoud 2 years ago
commit 460c3138fd

@ -73,7 +73,7 @@
"deviceImages": "Asset Images", "deviceImages": "Asset Images",
"deviceModel": "Asset Model", "deviceModel": "Asset Model",
"deviceRequired": "Asset Required", "deviceRequired": "Asset Required",
"deviceSN": "Asset SN", "deviceSN": "Asset Serial Number",
"engineerName": "Engineer Name", "engineerName": "Engineer Name",
"engineerPhone": "Engineer Phone", "engineerPhone": "Engineer Phone",
"facebook": "facebook", "facebook": "facebook",

@ -3,6 +3,8 @@ import 'package:test_sa/models/lookup.dart';
class VisitsSearch { class VisitsSearch {
String deviceSerialNumber; String deviceSerialNumber;
String deviceName;
String deviceNumber;
Hospital hospital; Hospital hospital;
String brand; String brand;
Lookup model; Lookup model;
@ -25,6 +27,8 @@ class VisitsSearch {
this.contactStatus, this.contactStatus,
this.expectedDateFrom, this.expectedDateFrom,
this.expectedDateTo, this.expectedDateTo,
this.deviceNumber,
this.deviceName
this.mostRecent, this.mostRecent,
}); });
@ -40,6 +44,8 @@ class VisitsSearch {
expectedDateTo = newSearch.expectedDateTo; expectedDateTo = newSearch.expectedDateTo;
statusValue = newSearch.statusValue; statusValue = newSearch.statusValue;
mostRecent = newSearch.mostRecent; mostRecent = newSearch.mostRecent;
deviceNumber=newSearch.deviceNumber;
deviceName=newSearch.deviceName;
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {

@ -5,6 +5,7 @@ import 'package:test_sa/controllers/providers/api/device_transfer_provider.dart'
import 'package:test_sa/controllers/providers/api/user_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/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/models/device/device_transfer.dart'; import 'package:test_sa/models/device/device_transfer.dart';
import 'package:test_sa/models/device/device_transfer_info.dart';
import 'package:test_sa/models/subtitle.dart'; import 'package:test_sa/models/subtitle.dart';
import 'package:test_sa/views/app_style/colors.dart'; import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart'; import 'package:test_sa/views/app_style/sizing.dart';
@ -32,8 +33,6 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
bool _isSender = false; bool _isSender = false;
bool _isReceiver = false; bool _isReceiver = false;
UserProvider _userProvider; UserProvider _userProvider;
SettingProvider _settingProvider;
DeviceTransferProvider _deviceTransferProvider;
bool _isLoading = false; bool _isLoading = false;
Subtitle _subtitle; Subtitle _subtitle;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -46,9 +45,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
} }
Future<void> _getDeviceTransfer() async { Future<void> _getDeviceTransfer() async {
print("====== object");
_model = await Provider.of<DeviceTransferProvider>(context).getRequestById(assetTransferId: widget.model.id); _model = await Provider.of<DeviceTransferProvider>(context).getRequestById(assetTransferId: widget.model.id);
print("====== object2");
} }
@override @override
@ -57,12 +54,14 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
key: _scaffoldKey, key: _scaffoldKey,
body: SafeArea( body: SafeArea(
child: FutureBuilder( child: FutureBuilder(
future: _getDeviceTransfer(), future: _getDeviceTransfer(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
return const ALoading(); return const ALoading();
} else { } else {
_subtitle = AppLocalization.of(context).subtitle; _subtitle = AppLocalization
.of(context)
.subtitle;
_userProvider = Provider.of<UserProvider>(context); _userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context); _settingProvider = Provider.of<SettingProvider>(context);
_deviceTransferProvider = Provider.of<DeviceTransferProvider>(context); _deviceTransferProvider = Provider.of<DeviceTransferProvider>(context);
@ -78,7 +77,10 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
child: Column( child: Column(
children: [ children: [
Container( Container(
color: Theme.of(context).colorScheme.primary, color: Theme
.of(context)
.colorScheme
.primary,
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row( child: Row(
children: [ children: [
@ -87,7 +89,11 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
child: Center( child: Center(
child: Text( child: Text(
_subtitle.details, _subtitle.details,
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic), style: Theme
.of(context)
.textTheme
.headline6
.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
), ),
), ),
), ),
@ -145,19 +151,23 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Text("Sender", style: Theme.of(context).textTheme.headline6), child: Text("Sender", style: Theme
.of(context)
.textTheme
.headline6),
), ),
if (_userProvider.user?.type == UsersTypes.engineer) if (_userProvider.user?.type == UsersTypes.engineer)
ASmallButton( ASmallButton(
text: _subtitle.edit, text: _subtitle.edit,
onPressed: (_isSender || _isReceiver || false) onPressed: (_isSender || _isReceiver || false)
? () { ? () {
Navigator.of(context).push(MaterialPageRoute( Navigator.of(context).push(MaterialPageRoute(
builder: (_) => UpdateDeviceTransfer( builder: (_) =>
model: _model, UpdateDeviceTransfer(
isSender: true, model: _model,
))); isSender: true,
} )));
}
: null, : null,
), ),
], ],
@ -165,33 +175,38 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
const SizedBox(height: 12), const SizedBox(height: 12),
DeviceTransferInfoSection( DeviceTransferInfoSection(
info: _model.sender, info: _model.sender,
isSender: true,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
Row( Row(
children: [ children: [
Expanded( Expanded(
child: Text("Receiver", style: Theme.of(context).textTheme.headline6), child: Text("Receiver", style: Theme
.of(context)
.textTheme
.headline6),
), ),
if (_userProvider.user?.type == UsersTypes.engineer) if (_userProvider.user?.type == UsersTypes.engineer)
ASmallButton( ASmallButton(
text: _subtitle.edit, text: _subtitle.edit,
onPressed: (_isReceiver || false) onPressed: (_isReceiver || false)
? () async { ? () {
Navigator.of(context).push( Navigator.of(context).push(MaterialPageRoute(
MaterialPageRoute( builder: (_) =>
builder: (_) => UpdateDeviceTransfer( UpdateDeviceTransfer(
model: _model, model: _model,
isSender: false, isSender: false,
), )));
), }
);
}
: null, : null,
), ),
], ],
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
DeviceTransferInfoSection(info: _model.receiver), DeviceTransferInfoSection(
info: _model.receiver,
isSender: false,
),
], ],
), ),
), ),
@ -201,8 +216,9 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
), ),
); );
} }
}), }
), )
)
); );
} }
} }

@ -186,7 +186,7 @@ class RequestDetailsPage extends StatelessWidget {
padding: EdgeInsets.symmetric(horizontal: 16), padding: EdgeInsets.symmetric(horizontal: 16),
children: [ children: [
RequestInfoRow( RequestInfoRow(
title: _subtitle.code, title: _subtitle.callId,
info: serviceRequest.requestCode, info: serviceRequest.requestCode,
), ),
RequestInfoRow( RequestInfoRow(

@ -73,21 +73,22 @@ class VisitDetailsPage extends StatelessWidget {
), ),
MaterialButton( MaterialButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
onPressed: visit.images.isEmpty || (visit.images?.first?.isEmpty ?? false) onPressed:() {
? () {} if(visit.images.isEmpty || (visit.images?.first?.isEmpty ?? false)) {
: () { Navigator.of(context).push(MaterialPageRoute(
Navigator.of(context).push(MaterialPageRoute( builder: (_) =>
builder: (_) => Scaffold( Scaffold(
body: InteractiveViewer( body: InteractiveViewer(
child: Center( child: Center(
child: ImageLoader( child: ImageLoader(
url: visit.images.first, url: visit.images.first,
boxFit: BoxFit.contain, boxFit: BoxFit.contain,
),
),
), ),
))); ),
}, ),
)));
}
},
child: SizedBox( child: SizedBox(
height: 140 * AppStyle.getScaleFactor(context), height: 140 * AppStyle.getScaleFactor(context),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
@ -117,6 +118,10 @@ class VisitDetailsPage extends StatelessWidget {
title: "Asset Number", title: "Asset Number",
info: visit.deviceNumber, info: visit.deviceNumber,
), ),
RequestInfoRow(
title: _subtitle.deviceName,
content: visit.deviceEnglishName,
),
RequestInfoRow( RequestInfoRow(
title: _subtitle.deviceSN, title: _subtitle.deviceSN,
info: visit.deviceSerialNumber, info: visit.deviceSerialNumber,
@ -158,10 +163,6 @@ class VisitDetailsPage extends StatelessWidget {
title: _subtitle.hospital, title: _subtitle.hospital,
content: visit.hospitalName, content: visit.hospitalName,
), ),
RequestInfoRow(
title: _subtitle.deviceName,
content: visit.deviceEnglishName,
),
], ],
), ),
), ),

@ -11,8 +11,9 @@ import '../../../controllers/providers/api/user_provider.dart';
class DeviceTransferInfoSection extends StatelessWidget { class DeviceTransferInfoSection extends StatelessWidget {
final DeviceTransferInfo info; final DeviceTransferInfo info;
final bool isSender;
final VoidCallback onEdit; final VoidCallback onEdit;
const DeviceTransferInfoSection({Key key, this.info, this.onEdit}) : super(key: key); const DeviceTransferInfoSection({Key key, this.info, this.onEdit, this.isSender}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -30,7 +31,7 @@ class DeviceTransferInfoSection extends StatelessWidget {
info: info.department.name, info: info.department.name,
), ),
RequestInfoRow( RequestInfoRow(
title: subtitle.engineerName, title: isSender? "Sender Name " : "Receiver Name",
info: info.userName, info: info.userName,
), ),
RequestInfoRow( RequestInfoRow(
@ -46,7 +47,7 @@ class DeviceTransferInfoSection extends StatelessWidget {
info: info.comment, info: info.comment,
), ),
RequestInfoRow( RequestInfoRow(
title: "Assigned FE", title: "Assigned Engineer",
info: info.assignedEmployeeName, info: info.assignedEmployeeName,
), ),
RequestInfoRow( RequestInfoRow(

@ -133,6 +133,13 @@ class ServiceRequestItem extends StatelessWidget {
Divider( Divider(
color: onItemColor, color: onItemColor,
), ),
Text(
request.deviceNumber,
style: Theme.of(context).textTheme.subtitle2.copyWith(color: onItemColor, fontSize: 12, fontWeight: FontWeight.normal),
),
Divider(
color: onItemColor,
),
Row( Row(
children: [ children: [
Expanded( Expanded(

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:test_sa/controllers/localization/localization.dart'; import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/lookup.dart';
@ -69,7 +70,7 @@ class _ServiceRequestsSearchDialogState extends State<ServiceRequestsSearchDialo
child: Padding( child: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child:Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
@ -116,6 +117,25 @@ class _ServiceRequestsSearchDialogState extends State<ServiceRequestsSearchDialo
SizedBox( SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context), height: 8.0 * AppStyle.getScaleFactor(context),
), ),
ATextFormField(
initialValue: _search.deviceNumber,
hintText: _subtitle.assetNumber,
style: Theme.of(context).textTheme.headline6,
textInputAction: TextInputAction.search,
onAction: () {
if (!_formKey.currentState.validate()) {
return;
}
_formKey.currentState.save();
Navigator.of(context).pop(_search);
},
onSaved: (value) {
_search.deviceNumber = value;
},
),
SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
ATextFormField( ATextFormField(
initialValue: _search.deviceSerialNumber, initialValue: _search.deviceSerialNumber,
hintText: _subtitle.serialNumber, hintText: _subtitle.serialNumber,
@ -187,7 +207,9 @@ class _ServiceRequestsSearchDialogState extends State<ServiceRequestsSearchDialo
height: 16 * AppStyle.getScaleFactor(context), height: 16 * AppStyle.getScaleFactor(context),
), ),
const ASubTitle("Status"), const ASubTitle("Status"),
const SizedBox(height: 4), const SizedBox(
height: 4,
),
ServiceRequestStatusMenu( ServiceRequestStatusMenu(
initialValue: _search.statusValue, initialValue: _search.statusValue,
onSelect: (status) { onSelect: (status) {

@ -97,6 +97,47 @@ class _VisitsSearchDialogState extends State<VisitsSearchDialog> with TickerProv
setState(() {}); setState(() {});
}, },
), ),
SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
ATextFormField(
initialValue: _search.deviceNumber,
hintText: _subtitle.assetNumber,
style: Theme.of(context).textTheme.headline6,
textInputAction: TextInputAction.search,
onAction: () {
if (!_formKey.currentState.validate()) {
return;
}
_formKey.currentState.save();
Navigator.of(context).pop(_search);
},
onSaved: (value) {
_search.deviceNumber = value;
},
),
SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
ATextFormField(
initialValue: _search.deviceName,
hintText: _subtitle.assetName,
style: Theme.of(context).textTheme.headline6,
textInputAction: TextInputAction.search,
onAction: () {
if (!_formKey.currentState.validate()) {
return;
}
_formKey.currentState.save();
Navigator.of(context).pop(_search);
},
onSaved: (value) {
_search.deviceName = value;
},
),
SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
ATextFormField( ATextFormField(
initialValue: _search.deviceSerialNumber, initialValue: _search.deviceSerialNumber,
hintText: _subtitle.serialNumber, hintText: _subtitle.serialNumber,

@ -82,6 +82,16 @@ class VisitItem extends StatelessWidget {
Divider( Divider(
color: onItemColor, color: onItemColor,
), ),
Text(
visit.deviceNumber ?? "",
style: Theme.of(context).textTheme.subtitle1.copyWith(
color: onItemColor,
fontSize: 14,
),
),
Divider(
color: onItemColor,
),
Row( Row(
children: [ children: [
Expanded( Expanded(

Loading…
Cancel
Save