|
|
|
|
@ -69,6 +69,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),
|
|
|
|
|
@ -86,9 +87,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);
|
|
|
|
|
@ -96,8 +96,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());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -138,7 +137,7 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
_formModel.gasRefillAttachments = [];
|
|
|
|
|
for (var item in _gasRefillProvider!.gasRefillAttachments) {
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
@ -263,7 +262,7 @@ class _GasRefillFormState extends State<GasRefillForm> {
|
|
|
|
|
// : context.translation.onlyNumbers,
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
_timerWidget(context, _formModel.workingHours ?? 0),
|
|
|
|
|
_timerWidget(context, totalWorkingHours ?? 0),
|
|
|
|
|
8.height,
|
|
|
|
|
// SingleItemDropDownMenu<Lookup, GasStatusProvider>(
|
|
|
|
|
// context: context,
|
|
|
|
|
@ -301,7 +300,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),
|
|
|
|
|
|