Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/AMP-30574/sectors mapping #4199

Open
wants to merge 87 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
5cf6e2e
AMP-30574 - Sector Mappings
drossi-dg Nov 20, 2023
620955b
AMP-30574 - Sector Mappings
drossi-dg Nov 24, 2023
4ae3e74
AMP-30574 - Sector Mappings
drossi-dg Nov 29, 2023
53e3435
AMP-30574 - Sector Mappings
drossi-dg Dec 6, 2023
370efad
AMP-30574 - Sector Mappings
drossi-dg Dec 7, 2023
257b4cc
AMP-30574 - Sector Mappings
drossi-dg Dec 12, 2023
a9842a6
AMP-30574 - Sector Mappings
drossi-dg Dec 13, 2023
131c9f6
AMP-30574 - Sector Mappings
drossi-dg Dec 15, 2023
2273c26
AMP-30574 - Sector Mappings
drossi-dg Dec 19, 2023
9dc8fcd
AMP-30574 - Sector Mappings
drossi-dg Jan 4, 2024
7d60264
merge develop
jdeanquin-dg Jun 11, 2024
e3ea6d6
AMP-30574
brianbrix Jun 13, 2024
5757e70
Merge remote-tracking branch 'origin/feature/AMP-30574/sectors-mappin…
brianbrix Jun 13, 2024
1a27bb7
AMP-30574
brianbrix Jun 13, 2024
2acd15d
AMP-30574
brianbrix Jun 13, 2024
30a15af
AMP-30574
brianbrix Jun 13, 2024
6733669
AMP-30574
brianbrix Jun 13, 2024
ccdb154
AMP-30574
brianbrix Jun 13, 2024
d687a16
AMP-30574
brianbrix Jun 13, 2024
869f3aa
AMP-30574
brianbrix Jun 13, 2024
eeb7d69
AMP-30574
brianbrix Jun 13, 2024
1ba157c
AMP-30574
brianbrix Jun 13, 2024
691053d
AMP-30574
brianbrix Jun 13, 2024
b09bbce
AMP-30574
brianbrix Jun 13, 2024
3f28498
AMP-30574
brianbrix Jun 13, 2024
e984e43
AMP-30574
brianbrix Jun 13, 2024
7d43474
AMP-30574
brianbrix Jun 13, 2024
565d8fc
AMP-30574
brianbrix Jun 13, 2024
1660a9c
AMP-30574
brianbrix Jun 13, 2024
6fc3367
AMP-30574
brianbrix Jun 13, 2024
753aa13
AMP-30574
brianbrix Jun 13, 2024
b786968
AMP-30574
brianbrix Jun 13, 2024
52c91ba
AMP-30574
brianbrix Jun 13, 2024
fe38740
AMP-30574
brianbrix Jun 13, 2024
581b174
AMP-30574
brianbrix Jun 13, 2024
b758f90
AMP-30574
brianbrix Jun 13, 2024
49f5a85
AMP-30574
brianbrix Jun 13, 2024
d2cac2d
AMP-30574
brianbrix Jun 13, 2024
ecea39e
AMP-30574
brianbrix Jun 13, 2024
146871a
AMP-30574
brianbrix Jun 13, 2024
84d741e
AMP-30574
brianbrix Jun 13, 2024
1b28c1a
AMP-30574
brianbrix Jun 13, 2024
27d9187
AMP-30574
brianbrix Jun 13, 2024
debb07b
AMP-30574
brianbrix Jun 13, 2024
493d6fd
AMP-30574
brianbrix Jun 14, 2024
c39648a
AMP-30574
brianbrix Jun 14, 2024
4c276ed
AMP-30574
brianbrix Jun 14, 2024
bcbca49
AMP-30574
brianbrix Jun 14, 2024
d5abda2
AMP-30574
brianbrix Jun 14, 2024
0c0bbca
AMP-30574
brianbrix Jun 14, 2024
d53021f
AMP-30574
brianbrix Jun 14, 2024
65be43f
AMP-30574
brianbrix Jun 14, 2024
3ebb00e
AMP-30574
brianbrix Jun 14, 2024
60934de
AMP-30574
brianbrix Jun 14, 2024
e955526
AMP-30574
brianbrix Jun 14, 2024
c57eab6
AMP-30574
brianbrix Jun 14, 2024
1e49775
AMP-30574
brianbrix Jun 14, 2024
2e0cb80
AMP-30574
brianbrix Jun 14, 2024
ba34ea8
AMP-30574
brianbrix Jun 14, 2024
cb555a9
AMP-30574
brianbrix Jun 14, 2024
def68ad
AMP-30574
brianbrix Jun 14, 2024
98d291b
AMP-30574
brianbrix Jun 14, 2024
e15dafb
AMP-30574
brianbrix Jun 14, 2024
762f622
AMP-30574
brianbrix Jun 14, 2024
d7162a9
AMP-30574
brianbrix Jun 14, 2024
cef4fb2
AMP-30574
brianbrix Jun 14, 2024
f976798
AMP-30574
brianbrix Jun 14, 2024
f725478
AMP-30574
brianbrix Jun 14, 2024
c6eb1f9
AMP-30574
brianbrix Jun 14, 2024
db84183
AMP-30574
brianbrix Jun 14, 2024
4190420
AMP-30574
brianbrix Jun 14, 2024
e0e3039
AMP-30574
brianbrix Jun 14, 2024
fb27805
AMP-30574
brianbrix Jun 14, 2024
32ee591
AMP-30574
brianbrix Jun 15, 2024
799fc18
AMP-30574
brianbrix Jun 15, 2024
90e2286
AMP-30574
brianbrix Jun 15, 2024
69b009a
AMP-30574
brianbrix Jun 15, 2024
1a0a62a
AMP-30574
brianbrix Jun 15, 2024
684c54e
AMP-30574
brianbrix Jun 15, 2024
28b5905
AMP-30574
brianbrix Jun 15, 2024
b23bc4d
AMP-30574
brianbrix Jun 15, 2024
abfd07e
AMP-30574
brianbrix Jun 15, 2024
ce087e5
AMP-30574
brianbrix Jun 15, 2024
939a3bc
AMP-30574
brianbrix Jun 15, 2024
b93df8b
AMP-30574
brianbrix Jun 16, 2024
acb7cc4
AMP-30574
brianbrix Jun 16, 2024
b4202f2
AMP-30574
brianbrix Jun 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions amp/TEMPLATE/reampv2/src/App.route.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const AdminNDDApp = lazy(() => import('./modules/admin/ndd'));
const NDDDashboardApp = lazy(() => import('./modules/ndddashboard'));
const ReportGeneratorApp = lazy(() => import('./modules/report_generator'));
const GeocoderApp = lazy(() => import('./modules/geocoder'));
const AdminSectorMappingApp = lazy(() => import('./modules/admin/sectorMapping'));

