Blood donation CR implementing
parent
a5e0de08ce
commit
a2a305ea71
@ -0,0 +1,46 @@
|
||||
class BloodDonationProjectsListResponse {
|
||||
int rowID;
|
||||
int iD;
|
||||
int projectID;
|
||||
int numberOfRooms;
|
||||
bool isActive;
|
||||
int createdBy;
|
||||
String createdOn;
|
||||
dynamic editedBy;
|
||||
dynamic editedON;
|
||||
String projectName;
|
||||
dynamic projectNameN;
|
||||
|
||||
BloodDonationProjectsListResponse(
|
||||
{this.rowID, this.iD, this.projectID, this.numberOfRooms, this.isActive, this.createdBy, this.createdOn, this.editedBy, this.editedON, this.projectName, this.projectNameN});
|
||||
|
||||
BloodDonationProjectsListResponse.fromJson(Map<String, dynamic> json) {
|
||||
rowID = json['RowID'];
|
||||
iD = json['ID'];
|
||||
projectID = json['ProjectID'];
|
||||
numberOfRooms = json['NumberOfRooms'];
|
||||
isActive = json['IsActive'];
|
||||
createdBy = json['CreatedBy'];
|
||||
createdOn = json['CreatedOn'];
|
||||
editedBy = json['EditedBy'];
|
||||
editedON = json['EditedON'];
|
||||
projectName = json['ProjectName'];
|
||||
projectNameN = json['ProjectNameN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['RowID'] = this.rowID;
|
||||
data['ID'] = this.iD;
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['NumberOfRooms'] = this.numberOfRooms;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['CreatedBy'] = this.createdBy;
|
||||
data['CreatedOn'] = this.createdOn;
|
||||
data['EditedBy'] = this.editedBy;
|
||||
data['EditedON'] = this.editedON;
|
||||
data['ProjectName'] = this.projectName;
|
||||
data['ProjectNameN'] = this.projectNameN;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,112 @@
|
||||
import 'package:diplomaticquarterapp/core/model/blooddonation/blood_donation_projects_list_response.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/blood/blood_donation_service.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../AlHabibMedicalService/h2o/h20_setting.dart';
|
||||
|
||||
class BloodDonationBookAppointment extends StatefulWidget {
|
||||
const BloodDonationBookAppointment();
|
||||
|
||||
@override
|
||||
State<BloodDonationBookAppointment> createState() => _BloodDonationBookAppointmentState();
|
||||
}
|
||||
|
||||
class _BloodDonationBookAppointmentState extends State<BloodDonationBookAppointment> {
|
||||
List<BloodDonationProjectsListResponse> bloodDonationProjectsListResponse = [];
|
||||
int _selectedProjectID = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
getBloodDonationProjectsList();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
isShowAppBar: true,
|
||||
showNewAppBar: true,
|
||||
backgroundColor: Color(0xffF7F7F7),
|
||||
showNewAppBarTitle: true,
|
||||
isShowDecPage: true,
|
||||
description: TranslationBase.of(context).bloodDonationInfo,
|
||||
appBarTitle: TranslationBase.of(context).bloodD,
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(21),
|
||||
child: Column(
|
||||
children: [
|
||||
CommonDropDownView(TranslationBase.of(context).selectProject, "Select Hospital", () {
|
||||
List<RadioSelectionDialogModel> list = [];
|
||||
|
||||
bloodDonationProjectsListResponse.forEach((element) {
|
||||
list.add(RadioSelectionDialogModel(element.projectName, element.projectID));
|
||||
});
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (cxt) => RadioSelectionDialog(
|
||||
listData: list,
|
||||
selectedIndex: 0,
|
||||
onValueSelected: (index) {
|
||||
print(index);
|
||||
_selectedProjectID = index;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).withBorderedContainer,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getBloodDonationFreeSlots() {
|
||||
BloodDonationService service = new BloodDonationService();
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
service.getBloodDonationProjectsList().then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(res['BD_getProjectsHaveBDClinics']);
|
||||
if (res["MessageStatus"] == 1) {
|
||||
res['BD_getProjectsHaveBDClinics'].forEach((element) {
|
||||
bloodDonationProjectsListResponse.add(BloodDonationProjectsListResponse.fromJson(element));
|
||||
});
|
||||
print(bloodDonationProjectsListResponse.length);
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
|
||||
}
|
||||
}).catchError((err) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(err);
|
||||
});
|
||||
}
|
||||
|
||||
getBloodDonationProjectsList() {
|
||||
BloodDonationService service = new BloodDonationService();
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
service.getBloodDonationProjectsList().then((res) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(res['BD_getProjectsHaveBDClinics']);
|
||||
if (res["MessageStatus"] == 1) {
|
||||
res['BD_getProjectsHaveBDClinics'].forEach((element) {
|
||||
bloodDonationProjectsListResponse.add(BloodDonationProjectsListResponse.fromJson(element));
|
||||
});
|
||||
print(bloodDonationProjectsListResponse.length);
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res["ErrorEndUserMessage"]);
|
||||
}
|
||||
}).catchError((err) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
print(err);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue