parent
08bf881f28
commit
942703ed32
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
class CartItemsModel {
|
||||
String medicine_name='';
|
||||
String quantity='';
|
||||
String price='';
|
||||
List items=[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CartItemsModel();
|
||||
|
||||
factory CartItemsModel.fromJson(Map<String, dynamic> json){
|
||||
CartItemsModel rtvm = new CartItemsModel();
|
||||
|
||||
//rtvm.items=json['items']??[];
|
||||
rtvm.medicine_name = json['medicinename']?? '';
|
||||
rtvm.quantity =json['quantity'].toString()?? '';
|
||||
rtvm.price = json['price'].toString()?? '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
class GetAllOffersModel {
|
||||
String description='';
|
||||
String name='';
|
||||
String code='';
|
||||
String category='';
|
||||
String startDate='';
|
||||
String endDate='';
|
||||
String picture='';
|
||||
String pharmacy_id='';
|
||||
bool isChecked=false;
|
||||
|
||||
|
||||
|
||||
|
||||
GetAllOffersModel();
|
||||
|
||||
factory GetAllOffersModel.fromJson(Map<String, dynamic> json){
|
||||
GetAllOffersModel rtvm = new GetAllOffersModel();
|
||||
rtvm.description = json['description'] ?? '';
|
||||
rtvm.name = json['offer_name'] ?? '';
|
||||
rtvm.code = json['offer_code'] ?? '';
|
||||
rtvm.category = json['category'] ?? '';
|
||||
rtvm.startDate = json['starting_date'] ?? '';
|
||||
rtvm.endDate = json['ending_date'] ?? '';
|
||||
rtvm.picture = json['picture'][0]['url'] ?? '';
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
class GetAllQuotationsModel {
|
||||
String bookingId='';
|
||||
String pharmacyId='';
|
||||
String pharmacyName='';
|
||||
String pharmacyContactNumber='';
|
||||
String pharmacy_address='';
|
||||
List prescriptionImages=[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GetAllQuotationsModel();
|
||||
|
||||
factory GetAllQuotationsModel.fromJson(Map<String, dynamic> json){
|
||||
GetAllQuotationsModel rtvm = new GetAllQuotationsModel();
|
||||
rtvm.bookingId = json['bookingId'] ?? '';
|
||||
rtvm.pharmacyId = json['pharmacyId'] ?? '';
|
||||
if(json['pharmacyInfo']!=null){
|
||||
rtvm.pharmacyName = json['pharmacyInfo']['pharmacyname'] ?? '';
|
||||
rtvm.pharmacyContactNumber = json['pharmacyInfo']['profile']['contactNumber'] ?? '';
|
||||
rtvm.pharmacy_address = json['pharmacyInfo']['profile']['pharmacy_address'] ?? '';
|
||||
}
|
||||
else{
|
||||
rtvm.pharmacyName = '';
|
||||
rtvm.pharmacyContactNumber = '';
|
||||
rtvm.pharmacy_address ='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
import 'dart:convert';
|
||||
|
||||
List<GetOffersDetailsModel> listdadFromJson(String str) => List<GetOffersDetailsModel >.from(json.decode(str).map((x) => GetOffersDetailsModel .fromJson(x)));
|
||||
|
||||
String listdadToJson(List<GetOffersDetailsModel > data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
||||
|
||||
class GetOffersDetailsModel {
|
||||
String ? description;
|
||||
String ? starting_date;
|
||||
String ? ending_date;
|
||||
String ? offer_code;
|
||||
List<Picture> picture;
|
||||
String ? offer_name;
|
||||
String ? category;
|
||||
String ? pharmacyId;
|
||||
String request_status='';
|
||||
|
||||
|
||||
GetOffersDetailsModel ({
|
||||
required this.description,
|
||||
required this.starting_date,
|
||||
required this.ending_date,
|
||||
required this.offer_code,
|
||||
required this.picture,
|
||||
required this.offer_name ,
|
||||
required this.category ,
|
||||
required this.pharmacyId ,
|
||||
required this.request_status ,
|
||||
});
|
||||
|
||||
factory GetOffersDetailsModel .fromJson(Map<String, dynamic> json) => GetOffersDetailsModel (
|
||||
description: json["description"],
|
||||
starting_date: json["starting_date"],
|
||||
ending_date: json["ending_date"],
|
||||
offer_code: json["offer_code"],
|
||||
category: json["category"],
|
||||
|
||||
picture: List<Picture>.from(json["picture"].map((x) => Picture.fromJson(x))),
|
||||
offer_name : json["offer_name"],
|
||||
pharmacyId : json["pharmacyId"],
|
||||
request_status : json["request_status"],
|
||||
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"description": description,
|
||||
"starting_date": starting_date,
|
||||
"ending_date": ending_date,
|
||||
"offer_code": offer_code,
|
||||
"picture": List<dynamic>.from(picture.map((x) => x.toJson())),
|
||||
"offer_name": offer_name,
|
||||
"category": category,
|
||||
"pharmacyId": pharmacyId,
|
||||
"request_status": request_status,
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
class Picture {
|
||||
String id;
|
||||
String url;
|
||||
|
||||
Picture({
|
||||
required this.id,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
factory Picture.fromJson(Map<String, dynamic> json) => Picture(
|
||||
id: json["_id"],
|
||||
url: json["url"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_id": id,
|
||||
"url": url,
|
||||
};
|
||||
}
|
@ -0,0 +1,345 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/zoom_image.dart';
|
||||
import 'package:healthcare_user/models/cart_items_model.dart';
|
||||
import 'package:healthcare_user/models/get_all_offers_model.dart';
|
||||
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
|
||||
import 'package:healthcare_user/models/get_offer_details_model.dart';
|
||||
import 'package:healthcare_user/my_connections/add-doctor.dart';
|
||||
import 'package:healthcare_user/orders/cart-items.dart';
|
||||
|
||||
import '../models/get_all_quotations.dart';
|
||||
|
||||
class CartItems extends StatefulWidget {
|
||||
var myObject;
|
||||
CartItems({this.myObject});
|
||||
|
||||
@override
|
||||
State<CartItems> createState() => _CartItemsState();
|
||||
}
|
||||
|
||||
class _CartItemsState extends State<CartItems>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _controller;
|
||||
bool isDataLoading = false;
|
||||
bool isOffersLoading = false;
|
||||
bool isSereverIssue = false;
|
||||
String bookingId='';
|
||||
String totalCartPrice='';
|
||||
String totalCartPriceAfterDiscount='';
|
||||
|
||||
final List<Tab> topTabs = <Tab>[
|
||||
Tab(
|
||||
child: Text(
|
||||
'Pending',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
Tab(
|
||||
child: Text(
|
||||
'Completed',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
];
|
||||
List<CartItemsModel> cartItemsList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TabController(vsync: this, length: topTabs.length);
|
||||
getAllCartItems();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllCartItems() async {
|
||||
isDataLoading = true;
|
||||
try {
|
||||
var payload = new Map<String, dynamic>();
|
||||
payload["pharmacyId"] = widget.myObject.pharmacyId;
|
||||
payload["customerId"] =AppSettings.customerId;
|
||||
var response = await AppSettings.getAllCartItems(widget.myObject.bookingId,payload);
|
||||
|
||||
setState(() {
|
||||
cartItemsList =
|
||||
((jsonDecode(response)['data'][0]['items']) as List).map((dynamic model) {
|
||||
return CartItemsModel.fromJson(model);
|
||||
}).toList();
|
||||
cartItemsList = cartItemsList.reversed.toList();
|
||||
bookingId=jsonDecode(response)['data'][0]['bookingId'];
|
||||
totalCartPrice=jsonDecode(response)['data'][0]['totalCartPrice'].toString();
|
||||
totalCartPriceAfterDiscount=jsonDecode(response)['data'][0]['totalCartPriceAfterDiscount'].toString();
|
||||
isDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _cartItems() {
|
||||
if (cartItemsList.length != 0) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(child: ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: cartItemsList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async{
|
||||
|
||||
},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Medicine Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Quantity',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Price',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
cartItemsList[index]
|
||||
.medicine_name
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
cartItemsList[index].quantity,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
cartItemsList[index]
|
||||
.price
|
||||
,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
})),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .06,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Total cart price: $totalCartPrice'),
|
||||
Text('Total cart price after discount: $totalCartPriceAfterDiscount'),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .06,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
AppSettings.preLoaderDialog(context);
|
||||
bool isOnline = await AppSettings.internetConnectivity();
|
||||
if(isOnline){
|
||||
var payload = new Map<String, dynamic>();
|
||||
|
||||
payload["user"] = {"profile": {"firstName": AppSettings.userName.toString(),
|
||||
"lastName": '',
|
||||
"contactNumber": AppSettings.phoneNumber.toString(),
|
||||
"address1": AppSettings.userAddress.toString(),
|
||||
"address2": AppSettings.detailedAddress.toString(),
|
||||
"country": ''
|
||||
},};
|
||||
payload["pharmacies"] = [
|
||||
{
|
||||
"pharmacyId": widget.myObject.pharmacyId.toString(),
|
||||
"pharmacyname": widget.myObject.pharmacyName.toString(),
|
||||
"phone":widget.myObject.pharmacyContactNumber.toString(),
|
||||
"profile": "?"
|
||||
}
|
||||
];
|
||||
payload["prescriptionPicture"] =
|
||||
{
|
||||
"pictureUrl": [
|
||||
"string"
|
||||
]
|
||||
};
|
||||
payload["amount"] =
|
||||
{
|
||||
"biddingAmount": totalCartPriceAfterDiscount!='null'?int.parse(totalCartPriceAfterDiscount):0,
|
||||
"totalAmount": totalCartPrice!='null'?int.parse(totalCartPrice):0,
|
||||
"discountAmount":0,
|
||||
};
|
||||
|
||||
bool orderStatus = await AppSettings.orderNow(payload,widget.myObject.bookingId);
|
||||
|
||||
try {
|
||||
if(orderStatus){
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longSuccessToast("order placed successfully");
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("failed to order");
|
||||
}
|
||||
} catch (exception) {
|
||||
print(exception);
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("failed to order");
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast(
|
||||
"Please check your internet");
|
||||
}
|
||||
},
|
||||
child: Text('Order now'),
|
||||
)),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No Cart items found'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Cart Items'),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: isDataLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _cartItems(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,805 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/zoom_image.dart';
|
||||
import 'package:healthcare_user/models/get_all_offers_model.dart';
|
||||
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
|
||||
import 'package:healthcare_user/models/get_offer_details_model.dart';
|
||||
import 'package:healthcare_user/my_connections/add-doctor.dart';
|
||||
import 'package:healthcare_user/orders/cart-items.dart';
|
||||
|
||||
import '../models/get_all_quotations.dart';
|
||||
|
||||
class AllQuotations extends StatefulWidget {
|
||||
const AllQuotations({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AllQuotations> createState() => _AllQuotationsState();
|
||||
}
|
||||
|
||||
class _AllQuotationsState extends State<AllQuotations>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _controller;
|
||||
bool isDataLoading = false;
|
||||
bool isOffersLoading = false;
|
||||
bool isSereverIssue = false;
|
||||
|
||||
final List<Tab> topTabs = <Tab>[
|
||||
Tab(
|
||||
child: Text(
|
||||
'Pending',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
Tab(
|
||||
child: Text(
|
||||
'Completed',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
];
|
||||
List<GetAllQuotationsModel> quotationsListOriginal = [];
|
||||
List<GetAllOffersModel> offersListOriginal = [];
|
||||
List<GetOffersDetailsModel> offersList = [];
|
||||
List pharmaciesCheckboxes = [];
|
||||
List pharmaciesCheckboxesInDialog = [];
|
||||
List selectedPharmacies = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TabController(vsync: this, length: topTabs.length);
|
||||
getAllQuotations();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllQuotations() async {
|
||||
isDataLoading = true;
|
||||
try {
|
||||
var response = await AppSettings.getAllQuotations();
|
||||
|
||||
setState(() {
|
||||
quotationsListOriginal =
|
||||
((jsonDecode(response)['data']) as List).map((dynamic model) {
|
||||
return GetAllQuotationsModel.fromJson(model);
|
||||
}).toList();
|
||||
quotationsListOriginal = quotationsListOriginal.reversed.toList();
|
||||
isDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getAllOffers(pharmacyId) async {
|
||||
isOffersLoading = true;
|
||||
try {
|
||||
var response = await AppSettings.getAllOffersUnderPharmacy(pharmacyId);
|
||||
|
||||
setState(() {
|
||||
offersListOriginal =
|
||||
((jsonDecode(response)['data']) as List).map((dynamic model) {
|
||||
return GetAllOffersModel.fromJson(model);
|
||||
}).toList();
|
||||
offersListOriginal = offersListOriginal.reversed.toList();
|
||||
isOffersLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isOffersLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _pendingQuotations() {
|
||||
if (quotationsListOriginal.length != 0) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: quotationsListOriginal.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async{
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartItems(myObject: quotationsListOriginal[index],)),
|
||||
);
|
||||
},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Booking Id',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Pharmacy Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Pharmacy ContactNumber',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
quotationsListOriginal[index]
|
||||
.bookingId
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
quotationsListOriginal[index].pharmacyName,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
quotationsListOriginal[index]
|
||||
.pharmacyContactNumber,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
/*ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
await getAllOffers(quotationsListOriginal[index]
|
||||
.pharmacyId
|
||||
.toString());
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return SizedBox(
|
||||
child: isOffersLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _offersData(),
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Text('Check Offers'),
|
||||
),*/
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No pending quotations'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _offers() {
|
||||
if (offersListOriginal.length != 0) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(10),
|
||||
itemCount: offersListOriginal.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Booking Id',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
/*
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Specialization',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Qualification',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Hospital',
|
||||
style: labelTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
/* SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
offersListOriginal[index]
|
||||
.description
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
|
||||
/* SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].specialization,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].qualification,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].hospital_name,
|
||||
style: valuesTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No pending quotations'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _offersData() {
|
||||
if (offersListOriginal.length != 0) {
|
||||
return Container(
|
||||
color: Colors.white60,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
itemCount: offersListOriginal.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
elevation: 3.0,
|
||||
child: CheckboxListTile(
|
||||
title: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
new MaterialPageRoute(
|
||||
builder: (__) =>
|
||||
new ImageZoomPage(
|
||||
imageName: 'Reports',
|
||||
imageDetails:
|
||||
offersListOriginal[
|
||||
index]
|
||||
.picture)));
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.18,
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
.10,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
image: DecorationImage(
|
||||
image: offersListOriginal[index]
|
||||
.picture ==
|
||||
''
|
||||
? AssetImage(
|
||||
"images/logo.png")
|
||||
: NetworkImage(
|
||||
offersListOriginal[
|
||||
index]
|
||||
.picture)
|
||||
as ImageProvider, // picked file
|
||||
fit: BoxFit.contain)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
//width: MediaQuery.of(context).size.width * .70,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Code',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Description',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Category',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Start Date',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'End Date',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
offersListOriginal[index]
|
||||
.name
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].code,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].description,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].category,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].startDate,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].endDate,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
checkColor: Colors.white,
|
||||
activeColor: primaryColor,
|
||||
value: offersListOriginal[index].isChecked,
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
offersListOriginal[index].isChecked = val!;
|
||||
},
|
||||
);
|
||||
/*if (offersListOriginal[index].isChecked) {
|
||||
pharmaciesCheckboxes.add({
|
||||
'pharmacyId': offersListOriginal[index].pharmacy_id,
|
||||
});
|
||||
selectedPharmacies.add(offersListOriginal[index]);
|
||||
} else {
|
||||
pharmaciesCheckboxes.removeWhere((e) =>
|
||||
e['pharmacyId'].toString().toUpperCase() ==
|
||||
offersListOriginal[index]
|
||||
.pharmacy_id
|
||||
.toString()
|
||||
.toUpperCase());
|
||||
selectedPharmacies.remove(offersListOriginal[index]);
|
||||
}*/
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1, //.size.width * .33,
|
||||
childAspectRatio: MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height / 5)),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: isSereverIssue
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
image: AssetImage('images/serverissue.png'),
|
||||
// height: MediaQuery.of(context).size.height * .10,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
'There is an issue at server please try after some time',
|
||||
style: serverIssueTextStyle(),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
/*Image(
|
||||
image: AssetImage('images/resourceblue.pngs'),
|
||||
// height: MediaQuery.of(context).size.height * .10,
|
||||
),*/
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
'No offers available',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _pharmacies() {
|
||||
return Container();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('All Quotations'),
|
||||
backgroundColor: primaryColor,
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
tabs: topTabs,
|
||||
indicatorColor: buttonColors,
|
||||
unselectedLabelColor: Colors.white60,
|
||||
indicatorWeight: 2,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: TabBarView(controller: _controller, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: isDataLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _pendingQuotations(),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue