|
|
|
|
@ -35,8 +35,7 @@ import '../../../../new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
|
import '../../../../new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import '../../../../new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
import '../../../../providers/gas_request_providers/gas_status_provider.dart';
|
|
|
|
|
import '../../../widgets/e_signature/e_signature.dart';
|
|
|
|
|
import '../../../widgets/timer/app_timer.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RequestGasRefill extends StatefulWidget {
|
|
|
|
|
static const String id = "/request-gas-refill";
|
|
|
|
|
@ -171,7 +170,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
if (_firstTime) {
|
|
|
|
|
String _clientName;
|
|
|
|
|
if (widget.gasRefillModel != null) {
|
|
|
|
|
_formModel.status = widget.gasRefillModel?.status ?? Lookup(value: 0);
|
|
|
|
|
//_formModel.status = widget.gasRefillModel?.status ?? Lookup(value: 0);
|
|
|
|
|
_gasRefillProvider.expectedDateTime = DateTime.tryParse(_formModel.expectedDate??"");
|
|
|
|
|
_gasRefillProvider.timer = TimerModel(startAt: DateTime.tryParse(widget.gasRefillModel?.startDate??""), endAt: DateTime.tryParse(widget.gasRefillModel?.endDate??""));
|
|
|
|
|
_clientName = _formModel.site.custName;
|
|
|
|
|
@ -287,380 +286,6 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// SingleChildScrollView(
|
|
|
|
|
// padding: EdgeInsets.all(12 * AppStyle.getScaleFactor(context)),
|
|
|
|
|
// child: Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// Center(
|
|
|
|
|
// child: Padding(
|
|
|
|
|
// padding: const EdgeInsets.all(8.0),
|
|
|
|
|
// child: Text(
|
|
|
|
|
// "${widget.gasRefillModel == null ? "Request" : "Update"} Gas Refill",
|
|
|
|
|
// style: Theme.of(context).textTheme.headline5.copyWith(color: Theme.of(context).primaryColor, fontSize: 28, fontWeight: FontWeight.bold),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// // const SizedBox(height: 4,),
|
|
|
|
|
// // ASubTitle(context.translation.title),
|
|
|
|
|
// // if(_validate && _formModel.title == null)
|
|
|
|
|
// // ASubTitle(context.translation.requiredWord,color: Colors.red,),
|
|
|
|
|
// // SizedBox(height: 4,),
|
|
|
|
|
// // ATextFormField(
|
|
|
|
|
// // initialValue: _formModel?.title,
|
|
|
|
|
// // textAlign: TextAlign.center,
|
|
|
|
|
// // style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// // textInputType: TextInputType.text,
|
|
|
|
|
// // onSaved: (value){
|
|
|
|
|
// // _formModel.title = value;
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// // const SizedBox(height: 8,),
|
|
|
|
|
// ASubTitle(context.translation.status),
|
|
|
|
|
// if (_validate && _formModel.status == null)
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
// context.translation.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// GasStatusMenu(
|
|
|
|
|
// initialValue: _formModel.status ?? Lookup(value: 0),
|
|
|
|
|
// enabled: widget.gasRefillModel != null,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _formModel.status = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// Divider(
|
|
|
|
|
// color: Theme.of(context).colorScheme.primary,
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// HospitalAutoCompleteField(
|
|
|
|
|
// enabled: false,
|
|
|
|
|
// initialValue: _gasRefillProvider.hospital?.name,
|
|
|
|
|
// // onSave: (value){
|
|
|
|
|
// // _search.hospital = value;
|
|
|
|
|
// // },
|
|
|
|
|
// onSearch: (value) {
|
|
|
|
|
// _gasRefillProvider.hospital = value;
|
|
|
|
|
// _gasRefillProvider.building = null;
|
|
|
|
|
// _gasRefillProvider.floor = null;
|
|
|
|
|
// _gasRefillProvider.department = null;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// BuildingTypeMenu(
|
|
|
|
|
// initialValue: _gasRefillProvider?.building,
|
|
|
|
|
// building: _gasRefillProvider?.hospital?.buildings,
|
|
|
|
|
// loading: _firstTime,
|
|
|
|
|
// enabled: widget.gasRefillModel == null,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _gasRefillProvider.building = status;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 8),
|
|
|
|
|
// FloorTypeMenu(
|
|
|
|
|
// initialValue: _gasRefillProvider?.floor,
|
|
|
|
|
// floors: _gasRefillProvider?.building?.floors,
|
|
|
|
|
// enabled: widget.gasRefillModel == null,
|
|
|
|
|
// loading: _firstTime,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _gasRefillProvider.floor = status;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 8),
|
|
|
|
|
// DepartmentTypeMenu(
|
|
|
|
|
// initialValue: _gasRefillProvider?.department,
|
|
|
|
|
// departments: _gasRefillProvider?.floor?.departments,
|
|
|
|
|
// loading: _firstTime,
|
|
|
|
|
// enabled: widget.gasRefillModel == null,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _gasRefillProvider.department = status;
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 8),
|
|
|
|
|
// if (widget.gasRefillModel != null) ASubTitle(context.translation.workingHours),
|
|
|
|
|
// if (widget.gasRefillModel != null) const SizedBox(height: 8),
|
|
|
|
|
// if (widget.gasRefillModel != null)
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Expanded(
|
|
|
|
|
// child: AppTimer(
|
|
|
|
|
// timer: _gasRefillProvider.timer,
|
|
|
|
|
// onChange: (timer) async {
|
|
|
|
|
// _gasRefillProvider.timer = timer;
|
|
|
|
|
// _formModel.workingHours = num.tryParse((((timer?.durationInSecond ?? 0) / 60) / 60)?.toStringAsFixed(2) ?? "0");
|
|
|
|
|
// _formModel.startDate = timer.startAt.toString();
|
|
|
|
|
// _formModel.endDate = timer.endAt.toString();
|
|
|
|
|
// return true;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// //const SizedBox(height: 8),
|
|
|
|
|
// // if (_userProvider.user?.type == UsersTypes.normal_user || widget.gasRefillModel != null)
|
|
|
|
|
// // Column(
|
|
|
|
|
// // crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
// // children: [
|
|
|
|
|
// // const ASubTitle("Expected Date"),
|
|
|
|
|
// // SizedBox(
|
|
|
|
|
// // height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
// // ),
|
|
|
|
|
// // ADateTimePicker(
|
|
|
|
|
// // date: _gasRefillProvider.expectedDateTime,
|
|
|
|
|
// // from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
// // to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
// // onDateTimePicker: (date) {
|
|
|
|
|
// // _gasRefillProvider.expectedDateTime = date;
|
|
|
|
|
// // _formModel.expectedDate = _gasRefillProvider.expectedDateTime;
|
|
|
|
|
// // setState(() {});
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// // if (_userProvider.user?.type == UsersTypes.engineer)
|
|
|
|
|
// // Column(
|
|
|
|
|
// // children: [
|
|
|
|
|
// // Row(
|
|
|
|
|
// // children: [
|
|
|
|
|
// // Expanded(
|
|
|
|
|
// // child: Column(
|
|
|
|
|
// // crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
// // children: [
|
|
|
|
|
// // const ASubTitle("Start of Work"),
|
|
|
|
|
// // SizedBox(
|
|
|
|
|
// // height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
// // ),
|
|
|
|
|
// // ADateTimePicker(
|
|
|
|
|
// // date: _gasRefillProvider.startDate,
|
|
|
|
|
// // from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
// // to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
// // onDateTimePicker: (date) {
|
|
|
|
|
// // _gasRefillProvider.startDate = date;
|
|
|
|
|
// // setState(() {});
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// // ),
|
|
|
|
|
// // const SizedBox(width: 8),
|
|
|
|
|
// // Expanded(
|
|
|
|
|
// // child: Column(
|
|
|
|
|
// // crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
// // children: [
|
|
|
|
|
// // const ASubTitle("End of Work"),
|
|
|
|
|
// // SizedBox(
|
|
|
|
|
// // height: 8 * AppStyle.getScaleFactor(context),
|
|
|
|
|
// // ),
|
|
|
|
|
// // ADateTimePicker(
|
|
|
|
|
// // date: _gasRefillProvider.endDate,
|
|
|
|
|
// // from: DateTime.now().subtract(const Duration(days: 365)),
|
|
|
|
|
// // to: DateTime.now().add(const Duration(days: 365)),
|
|
|
|
|
// // onDateTimePicker: (date) {
|
|
|
|
|
// // _gasRefillProvider.endDate = date;
|
|
|
|
|
// // setState(() {});
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// // const SizedBox(height: 8),
|
|
|
|
|
// // ASubTitle(context.translation.workingHours),
|
|
|
|
|
// // const SizedBox(height: 4),
|
|
|
|
|
// // ATextFormField(
|
|
|
|
|
// // initialValue: null,
|
|
|
|
|
// // textAlign: TextAlign.center,
|
|
|
|
|
// // hintText: _gasRefillProvider.startDate == null
|
|
|
|
|
// // ? "0"
|
|
|
|
|
// // : ((_gasRefillProvider.endDate?.difference(_gasRefillProvider.startDate)?.inMinutes ?? 0) / 60)?.toStringAsFixed(2)?.toString() ?? "0",
|
|
|
|
|
// // enable: false,
|
|
|
|
|
// // style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// // validator: (value) => Validator.isNumeric(value) ? null : context.translation.requiredWord,
|
|
|
|
|
// // textInputType: TextInputType.number,
|
|
|
|
|
// // onSaved: (value) {
|
|
|
|
|
// // // _serviceReport.workHours = value;
|
|
|
|
|
// // },
|
|
|
|
|
// // ),
|
|
|
|
|
// // ],
|
|
|
|
|
// // ),
|
|
|
|
|
// if (widget.gasRefillModel == null)
|
|
|
|
|
// Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// const SizedBox(height: 8),
|
|
|
|
|
// Divider(color: Theme.of(context).colorScheme.primary),
|
|
|
|
|
// const SizedBox(height: 4),
|
|
|
|
|
// const ASubTitle("Gas Type"),
|
|
|
|
|
// if (_validate && _currentDetails.gasType == null) ASubTitle(context.translation.requiredWord, color: Colors.red),
|
|
|
|
|
// const SizedBox(height: 4),
|
|
|
|
|
// GasTypeMenu(
|
|
|
|
|
// initialValue: _currentDetails.gasType,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _currentDetails.gasType = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 8),
|
|
|
|
|
// const ASubTitle("Cylinder Size"),
|
|
|
|
|
// if (_validate && _currentDetails.cylinderSize == null)
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
// context.translation.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// GasCylinderSizeMenu(
|
|
|
|
|
// initialValue: _currentDetails.cylinderSize,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _currentDetails.cylinderSize = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// const ASubTitle("Cylinder Type"),
|
|
|
|
|
// if (_validate && _currentDetails.cylinderSize == null)
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
// context.translation.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// GasCylinderTypesMenu(
|
|
|
|
|
// initialValue: _currentDetails.cylinderType,
|
|
|
|
|
// onSelect: (status) {
|
|
|
|
|
// _currentDetails.cylinderType = status;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// ASubTitle(context.translation.requestedQuantity),
|
|
|
|
|
// if (_validate && _currentDetails?.requestedQty == null)
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
// context.translation.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// height: 4,
|
|
|
|
|
// ),
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: (_currentDetails?.requestedQty ?? "").toString(),
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// controller: _requestedQuantityController,
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// _currentDetails?.requestedQty = double.tryParse(value);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// if (widget.gasRefillModel != null) const SizedBox(height: 16),
|
|
|
|
|
// if (widget.gasRefillModel != null) ASubTitle(context.translation.deliveredQuantity),
|
|
|
|
|
// if (widget.gasRefillModel != null && _validate && _currentDetails?.deliverdQty == null)
|
|
|
|
|
// ASubTitle(
|
|
|
|
|
// context.translation.requiredWord,
|
|
|
|
|
// color: Colors.red,
|
|
|
|
|
// ),
|
|
|
|
|
// if (widget.gasRefillModel != null) const SizedBox(height: 4),
|
|
|
|
|
// if (widget.gasRefillModel != null)
|
|
|
|
|
// ATextFormField(
|
|
|
|
|
// initialValue: (_currentDetails?.deliverdQty ?? "").toString(),
|
|
|
|
|
// textAlign: TextAlign.center,
|
|
|
|
|
// controller: _deliveredQuantityController,
|
|
|
|
|
// style: Theme.of(context).textTheme.subtitle1,
|
|
|
|
|
// validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
|
|
|
|
|
// textInputType: TextInputType.number,
|
|
|
|
|
// onChange: (value) {
|
|
|
|
|
// _currentDetails?.deliverdQty = double.tryParse(value);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 16),
|
|
|
|
|
// AButton(
|
|
|
|
|
// text: context.translation.add,
|
|
|
|
|
// onPressed: ()async{await _addNewModel.call(context);},
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 16),
|
|
|
|
|
// if (_formModel.gazRefillDetails.isNotEmpty) const ASubTitle("Gas Requests"),
|
|
|
|
|
// ListView.builder(
|
|
|
|
|
// key: _DetailsKey,
|
|
|
|
|
// shrinkWrap: true,
|
|
|
|
|
// physics: const ClampingScrollPhysics(),
|
|
|
|
|
// itemCount: _formModel.gazRefillDetails.length,
|
|
|
|
|
// itemBuilder: (context, index) {
|
|
|
|
|
// final model = _formModel.gazRefillDetails[index];
|
|
|
|
|
// return GasRefillCreateDetailsItem(
|
|
|
|
|
// isUpdate: widget.gasRefillModel != null,
|
|
|
|
|
// model: model,
|
|
|
|
|
// onPressed: () {
|
|
|
|
|
// if (widget.gasRefillModel != null) {
|
|
|
|
|
// model.selectedForEditing = !(model.selectedForEditing ?? false);
|
|
|
|
|
// }
|
|
|
|
|
// if (widget.gasRefillModel == null) {
|
|
|
|
|
// _formModel.gazRefillDetails.remove(model);
|
|
|
|
|
// }
|
|
|
|
|
// setState(() {});
|
|
|
|
|
// },
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
// if (widget.gasRefillModel != null) const SizedBox(height: 16),
|
|
|
|
|
// if (widget.gasRefillModel != null) const ASubTitle("Nurse Signature"),
|
|
|
|
|
// if (widget.gasRefillModel != null)
|
|
|
|
|
// ESignature(
|
|
|
|
|
// oldSignature: _formModel.nurseSignature,
|
|
|
|
|
// newSignature: _formModel.localNurseSignature,
|
|
|
|
|
// onChange: (signature) {
|
|
|
|
|
// if (signature == null || signature.isEmpty) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// _formModel.localNurseSignature = signature;
|
|
|
|
|
// _formModel.nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// if (widget.gasRefillModel != null)
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// height: 8,
|
|
|
|
|
// ),
|
|
|
|
|
// if (widget.gasRefillModel != null) const ASubTitle("Engineer Signature"),
|
|
|
|
|
// if (widget.gasRefillModel != null)
|
|
|
|
|
// ESignature(
|
|
|
|
|
// oldSignature: _formModel.engSignature,
|
|
|
|
|
// newSignature: _formModel.localEngineerSignature,
|
|
|
|
|
// onChange: (signature) {
|
|
|
|
|
// if (signature == null || signature.isEmpty) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// _formModel.localEngineerSignature = signature;
|
|
|
|
|
// _formModel.engSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 16),
|
|
|
|
|
// AButton(
|
|
|
|
|
// text: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
|
|
|
|
|
// onPressed:()async{_onSubmit.call(context);},
|
|
|
|
|
// ),
|
|
|
|
|
// const SizedBox(height: 100)
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|