My invoices implementation continued
parent
709877b5f1
commit
a32501f3dc
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,100 @@
|
|||||||
|
class GetDentalAppointmentsResponse {
|
||||||
|
List<ListDentalAppointments> listDentalAppointments;
|
||||||
|
|
||||||
|
GetDentalAppointmentsResponse({this.listDentalAppointments});
|
||||||
|
|
||||||
|
GetDentalAppointmentsResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
if (json['List_DentalAppointments'] != null) {
|
||||||
|
listDentalAppointments = new List<ListDentalAppointments>();
|
||||||
|
json['List_DentalAppointments'].forEach((v) {
|
||||||
|
listDentalAppointments.add(new ListDentalAppointments.fromJson(v));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
if (this.listDentalAppointments != null) {
|
||||||
|
data['List_DentalAppointments'] =
|
||||||
|
this.listDentalAppointments.map((v) => v.toJson()).toList();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ListDentalAppointments {
|
||||||
|
String setupId;
|
||||||
|
int projectID;
|
||||||
|
int patientID;
|
||||||
|
int appointmentNo;
|
||||||
|
String appointmentDate;
|
||||||
|
dynamic appointmentDateN;
|
||||||
|
int clinicID;
|
||||||
|
int doctorID;
|
||||||
|
int invoiceNo;
|
||||||
|
int status;
|
||||||
|
String arrivedOn;
|
||||||
|
String doctorName;
|
||||||
|
dynamic doctorNameN;
|
||||||
|
String clinicName;
|
||||||
|
String doctorImageURL;
|
||||||
|
String projectName;
|
||||||
|
|
||||||
|
ListDentalAppointments(
|
||||||
|
{this.setupId,
|
||||||
|
this.projectID,
|
||||||
|
this.patientID,
|
||||||
|
this.appointmentNo,
|
||||||
|
this.appointmentDate,
|
||||||
|
this.appointmentDateN,
|
||||||
|
this.clinicID,
|
||||||
|
this.doctorID,
|
||||||
|
this.invoiceNo,
|
||||||
|
this.status,
|
||||||
|
this.arrivedOn,
|
||||||
|
this.doctorName,
|
||||||
|
this.doctorNameN,
|
||||||
|
this.clinicName,
|
||||||
|
this.doctorImageURL,
|
||||||
|
this.projectName});
|
||||||
|
|
||||||
|
ListDentalAppointments.fromJson(Map<String, dynamic> json) {
|
||||||
|
setupId = json['SetupId'];
|
||||||
|
projectID = json['ProjectID'];
|
||||||
|
patientID = json['PatientID'];
|
||||||
|
appointmentNo = json['AppointmentNo'];
|
||||||
|
appointmentDate = json['AppointmentDate'];
|
||||||
|
appointmentDateN = json['AppointmentDateN'];
|
||||||
|
clinicID = json['ClinicID'];
|
||||||
|
doctorID = json['DoctorID'];
|
||||||
|
invoiceNo = json['InvoiceNo'];
|
||||||
|
status = json['Status'];
|
||||||
|
arrivedOn = json['ArrivedOn'];
|
||||||
|
doctorName = json['DoctorName'];
|
||||||
|
doctorNameN = json['DoctorNameN'];
|
||||||
|
clinicName = json['ClinicName'];
|
||||||
|
doctorImageURL = json['DoctorImageURL'];
|
||||||
|
projectName = json['ProjectName'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['SetupId'] = this.setupId;
|
||||||
|
data['ProjectID'] = this.projectID;
|
||||||
|
data['PatientID'] = this.patientID;
|
||||||
|
data['AppointmentNo'] = this.appointmentNo;
|
||||||
|
data['AppointmentDate'] = this.appointmentDate;
|
||||||
|
data['AppointmentDateN'] = this.appointmentDateN;
|
||||||
|
data['ClinicID'] = this.clinicID;
|
||||||
|
data['DoctorID'] = this.doctorID;
|
||||||
|
data['InvoiceNo'] = this.invoiceNo;
|
||||||
|
data['Status'] = this.status;
|
||||||
|
data['ArrivedOn'] = this.arrivedOn;
|
||||||
|
data['DoctorName'] = this.doctorName;
|
||||||
|
data['DoctorNameN'] = this.doctorNameN;
|
||||||
|
data['ClinicName'] = this.clinicName;
|
||||||
|
data['DoctorImageURL'] = this.doctorImageURL;
|
||||||
|
data['ProjectName'] = this.projectName;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class InvoiceDetail extends StatelessWidget {
|
||||||
|
final DoctorList doctor;
|
||||||
|
final ListDentalAppointments listDentalAppointments;
|
||||||
|
|
||||||
|
InvoiceDetail(this.doctor, this.listDentalAppointments);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).myInvoice,
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
body: Container(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
DoctorView(doctor: doctor, isLiveCareAppointment: false, isShowFlag: false),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0),
|
||||||
|
padding: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0, bottom: 10.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey[800],
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(8),
|
||||||
|
topRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text("Description", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
Text("Quantity", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
Text("Price", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
Text("Total", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,234 @@
|
|||||||
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'
|
||||||
|
as DoctorListResponse;
|
||||||
|
import 'package:diplomaticquarterapp/models/MyInvoices/GetDentalAppointmentsResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/medical/my_invoices/invoice_detail_page.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/my_invoice_service/my_invoice_services.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class MyInvoices extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_MyInvoicesState createState() => _MyInvoicesState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _MyInvoicesState extends State<MyInvoices> {
|
||||||
|
bool isDataLoaded = false;
|
||||||
|
GetDentalAppointmentsResponse getDentalAppointmentsResponse;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
getDentalAppointments();
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
|
return AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).myInvoice,
|
||||||
|
isShowAppBar: true,
|
||||||
|
isShowDecPage: false,
|
||||||
|
body: Container(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
child: isDataLoaded
|
||||||
|
? Column(
|
||||||
|
children: [
|
||||||
|
...List.generate(
|
||||||
|
getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments.length,
|
||||||
|
(index) => InkWell(
|
||||||
|
onTap: () {
|
||||||
|
openInvoiceDetailsPage(getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments[index]);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(8.0)),
|
||||||
|
),
|
||||||
|
margin: EdgeInsets.all(10.0),
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.fromLTRB(
|
||||||
|
20.0, 10.0, 20.0, 10.0),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.circular(100.0),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/images/new-design/ViewDetailsIco.png",
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
height: 60.0,
|
||||||
|
width: 60.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Appointment No: ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text("Appointment Date: ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10.0, bottom: 10.0),
|
||||||
|
child: Text("Clinic: ",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text(
|
||||||
|
getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments[index]
|
||||||
|
.appointmentNo
|
||||||
|
.toString(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 10.0),
|
||||||
|
child: Text(
|
||||||
|
DateUtil.getMonthDayYearDateFormatted(
|
||||||
|
DateUtil.convertStringToDate(
|
||||||
|
getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments[
|
||||||
|
index]
|
||||||
|
.appointmentDate)),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
top: 10.0, bottom: 10.0),
|
||||||
|
child: Text(
|
||||||
|
getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments[index]
|
||||||
|
.clinicName,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
letterSpacing: 0.5)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
projectViewModel.isArabic
|
||||||
|
? Container(
|
||||||
|
margin: EdgeInsets.only(left: 15.0),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/images/new-design/arrow_menu_black-ar.png",
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
height: 20.0,
|
||||||
|
width: 12.0),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
margin: EdgeInsets.only(right: 15.0),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/images/new-design/arrow_menu_black-en.png",
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
height: 20.0,
|
||||||
|
width: 12.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
openInvoiceDetailsPage(ListDentalAppointments listDentalAppointments) {
|
||||||
|
DoctorListResponse.DoctorList doctor = new DoctorListResponse.DoctorList();
|
||||||
|
|
||||||
|
doctor.name = listDentalAppointments.doctorName;
|
||||||
|
doctor.projectName = listDentalAppointments.projectName;
|
||||||
|
doctor.date = listDentalAppointments.appointmentDate;
|
||||||
|
doctor.actualDoctorRate = 0;
|
||||||
|
doctor.doctorImageURL = listDentalAppointments.doctorImageURL;
|
||||||
|
doctor.dayName = listDentalAppointments.invoiceNo;
|
||||||
|
doctor.doctorTitle = "Dr.";
|
||||||
|
doctor.clinicName = "InvoiceNo: " + listDentalAppointments.invoiceNo.toString();
|
||||||
|
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FadePage(
|
||||||
|
page: InvoiceDetail(
|
||||||
|
doctor,
|
||||||
|
listDentalAppointments,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
getDentalAppointments() {
|
||||||
|
GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
MyInvoicesService myInvoicesService = new MyInvoicesService();
|
||||||
|
|
||||||
|
myInvoicesService.getAllDentalAppointments(12, context).then((res) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
setState(() {
|
||||||
|
if (res['MessageStatus'] == 1) {
|
||||||
|
getDentalAppointmentsResponse =
|
||||||
|
GetDentalAppointmentsResponse.fromJson(res);
|
||||||
|
print(getDentalAppointmentsResponse.listDentalAppointments.length);
|
||||||
|
print(getDentalAppointmentsResponse
|
||||||
|
.listDentalAppointments[0].appointmentNo);
|
||||||
|
} else {
|
||||||
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||||
|
}
|
||||||
|
isDataLoaded = true;
|
||||||
|
});
|
||||||
|
}).catchError((err) {
|
||||||
|
GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
print(err);
|
||||||
|
AppToast.showErrorToast(message: err);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
import 'package:diplomaticquarterapp/config/config.dart';
|
||||||
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/service/base_service.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
|
||||||
|
import 'package:diplomaticquarterapp/models/Request.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
||||||
|
|
||||||
|
class MyInvoicesService extends BaseService {
|
||||||
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
||||||
|
AppGlobal appGlobal = new AppGlobal();
|
||||||
|
|
||||||
|
AuthenticatedUser authUser = new AuthenticatedUser();
|
||||||
|
AuthProvider authProvider = new AuthProvider();
|
||||||
|
|
||||||
|
Future<Map> getAllDentalAppointments(int projectID,
|
||||||
|
context) async {
|
||||||
|
Map<String, dynamic> request;
|
||||||
|
var languageID =
|
||||||
|
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
||||||
|
Request req = appGlobal.getPublicRequest();
|
||||||
|
request = {
|
||||||
|
"LanguageID": languageID == 'ar' ? 1 : 2,
|
||||||
|
"IPAdress": "10.20.10.20",
|
||||||
|
"VersionID": req.VersionID,
|
||||||
|
"Channel": req.Channel,
|
||||||
|
"generalid": 'Cs2020@2016\$2958',
|
||||||
|
"PatientOutSA": authUser.outSA,
|
||||||
|
"DeviceTypeID": req.DeviceTypeID,
|
||||||
|
"SessionID": null,
|
||||||
|
"PatientID": authUser.patientID,
|
||||||
|
"License": true,
|
||||||
|
"IsRegistered": true,
|
||||||
|
"ProjectID": projectID,
|
||||||
|
"PatientTypeID":authUser.patientIdentificationType,
|
||||||
|
"PatientType":authUser.patientType,
|
||||||
|
"isDentalAllowedBackend": false
|
||||||
|
};
|
||||||
|
|
||||||
|
dynamic localRes;
|
||||||
|
|
||||||
|
await baseAppClient.post(GET_ALL_APPOINTMENTS_FOR_DENTAL_CLINIC,
|
||||||
|
onSuccess: (response, statusCode) async {
|
||||||
|
localRes = response;
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
throw error;
|
||||||
|
}, body: request);
|
||||||
|
return Future.value(
|
||||||
|
localRes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue