Compare commits

...

10 Commits

@ -1,14 +1,14 @@
class URLs {
URLs._();
static const String appReleaseBuildNumber = "41";
static const String appReleaseBuildNumber = "42";
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 final String _baseUrl = "$_host/mobile"; // host local UAT
// static final String _baseUrl = "$_host/mobile"; // new V2 apis
// static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis
static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM
// static final String _baseUrl = "$_host/v4/mobile"; // v4 for Demo module
// static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation
@ -365,6 +365,7 @@ class URLs {
static get getSiteContactInfo => "$_baseUrl/AssetGroupSiteContactInfo"; // add
static get getDepartmentBasedOnSite => "$_baseUrl/TRAFDataSource/GetDepartmentBasedOnSite"; // add
static get getCustomersByUserId => "$_baseUrl/TRAFDataSource/GetCustomersByUserId"; // add
// asset inventory Urls.
static get getAssetInventoryById => '$_baseUrl/AssetInventory/GetAssetInventoryById';

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:developer';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart';
@ -156,14 +157,20 @@ class AllRequestsProvider extends ChangeNotifier {
list.add(7); // task mod
}
// switching asset inventory to users permissions
//TODO uncommit this to enable TRAF in production.
context.userProvider.modulesPermissionsList.forEach((module) {
if (module.module!.value! == 8 || module.module!.value! == 9) {
list.add(module.module!.value!);
}
});
// if (context.settingProvider.isUserFlowMedical && context.userProvider.isNurse) {
//Todo commit this when passing to production.
// context.userProvider.modulesPermissionsList.forEach((module) {
// if (module.module!.value! == 8) {
// list.add(module.module!.value!);
// }
// });
//
// if (context.settingProvider.isUserFlowMedical && !context.userProvider.isAssessor && (context.userProvider.isNurse || context.userProvider.isEngineer)) {
// list.add(9); //
// }
list.add(12);

@ -134,6 +134,7 @@ import 'modules/tm_module/device_transfer/device_search_screen.dart';
import 'modules/tm_module/tasks/create_task_view.dart';
import 'modules/tm_module/gas_refill/gas_refill_request_form.dart';
import 'providers/lookups/classification_lookup_provider.dart';
import 'providers/lookups/customer_lookup_provider.dart';
import 'providers/lookups/department_lookup_provider.dart';
import 'providers/lookups/request_type_lookup_provider.dart';
import 'providers/lookups/yes_no_lookup_provider.dart';
@ -232,6 +233,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => RequestTypeLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => YesNoLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => DepartmentLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => CustomerLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => EndUserStatusLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => EndUserRejectionReasonLookupProvider(), lazy: true),
ChangeNotifierProvider(create: (_) => AttachmentTypeLookupProvider(), lazy: true),

@ -0,0 +1,62 @@
import '../base.dart';
class TrafCustomer extends Base {
int? customerId;
int? langId;
String? nameValue;
String? customerName;
String? languageName;
int? id;
String? createdBy;
String? createdDate;
String? modifiedBy;
String? modifiedDate;
TrafCustomer({
this.customerId,
this.langId,
this.nameValue,
this.customerName,
this.languageName,
this.id,
this.createdBy,
this.createdDate,
this.modifiedBy,
this.modifiedDate,
}) : super(identifier: id?.toString() ?? '', name: nameValue ?? customerName);
factory TrafCustomer.fromJson(Map<String, dynamic> json) {
return TrafCustomer(
customerId: json['customerId'],
langId: json['langId'],
nameValue: json['nameValue'],
customerName: json['customerName'],
languageName: json['languageName'],
id: json['id'],
createdBy: json['createdBy'],
createdDate: json['createdDate'],
modifiedBy: json['modifiedBy'],
modifiedDate: json['modifiedDate'],
);
}
Map<String, dynamic> toJson() {
return {
'customerId': customerId,
'langId': langId,
'nameValue': nameValue,
'customerName': customerName,
'languageName': languageName,
'id': id,
'createdBy': createdBy,
'createdDate': createdDate,
'modifiedBy': modifiedBy,
'modifiedDate': modifiedDate,
};
}
@override
String toString() {
return nameValue ?? customerName ?? '';
}
}

@ -237,6 +237,7 @@ class _CreateMedicalGasRequestPageState extends State<CreateMedicalGasRequestPag
itemCount: medicalGasInfo!.attributeInfo!.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
AttributeInfo model = medicalGasInfo!.attributeInfo![index];
return AppTextFormField(

@ -90,8 +90,7 @@ class _MedicalGasInspectionDetailPageState extends State<MedicalGasInspectionDet
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
'${context.translation.requestNo}: ${model?.requestNumber ?? '-'}'.bodyText(context),
'Requested by: ${model?.requestedBy ?? '-'}'.bodyText(context),
if (model?.lastModifiedBy != null)
'Last Modified by: ${model?.lastModifiedBy ?? '-'}'.bodyText(context),
if (model?.lastModifiedBy != null) 'Last Modified by: ${model?.lastModifiedBy ?? '-'}'.bodyText(context),
'Order Type: ${model?.requestOrderType ?? '-'}'.bodyText(context),
'Item Type: ${model?.itemType ?? '-'}'.bodyText(context),
'Site: ${model?.site ?? '-'}'.bodyText(context),
@ -124,10 +123,7 @@ class _MedicalGasInspectionDetailPageState extends State<MedicalGasInspectionDet
}
return;
}
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(
builder: (_) => CreateMedicalGasRequestPage(
dataModel: model,
)));
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => CreateMedicalGasRequestPage(dataModel: model)));
if (isRefresh == true) {
_loadData();
}

