chat employee id changes.

design_3.0_medical_gas
Sikander Saleem 3 weeks ago
parent 267a4445d1
commit df8d22f792

@ -53,90 +53,88 @@ class _MedicalGasInspectionDetailPageState extends State<MedicalGasInspectionDet
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const DefaultAppBar(title: "Request Details"), appBar: const DefaultAppBar(title: "Request Details"),
body: SafeArea( body: _isLoading
child: _isLoading ? SizedBox.expand(child: const CircularProgressIndicator(color: AppColor.primary10).center)
? SizedBox.expand(child: const CircularProgressIndicator(color: AppColor.primary10).center) : model == null
: model == null ? const NoDataFound().center
? const NoDataFound().center : Column(
: Column( children: [
children: [ ListView(
ListView( padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16), children: [
children: [ Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ //Need to return the status form api backend
//Need to return the status form api backend Row(
Row( children: [
children: [ if (widget.prority != null) ...[
if (widget.prority != null) ...[
StatusLabel(
label: widget.prority,
textColor: AppColor.getRequestStatusTextColorByName(context, widget.prority),
backgroundColor: AppColor.getRequestStatusColorByName(context, widget.prority),
),
8.width,
],
StatusLabel( StatusLabel(
label: model?.requestStatus?.name, label: widget.prority,
textColor: AppColor.getHistoryLogStatusTextColorByName(model?.requestStatus?.name ?? ''), textColor: AppColor.getRequestStatusTextColorByName(context, widget.prority),
backgroundColor: AppColor.getHistoryLogStatusColorByName(model?.requestStatus?.name ?? ''), backgroundColor: AppColor.getRequestStatusColorByName(context, widget.prority),
), ),
1.width.expanded, 8.width,
Text(model!.requestedDate!.toServiceRequestCardFormat,
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50))
], ],
), StatusLabel(
8.height, label: model?.requestStatus?.name,
Text("Request Details", style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50)), textColor: AppColor.getHistoryLogStatusTextColorByName(model?.requestStatus?.name ?? ''),
'${context.translation.requestNo}: ${model?.requestNumber ?? '-'}'.bodyText(context), backgroundColor: AppColor.getHistoryLogStatusColorByName(model?.requestStatus?.name ?? ''),
'Requested by: ${model?.requestedBy ?? '-'}'.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),
'Supplier Name: ${model?.supplier ?? '-'}'.bodyText(context),
'Supplier Contact: ${model?.contact ?? '-'}'.bodyText(context),
'Supplier Email: ${model?.email ?? '-'}'.bodyText(context),
if (model!.deliveryNoteAttachmentDto.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
), ),
FilesList(images: model!.deliveryNoteAttachmentDto.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []), 1.width.expanded,
Text(model!.requestedDate!.toServiceRequestCardFormat,
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50))
], ],
),
8.height,
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),
'Order Type: ${model?.requestOrderType ?? '-'}'.bodyText(context),
'Item Type: ${model?.itemType ?? '-'}'.bodyText(context),
'Site: ${model?.site ?? '-'}'.bodyText(context),
'Supplier Name: ${model?.supplier ?? '-'}'.bodyText(context),
'Supplier Contact: ${model?.contact ?? '-'}'.bodyText(context),
'Supplier Email: ${model?.email ?? '-'}'.bodyText(context),
if (model!.deliveryNoteAttachmentDto.isNotEmpty) ...[
const Divider().defaultStyle(context),
Text(
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
FilesList(images: model!.deliveryNoteAttachmentDto.map((e) => URLs.getFileUrl(e.name ?? '') ?? '').toList() ?? []),
], ],
).toShadowContainer(context, padding: 12), ],
], ).toShadowContainer(context, padding: 12),
).expanded, ],
if (model?.requestStatus?.value != null && model!.requestStatus!.value! < 3) ).expanded,
FooterActionButton.footerContainer( if (model?.requestStatus?.value != null && model!.requestStatus!.value! < 3)
context: context, FooterActionButton.footerContainer(
child: AppFilledButton( context: context,
buttonColor: AppColor.primary10, child: AppFilledButton(
label: model?.isSubmitted == true ? "Upload Delivery Note" : 'Update', buttonColor: AppColor.primary10,
onPressed: () async { label: model?.isSubmitted == true ? "Upload Delivery Note" : 'Update',
if (model?.isSubmitted == true) { onPressed: () async {
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeliveryNotes(dataModel: model))); if (model?.isSubmitted == true) {
if (isRefresh == true) { bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeliveryNotes(dataModel: model)));
_loadData();
}
return;
}
bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(
builder: (_) => CreateMedicalGasRequestPage(
dataModel: model,
)));
if (isRefresh == true) { if (isRefresh == true) {
_loadData(); _loadData();
} }
}), return;
), }
], bool? isRefresh = await Navigator.of(context).push(MaterialPageRoute(
), builder: (_) => CreateMedicalGasRequestPage(
)); dataModel: model,
)));
if (isRefresh == true) {
_loadData();
}
}),
),
],
));
} }
Widget labelValueText(BuildContext context, String label, String? value) { Widget labelValueText(BuildContext context, String label, String? value) {

@ -80,211 +80,209 @@ class _UpdateDeliveryNotesState extends State<UpdateDeliveryNotes> {
// _update(context: context); // _update(context: context);
// }, // },
), ),
body: SafeArea( body: Form(
child: Form( key: _formKey,
key: _formKey, child: Column(
child: Column( children: [
children: [ ListView(
ListView( padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(16), children: [
children: [ Column(
Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ ADatePicker(
ADatePicker( label: "Delivered Date",
label: "Delivered Date", hideShadow: true,
hideShadow: true, backgroundColor: AppColor.fieldBgColor(context),
backgroundColor: AppColor.fieldBgColor(context), from: DateTime.now().subtract(const Duration(days: 365 * 3)),
from: DateTime.now().subtract(const Duration(days: 365 * 3)), date: formModel.deliveredDate,
date: formModel.deliveredDate, formatDateWithTime: true,
formatDateWithTime: true, onDatePicker: (selectedDate) {
onDatePicker: (selectedDate) { showTimePicker(
showTimePicker( context: context,
context: context, initialTime: TimeOfDay.now(),
initialTime: TimeOfDay.now(), ).then((selectedTime) {
).then((selectedTime) { if (selectedTime != null) {
if (selectedTime != null) { formModel.deliveredDate = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute);
formModel.deliveredDate = DateTime(selectedDate.year, selectedDate.month, selectedDate.day, selectedTime.hour, selectedTime.minute); setState(() {});
setState(() {}); }
} });
}); },
}, ),
), 16.height,
16.height, AppTextFormField(
AppTextFormField( initialValue: formModel.deliveryNoteNumber,
initialValue: formModel.deliveryNoteNumber, labelText: "Delivery Notes",
labelText: "Delivery Notes", // validator: (value) {
// validator: (value) { // if ((value ?? "").isEmpty) return "Delivery Notes Required";
// if ((value ?? "").isEmpty) return "Delivery Notes Required"; // return null;
// return null; // },
// }, backgroundColor: AppColor.fieldBgColor(context),
backgroundColor: AppColor.fieldBgColor(context), labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
floatingLabelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)), showShadow: false,
showShadow: false, textInputType: TextInputType.multiline,
textInputType: TextInputType.multiline, makeMultiLinesNull: true,
makeMultiLinesNull: true, onChange: (value) {
onChange: (value) { formModel.deliveryNoteNumber = value;
formModel.deliveryNoteNumber = value; },
}, ),
), 16.height,
16.height,
//Older design code
// MultipleItemDropDownMenu<MedicalGasRequestDetailModel, NullableLoadingProvider>(
// context: context,
// showAsBottomSheet: true,
// backgroundColor: AppColor.neutral100,
// showShadow: false,
// showCancel: true,
// requestById: context.userProvider.user?.clientId,
// title: 'Delivered Items'.addTranslation,
// staticData: formModel.deliveredItemList,
// initialValue: selectedItemList,
// onSelect: (value) {
// if ((value ?? []).isNotEmpty) {
// WidgetsBinding.instance.addPostFrameCallback((_) {
// if (!mounted) return;
// setState(() {
// selectedItemList = value ?? [];
// });
// });
// }
// },
// ),
// if (selectedItemList.isNotEmpty) ...[
// 8.height,
// ListView.separated(
// separatorBuilder: (_, __) => 12.height,
// itemCount: selectedItemList.length,
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// itemBuilder: (context, index) {
// MedicalGasRequestDetailModel model = selectedItemList[index];
// return AppTextFormField(
// labelText: '${model.name} (Req Qty =${model.requestedQuantity})',
// hintText: 'Enter Delivered Quantity'.addTranslation,
// backgroundColor: AppColor.fieldBgColor(context),
// initialValue: model.deliveredQuantity != null ? model.deliveredQuantity?.toInt().toString() : '',
// textAlign: TextAlign.center,
// enable: true,
// textInputType: TextInputType.number,
// labelStyle: AppTextStyles.textFieldLabelStyle,
// showShadow: false,
// onChange: (value) {
// if (value.isNotEmpty) {
// model.deliveredQuantity = double.tryParse(value);
// }
// },
// style: Theme.of(context).textTheme.titleMedium,
// );
// },
// )
// ],
if (formModel.deliveredItemList.isNotEmpty) ...[
_ItemRowLayout(
left: 'Items'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)),
right: 'Delivered Qty'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)),
),
8.height,
ListView.separated(
separatorBuilder: (_, __) => 12.height,
itemCount: formModel.deliveredItemList.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
MedicalGasRequestDetailModel model = formModel.deliveredItemList[index];
return itemQuantityFieldWidget(index: index, model: model, context: context);
},
)
],
16.height,
AttachmentPicker( //Older design code
label: 'Upload Attachment', // MultipleItemDropDownMenu<MedicalGasRequestDetailModel, NullableLoadingProvider>(
attachment: formModel.attachments, // context: context,
buttonColor: AppColor.primary10, // showAsBottomSheet: true,
// showAsListView: true, // backgroundColor: AppColor.neutral100,
onlyImages: false, // showShadow: false,
buttonIcon: 'attachment_icon'.toSvgAsset( // showCancel: true,
color: AppColor.primary10, // requestById: context.userProvider.user?.clientId,
), // title: 'Delivered Items'.addTranslation,
), // staticData: formModel.deliveredItemList,
16.height, // initialValue: selectedItemList,
//should create a reusable widget. // onSelect: (value) {
Row( // if ((value ?? []).isNotEmpty) {
children: [ // WidgetsBinding.instance.addPostFrameCallback((_) {
Checkbox( // if (!mounted) return;
value: formModel.isPressureChecked, // setState(() {
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), // selectedItemList = value ?? [];
activeColor: AppColor.blueStatus(context), // });
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // });
onChanged: (value) { // }
setState(() { // },
formModel.isPressureChecked = value!; // ),
}); // if (selectedItemList.isNotEmpty) ...[
}), // 8.height,
12.width, // ListView.separated(
"I Acknowledge that the received medical gases cylinders have been tested for pressure." // separatorBuilder: (_, __) => 12.height,
.addTranslation // itemCount: selectedItemList.length,
.bodyText(context) // shrinkWrap: true,
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120) // physics: const NeverScrollableScrollPhysics(),
.expanded, // itemBuilder: (context, index) {
], // MedicalGasRequestDetailModel model = selectedItemList[index];
// return AppTextFormField(
// labelText: '${model.name} (Req Qty =${model.requestedQuantity})',
// hintText: 'Enter Delivered Quantity'.addTranslation,
// backgroundColor: AppColor.fieldBgColor(context),
// initialValue: model.deliveredQuantity != null ? model.deliveredQuantity?.toInt().toString() : '',
// textAlign: TextAlign.center,
// enable: true,
// textInputType: TextInputType.number,
// labelStyle: AppTextStyles.textFieldLabelStyle,
// showShadow: false,
// onChange: (value) {
// if (value.isNotEmpty) {
// model.deliveredQuantity = double.tryParse(value);
// }
// },
// style: Theme.of(context).textTheme.titleMedium,
// );
// },
// )
// ],
if (formModel.deliveredItemList.isNotEmpty) ...[
_ItemRowLayout(
left: 'Items'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)),
right: 'Delivered Qty'.addTranslation.bodyText(context).custom(color: AppColor.textColor(context)),
), ),
8.height, 8.height,
Row( ListView.separated(
// mainAxisAlignment: MainAxisAlignment.start, separatorBuilder: (_, __) => 12.height,
crossAxisAlignment: CrossAxisAlignment.start, itemCount: formModel.deliveredItemList.length,
children: [ shrinkWrap: true,
Checkbox( physics: const NeverScrollableScrollPhysics(),
value: formModel.isInspectedGasLeak, itemBuilder: (context, index) {
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), MedicalGasRequestDetailModel model = formModel.deliveredItemList[index];
activeColor: AppColor.blueStatus(context), return itemQuantityFieldWidget(index: index, model: model, context: context);
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, },
onChanged: (value) { )
setState(() {
formModel.isInspectedGasLeak = value!;
});
}),
12.width,
"I Acknowledge that the received medical gases cylinders have been inspected for leak test."
.addTranslation
.bodyText(context)
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
.expanded,
],
),
], ],
).toShadowContainer(context, padding: 12), 16.height,
],
).expanded, AttachmentPicker(
FooterActionButton.footerContainer( label: 'Upload Attachment',
context: context, attachment: formModel.attachments,
child: Row(
children: [
AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Save'.addTranslation,
onPressed: () {
_update(context: context);
},
// buttonColor: AppColor.primary10,
).expanded,
8.width,
AppFilledButton(
buttonColor: AppColor.primary10, buttonColor: AppColor.primary10,
label: 'Submit'.addTranslation, // showAsListView: true,
onPressed: () { onlyImages: false,
_update(context: context, isSubmitted: true); buttonIcon: 'attachment_icon'.toSvgAsset(
}, color: AppColor.primary10,
// buttonColor: AppColor.primary10, ),
).expanded, ),
16.height,
//should create a reusable widget.
Row(
children: [
Checkbox(
value: formModel.isPressureChecked,
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
activeColor: AppColor.blueStatus(context),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (value) {
setState(() {
formModel.isPressureChecked = value!;
});
}),
12.width,
"I Acknowledge that the received medical gases cylinders have been tested for pressure."
.addTranslation
.bodyText(context)
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
.expanded,
],
),
8.height,
Row(
// mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Checkbox(
value: formModel.isInspectedGasLeak,
visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0),
activeColor: AppColor.blueStatus(context),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (value) {
setState(() {
formModel.isInspectedGasLeak = value!;
});
}),
12.width,
"I Acknowledge that the received medical gases cylinders have been inspected for leak test."
.addTranslation
.bodyText(context)
.custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)
.expanded,
],
),
], ],
), ).toShadowContainer(context, padding: 12),
],
).expanded,
FooterActionButton.footerContainer(
context: context,
child: Row(
children: [
AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Save'.addTranslation,
onPressed: () {
_update(context: context);
},
// buttonColor: AppColor.primary10,
).expanded,
8.width,
AppFilledButton(
buttonColor: AppColor.primary10,
label: 'Submit'.addTranslation,
onPressed: () {
_update(context: context, isSubmitted: true);
},
// buttonColor: AppColor.primary10,
).expanded,
],
), ),
], ),
), ],
), ),
)); ));
// .handlePopScope( // .handlePopScope(

