|
|
|
|
@ -55,7 +55,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
GasRefillModel _formModel = GasRefillModel(gazRefillDetails: []);
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
bool _firstTime = true;
|
|
|
|
|
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
Lookup _deliveredQuantity;
|
|
|
|
|
|
|
|
|
|
static List<Lookup> deliveredQuantity = [
|
|
|
|
|
@ -137,7 +137,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
setState(() {});
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
_currentDetails.gasType = _formModel.gazRefillDetails[0].gasType;
|
|
|
|
|
_currentDetails.cylinderSize = _formModel.gazRefillDetails[0].cylinderSize;
|
|
|
|
|
_currentDetails.cylinderType = _formModel.gazRefillDetails[0].cylinderType;
|
|
|
|
|
@ -198,129 +198,132 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: DefaultAppBar(title: context.translation.updateRequest),
|
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
body: SafeArea(
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _isLoading,
|
|
|
|
|
isFailedLoading: false,
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.gasRefill.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
'${context.translation.gasRequest}: ${widget.gasRefillModel.gazRefillDetails[0].gasType.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderType}: ${widget.gasRefillModel.gazRefillDetails[0].cylinderType.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderSize}: ${widget.gasRefillModel.gazRefillDetails[0].cylinderSize.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.quantity}: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty ?? 0}'.bodyText(context),
|
|
|
|
|
'${context.translation.site}: ${widget.gasRefillModel.site?.name}'.bodyText(context),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
8.height,
|
|
|
|
|
AppTimer(
|
|
|
|
|
label: context.translation.workingHours,
|
|
|
|
|
timer: _formModel.timer,
|
|
|
|
|
enabled: _formModel.endDate == null,
|
|
|
|
|
onChange: (timer) async {
|
|
|
|
|
_formModel.timer = timer;
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, GasStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.requestStatus,
|
|
|
|
|
initialValue: _formModel.status,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value?.value == 0) {
|
|
|
|
|
"Status cannot be change to ${value.name}.".addTranslation.showToast;
|
|
|
|
|
setState(() {});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (value != null) {
|
|
|
|
|
_formModel.status = value;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.quantity,
|
|
|
|
|
initialValue: _deliveredQuantity,
|
|
|
|
|
staticData: deliveredQuantity,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
_deliveredQuantity = value;
|
|
|
|
|
_currentDetails.deliverdQty = value.value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// initialValue: _formModel.gazRefillDetails[0]?.deliverdQty?.toString(),
|
|
|
|
|
// labelText: context.translation.deliveredQuantity,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _currentDetails?.deliverdQty = double.tryParse(value);
|
|
|
|
|
// },
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// controller: _deliveredQuantityController,
|
|
|
|
|
// validator: (value) => value == null || value.isEmpty
|
|
|
|
|
// ? context.translation.requiredField
|
|
|
|
|
// : Validator.isNumeric(value)
|
|
|
|
|
// ? null
|
|
|
|
|
// : context.translation.onlyNumbers,
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
body: Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
isLoading: _isLoading,
|
|
|
|
|
isFailedLoading: false,
|
|
|
|
|
stateCode: 200,
|
|
|
|
|
onRefresh: () async {},
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
SingleChildScrollView(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
context.translation.gasRefill.heading5(context),
|
|
|
|
|
8.height,
|
|
|
|
|
'${context.translation.gasRequest}: ${widget.gasRefillModel.gazRefillDetails[0].gasType.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderType}: ${widget.gasRefillModel.gazRefillDetails[0].cylinderType.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.cylinderSize}: ${widget.gasRefillModel.gazRefillDetails[0].cylinderSize.name}'.bodyText(context),
|
|
|
|
|
'${context.translation.quantity}: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty ?? 0}'.bodyText(context),
|
|
|
|
|
'${context.translation.site}: ${widget.gasRefillModel.site?.name}'.bodyText(context),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context),
|
|
|
|
|
8.height,
|
|
|
|
|
AppTimer(
|
|
|
|
|
label: context.translation.workingHours,
|
|
|
|
|
timer: _formModel.timer,
|
|
|
|
|
enabled: _formModel.endDate == null,
|
|
|
|
|
onChange: (timer) async {
|
|
|
|
|
_formModel.timer = timer;
|
|
|
|
|
return true;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, GasStatusProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.requestStatus,
|
|
|
|
|
initialValue: _formModel.status,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
if (value?.value == 0) {
|
|
|
|
|
"Status cannot be change to ${value.name}.".addTranslation.showToast;
|
|
|
|
|
setState(() {});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (value != null) {
|
|
|
|
|
_formModel.status = value;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
|
|
|
|
|
context: context,
|
|
|
|
|
title: context.translation.quantity,
|
|
|
|
|
initialValue: _deliveredQuantity,
|
|
|
|
|
staticData: deliveredQuantity,
|
|
|
|
|
onSelect: (value) {
|
|
|
|
|
_deliveredQuantity = value;
|
|
|
|
|
_currentDetails.deliverdQty = value.value;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// initialValue: _formModel.gazRefillDetails[0]?.deliverdQty?.toString(),
|
|
|
|
|
// labelText: context.translation.deliveredQuantity,
|
|
|
|
|
// onSaved: (value) {
|
|
|
|
|
// _currentDetails?.deliverdQty = double.tryParse(value);
|
|
|
|
|
// },
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// controller: _deliveredQuantityController,
|
|
|
|
|
// validator: (value) => value == null || value.isEmpty
|
|
|
|
|
// ? context.translation.requiredField
|
|
|
|
|
// : Validator.isNumeric(value)
|
|
|
|
|
// ? null
|
|
|
|
|
// : context.translation.onlyNumbers,
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
|
controller: _commentController,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ESignature(
|
|
|
|
|
title: "Engineer Signature",
|
|
|
|
|
oldSignature: widget.gasRefillModel.engSignature,
|
|
|
|
|
newSignature: _engineerSignature,
|
|
|
|
|
onSaved: (signature) {
|
|
|
|
|
_engineerSignature = signature;
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
_formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
//base64Encode(signature);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ESignature(
|
|
|
|
|
title: "Nurse Signature",
|
|
|
|
|
oldSignature: widget.gasRefillModel.nurseSignature,
|
|
|
|
|
newSignature: _nurseSignature,
|
|
|
|
|
onSaved: (signature) {
|
|
|
|
|
_nurseSignature = signature;
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
_formModel.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
//base64Encode(signature);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
_onSubmit.call(context);
|
|
|
|
|
},
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
/// TBD
|
|
|
|
|
AppTextFormField(
|
|
|
|
|
labelText: context.translation.comments,
|
|
|
|
|
textInputType: TextInputType.multiline,
|
|
|
|
|
alignLabelWithHint: true,
|
|
|
|
|
controller: _commentController,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ESignature(
|
|
|
|
|
title: "Engineer Signature",
|
|
|
|
|
oldSignature: widget.gasRefillModel.engSignature,
|
|
|
|
|
newSignature: _engineerSignature,
|
|
|
|
|
onSaved: (signature) {
|
|
|
|
|
_engineerSignature = signature;
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
_formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
//base64Encode(signature);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
ESignature(
|
|
|
|
|
title: "Nurse Signature",
|
|
|
|
|
oldSignature: widget.gasRefillModel.nurseSignature,
|
|
|
|
|
newSignature: _nurseSignature,
|
|
|
|
|
onSaved: (signature) {
|
|
|
|
|
_nurseSignature = signature;
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
_formModel.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
//base64Encode(signature);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
_onSubmit.call(context);
|
|
|
|
|
},
|
|
|
|
|
).paddingAll(16),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|