|
|
|
@ -1,15 +1,11 @@
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
|
|
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
|
|
|
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
|
|
|
|
|
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
import 'package:watermanagement/model/getdeliveryboy_model.dart';
|
|
|
|
|
import 'package:watermanagement/settings.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'order_tracking_page.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,7 +55,9 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
|
|
|
|
|
return GetDeliveryboyDetailsModel.fromJson(model);
|
|
|
|
|
}).toList();
|
|
|
|
|
activeOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()!='delivered').toList();
|
|
|
|
|
activeOrdersList=activeOrdersList.reversed.toList();
|
|
|
|
|
completedOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()=='delivered').toList();
|
|
|
|
|
completedOrdersList=completedOrdersList.reversed.toList();
|
|
|
|
|
isLoading = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -229,10 +227,17 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
|
|
|
|
|
|
|
|
|
|
if(int.parse(x)<=int.parse(obj.price)){
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
|
|
final DateTime now = DateTime.now();
|
|
|
|
|
final DateFormat formatter = DateFormat('dd-MMM-yyyy - HH:mm');
|
|
|
|
|
|
|
|
|
|
final String formatted = formatter.format(now);
|
|
|
|
|
print(formatted);
|
|
|
|
|
|
|
|
|
|
payload["amount_paid"] = amountPaidController.text.toString();
|
|
|
|
|
payload["payment_mode"] = dropdownTypeOfPayment.toString().toLowerCase();
|
|
|
|
|
payload["orderStatus"] = 'delivered';
|
|
|
|
|
payload["deliveredDate"] = formatted;
|
|
|
|
|
|
|
|
|
|
bool updateStatus = await AppSettings.deliveryboyFinishOrder(obj.bookingid,payload);
|
|
|
|
|
|
|
|
|
@ -418,53 +423,56 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 30,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
iconSize: 30,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.download,
|
|
|
|
|
color:activeOrdersList[index].tankerRunningStatus=='1'?Colors.red: Colors.green,
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: activeOrdersList[index].stopTime==''||activeOrdersList[index].stopTime=='null',
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
iconSize: 30,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.download,
|
|
|
|
|
color:activeOrdersList[index].tankerRunningStatus=='1'?Colors.red: Colors.green,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
if(activeOrdersList[index].tankerRunningStatus!='0'){
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["action"] = 'stop';
|
|
|
|
|
payload["percentage"] = '';
|
|
|
|
|
|
|
|
|
|
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
|
|
|
|
|
|
|
|
|
|
print(capacity);
|
|
|
|
|
//var modelTanksViewList = jsonDecode(capacity)['data'];
|
|
|
|
|
setState(() {
|
|
|
|
|
activeOrdersList[index].tankerRunningStatus='0';
|
|
|
|
|
activeOrdersList[index].stopTime=jsonDecode(capacity)['stop time'];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["action"] = 'start';
|
|
|
|
|
payload["percentage"] = '';
|
|
|
|
|
|
|
|
|
|
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
|
|
|
|
|
|
|
|
|
|
print(capacity);
|
|
|
|
|
//var modelTanksViewList = jsonDecode(capacity)['data'];
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
activeOrdersList[index].tankerRunningStatus='1';
|
|
|
|
|
activeOrdersList[index].startTime=jsonDecode(capacity)['start time'];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
if(activeOrdersList[index].tankerRunningStatus!='0'){
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["action"] = 'stop';
|
|
|
|
|
payload["percentage"] = '';
|
|
|
|
|
|
|
|
|
|
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
|
|
|
|
|
|
|
|
|
|
print(capacity);
|
|
|
|
|
//var modelTanksViewList = jsonDecode(capacity)['data'];
|
|
|
|
|
setState(() {
|
|
|
|
|
activeOrdersList[index].tankerRunningStatus='0';
|
|
|
|
|
activeOrdersList[index].stopTime=jsonDecode(capacity)['stop time'];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["action"] = 'start';
|
|
|
|
|
payload["percentage"] = '';
|
|
|
|
|
|
|
|
|
|
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
|
|
|
|
|
|
|
|
|
|
print(capacity);
|
|
|
|
|
//var modelTanksViewList = jsonDecode(capacity)['data'];
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
activeOrdersList[index].tankerRunningStatus='1';
|
|
|
|
|
activeOrdersList[index].startTime=jsonDecode(capacity)['start time'];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
'Download Water',
|
|
|
|
|
style: iconBelowTextStyle(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
Text(
|
|
|
|
|
'Download Water',
|
|
|
|
|
style: iconBelowTextStyle(),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
|
|
|
|
|