@ -228,7 +228,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
requestId: widget.model.id!.toInt(), requestId: widget.model.id!.toInt(),
assigneeEmployeeNumber: _model!.senderAssignedEmployeeNumber, assigneeEmployeeNumber: _model!.senderAssignedEmployeeNumber,
myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!, myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!,
contactEmployeeINumber: _model!.assetTransferContactPersons!.first.employeeNumber, contactEmployeeINumber: _model!.assetTransferContactPersons!.first.employeeId ?? _model!.assetTransferContactPersons!.first.employeeNumber,
), ),
if ((_userProvider!.user?.type == UsersTypes.engineer)) if ((_userProvider!.user?.type == UsersTypes.engineer))
if (isCurrentEngineerEligibleForEdit && isCurrentRequestEditAble) if (isCurrentEngineerEligibleForEdit && isCurrentRequestEditAble)
@ -289,7 +289,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
requestId: widget.model.id!.toInt(), requestId: widget.model.id!.toInt(),
assigneeEmployeeNumber: isSender ? _deviceTransfer.senderAssignedEmployeeNumber! : _deviceTransfer.receiverAssignedEmployeeNumber!, assigneeEmployeeNumber: isSender ? _deviceTransfer.senderAssignedEmployeeNumber! : _deviceTransfer.receiverAssignedEmployeeNumber!,
myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!, myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!,
contactEmployeeINumber: _deviceTransfer.assetTransferContactPersons!.first.employeeNumber, contactEmployeeINumber: _model!.assetTransferContactPersons!.first.employeeId ?? _deviceTransfer.assetTransferContactPersons!.first.employeeNumber,
), ),
if ((_userProvider!.user?.type == UsersTypes.engineer)) if ((_userProvider!.user?.type == UsersTypes.engineer))
if (isCurrentEngineerEligibleForEdit && !isCurrentRequestClosed) if (isCurrentEngineerEligibleForEdit && !isCurrentRequestClosed)

