|
|
|
|
@ -27,16 +27,14 @@ class MyHttpOverrides extends HttpOverrides {
|
|
|
|
|
|
|
|
|
|
class API {
|
|
|
|
|
static getCallRequestInfoByClinicInfo(String deviceIp,
|
|
|
|
|
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess,
|
|
|
|
|
required Function(dynamic) onFailure}) async {
|
|
|
|
|
{required Function(List<PatientTicketModel>, List<PatientTicketModel>, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async {
|
|
|
|
|
final body = {"ipAdress": deviceIp, "apiKey": apiKey};
|
|
|
|
|
bool isDevMode = false;
|
|
|
|
|
if (isDevMode) {
|
|
|
|
|
final Map<String, dynamic> response = testPatientsData["data"] as Map<String, dynamic>;
|
|
|
|
|
|
|
|
|
|
CallConfig callConfig = CallConfig.fromJson(response["callConfig"]);
|
|
|
|
|
var callPatients =
|
|
|
|
|
(response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList();
|
|
|
|
|
log("callPatients: ${callPatients.toString()}");
|
|
|
|
|
log("isQueuePatients: ${isQueuePatients.toString()}");
|
|
|
|
|
@ -50,11 +48,7 @@ class API {
|
|
|
|
|
final response = apiResp["data"];
|
|
|
|
|
|
|
|
|
|
CallConfig callConfig = CallConfig.fromJson(response["callConfig"]);
|
|
|
|
|
var callPatients = (response["callPatients"] as List)
|
|
|
|
|
.map((j) => PatientTicketModel.fromJson(j))
|
|
|
|
|
.toList()
|
|
|
|
|
.where((element) => element.callType != 0)
|
|
|
|
|
.toList();
|
|
|
|
|
var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList();
|
|
|
|
|
|
|
|
|
|
var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList();
|
|
|
|
|
callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp));
|
|
|
|
|
@ -108,7 +102,10 @@ class API {
|
|
|
|
|
body: body,
|
|
|
|
|
onSuccess: (response, status) {
|
|
|
|
|
if (status == 200 && response["data"] != null) {
|
|
|
|
|
widgetsConfigModel = (response["data"] as List).map((e) => WidgetsConfigModel.fromJson(e)).toList().first;
|
|
|
|
|
List list = (response["data"] as List).map((e) => WidgetsConfigModel.fromJson(e)).toList();
|
|
|
|
|
if (list.isNotEmpty) {
|
|
|
|
|
widgetsConfigModel = list.first;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onFailure: (error, status) => log("error: ${error.toString()}"));
|
|
|
|
|
|