Merge branch 'QR' into 'development'
Qr See merge request Cloud_Solution/driver-app!9merge-requests/10/merge
commit
cd115e717b
@ -1,15 +1,22 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
const MAX_SMALL_SCREEN = 660;
|
/// End points
|
||||||
|
|
||||||
const BASE_URL = 'https://uat.hmgwebservices.com/Services';
|
const BASE_URL = 'https://uat.hmgwebservices.com/Services';
|
||||||
|
|
||||||
const GET_PROJECT = '/Lists.svc/REST/GetProject';
|
const GET_PROJECT = '/Lists.svc/REST/GetProject';
|
||||||
const LOGIN = "/Authentication.svc/REST/CheckDriverAuthentication";
|
const LOGIN = "/Authentication.svc/REST/CheckDriverAuthentication";
|
||||||
|
const GET_ALL_ORDERS = '/Patients.svc/REST/PatientER_Delivery_GetAllOrder';
|
||||||
|
const SCAN_QR = '/Patients.svc/REST/PatientER_Delivery_OrderInsert';
|
||||||
|
|
||||||
|
/// Body Constant
|
||||||
|
const CHANNEL = 9;
|
||||||
|
|
||||||
|
|
||||||
|
/// design constant
|
||||||
|
const MAX_SMALL_SCREEN = 660;
|
||||||
|
|
||||||
const GET_ALL_ORDERS = '/Patients.svc/REST/PatientER_Delivery_GetAllOrder';
|
|
||||||
|
|
||||||
class AppGlobal {
|
class AppGlobal {
|
||||||
static BuildContext context;
|
static BuildContext context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,44 @@
|
|||||||
|
class ScanQrRequestModel {
|
||||||
|
int deliveryOrderID;
|
||||||
|
int driverID;
|
||||||
|
int createdBy;
|
||||||
|
int channel;
|
||||||
|
int groupID;
|
||||||
|
String tokenID;
|
||||||
|
String userID;
|
||||||
|
String mobileNo;
|
||||||
|
|
||||||
|
ScanQrRequestModel(
|
||||||
|
{this.deliveryOrderID,
|
||||||
|
this.driverID,
|
||||||
|
this.createdBy,
|
||||||
|
this.channel,
|
||||||
|
this.groupID,
|
||||||
|
this.tokenID,
|
||||||
|
this.userID,
|
||||||
|
this.mobileNo});
|
||||||
|
|
||||||
|
ScanQrRequestModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
deliveryOrderID = json['DeliveryOrderID'];
|
||||||
|
driverID = json['DriverID'];
|
||||||
|
createdBy = json['CreatedBy'];
|
||||||
|
channel = json['Channel'];
|
||||||
|
groupID = json['GroupID'];
|
||||||
|
tokenID = json['TokenID'];
|
||||||
|
userID = json['UserID'];
|
||||||
|
mobileNo = json['MobileNo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['DeliveryOrderID'] = this.deliveryOrderID;
|
||||||
|
data['DriverID'] = this.driverID;
|
||||||
|
data['CreatedBy'] = this.createdBy;
|
||||||
|
data['Channel'] = this.channel;
|
||||||
|
data['GroupID'] = this.groupID;
|
||||||
|
data['TokenID'] = this.tokenID;
|
||||||
|
data['UserID'] = this.userID;
|
||||||
|
data['MobileNo'] = this.mobileNo;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
import 'package:driverapp/config/config.dart';
|
||||||
|
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
|
||||||
|
import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart';
|
||||||
|
import 'package:driverapp/core/service/base_service.dart';
|
||||||
|
|
||||||
|
class OrdersService extends BaseService {
|
||||||
|
List<PendingOrders> _orders = List();
|
||||||
|
List<PendingOrders> get orders => _orders;
|
||||||
|
bool isOrderInserted;
|
||||||
|
|
||||||
|
PendingOrders _requestGetPendingOrders = PendingOrders(
|
||||||
|
driverID: 1111,
|
||||||
|
searchKey: "",
|
||||||
|
pageSize: 0,
|
||||||
|
pageIndex: 0,
|
||||||
|
tokenID: "@dm!n",
|
||||||
|
userID: "1111",
|
||||||
|
mobileNo: "0541710575",
|
||||||
|
);
|
||||||
|
|
||||||
|
Future getPendingOrders() async {
|
||||||
|
hasError = false;
|
||||||
|
try {
|
||||||
|
await baseAppClient.post(GET_ALL_ORDERS,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
_orders.clear();
|
||||||
|
response['PatientER_Delivery_GetAllOrderList'].forEach((order) {
|
||||||
|
_orders.add(PendingOrders.fromJson(order));
|
||||||
|
});
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: _requestGetPendingOrders.toJson());
|
||||||
|
} catch (e) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Future insertOrder() async {
|
||||||
|
ScanQrRequestModel _scanQrRequestModel = ScanQrRequestModel(deliveryOrderID: 1200, groupID: 0);
|
||||||
|
hasError = false;
|
||||||
|
try {
|
||||||
|
await baseAppClient.post(SCAN_QR,
|
||||||
|
onSuccess: (dynamic response, int statusCode) {
|
||||||
|
isOrderInserted = response["PatientER_Delivery_IsOrderInserted"];
|
||||||
|
}, onFailure: (String error, int statusCode) {
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
}, body: _scanQrRequestModel.toJson());
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
hasError = true;
|
||||||
|
super.error = error;
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import 'package:driverapp/config/config.dart';
|
|
||||||
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
|
|
||||||
import 'package:driverapp/core/service/base_service.dart';
|
|
||||||
|
|
||||||
class PendingOrdersService extends BaseService {
|
|
||||||
List<PendingOrders> _orders = List();
|
|
||||||
List<PendingOrders> get orders => _orders;
|
|
||||||
|
|
||||||
PendingOrders _requestGetPendingOrders = PendingOrders(
|
|
||||||
driverID: 1111,
|
|
||||||
searchKey: "",
|
|
||||||
pageSize: 0,
|
|
||||||
pageIndex: 0,
|
|
||||||
tokenID: "@dm!n",
|
|
||||||
userID: "1111",
|
|
||||||
mobileNo: "0541710575",
|
|
||||||
);
|
|
||||||
|
|
||||||
Future getPendingOrders() async {
|
|
||||||
await baseAppClient.post(GET_ALL_ORDERS,
|
|
||||||
onSuccess: (dynamic response, int statusCode) {
|
|
||||||
_orders.clear();
|
|
||||||
response['PatientER_Delivery_GetAllOrderList'].forEach((order) {
|
|
||||||
_orders.add(PendingOrders.fromJson(order));
|
|
||||||
});
|
|
||||||
}, onFailure: (String error, int statusCode) {
|
|
||||||
hasError = true;
|
|
||||||
super.error = error;
|
|
||||||
}, body: _requestGetPendingOrders.toJson());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue