diff --git a/assets/subtitles/en_subtitle.json b/assets/subtitles/en_subtitle.json index d1412bf5..4b5352f9 100644 --- a/assets/subtitles/en_subtitle.json +++ b/assets/subtitles/en_subtitle.json @@ -73,7 +73,7 @@ "deviceImages": "Asset Images", "deviceModel": "Asset Model", "deviceRequired": "Asset Required", - "deviceSN": "Asset SN", + "deviceSN": "Asset Serial Number", "engineerName": "Engineer Name", "engineerPhone": "Engineer Phone", "facebook": "facebook", diff --git a/lib/models/visits/visits_search.dart b/lib/models/visits/visits_search.dart index ee5045b0..a18bfa11 100644 --- a/lib/models/visits/visits_search.dart +++ b/lib/models/visits/visits_search.dart @@ -3,6 +3,8 @@ import 'package:test_sa/models/lookup.dart'; class VisitsSearch { String deviceSerialNumber; + String deviceName; + String deviceNumber; Hospital hospital; String brand; Lookup model; @@ -25,6 +27,8 @@ class VisitsSearch { this.contactStatus, this.expectedDateFrom, this.expectedDateTo, + this.deviceNumber, + this.deviceName this.mostRecent, }); @@ -40,6 +44,8 @@ class VisitsSearch { expectedDateTo = newSearch.expectedDateTo; statusValue = newSearch.statusValue; mostRecent = newSearch.mostRecent; + deviceNumber=newSearch.deviceNumber; + deviceName=newSearch.deviceName; } Map toMap() { diff --git a/lib/views/pages/device_transfer/device_transfer_details.dart b/lib/views/pages/device_transfer/device_transfer_details.dart index 802b1e0c..22c33c99 100644 --- a/lib/views/pages/device_transfer/device_transfer_details.dart +++ b/lib/views/pages/device_transfer/device_transfer_details.dart @@ -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/settings/setting_provider.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/views/app_style/colors.dart'; import 'package:test_sa/views/app_style/sizing.dart'; @@ -32,8 +33,6 @@ class _DeviceTransferDetailsState extends State { bool _isSender = false; bool _isReceiver = false; UserProvider _userProvider; - SettingProvider _settingProvider; - DeviceTransferProvider _deviceTransferProvider; bool _isLoading = false; Subtitle _subtitle; final GlobalKey _formKey = GlobalKey(); @@ -46,9 +45,7 @@ class _DeviceTransferDetailsState extends State { } Future _getDeviceTransfer() async { - print("====== object"); _model = await Provider.of(context).getRequestById(assetTransferId: widget.model.id); - print("====== object2"); } @override @@ -57,12 +54,14 @@ class _DeviceTransferDetailsState extends State { key: _scaffoldKey, body: SafeArea( child: FutureBuilder( - future: _getDeviceTransfer(), + future: _getDeviceTransfer(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const ALoading(); } else { - _subtitle = AppLocalization.of(context).subtitle; + _subtitle = AppLocalization + .of(context) + .subtitle; _userProvider = Provider.of(context); _settingProvider = Provider.of(context); _deviceTransferProvider = Provider.of(context); @@ -78,7 +77,10 @@ class _DeviceTransferDetailsState extends State { child: Column( children: [ Container( - color: Theme.of(context).colorScheme.primary, + color: Theme + .of(context) + .colorScheme + .primary, padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4), child: Row( children: [ @@ -87,7 +89,11 @@ class _DeviceTransferDetailsState extends State { child: Center( child: Text( _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 { Row( children: [ 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) ASmallButton( text: _subtitle.edit, onPressed: (_isSender || _isReceiver || false) ? () { - Navigator.of(context).push(MaterialPageRoute( - builder: (_) => UpdateDeviceTransfer( - model: _model, - isSender: true, - ))); - } + Navigator.of(context).push(MaterialPageRoute( + builder: (_) => + UpdateDeviceTransfer( + model: _model, + isSender: true, + ))); + } : null, ), ], @@ -165,33 +175,38 @@ class _DeviceTransferDetailsState extends State { const SizedBox(height: 12), DeviceTransferInfoSection( info: _model.sender, + isSender: true, ), const SizedBox(height: 8), Row( children: [ 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) ASmallButton( text: _subtitle.edit, onPressed: (_isReceiver || false) - ? () async { - Navigator.of(context).push( - MaterialPageRoute( - builder: (_) => UpdateDeviceTransfer( - model: _model, - isSender: false, - ), - ), - ); - } + ? () { + Navigator.of(context).push(MaterialPageRoute( + builder: (_) => + UpdateDeviceTransfer( + model: _model, + isSender: false, + ))); + } : null, ), ], ), const SizedBox(height: 12), - DeviceTransferInfoSection(info: _model.receiver), + DeviceTransferInfoSection( + info: _model.receiver, + isSender: false, + ), ], ), ), @@ -201,8 +216,9 @@ class _DeviceTransferDetailsState extends State { ), ); } - }), - ), + } + ) + ) ); } } diff --git a/lib/views/pages/user/requests/request_details.dart b/lib/views/pages/user/requests/request_details.dart index 23bd5792..3ea9dfbf 100644 --- a/lib/views/pages/user/requests/request_details.dart +++ b/lib/views/pages/user/requests/request_details.dart @@ -186,7 +186,7 @@ class RequestDetailsPage extends StatelessWidget { padding: EdgeInsets.symmetric(horizontal: 16), children: [ RequestInfoRow( - title: _subtitle.code, + title: _subtitle.callId, info: serviceRequest.requestCode, ), RequestInfoRow( diff --git a/lib/views/pages/user/visits/visit_details.dart b/lib/views/pages/user/visits/visit_details.dart index d6635358..508b7665 100644 --- a/lib/views/pages/user/visits/visit_details.dart +++ b/lib/views/pages/user/visits/visit_details.dart @@ -73,21 +73,22 @@ class VisitDetailsPage extends StatelessWidget { ), MaterialButton( padding: EdgeInsets.zero, - onPressed: visit.images.isEmpty || (visit.images?.first?.isEmpty ?? false) - ? () {} - : () { - Navigator.of(context).push(MaterialPageRoute( - builder: (_) => Scaffold( - body: InteractiveViewer( - child: Center( - child: ImageLoader( - url: visit.images.first, - boxFit: BoxFit.contain, - ), - ), + onPressed:() { + if(visit.images.isEmpty || (visit.images?.first?.isEmpty ?? false)) { + Navigator.of(context).push(MaterialPageRoute( + builder: (_) => + Scaffold( + body: InteractiveViewer( + child: Center( + child: ImageLoader( + url: visit.images.first, + boxFit: BoxFit.contain, ), - ))); - }, + ), + ), + ))); + } + }, child: SizedBox( height: 140 * AppStyle.getScaleFactor(context), width: MediaQuery.of(context).size.width, @@ -117,6 +118,10 @@ class VisitDetailsPage extends StatelessWidget { title: "Asset Number", info: visit.deviceNumber, ), + RequestInfoRow( + title: _subtitle.deviceName, + content: visit.deviceEnglishName, + ), RequestInfoRow( title: _subtitle.deviceSN, info: visit.deviceSerialNumber, @@ -158,10 +163,6 @@ class VisitDetailsPage extends StatelessWidget { title: _subtitle.hospital, content: visit.hospitalName, ), - RequestInfoRow( - title: _subtitle.deviceName, - content: visit.deviceEnglishName, - ), ], ), ), diff --git a/lib/views/widgets/device_trancfer/device_transfer_info_section.dart b/lib/views/widgets/device_trancfer/device_transfer_info_section.dart index ea699121..5420d504 100644 --- a/lib/views/widgets/device_trancfer/device_transfer_info_section.dart +++ b/lib/views/widgets/device_trancfer/device_transfer_info_section.dart @@ -11,8 +11,9 @@ import '../../../controllers/providers/api/user_provider.dart'; class DeviceTransferInfoSection extends StatelessWidget { final DeviceTransferInfo info; + final bool isSender; 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 Widget build(BuildContext context) { @@ -30,7 +31,7 @@ class DeviceTransferInfoSection extends StatelessWidget { info: info.department.name, ), RequestInfoRow( - title: subtitle.engineerName, + title: isSender? "Sender Name " : "Receiver Name", info: info.userName, ), RequestInfoRow( @@ -46,7 +47,7 @@ class DeviceTransferInfoSection extends StatelessWidget { info: info.comment, ), RequestInfoRow( - title: "Assigned FE", + title: "Assigned Engineer", info: info.assignedEmployeeName, ), RequestInfoRow( diff --git a/lib/views/widgets/requests/service_request_item.dart b/lib/views/widgets/requests/service_request_item.dart index 2580deef..0b650427 100644 --- a/lib/views/widgets/requests/service_request_item.dart +++ b/lib/views/widgets/requests/service_request_item.dart @@ -133,6 +133,13 @@ class ServiceRequestItem extends StatelessWidget { Divider( color: onItemColor, ), + Text( + request.deviceNumber, + style: Theme.of(context).textTheme.subtitle2.copyWith(color: onItemColor, fontSize: 12, fontWeight: FontWeight.normal), + ), + Divider( + color: onItemColor, + ), Row( children: [ Expanded( diff --git a/lib/views/widgets/search/service_request_search_bar.dart b/lib/views/widgets/search/service_request_search_bar.dart index 3ff29b7a..1a82b0a2 100644 --- a/lib/views/widgets/search/service_request_search_bar.dart +++ b/lib/views/widgets/search/service_request_search_bar.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:test_sa/controllers/localization/localization.dart'; import 'package:test_sa/models/lookup.dart'; @@ -69,7 +70,7 @@ class _ServiceRequestsSearchDialogState extends State with TickerProv 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( initialValue: _search.deviceSerialNumber, hintText: _subtitle.serialNumber, diff --git a/lib/views/widgets/visits/visit_item.dart b/lib/views/widgets/visits/visit_item.dart index e6ca6676..31d0e9d0 100644 --- a/lib/views/widgets/visits/visit_item.dart +++ b/lib/views/widgets/visits/visit_item.dart @@ -82,6 +82,16 @@ class VisitItem extends StatelessWidget { Divider( color: onItemColor, ), + Text( + visit.deviceNumber ?? "", + style: Theme.of(context).textTheme.subtitle1.copyWith( + color: onItemColor, + fontSize: 14, + ), + ), + Divider( + color: onItemColor, + ), Row( children: [ Expanded(