|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|
|
|
import 'package:watermanagement/settings.dart';
|
|
|
|
import 'package:watermanagement/settings.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'models/booking_requests_model.dart';
|
|
|
|
import 'models/booking_requests_model.dart';
|
|
|
|
|
|
|
|
import 'models/getdeliveryboy_model.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class BookingRequets extends StatefulWidget {
|
|
|
|
class BookingRequets extends StatefulWidget {
|
|
|
|
const BookingRequets({Key? key}) : super(key: key);
|
|
|
|
const BookingRequets({Key? key}) : super(key: key);
|
|
|
@ -14,8 +15,10 @@ class BookingRequets extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
List<BookingRequestsModel> BookingRequestsList = [];
|
|
|
|
List<BookingRequestsModel> BookingRequestsList = [];
|
|
|
|
|
|
|
|
List<GetDeliveryboyDetailsModel> modeldeliveryboyList = [];
|
|
|
|
bool isSereverIssuePending = false;
|
|
|
|
bool isSereverIssuePending = false;
|
|
|
|
bool isDataLoading = false;
|
|
|
|
bool isDataLoading = false;
|
|
|
|
|
|
|
|
var dropdownAllDeliveryBoys;
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getBookingRequestsData() async {
|
|
|
|
Future<void> getBookingRequestsData() async {
|
|
|
|
isDataLoading = true;
|
|
|
|
isDataLoading = true;
|
|
|
@ -37,11 +40,22 @@ class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<void> getAllDeliveryBoys() async {
|
|
|
|
|
|
|
|
var response1= await AppSettings.getAllDeliverboy();
|
|
|
|
|
|
|
|
print(response1);
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
modeldeliveryboyList =
|
|
|
|
|
|
|
|
((jsonDecode(response1)['data']) as List).map((dynamic model) {
|
|
|
|
|
|
|
|
return GetDeliveryboyDetailsModel.fromJson(model);
|
|
|
|
|
|
|
|
}).toList();
|
|
|
|
|
|
|
|
dropdownAllDeliveryBoys=modeldeliveryboyList[0];
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
isDataLoading = true;
|
|
|
|
isDataLoading = true;
|
|
|
|
getBookingRequestsData();
|
|
|
|
getBookingRequestsData();
|
|
|
|
|
|
|
|
getAllDeliveryBoys();
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -225,6 +239,74 @@ class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
color:
|
|
|
|
color:
|
|
|
|
primaryColor /*FilteredList[index].text_color*/),
|
|
|
|
primaryColor /*FilteredList[index].text_color*/),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return showDialog(
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
|
|
return StatefulBuilder(
|
|
|
|
|
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
|
|
|
title: const Text('Assign'),
|
|
|
|
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
|
|
|
|
child: ListBody(
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
|
|
|
|
child: DropdownButtonFormField<GetDeliveryboyDetailsModel>(
|
|
|
|
|
|
|
|
// Initial Value
|
|
|
|
|
|
|
|
value: dropdownAllDeliveryBoys,
|
|
|
|
|
|
|
|
isExpanded: true,
|
|
|
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
|
|
|
Icons.water,
|
|
|
|
|
|
|
|
color: greyColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
labelText: 'Select delivery boy',
|
|
|
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hint: Text('Select delivery boy'),
|
|
|
|
|
|
|
|
// Down Arrow Icon
|
|
|
|
|
|
|
|
icon: const Icon(Icons.keyboard_arrow_down),
|
|
|
|
|
|
|
|
items: modeldeliveryboyList
|
|
|
|
|
|
|
|
.map<DropdownMenuItem<GetDeliveryboyDetailsModel>>(
|
|
|
|
|
|
|
|
(value) => new DropdownMenuItem<GetDeliveryboyDetailsModel>(
|
|
|
|
|
|
|
|
value: value,
|
|
|
|
|
|
|
|
child: new Text(value.deliveryboy_name),
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.toList(),
|
|
|
|
|
|
|
|
onChanged: (GetDeliveryboyDetailsModel? newValue) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
dropdownAllDeliveryBoys = newValue;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
child: Text('cancel', style: textButtonStyle()),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
child: Text('Accept', style: textButtonStyle()),
|
|
|
|
onPressed: () async{
|
|
|
|
onPressed: () async{
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
payload["supplierName"] =
|
|
|
|
payload["supplierName"] =
|
|
|
@ -243,9 +325,9 @@ class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
payload["action"] = "accept";
|
|
|
|
payload["action"] = "accept";
|
|
|
|
payload["price"] =
|
|
|
|
payload["price"] =
|
|
|
|
BookingRequestsList[index].price;
|
|
|
|
BookingRequestsList[index].price;
|
|
|
|
payload["delivery_agent"] = '';
|
|
|
|
payload["delivery_agent"] = dropdownAllDeliveryBoys.deliveryboy_name;
|
|
|
|
payload["agent_mobile"] = '';
|
|
|
|
payload["agent_mobile"] = dropdownAllDeliveryBoys.deliveryboy_phone;
|
|
|
|
payload["agent_alternative_mobile"] = '';
|
|
|
|
payload["agent_alternative_mobile"] = dropdownAllDeliveryBoys.deliveryboy_alternativeContactNumber;
|
|
|
|
|
|
|
|
|
|
|
|
bool requestStatus =
|
|
|
|
bool requestStatus =
|
|
|
|
await AppSettings.acceptBookingRequests(
|
|
|
|
await AppSettings.acceptBookingRequests(
|
|
|
@ -253,6 +335,7 @@ class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
payload);
|
|
|
|
payload);
|
|
|
|
|
|
|
|
|
|
|
|
if (requestStatus) {
|
|
|
|
if (requestStatus) {
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
AppSettings.longSuccessToast(
|
|
|
|
AppSettings.longSuccessToast(
|
|
|
|
"Booking Accepted");
|
|
|
|
"Booking Accepted");
|
|
|
|
await getBookingRequestsData();
|
|
|
|
await getBookingRequestsData();
|
|
|
@ -261,6 +344,17 @@ class _BookingRequetsState extends State<BookingRequets> {
|
|
|
|
//await getPendingSuppliersData();
|
|
|
|
//await getPendingSuppliersData();
|
|
|
|
|
|
|
|
|
|
|
|
} else {}
|
|
|
|
} else {}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextButton(
|
|
|
|
TextButton(
|
|
|
|