vineanova-redux-artifacts 1.45.0 → 1.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4567,6 +4567,99 @@ import { VineaNovaActions } from '../actions'
4567
4567
  }
4568
4568
 
4569
4569
 
4570
+ export function* getlookupInactiveReasonSagas(action) {
4571
+ const {
4572
+ payload = {},
4573
+ meta: { reducerName },
4574
+ } = action;
4575
+ try {
4576
+ yield put({
4577
+ type: "FETCHING",
4578
+ name: reducerName,
4579
+ });
4580
+
4581
+ const response = yield call(APIServices.getlookupInactiveReason, payload);
4582
+ yield put({
4583
+ type: "SUCCESS",
4584
+ payload: response,
4585
+ name: reducerName,
4586
+ });
4587
+
4588
+
4589
+ } catch (err) {
4590
+ logger.error(err);
4591
+ /* istanbul ignore next */
4592
+ yield put({
4593
+ type: "ERROR",
4594
+ payload: err,
4595
+ name: reducerName,
4596
+ });
4597
+ }
4598
+ }
4599
+
4600
+
4601
+ export function* getlookupDocumentTypeSagas(action) {
4602
+ const {
4603
+ payload = {},
4604
+ meta: { reducerName },
4605
+ } = action;
4606
+ try {
4607
+ yield put({
4608
+ type: "FETCHING",
4609
+ name: reducerName,
4610
+ });
4611
+
4612
+ const response = yield call(APIServices.getlookupDocumentType, payload);
4613
+ yield put({
4614
+ type: "SUCCESS",
4615
+ payload: response,
4616
+ name: reducerName,
4617
+ });
4618
+
4619
+
4620
+ } catch (err) {
4621
+ logger.error(err);
4622
+ /* istanbul ignore next */
4623
+ yield put({
4624
+ type: "ERROR",
4625
+ payload: err,
4626
+ name: reducerName,
4627
+ });
4628
+ }
4629
+ }
4630
+
4631
+
4632
+ export function* getlookupDocumentStatusSagas(action) {
4633
+ const {
4634
+ payload = {},
4635
+ meta: { reducerName },
4636
+ } = action;
4637
+ try {
4638
+ yield put({
4639
+ type: "FETCHING",
4640
+ name: reducerName,
4641
+ });
4642
+
4643
+ const response = yield call(APIServices.getlookupDocumentStatus, payload);
4644
+ yield put({
4645
+ type: "SUCCESS",
4646
+ payload: response,
4647
+ name: reducerName,
4648
+ });
4649
+
4650
+
4651
+ } catch (err) {
4652
+ logger.error(err);
4653
+ /* istanbul ignore next */
4654
+ yield put({
4655
+ type: "ERROR",
4656
+ payload: err,
4657
+ name: reducerName,
4658
+ });
4659
+ }
4660
+ }
4661
+
4662
+
4570
4663
 
4571
4664
  /** run all lookups requests **/