@ -73,7 +73,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
requestId: widget.model.id!.toInt(), requestId: widget.model.id!.toInt(),
assigneeEmployeeNumber: _gasRefillModel.assignedEmployee?.employeeId!, assigneeEmployeeNumber: _gasRefillModel.assignedEmployee?.employeeId!,
myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!, myLoginUserID: context.userProvider.user!.employeeId ?? context.userProvider.user!.username!,
contactEmployeeINumber: _gasRefillModel.gasRefillContactPerson!.first.employeeCode!, contactEmployeeINumber: _gasRefillModel.gasRefillContactPerson!.first.employeeId ?? _gasRefillModel.gasRefillContactPerson!.first.employeeCode!,
); );
}) })
], ],

@ -254,7 +254,6 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
8.height,
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>( SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
context: context, context: context,
title: context.translation.quantity, title: context.translation.quantity,

@ -116,11 +116,9 @@ class CreateRequestModel {
if (context.userProvider.isQualityUser && context.settingProvider.isUserFlowMedical) { if (context.userProvider.isQualityUser && context.settingProvider.isUserFlowMedical) {
list.add(CreateRequestModel("Equipment Internal Audit Checklist".addTranslation, "add_icon", CreateEquipmentInternalAuditForm.id)); list.add(CreateRequestModel("Equipment Internal Audit Checklist".addTranslation, "add_icon", CreateEquipmentInternalAuditForm.id));
list.add(CreateRequestModel("System Internal Audit Checklist".addTranslation, "add_icon", CreateSystemInternalAuditForm.id)); list.add(CreateRequestModel("System Internal Audit Checklist".addTranslation, "add_icon", CreateSystemInternalAuditForm.id));
} } else if (context.userProvider.isAssessor) {
else if (context.userProvider.isAssessor) {
list.add(CreateRequestModel("TRAF".addTranslation, "add_icon", CreateTRAFRequestPage.id)); list.add(CreateRequestModel("TRAF".addTranslation, "add_icon", CreateTRAFRequestPage.id));
} } else if (context.userProvider.isEngineer) {
else if (context.userProvider.isEngineer) {
if (Provider.of<SettingProvider>(context, listen: false).engineerCanCreateCM) { if (Provider.of<SettingProvider>(context, listen: false).engineerCanCreateCM) {
list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id)); list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id));
} }
@ -128,16 +126,18 @@ class CreateRequestModel {
//TODO uncommit this to enable task. //TODO uncommit this to enable task.
list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id)); list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id));
//Need to add check from permission Api. //Need to add check from permission Api.
// if (Provider.of<SettingProvider>(context, listen: false).engineerCanCreateCM) { if ((context.settingProvider.isUserFlowMedical)) {
list.add(CreateRequestModel('Medical Gas'.addTranslation, "add_icon", CreateMedicalGasRequestPage.id)); list.add(CreateRequestModel('Medical Gas'.addTranslation, "add_icon", CreateMedicalGasRequestPage.id));
// } }
} else { } else {
list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id)); list.add(CreateRequestModel(context.translation.correctiveMaintenance, "add_icon", CreateCMRequest.id));
list.add(CreateRequestModel(context.translation.gasRefill, "add_icon", GasRefillRequestForm.routeName)); list.add(CreateRequestModel(context.translation.gasRefill, "add_icon", GasRefillRequestForm.routeName));
list.add(CreateRequestModel(context.translation.transferAsset, "add_icon", CreateDeviceTransferRequest.id)); list.add(CreateRequestModel(context.translation.transferAsset, "add_icon", CreateDeviceTransferRequest.id));
//TODO uncommit this to enable task. //TODO uncommit this to enable task.
list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id)); list.add(CreateRequestModel(context.translation.task, "add_icon", CreateTaskView.id));
list.add(CreateRequestModel("TRAF".addTranslation, "add_icon", CreateTRAFRequestPage.id)); if ((context.settingProvider.isUserFlowMedical)) {
list.add(CreateRequestModel("TRAF".addTranslation, "add_icon", CreateTRAFRequestPage.id));
}
// Hide Loan // Hide Loan
// list.add(CreateRequestModel('Loan Equipment Request'.addTranslation, "add_icon", CreateLoanRequestPage.id)); // list.add(CreateRequestModel('Loan Equipment Request'.addTranslation, "add_icon", CreateLoanRequestPage.id));
} }

