second commit
This commit is contained in:
@@ -0,0 +1,378 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
|
||||
|
||||
|
||||
class AddCustomerView extends StatelessWidget {
|
||||
AddCustomerView({super.key});
|
||||
|
||||
AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<AddPickupCustomerController>(
|
||||
initState: (_){
|
||||
addPickupCustomerController.getLocation();
|
||||
},
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,)),
|
||||
title: Row(
|
||||
children: [
|
||||
Text('Create customer',),
|
||||
],
|
||||
),
|
||||
titleSpacing: 0,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 9,
|
||||
child: Container(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Expanded(
|
||||
// height: Get.height,
|
||||
child: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height * 1.1,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
customerFirstName(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
// CustomerLastName(),
|
||||
// SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
Container(
|
||||
height: 55,
|
||||
child: contactNo(Get.context),
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 5,),
|
||||
Text("Address",style: TextStyle(color: Colors.grey[600],fontSize: 15),),
|
||||
// Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () async{
|
||||
// if (controller.resultPosition != null) {
|
||||
// var locationResult = await
|
||||
// Get.to(CustomerMap(lat: controller.resultPosition!.latitude, long: controller.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// controller.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on_outlined,
|
||||
// color: Colors.red,
|
||||
// size: 32,
|
||||
// )),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
address(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
height: Get.height*0.08,
|
||||
child: submit(),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
customerFirstName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
UpperCaseTextFormatter()
|
||||
],
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Name',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.customerFirstNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
customerLastName(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'LastName',
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.customerLastNameController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
contactNo(context) {
|
||||
return GetBuilder<AddPickupCustomerController>(
|
||||
builder: (controller) {
|
||||
return TextFormField(
|
||||
enabled: true,
|
||||
maxLength: 10,
|
||||
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
controller: controller.customerPhoneController,
|
||||
onChanged: (value){
|
||||
if(value.length==10){
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
}
|
||||
},
|
||||
onTap: () async {
|
||||
},
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Mobile no',
|
||||
prefixIcon: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * 0.3,
|
||||
height: Get.height * 0.04,
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(flex: 1,),
|
||||
Flexible(
|
||||
child: Icon(
|
||||
Icons.call,
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 1,),
|
||||
Flexible(flex: 3,child: Text("+${controller.selectedDialogCountry.phoneCode}",style: TextStyle(color: ColorConstants.primaryColor,fontWeight: FontWeight.bold))),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),),
|
||||
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
address() {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// onTap: () async{
|
||||
// if (addCustomerController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(CustomerMap(lat: addCustomerController.resultPosition!.latitude, long: addCustomerController.resultPosition!.longitude));
|
||||
// if (locationResult != null) {
|
||||
// addCustomerController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
|
||||
onChanged: (text) => addPickupCustomerController.onSearchTextChanged(text),
|
||||
|
||||
decoration: CustomDecoration.textFieldStyle(),
|
||||
|
||||
maxLines: 2,
|
||||
controller: addPickupCustomerController.addressController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
addPickupCustomerController.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width*0.90,
|
||||
decoration: BoxDecoration(color: Colors.grey[100],borderRadius: BorderRadius.circular(10)),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: addPickupCustomerController.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
addPickupCustomerController.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
addPickupCustomerController.predictions[index]['place_id'];
|
||||
addPickupCustomerController.getPlaceDetails(placeId,prediction);
|
||||
addPickupCustomerController.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox()
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
doorNo(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
// keyboardType: TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Door / Flat number',
|
||||
prefixIcon: Icon(
|
||||
Icons.door_front_door_outlined,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.doorNoController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
landmark(){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
),
|
||||
child: TextFormField(
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: 'Landmark',
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on_rounded,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller: addPickupCustomerController.landMarkController,
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 0,bottom: 5,left: 20,right: 20),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
addPickupCustomerController.describeValidation();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor!,
|
||||
title: 'Create',
|
||||
controller: addPickupCustomerController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class UpperCaseTextFormatter extends TextInputFormatter {
|
||||
@override
|
||||
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
|
||||
return TextEditingValue(
|
||||
text: capitalize(newValue.text),
|
||||
selection: newValue.selection,
|
||||
);
|
||||
}
|
||||
}
|
||||
String capitalize(String value) {
|
||||
if(value.trim().isEmpty) return "";
|
||||
return "${value[0].toUpperCase()}${value.substring(1)}";
|
||||
}
|
||||
@@ -0,0 +1,728 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Customeraddresscontroller.dart';
|
||||
import '../../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../../Helper/custombutton.dart';
|
||||
import '../../../../../../../Helper/customederaction.dart';
|
||||
import '../../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../../../../../Model/Response/Getcustomeraddress/GetCustomerAddress.dart';
|
||||
import '../../../../../Createorderview.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class CustomerPickupAddressView extends StatelessWidget {
|
||||
final GetCustomerByTenantIdDetails? data;
|
||||
|
||||
|
||||
CustomerPickupAddressView({super.key, required this.data});
|
||||
|
||||
PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
elevation: 0.3,
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child:InkWell(
|
||||
onTap: (){
|
||||
pickupCustomerAddressController.deliveryAddressList = false;
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
title: Text('Pickup Address'),
|
||||
titleSpacing: 0,
|
||||
actions: [
|
||||
InkWell(
|
||||
onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
pickupCustomerAddressController.deliveryAddressList = true;
|
||||
pickupCustomerAddressController.addressController.clear();
|
||||
pickupCustomerAddressController.suburbController.clear();
|
||||
pickupCustomerAddressController.cityController.clear();
|
||||
pickupCustomerAddressController.stateController.clear();
|
||||
pickupCustomerAddressController.postCodeController.clear();
|
||||
pickupCustomerAddressController.doornoController.clear();
|
||||
pickupCustomerAddressController.landmarkController.clear();
|
||||
|
||||
pickupCustomerAddressController.update();
|
||||
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 20,
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
child: Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 25,)),
|
||||
),
|
||||
SizedBox(width: 20,)
|
||||
],
|
||||
|
||||
),
|
||||
backgroundColor: Colors.grey[100],
|
||||
body: GetBuilder<PickupCustomerAddressController>(
|
||||
initState: (_){
|
||||
pickupCustomerAddressController.loader = true;
|
||||
pickupCustomerAddressController.customerId =data?.customerid;
|
||||
pickupCustomerAddressController.customerName ="${data?.firstname}"+ "${data?.lastname}";
|
||||
pickupCustomerAddressController.customerContactNo =data?.contactno;
|
||||
pickupCustomerAddressController.customerAddressInfo = data;
|
||||
pickupCustomerAddressController.getDetails();
|
||||
pickupCustomerAddressController.getCustomerAddress();
|
||||
},
|
||||
builder: (controller) {
|
||||
print("deliveryAddressListbool...............${controller.deliveryAddressList}");
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
addAddress(),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10, top: 10, bottom: 5),
|
||||
child: Text(
|
||||
"Select delivery address :",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontSize: 16),
|
||||
textAlign: TextAlign.start,
|
||||
)),
|
||||
controller.deliveryAddressList == true
|
||||
? Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
addressWidget(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
suburb(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
city(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
state(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
postalCode(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
doorNo(),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
landmark(),
|
||||
],
|
||||
)
|
||||
],
|
||||
))
|
||||
: Expanded(
|
||||
child: savedAddressDetailsList()
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
controller.deliveryAddressList == true
|
||||
? submit()
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
proceed(),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
),
|
||||
// floatingActionButton:savedAddressController.deliveryAddressList == false
|
||||
// ? FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ):Container(),
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
addAddress() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 0,left: 10,right: 10),
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
surfaceTintColor: ColorConstants.secondaryColor,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.3,
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(3),color: ColorConstants.primaryColor1),
|
||||
child: Icon(Icons.delivery_dining,size: 55,color: ColorConstants.darkGreyColor),
|
||||
),
|
||||
Container(
|
||||
height: Get.height*0.12,
|
||||
width: Get.width*0.6,
|
||||
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(10),color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 14,left: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 25,),
|
||||
SizedBox(width: 5,),
|
||||
Expanded(child: Text('${data?.firstname} ${data?.lastname}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 1,overflow: TextOverflow.ellipsis)),
|
||||
],
|
||||
),
|
||||
// SizedBox(height: 4,),
|
||||
// Row(
|
||||
// children: [
|
||||
// Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
// SizedBox(width: 5,),
|
||||
// Expanded(child: Padding(
|
||||
// padding: const EdgeInsets.only(top: 5),
|
||||
// child: Text('${data[0].address}',style:TextStyle(fontSize: 15,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold),maxLines: 2,overflow: TextOverflow.ellipsis,),
|
||||
// ),),
|
||||
// ],
|
||||
// ),
|
||||
SizedBox(height: 7,),
|
||||
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: Icon(Icons.phone,color: ColorConstants.primaryColor,size: 25,),
|
||||
),
|
||||
SizedBox(width: 5,),
|
||||
Text('${data?.contactno}',style:TextStyle(fontSize: 18,color: ColorConstants.darkGreyColor,fontWeight: FontWeight.bold)),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressWidget() {
|
||||
return GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
height: Get.height*0.08,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child:
|
||||
TextField(
|
||||
style: TextStyle(
|
||||
fontSize: 14,fontWeight: FontWeight.bold,
|
||||
// color: Colors.grey[400],
|
||||
),
|
||||
controller: controller.addressController,
|
||||
onChanged: (text) => controller.onSearchTextChanged(text),
|
||||
|
||||
decoration: InputDecoration(
|
||||
prefixIcon:Icon( Icons.location_on,color: ColorConstants.primaryColor,) ,
|
||||
suffixIcon: InkWell(
|
||||
onTap: (){
|
||||
controller.addressController.clear();
|
||||
controller.suburbController.clear();
|
||||
controller.cityController.clear();
|
||||
controller.stateController.clear();
|
||||
controller.postCodeController.clear();
|
||||
},
|
||||
child: Icon(Icons.close,color: Colors.red,)),
|
||||
// suffixIcon: InkWell(
|
||||
// onTap: ()async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(Icons.edit,color: ColorConstants.primaryColor,)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[400]!,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: ColorConstants.primaryColor,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
|
||||
labelText: 'Address',
|
||||
labelStyle: TextStyle(color: ColorConstants.primaryColor)),
|
||||
),
|
||||
|
||||
),
|
||||
SizedBox(height: 8,),
|
||||
|
||||
controller.predictions.isNotEmpty?Container(
|
||||
height: Get.height*0.20,
|
||||
width: Get.width,
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Obx(() {
|
||||
return ListView.builder(
|
||||
itemCount: controller.predictions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final prediction =
|
||||
controller.predictions[index]['description'];
|
||||
return ListTile(
|
||||
title: Text(prediction),
|
||||
onTap: () {
|
||||
final placeId =
|
||||
controller.predictions[index]['place_id'];
|
||||
controller.getPlaceDetails(placeId,prediction);
|
||||
controller.searchController.clear();
|
||||
controller.predictions.clear();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
}),):SizedBox(),
|
||||
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget suburb(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Suburb",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.suburbController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget city(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "City",
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.cityController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget state(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "State",
|
||||
prefixIcon: Icon(
|
||||
Icons.account_balance,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.stateController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget postalCode(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "PostCode",
|
||||
prefixIcon: Icon(
|
||||
Icons.local_post_office,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.postCodeController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget landmark(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "LandMark",
|
||||
prefixIcon: Icon(
|
||||
Icons.home,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.landmarkController,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Widget doorNo(){
|
||||
return Container(
|
||||
height: Get.height*0.07,
|
||||
width: Get.width*0.9,
|
||||
// decoration: BoxDecoration(
|
||||
// color: secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
child: TextFormField(
|
||||
style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold),
|
||||
decoration: CustomDecoration.textFieldStyle(
|
||||
labelTextStr: "Doorno",
|
||||
prefixIcon: Icon(
|
||||
Icons.door_back_door,
|
||||
color: ColorConstants.primaryColor,
|
||||
)),
|
||||
controller:pickupCustomerAddressController.doornoController,
|
||||
|
||||
// focusNode: individualNameNode,
|
||||
onEditingComplete: () {
|
||||
var context = Get.context;
|
||||
FocusScope.of(context!).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
savedAddressDetailsList() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10,left: 20),
|
||||
child: GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return controller.getCustomeraddress.isEmpty && !controller.loader == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No delivery address available",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.loader?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
|
||||
Container(
|
||||
width: Get.width*0.90,
|
||||
child: ListView.separated(
|
||||
itemCount: controller.getCustomeraddress.length,
|
||||
padding: EdgeInsets.only(top: 4),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return addressCard(controller.getCustomeraddress[index], index);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) =>
|
||||
Container(height: 8, color: Colors.grey[100]),
|
||||
),
|
||||
// color: Colors.white,
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
addressCard(CustomerAddressDetail models, int index) {
|
||||
return GetBuilder<PickupCustomerAddressController>(
|
||||
builder: (controller) {
|
||||
return InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.address = models.address??'';
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor,borderRadius: BorderRadius.circular(5)),
|
||||
child: ListTile(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.fromLTRB(0, 8, 8, 8),
|
||||
// child: Icon(
|
||||
// Icons.my_location,
|
||||
// size: 25,
|
||||
// color: Colors.grey,
|
||||
// ),
|
||||
// ),
|
||||
trailing: InkWell(
|
||||
onTap: (){
|
||||
controller.selectedAddressIndex = index;
|
||||
controller.locationId = models.locationid!;
|
||||
controller.addressController.text =models.address!;
|
||||
controller.latitude = models.latitude;
|
||||
controller.longitude = models.longitude;
|
||||
// controller.changeCustomeraddress.add(controller.mSelectedAddressIndex[index]);
|
||||
controller.update();
|
||||
print('locationIdonChanged ${controller.locationId}');
|
||||
print('addressControlleronChanged ${controller.addressController.text}');
|
||||
print('addressControlleronChanged ${controller.selectedAddressIndex}');
|
||||
print('latitudeControlleronChanged ${ controller.latitude}');
|
||||
print('longitudeControlleronChanged ${ controller.longitude}');
|
||||
},
|
||||
child: CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor:controller.selectedAddressIndex==index?Colors.green:Colors.grey[300],
|
||||
child: Icon(Icons.check,color: ColorConstants.secondaryColor,size: 20),
|
||||
),
|
||||
),
|
||||
title: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,size: 20,color: ColorConstants.primaryColor,),
|
||||
SizedBox(width: 4,),
|
||||
Text('${controller.getCustomeraddress[index].suburb}',
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Icon(Icons.location_on,size: 20,color: ColorConstants.primaryColor,),
|
||||
),
|
||||
SizedBox(width: 4,),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Container(
|
||||
width: Get.width*0.59,
|
||||
child: Text('${controller.getCustomeraddress[index].address}',
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold,color: ColorConstants.darkGreyColor)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// color: Colors.white,
|
||||
margin: EdgeInsets.only(bottom: 2)),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
submit() {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
pickupCustomerAddressController.describeValidation();
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Submit',
|
||||
controller: pickupCustomerAddressController.submitBtnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
proceed() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20,top: 10),
|
||||
child: Center(
|
||||
child: RoundedButton(
|
||||
onPressed: () {
|
||||
if(pickupCustomerAddressController.selectedAddressIndex!=-1){
|
||||
pickupCustomerAddressController.selectedAddressIndex =-1;
|
||||
// Get.to(OrderDetailsView(data:data));
|
||||
pickupCustomerAddressController.btnController.success();
|
||||
Get.to(CreateOrderView(pickUpData: data,isDashboard: false,));
|
||||
pickupCustomerAddressController.btnController.reset();
|
||||
}
|
||||
else{
|
||||
print('Please Select delivery address');
|
||||
Toast.showToast('Please Select delivery address',);
|
||||
|
||||
pickupCustomerAddressController.btnController.reset();
|
||||
}
|
||||
pickupCustomerAddressController.update();
|
||||
|
||||
},
|
||||
color:ColorConstants.primaryColor,
|
||||
title: 'Proceed',
|
||||
controller: pickupCustomerAddressController.btnController,
|
||||
textStyle: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: "Lato",
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold),
|
||||
height: Get.height*0.06,
|
||||
width: Get.width*0.8,
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
)),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 5,left: 20),
|
||||
// child: FloatingActionButton(
|
||||
// onPressed: () async{
|
||||
// if (savedAddressController.resultPosition != null) {
|
||||
// var locationResult = await Get.to(AddCustomerAddressMap( long: savedAddressController.resultPosition!.longitude, lat: savedAddressController.resultPosition!.latitude,));
|
||||
// if (locationResult != null) {
|
||||
// savedAddressController.setLocationValues(locationResult);
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.location_on,
|
||||
// color: ColorConstants.secondaryColor,
|
||||
// ),
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../../Createorderview.dart';
|
||||
|
||||
class TenantPickUpCustomerView extends StatelessWidget {
|
||||
TenantPickUpCustomerView({super.key});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.progress = true;
|
||||
tenantPickupCustomerController.getCustomerByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// pickupCustomerAddressController.selectedAddressIndex = -1;
|
||||
createOrderController.pickupCustomerId = item.data.customerid;
|
||||
createOrderController.pickUpCustomerName = "${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = item.data.contactno;
|
||||
createOrderController.pickupLocationId = item.data.deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.fromLatitude = item.data.latitude;
|
||||
createOrderController.fromLongitude = item.data.longitude;
|
||||
createOrderController.fromAddress =item.data.address;
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
Get.to(CreateOrderView(pickUpData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
'${item.data.suburb??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,898 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import '../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Pickupcustomertabscontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Customeraddress/Addcustomer/Addcustomercontroller.dart';
|
||||
import '../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../Helper/Logger.dart';
|
||||
import '../../../../Helper/toast.dart';
|
||||
import '../../../../Helper/utility.dart';
|
||||
import '../../Createorderview.dart';
|
||||
import 'Allcustomers/Tenantcustomers/Tenantcustomerview.dart';
|
||||
import 'Tenants/Tenantsview.dart';
|
||||
|
||||
// class PickupCustomerTabView extends StatelessWidget {
|
||||
// final int tabIndex;
|
||||
//
|
||||
// PickupCustomerTabView({super.key, this.tabIndex = 0});
|
||||
//
|
||||
// PickupCustomerTabController pickupCustomerTabController = Get.put(PickupCustomerTabController());
|
||||
// AddPickupCustomerController addPickupCustomerController = Get.put(AddPickupCustomerController());
|
||||
//
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return GetBuilder<PickupCustomerTabController>(
|
||||
// initState: (_){
|
||||
// if (tabIndex != 0) {
|
||||
// print('tabindex ${tabIndex}');
|
||||
// pickupCustomerTabController.tabIndex =tabIndex;
|
||||
// }
|
||||
// // orderMainController.tabIndex = tabIndex;
|
||||
// pickupCustomerTabController.tabController.index = tabIndex;
|
||||
// pickupCustomerTabController.tabController.addListener(() {
|
||||
// if (!pickupCustomerTabController.tabController.indexIsChanging) {
|
||||
// // pickupCustomerTabController.update();
|
||||
// pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// },
|
||||
// builder: (controller) {
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.grey[100],
|
||||
// appBar: AppBar(
|
||||
// leading: Padding(
|
||||
// padding: const EdgeInsets.all(5.0),
|
||||
// child:InkWell(
|
||||
// onTap: (){
|
||||
//
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
// ),
|
||||
// titleSpacing: 0,
|
||||
//
|
||||
// title: Row(
|
||||
// children: [
|
||||
// Text("Pickup address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
// const Spacer(),
|
||||
// InkWell(
|
||||
// onTap: () {
|
||||
// addPickupCustomerController.customerFirstNameController.clear();
|
||||
// addPickupCustomerController.customerLastNameController.clear();
|
||||
// addPickupCustomerController.customerPhoneController.clear();
|
||||
// addPickupCustomerController.addressController.clear() ;
|
||||
// addPickupCustomerController.doorNoController.clear() ;
|
||||
// addPickupCustomerController.landMarkController.clear() ;
|
||||
// addPickupCustomerController.predictions.clear();
|
||||
// Get.to(AddCustomerView());
|
||||
// },
|
||||
// child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.end,
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: EdgeInsets.only(bottom: 3,right: 0),
|
||||
// child: Icon(
|
||||
// Icons.person_add_alt_rounded,
|
||||
// size: 35,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 10,)
|
||||
// ],
|
||||
// ),
|
||||
// elevation: 0,
|
||||
// backgroundColor: ColorConstants.primaryColor,
|
||||
// automaticallyImplyLeading: false,
|
||||
//
|
||||
// // backwardsCompatibility: false,
|
||||
// ),
|
||||
// body: Stack(
|
||||
// children: [
|
||||
// Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.start,
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// TabBar(
|
||||
// tabs: controller.tabs,
|
||||
// unselectedLabelColor: ColorConstants.primaryColor,
|
||||
// indicatorColor: ColorConstants.primaryColor,
|
||||
// indicatorSize: TabBarIndicatorSize.tab,
|
||||
// labelColor: ColorConstants.primaryColor,
|
||||
// controller: controller.tabController,
|
||||
// onTap: (_){
|
||||
// pickupCustomerTabController.tabIndex = pickupCustomerTabController.tabController.index;
|
||||
// print("tabIndexonTap ${pickupCustomerTabController.tabIndex}");
|
||||
// },
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: TabBarView(
|
||||
// controller: controller.tabController,
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// children: [
|
||||
// TenantPickUpCustomerView(),
|
||||
// TenantPickUpTenantsView(),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class PickupCustomerView extends StatelessWidget {
|
||||
PickupCustomerView({super.key});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
void onScroll() {
|
||||
double maxScroll = scrollController.position.maxScrollExtent;
|
||||
double currentScroll = scrollController.position.pixels;
|
||||
|
||||
if (maxScroll == currentScroll && tenantPickupCustomerController.hasMore.value) {
|
||||
tenantPickupCustomerController.getCustomerData();
|
||||
}
|
||||
}
|
||||
|
||||
scrollController.addListener(onScroll);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
appBar: AppBar(
|
||||
leading: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child:InkWell(
|
||||
onTap: (){
|
||||
Get.back();
|
||||
},
|
||||
child: Icon(Icons.reply,size: 30,color: ColorConstants.secondaryColor,)),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
|
||||
title: Row(
|
||||
children: [
|
||||
Text("Saved address",style: TextStyle(color: ColorConstants.secondaryColor)),
|
||||
],
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: ColorConstants.primaryColor,
|
||||
automaticallyImplyLeading: false,
|
||||
// backwardsCompatibility: false,
|
||||
),
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.shimmer.value = true;
|
||||
// tenantPickupCustomerController.getCustomerByTenantId();
|
||||
// tenantPickupCustomerController.getCustomerData();
|
||||
tenantPickupCustomerController.refreshData();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 10,bottom: 10),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: TextField(
|
||||
controller: controller.searchController,
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
// focusNode: controller.focusNode,
|
||||
onChanged: (data){
|
||||
var keyword = data;
|
||||
print('keyword................${keyword}');
|
||||
if(data.isNotEmpty) {
|
||||
controller.shimmer.value = true;
|
||||
controller.getSearchCustomerData(keyword);
|
||||
}
|
||||
else{
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
controller.update();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: IconButton(
|
||||
icon: const Icon(Icons.search),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
hintText: 'Search by customer',
|
||||
hintStyle: TextStyle(
|
||||
color: Colors.grey[500]!,
|
||||
|
||||
|
||||
),
|
||||
suffixIcon: controller.searchController.text.isEmpty ? const SizedBox() : IconButton(
|
||||
icon: const Icon(Icons.cancel),
|
||||
color: Colors.grey[500]!,
|
||||
onPressed: () {
|
||||
controller.shimmer.value = true;
|
||||
controller.refreshData();
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
),
|
||||
border: InputBorder.none),
|
||||
),
|
||||
),
|
||||
controller.getCustomerBytenantId.isEmpty && !controller.shimmer.value
|
||||
? Center(
|
||||
heightFactor: 3.0,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.shimmer.value?Center(
|
||||
heightFactor: 15.0,
|
||||
child: CircularProgressIndicator(color: ColorConstants.primaryColor)):
|
||||
controller.shimmer.value?
|
||||
queueShimmerCard(context):
|
||||
Expanded(
|
||||
child:controller.searchController.text.isEmpty? ListView.builder(
|
||||
controller: scrollController,
|
||||
itemCount: controller.hasMore.value
|
||||
? controller.getCustomerBytenantId.length + 1
|
||||
: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
if(index < controller.getCustomerBytenantId.length){
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
InkWell(
|
||||
onTap:(){
|
||||
createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickupContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.pickupPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;
|
||||
|
||||
print('pickupCustomerIdmainpage ${createOrderController.pickupCustomerId}');
|
||||
|
||||
logger.i (createOrderController.pickupCustomerId);
|
||||
logger.i (createOrderController.dropCustomerId);
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
createOrderController.pickupSaveAddress = false;
|
||||
Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString()
|
||||
)
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
else{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: ColorConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
):
|
||||
ListView.builder(
|
||||
itemCount: controller.getCustomerBytenantId.length,
|
||||
itemBuilder: (BuildContext context,int index)
|
||||
{
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
createOrderController.pickupCustomerId = controller.getCustomerBytenantId[index].customerid;
|
||||
createOrderController.pickUpCustomerName = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = controller.getCustomerBytenantId[index].contactno;
|
||||
createOrderController.pickUpLandMark = controller.getCustomerBytenantId[index].landmark;
|
||||
createOrderController.pickUpDoorNo = controller.getCustomerBytenantId[index].doorno;
|
||||
createOrderController.pickupLocationId = controller.getCustomerBytenantId[index].deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = controller.getCustomerBytenantId[index].tenantlocationid;
|
||||
createOrderController.fromLatitude = controller.getCustomerBytenantId[index].latitude;
|
||||
createOrderController.fromLongitude = controller.getCustomerBytenantId[index].longitude;
|
||||
createOrderController.fromAddress =controller.getCustomerBytenantId[index].address;
|
||||
|
||||
createOrderController.pickupAddressController.text = controller.getCustomerBytenantId[index].address??'';
|
||||
createOrderController.pickupContactNameController.text = "${controller.getCustomerBytenantId[index].firstname}" + "${controller.getCustomerBytenantId[index].lastname}";
|
||||
createOrderController.pickupContactNoController.text = controller.getCustomerBytenantId[index].contactno??'';
|
||||
createOrderController.pickupDoorNoController.text = controller.getCustomerBytenantId[index].doorno??'';
|
||||
createOrderController.pickupLandMarkController.text = controller.getCustomerBytenantId[index].landmark??'';
|
||||
createOrderController.pickupStateController.text = controller.getCustomerBytenantId[index].state ??'';
|
||||
createOrderController.pickupCityController.text = controller.getCustomerBytenantId[index].city??'' ;
|
||||
createOrderController.pickupSuburbController.text = controller.getCustomerBytenantId[index].suburb??'';
|
||||
createOrderController.pickupPostcodeController.text = controller.getCustomerBytenantId[index].postcode??'' ;
|
||||
|
||||
logger.i (createOrderController.pickupCustomerId);
|
||||
logger.i (createOrderController.dropCustomerId);
|
||||
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
createOrderController.pickupSaveAddress = false;
|
||||
Get.to(CreateOrderView(pickUpData:controller.getCustomerBytenantId[index], isDashboard: false,));
|
||||
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.15,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
color: UtilityPromotion
|
||||
.getLightColors(
|
||||
controller.getCustomerBytenantId[index].firstname![0]
|
||||
.toString())
|
||||
.withAlpha(100),
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: 10,),
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
controller.getCustomerBytenantId[index].firstname == '' ?'':
|
||||
controller.getCustomerBytenantId[index].firstname![0].toString().toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
Spacer(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 5,bottom: 5,right: 5,left: 5),
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].suburb}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
controller.getCustomerBytenantId[index].firstname ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'${controller.getCustomerBytenantId[index].contactno}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.location_on,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${controller.getCustomerBytenantId[index].address}',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
queueShimmerCard(BuildContext context) {
|
||||
return Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: 6,
|
||||
itemBuilder: (_, __) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
child: Shimmer.fromColors(
|
||||
enabled: true,
|
||||
highlightColor: ColorConstants.lightGreyBg!,
|
||||
baseColor: Colors.grey[300]!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 10,
|
||||
right: 10,
|
||||
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: ()async{
|
||||
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 15
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConstants.secondaryColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(color: Colors.grey)
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(3)),
|
||||
),
|
||||
height: Get.height*0.10,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(5),
|
||||
decoration: const BoxDecoration(
|
||||
color:Colors.grey,
|
||||
shape: BoxShape.rectangle,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.white70,
|
||||
radius: 28,
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.black54,
|
||||
fontSize: 22),
|
||||
)),
|
||||
],
|
||||
),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
flex: 8,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person,
|
||||
color: ColorConstants
|
||||
.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors
|
||||
.grey[600],
|
||||
fontWeight:
|
||||
FontWeight
|
||||
.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.call,
|
||||
color:
|
||||
ColorConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
color: ColorConstants
|
||||
.darkGreyColor,
|
||||
fontSize: 14,
|
||||
fontWeight:
|
||||
FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10,
|
||||
// ),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
import 'package:alphabet_search_view/alphabet_search_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../../../../Helper/toast.dart';
|
||||
import '../../../../../Controller/Createorder/Createordercontroller.dart';
|
||||
import '../../../../../Controller/Dashboard/Pickup/Tabs/Tenantcustomers/Tenantcustomercontroller.dart';
|
||||
import '../../../../../Helper/Constants/Assetconstants.dart';
|
||||
import '../../../../../Helper/Constants/Colorconstants.dart';
|
||||
import '../../../../../Model/Response/Customers/GetCustomerById/GetCustomerByTenantId.dart';
|
||||
import '../../../Createorderview.dart';
|
||||
|
||||
class TenantPickUpTenantsView extends StatelessWidget {
|
||||
final bool? navigate;
|
||||
TenantPickUpTenantsView({super.key, this.navigate});
|
||||
|
||||
TenantPickupCustomerController tenantPickupCustomerController = Get.put(TenantPickupCustomerController());
|
||||
CreateOrderController createOrderController = Get.put(CreateOrderController());
|
||||
// PickupCustomerAddressController pickupCustomerAddressController = Get.put(PickupCustomerAddressController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey[100],
|
||||
|
||||
body: GetBuilder<TenantPickupCustomerController>(
|
||||
initState: (_){
|
||||
tenantPickupCustomerController.progress = true;
|
||||
tenantPickupCustomerController.getTenantsByTenantId();
|
||||
|
||||
},
|
||||
builder: (controller) {
|
||||
return controller.getCustomerBytenantId.isEmpty && !controller.progress == true
|
||||
? Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Image(
|
||||
height: 160,
|
||||
width: 160,
|
||||
image: AssetImage(AssetConstants.NoRecords),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Text(
|
||||
"No customers at this moment",
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
fontSize: 18),
|
||||
),
|
||||
],
|
||||
)):controller.progress?Center(child: CircularProgressIndicator(color: ColorConstants.primaryColor)): Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: AlphabetSearchView<GetCustomerByTenantIdDetails>.list(
|
||||
decoration: AlphabetSearchDecoration.fromContext(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
withSearch: true,
|
||||
context,
|
||||
subtitleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor),
|
||||
titleStyle: TextStyle(backgroundColor: ColorConstants.secondaryColor,),
|
||||
letterHeaderTextStyle: TextStyle(
|
||||
backgroundColor: ColorConstants.secondaryColor,
|
||||
color: ColorConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40),
|
||||
),
|
||||
list: controller.getCustomerBytenantId.map(
|
||||
(e) => AlphabetSearchModel<GetCustomerByTenantIdDetails>(
|
||||
title: e.firstname.toString() + e.lastname.toString(),
|
||||
subtitle: e.contactno.toString(),
|
||||
data: e,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onItemTap: (_, index, item) {
|
||||
// deliveryDetailsController.weightSelectedIndex = -1;
|
||||
// deliveryDetailsController.paymentSelectedIndex = -1;
|
||||
// deliveryDetailsController.timeSelectIndex = -1;
|
||||
// deliveryDetailsController.weight = null;
|
||||
// deliveryDetailsController.selectedDate = DateTime.now();
|
||||
// deliveryDetailsController.datetime = DateTime.now();
|
||||
// deliveryDetailsController.subCatName = null;
|
||||
// deliveryDetailsController.tecNotes.clear();
|
||||
// deliveryDetailsController.payment =null;
|
||||
// savedAddressController.deliveryAddressList = false;
|
||||
// savedAddressController.mSelectedAddressIndex = -1;
|
||||
// pickupCustomerAddressController.selectedAddressIndex = -1;
|
||||
createOrderController.pickupCustomerId = item.data.customerid;
|
||||
createOrderController.pickUpCustomerName = "${item.data.firstname}" + "${item.data.lastname}";
|
||||
createOrderController.pickUpCustomerContactNo = item.data.contactno;
|
||||
createOrderController.pickupLocationId = item.data.deliverylocationid;
|
||||
createOrderController.pickupTenantLocationId = item.data.tenantlocationid;
|
||||
createOrderController.fromLatitude = item.data.latitude;
|
||||
createOrderController.fromLongitude = item.data.longitude;
|
||||
createOrderController.fromAddress =item.data.address;
|
||||
|
||||
if(createOrderController.pickupCustomerId == createOrderController.dropCustomerId){
|
||||
Toast.showToast('Please select different customer it already selected');
|
||||
}
|
||||
else{
|
||||
|
||||
Get.to(CreateOrderView(pickUpData:item.data, isDashboard: false,));
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
buildItem: (_, index, item) {
|
||||
print('dashboardgetCustomerBytenantId${controller.getCustomerBytenantId.length}');
|
||||
return Container(
|
||||
decoration: BoxDecoration(color: ColorConstants.secondaryColor),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 14,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_city,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.data.suburb??'',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.location_on,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'${item.data.address??''}',
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Flexible(
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.phone,color: ColorConstants.primaryColor,size: 20,),
|
||||
const SizedBox(width: 3,),
|
||||
Text(
|
||||
item.subtitle!,
|
||||
style: TextStyle(color: ColorConstants.darkGreyColor,fontSize: 14,fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user