initial docker setup
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import {
|
||||
REQUEST_PACKAGE_DETAILS,
|
||||
RECIEVE_PACKAGE_DETAILS,
|
||||
SELECT_OPTION,
|
||||
SELECT_AGREEMENT,
|
||||
SELECT_ADDITIONAL,
|
||||
REMOVE_ADDITIONAL,
|
||||
CLEAR_SELECTIONS
|
||||
} from '../../constants/coMarketConstants';
|
||||
|
||||
const moduleReducers = {};
|
||||
|
||||
moduleReducers[REQUEST_PACKAGE_DETAILS] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
isLoading: action.isLoading
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[RECIEVE_PACKAGE_DETAILS] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
selectedPackage: action.selectedPackage,
|
||||
isLoading: action.isLoading
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[CLEAR_SELECTIONS] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
selectedOptions: action.selectedOptions,
|
||||
selectedAdditionals: action.selectedAdditionals,
|
||||
selectedAgreement: action.selectedAgreement
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[SELECT_AGREEMENT] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
selectedAgreement: action.selectedAgreement
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[SELECT_OPTION] = (state, action) => {
|
||||
const newOptions = Object.assign({}, state.selectedOptions, action.selectedOptions);
|
||||
return Object.assign({}, state, {
|
||||
selectedOptions: newOptions
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[SELECT_ADDITIONAL] = (state, action) => {
|
||||
const newState = {selectedAdditionals : []};
|
||||
newState.selectedAdditionals = state.selectedAdditionals ? newState.selectedAdditionals.concat(state.selectedAdditionals) : [];
|
||||
if(!newState.selectedAdditionals.includes(action.selectedAdditonal)){
|
||||
newState.selectedAdditionals.push(action.selectedAdditonal);
|
||||
}
|
||||
|
||||
return Object.assign({}, state, newState);
|
||||
};
|
||||
|
||||
moduleReducers[REMOVE_ADDITIONAL] = (state, action) => {
|
||||
const newState = {selectedAdditionals : []};
|
||||
newState.selectedAdditionals = state.selectedAdditionals ? newState.selectedAdditionals.concat(state.selectedAdditionals) : [];
|
||||
const indexOfElement = newState.selectedAdditionals.indexOf(action.selectedAdditonal);
|
||||
if(indexOfElement > -1){
|
||||
newState.selectedAdditionals.splice(indexOfElement, 1);
|
||||
}
|
||||
|
||||
return Object.assign({}, state, newState);
|
||||
};
|
||||
|
||||
const coMarketPackageDetailsReducer = (state = {}, action) => {
|
||||
|
||||
return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
|
||||
};
|
||||
|
||||
export default coMarketPackageDetailsReducer;
|
||||
40
frontend/src/reducers/coMarket/coMarketPackagesReducers.js
Normal file
40
frontend/src/reducers/coMarket/coMarketPackagesReducers.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
RECIEVE_SHOP_PACKAGES,
|
||||
RECIEVE_SHOP_COMMERCIAL_LEADS,
|
||||
SELECT_SHOP_COMMERCIAL_LEAD,
|
||||
REQUEST_SHOP_PACKAGES
|
||||
} from '../../constants/coMarketConstants';
|
||||
|
||||
const moduleReducers = {};
|
||||
|
||||
moduleReducers[REQUEST_SHOP_PACKAGES] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
isLoading: action.isLoading
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[RECIEVE_SHOP_PACKAGES] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
shopPackages: action.shopPackages,
|
||||
isLoading: action.isLoading
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[RECIEVE_SHOP_COMMERCIAL_LEADS] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
commercialLeads: action.commercialLeads
|
||||
});
|
||||
};
|
||||
|
||||
moduleReducers[SELECT_SHOP_COMMERCIAL_LEAD] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
selectedCommercialLead: action.selectedCommercialLead
|
||||
});
|
||||
};
|
||||
|
||||
const coMarketPackagesReducer = (state = {}, action) => {
|
||||
|
||||
return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
|
||||
};
|
||||
|
||||
export default coMarketPackagesReducer;
|
||||
18
frontend/src/reducers/coMarket/coMarketReducers.js
Normal file
18
frontend/src/reducers/coMarket/coMarketReducers.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import {
|
||||
SET_PACKAGE_FROM_URL
|
||||
} from '../../constants/coMarketConstants';
|
||||
|
||||
const moduleReducers = {};
|
||||
|
||||
moduleReducers[SET_PACKAGE_FROM_URL] = (state, action) => {
|
||||
return Object.assign({}, state, {
|
||||
idPackage: action.idPackage
|
||||
});
|
||||
};
|
||||
|
||||
const coMarketReducer = (state = {}, action) => {
|
||||
|
||||
return moduleReducers[action.type] ? moduleReducers[action.type](state, action) : state;
|
||||
};
|
||||
|
||||
export default coMarketReducer;
|
||||
Reference in New Issue
Block a user