|
|
|
@ -44,98 +44,99 @@ class _AddSupplierEngineerBottomSheetState extends State<AddSupplierEngineerBott
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
return Wrap(
|
|
|
|
return SafeArea(
|
|
|
|
children: [
|
|
|
|
child: Wrap(
|
|
|
|
Form(
|
|
|
|
children: [
|
|
|
|
key: _formKey,
|
|
|
|
Form(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
key: _formKey,
|
|
|
|
child: Column(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
children: [
|
|
|
|
child: Column(
|
|
|
|
Container(
|
|
|
|
children: [
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
Container(
|
|
|
|
height: 5.toScreenHeight,
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
|
|
|
|
height: 5.toScreenHeight,
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
|
|
|
|
Align(
|
|
|
|
),
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
Align(
|
|
|
|
child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16),
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
),
|
|
|
|
child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16),
|
|
|
|
8.height,
|
|
|
|
),
|
|
|
|
AppTextFormField(
|
|
|
|
12.height,
|
|
|
|
labelText: "Engineer Supplier Name".addTranslation,
|
|
|
|
AppTextFormField(
|
|
|
|
textInputType: TextInputType.name,
|
|
|
|
labelText: "Engineer Supplier Name".addTranslation,
|
|
|
|
onChange: (text) {
|
|
|
|
textInputType: TextInputType.name,
|
|
|
|
engineer.personName = text.isEmpty ? null : text;
|
|
|
|
onChange: (text) {
|
|
|
|
},
|
|
|
|
engineer.personName = text.isEmpty ? null : text;
|
|
|
|
onSaved: (text) {
|
|
|
|
},
|
|
|
|
engineer.personName = text.isEmpty ? null : text;
|
|
|
|
onSaved: (text) {
|
|
|
|
},
|
|
|
|
engineer.personName = text.isEmpty ? null : text;
|
|
|
|
),
|
|
|
|
},
|
|
|
|
8.height,
|
|
|
|
),
|
|
|
|
SingleItemDropDownMenu<Lookup, SupplierEngineerProvider>(
|
|
|
|
12.height,
|
|
|
|
context: context,
|
|
|
|
SingleItemDropDownMenu<Lookup, SupplierEngineerProvider>(
|
|
|
|
title: "Role",
|
|
|
|
context: context,
|
|
|
|
initialValue: suppEngRole,
|
|
|
|
title: "Role",
|
|
|
|
onSelect: (value) {
|
|
|
|
initialValue: suppEngRole,
|
|
|
|
if (value != null) {
|
|
|
|
onSelect: (value) {
|
|
|
|
suppEngRole = value;
|
|
|
|
if (value != null) {
|
|
|
|
}
|
|
|
|
suppEngRole = value;
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
labelText: "Contact".addTranslation,
|
|
|
|
|
|
|
|
textInputType: TextInputType.name,
|
|
|
|
|
|
|
|
onChange: (text) {
|
|
|
|
|
|
|
|
engineer.contact = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSaved: (text) {
|
|
|
|
|
|
|
|
engineer.contact = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
labelText: "Email".addTranslation,
|
|
|
|
|
|
|
|
textInputType: TextInputType.emailAddress,
|
|
|
|
|
|
|
|
onChange: (text) {
|
|
|
|
|
|
|
|
engineer.email = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSaved: (text) {
|
|
|
|
|
|
|
|
engineer.email = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
16.height,
|
|
|
|
|
|
|
|
Consumer<ServiceRequestsProvider>(
|
|
|
|
|
|
|
|
builder: (context, snapshot, _) => AppFilledButton(
|
|
|
|
|
|
|
|
label: context.translation.save,
|
|
|
|
|
|
|
|
loading: snapshot.isLoading ?? false,
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
_formKey.currentState!.save();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (engineer.personName?.isEmpty ?? true) {
|
|
|
|
|
|
|
|
"Engineer supplier name is empty".showToast;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
12.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
labelText: "Contact".addTranslation,
|
|
|
|
|
|
|
|
textInputType: TextInputType.name,
|
|
|
|
|
|
|
|
onChange: (text) {
|
|
|
|
|
|
|
|
engineer.contact = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSaved: (text) {
|
|
|
|
|
|
|
|
engineer.contact = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
12.height,
|
|
|
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
|
|
|
labelText: "Email".addTranslation,
|
|
|
|
|
|
|
|
textInputType: TextInputType.emailAddress,
|
|
|
|
|
|
|
|
onChange: (text) {
|
|
|
|
|
|
|
|
engineer.email = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onSaved: (text) {
|
|
|
|
|
|
|
|
engineer.email = text.isEmpty ? null : text;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
24.height,
|
|
|
|
|
|
|
|
Consumer<ServiceRequestsProvider>(
|
|
|
|
|
|
|
|
builder: (context, snapshot, _) => AppFilledButton(
|
|
|
|
|
|
|
|
label: context.translation.save,
|
|
|
|
|
|
|
|
loading: snapshot.isLoading ?? false,
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
_formKey.currentState!.save();
|
|
|
|
|
|
|
|
|
|
|
|
engineer.personRoleId = suppEngRole?.id;
|
|
|
|
if (engineer.personName?.isEmpty ?? true) {
|
|
|
|
|
|
|
|
"Engineer supplier name is empty".showToast;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer);
|
|
|
|
engineer.personRoleId = suppEngRole?.id;
|
|
|
|
if (suppEngineer == null) {
|
|
|
|
|
|
|
|
Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest);
|
|
|
|
SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer);
|
|
|
|
return;
|
|
|
|
if (suppEngineer == null) {
|
|
|
|
}
|
|
|
|
Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest);
|
|
|
|
Fluttertoast.showToast(msg: context.translation.successfulRequestMessage);
|
|
|
|
return;
|
|
|
|
Navigator.pop(context, suppEngineer);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
Fluttertoast.showToast(msg: context.translation.successfulRequestMessage);
|
|
|
|
|
|
|
|
Navigator.pop(context, suppEngineer);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
16.height,
|
|
|
|
16.height,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|