class AppRoute extends Component {
render() {
Expand All @@ -21,6 +22,7 @@ class AppRoute extends Component {
<Route path="/ndddashboard" component={NDDDashboardApp} />
<Route path="/report_generator" component={ReportGeneratorApp} />
<Route path="/geocoder" component={GeocoderApp}/>
<Route path="/sector-mapping" component={AdminSectorMappingApp}/>
</Suspense>
</Router>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
fetchSectorsSuccess,
fetchSectorsPending,
fetchSectorsError
} from './startupAction';

function fetchSectors(url, type) {
return dispatch => {
dispatch(fetchSectorsPending());
fetch(url + '/' + type)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchSectorsSuccess(res));
return res;
})
.catch(error => {
dispatch(fetchSectorsError(error));
});
};
}

export default fetchSectors;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { fetchLayoutSuccess, fetchLayoutPending, fetchLayoutError } from './layoutAction';
import { LAYOUT_EP } from '../constants/Constants';

function fetchLayout() {
return dispatch => {
dispatch(fetchLayoutPending());
return fetch(LAYOUT_EP)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchLayoutSuccess(res));
return res;
})
.catch(error => {
dispatch(fetchLayoutError(error));
});
};
}

export default fetchLayout;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {
fetchSchemesSuccess,
fetchSchemesPending,
fetchSchemesError
} from './startupAction';

function fetchSchemes(url) {
return dispatch => {
dispatch(fetchSchemesPending());
fetch(url)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchSchemesSuccess(res));
return res;
})
.catch(error => {
dispatch(fetchSchemesError(error));
});
};
}

export default fetchSchemes;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { fetchSectorMappingSuccess, fetchSectorMappingPending, fetchSectorMappingError } from './startupAction';

function fetchSectorMappings(url) {
return dispatch => {
dispatch(fetchSectorMappingPending());
fetch(url)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchSectorMappingSuccess(res));
return res;
})
.catch(error => {
dispatch(fetchSectorMappingError(error));
});
};
}

export default fetchSectorMappings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { fetchSettingsSuccess, fetchSettingsPending, fetchSettingsError } from './settingsAction';
import { SETTINGS_EP } from '../constants/Constants';

function fetchSettings() {
return dispatch => {
dispatch(fetchSettingsPending());
return fetch(SETTINGS_EP)
.then(res => res.json())
.then(res => {
if (res.error) {
throw (res.error);
}
dispatch(fetchSettingsSuccess(res));
return res;
})
.catch(error => {
dispatch(fetchSettingsError(error));
});
};
}

export default fetchSettings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const FETCH_LAYOUT_PENDING = 'FETCH_LAYOUT_PENDING';
export const FETCH_LAYOUT_SUCCESS = 'FETCH_LAYOUT_SUCCESS';
export const FETCH_LAYOUT_ERROR = 'FETCH_LAYOUT_ERROR';

