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

merge-requests/27/head
zaid_daoud 1 year ago
commit e08fcc8b32

@ -143,33 +143,43 @@ class DeviceTransferProvider extends ChangeNotifier {
};
if(isSender){
body.addAll({
//"senderSiteId": newModel.client.id,
//"senderDepartmentId": newModel.department.id,
body.addAll(
{
"senderSiteId": newModel.client.id,
"senderDepartmentId": newModel.department.id,
"senderAssignedEmployeeId": newModel.userId,
"senderMachineStatusId": newModel.status.id,
"senderComment": newModel.comment,
"senderWorkingHours": newModel.workingHours,
"senderTravelingHours": newModel.travelingHours,
"senderAttachmentName": "${DateTime.now().toIso8601String()}.png|${newModel.signature}",
});
"senderAttachmentName": "${newModel.signature}.png",
}
);
}else{
body.addAll({
//"destSiteId": newModel.client.id,
//"destDepartmentId": newModel.department.id,
body.addAll(
{
"destSiteId": newModel.client.id,
"destDepartmentId": newModel.department.id,
"receiverAssignedEmployeeId": newModel.userId,
"receiverMachineStatusId": newModel.status.id,
"receiverMachineStatusId": newModel.status?.id??"",
"receiverComment": newModel.comment,
"receiverWorkingHours": newModel.workingHours,
"receiverTravelingHours": newModel.travelingHours,
"receiverAttachmentName": "${DateTime.now().toIso8601String()}.png|${newModel.signature}",
});
"receiverAttachmentName": "${newModel.signature}.png",
}
);
}
body.addAll(newModel.toJson(isSender));
Response response;
try{
response = await ApiManager.instance.put(URLs.updateDeviceTransfer, body: body);
response = await ApiManager.instance.put(
URLs.updateDeviceTransfer,
body: body
);
print(response.body);
print("${newModel.signature}.png");
// response = await post(
// Uri.parse("$host${URLs.updateDeviceTransfer}/$requestId"),
// body: body,

@ -67,7 +67,7 @@ class DevicesProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List equipmentListJson = json.decode(response.body)["data"];
_devices = equipmentListJson.map((device) => Device.fromJson(device)).toList();
_devices = equipmentListJson.map<Device>((device) => Device.fromJson(device)).toList();
}
_loading = false;
notifyListeners();

@ -182,7 +182,7 @@ class _LandPageState extends State<LandPage> {
// Navigator.of(context).pushNamed(PreventiveMaintenanceVisitsPage.id);
// },
// ),
if (_userProvider.user != null && _userProvider.user.type != UsersTypes.engineer)
if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.engineer)
LandPageItem(
text: "Request Gas Refill",
icon: FontAwesomeIcons.truckFast,

@ -33,7 +33,7 @@ class _SingleStatusMenuState extends State<SingleStatusMenu> {
} else {
_selectedStatus = null;
}
if (widget.initialStatus?.id != _selectedStatus?.id) {
if((widget.initialStatus?.id??"") != (_selectedStatus?.id??"")) {
widget.onSelect(_selectedStatus);
}
} else {

Loading…
Cancel
Save