latest code merge changes

merge-requests/22/head
Sikander Saleem 3 years ago
parent c5c96a4fce
commit 534aab3ceb

@ -0,0 +1,67 @@
class Lookup{
//old name label
final String name;
// old name key
final int value;
final int id;
const Lookup({
this.name,
this.value,
this.id,
});
@override
bool operator == (Object other) =>
identical(this, other) || other is Lookup &&
((value != null && value == other.value)
|| ( id != null && id == other.id )) ;
@override
int get hashCode => id?.hashCode ?? value?.hashCode;
toMap(){
return {
"id": id,
"name": name,
"value": value
};
}
factory Lookup.fromStatus(Lookup old){
if(old == null) return null;
return Lookup(
name: old.name,
id: old.id,
value: old.value,
);
}
factory Lookup.fromJson(Map<String,dynamic> parsedJson){
if(parsedJson == null) return null;
return Lookup(
name: parsedJson["name"],
id: parsedJson["id"],
value: parsedJson["value"],
);
}
// factory Lookup.fromJson(Map<String,dynamic> parsedJson){
// if(parsedJson["id"] == null && parsedJson["uid"] == null) return null;
// return Lookup(
// name: parsedJson["value"],
// id: parsedJson["id"] is int
// ? parsedJson["id"]
// : int.tryParse(parsedJson["id"] ?? parsedJson["uid"]),
// );
// }
// factory Lookup.fromIntIdJson(Map<String,dynamic> parsedJson){
// return Lookup(
// name: parsedJson["value"],
// id: parsedJson["id"],
// );
// }
}

@ -26,6 +26,7 @@ import 'package:test_sa/views/pages/device_transfer/request_device_transfer.dart
import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart'; import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart';
import 'package:test_sa/views/pages/user/gas_refill/request_gas_refill.dart'; import 'package:test_sa/views/pages/user/gas_refill/request_gas_refill.dart';
import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart'; import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart';
import 'package:test_sa/views/pages/user/notifications/notifications_page.dart';
import 'package:test_sa/views/pages/user/requests/create_request.dart'; import 'package:test_sa/views/pages/user/requests/create_request.dart';
import 'package:test_sa/views/pages/user/visits/regular_visits_page.dart'; import 'package:test_sa/views/pages/user/visits/regular_visits_page.dart';
import 'package:test_sa/views/widgets/buttons/app_back_button.dart'; import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
@ -284,7 +285,7 @@ class _LandPageState extends State<LandPage> {
), ),
12.width, 12.width,
Text( Text(
_userProvider.user.userName, _userProvider.user?.userName ?? "??",
style: Theme.of(context).textTheme.headline6.copyWith( style: Theme.of(context).textTheme.headline6.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),

@ -7,6 +7,7 @@ import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/models/device/device.dart'; import 'package:test_sa/models/device/device.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';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
class AutoCompleteDeviceField extends StatefulWidget { class AutoCompleteDeviceField extends StatefulWidget {
final Device initialValue; final Device initialValue;
final int hospitalId; final int hospitalId;

@ -6,6 +6,7 @@ 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';
import 'package:test_sa/views/widgets/equipment/single_device_picker.dart'; import 'package:test_sa/views/widgets/equipment/single_device_picker.dart';
class DeviceButton extends StatelessWidget { class DeviceButton extends StatelessWidget {
final Function(Device) onDevicePick; final Function(Device) onDevicePick;
final Device device; final Device device;
@ -59,14 +60,14 @@ class DeviceButton extends StatelessWidget {
color: Theme.of(context).textTheme.subtitle1.color, color: Theme.of(context).textTheme.subtitle1.color,
), ),
Text( Text(
"${_subtitle.brand} : " + device.brand, "${_subtitle.brand} : ${device.modelDefinition.manufacturerName}",
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.subtitle2,
), ),
Divider( Divider(
color: Theme.of(context).textTheme.subtitle1.color, color: Theme.of(context).textTheme.subtitle1.color,
), ),
Text( Text(
"${_subtitle.model} : " + device.model, "${_subtitle.model} : ${device.modelDefinition.modelName}",
style: Theme.of(context).textTheme.subtitle2, style: Theme.of(context).textTheme.subtitle2,
), ),
], ],

@ -12,7 +12,6 @@ class AutoCompletePartsField extends StatefulWidget {
final String initialValue; final String initialValue;
final bool clearAfterPick; final bool clearAfterPick;
final Function(Part) onPick; final Function(Part) onPick;
final bool clearAfterPick;
const AutoCompletePartsField({Key key, this.initialValue, this.onPick, this.clearAfterPick = true}) : super(key: key); const AutoCompletePartsField({Key key, this.initialValue, this.onPick, this.clearAfterPick = true}) : super(key: key);

@ -14,24 +14,20 @@ import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/buttons/app_small_button.dart'; import 'package:test_sa/views/widgets/buttons/app_small_button.dart';
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
import 'package:test_sa/views/widgets/status/employee/assigned_to_mune.dart'; import 'package:test_sa/views/widgets/status/employee/assigned_to_mune.dart';
import 'package:test_sa/views/widgets/hospitals/hospital_auto_complete_field.dart';
import 'package:flutter/material.dart';
import 'package:test_sa/views/widgets/status/employee/employee_mune.dart';
import '../app_text_form_field.dart';
class ServiceRequestsUpdateDialog extends StatefulWidget { class ServiceRequestsUpdateDialog extends StatefulWidget {
final ServiceRequest request; final ServiceRequest request;
const ServiceRequestsUpdateDialog({ const ServiceRequestsUpdateDialog({
Key key, this.request, Key key,
this.request,
}) : super(key: key); }) : super(key: key);
@override @override
State<ServiceRequestsUpdateDialog> createState() => _ServiceRequestsUpdateDialogState(); State<ServiceRequestsUpdateDialog> createState() => _ServiceRequestsUpdateDialogState();
} }
class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialog> class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialog> with TickerProviderStateMixin {
with TickerProviderStateMixin{
DateTime _dateTime; DateTime _dateTime;
Lookup _employee; Lookup _employee;
Subtitle _subtitle; Subtitle _subtitle;
@ -42,7 +38,7 @@ class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialo
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
_update() async { _update() async {
if(_dateTime == null && _employee == null){ if (_dateTime == null && _employee == null) {
Fluttertoast.showToast( Fluttertoast.showToast(
msg: _subtitle.noDateFound, msg: _subtitle.noDateFound,
); );
@ -59,13 +55,8 @@ class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialo
}, },
); );
int status = await _serviceRequestsProvider.updateDate( int status = await _serviceRequestsProvider.updateDate(
user: _userProvider.user, user: _userProvider.user, host: _settingProvider.host, request: widget.request, newDate: _dateTime?.toString()?.split(" ")?.first, employee: _employee);
host: _settingProvider.host, if (status == 200) Navigator.of(context).pop();
request: widget.request,
newDate: _dateTime?.toString()?.split(" ")?.first,
employee: _employee
);
if(status == 200) Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
Fluttertoast.showToast( Fluttertoast.showToast(
msg: HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle), msg: HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle),
@ -79,15 +70,15 @@ class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialo
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_subtitle = AppLocalization.of(context).subtitle; _subtitle = AppLocalization.of(context).subtitle;
_userProvider = Provider.of<UserProvider>(context,listen: false); _userProvider = Provider.of<UserProvider>(context, listen: false);
_settingProvider = Provider.of<SettingProvider>(context,listen: false); _settingProvider = Provider.of<SettingProvider>(context, listen: false);
_serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context,listen: false); _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context, listen: false);
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
SizedBox( SizedBox(
// height: MediaQuery.of(context).size.height / 1.2, // height: MediaQuery.of(context).size.height / 1.2,
child: Form( child: Form(
key: _formKey, key: _formKey,
child: Padding( child: Padding(
@ -99,18 +90,19 @@ class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialo
children: [ children: [
ASmallButton( ASmallButton(
text: _subtitle.cancel, text: _subtitle.cancel,
onPressed: (){ onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
), ),
ASmallButton( ASmallButton(
text: _subtitle.update, text: _subtitle.update,
onPressed: _update, onPressed: _update,
) )
], ],
), ),
SizedBox(height: 8.0 * AppStyle.getScaleFactor(context),), SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -123,21 +115,25 @@ class _ServiceRequestsUpdateDialogState extends State<ServiceRequestsUpdateDialo
ADatePicker( ADatePicker(
date: _dateTime, date: _dateTime,
from: DateTime.now(), from: DateTime.now(),
onDatePicker: (date){ onDatePicker: (date) {
_dateTime = date; _dateTime = date;
setState(() {}); setState(() {});
}, },
), ),
], ],
), ),
SizedBox(height: 8.0 * AppStyle.getScaleFactor(context),), SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
AssignedToMenu( AssignedToMenu(
initialValue: _employee, initialValue: _employee,
onSelect: (employee){ onSelect: (employee) {
_employee = employee; _employee = employee;
}, },
), ),
SizedBox(height: 8.0 * AppStyle.getScaleFactor(context),), SizedBox(
height: 8.0 * AppStyle.getScaleFactor(context),
),
], ],
), ),
), ),

@ -111,13 +111,13 @@ class VisitItem extends StatelessWidget {
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 14, fontWeight: FontWeight.bold), style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 14, fontWeight: FontWeight.bold),
), ),
), ),
Text( // Text(
visit.contactStatus ?? "", // visit.contactStatus ?? "",
style: Theme.of(context).textTheme.subtitle1.copyWith( // style: Theme.of(context).textTheme.subtitle1.copyWith(
color: onItemColor, // color: onItemColor,
fontSize: 14, // fontSize: 14,
), // ),
), // ),
], ],
), ),
Divider( Divider(
@ -162,13 +162,13 @@ class VisitItem extends StatelessWidget {
color: onItemColor, color: onItemColor,
fontSize: 14, fontSize: 14,
), ),
// Text( // Text(
// visit.contactStatus ?? "", // visit.contactStatus ?? "",
// style: Theme.of(context).textTheme.subtitle1.copyWith( // style: Theme.of(context).textTheme.subtitle1.copyWith(
// color: onItemColor, // color: onItemColor,
// fontSize: 14, // fontSize: 14,
// ), // ),
// ), // ),
), ),
], ],
), ),

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save