Merge remote-tracking branch 'origin/design_3.0_TM_Module_bug_fixes' into design_3.0_TM_Module_bug_fixes

design_3.0_task_module_new
Sikander Saleem 6 months ago
commit 1900715559

@ -4,12 +4,12 @@ class URLs {
static const String appReleaseBuildNumber = "15";
// static const host1 = "https://atomsm.hmg.com"; // production url
// static const host1 = "https://atomsmdev.hmg.com"; // local DEV url
static const host1 = "https://atomsmuat.hmg.com"; // local UAT url
static const host1 = "https://atomsmdev.hmg.com"; // local DEV url
// static const host1 = "https://atomsmuat.hmg.com"; // local UAT url
// static String _baseUrl = "$_host/mobile";
// static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis
static final String _baseUrl = "$_host/mobile"; // host local UAT
static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis
// static final String _baseUrl = "$_host/mobile"; // host local UAT
// static final String _baseUrl = "$_host/v3/mobile"; // new V3 apis
static String _host = host1;
@ -241,6 +241,7 @@ class URLs {
static get getGasStatus => "$_baseUrl/Lookups/GetLookup?lookupEnum=609"; // get
static get requestGasRefill => "$_baseUrl/GasRefill/AddGasRefillFromMobile"; // get
static get updateGasRefill => "$_baseUrl/GazRefill/UpdateGazRefill"; // get
static get updateGasRefillByNurse => "$_baseUrl/GazRefill/UpdateGasRefillByNurseForMobile"; //update gas refill by nurse
static get getGasRefill => "$_baseUrl/GazRefill/GetGazRefills"; // get
// static get getGasRefillById => "$_baseUrl/GazRefill/GetGazRefillById"; // get older endpoint..
static get getGasRefillById => "$_baseUrl/GasRefill/GetGasRefillById"; // get

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
@ -6,12 +7,17 @@ import 'package:flutter/material.dart';
import 'package:google_api_availability/google_api_availability.dart';
import 'package:huawei_push/huawei_push.dart' as h_push;
import 'package:test_sa/controllers/notification/notification_manger.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/all_requests_and_count_model.dart';
import 'package:test_sa/models/device/device_transfer.dart';
import 'package:test_sa/models/new_models/gas_refill_model.dart';
import 'package:test_sa/modules/cm_module/views/service_request_detail_main_view.dart';
import 'package:test_sa/modules/pm_module/ppm_wo/ppm_details_page.dart';
import 'package:test_sa/modules/pm_module/recurrent_wo/recurrent_work_order_view.dart';
import 'package:test_sa/modules/tm_module/tasks_wo/task_request_detail_view.dart';
import 'package:test_sa/views/pages/device_transfer/device_transfer_details.dart';
import 'package:test_sa/views/pages/user/gas_refill/gas_refill_details.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
@pragma('vm:entry-point')
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {}
@ -78,28 +84,67 @@ class FirebaseNotificationManger {
static void handleMessage(context, Map<String, dynamic> messageData) {
if (messageData["requestType"] != null && messageData["requestNumber"] != null) {
Widget? serviceClass;
if (messageData["requestType"] == "Service request to engineer") {
serviceClass = ServiceRequestDetailMain(requestId: messageData["requestNumber"] ?? '');
} else if (messageData["requestType"] == "Gas Refill") {
serviceClass = GasRefillDetailsPage(
priority: messageData["priority"],
date: messageData["createdOn"],
model: GasRefillModel(id: int.parse(messageData["requestNumber"].toString())),
);
} else if (messageData["requestType"] == "Asset Transfer") {
serviceClass = DeviceTransferDetails(model: DeviceTransfer(id: int.parse(messageData["requestNumber"].toString())));
} else if (messageData["requestType"] == "PPM") {
serviceClass = PpmDetailsPage(requestId: int.parse(messageData["requestNumber"].toString()));
// PPM=1,
// ServiceRequestEngineer = 3,
// AssetTransfer=7,
// SparePartTransaction= 8,
// GasRefill=9,
// TechnicalRetirmentWO = 11,
// Recurrent = 12,
switch (messageData["transactionType"]) {
case 1:
serviceClass = PpmDetailsPage(requestId: int.parse(messageData["requestNumber"].toString()));
break;
//these three request are same corrective maintenance....
case 3:
serviceClass = ServiceRequestDetailMain(requestId: messageData["requestNumber"] ?? '');
break;
case 8:
serviceClass = ServiceRequestDetailMain(requestId: messageData["requestNumber"] ?? '');
break;
case 11:
serviceClass = ServiceRequestDetailMain(requestId: messageData["requestNumber"] ?? '');
break;
case 7:
serviceClass = DeviceTransferDetails(model: DeviceTransfer(id: int.parse(messageData["requestNumber"].toString())));
break;
case 9:
serviceClass = GasRefillDetailsPage(
priority: messageData["priority"],
date: messageData["createdOn"],
model: GasRefillModel(id: int.parse(messageData["requestNumber"].toString())),
);
break;
case 12:
serviceClass = RecurrentWorkOrderView(taskId: int.parse(messageData["requestNumber"].toString()));
//Didn't handle task request yet...
// case 6:
// serviceClass = TaskRequestDetailsView(
// taskId: int.parse(messageData["requestNumber"].toString()),
// requestDetails: RequestsDetails(nameOfType: messageData["sourceName"], status: messageData["statusName"], priority: messageData["priorityName"], date: messageData["createdDate"]));
// return;
default:
serviceClass = const Scaffold(body: Center(child: NoDataFound()));
}
// if (messageData["requestType"] == "Service request to engineer") {
// serviceClass = ServiceRequestDetailMain(requestId: messageData["requestNumber"] ?? '');
// } else if (messageData["requestType"] == "Gas Refill") {
// serviceClass = GasRefillDetailsPage(
// priority: messageData["priority"],
// date: messageData["createdOn"],
// model: GasRefillModel(id: int.parse(messageData["requestNumber"].toString())),
// );
// } else if (messageData["requestType"] == "Asset Transfer") {
// serviceClass = DeviceTransferDetails(model: DeviceTransfer(id: int.parse(messageData["requestNumber"].toString())));
// } else if (messageData["requestType"] == "PPM") {
// serviceClass = PpmDetailsPage(requestId: int.parse(messageData["requestNumber"].toString()));
// }
// else if (data["requestType"] == "WorkOrder") {
//
// }
if (serviceClass != null) {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => serviceClass!));
}
}
Navigator.of(context).push(MaterialPageRoute(builder: (_) => serviceClass!));
}
}
static initialized(BuildContext context) async {
@ -116,6 +161,7 @@ class FirebaseNotificationManger {
if (message is Map<String, dynamic>) {
Map<String, dynamic> remoteData = message;
remoteData = remoteData["extras"];
handleMessage(context, remoteData);
}
} catch (ex) {

@ -12,6 +12,7 @@ import 'package:test_sa/models/hospital.dart';
import 'package:test_sa/models/new_models/gas_refill_model.dart';
import 'package:test_sa/models/timer_model.dart';
import 'package:test_sa/models/user.dart';
import 'package:test_sa/views/pages/user/gas_refill/update_gas_refill_request.dart';
import '../../../new_views/common_widgets/app_lazy_loading.dart';
@ -138,6 +139,33 @@ class GasRefillProvider extends ChangeNotifier {
print(error);
}
}
Future<void> updateGasRefillRequestByNurse({
required BuildContext context,
required GasRefillModel model,
}) async {
late Response response;
try {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
response = await ApiManager.instance.post(URLs.updateGasRefillByNurse, body: model.toJson());
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
if (items != null) {
reset();
notifyListeners();
}
Fluttertoast.showToast(msg: context.translation.createdSuccessfully);
Navigator.pop(context);
} else {
Fluttertoast.showToast(msg: "${context.translation.failedToCompleteRequest} :${json.decode(response.body)['message']}");
}
Navigator.pop(context);
} catch (error) {
stateCode = -1;
notifyListeners();
Navigator.pop(context);
print(error);
}
}
Future<int> updateGasRefill({required int status, required GasRefillModel model}) async {
isLoading = true;

@ -36,6 +36,10 @@ class GasRefillModel {
this.assignedEmployee,
this.status,
this.comment,
this.mapSite,
this.mappedFloor,
this.mappedBuilding,
this.mappedDepartment,
this.techComment,
this.gasRefillDetails,
this.localEngineerSignature,
@ -132,12 +136,21 @@ class GasRefillModel {
// } catch (e) {
// print(e);
// }
print('building # ${json['building']}');
print('department # ${json['department']}');
print('floor # ${json['floor']}');
engSignature = json['engSignature'];
nurseSignature = json['nurseSignature'];
site = json['site'] != null ? Site.fromJson(json['site']) : null;
building = json['building'] != null ? Building.fromJson(json['building']) : null;
floor = json['floor'] != null ? Floor.fromJson(json['floor']) : null;
department = json['department'] != null ? Department.fromJson(json['department']) : null;
mapSite = json['site'] != null ? MappedSite.fromJson(json['site']) : null;
print('site i got is ::${mapSite?.toJson()}');
mappedBuilding = mapSite?.buildings?.firstWhere((element) => element.identifier == building?.identifier, orElse: () => MappedBuilding());
mappedFloor = mappedBuilding?.floors?.firstWhere((element) => element.identifier == floor?.identifier, orElse: () => MappedFloor());
mappedDepartment = mappedFloor?.departments?.firstWhere((element) => element.identifier == department?.identifier, orElse: () => MappedDepartment());
assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
status = json['status'] != null ? Lookup.fromJson(json['status']) : null;
if (json['gasRefillDetails'] != null) {
@ -150,6 +163,7 @@ class GasRefillModel {
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id ?? 0;
map['gasTypeId'] = gasRefillDetails?[0].gasType?.id;
map['cylinderTypeId'] = gasRefillDetails?[0].cylinderType?.id;

@ -239,7 +239,7 @@ class MappedBuilding extends Base {
customerId = json['customerId'];
clientBuildingId = json['clientBuildingId'];
clientBuildingName = json['clientBuildingName'];
name = clientBuildingName;
name = clientBuildingName??json['name'];
floors = (json['floors'] as List?)?.map((e) => MappedFloor.fromJson(e)).toList();
}
@ -274,7 +274,7 @@ class MappedFloor extends Base {
buildingId = json['buildingId'];
clientFloorId = json['clientFloorId'];
clientFloorName = json['clientFloorName'];
name = clientFloorName;
name = clientFloorName??json['name'];
departments = (json['departments'] as List?)?.map((e) => MappedDepartment.fromJson(e)).toList();
}
@ -308,7 +308,7 @@ class MappedDepartment extends Base {
floorId = json['floorId'];
departmentId = json['departmentId'];
departmentName = json['departmentName'];
name = departmentName;
name = departmentName??json['name'];
// rooms = json['rooms'];
}

@ -13,6 +13,7 @@ class SystemNotificationModel {
String? modifiedOn;
String? priorityName;
String? statusName;
int ? transactionType;
SystemNotificationModel(
{this.userId,
@ -28,6 +29,7 @@ class SystemNotificationModel {
this.createdOn,
this.modifiedOn,
this.priorityName,
this.transactionType,
this.statusName});
SystemNotificationModel.fromJson(Map<String, dynamic>? json) {
@ -48,6 +50,7 @@ class SystemNotificationModel {
modifiedOn = json['modifiedOn'];
priorityName = json['priorityName'];
statusName = json['statusName'];
transactionType = json['transactionType'];
}
}
@ -68,6 +71,7 @@ class SystemNotificationModel {
data['priorityName'] = priorityName;
data['priority'] = priorityName;
data['statusName'] = statusName;
data['transactionType'] = transactionType;
return data;
}
@ -87,6 +91,7 @@ class SystemNotificationModel {
data['modifiedOn'] = modifiedOn;
data['priorityName'] = priorityName;
data['statusName'] = statusName;
data['transactionType'] = transactionType;
return data;
}
}

@ -243,6 +243,8 @@ class ServiceRequestDetailProvider extends ChangeNotifier {
} else {
isReadOnlyRequest = false;
}
}else{
currentWorkOrder =null;
}
isLoading = false;
notifyListeners();

@ -12,6 +12,7 @@ import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'components/history_log_view.dart';
import 'components/service_request_detail_view.dart';
@ -37,18 +38,18 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
});
}
Future<void> getInitialData() async{
Future<void> getInitialData() async {
bool isNurse = (Provider.of<UserProvider>(context, listen: false).user?.type) == UsersTypes.normal_user;
_requestProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
_requestProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
await _requestProvider.getWorkOrderById(id: widget.requestId);
if (isNurse && (_requestProvider.currentWorkOrder?.data?.nextStep?.workOrderNextStepEnum == WorkOrderNextStepEnum.waitingForRequesterToConfirm)) {
ServiceRequestBottomSheet.nurseVerifyArrivalBottomSheet(context: context);
}
_requestProvider.needVisitHelperModel = NeedVisitHelperModel(
workOrderId: _requestProvider.currentWorkOrder?.data?.requestId,
visitDate: _requestProvider.currentWorkOrder?.data?.needAVisitDateTime,
comment: _requestProvider.currentWorkOrder?.data?.needAVisitComment,
);
workOrderId: _requestProvider.currentWorkOrder?.data?.requestId,
visitDate: _requestProvider.currentWorkOrder?.data?.needAVisitDateTime,
comment: _requestProvider.currentWorkOrder?.data?.needAVisitComment,
);
}
@override
@ -72,72 +73,71 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
return true;
},
child: Scaffold(
backgroundColor: AppColor.neutral100,
appBar: DefaultAppBar(
title: context.translation.cmDetails,
onBackPress: () {
stopTimer();
Navigator.pop(context);
},
actions: [
isNurse
? IconButton(
icon: 'qr'.toSvgAsset(
height: 24,
width: 24,
backgroundColor: AppColor.neutral100,
appBar: DefaultAppBar(
title: context.translation.cmDetails,
onBackPress: () {
stopTimer();
Navigator.pop(context);
},
actions: [
isNurse
? IconButton(
icon: 'qr'.toSvgAsset(
height: 24,
width: 24,
),
onPressed: () {
ServiceRequestBottomSheet.getQRCodeBottomSheet(context: context);
},
)
: IconButton(
icon: const Icon(Icons.home),
onPressed: () {
// stopTimer();
Navigator.pop(context);
},
),
onPressed: () {
ServiceRequestBottomSheet.getQRCodeBottomSheet(context: context);
},
)
: IconButton(
icon: const Icon(Icons.home),
onPressed: () {
// stopTimer();
Navigator.pop(context);
],
),
body: DefaultTabController(
length: 2,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 16.toScreenWidth, right: 16.toScreenWidth, top: 12.toScreenHeight),
decoration: BoxDecoration(color: context.isDark ? AppColor.neutral50 : AppColor.white10, borderRadius: BorderRadius.circular(10)),
child: TabBar(
//controller: _tabController,
padding: EdgeInsets.symmetric(vertical: 4.toScreenHeight, horizontal: 4.toScreenWidth),
labelColor: context.isDark ? AppColor.neutral30 : AppColor.black20,
unselectedLabelColor: context.isDark ? AppColor.neutral30 : AppColor.black20,
unselectedLabelStyle: AppTextStyles.bodyText,
labelStyle: AppTextStyles.bodyText,
indicatorPadding: EdgeInsets.zero,
indicatorSize: TabBarIndicatorSize.tab,
dividerColor: Colors.transparent,
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral60 : AppColor.neutral110, borderRadius: BorderRadius.circular(7)),
onTap: (index) {
// setState(() {});
},
tabs: [
Tab(text: context.translation.details, height: 57.toScreenHeight),
Tab(text: context.translation.historyLogs, height: 57.toScreenHeight),
],
),
],
),
body: DefaultTabController(
length: 2,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 16.toScreenWidth, right: 16.toScreenWidth, top: 12.toScreenHeight),
decoration: BoxDecoration(color: context.isDark ? AppColor.neutral50 : AppColor.white10, borderRadius: BorderRadius.circular(10)),
child: TabBar(
//controller: _tabController,
padding: EdgeInsets.symmetric(vertical: 4.toScreenHeight, horizontal: 4.toScreenWidth),
labelColor: context.isDark ? AppColor.neutral30 : AppColor.black20,
unselectedLabelColor: context.isDark ? AppColor.neutral30 : AppColor.black20,
unselectedLabelStyle: AppTextStyles.bodyText,
labelStyle: AppTextStyles.bodyText,
indicatorPadding: EdgeInsets.zero,
indicatorSize: TabBarIndicatorSize.tab,
dividerColor: Colors.transparent,
indicator: BoxDecoration(color: context.isDark ? AppColor.neutral60 : AppColor.neutral110, borderRadius: BorderRadius.circular(7)),
onTap: (index) {
// setState(() {});
},
tabs: [
Tab(text: context.translation.details, height: 57.toScreenHeight),
Tab(text: context.translation.historyLogs, height: 57.toScreenHeight),
],
),
),
12.height,
TabBarView(
children: [
ServiceRequestDetailView(),
const HistoryLogView(),
],
).expanded,
],
),
),
),
12.height,
TabBarView(
children: [
ServiceRequestDetailView(),
const HistoryLogView(),
],
).expanded,
],
),
)),
);
}
}

@ -9,6 +9,7 @@ import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/plan_preventive_visit/plan_preventive_visit_model.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import 'package:test_sa/views/widgets/requests/request_status.dart';
import '../../../../../controllers/providers/api/user_provider.dart';
@ -64,7 +65,7 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
PlanPreventiveVisit? planPreventiveVisit = ppmProvider.planPreventiveVisit;
return ppmProvider.isLoading
? const ALoading()
: Column(children: [
:planPreventiveVisit!=null? Column(children: [
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -80,7 +81,7 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
// if (planPreventiveVisit?.visitStatus != null) 8.width,
StatusLabel(
label: planPreventiveVisit?.visitStatus!.name!,
id: planPreventiveVisit!.visitStatus!.id!,
id: planPreventiveVisit?.visitStatus?.id??0,
textColor: AppColor.getRequestStatusTextColorByName(context, planPreventiveVisit.visitStatus!.name!),
backgroundColor: AppColor.getRequestStatusColorByName(context, planPreventiveVisit.visitStatus!.name!),
),
@ -124,7 +125,7 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
label: context.translation.viewDetails,
).paddingAll(16)
]
]);
]):const Center(child: NoDataFound());
}),
),
);

@ -330,3 +330,358 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// },
// ),
}
//TODO uncommit this to use editable form for nurse side.
// import 'dart:convert';
// import 'dart:io';
// import 'package:flutter/material.dart';
// import 'package:fluttertoast/fluttertoast.dart';
// import 'package:provider/provider.dart';
// import 'package:test_sa/cm_module/utilities/service_request_utils.dart';
// import 'package:test_sa/dashboard_latest/dashboard_provider.dart';
// import 'package:test_sa/extensions/context_extension.dart';
// import 'package:test_sa/extensions/int_extensions.dart';
// import 'package:test_sa/extensions/text_extensions.dart';
// import 'package:test_sa/extensions/widget_extensions.dart';
// import 'package:test_sa/models/enums/user_types.dart';
// import 'package:test_sa/models/lookup.dart';
// import 'package:test_sa/models/new_models/gas_refill_model.dart';
// import 'package:test_sa/models/new_models/mapped_sites.dart';
// import 'package:test_sa/new_views/app_style/app_color.dart';
// import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
// import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
// import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
// import 'package:test_sa/providers/gas_request_providers/cylinder_size_provider.dart';
// import 'package:test_sa/providers/gas_request_providers/cylinder_type_provider.dart';
// import 'package:test_sa/providers/gas_request_providers/gas_types_provider.dart';
// import 'package:test_sa/providers/gas_request_providers/site_provider.dart';
// import 'package:test_sa/providers/loading_list_notifier.dart';
//
// import 'package:test_sa/cm_module/views/components/action_button/footer_action_button.dart';
// import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
// import '../../controllers/providers/api/gas_refill_provider.dart';
// import '../common_widgets/default_app_bar.dart';
//
// class GasRefillRequestForm extends StatefulWidget {
// static const String routeName = "/gas_refill_request_form";
// final GasRefillModel? gasModel;
// final GasRefillDetails? gasRefillDetails;
//
// const GasRefillRequestForm({this.gasModel, this.gasRefillDetails, Key? key}) : super(key: key);
//
// @override
// State<GasRefillRequestForm> createState() => _GasRefillRequestFormState();
// }
//
// class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// late GasRefillDetails _currentDetails;
// late GasRefillModel _gasModel;
// Lookup? _requestedQuantity;
// final TextEditingController _commentController = TextEditingController();
// GasRefillProvider? _gasRefillProvider;
// List<File> _files = [];
//
// static List<Lookup> gasQuantity = [
// Lookup(name: "1", id: 1, value: 1),
// Lookup(name: "2", id: 2, value: 2),
// Lookup(name: "3", id: 3, value: 3),
// Lookup(name: "4", id: 4, value: 4),
// Lookup(name: "5", id: 5, value: 5)
// ];
//
// @override
// void initState() {
// super.initState();
// _gasRefillProvider ??= Provider.of<GasRefillProvider>(context, listen: false);
// _currentDetails = widget.gasRefillDetails ?? GasRefillDetails();
// _gasModel = widget.gasModel ?? GasRefillModel(gasRefillDetails: []);
// if (_gasModel.gasRefillAttachments != null && _gasModel.gasRefillAttachments!.isNotEmpty) {
// _files.addAll(_gasModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
// }
// if (widget.gasRefillDetails != null && widget.gasRefillDetails?.requestedQty != null) {
// _requestedQuantity = Lookup(name: "1", id: 1, value: int.parse(widget.gasRefillDetails!.requestedQty!.toStringAsFixed(0)));
// }
// }
//
// @override
// void dispose() {
// super.dispose();
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: DefaultAppBar(title: widget.gasModel == null ? context.translation.newGasRefillRequest : context.translation.updateRequest),
// body: Column(
// children: [
// 12.height,
// SingleChildScrollView(
// child: Column(
// children: [
// SingleItemDropDownMenu<Lookup, GasTypesProvider>(
// context: context,
// title: context.translation.gasType,
// initialValue: _currentDetails.gasType,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// showAsBottomSheet: true,
// onSelect: (value) {
// _currentDetails.gasType = value;
// },
// ),
// 8.height,
// SingleItemDropDownMenu<Lookup, CylinderTypesProvider>(
// context: context,
// title: context.translation.cylinderType,
// initialValue: _currentDetails.cylinderType,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// _currentDetails.cylinderType = value;
// },
// ),
// 8.height,
// SingleItemDropDownMenu<Lookup, CylinderSizeProvider>(
// context: context,
// title: context.translation.cylinderSize,
// initialValue: _currentDetails.cylinderSize,
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// _currentDetails.cylinderSize = value;
// },
// ),
// 8.height,
// SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
// context: context,
// title: context.translation.quantity,
// showAsBottomSheet: true,
// initialValue: _requestedQuantity,
// staticData: gasQuantity,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// _requestedQuantity = value;
// _currentDetails.requestedQty = value?.value;
// },
// ),
// 8.height,
// Row(
// children: [
// SingleItemDropDownMenu<MappedSite, MappedSiteProvider>(
// context: context,
// title: context.translation.site,
// initialValue: _gasModel.mapSite,
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// setState(() {
// _gasModel.mapSite = value;
// _gasModel.mappedBuilding = null;
// _gasModel.mappedFloor = null;
// _gasModel.mappedDepartment = null;
// });
// },
// ).expanded,
// 8.width,
// SingleItemDropDownMenu<MappedBuilding, NullableLoadingProvider>(
// context: context,
// title: context.translation.building,
// initialValue: _gasModel.mappedBuilding,
// enabled: _gasModel.mapSite?.buildings?.isNotEmpty ?? false,
// staticData: _gasModel.mapSite?.buildings ?? [],
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// setState(() {
// _gasModel.mappedBuilding = value;
// _gasModel.mappedFloor = null;
// _gasModel.mappedDepartment = null;
// });
// },
// ).expanded,
// ],
// ),
// 8.height,
// Row(
// children: [
// SingleItemDropDownMenu<MappedFloor, NullableLoadingProvider>(
// context: context,
// title: context.translation.floor,
// initialValue: _gasModel.mappedFloor,
// enabled: _gasModel.mappedBuilding?.floors?.isNotEmpty ?? false,
// staticData: _gasModel.mappedBuilding?.floors ?? [],
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// if (value != null) {
// setState(() {
// _gasModel.mappedFloor = value;
// _gasModel.department = null;
// });
// }
// },
// ).expanded,
// 8.width,
// SingleItemDropDownMenu<MappedDepartment, NullableLoadingProvider>(
// context: context,
// title: context.translation.department,
// initialValue: _gasModel.mappedDepartment,
// enabled: _gasModel.mappedFloor?.departments?.isNotEmpty ?? false,
// staticData: _gasModel.mappedFloor?.departments ?? [],
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// onSelect: (value) {
// _gasModel.mappedDepartment = value;
// },
// ).expanded,
// ],
// ),
// 8.height,
// AppTextFormField(
// labelText: context.translation.callComments,
// labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120),
// textInputType: TextInputType.multiline,
// alignLabelWithHint: true,
// initialValue: _gasModel.comment,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// controller: _commentController,
// onChange: (value) {
// _gasModel.comment = value;
// },
// onSaved: (value) {},
// ),
// 8.height,
// MultiFilesPicker(
// label: context.translation.attachFiles,
// files: _files,
// buttonColor: AppColor.black10,
// onlyImages: false,
// buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
// ),
// ],
// ).toShadowContainer(context, padding: 10).paddingOnly(start: 16, end: 16, top: 16),
// ).expanded,
// 16.height,
// FooterActionButton.footerContainer(
// child: AppFilledButton(label: widget.gasModel == null ? context.translation.submitRequest : context.translation.updateRequest, maxWidth: true, onPressed: _submit)),
// ],
// ),
// );
// }
//
// Future<void> _submit() async {
// if (await validateRequest()) {
// _gasModel.gasRefillDetails = [];
// _gasModel.gasRefillDetails?.add(_currentDetails);
// _gasModel.gasRefillAttachments = [];
// for (var item in _files) {
// _gasModel.gasRefillAttachments?.add(GasRefillAttachments(
// id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
// }
// if (widget.gasModel != null) {
// //TODO need to call api here for update for nurse APi has issue need to discuss with backend..
// await _gasRefillProvider?.updateGasRefillRequestByNurse(
// context: context,
// model: _gasModel,
// );
// } else {
// await _gasRefillProvider?.addGasRefillRequest(
// context: context,
// model: _gasModel,
// );
// }
// if (_gasRefillProvider?.stateCode == 200) {
// DashBoardProvider dashBoardProvider = Provider.of<DashBoardProvider>(context, listen: false);
// dashBoardProvider.refreshDashboard(context: context, userType: UsersTypes.nurse);
// }
// }
// }
//
// Future<bool> validateRequest() async {
// if (_currentDetails.gasType == null) {
// await Fluttertoast.showToast(msg: "Please Select Gas Type");
// return false;
// }
// if (_gasModel.mapSite == null) {
// await Fluttertoast.showToast(msg: "Please Select Site");
// return false;
// }
// if (_gasModel.mappedBuilding == null) {
// await Fluttertoast.showToast(msg: "Please Select Building");
// return false;
// }
// if (_gasModel.mappedFloor == null) {
// await Fluttertoast.showToast(msg: "Please Select Floor");
// return false;
// }
// if (_gasModel.mappedDepartment == null) {
// await Fluttertoast.showToast(msg: "Please Select Department");
// return false;
// }
// return true;
// }
//
// //older code....
// // if (_gasModel.gasRefillDetails?.isEmpty ?? true)
// // AppFilledButton(
// // label: context.translation.add,
// // maxWidth: true,
// // textColor: Colors.white,
// // buttonColor: context.isDark ? AppColor.neutral60 : AppColor.neutral50,
// // onPressed: _add,
// // ),
// // ListView.builder(
// // shrinkWrap: true,
// // itemCount: _gasModel.gasRefillDetails?.length,
// // padding: const EdgeInsets.only(top: 12, bottom: 24),
// // physics: const NeverScrollableScrollPhysics(),
// // itemBuilder: (context, index) {
// // return Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // Row(
// // mainAxisAlignment: MainAxisAlignment.spaceBetween,
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // Column(
// // crossAxisAlignment: CrossAxisAlignment.start,
// // children: [
// // (_gasModel.gasRefillDetails![index].gasType?.name ?? "").heading5(context),
// // 8.height,
// // ("${context.translation.quantity}: ${_gasModel.gasRefillDetails![index].requestedQty}").bodyText(context),
// // ("${context.translation.cylinderSize}: ${_gasModel.gasRefillDetails![index].cylinderSize?.name}").bodyText(context),
// // ("${context.translation.cylinderType}: ${_gasModel.gasRefillDetails![index].cylinderType?.name}").bodyText(context),
// // ],
// // ),
// // Container(
// // height: 48.toScreenWidth,
// // width: 48.toScreenWidth,
// // decoration: BoxDecoration(
// // borderRadius: BorderRadius.circular(100),
// // border: Border.all(color: context.isDark ? AppColor.neutral50 : AppColor.neutral30),
// // ),
// // padding: EdgeInsets.symmetric(vertical: 12.toScreenHeight),
// // child: "trash".toSvgAsset(fit: BoxFit.fitHeight, color: context.isDark ? AppColor.red40 : AppColor.red50),
// // ).onPress(() {
// // _delete(index);
// // }),
// // ],
// // ),
// // const Divider().defaultStyle(context),
// // ("${context.translation.site}: ${_gasModel.site?.custName}").bodyText(context),
// // ("${context.translation.building}: ${_gasModel.building?.name}").bodyText(context),
// // ("${context.translation.floor}: ${_gasModel.floor?.name}").bodyText(context),
// // ("${context.translation.department}: ${_gasModel.department?.departmentName}").bodyText(context),
// // ],
// // ).toShadowContainer(context);
// // },
// // ),
// }

