|
|
|
|
@ -17,14 +17,14 @@ abstract class AppointmentRepo {
|
|
|
|
|
Future<List<AppointmentListModel>> getMyAppointments(
|
|
|
|
|
Map<String, dynamic> map);
|
|
|
|
|
|
|
|
|
|
Future<MResponse> updateAppointmentStatus(
|
|
|
|
|
Map<String, dynamic> map);
|
|
|
|
|
Future<MResponse> updateAppointmentStatus(Map<String, dynamic> map);
|
|
|
|
|
|
|
|
|
|
Future<MResponse> updateAppointmentPaymentStatus(
|
|
|
|
|
Map<String, dynamic> map);
|
|
|
|
|
Future<MResponse> updateAppointmentPaymentStatus(Map<String, dynamic> map);
|
|
|
|
|
|
|
|
|
|
Future<MResponse> getAppointmentSlots(Map<String, dynamic> map);
|
|
|
|
|
|
|
|
|
|
Future<MResponse> createMergeAppointment(Map<String, dynamic> map);
|
|
|
|
|
|
|
|
|
|
Future<Services> getAllServices(String branchId);
|
|
|
|
|
|
|
|
|
|
Future<MResponse> createSchedule(Map map);
|
|
|
|
|
@ -38,19 +38,19 @@ abstract class AppointmentRepo {
|
|
|
|
|
Future<MResponse> updateServicesInSchedule(Map map);
|
|
|
|
|
|
|
|
|
|
Future<List<ServiceAppointmentScheduleModel>>
|
|
|
|
|
mergeServiceIntoAvailableSchedules({
|
|
|
|
|
mergeServiceIntoAvailableSchedules({
|
|
|
|
|
required List<String> serviceItemIdsForHome,
|
|
|
|
|
required List<String> serviceItemIdsForWorkshop,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Future<GenericRespModel> createServiceAppointment(
|
|
|
|
|
{required List<ServiceAppointmentScheduleModel> schedules,
|
|
|
|
|
required int serviceProviderID});
|
|
|
|
|
required int serviceProviderID});
|
|
|
|
|
|
|
|
|
|
Future<GenericRespModel> cancelOrRescheduleServiceAppointment(
|
|
|
|
|
{required int serviceAppointmentID,
|
|
|
|
|
required int serviceSlotID,
|
|
|
|
|
required int appointmentScheduleAction});
|
|
|
|
|
required int serviceSlotID,
|
|
|
|
|
required int appointmentScheduleAction});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
@ -59,7 +59,7 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
Map<String, dynamic> map = {"ProviderBranchID": branchId};
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
(json) => Services.fromJson(json), ApiConsts.getServicesOfBranch,
|
|
|
|
|
(json) => Services.fromJson(json), ApiConsts.getServicesOfBranch,
|
|
|
|
|
token: t, queryParameters: map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -67,7 +67,7 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
Future<MResponse> createSchedule(Map map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.createSchedule, map,
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.createSchedule, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -75,7 +75,7 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
Future<MResponse> addServicesInSchedule(Map map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.createGroup, map,
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.createGroup, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -85,22 +85,22 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
|
|
|
|
|
GenericRespModel adsGenericModel =
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.getSchedule,
|
|
|
|
|
token: t,
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.getSchedule,
|
|
|
|
|
token: t,
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return List.generate(adsGenericModel.data.length,
|
|
|
|
|
(index) => ScheduleData.fromJson(adsGenericModel.data[index]));
|
|
|
|
|
(index) => ScheduleData.fromJson(adsGenericModel.data[index]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<MResponse> updateSchedule(Map map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateSchedule, map,
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateSchedule, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -108,12 +108,12 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
Future<MResponse> updateServicesInSchedule(Map map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateGroup, map,
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateGroup, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<List<ServiceAppointmentScheduleModel>>
|
|
|
|
|
mergeServiceIntoAvailableSchedules({
|
|
|
|
|
mergeServiceIntoAvailableSchedules({
|
|
|
|
|
required List<String> serviceItemIdsForHome,
|
|
|
|
|
required List<String> serviceItemIdsForWorkshop,
|
|
|
|
|
}) async {
|
|
|
|
|
@ -129,19 +129,20 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
GenericRespModel adsGenericModel =
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.GetServiceItemAppointmentScheduleSlots,
|
|
|
|
|
queryParameters,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.GetServiceItemAppointmentScheduleSlots,
|
|
|
|
|
queryParameters,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
if (adsGenericModel.data == null) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
List<ServiceAppointmentScheduleModel> serviceAppointmentScheduleModel =
|
|
|
|
|
List.generate(
|
|
|
|
|
adsGenericModel.data.length,
|
|
|
|
|
(index) => ServiceAppointmentScheduleModel.fromJson(
|
|
|
|
|
List.generate(
|
|
|
|
|
adsGenericModel.data.length,
|
|
|
|
|
(index) =>
|
|
|
|
|
ServiceAppointmentScheduleModel.fromJson(
|
|
|
|
|
adsGenericModel.data[index],
|
|
|
|
|
isForAppointment: true));
|
|
|
|
|
return serviceAppointmentScheduleModel;
|
|
|
|
|
@ -149,7 +150,7 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
|
|
|
|
|
Future<GenericRespModel> createServiceAppointment(
|
|
|
|
|
{required List<ServiceAppointmentScheduleModel> schedules,
|
|
|
|
|
required int serviceProviderID}) async {
|
|
|
|
|
required int serviceProviderID}) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
int customerId = AppState().getUser.data!.userInfo!.customerId ?? 0;
|
|
|
|
|
|
|
|
|
|
@ -170,12 +171,12 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
GenericRespModel adsGenericModel =
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.ServiceProvidersAppointmentCreate,
|
|
|
|
|
mapList,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.ServiceProvidersAppointmentCreate,
|
|
|
|
|
mapList,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return adsGenericModel;
|
|
|
|
|
}
|
|
|
|
|
@ -183,8 +184,8 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
@override
|
|
|
|
|
Future<GenericRespModel> cancelOrRescheduleServiceAppointment(
|
|
|
|
|
{required int serviceAppointmentID,
|
|
|
|
|
required int serviceSlotID,
|
|
|
|
|
required int appointmentScheduleAction}) async {
|
|
|
|
|
required int serviceSlotID,
|
|
|
|
|
required int appointmentScheduleAction}) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
|
|
|
|
|
final payload = {
|
|
|
|
|
@ -194,12 +195,12 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
GenericRespModel adsGenericModel =
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.ServiceProviderAppointmentRescheduleCancelAppointment,
|
|
|
|
|
payload,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
ApiConsts.ServiceProviderAppointmentRescheduleCancelAppointment,
|
|
|
|
|
payload,
|
|
|
|
|
token: t,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return adsGenericModel;
|
|
|
|
|
}
|
|
|
|
|
@ -210,15 +211,16 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
|
|
|
|
|
GenericRespModel genericRespModel =
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
token: t,
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
ApiConsts.serviceProvidersAppointmentGet,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
token: t,
|
|
|
|
|
(json) => GenericRespModel.fromJson(json),
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
ApiConsts.serviceProvidersAppointmentGet,
|
|
|
|
|
);
|
|
|
|
|
List<AppointmentListModel> appointmentList = List.generate(
|
|
|
|
|
genericRespModel.data.length,
|
|
|
|
|
(index) => AppointmentListModel.fromJson(genericRespModel.data[index]));
|
|
|
|
|
(index) =>
|
|
|
|
|
AppointmentListModel.fromJson(genericRespModel.data[index]));
|
|
|
|
|
return appointmentList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -227,21 +229,23 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
|
|
|
|
|
MResponse adsGenericModel =
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json),
|
|
|
|
|
ApiConsts.getAppointmentSlots,
|
|
|
|
|
token: t,
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
);
|
|
|
|
|
await injector.get<ApiClient>().getJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json),
|
|
|
|
|
ApiConsts.getAppointmentSlots,
|
|
|
|
|
token: t,
|
|
|
|
|
queryParameters: map,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return adsGenericModel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<MResponse> updateAppointmentPaymentStatus(Map<String, dynamic> map) async {
|
|
|
|
|
Future<MResponse> updateAppointmentPaymentStatus(
|
|
|
|
|
Map<String, dynamic> map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateAppointmentPaymentStatus, map,
|
|
|
|
|
(json) => MResponse.fromJson(json),
|
|
|
|
|
ApiConsts.updateAppointmentPaymentStatus, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -249,7 +253,17 @@ class AppointmentRepoImp implements AppointmentRepo {
|
|
|
|
|
Future<MResponse> updateAppointmentStatus(Map<String, dynamic> map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json), ApiConsts.updateAppointmentStatus, map,
|
|
|
|
|
(json) => MResponse.fromJson(json),
|
|
|
|
|
ApiConsts.updateAppointmentStatus, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<MResponse> createMergeAppointment(Map<String, dynamic> map) async {
|
|
|
|
|
String t = AppState().getUser.data!.accessToken ?? "";
|
|
|
|
|
return await injector.get<ApiClient>().postJsonForObject(
|
|
|
|
|
(json) => MResponse.fromJson(json),
|
|
|
|
|
ApiConsts.createMergeAppointment, map,
|
|
|
|
|
token: t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|