export function fetchLayoutPending() {
return {
type: FETCH_LAYOUT_PENDING
};
}

export function fetchLayoutSuccess(layout) {
return {
type: FETCH_LAYOUT_SUCCESS,
payload: layout
};
}
export function fetchLayoutError(error) {
return {
type: FETCH_LAYOUT_ERROR,
error
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const SAVE_SECTOR_MAP_PENDING = 'SAVE_SECTOR_MAP_PENDING';
export const SAVE_SECTOR_MAP_SUCCESS = 'SAVE_SECTOR_MAP_SUCCESS';
export const SAVE_SECTOR_MAP_ERROR = 'SAVE_SECTOR_MAP_ERROR';

export function saveSectorMappingPending() {
return {
type: SAVE_SECTOR_MAP_PENDING
};
}

export function saveSectorMappingSuccess(mappings) {
return {
type: SAVE_SECTOR_MAP_SUCCESS,
payload: mappings
};
}

export function saveSectorMappingError(error) {
return {
type: SAVE_SECTOR_MAP_ERROR,
error
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {saveSectorMappingPending, saveSectorMappingSuccess, saveSectorMappingError} from './saveAction';
import {LAYOUT_EP} from '../constants/Constants';

function saveSectorMappings(mappings, urlSave) {
return dispatch => {
dispatch(saveSectorMappingPending());
fetch(LAYOUT_EP).then(layoutRes => layoutRes.json()).then(data => {
if (data.logged) {
fetch(urlSave, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(mappings)
}).then(response => {
processResponse(response);
dispatch(saveSectorMappingSuccess(response));
return response;
})
.catch(error => {
dispatch(saveSectorMappingError(error));
});
} else {
window.location.replace('/login.do');
dispatch(saveSectorMappingError({ error: 'not logged' }));
}
}).catch(error => {
dispatch(saveSectorMappingError(error));
});
};
}

function processResponse(response) {
if (response.status === 500 || response.error) {
if (response.error) {
throw (response.error);
} else {
throw (response.statusText);
}
}
}

export default saveSectorMappings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export const FETCH_SETTINGS_PENDING = 'FETCH_SETTINGS_PENDING';
export const FETCH_SETTINGS_SUCCESS = 'FETCH_SETTINGS_SUCCESS';
export const FETCH_SETTINGS_ERROR = 'FETCH_SETTINGS_ERROR';

export function fetchSettingsPending() {
return {
type: FETCH_SETTINGS_PENDING
};
}

export function fetchSettingsSuccess(settings) {
return {
type: FETCH_SETTINGS_SUCCESS,
payload: settings
};
}
export function fetchSettingsError(error) {
return {
type: FETCH_SETTINGS_ERROR,
error
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
export const FETCH_SECTOR_MAP_PENDING = 'FETCH_SECTOR_MAP_PENDING';
export const FETCH_SECTOR_MAP_SUCCESS = 'FETCH_SECTOR_MAP_SUCCESS';
export const FETCH_SECTOR_MAP_ERROR = 'FETCH_SECTOR_MAP_ERROR';
export const FETCH_SECTORS_PENDING = 'FETCH_SECTORS_PENDING';
export const FETCH_SECTORS_SUCCESS = 'FETCH_SECTORS_SUCCESS';
export const FETCH_SECTORS_ERROR = 'FETCH_SECTORS_ERROR';
export const FETCH_SCHEMES_PENDING = 'FETCH_SCHEMES_PENDING';
export const FETCH_SCHEMES_SUCCESS = 'FETCH_SCHEMES_SUCCESS';
export const FETCH_SCHEMES_ERROR = 'FETCH_SCHEMES_ERROR';

export function fetchSectorMappingPending() {
return {
type: FETCH_SECTOR_MAP_PENDING
};
}

export function fetchSectorMappingSuccess(sectorMapping) {
return {
type: FETCH_SECTOR_MAP_SUCCESS,
payload: sectorMapping
};
}
export function fetchSectorMappingError(error) {
return {
type: FETCH_SECTOR_MAP_ERROR,
error
};
}
export function fetchSectorsPending() {
return {
type: FETCH_SECTORS_PENDING
};
}

export function fetchSectorsSuccess(sectors) {
return {
type: FETCH_SECTORS_SUCCESS,
payload: sectors
};
}
export function fetchSectorsError(error) {
return {
type: FETCH_SECTORS_ERROR,
error
};
}


export function fetchSchemesPending() {
return {
type: FETCH_SCHEMES_PENDING
};
}

export function fetchSchemesSuccess(schemes) {
return {
type: FETCH_SCHEMES_SUCCESS,
payload: schemes
};
}
export function fetchSchemesError(error) {
return {
type: FETCH_SCHEMES_ERROR,
error
};
}

Loading