|
|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/http_status_manger.dart';
|
|
|
|
|
@ -21,6 +24,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 {
|
|
|
|
|
@ -36,6 +40,9 @@ class RequestGasRefill extends StatefulWidget {
|
|
|
|
|
class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
bool _validate = false;
|
|
|
|
|
Uint8List _engineerSignature;
|
|
|
|
|
Uint8List _nurseSignature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserProvider _userProvider;
|
|
|
|
|
SettingProvider _settingProvider;
|
|
|
|
|
@ -78,6 +85,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
_formKey.currentState.save();
|
|
|
|
|
|
|
|
|
|
int status = widget.gasRefillModel == null
|
|
|
|
|
? null /*await _gasRefillProvider.createModel(
|
|
|
|
|
@ -150,10 +158,10 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
if (widget.gasRefillModel != null) {
|
|
|
|
|
//_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 ?? ""));
|
|
|
|
|
_formModel.timer = TimerModel(startAt: DateTime.tryParse(widget.gasRefillModel?.startDate ?? ""), endAt: DateTime.tryParse(widget.gasRefillModel?.endDate ?? ""));
|
|
|
|
|
_clientName = _formModel.site.custName;
|
|
|
|
|
} else {
|
|
|
|
|
_gasRefillProvider.timer = null;
|
|
|
|
|
_formModel.timer = null;
|
|
|
|
|
_clientName = _userProvider.user?.clientName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -237,6 +245,30 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
|
|
|
|
|
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,
|
|
|
|
|
|