some edits

pull/2/head
nextwo 2 years ago
parent 3737c3b41c
commit 44654e1e38

@ -115,13 +115,13 @@ class HospitalsProvider extends ChangeNotifier {
}
}
Future<List<Hospital>> getHospitalsListByVal({String searchVal=""}) async {
Future<List<Hospital>> getHospitalsListByVal({String searchVal = ""}) async {
Response response;
try {
if(searchVal.isNotEmpty) {
if (searchVal.isNotEmpty) {
searchVal = "?searchText=$searchVal";
}
response = await ApiManager.instance.get(URLs.getHospitalsAutoComplete+searchVal);
response = await ApiManager.instance.get(URLs.getHospitalsAutoComplete + searchVal);
// response = await get(
// Uri.parse(host + URLs.getHospitals
// + ( title == null || title.isEmpty ? "" : "?name=$title" )),

@ -57,7 +57,7 @@ class ServiceReportLastCallsProvider extends ChangeNotifier {
try {
// todo request new api from backend to make filter work
response = await ApiManager.instance.get(
"${URLs.getServiceReportLastCalls}?parentWOId=${woId??id}&isAdd=true&id=${id ?? 0}&typeTransaction=$typeName",
"${URLs.getServiceReportLastCalls}?parentWOId=${woId ?? id}&isAdd=true&id=${id ?? 0}&typeTransaction=$typeName",
);
// response = await get(
// Uri.parse(

@ -34,21 +34,21 @@ class Device {
factory Device.fromJson(Map<String, dynamic> parsedJson) {
return Device(
id: parsedJson["id"],
serialNumber: parsedJson["assetSerialNo"],
number: parsedJson["assetNumber"],
modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]),
hospital: Hospital.fromJson(parsedJson["site"]),
destBuildingName: parsedJson["destBuildingName"],
destDepartmentName: parsedJson["destDepartmentName"],
destRoom: parsedJson["destRoom"],
destFloor: parsedJson["destFloor"],
destSiteName:parsedJson['destSiteName']
// parsedJson["modelDefinition"] == null ? "" :
// parsedJson["modelDefinition"]["manufacturerName"],
// model: parsedJson["modelDefinition"] == null ? "" :
// parsedJson["modelDefinition"]["modelName"],
);
id: parsedJson["id"],
serialNumber: parsedJson["assetSerialNo"],
number: parsedJson["assetNumber"],
modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]),
hospital: Hospital.fromJson(parsedJson["site"]),
destBuildingName: parsedJson["destBuildingName"],
destDepartmentName: parsedJson["destDepartmentName"],
destRoom: parsedJson["destRoom"],
destFloor: parsedJson["destFloor"],
destSiteName: parsedJson['destSiteName']
// parsedJson["modelDefinition"] == null ? "" :
// parsedJson["modelDefinition"]["manufacturerName"],
// model: parsedJson["modelDefinition"] == null ? "" :
// parsedJson["modelDefinition"]["modelName"],
);
}
factory Device.fromDevice(Device device) {

@ -8,9 +8,9 @@ class Engineer {
});
factory Engineer.fromJson(Map<String, dynamic> parsedJson) {
if(parsedJson==null) return Engineer();
if (parsedJson == null) return Engineer();
return Engineer(
id: parsedJson["userId"] ?? parsedJson["id"],
id: parsedJson["userId"] ?? parsedJson["id"],
name: parsedJson["userName"] ?? parsedJson["name"],
);
}

@ -1,9 +1,10 @@
class FaultDescription {
FaultDescription({
this.id,
this.defectName,
this.workPerformed,
this.estimatedTime,});
this.id,
this.defectName,
this.workPerformed,
this.estimatedTime,
});
FaultDescription.fromJson(dynamic json) {
id = json['id'];
@ -15,15 +16,18 @@ class FaultDescription {
String defectName;
String workPerformed;
String estimatedTime;
FaultDescription copyWith({ num id,
String defectName,
String workPerformed,
String estimatedTime,
}) => FaultDescription( id: id ?? this.id,
defectName: defectName ?? this.defectName,
workPerformed: workPerformed ?? this.workPerformed,
estimatedTime: estimatedTime ?? this.estimatedTime,
);
FaultDescription copyWith({
num id,
String defectName,
String workPerformed,
String estimatedTime,
}) =>
FaultDescription(
id: id ?? this.id,
defectName: defectName ?? this.defectName,
workPerformed: workPerformed ?? this.workPerformed,
estimatedTime: estimatedTime ?? this.estimatedTime,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
@ -32,5 +36,4 @@ FaultDescription copyWith({ num id,
map['estimatedTime'] = estimatedTime;
return map;
}
}
}

@ -237,7 +237,6 @@ class Subtitle {
String room;
String actions;
void setIssues(List<String> issues) {
issues.clear();
issues.add(reason1);

@ -245,7 +245,7 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
departments: _deviceTransferProvider?.floor?.departments,
onSelect: (status) {
_deviceTransferProvider.department = status;
_formModel.receiver.department = Department(id: status.id, name: status.name) ;
_formModel.receiver.department = Department(id: status.id, name: status.name);
setState(() {});
},
),
@ -261,7 +261,7 @@ class _RequestDeviceTransferState extends State<RequestDeviceTransfer> {
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
textInputType: TextInputType.number,
onSaved: (value) {
_deviceTransferProvider.room=value;
_deviceTransferProvider.room = value;
},
),
12.height,

@ -115,14 +115,13 @@ class _LoginState extends State<Login> {
host: _settingProvider.host,
);
if (status >= 200 && status < 300) {
if(_userProvider.user.isAuthenticated ?? false) {
if (_userProvider.user.isAuthenticated ?? false) {
_settingProvider.setUser(_userProvider.user);
Navigator.of(context).pushNamed(LandPage.id);
} else {
Fluttertoast.showToast(msg: _userProvider.user.message);
}
// if (_userProvider.user.isActive)
// else

@ -135,12 +135,10 @@ class _SearchSubWorkOrderPageState extends State<SearchSubWorkOrderPage> {
),
const SizedBox(height: 16),
HospitalAutoCompleteField(
initialValue:_site,
initialValue: _site,
onSearch: (value) {
_site = value.name;
setState(() {
});
setState(() {});
},
),
const SizedBox(height: 16),

@ -55,7 +55,9 @@ class _WorkOrderUpdateState extends State<WorkOrderUpdate> {
],
),
),
WorkOrderDetails(item: widget.item,)
WorkOrderDetails(
item: widget.item,
)
],
),
),

@ -212,14 +212,14 @@ class _LandPageState extends State<LandPage> {
Navigator.of(context).pushNamed(TrackDeviceTransferPage.id);
},
),
if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.normal_user)
LandPageItem(
text: "Search Work Order",
svgPath: "assets/images/sub_workorder_icon.svg",
onPressed: () {
Navigator.of(context).pushNamed(SearchSubWorkOrderPage.id);
},
),
if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.normal_user)
LandPageItem(
text: "Search Work Order",
svgPath: "assets/images/sub_workorder_icon.svg",
onPressed: () {
Navigator.of(context).pushNamed(SearchSubWorkOrderPage.id);
},
),
],
),
],