@ -13,6 +13,7 @@ import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart'
import 'package:test_sa/views/widgets/images/files_list.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
import '../../../extensions/text_extensions.dart';
import '../../../models/enums/user_types.dart';
import '../../../new_views/app_style/app_color.dart';
@ -57,131 +58,135 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
} else {
_model = snapshot.data as DeviceTransfer?;
_attachments = _model?.assetTransferAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
return Form(
key: _formKey,
child: LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: SingleChildScrollView(
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"Transfer Details".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
_buildTextWidget('${context.translation.createdBy} : ${_model?.name ?? ""}'),
const Divider().defaultStyle(context),
Text(
"Asset Info".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_contactInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
return _model != null
? Form(
key: _formKey,
child: LoadingManager(
isLoading: _isLoading,
isFailedLoading: false,
stateCode: 200,
onRefresh: () async {},
child: SingleChildScrollView(
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"Comments".addTranslation,
"Transfer Details".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
_buildTextWidget(_model!.comment!),
],
if (_attachments.isNotEmpty) ...[
_buildTextWidget('${context.translation.requestNo} : ${_model?.transferCode ?? ""}'),
_buildTextWidget('${context.translation.transferType} : ${_model?.transferType?.name ?? ""}'),
_buildTextWidget('${context.translation.createdBy} : ${_model?.name ?? ""}'),
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
"Asset Info".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
//attachmentWidget(),
]
],
_buildTextWidget('${context.translation.assetName} : ${_model?.assetName?.cleanupWhitespace.capitalizeFirstOfEach ?? ""}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model?.assetNumber ?? ""}'),
_buildTextWidget('${context.translation.model} : ${_model?.modelName ?? ""}'),
_buildTextWidget('${context.translation.sn} : ${_model?.assetSerialNo ?? ""}'),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_contactInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Comments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
_buildTextWidget(_model!.comment!),
],
if (_attachments.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
//attachmentWidget(),
]
],
),
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
1.width,
Text(
_model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
],
),
],
).toShadowContainer(context),
8.height,
if (_model?.transferType?.value == 1) ...[
_internalRequestDetailsCard(
statusLabel: _model?.senderMachineStatusName != null
? StatusLabel(
label: _model!.senderMachineStatusName!,
id: _model!.senderMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
)
: null,
)
] else ...[
// sender card
_buildCard(
isSender: true,
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
dept: _model?.senderDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
building: _model?.senderBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
floor: _model?.senderFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
comment: _model?.senderComment ?? "",
statusLabel: _model?.senderMachineStatusName != null
? StatusLabel(
label: _model!.senderMachineStatusName!,
id: _model!.senderMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
)
: null,
),
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
1.width,
Text(
_model?.createdOn != null ? _model!.createdOn!.toServiceRequestCardFormat : "",
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
8.height,
// receiver card
_buildCard(
isSender: false,
site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
dept: _model?.destDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
building: _model?.destBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
floor: _model?.destFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
comment: _model?.receiverComment ?? "",
statusLabel: _model?.receiverMachineStatusName != null
? StatusLabel(
label: _model!.receiverMachineStatusName ?? "",
id: _model!.receiverMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.receiverMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.receiverMachineStatusName!))
: null,
),
],
),
],
).toShadowContainer(context),
8.height,
if (_model?.transferType?.value == 1) ...[
_internalRequestDetailsCard(
statusLabel: _model?.senderMachineStatusName != null
? StatusLabel(
label: _model!.senderMachineStatusName!,
id: _model!.senderMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
)
: null,
)
] else ...[
// sender card
_buildCard(
isSender: true,
site: _model?.senderSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
dept: _model?.senderDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
building: _model?.senderBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
floor: _model?.senderFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
comment: _model?.senderComment ?? "",
statusLabel: _model?.senderMachineStatusName != null
? StatusLabel(
label: _model!.senderMachineStatusName!,
id: _model!.senderMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.senderMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.senderMachineStatusName!),
)
: null,
),
8.height,
// receiver card
_buildCard(
isSender: false,
site: _model?.destSiteName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
dept: _model?.destDepartmentName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
building: _model?.destBuildingName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
floor: _model?.destFloorName?.cleanupWhitespace.capitalizeFirstOfEach ?? "",
comment: _model?.receiverComment ?? "",
statusLabel: _model?.receiverMachineStatusName != null
? StatusLabel(
label: _model!.receiverMachineStatusName ?? "",
id: _model!.receiverMachineStatusId!.toInt(),
textColor: AppColor.getRequestStatusTextColorByName(context, _model!.receiverMachineStatusName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, _model!.receiverMachineStatusName!))
: null,
),
],
],
).paddingAll(16),
),
),
);
],
).paddingAll(16),
),
),
)
: const Center(
child: NoDataFound(),
);
}
},
),

