|
|
|
|
@ -62,6 +62,7 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
bool _firstTime = true;
|
|
|
|
|
|
|
|
|
|
Lookup? _deliveredQuantity;
|
|
|
|
|
List<File> _attachments = [];
|
|
|
|
|
|
|
|
|
|
static List<Lookup> deliveredQuantity = [
|
|
|
|
|
Lookup(name: "1", id: 1, value: 1),
|
|
|
|
|
@ -79,9 +80,8 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
if (widget.gasRefillModel != null) {
|
|
|
|
|
_formModel.fromGasRefillModel(widget.gasRefillModel!);
|
|
|
|
|
|
|
|
|
|
// totalWorkingHours =
|
|
|
|
|
// _formModel?.fold(0.0, (sum, item) => (sum ?? 0) + DateTime.parse(item.endDateTime!).difference(DateTime.parse(item.startDateTime!)).inSeconds) ?? 0;
|
|
|
|
|
|
|
|
|
|
totalWorkingHours =
|
|
|
|
|
_formModel.gasRefillTimers?.fold(0.0, (sum, item) => (sum ?? 0) + DateTime.parse(item.endDate!).difference(DateTime.parse(item.startDate!)).inSeconds) ?? 0;
|
|
|
|
|
_commentController.text = _formModel.techComment ?? "";
|
|
|
|
|
try {
|
|
|
|
|
_deliveredQuantity = deliveredQuantity.singleWhere((element) => element.value == _formModel.gasRefillDetails![0].deliverdQty);
|
|
|
|
|
@ -89,8 +89,7 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
} catch (ex) {}
|
|
|
|
|
}
|
|
|
|
|
if (_formModel.gasRefillAttachments != null && _formModel.gasRefillAttachments!.isNotEmpty) {
|
|
|
|
|
_gasRefillProvider?.gasRefillAttachments = [];
|
|
|
|
|
_gasRefillProvider?.gasRefillAttachments.addAll(_formModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
|
|
|
|
|
_attachments.addAll(_formModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -130,9 +129,9 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
_formModel.gasRefillAttachments = [];
|
|
|
|
|
for (var item in _gasRefillProvider!.gasRefillAttachments) {
|
|
|
|
|
_formModel.gasRefillAttachments?.add(GasRefillAttachments(
|
|
|
|
|
id: 0, gasRefillId: _formModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
|
|
|
|
|
for (var item in _attachments) {
|
|
|
|
|
_formModel.gasRefillAttachments
|
|
|
|
|
?.add(GasRefillAttachments(id: 0,gasRefillId: _formModel.id??0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
|
|
|
|
|
}
|
|
|
|
|
await _gasRefillProvider?.updateGasRefill(status: status, model: _formModel).whenComplete(() {
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
@ -287,7 +286,7 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
16.height,
|
|
|
|
|
MultiFilesPicker(
|
|
|
|
|
label: context.translation.attachFiles,
|
|
|
|
|
files: _gasRefillProvider!.gasRefillAttachments,
|
|
|
|
|
files: _attachments,
|
|
|
|
|
buttonColor: AppColor.black10,
|
|
|
|
|
onlyImages: false,
|
|
|
|
|
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
|
|
|
|
|
|