|
|
|
@ -19,6 +19,7 @@ import 'package:test_sa/views/widgets/status/gas_refill/gas_status.dart';
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import '../../../../controllers/localization/localization.dart';
|
|
|
|
import '../../../../controllers/localization/localization.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class UpdateDeviceTransfer extends StatefulWidget {
|
|
|
|
class UpdateDeviceTransfer extends StatefulWidget {
|
|
|
|
final DeviceTransfer model;
|
|
|
|
final DeviceTransfer model;
|
|
|
|
final bool isSender;
|
|
|
|
final bool isSender;
|
|
|
|
@ -52,13 +53,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
_isLoading = true;
|
|
|
|
_isLoading = true;
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
int status = await _deviceTransferProvider.updateRequest(
|
|
|
|
int status = await _deviceTransferProvider.updateRequest(
|
|
|
|
user: _userProvider.user,
|
|
|
|
user: _userProvider.user, host: _settingProvider.host, requestId: widget.model.id, isSender: widget.isSender, newModel: _formModel, oldModel: widget.model);
|
|
|
|
host: _settingProvider.host,
|
|
|
|
|
|
|
|
requestId: widget.model.id,
|
|
|
|
|
|
|
|
isSender: widget.isSender,
|
|
|
|
|
|
|
|
newModel: _formModel,
|
|
|
|
|
|
|
|
oldModel: widget.model
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
_isLoading = false;
|
|
|
|
_isLoading = false;
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
if (status >= 200 && status < 300) {
|
|
|
|
if (status >= 200 && status < 300) {
|
|
|
|
@ -78,10 +73,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
_formModel.fromDetails(widget.isSender
|
|
|
|
_formModel.fromDetails(widget.isSender ? widget.model.sender : widget.model.receiver, withSignature: false);
|
|
|
|
? widget.model.sender : widget.model.receiver,
|
|
|
|
|
|
|
|
withSignature: false
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -117,18 +109,18 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
"Edit Transfer Device",
|
|
|
|
"Edit Transfer Device",
|
|
|
|
style: Theme.of(context).textTheme.headline5.copyWith(
|
|
|
|
style: Theme.of(context).textTheme.headline5.copyWith(color: Theme.of(context).primaryColor, fontSize: 28, fontWeight: FontWeight.bold),
|
|
|
|
color: Theme.of(context).primaryColor,
|
|
|
|
|
|
|
|
fontSize: 28,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8,),
|
|
|
|
|
|
|
|
ASubTitle("Comment"),
|
|
|
|
ASubTitle("Comment"),
|
|
|
|
|
|
|
|
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
initialValue: _formModel?.comment,
|
|
|
|
initialValue: _formModel?.comment,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
@ -138,9 +130,13 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
_formModel.comment = value;
|
|
|
|
_formModel.comment = value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
ASubTitle(_subtitle.travelingHours),
|
|
|
|
ASubTitle(_subtitle.travelingHours),
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
initialValue: _formModel?.travelingHours,
|
|
|
|
initialValue: _formModel?.travelingHours,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
@ -150,9 +146,13 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
_formModel.travelingHours = value;
|
|
|
|
_formModel.travelingHours = value;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
ASubTitle(_subtitle.workingHours),
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
ATextFormField(
|
|
|
|
ATextFormField(
|
|
|
|
initialValue: _formModel?.workingHours,
|
|
|
|
initialValue: _formModel?.workingHours,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
@ -174,9 +174,13 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
// setState(() {});
|
|
|
|
// setState(() {});
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
const SizedBox(height: 8,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
ASubTitle(_subtitle.status),
|
|
|
|
ASubTitle(_subtitle.status),
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
GasStatusMenu(
|
|
|
|
GasStatusMenu(
|
|
|
|
initialValue: _formModel.status,
|
|
|
|
initialValue: _formModel.status,
|
|
|
|
onSelect: (status) {
|
|
|
|
onSelect: (status) {
|
|
|
|
@ -184,21 +188,22 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 8,
|
|
|
|
|
|
|
|
),
|
|
|
|
const ASubTitle("Signature"),
|
|
|
|
const ASubTitle("Signature"),
|
|
|
|
// if(_validate && _formModel.signature == null)
|
|
|
|
// if(_validate && _formModel.signature == null)
|
|
|
|
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
|
|
|
|
// ASubTitle(_subtitle.requiredWord,color: Colors.red,),
|
|
|
|
const SizedBox(height: 4,),
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 4,
|
|
|
|
|
|
|
|
),
|
|
|
|
ESignature(
|
|
|
|
ESignature(
|
|
|
|
oldSignature: widget.isSender
|
|
|
|
oldSignature: widget.isSender ? widget.model.sender.signature : widget.model.receiver.signature,
|
|
|
|
? widget.model.sender.signature
|
|
|
|
|
|
|
|
: widget.model.receiver.signature,
|
|
|
|
|
|
|
|
newSignature: _signature,
|
|
|
|
newSignature: _signature,
|
|
|
|
onSaved: (signature) {
|
|
|
|
onSaved: (signature) {
|
|
|
|
_signature = signature;
|
|
|
|
_signature = signature;
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
_formModel.signature = base64Encode(signature);
|
|
|
|
_formModel.signature = base64Encode(signature);
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
@ -208,7 +213,9 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
onPressed: _update,
|
|
|
|
onPressed: _update,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 100,)
|
|
|
|
const SizedBox(
|
|
|
|
|
|
|
|
height: 100,
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -218,4 +225,3 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|