You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.8 KiB
Dart
79 lines
3.8 KiB
Dart
import 'package:mohem_flutter_app/api/api_client.dart';
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
import 'package:mohem_flutter_app/classes/consts.dart';
|
|
import 'package:mohem_flutter_app/models/generic_response_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/get_item_type_notifications_list_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/get_notification_reassign_mode_list_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/get_vacation_rules_list_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/respond_attributes_list_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/vr_item_types_list_model.dart';
|
|
import 'package:mohem_flutter_app/models/vacation_rule/wf_look_up_list_model.dart';
|
|
|
|
class VacationRuleApiClient {
|
|
static final VacationRuleApiClient _instance = VacationRuleApiClient._internal();
|
|
|
|
VacationRuleApiClient._internal();
|
|
|
|
factory VacationRuleApiClient() => _instance;
|
|
|
|
Future<List<GetVacationRulesList>> getVacationRules() async {
|
|
String url = "${ApiConsts.erpRest}GET_VACATION_RULES";
|
|
Map<String, dynamic> postParams = {"P_PAGE_LIMIT": 50, "P_PAGE_NUM": 1};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.getVacationRulesList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
|
|
Future<List<VrItemTypesList>> getVrItemTypes() async {
|
|
String url = "${ApiConsts.erpRest}GET_VR_ITEM_TYPES";
|
|
Map<String, dynamic> postParams = {};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.vrItemTypesList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
|
|
Future<List<GetItemTypeNotificationsList>> getItemTypeNotifications(String pItemType) async {
|
|
String url = "${ApiConsts.erpRest}GET_ITEM_TYPE_NOTIFICATIONS";
|
|
Map<String, dynamic> postParams = {"P_ITEM_TYPE": pItemType};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.getItemTypeNotificationsList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
|
|
Future<List<GetNotificationReassignModeList>> getNotificationReassignMode() async {
|
|
String url = "${ApiConsts.erpRest}GET_NOTIFICATION_REASSIGN_MODE";
|
|
Map<String, dynamic> postParams = {};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.getNotificationReassignModeList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
|
|
Future<List<RespondAttributesList>> getRespondAttributes(String pItemType, String pNotificationName) async {
|
|
String url = "${ApiConsts.erpRest}GET_RESPOND_ATTRIBUTES";
|
|
Map<String, dynamic> postParams = {"P_ITEM_TYPE": pItemType, "P_NOTIFICATION_NAME": pNotificationName};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.respondAttributesList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
|
|
Future<List<WFLookUpList>> getWfLookup(String pLookupType) async {
|
|
String url = "${ApiConsts.erpRest}GET_WF_LOOKUP";
|
|
Map<String, dynamic> postParams = {"P_LOOKUP_TYPE": pLookupType};
|
|
postParams.addAll(AppState().postParamsJson);
|
|
return await ApiClient().postJsonForObject((json) {
|
|
GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
|
|
return responseData.wFLookUpList ?? [];
|
|
}, url, postParams);
|
|
}
|
|
}
|