4572
4665
  export function* fetchAllLookupsSagas(action) {
@@ -4700,6 +4793,15 @@ export function* fetchAllLookupsSagas(action) {
4700
4793
  yield put(
4701
4794
  VineaNovaActions.api.v1.lookupCropSettingOption.get.request(),
4702
4795
  );
4796
+ yield put(
4797
+ VineaNovaActions.api.v1.lookupInactiveReason.get.request(),
4798
+ );
4799
+ yield put(
4800
+ VineaNovaActions.api.v1.lookupDocumentType.get.request(),
4801
+ );
4802
+ yield put(
4803
+ VineaNovaActions.api.v1.lookupDocumentStatus.get.request(),
4804
+ );
4703
4805
  } catch (err) {
4704
4806
  logger.error(err);
4705
4807
  }
@@ -4898,6 +5000,9 @@ export default function* root() {
4898
5000
  takeLatest(VineaNovaActions.api.v1.lookupPhenologyMeasureType.get.request().type, getlookupPhenologyMeasureTypeSagas),
4899
5001
  takeLatest(VineaNovaActions.api.v1.lookupCropSettingInstance.get.request().type, getlookupCropSettingInstanceSagas),
4900
5002
  takeLatest(VineaNovaActions.api.v1.lookupCropSettingOption.get.request().type, getlookupCropSettingOptionSagas),
5003
+ takeLatest(VineaNovaActions.api.v1.lookupInactiveReason.get.request().type, getlookupInactiveReasonSagas),
5004
+ takeLatest(VineaNovaActions.api.v1.lookupDocumentType.get.request().type, getlookupDocumentTypeSagas),
5005
+ takeLatest(VineaNovaActions.api.v1.lookupDocumentStatus.get.request().type, getlookupDocumentStatusSagas),
4901
5006
  takeLatest(VineaNovaActions.api.v1.fetchAllLookups.request().type, fetchAllLookupsSagas),
4902
5007
  takeLatest((action)=> /CLEARDATA/.test(action.type), clearReducerData),
4903
5008
  takeLatest((action)=> /UPDATEPARTIALENTITY/.test(action.type), commonEntityPartialUpdateActionCreator),
@@ -90,4 +90,7 @@ export * from "./lookupPhenologyMeasureSetSelector";
90
90
  export * from "./lookupPhenologyMeasureTypeSelector";
91
91
  export * from "./lookupCropSettingInstanceSelector";
92
92
  export * from "./lookupCropSettingOptionSelector";
93
+ export * from "./lookupInactiveReasonSelector";
94
+ export * from "./lookupDocumentTypeSelector";
95
+ export * from "./lookupDocumentStatusSelector";
93
96
  export * from './lookupStatusSelector';
@@ -0,0 +1,64 @@
1
+ import { createSelector } from 'reselect';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import {isValid, format} from 'date-fns';
4
+ import isNil from 'lodash/isNil';
5
+ import has from 'lodash/has';
6
+
7
+
8
+ export const getlookupDocumentStatusEntity = state => state.entities.lookupDocumentStatus;
9
+
10
+ export const getlookupDocumentStatusEntityMeta = createSelector(
11
+ [getlookupDocumentStatusEntity],
12
+ reference => {
13
+ const { isLoading, isLoaded, hasError, error } = reference;
14
+ return {
15
+ isLoading,
16
+ isLoaded,
17
+ hasError,
18
+ error,
19
+ };
20
+ },
21
+ );
22
+
23
+ export const getlookupDocumentStatusEntityData = createSelector(
24
+ [getlookupDocumentStatusEntity],
25
+ reference => {
26
+ const { data = [] } = reference;
27
+ const refData = isEmpty(data) ? [] : data;
28
+ if (!Array.isArray(refData) || isNil(refData)) return [];
29
+
30
+ const formattedData = refData.map(d => {
31
+ let hasDates = false;
32
+ let fromDate = '';
33
+ let toDate = '';
34
+ let fromTo = '';
35
+
36
+ if(has(d, 'effectiveToDate') && has(d, 'effectiveFromDate')){
37
+ hasDates = true;
38
+ toDate =
39
+ !isEmpty(d.effectiveToDate) && isValid(new Date(d.effectiveToDate))
40
+ ? format(new Date(d.effectiveToDate), viewDateFormat)
41
+ : '';
42
+ fromDate =
43
+ !isEmpty(d.effectiveFromDate) &&
44
+ isValid(new Date(d.effectiveFromDate))
45
+ ? format(new Date(d.effectiveFromDate), viewDateFormat)
46
+ : '';
47
+ const seperator = toDate ? '-' : '';
48
+ fromToDate = `${fromDate} ${seperator} ${toDate}`;
49
+ }
50
+
51
+ return {
52
+ ...d,
53
+ ...(hasDates && {
54
+ fromDate,
55
+ toDate,
56
+ fromTo,
57
+ })
58
+ };
59
+ });
60
+
61
+ return formattedData;
62
+ },
63
+ );
64
+
@@ -0,0 +1,64 @@
1
+ import { createSelector } from 'reselect';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import {isValid, format} from 'date-fns';
4
+ import isNil from 'lodash/isNil';
5
+ import has from 'lodash/has';
6
+
7
+
8
+ export const getlookupDocumentTypeEntity = state => state.entities.lookupDocumentType;
9
+
10
+ export const getlookupDocumentTypeEntityMeta = createSelector(
11
+ [getlookupDocumentTypeEntity],
12
+ reference => {
13
+ const { isLoading, isLoaded, hasError, error } = reference;
14
+ return {
15
+ isLoading,
16
+ isLoaded,
17
+ hasError,
18
+ error,
19
+ };
20
+ },
21
+ );
22
+
23
+ export const getlookupDocumentTypeEntityData = createSelector(
24
+ [getlookupDocumentTypeEntity],
25
+ reference => {
26
+ const { data = [] } = reference;
27
+ const refData = isEmpty(data) ? [] : data;
28
+ if (!Array.isArray(refData) || isNil(refData)) return [];
29
+
30
+ const formattedData = refData.map(d => {
31
+ let hasDates = false;
32
+ let fromDate = '';
33
+ let toDate = '';
34
+ let fromTo = '';
35
+
36
+ if(has(d, 'effectiveToDate') && has(d, 'effectiveFromDate')){
37
+ hasDates = true;
38
+ toDate =
39
+ !isEmpty(d.effectiveToDate) && isValid(new Date(d.effectiveToDate))
40
+ ? format(new Date(d.effectiveToDate), viewDateFormat)
41
+ : '';
42
+ fromDate =
43
+ !isEmpty(d.effectiveFromDate) &&
44
+ isValid(new Date(d.effectiveFromDate))
45
+ ? format(new Date(d.effectiveFromDate), viewDateFormat)
46
+ : '';
47
+ const seperator = toDate ? '-' : '';
48
+ fromToDate = `${fromDate} ${seperator} ${toDate}`;
49
+ }
50
+
51
+ return {
52
+ ...d,
53
+ ...(hasDates && {
54
+ fromDate,
55
+ toDate,
56
+ fromTo,
57
+ })
58
+ };
59
+ });
60
+
61
+ return formattedData;
62
+ },
63
+ );
64
+
@@ -0,0 +1,64 @@
1
+ import { createSelector } from 'reselect';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import {isValid, format} from 'date-fns';
4
+ import isNil from 'lodash/isNil';
5
+ import has from 'lodash/has';
6
+
7
+
8
+ export const getlookupInactiveReasonEntity = state => state.entities.lookupInactiveReason;
9
+
10
+ export const getlookupInactiveReasonEntityMeta = createSelector(
11
+ [getlookupInactiveReasonEntity],
12
+ reference => {
13
+ const { isLoading, isLoaded, hasError, error } = reference;
14
+ return {
15
+ isLoading,
16
+ isLoaded,
17
+ hasError,
18
+ error,
19
+ };
20
+ },
21
+ );
22
+
23
+ export const getlookupInactiveReasonEntityData = createSelector(
24
+ [getlookupInactiveReasonEntity],
25
+ reference => {
26
+ const { data = [] } = reference;
27
+ const refData = isEmpty(data) ? [] : data;
28
+ if (!Array.isArray(refData) || isNil(refData)) return [];
29
+
30
+ const formattedData = refData.map(d => {
31
+ let hasDates = false;
32
+ let fromDate = '';
33
+ let toDate = '';
34
+ let fromTo = '';
35
+
36
+ if(has(d, 'effectiveToDate') && has(d, 'effectiveFromDate')){
37
+ hasDates = true;
38
+ toDate =
39
+ !isEmpty(d.effectiveToDate) && isValid(new Date(d.effectiveToDate))
40
+ ? format(new Date(d.effectiveToDate), viewDateFormat)
41
+ : '';
42
+ fromDate =
43
+ !isEmpty(d.effectiveFromDate) &&
44
+ isValid(new Date(d.effectiveFromDate))
45
+ ? format(new Date(d.effectiveFromDate), viewDateFormat)
46
+ : '';
47
+ const seperator = toDate ? '-' : '';
48
+ fromToDate = `${fromDate} ${seperator} ${toDate}`;
49
+ }
50
+
51
+ return {
52
+ ...d,
53
+ ...(hasDates && {
54
+ fromDate,
55
+ toDate,
56
+ fromTo,
57
+ })
58
+ };
59
+ });
60
+
61
+ return formattedData;
62
+ },
63
+ );
64
+
@@ -43,6 +43,9 @@ const getLkplookupPhenologyMeasureSet = state => state.entities.lookupPhenologyM
43
43
  const getLkplookupPhenologyMeasureType = state => state.entities.lookupPhenologyMeasureType;
44
44
  const getLkplookupCropSettingInstance = state => state.entities.lookupCropSettingInstance;
45
45
  const getLkplookupCropSettingOption = state => state.entities.lookupCropSettingOption;
46
+ const getLkplookupInactiveReason = state => state.entities.lookupInactiveReason;
47
+ const getLkplookupDocumentType = state => state.entities.lookupDocumentType;
48
+ const getLkplookupDocumentStatus = state => state.entities.lookupDocumentStatus;
46
49
 
47
50
  export const areLookupsLoading = createSelector(
48
51
  [
@@ -89,6 +92,9 @@ export const areLookupsLoading = createSelector(
89
92
  getLkplookupPhenologyMeasureType,
90
93
  getLkplookupCropSettingInstance,
91
94
  getLkplookupCropSettingOption,
95
+ getLkplookupInactiveReason,
96
+ getLkplookupDocumentType,
97
+ getLkplookupDocumentStatus,
92
98
  ],
93
99
  (
94
100
  lkplookupClassification,
@@ -134,6 +140,9 @@ export const areLookupsLoading = createSelector(
134
140
  lkplookupPhenologyMeasureType,
135
141
  lkplookupCropSettingInstance,
136
142
  lkplookupCropSettingOption,
143
+ lkplookupInactiveReason,
144
+ lkplookupDocumentType,
145
+ lkplookupDocumentStatus,
137
146
  ) => {
138
147
  const { isLoading: lookupClassificationIsLoading } = lkplookupClassification;
139
148
  const { isLoading: lookupClassificationGroupIsLoading } = lkplookupClassificationGroup;
@@ -178,6 +187,9 @@ export const areLookupsLoading = createSelector(
178
187
  const { isLoading: lookupPhenologyMeasureTypeIsLoading } = lkplookupPhenologyMeasureType;
179
188
  const { isLoading: lookupCropSettingInstanceIsLoading } = lkplookupCropSettingInstance;
180
189
  const { isLoading: lookupCropSettingOptionIsLoading } = lkplookupCropSettingOption;
190
+ const { isLoading: lookupInactiveReasonIsLoading } = lkplookupInactiveReason;
191
+ const { isLoading: lookupDocumentTypeIsLoading } = lkplookupDocumentType;
192
+ const { isLoading: lookupDocumentStatusIsLoading } = lkplookupDocumentStatus;
181
193
 
182
194
  return (
183
195
  lookupClassificationIsLoading ||
@@ -223,6 +235,9 @@ export const areLookupsLoading = createSelector(
223
235
  lookupPhenologyMeasureTypeIsLoading ||
224
236
  lookupCropSettingInstanceIsLoading ||
225
237
  lookupCropSettingOptionIsLoading ||
238
+ lookupInactiveReasonIsLoading ||
239
+ lookupDocumentTypeIsLoading ||
240
+ lookupDocumentStatusIsLoading ||
226
241
  false
227
242
  );
228
243
  },
@@ -274,6 +289,9 @@ export const areLookupsLoaded = createSelector(
274
289
  getLkplookupPhenologyMeasureType,
275
290
  getLkplookupCropSettingInstance,
276
291
  getLkplookupCropSettingOption,
292
+ getLkplookupInactiveReason,
293
+ getLkplookupDocumentType,
294
+ getLkplookupDocumentStatus,
277
295
  ],
278
296
  (
279
297
  lkplookupClassification,
@@ -319,6 +337,9 @@ export const areLookupsLoaded = createSelector(
319
337
  lkplookupPhenologyMeasureType,
320
338
  lkplookupCropSettingInstance,
321
339
  lkplookupCropSettingOption,
340
+ lkplookupInactiveReason,
341
+ lkplookupDocumentType,
342
+ lkplookupDocumentStatus,
322
343
  ) => {
323
344
  const { isLoaded: lookupClassificationIsLoaded } = lkplookupClassification;
324
345
  const { isLoaded: lookupClassificationGroupIsLoaded } = lkplookupClassificationGroup;
@@ -363,6 +384,9 @@ export const areLookupsLoaded = createSelector(
363
384
  const { isLoaded: lookupPhenologyMeasureTypeIsLoaded } = lkplookupPhenologyMeasureType;
364
385
  const { isLoaded: lookupCropSettingInstanceIsLoaded } = lkplookupCropSettingInstance;
365
386
  const { isLoaded: lookupCropSettingOptionIsLoaded } = lkplookupCropSettingOption;
387
+ const { isLoaded: lookupInactiveReasonIsLoaded } = lkplookupInactiveReason;
388
+ const { isLoaded: lookupDocumentTypeIsLoaded } = lkplookupDocumentType;
389
+ const { isLoaded: lookupDocumentStatusIsLoaded } = lkplookupDocumentStatus;
366
390
 
367
391
  return (
368
392
  lookupClassificationIsLoaded ||
@@ -408,6 +432,9 @@ export const areLookupsLoaded = createSelector(
408
432
  lookupPhenologyMeasureTypeIsLoaded ||
409
433
  lookupCropSettingInstanceIsLoaded ||
410
434
  lookupCropSettingOptionIsLoaded ||
435
+ lookupInactiveReasonIsLoaded ||
436
+ lookupDocumentTypeIsLoaded ||
437
+ lookupDocumentStatusIsLoaded ||
411
438
  false
412
439
  );
413
440
  },
@@ -4048,3 +4048,87 @@ import serviceConfig from "./config/serviceConfig";
4048
4048
  };
4049
4049
 
4050
4050
 
4051
+ export const getlookupInactiveReason = async (payload) => {
4052
+ try {
4053
+ const { queryParams, postBody, options } = payload || {};
4054
+ const { code = '' } = queryParams || {};
4055
+ const API_FUNCTION_CODE = process.env.REACT_APP_FUNCTION_CODE || code;
4056
+ let apiUrl = '/GetLookUp';
4057
+ const response = await serviceConfig.request({
4058
+ url: apiUrl,
4059
+ method: "get",
4060
+ params: {
4061
+ ...queryParams,
4062
+ code: API_FUNCTION_CODE,
4063
+ LookUpName: 'lookupInactiveReason'.replace('lookup',''),
4064
+ },
4065
+ headers: {
4066
+ "Content-Type": "application/json",
4067
+ Accept: "application/json",
4068
+ },
4069
+ ...options,
4070
+ });
4071
+ return response;
4072
+ } catch (err) {
4073
+ logger.error(err);
4074
+ throw err;
4075
+ }
4076
+ };
4077
+
4078
+
4079
+ export const getlookupDocumentType = async (payload) => {
4080
+ try {
4081
+ const { queryParams, postBody, options } = payload || {};
4082
+ const { code = '' } = queryParams || {};
4083
+ const API_FUNCTION_CODE = process.env.REACT_APP_FUNCTION_CODE || code;
4084
+ let apiUrl = '/GetLookUp';
4085
+ const response = await serviceConfig.request({
4086
+ url: apiUrl,
4087
+ method: "get",
4088
+ params: {
4089
+ ...queryParams,
4090
+ code: API_FUNCTION_CODE,
4091
+ LookUpName: 'lookupDocumentType'.replace('lookup',''),
4092
+ },
4093
+ headers: {
4094
+ "Content-Type": "application/json",
4095
+ Accept: "application/json",
4096
+ },
4097
+ ...options,
4098
+ });
4099
+ return response;
4100
+ } catch (err) {
4101
+ logger.error(err);
4102
+ throw err;
4103
+ }
4104
+ };
4105
+
4106
+
4107
+ export const getlookupDocumentStatus = async (payload) => {
4108
+ try {
4109
+ const { queryParams, postBody, options } = payload || {};
4110
+ const { code = '' } = queryParams || {};
4111
+ const API_FUNCTION_CODE = process.env.REACT_APP_FUNCTION_CODE || code;
4112
+ let apiUrl = '/GetLookUp';
4113
+ const response = await serviceConfig.request({
4114
+ url: apiUrl,
4115
+ method: "get",
4116
+ params: {
4117
+ ...queryParams,
4118
+ code: API_FUNCTION_CODE,
4119
+ LookUpName: 'lookupDocumentStatus'.replace('lookup',''),
4120
+ },
4121
+ headers: {
4122
+ "Content-Type": "application/json",
4123
+ Accept: "application/json",
4124
+ },
4125
+ ...options,
4126
+ });
4127
+ return response;
4128
+ } catch (err) {
4129
+ logger.error(err);
4130
+ throw err;
4131
+ }
4132
+ };
4133
+
4134
+