@ -104,7 +104,7 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
getRequestForWorkOrder();
}
_serviceReport.assetType = _assetTypeProvider.statuses?.firstWhere(
(element) => element.value == _callRequestForWorkOrder?.assetType,
(element) => element.value == _callRequestForWorkOrder?.assetType,
orElse: () => null,
);
_subtitle = AppLocalization.of(context).subtitle;
@ -158,15 +158,15 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
widget.request.deviceSerialNumber == null
? const SizedBox()
: ASubTitle(
"${_subtitle.deviceSN}: ${widget.request.deviceSerialNumber}",
font: 14,
),
"${_subtitle.deviceSN}: ${widget.request.deviceSerialNumber}",
font: 14,
),
Text(
"${_subtitle.customer}: ${widget.request.hospitalName}",
style: Theme.of(context).textTheme.subtitle1.copyWith(
fontWeight: FontWeight.bold,
fontSize: 12,
),
fontWeight: FontWeight.bold,
fontSize: 12,
),
textScaleFactor: AppStyle.getScaleFactor(context),
)
],
@ -226,9 +226,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle(_subtitle.visitDate),
_validate && _serviceReport.visitDate == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
Row(
children: [
@ -262,9 +262,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle(_subtitle.deviceSN),
_validate && _serviceReport.device?.id == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
AutoCompleteDeviceField(
hospitalId: widget.request.hospitalId,
@ -281,9 +281,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle(_subtitle.AssetType),
_validate && _serviceReport.assetType == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
const SizedBox(
height: 4,
@ -296,7 +296,7 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
_assetTypeProvider.reset();
await _assetTypeProvider.getTypes(user: _userProvider.user, host: _settingProvider.host);
_serviceReport?.assetType = _assetTypeProvider.statuses?.firstWhere(
(element) => element.value == _callRequestForWorkOrder.assetType,
(element) => element.value == _callRequestForWorkOrder.assetType,
orElse: () => null,
);
},
@ -327,9 +327,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle("Equipment Status"),
_validate && _serviceReport.equipmentStatus == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
const SizedBox(
height: 4,
@ -367,9 +367,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle(_subtitle.callLastSituation),
_validate && _serviceReport.callLastSituation == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
const SizedBox(height: 4),
ServiceReportLastCallsMenu(
@ -504,54 +504,54 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
_serviceReport.callLastSituation?.value != 12
? const SizedBox.shrink()
: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle(_subtitle.invoiceNumber),
const SizedBox(
height: 8,
),
ATextFormField(
initialValue: _serviceReport?.invoiceNumber,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1,
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
textInputType: TextInputType.number,
onSaved: (value) {
_serviceReport.invoiceNumber = value;
},
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle(_subtitle.invoiceNumber),
const SizedBox(
height: 8,
),
ATextFormField(
initialValue: _serviceReport?.invoiceNumber,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1,
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
textInputType: TextInputType.number,
onSaved: (value) {
_serviceReport.invoiceNumber = value;
},
),
],
),
),
],
),
),
const SizedBox(
width: 8,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle(_subtitle.invoiceCode),
const SizedBox(
height: 4,
width: 8,
),
ATextFormField(
initialValue: _serviceReport?.invoiceCode,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1,
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
textInputType: TextInputType.text,
onSaved: (value) {
_serviceReport.invoiceCode = value;
},
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ASubTitle(_subtitle.invoiceCode),
const SizedBox(
height: 4,
),
ATextFormField(
initialValue: _serviceReport?.invoiceCode,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.subtitle1,
validator: (value) => Validator.hasValue(value) ? null : _subtitle.requiredWord,
textInputType: TextInputType.text,
onSaved: (value) {
_serviceReport.invoiceCode = value;
},
),
],
),
),
],
),
),
],
),
// const SizedBox(height: 8,),
// Row(
@ -958,9 +958,9 @@ class _EditServiceReportState extends State<EditServiceReport> with TickerProvid
ASubTitle(_subtitle.partNumber),
_validate && _serviceReport.parts == null
? ASubTitle(
_subtitle.requiredWord,
color: Colors.red,
)
_subtitle.requiredWord,
color: Colors.red,
)
: const SizedBox.shrink(),
const SizedBox(
height: 4,

@ -31,8 +31,7 @@ class _FutureServiceReportState extends State<FutureServiceReport> {
_userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context);
Subtitle _subtitle = AppLocalization.of(context).subtitle;
ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: _subtitle)
;
ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: _subtitle);
return Scaffold(
body: FutureBuilder<ServiceReport>(
future: ServiceRequestsProvider().getSingleServiceReport(reportId: widget.workOrder.id, user: _userProvider.user, host: _settingProvider.host, subtitle: _subtitle),

@ -345,7 +345,7 @@ class RequestDetailsPage extends StatelessWidget {
title: _subtitle.visitDate,
info: workOrders[index].visitDate,
),
RequestInfoRow(title: _subtitle.assignedEmployee, info: workOrders[index].assignedEmployee?.name??""),
RequestInfoRow(title: _subtitle.assignedEmployee, info: workOrders[index].assignedEmployee?.name ?? ""),
RequestInfoRow(
title: _subtitle.assetSN,
info: workOrders[index].callRequest.asset.assetSerialNo,

@ -47,19 +47,19 @@ class VisitDetailsPage extends StatelessWidget {
),
),
if (_userProvider?.user?.type == UsersTypes.engineer)
AIconButton(
iconData: Icons.edit,
color: AColors.white,
buttonSize: 42,
backgroundColor: AColors.green,
onPressed: () async {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => EditPentry(
visit: visit,
pentry: visit.pentry,
)));
},
),
AIconButton(
iconData: Icons.edit,
color: AColors.white,
buttonSize: 42,
backgroundColor: AColors.green,
onPressed: () async {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => EditPentry(
visit: visit,
pentry: visit.pentry,
)));
},
),
SizedBox(width: 42)
],
),

@ -20,7 +20,7 @@ class ADateTimePicker extends StatelessWidget {
),
),
child: Text(
date == null ? "Pick Time" : date.toString().substring(0,date.toString().lastIndexOf(":")),
date == null ? "Pick Time" : date.toString().substring(0, date.toString().lastIndexOf(":")),
textScaleFactor: AppStyle.getScaleFactor(context),
),
onPressed: () async {

@ -106,7 +106,8 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
),
const SizedBox(
height: 8,
),ATextFormField(
),
ATextFormField(
hintText: _subtitle.searchBySn,
controller: snController,
style: Theme.of(context).textTheme.subtitle1,
@ -120,7 +121,6 @@ class _SingleDevicePickerState extends State<SingleDevicePicker> {
_searchableList.addAll(_devicesProvider.devices);
},
),
],
),
),

@ -44,10 +44,8 @@ class _SingleStatusMenuState extends State<FaultDescriptionMenu> {
@override
void initState() {
if (widget.initialStatus != null) {
final result = widget.statuses?.where((element) {
return element.id == widget.initialStatus.id;
});
if (result.isNotEmpty) _selectedStatus = result.first;

Loading…
Cancel
Save