master
Sneha 2 weeks ago
parent fdfdecf6da
commit e49f859358

@ -120,12 +120,10 @@ InputDecoration textFormFieldDecorationHintText(IconData icon,var text){
); );
} }
TextStyle PreloaderText() { TextStyle PreloaderText() {
return TextStyle(color:primaryColor); return TextStyle(color:primaryColor);
} }
class AppSettings{ class AppSettings{
static SharedPreferences sharedPreferences = static SharedPreferences sharedPreferences =
SharedPreferences.getInstance() as SharedPreferences; SharedPreferences.getInstance() as SharedPreferences;
@ -159,6 +157,7 @@ class AppSettings{
static String acceptOrderRequestsUrl = host + 'request-booking-with-charges'; static String acceptOrderRequestsUrl = host + 'request-booking-with-charges';
static String getAcceptedOrdersFromUsersUrl = host + 'getAllTankersBookingdetails'; static String getAcceptedOrdersFromUsersUrl = host + 'getAllTankersBookingdetails';
static String getPlanRequestsFromUsersUrl = host + 'getuserRequestbookingsforplansforsupplier'; static String getPlanRequestsFromUsersUrl = host + 'getuserRequestbookingsforplansforsupplier';
static String acceptPlanRequestsUrl = host + 'supplier/recurring/respond';
static String getTankersUrl = host + 'getTankers'; static String getTankersUrl = host + 'getTankers';
static String getTankerDetailsByNameUrl = host + 'getsingledetails'; static String getTankerDetailsByNameUrl = host + 'getsingledetails';
static String addTankerUrl = host + 'addTankers'; static String addTankerUrl = host + 'addTankers';
@ -503,6 +502,30 @@ class AppSettings{
} }
} }
static Future<bool> acceptPlanRequests(payload,dbId) async {
var uri = Uri.parse(acceptPlanRequestsUrl+'/'+dbId+'/'+AppSettings.supplierId);
var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.put(uri,body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
static Future<String> getTankers() async { static Future<String> getTankers() async {
var uri = Uri.parse(getTankersUrl); var uri = Uri.parse(getTankersUrl);
uri = uri.replace(query: 'supplierId=$supplierId'); uri = uri.replace(query: 'supplierId=$supplierId');
@ -1302,6 +1325,7 @@ class AppSettings{
backgroundColor: Colors.white, backgroundColor: Colors.white,
elevation: 0, elevation: 0,
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
titleSpacing: 0,
title: Text(title,style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w500),), title: Text(title,style: fontTextStyle(14,Color(0XFF2A2A2A),FontWeight.w500),),
iconTheme: IconThemeData(color: Color(0XFF2A2A2A)), iconTheme: IconThemeData(color: Color(0XFF2A2A2A)),
actions: [ actions: [
@ -1424,5 +1448,4 @@ class AppSettings{
); );
} }
} }

@ -134,7 +134,6 @@ class _ChangeDriverScreenState extends State<ChangeDriverScreen> {
} }
} }
Widget _assignedTankerDetails() { Widget _assignedTankerDetails() {
if (isTankersDataLoading) { if (isTankersDataLoading) {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
@ -748,7 +747,7 @@ class _ChangeDriverScreenState extends State<ChangeDriverScreen> {
final d = sourcesList[idx]; final d = sourcesList[idx];
final isSelected = final isSelected =
selectedSourceIndex == idx; selectedSourceIndex == idx;
/* final statusColor = d.status == "available" /* final statusColor = d.status == "available"
? const Color(0XFF0A9E04) ? const Color(0XFF0A9E04)
: (d.status == "on delivery" : (d.status == "on delivery"
? const Color(0XFFD0AE3C) ? const Color(0XFFD0AE3C)
@ -893,7 +892,6 @@ class _ChangeDriverScreenState extends State<ChangeDriverScreen> {
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(

@ -12,18 +12,13 @@ class AcceptPlanRequests extends StatefulWidget {
class _AcceptPlanRequestsState extends State<AcceptPlanRequests> { class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
int advancePayable = 0; int advancePayable = 0;
int advance =0; //int advance =0;
double amountToPayAfterDelivery = 0.0; double amountToPayAfterDelivery = 0.0;
double totalFare = 0.0;
@override @override
void initState() { void initState() {
// TODO: implement initState // TODO: implement initState
super.initState(); super.initState();
advance = 150;
advancePayable = advance;
//totalFare = advance + double.parse(widget.order.quoted_amount)??0;
amountToPayAfterDelivery = totalFare - advancePayable;
} }
@override @override
@ -272,13 +267,10 @@ class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
), ),
_detailRow("Tanker Price", _detailRow("Tanker Price",
"${AppSettings.formDouble(widget.order.quoted_amount) ?? ''}"), "${AppSettings.formDouble(widget.order.quoted_amount) ?? ''}"),
SizedBox( /* SizedBox(
height: MediaQuery.of(context).size.height * .004,
),
_detailRow("Booking Charges", "" + advance.toString()),
SizedBox(
height: MediaQuery.of(context).size.height * .004, height: MediaQuery.of(context).size.height * .004,
), ),
_detailRow("Total Amount", "" + totalFare.toString()), _detailRow("Total Amount", "" + totalFare.toString()),
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * .004, height: MediaQuery.of(context).size.height * .004,
@ -296,7 +288,7 @@ class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
height: MediaQuery.of(context).size.height * .004, height: MediaQuery.of(context).size.height * .004,
), ),
_detailRow("Amount to Pay (After Delivery)", _detailRow("Amount to Pay (After Delivery)",
'${AppSettings.formDouble(amountToPayAfterDelivery.toString()) ?? ''}'), '${AppSettings.formDouble(amountToPayAfterDelivery.toString()) ?? ''}'),*/
], ],
), ),
), ),
@ -330,7 +322,6 @@ class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
MaterialPageRoute( MaterialPageRoute(
builder: (_) => EditPlanRequests( builder: (_) => EditPlanRequests(
order: widget.order, order: widget.order,
advance: advance.toString(),
status: widget.status, status: widget.status,
), ),
), ),
@ -425,12 +416,12 @@ class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
if (isOnline) { if (isOnline) {
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
payload["supplierId"] = AppSettings.supplierId; /*payload["supplierId"] = AppSettings.supplierId;
payload["amount"] = int.parse(widget.order.quoted_amount); payload["amount"] = int.parse(widget.order.quoted_amount);
payload["delivery_charges"] = advance; payload["delivery_charges"] = advance;*/
payload["action"] = 'accept'; payload["action"] = 'accept';
bool status = await AppSettings.acceptOrderRequests( bool status = await AppSettings.acceptPlanRequests(
payload, widget.order.dbId); payload, widget.order.dbId);
try { try {
@ -440,7 +431,7 @@ class _AcceptPlanRequestsState extends State<AcceptPlanRequests> {
} }
else{ else{
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();
AppSettings.longFailedToast("Accept of order request Failed"); AppSettings.longFailedToast("Accept of plan request Failed");
} }
} catch (e) { } catch (e) {
Navigator.of(context,rootNavigator: true).pop(); Navigator.of(context,rootNavigator: true).pop();

@ -81,7 +81,7 @@ class _PlanRequestsPageState extends State<PlanRequestsPage> {
// Statuses that ignore time // Statuses that ignore time
if (dbLower == "reject") return {"status": "Rejected", "color": const Color(0XFFE2483D)}; if (dbLower == "reject") return {"status": "Rejected", "color": const Color(0XFFE2483D)};
if (dbLower == "accept") return {"status": "Accepted", "color": const Color(0XFF0A9E04)}; if (dbLower == "accepted") return {"status": "Accepted", "color": const Color(0XFF0A9E04)};
if (dbLower == "advance_paid") return {"status": "Accepted", "color": const Color(0XFF0A9E04)}; if (dbLower == "advance_paid") return {"status": "Accepted", "color": const Color(0XFF0A9E04)};
if (dbLower == "cancelled" || dbLower == "cancelled_by_user" || dbLower == "cancelled_by_supplier") { if (dbLower == "cancelled" || dbLower == "cancelled_by_user" || dbLower == "cancelled_by_supplier") {
return {"status": "Cancelled", "color": const Color(0XFF757575)}; return {"status": "Cancelled", "color": const Color(0XFF757575)};

@ -25,12 +25,12 @@ class PlanRequestsModel {
factory PlanRequestsModel.fromJson(Map<String, dynamic> json){ factory PlanRequestsModel.fromJson(Map<String, dynamic> json){
PlanRequestsModel rtvm = new PlanRequestsModel(); PlanRequestsModel rtvm = new PlanRequestsModel();
// rtvm.building_name = json['customer_details']['buildingName'] ?? ''; rtvm.building_name = json['customer_details']['buildingName'] ?? '';
rtvm.dbId = json['_id']?? ''; rtvm.dbId = json['_id']?? '';
// rtvm.address = json['customer_details']['profile']['address1'] ?? ''; rtvm.address = json['customer_details']['profile']['address1'] ?? '';
rtvm.type_of_water = json['type_of_water'] ?? ''; rtvm.type_of_water = json['type_of_water'] ?? '';
rtvm.capacity = json['capacity'] ?? ''; rtvm.capacity = json['capacity'] ?? '';
//rtvm.quantity = json['quantity']?? ''; rtvm.quantity = json['quantity']?? '';
rtvm.frequency = json['frequency']?? ''; rtvm.frequency = json['frequency']?? '';
if(rtvm.frequency.toString().toLowerCase()=='weekly_twice'){ if(rtvm.frequency.toString().toLowerCase()=='weekly_twice'){
@ -53,9 +53,9 @@ class PlanRequestsModel {
rtvm.averageTime = json['time'] ?? ''; rtvm.averageTime = json['time'] ?? '';
rtvm.time = json['my_supplier_entry']['time'] ?? ''; rtvm.time = json['my_supplier_entry']['time'] ?? '';
rtvm.status = json['my_supplier_entry']['status'] ?? ''; rtvm.status = json['my_supplier_entry']['status'] ?? '';
//rtvm.quoted_amount = json['my_supplier_entry']['quoted_amount'].toString() ?? ''; rtvm.quoted_amount = json['my_supplier_entry']['quoted_amount'].toString() ?? '';
//rtvm.lng=json['customer_details']['longitude'] ?? 0.0; rtvm.lng=json['customer_details']['longitude'] ?? 0.0;
//rtvm.lat=json['customer_details']['latitude'] ?? 0.0; rtvm.lat=json['customer_details']['latitude'] ?? 0.0;
// Split and trim // Split and trim
List<String> parts = rtvm.address.split(',').map((e) => e.trim()).toList(); List<String> parts = rtvm.address.split(',').map((e) => e.trim()).toList();

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save