@ -81,9 +81,9 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
if (isEngineer) { if (isEngineer) {
types[context.translation.recurrentWo] = 5; types[context.translation.recurrentWo] = 5;
if (context.settingProvider.isUserFlowMedical) types["Equipment Internal Audit".addTranslation] = 10; if (context.settingProvider.isUserFlowMedical) types["Equipment Internal Audit".addTranslation] = 10;
if (context.settingProvider.isUserFlowMedical) types["System Internal Audit".addTranslation] = 11; if (context.settingProvider.isUserFlowMedical) types["System Internal Audit".addTranslation] = 11;
if (context.settingProvider.isUserFlowMedical) types["Medical Gas Inspection".addTranslation] = 11; if (context.settingProvider.isUserFlowMedical) types["Medical Gas Inspection".addTranslation] = 11;
} }
if (context.settingProvider.isUserFlowMedical && isEngineer) { if (context.settingProvider.isUserFlowMedical && isEngineer) {
@ -97,17 +97,17 @@ class _AllRequestsFilterPageState extends State<AllRequestsFilterPage> {
} }
}); });
//Hide traf //Hide traf
if (!isEngineer) { if (!isEngineer && context.settingProvider.isUserFlowMedical) {
types['TRAF'] = 9; types['TRAF'] = 9;
} }
if (context.userProvider.isAssessor) { if (context.settingProvider.isUserFlowMedical && context.userProvider.isAssessor) {
types = {"TRAF": 9}; types = {"TRAF": 9};
} }
if (context.userProvider.isQualityUser) { if (context.userProvider.isQualityUser) {
if (context.settingProvider.isUserFlowMedical) types = {'Recall and Alert': 7}; if (context.settingProvider.isUserFlowMedical) types = {'Recall and Alert': 7};
if (context.settingProvider.isUserFlowMedical) types['Equipment Internal Audit'] = 10; if (context.settingProvider.isUserFlowMedical) types['Equipment Internal Audit'] = 10;
if (context.settingProvider.isUserFlowMedical) types['System Internal Audit'] = 11; if (context.settingProvider.isUserFlowMedical) types['System Internal Audit'] = 11;
} }
if (context.userProvider.isCommissioningEngineer) { if (context.userProvider.isCommissioningEngineer) {
///TODO need to check what other requests type needed here. ///TODO need to check what other requests type needed here.

@ -63,7 +63,7 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
} }
}); });
//Hide TRAF. //Hide TRAF.
if (context.userProvider.user!.type == UsersTypes.normal_user) { if (context.settingProvider.isUserFlowMedical && context.userProvider.user!.type == UsersTypes.normal_user) {
requestsList.add(Request(9, 'TRAF')); requestsList.add(Request(9, 'TRAF'));
} }
if (context.userProvider.isEngineer && context.settingProvider.isUserFlowMedical) { if (context.userProvider.isEngineer && context.settingProvider.isUserFlowMedical) {
@ -74,7 +74,6 @@ class _MyRequestsPageState extends State<MyRequestsPage> {
requestsList.add(Request(14, "Medical Gas Inspection")); requestsList.add(Request(14, "Medical Gas Inspection"));
} }
// Hide Loan // Hide Loan
// requestsList.add(Request(12, "Loan Equipment")); // requestsList.add(Request(12, "Loan Equipment"));

Loading…
Cancel
Save