@ -52,67 +52,71 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
List<File> _files = [];
_update({required int status}) async {
_formKey.currentState!.save();
if (_validateForm()) {
_formModel.statusValue = status;
_formModel.isSender = widget.isSender;
_formModel.assetTransferAttachments = [];
int workingHours = _formModel.tbsTimer?.endAt!.difference(_formModel.tbsTimer!.startAt!).inSeconds ?? 0;
if (widget.isSender) {
_formModel.senderVisitTimers?.add(
VisitTimers(
id: 0,
startDateTime: _formModel.tbsTimer?.startAt?.toIso8601String(),
endDateTime: _formModel.tbsTimer?.endAt?.toIso8601String(),
workingHours: ((workingHours) / 60 / 60),
),
);
_formModel.assetTransferEngineerTimers = _formModel.senderVisitTimers;
} else {
_formModel.receiverVisitTimers?.add(
VisitTimers(
id: 0,
startDateTime: _formModel.tbsTimer?.startAt?.toIso8601String(),
endDateTime: _formModel.tbsTimer?.endAt?.toIso8601String(),
workingHours: ((workingHours) / 60 / 60),
),
);
_formModel.assetTransferEngineerTimers = _formModel.receiverVisitTimers;
}
try {
for (var file in _files) {
String attachmentName = file.path;
if (attachmentName.contains("/")) {
attachmentName = file.path.split("/").last;
attachmentName = "$attachmentName|${base64Encode(file.readAsBytesSync())}";
}
_formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: 0, attachmentName: attachmentName));
_formModel.attachments = _formModel.assetTransferAttachments;
}
} catch (error) {
print(error);
}
await _deviceTransferProvider.updateRequest(context, model: _formModel);
}
}
bool _validateForm() {
if (_formModel.tbsTimer?.startAt == null) {
await Fluttertoast.showToast(msg: "Working Hours Required");
Fluttertoast.showToast(msg: "Working Hours Required");
return false;
}
if (_formModel.tbsTimer?.endAt == null || isTimerRunning) {
await Fluttertoast.showToast(msg: "Please Stop The Timer");
return false;
}
if (!(_formKey.currentState!.validate())) {
setState(() {});
Fluttertoast.showToast(msg: "Please Stop The Timer");
return false;
}
_formKey.currentState!.save();
_formModel.statusValue = status;
_formModel.isSender = widget.isSender;
_formModel.assetTransferAttachments = [];
int workingHours = _formModel.tbsTimer?.endAt!.difference(_formModel.tbsTimer!.startAt!).inSeconds ?? 0;
if (widget.isSender) {
_formModel.senderVisitTimers?.add(
VisitTimers(
id: 0,
startDateTime: _formModel.tbsTimer?.startAt?.toIso8601String(),
endDateTime: _formModel.tbsTimer?.endAt?.toIso8601String(),
workingHours: ((workingHours) / 60 / 60),
),
);
_formModel.assetTransferEngineerTimers = _formModel.senderVisitTimers;
} else {
_formModel.receiverVisitTimers?.add(
VisitTimers(
id: 0,
startDateTime: _formModel.tbsTimer?.startAt?.toIso8601String(),
endDateTime: _formModel.tbsTimer?.endAt?.toIso8601String(),
workingHours: ((workingHours) / 60 / 60),
),
);
_formModel.assetTransferEngineerTimers = _formModel.receiverVisitTimers;
}
try {
for (var file in _files) {
String attachmentName = file.path;
if (attachmentName.contains("/")) {
attachmentName = file.path.split("/").last;
attachmentName = "$attachmentName|${base64Encode(file.readAsBytesSync())}";
}
// if (widget.isSender) {
_formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: 0, attachmentName: attachmentName));
_formModel.attachments = _formModel.assetTransferAttachments;
// }
// else {
// _formModel.receiverAttachments!.add(AssetTransferAttachment(id: 0, attachmentName: attachmentName));
// _formModel.attachments = _formModel.receiverAttachments;
// }
if (_formModel.assistantEmployees != null) {
if (_formModel.modelAssistantEmployees?.startDate == null) {
Fluttertoast.showToast(msg: "Please Select Assistant Employee Start Time");
return false;
}
if (_formModel.modelAssistantEmployees?.endDate == null) {
Fluttertoast.showToast(msg: "Please Select Assistant Employee End Time");
return false;
}
} catch (error) {
print(error);
}
await _deviceTransferProvider.updateRequest(context, model: _formModel);
return true;
}
@override

