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.
		
		
		
		
		
			
		
			
				
	
	
		
			99 lines
		
	
	
		
			4.7 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			99 lines
		
	
	
		
			4.7 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/create_vacation_rule_list_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/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<GenericResponseModel> 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;
 | |
|     }, url, postParams);
 | |
|   }
 | |
| 
 | |
|   Future<CreateVacationRuleList?> createVacationRule(String pBeginDate, String pEndDate, String pItemType, String pNotificationName, String pMessage, String pAction, String pReplacementUserName,
 | |
|       List<Map<String, dynamic>> respondAttributeList) async {
 | |
|     String url = "${ApiConsts.erpRest}CREATE_VACATION_RULE";
 | |
|     Map<String, dynamic> postParams = {
 | |
|       "P_ITEM_TYPE": pItemType,
 | |
|       "P_NOTIFICATION_NAME": pNotificationName,
 | |
|       "P_BEGIN_DATE": pBeginDate,
 | |
|       "P_END_DATE": pEndDate,
 | |
|       "P_MESSAGE": pMessage,
 | |
|       "P_REPLACEMENT_USER_NAME": pReplacementUserName,
 | |
|       "P_ACTION": pAction,
 | |
|       "RespondAttributeList": respondAttributeList,
 | |
|     };
 | |
|     postParams.addAll(AppState().postParamsJson);
 | |
|     return await ApiClient().postJsonForObject((json) {
 | |
|       GenericResponseModel? responseData = GenericResponseModel.fromJson(json);
 | |
|       return responseData.createVacationRuleList;
 | |
|     }, 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);
 | |
|   }
 | |
| }
 |