|
|
|
@ -21,6 +21,8 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
TextEditingController deliveryboyPhoneController = TextEditingController();
|
|
|
|
|
TextEditingController deliveryboyAlterPhoneController = TextEditingController();
|
|
|
|
|
TextEditingController deliveryboyAddress = TextEditingController();
|
|
|
|
|
TextEditingController deliveryboyStatus = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isLoading=false;
|
|
|
|
|
|
|
|
|
@ -43,7 +45,157 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showUpdateDeliveryDialog(var object) async {
|
|
|
|
|
// tankNameController
|
|
|
|
|
// blockNameController
|
|
|
|
|
// capacityController
|
|
|
|
|
deliveryboyNameController.text=object.deliveryboy_name??'';
|
|
|
|
|
deliveryboyPhoneController.text=object.deliveryboy_phone??'';
|
|
|
|
|
deliveryboyAlterPhoneController.text=object.deliveryboy_alternativeContactNumber??'';
|
|
|
|
|
deliveryboyAddress.text=object.deliveryboy_address??'';
|
|
|
|
|
deliveryboyStatus.text=object.deliveryboy_status??'';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return StatefulBuilder(
|
|
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: const Text('Update Deliveryboy'),
|
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
|
child: ListBody(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
cursorColor: greyColor,
|
|
|
|
|
controller: deliveryboyNameController,
|
|
|
|
|
textCapitalization: TextCapitalization.characters,
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
Icons.ac_unit_outlined,
|
|
|
|
|
color: greyColor,
|
|
|
|
|
),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
labelText: 'Enter name',
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
cursorColor: greyColor,
|
|
|
|
|
controller: deliveryboyPhoneController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
Icons.phone,
|
|
|
|
|
color: greyColor,
|
|
|
|
|
),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
labelText: 'Enter phone number',
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
cursorColor: greyColor,
|
|
|
|
|
controller: deliveryboyAlterPhoneController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
|
prefixIcon: Icon(
|
|
|
|
|
Icons.phone,
|
|
|
|
|
color: greyColor,
|
|
|
|
|
),
|
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
|
),
|
|
|
|
|
labelText: 'Enter Alternative phone number',
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
child: Text('Cancel',style:textButtonStyle()),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
child: Text('Update',style:textButtonStyle()),
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(deliveryboyNameController.text!=''&&deliveryboyPhoneController.text!=''&&deliveryboyAlterPhoneController.text!=''){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
payload["name"] = deliveryboyNameController.text.toString();
|
|
|
|
|
payload["phone"] = deliveryboyPhoneController.text.toString();
|
|
|
|
|
payload["alternativeContactNumber"] = deliveryboyAlterPhoneController.text.toString();
|
|
|
|
|
bool updateDeliveryboyStatus = await AppSettings.updateDeliveryboy(object.deliveryboy_phone,payload);
|
|
|
|
|
|
|
|
|
|
if(updateDeliveryboyStatus){
|
|
|
|
|
readJson();
|
|
|
|
|
AppSettings.longSuccessToast('Deliveryboy updated successfully');
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('Deliveryboy update failed');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('Fill the details');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget renderzUi(){
|
|
|
|
|
if(modeldeliveryboyList.length!=0){
|
|
|
|
@ -79,7 +231,8 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
Text('name :',style: labelTextStyle()),
|
|
|
|
|
Text('phone :',style: labelTextStyle()),
|
|
|
|
|
Text('alternativeContactNumber :',style: labelTextStyle()),
|
|
|
|
|
Text('address :',style: labelTextStyle()),
|
|
|
|
|
// Text('address :',style: labelTextStyle()),
|
|
|
|
|
Text('status :',style: labelTextStyle()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(width: 5,),
|
|
|
|
@ -90,9 +243,11 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
Text(modeldeliveryboyList[index].deliveryboy_name,style: valuesTextStyle()),
|
|
|
|
|
Text(modeldeliveryboyList[index].deliveryboy_phone,style: valuesTextStyle()),
|
|
|
|
|
Text(modeldeliveryboyList[index].deliveryboy_alternativeContactNumber,style: valuesTextStyle()),
|
|
|
|
|
Text(modeldeliveryboyList[index].deliveryboy_address,style: valuesTextStyle(),
|
|
|
|
|
/*Text(modeldeliveryboyList[index].deliveryboy_address,style: valuesTextStyle(),
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
maxLines: 1),
|
|
|
|
|
maxLines: 1),*/
|
|
|
|
|
Text(modeldeliveryboyList[index].deliveryboy_status,style: valuesTextStyle()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
@ -106,14 +261,14 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
Expanded(child:IconButton(
|
|
|
|
|
icon: const Icon(Icons.edit,color: primaryColor,),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// showTankerUpdateDialog(modeldeliveryboyList[index]);
|
|
|
|
|
showUpdateDeliveryDialog(modeldeliveryboyList[index]);
|
|
|
|
|
},
|
|
|
|
|
),),
|
|
|
|
|
Expanded(child:IconButton(
|
|
|
|
|
icon: const Icon(Icons.delete,color: primaryColor,),
|
|
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
/* showDialog(
|
|
|
|
|
showDialog(
|
|
|
|
|
//if set to true allow to close popup by tapping out of the popup
|
|
|
|
|
//barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
@ -127,17 +282,17 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: ()async {
|
|
|
|
|
bool deleteTankStatus = await AppSettings.deleteTanker(modelTanksViewList[index].tanker_name);
|
|
|
|
|
bool deleteDeliveryboyStatus = await AppSettings.deleteDeliveryboy(modeldeliveryboyList[index].deliveryboy_phone);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(deleteTankStatus){
|
|
|
|
|
if(deleteDeliveryboyStatus){
|
|
|
|
|
readJson();
|
|
|
|
|
AppSettings.longSuccessToast('tank deleted successfully');
|
|
|
|
|
AppSettings.longSuccessToast('Deliveryboy deleted successfully');
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
AppSettings.longFailedToast('tank deletion failed');
|
|
|
|
|
AppSettings.longFailedToast('Deliveryboy deletion failed');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: const Text('Yes',
|
|
|
|
@ -160,7 +315,7 @@ class _GetDeliveryboyDataState extends State<GetDeliveryboyData> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),)
|
|
|
|
|