@ -11,6 +11,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/pages/gas_refill_request_form.dart';
import 'package:test_sa/views/pages/user/gas_refill/update_gas_refill_request.dart';
import 'package:test_sa/views/widgets/images/files_list.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
@ -73,7 +74,6 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
padding: const EdgeInsets.all(16),
child: informationCard(_model),
).expanded,
if (_userProvider.user!.type == UsersTypes.engineer && (_model.status!.value! != 2)) ...[
AppFilledButton(
onPressed: () async {
@ -82,11 +82,17 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
},
label: context.translation.updateRequest,
).paddingAll(16)
]
// else if(_model.status!.value! == 0)...[
//TODO need to uncomment this to enable nurse edit gas refill request.
// else if (_model.status!.value! == 0) ...[
// AppFilledButton(
// onPressed: () async {
// await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateGasRefillRequest(gasRefillModel: _model)));
// await Navigator.of(context).push(MaterialPageRoute(
// builder: (_) => GasRefillRequestForm(
// gasModel: _model,
// gasRefillDetails: _model.gasRefillDetails?[0],
// )));
// // getVisitData();
// },
// label: context.translation.updateRequest,

@ -4,7 +4,7 @@ import 'package:test_sa/extensions/text_extensions.dart';
class StatusLabel extends StatelessWidget {
String? label;
final int id;
final int? id;
final Color? backgroundColor;
final Color? textColor;
final bool isPriority;

Loading…
Cancel
Save