@ -49,7 +49,7 @@ class AttributeInfo {
AttributeInfo.fromJson(Map<String, dynamic> json) {
id = json['id'];
medicalGasAttributeId = json['medicalGasAttributeId'];
requestedQuantity = json['requestedQuantity'];
requestedQuantity = json['value'] ?? json['requestedQuantity'];
value = json['value'];
itemName = json['itemName'];
oracleName = json['oracleName'];

@ -371,9 +371,9 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
return "Enter a valid number";
}
if (intVal <= 0) {
return "Value must be greater than 0";
}
// if (intVal <= 0) {
// return "Value must be greater than 0";
// }
return null;
},

@ -88,7 +88,7 @@ class _RecurrentTaskInfoWidgetState extends State<RecurrentTaskInfoWidget> {
'${context.translation.room}: ${widget.model!.room?.name ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
],
'${context.translation.assignedEmployee}: ${widget.model!.engineer?.userName ?? ""}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.scheduledDate}: ${widget.model!.scheduleDate!.toMonthYearFormat}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.scheduledDate}: ${widget.model!.scheduleDate!.toServiceRequestDetailsFormat}'.bodyText2(context).custom(color: AppColor.neutral120),
],
).toShadowContainer(context),
12.height,

@ -1,3 +1,7 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
@ -7,13 +11,14 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/helper/utils.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/traf_customer.dart';
import 'package:test_sa/models/new_models/traf_department.dart';
import 'package:test_sa/models/new_models/users_based_on_search_model.dart';
import 'package:test_sa/modules/cm_module/cm_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/traf_module/asset_auto_complete_field.dart';
import 'package:test_sa/modules/traf_module/traf_request_detail_page.dart';
import 'package:test_sa/modules/traf_module/update_traf_request_page.dart';
import 'package:test_sa/modules/traf_module/users_auto_complete_field.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
@ -21,11 +26,12 @@ import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/new_views/common_widgets/multiple_item_drop_down_menu.dart';
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/providers/lookups/customer_lookup_provider.dart';
import 'package:test_sa/providers/lookups/department_lookup_provider.dart';
import 'package:test_sa/providers/lookups/request_type_lookup_provider.dart';
import 'package:test_sa/providers/lookups/yes_no_lookup_provider.dart';
import 'package:test_sa/views/widgets/equipment/asset_picker.dart';
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
import 'traf_request_model.dart';
import 'traf_request_provider.dart';
@ -52,27 +58,47 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
Lookup? otherServicesEffects;
Lookup? useInCombination;
TrafCustomer? selectedSite;
TrafDepartment? selectedDepartment;
TrafRequestDataModel? trafRequest;
List<Lookup> abc = [];
List<TrafDepartment> departments = [];
List<UsersBasedOnSearchModel> userBasedOnSearch = [];
List<GenericAttachmentModel> attachments = [];
FocusNode otherServicesEffectsNode = FocusNode();
FocusNode useInCombinationNode = FocusNode();
FocusNode departmentNode = FocusNode();
FocusNode siteDepartmentNode = FocusNode();
@override
void initState() {
super.initState();
trafRequest = TrafRequestDataModel(id: 0, attachments: [], departments: [], qty: 1);
resetProviders();
WidgetsBinding.instance.addPostFrameCallback((_) {
final requestTypeProvider = Provider.of<RequestTypeLookupProvider>(context, listen: false);
final yesNoProvider = Provider.of<YesNoLookupProvider>(context, listen: false);
final customerProvider = Provider.of<CustomerLookupProvider>(context, listen: false);
if (requestTypeProvider.items.isEmpty) {
requestTypeProvider.reset();
}
if (yesNoProvider.items.isEmpty) {
yesNoProvider.reset();
}
final userId = context.userProvider.user?.userID;
if (customerProvider.items.isEmpty && userId != null && userId.isNotEmpty) {
customerProvider.getDataByUserId(userId);
}
log('user id is ${userId}');
});
}
void resetProviders() {
Provider.of<RequestTypeLookupProvider>(context, listen: false).reset();
// Provider.of<YesNoLookupProvider>(context, listen: false).reset();
Provider.of<YesNoLookupProvider>(context, listen: false).reset();
}
@override
@ -83,7 +109,7 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const DefaultAppBar(title: "TRAF Request"),
appBar: const DefaultAppBar(title: "Assessment of Need & Technology"),
body: Form(
key: _formKey,
child: Column(
@ -180,6 +206,48 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50, fontWeight: FontWeight.w600),
),
12.height,
SingleItemDropDownMenu<TrafCustomer, CustomerLookupProvider>(
context: context,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
showShadow: false,
title: "Site",
requestById: int.tryParse(context.userProvider.user?.userID ?? ''),
initialValue: selectedSite,
onSelect: (value) {
selectedSite = value;
trafRequest?.siteId = value?.customerId;
// Reset department when site changes
selectedDepartment = null;
trafRequest?.departmentId = null;
// Reset and fetch department data based on selected site
Provider.of<DepartmentLookupProvider>(context, listen: false).reset();
if (selectedSite != null && selectedSite!.customerId != null) {
// Fetch departments for the selected site
Provider.of<DepartmentLookupProvider>(context, listen: false).getData(id: selectedSite!.customerId);
siteDepartmentNode.requestFocus();
}
setState(() {});
},
),
12.height,
SingleItemDropDownMenu<TrafDepartment, DepartmentLookupProvider>(
context: context,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
showShadow: false,
title: "Department",
requestById: null,
// initialValue: selectedDepartment,
enabled: selectedSite != null,
onSelect: (value) {
selectedDepartment = value;
trafRequest?.departmentId = value?.id?.toString();
setState(() {});
},
),
12.height,
AppTextFormField(
initialValue: "",
labelText: "How would the requested technology solve the current situation and/or serve the purpose?",
@ -443,7 +511,18 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
trafRequest?.usedWithCombination = value;
},
),
]
],
12.height,
AttachmentPicker(
label: context.translation.attachFiles,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
onChange: (attachment) {
attachments = attachment;
},
),
],
).toShadowContainer(context, padding: 12, borderRadius: 20),
16.height,
@ -491,10 +570,25 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
"Pick asset".showToast;
return;
}
// Validate site and department selection
if (selectedSite == null) {
"Please select a site".showToast;
return;
}
if (selectedDepartment == null) {
"Please select a department".showToast;
return;
}
if (!_formKey.currentState!.validate()) return;
trafRequest?.employeeId = context.userProvider.user?.userID;
trafRequest?.siteId = context.userProvider.user?.clientId;
// Set site and department IDs from selected dropdowns
trafRequest?.siteId = selectedSite?.customerId;
trafRequest?.departmentId = selectedDepartment?.id;
trafRequest?.trafContacts = [];
trafRequest?.trafContacts = userBasedOnSearch.map((item) => TrafContacts(id: 0, trafId: 0, name: item.userName, userId: item.userId)).toList();
@ -521,8 +615,17 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
return;
}
// Process attachments similar to CreateCMRequest
trafRequest?.attachments = [];
for (var item in attachments) {
String fileName = CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
trafRequest?.attachments!.add(
Attachments(id: 0, trafId: 0, attachmentName: fileName),
);
}
Utils.showLoading(context);
bool isSuccess = await Provider.of<TrafRequestProvider>(context, listen: false).addTraf(trafRequest!.toJson());
bool isSuccess = await Provider.of<TrafRequestProvider>(context, listen: false).addTraf(trafRequest!.toJsonNew());
Utils.hideLoading(context);
if (isSuccess) {
Navigator.pop(context);

@ -1,8 +1,12 @@
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_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';
@ -12,9 +16,11 @@ import 'package:test_sa/modules/traf_module/update_traf_request_page.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/default_app_bar.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/no_data_found.dart';
import '../../controllers/api_routes/urls.dart';
import 'asset_analytics_model.dart';
import 'traf_request_model.dart';
@ -32,10 +38,14 @@ class TrafRequestDetailPage extends StatefulWidget {
}
class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
List<File> _attachments = [];
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
Provider.of<TrafRequestProvider>(context, listen: false).getTRAFById(widget.trafId);
});
}
@override
@ -47,12 +57,15 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
Widget build(BuildContext context) {
bool isEngineer = (Provider.of<UserProvider>(context, listen: false).user?.type) == UsersTypes.engineer;
return Scaffold(
appBar: const DefaultAppBar(title: "TRAF Request"),
appBar: const DefaultAppBar(title: "Assessment of Need & Technology"),
body: Selector<TrafRequestProvider, bool>(
selector: (_, myModel) => myModel.isLoading, // Selects only the userName
builder: (_, isLoading, __) {
if (isLoading) return const ALoading();
TrafRequestProvider trafProvider = Provider.of<TrafRequestProvider>(context, listen: false);
if (trafProvider.trafRequestDataModel?.attachments != null) {
_attachments = trafProvider.trafRequestDataModel!.attachments!.map((e) => File(URLs.getFileUrl(e.attachmentName ?? '') ?? '')).toList();
}
return trafProvider.trafRequestDataModel == null
? const NoDataFound().center
: Column(
@ -116,8 +129,12 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
8.height,
'TRAF No: ${data.reqCode ?? '-'}'.bodyText(context),
'Request No: ${data.reqCode ?? '-'}'.bodyText(context),
'Request type: ${data.requestTypeName ?? '-'}'.bodyText(context),
if (data.requestTypeValue == 1) ...[
4.height,
'Requested Quantity: ${data.qty ?? '-'}'.bodyText(context),
],
4.height,
'How would the requested technology solve the current situation and/or serve the purpose?: ${data.purposeAnswer ?? '-'}'.bodyText(context),
4.height,
@ -148,6 +165,15 @@ class _TrafRequestDetailPageState extends State<TrafRequestDetailPage> {
4.height,
'Equipment going to be used with combination of other equipments:\n${data.usedWithCombination ?? '-'}'.bodyText(context),
],
if (_attachments.isNotEmpty) ...[
4.height,
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading6.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
// 8.height,
FilesList(images: _attachments.map((e) => URLs.getFileUrl(e.path ?? '') ?? '').toList() ?? []),
],
],
).toShadowContainer(context, borderRadius: 20, padding: 12);
}

@ -47,9 +47,11 @@ class TrafRequestItemView extends StatelessWidget {
],
),
8.height,
(requestData?.typeTransaction ?? "TRAF Request").heading5(context),
//TODO uncommit this when API will provide changed name for traf
// (requestData?.typeTransaction ?? "TRAF Request").heading5(context),
("Assessment of Need & Technology").heading5(context),
infoWidget(label: context.translation.requestType, value: requestData?.requestTypeName, context: context),
infoWidget(label: "TRAF No", value: requestData?.requestNo, context: context),
infoWidget(label: "Request No", value: requestData?.requestNo, context: context),
8.height,
Row(
mainAxisSize: MainAxisSize.min,
@ -93,10 +95,13 @@ class TrafRequestItemView extends StatelessWidget {
],
),
8.height,
(requestDetails?.nameOfType ?? "TRAF Request").heading5(context),
//TODO uncommit this when API will provide changed name for traf
// (requestDetails?.nameOfType ?? "TRAF Request").heading5(context),
("Assessment of Need & Technology").heading5(context),
8.height,
infoWidget(label: context.translation.requestType, value: requestDetails!.requestType, context: context),
infoWidget(label: "TRAF No", value: requestDetails!.requestNo, context: context),
infoWidget(label: "Request No", value: requestDetails!.requestNo, context: context),
infoWidget(label: context.translation.site, value: requestDetails!.site, context: context),
8.height,
Row(

@ -51,7 +51,7 @@ class TrafRequestDataModel {
String? employeeEmail;
int? positionId;
String? positionName;
String? departmentId;
dynamic departmentId;
String? departmentName;
List<Departments>? departments;
List<Departments>? trafDepartments;
@ -88,10 +88,12 @@ class TrafRequestDataModel {
String? isEffectedName;
String? effectedServices;
int? isCombinationId;
int?requestTypeValue;
String? isCombinationName;
String? usedWithCombination;
String? comment;
List<Attachments>? attachments;
bool? isFromMobile;
int? isBudgetId;
String? isBudgetName;
String? firstLineManagerId;
@ -186,9 +188,11 @@ class TrafRequestDataModel {
this.isEffectedName,
this.effectedServices,
this.isCombinationId,
this.requestTypeValue,
this.isCombinationName,
this.usedWithCombination,
this.comment,
this.isFromMobile = true,
this.attachments,
this.isBudgetId,
this.isBudgetName,
@ -299,9 +303,11 @@ class TrafRequestDataModel {
isEffectedName = json['isEffectedName'];
effectedServices = json['effectedServices'];
isCombinationId = json['isCombinationId'];
requestTypeValue = json['requestTypeValue'];
isCombinationName = json['isCombinationName'];
usedWithCombination = json['usedWithCombination'];
comment = json['comment'];
isFromMobile = json['isFromMobile'];
if (json['attachments'] != null) {
attachments = <Attachments>[];
json['attachments'].forEach((v) {
@ -415,9 +421,11 @@ class TrafRequestDataModel {
data['isEffectedName'] = this.isEffectedName;
data['effectedServices'] = this.effectedServices;
data['isCombinationId'] = this.isCombinationId;
data['requestTypeValue'] = this.requestTypeValue;
data['isCombinationName'] = this.isCombinationName;
data['usedWithCombination'] = this.usedWithCombination;
data['comment'] = this.comment;
data['isFromMobile'] = this.isFromMobile;
if (this.attachments != null) {
data['attachments'] = this.attachments!.map((v) => v.toJson()).toList();
} else {
@ -474,6 +482,68 @@ class TrafRequestDataModel {
data['modifiedDate'] = this.modifiedDate;
return data;
}
Map<String, dynamic> toJsonNew() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['reqNo'] = reqNo;
data['reqCode'] = reqCode;
data['employeeId'] = employeeId;
data['positionId'] = positionId;
data['departments'] =
departments?.map((v) => v.toJson()).toList() ?? [];
if (this.trafDepartments != null) {
data['trafDepartments'] = this.trafDepartments!.map((v) => v.toJson()).toList();
}
data['siteId'] = siteId;
data['departmentId'] = departmentId;
data['siteName'] = siteName;
data['requesterExtensionNumber'] = requesterExtensionNumber;
data['requesterExtensionName'] = requesterExtensionName;
data['requesterExtensionPositionId'] = requesterExtensionPositionId;
data['requestTypeId'] = requestTypeId;
data['assetNDId'] = assetNDId;
data['assetId'] = assetId;
data['qty'] = qty;
data['purposeAnswer'] = purposeAnswer;
data['currentPractise'] = currentPractise;
data['censusQ1'] = censusQ1;
data['censusQ2'] = censusQ2;
data['censusQ3'] = censusQ3;
data['censusQ4'] = censusQ4;
data['isFromMobile'] = isFromMobile;
data['trafContacts'] =
trafContacts?.map((v) => v.toJson()).toList() ?? [];
data['usingSolelyOrSharedId'] = usingSolelyOrSharedId;
data['isEffectedId'] = isEffectedId;
data['effectedServices'] = effectedServices;
data['isCombinationId'] = isCombinationId;
data['usedWithCombination'] = usedWithCombination;
data['comment'] = comment;
data['isBudgetId'] = isBudgetId;
data['attachments'] =
attachments?.map((v) => v.toJson()).toList() ?? [];
return data;
}
}
class TrafContacts {

@ -147,10 +147,15 @@ class CreateRequestModel {
// list.add(CreateRequestModel('Demo Request'.addTranslation, "add_icon", CreateDemoRequestPage.id));
}
}
// if (context.settingProvider.isUserFlowMedical && (context.userProvider.isAssessor || context.userProvider.isEngineer || context.userProvider.isNurse)) {
// //Traf name changed to Assessment of Need & Technology by client .
// list.add(CreateRequestModel("Assessment of Need & Technology".addTranslation, "add_icon", CreateTRAFRequestPage.id));
// }
context.userProvider.modulesPermissionsList.forEach((module) {
///TODO uncommit this to enable TRAF in production.
if (module.module!.value! == 9 && (module.canAdd ?? false)) {
list.add(CreateRequestModel("TRAF".addTranslation, "add_icon", CreateTRAFRequestPage.id));
list.add(CreateRequestModel(module.module?.name ?? "Assessment of Need & Technology".addTranslation, "add_icon", CreateTRAFRequestPage.id));
}
if (module.module!.value! == 15 && (module.canAdd ?? false)) {
list.add(CreateRequestModel('Demo Request'.addTranslation, "add_icon", CreateDemoRequestPage.id));

@ -95,7 +95,7 @@ class _LandPageState extends State<LandPage> {
Navigator.pop(context);
Navigator.of(context).pushNamed(SettingsPage.id);
},
label: "Enable".addTranslation),
label: "Continue".addTranslation),
],
)),
),

@ -120,7 +120,9 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
///TODO need add accessor filter as well.
if (context.settingProvider.isUserFlowMedical && context.userProvider.isAssessor) {
types = {
'TRAF': 9,
// 'TRAF': 9,
//Traf name changed as per client requirements
'Assessment of Need & Technology': 9,
// 'Demo': 15, moved to permission api
};
}

@ -58,13 +58,14 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
// switching asset inventory to users permissions
context.userProvider.modulesPermissionsList.forEach((module) {
///todo uncommit this in prod currently apis is not giving the correct name for traf
if (module.module!.value! == 8 || module.module!.value! == 9 || module.module!.value! == 15) {
requestsList.add(Request(module.module!.value!, module.module!.name!.addTranslation));
}
});
//Hide TRAF.
// if (context.settingProvider.isUserFlowMedical && context.userProvider.user!.type == UsersTypes.normal_user) {
// requestsList.add(Request(9, 'TRAF'));
// requestsList.add(Request(9, 'Assessment of Need & Technology'));
// }
if (context.userProvider.isEngineer && context.settingProvider.isUserFlowMedical) {
requestsList.add(Request(10, 'Equipment Internal Audit'));
@ -82,7 +83,9 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
if (context.userProvider.isAssessor) {
requestsList = [
Request(null, context.translation.allWorkOrder),
Request(9, 'TRAF'),
// Request(9, 'TRAF'),
//name changed as requested by client
Request(9, 'Assessment of Need & Technology'),
// Request(15, 'Demo'), moved to permission api
];
}

@ -0,0 +1,37 @@
import 'dart:convert';
import 'package:http/http.dart';
import 'package:test_sa/models/new_models/traf_customer.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
import '../../controllers/api_routes/api_manager.dart';
import '../../controllers/api_routes/urls.dart';
class CustomerLookupProvider extends LoadingListNotifier<TrafCustomer> {
@override
Future getData({int? id}) async {}
Future getDataByUserId(String? userId) async {
if (loading == true) return -2;
if (userId == null || userId.isEmpty) return -1;
loading = true;
notifyListeners();
try {
Response response = await ApiManager.instance.get(URLs.getCustomersByUserId + "?userId=$userId", useCache: true, enableToastMessage: false);
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
List categoriesListJson = json.decode(response.body)["data"];
items = categoriesListJson.map((item) => TrafCustomer.fromJson(item)).toList();
}
loading = false;
notifyListeners();
return response.statusCode;
} catch (error) {
loading = false;
stateCode = -1;
notifyListeners();
return -1;
}
}
}

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.6+41
version: 1.7.7+42
environment:
sdk: ">=3.5.0 <4.0.0"

Loading…
Cancel
Save